Mass deprecation

This commit is contained in:
Yair Morgenstern 2021-07-19 23:27:34 +03:00
parent 7039b6a287
commit 1070584180
7 changed files with 4 additions and 88 deletions

View File

@ -137,7 +137,7 @@ object BattleDamage {
}
}
for (unique in attacker.getCivInfo().getMatchingUniques("+[]% attack strength to all [] units for [] turns")) {
for (unique in attacker.getCivInfo().getMatchingUniques("[]% attack strength to all [] units for [] turns")) {
if (attacker.matchesCategory(unique.params[1])) {
modifiers.add("Temporary Bonus", unique.params[0].toInt())
}
@ -231,14 +231,6 @@ object BattleDamage {
if (tile.matchesFilter(filter, unit.getCivInfo()))
modifiers.add(filter, unique.params[0].toInt())
}
// Deprecated since 3.15
for (unique in unit.getCivInfo().getMatchingUniques("+[]% combat bonus for units fighting in []")) {
val filter = unique.params[1]
if (tile.matchesFilter(filter, unit.getCivInfo()))
modifiers.add(filter, unique.params[0].toInt())
}
//
for (unique in unit.getCivInfo()
.getMatchingUniques("+[]% Strength if within [] tiles of a []")) {

View File

@ -541,11 +541,6 @@ class CityStats {
for (unique in cityInfo.civInfo.getMatchingUniques("-[]% food consumption by specialists"))
foodEatenBySpecialists *= 1f - unique.params[0].toFloat() / 100f
// Deprecated since 3.15
if (cityInfo.civInfo.hasUnique("-50% food consumption by specialists"))
foodEatenBySpecialists *= 0.5f
//
foodEaten -= 2f * cityInfo.population.getNumberOfSpecialists() - foodEatenBySpecialists
}
}

View File

@ -47,10 +47,6 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
for (unique in civInfo.getMatchingUniques("-[]% unit upkeep costs")) {
cost *= 1f - unique.params[0].toFloat() / 100f
}
// Deprecated since 3.15
if (civInfo.hasUnique("-33% unit upkeep costs")) cost *= 0.67f
//
return cost.toInt()
}
@ -114,14 +110,6 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
)
)
}
// Deprecated since 3.15.1
if (otherCiv.isCityState() && otherCiv.getDiplomacyManager(civInfo.civName).relationshipLevel() >= RelationshipLevel.Ally) {
val sciencePercentage = civInfo
.getMatchingUniques("Allied City-States provide Science equal to []% of what they produce for themselves")
.sumBy { it.params[0].toInt() }
statMap.add("City-States", Stats().apply { science = otherCiv.statsForNextTurn.science * (sciencePercentage / 100f) })
}
//
}
statMap["Transportation upkeep"] = Stats().apply { gold = -getTransportationUpkeep().toFloat() }

View File

@ -231,11 +231,6 @@ class CivilizationInfo {
resourceModifier *= 1f + getMatchingUniques("Quantity of strategic resources produced by the empire +[]%")
.map { it.params[0].toFloat() / 100f }.sum()
// Deprecated since 3.15
if (hasUnique("Quantity of strategic resources produced by the empire increased by 100%")) {
resourceModifier *= 2f
}
//
}
return resourceModifier.toInt()
}

View File

@ -217,11 +217,7 @@ class MapUnit {
visibilityRange += getMatchingUniques("[] Visibility Range").sumBy { it.params[0].toInt() }
if (hasUnique("Limited Visibility")) visibilityRange -= 1
// Deprecated since 3.15.6
visibilityRange += getUniques().count { it.text == "+1 Visibility Range" }
if (hasUnique("+2 Visibility Range")) visibilityRange += 2 // This shouldn't be stackable
//
// Deprecated since 3.15.1
if (civInfo.hasUnique("+1 Sight for all land military units") && type.isMilitary() && type.isLandUnit())
visibilityRange += 1
@ -356,11 +352,6 @@ class MapUnit {
if (matchesFilter(unique.params[0]))
goldCostOfUpgrade *= (1 - unique.params[1].toFloat() / 100f)
}
// Deprecated since 3.14.17
if (civInfo.hasUnique("Gold cost of upgrading military units reduced by 33%")) {
goldCostOfUpgrade *= 0.67f
}
//
if (goldCostOfUpgrade < 0) return 0 // For instance, Landsknecht costs less than Spearman, so upgrading would cost negative gold
return goldCostOfUpgrade.toInt()
@ -391,13 +382,7 @@ class MapUnit {
}
private fun adjacentHealingBonus(): Int {
var healingBonus = 0
healingBonus += getMatchingUniques("All adjacent units heal [] HP when healing").sumBy { it.params[0].toInt() }
// Deprecated since 3.15.6
if (hasUnique("This unit and all others in adjacent tiles heal 5 additional HP per turn")) healingBonus += 5
if (hasUnique("This unit and all others in adjacent tiles heal 5 additional HP. This unit heals 5 additional HP outside of friendly territory.")) healingBonus += 5
//
return healingBonus
return getMatchingUniques("All adjacent units heal [] HP when healing").sumBy { it.params[0].toInt() }
}
fun canGarrison() = type.isMilitary() && type.isLandUnit()
@ -527,9 +512,6 @@ class MapUnit {
var amountToHealBy = rankTileForHealing(getTile())
if (amountToHealBy == 0 && !(hasUnique("May heal outside of friendly territory") && !getTile().isFriendlyTerritory(civInfo))) return
// Deprecated since 3.15.6
if (hasUnique("+10 HP when healing")) amountToHealBy += 10
//
amountToHealBy += getMatchingUniques("[] HP when healing").sumBy { it.params[0].toInt() }
val maxAdjacentHealingBonus = currentTile.getTilesInDistance(1)
@ -562,12 +544,6 @@ class MapUnit {
val mayHeal = healing > 0 || (tileInfo.isWater && hasUnique("May heal outside of friendly territory"))
if (!mayHeal) return healing
// Deprecated since 3.15.6
if (hasUnique("This unit and all others in adjacent tiles heal 5 additional HP. This unit heals 5 additional HP outside of friendly territory.")
&& !isFriendlyTerritory
)// Additional healing from medic is only applied when the unit is able to heal
healing += 5
//
for (unique in getMatchingUniques("[] HP when healing in [] tiles")) {
if (tileInfo.matchesFilter(unique.params[1], civInfo)) {
@ -596,11 +572,6 @@ class MapUnit {
getTile().improvementInProgress != null
&& canBuildImprovement(getTile().getTileImprovementInProgress()!!)
) workOnImprovement()
// unique "Can construct roads" deprecated since 3.15.4
if (currentMovement > 0 && hasUnique("Can construct roads")
&& currentTile.improvementInProgress == "Road"
) workOnImprovement()
//
if (currentMovement == getMaxMovement().toFloat() && isFortified()) {
val currentTurnsFortified = getFortificationTurns()
if (currentTurnsFortified < 2)
@ -914,9 +885,6 @@ class MapUnit {
var damageFactor = 1f
for (unique in getMatchingUniques("Damage taken from interception reduced by []%"))
damageFactor *= 1f - unique.params[0].toFloat() / 100f
// Deprecated since 3.15.6
damageFactor *= 0.5f.pow(getUniques().count{it.text == "Reduces damage taken from interception by 50%"})
// End deprecation
return damageFactor
}

View File

@ -93,9 +93,6 @@ object UniqueTriggerActivation {
"[] Free Technologies" -> if (!civInfo.isSpectator()) civInfo.tech.freeTechs += unique.params[0].toInt()
"Quantity of strategic resources produced by the empire increased by 100%" -> civInfo.updateDetailedCivResources()
// Deprecated since 3.15
"+20% attack bonus to all Military Units for 30 turns" -> civInfo.temporaryUniques.add(Pair(unique, 30))
//
"+[]% attack strength to all [] Units for [] turns" -> civInfo.temporaryUniques.add(Pair(unique, unique.params[2].toInt()))
"Reveals the entire map" -> civInfo.exploredTiles.addAll(civInfo.gameInfo.tileMap.values.asSequence().map { it.position })

View File

@ -10,7 +10,6 @@ import com.unciv.logic.civilization.PlayerType
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo
import com.unciv.models.UncivSound
import com.unciv.models.UnitAction
@ -58,9 +57,6 @@ object UnitActions {
addSetupAction(unit, actionList)
addFoundCityAction(unit, actionList, tile)
addWorkerActions(unit, actionList, tile, worldScreen, unitTable)
// Deprecated since 3.15.4
addConstructRoadsAction(unit, tile, actionList)
//
addCreateWaterImprovements(unit, actionList)
addGreatPersonActions(unit, actionList, tile)
addFoundReligionAction(unit, actionList, tile)
@ -129,22 +125,7 @@ object UnitActions {
unit.destroy()
}.takeIf { unit.currentMovement > 0 })
}
// This entire function is deprecated since 3.15.4, as the 'can construct roads' unique is deprecated
private fun addConstructRoadsAction(unit: MapUnit, tile: TileInfo, actionList: ArrayList<UnitAction>) {
val improvement = RoadStatus.Road.improvement(unit.civInfo.gameInfo.ruleSet) ?: return
if (unit.hasUnique("Can construct roads")
&& tile.roadStatus == RoadStatus.None
&& tile.improvementInProgress != "Road"
&& tile.isLand
&& (improvement.techRequired == null || unit.civInfo.tech.isResearched(improvement.techRequired!!)))
actionList += UnitAction(UnitActionType.ConstructRoad,
action = {
tile.improvementInProgress = "Road"
tile.turnsToImprovement = improvement.getTurnsToBuild(unit.civInfo)
}.takeIf { unit.currentMovement > 0 })
}
//
private fun addFoundCityAction(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
val getFoundCityAction = getFoundCityAction(unit, tile)