Deprecation of old uniques

This commit is contained in:
yairm210
2021-10-20 21:35:13 +03:00
parent 50225101ea
commit dda2f6a37c
4 changed files with 10 additions and 49 deletions

View File

@ -176,15 +176,6 @@ class CityStats(val cityInfo: CityInfo) {
if (cityInfo.matchesFilter(unique.params[1]))
bonus += unique.params[0].toFloat()
}
// Deprecated since 3.16.14
for (unique in cityInfo.getMatchingUniques(UniqueType.GrowthPercentBonusPositive)) {
if (cityInfo.matchesFilter(unique.params[1]))
bonus += unique.params[0].toFloat()
}
for (unique in cityInfo.getMatchingUniques(UniqueType.GrowthPercentBonusWhenNotAtWar))
if (cityInfo.matchesFilter(unique.params[1]) && !cityInfo.civInfo.isAtWar())
bonus += unique.params[0].toFloat()
//
return bonus / 100
}
@ -197,10 +188,6 @@ class CityStats(val cityInfo: CityInfo) {
val specialist = cityInfo.getRuleset().specialists[specialistName]
?: return Stats()
val stats = specialist.clone()
// Deprecated since 3.16.11
for (unique in cityInfo.civInfo.getMatchingUniques(UniqueType.StatsFromSpecialistDeprecated))
stats.add(unique.stats)
//
for (unique in cityInfo.getMatchingUniques(UniqueType.StatsFromSpecialist))
if (cityInfo.matchesFilter(unique.params[1]))
stats.add(unique.stats)
@ -437,15 +424,6 @@ class CityStats(val cityInfo: CityInfo) {
else if (hasExtraAnnexUnhappiness())
unhappinessFromCitizens *= 2f
// Deprecated since 3.16.11
for (unique in civInfo.getMatchingUniques(UniqueType.UnhappinessFromPopulationPercentageChangeOld1))
unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100)
for (unique in civInfo.getMatchingUniques(UniqueType.UnhappinessFromPopulationPercentageChangeOld2))
if (cityInfo.matchesFilter(unique.params[1]))
unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100)
//
for (unique in cityInfo.getMatchingUniques(UniqueType.UnhappinessFromPopulationPercentageChange))
if (cityInfo.matchesFilter(unique.params[1]))
unhappinessFromCitizens *= unique.params[0].toPercent()

View File

@ -44,17 +44,6 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
numberOfUnitsToPayFor += numberOfUnitsWithDiscount * unique.params[0].toFloat() / 100f
}
for (unique in civInfo.getMatchingUniques(UniqueType.DecreasedUnitMaintenanceCostsByFilter)) {
val numberOfUnitsWithDiscount = min(
numberOfUnitsToPayFor,
unitsToPayFor.count { it.matchesFilter(unique.params[1]) }.toFloat()
)
numberOfUnitsToPayFor -= numberOfUnitsWithDiscount * unique.params[0].toFloat() / 100f
}
for (unique in civInfo.getMatchingUniques(UniqueType.DecreasedUnitMaintenanceCostsGlobally)) {
numberOfUnitsToPayFor *= 1f - unique.params[0].toFloat() / 100f
}
val turnLimit =
BASE_GAME_DURATION_TURNS * civInfo.gameInfo.gameParameters.gameSpeed.modifier
val gameProgress =

View File

@ -327,12 +327,6 @@ class MapUnit {
movement += 1
//
// Deprecated since 3.16.11
if (isEmbarked()) {
movement += civInfo.getMatchingUniques(UniqueType.EmbarkedUnitMovement1).count()
if (civInfo.hasUnique(UniqueType.EmbarkedUnitMovement2)) movement += 1
}
//
if (movement < 1) movement = 1

View File

@ -64,11 +64,11 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
Stats("[stats]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
StatsPerCity("[stats] [cityFilter]", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[stats] <if this city has at least [amount] specialists>"), DeprecationLevel.ERROR)
@Deprecated("As of 3.16.16 - removed as of 3.17.11", ReplaceWith("[stats] <if this city has at least [amount] specialists>"), DeprecationLevel.ERROR)
StatBonusForNumberOfSpecialists("[stats] if this city has at least [amount] specialists", UniqueTarget.Global),
StatsFromSpecialist("[stats] from every specialist [cityFilter]", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[stats] from every specialist [in all cities]"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.16 - removed as of 3.17.11", ReplaceWith("[stats] from every specialist [in all cities]"), DeprecationLevel.ERROR)
StatsFromSpecialistDeprecated("[stats] from every specialist", UniqueTarget.Global),
StatsPerPopulation("[stats] per [amount] population [cityFilter]", UniqueTarget.Global),
@ -100,9 +100,9 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
RemoveAnnexUnhappiness("Remove extra unhappiness from annexed cities", UniqueTarget.Building),
UnhappinessFromPopulationPercentageChange("[amount]% unhappiness from population [cityFilter]", UniqueTarget.Global),
@Deprecated("As of 3.16.11", ReplaceWith("[amount]% unhappiness from population [cityFilter]"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.11 - removed as of 3.17.11", ReplaceWith("[amount]% unhappiness from population [cityFilter]"), DeprecationLevel.ERROR)
UnhappinessFromPopulationPercentageChangeOld1("Unhappiness from population decreased by [amount]%", UniqueTarget.Global),
@Deprecated("As of 3.16.11", ReplaceWith("[amount]% unhappiness from population [cityFilter]"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.11 - removed as of 3.17.11", ReplaceWith("[amount]% unhappiness from population [cityFilter]"), DeprecationLevel.ERROR)
UnhappinessFromPopulationPercentageChangeOld2("Unhappiness from population decreased by [amount]% [cityFilter]", UniqueTarget.Global),
@ -127,18 +127,18 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
FreeUnits("[amount] units cost no maintenance", UniqueTarget.Global),
UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.16 - removed as of 3.17.11", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.ERROR)
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.ERROR)
DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UniqueTarget.Global),
ConsumesResources("Consumes [amount] [resource]", UniqueTarget.Improvement, UniqueTarget.Building, UniqueTarget.Unit),
ProvidesResources("Provides [amount] [resource]", UniqueTarget.Improvement, UniqueTarget.Building),
GrowthPercentBonus("[amount]% growth [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
@Deprecated("As of 3.16.14", ReplaceWith("[amount]% growth [cityFilter]"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.14 - removed as of 3.17.11", ReplaceWith("[amount]% growth [cityFilter]"), DeprecationLevel.ERROR)
GrowthPercentBonusPositive("+[amount]% growth [cityFilter]", UniqueTarget.Global),
@Deprecated("As of 3.16.14", ReplaceWith("[amount]% growth [cityFilter] <when not at war>"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.14", ReplaceWith("[amount]% growth [cityFilter] <when not at war>"), DeprecationLevel.ERROR)
GrowthPercentBonusWhenNotAtWar("+[amount]% growth [cityFilter] when not at war", UniqueTarget.Global),
GainFreeBuildings("Gain a free [buildingName] [cityFilter]", UniqueTarget.Global),
@ -221,9 +221,9 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
NormalVisionWhenEmbarked("Normal vision when embarked", UniqueTarget.Unit, UniqueTarget.Global),
CannotAttack("Cannot attack", UniqueTarget.Unit),
@Deprecated("As of 3.16.11", ReplaceWith("[+1] Movement <for [Embarked] units>"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.11 - removed as of 3.17.11", ReplaceWith("[+1] Movement <for [Embarked] units>"), DeprecationLevel.ERROR)
EmbarkedUnitMovement1("Increases embarked movement +1", UniqueTarget.Global),
@Deprecated("As of 3.16.11", ReplaceWith("[+1] Movement <for [Embarked] units>"), DeprecationLevel.WARNING)
@Deprecated("As of 3.16.11 - removed as of 3.17.11", ReplaceWith("[+1] Movement <for [Embarked] units>"), DeprecationLevel.ERROR)
EmbarkedUnitMovement2("+1 Movement for all embarked units", UniqueTarget.Global),
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Movement <for [mapUnitFilter] units>"), DeprecationLevel.WARNING)
MovementUnits("+[amount] Movement for all [mapUnitFilter] units", UniqueTarget.Global),