Typed deprecated uniques so modders have warnings

This commit is contained in:
yairm210 2021-10-17 22:15:46 +03:00
parent ef2f2eccde
commit 8b2bb8e59b
3 changed files with 17 additions and 5 deletions

View File

@ -420,15 +420,15 @@ class CityStats(val cityInfo: CityInfo) {
unhappinessFromCitizens *= 2f
// Deprecated since 3.16.11
for (unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []%"))
for (unique in civInfo.getMatchingUniques(UniqueType.UnhappinessFromPopulationPercentageChangeOld1))
unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100)
for (unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []% []"))
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("[]% unhappiness from population []"))
for (unique in cityInfo.getMatchingUniques(UniqueType.UnhappinessFromPopulationPercentageChange))
if (cityInfo.matchesFilter(unique.params[1]))
unhappinessFromCitizens *= unique.params[0].toPercent()

View File

@ -328,8 +328,8 @@ class MapUnit {
// Deprecated since 3.16.11
if (isEmbarked()) {
movement += civInfo.getMatchingUniques("Increases embarked movement +1").count()
if (civInfo.hasUnique("+1 Movement for all embarked units")) movement += 1
movement += civInfo.getMatchingUniques(UniqueType.EmbarkedUnitMovement1).count()
if (civInfo.hasUnique(UniqueType.EmbarkedUnitMovement2)) movement += 1
}
//

View File

@ -71,6 +71,14 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
BonusStatsFromCityStates("[amount]% [stat] from City-States", UniqueTarget.Global),
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)
UnhappinessFromPopulationPercentageChangeOld1("Unhappiness from population decreased by [amount]%", UniqueTarget.Global),
@Deprecated("As of 3.16.11", ReplaceWith("[amount]% unhappiness from population [cityFilter]"), DeprecationLevel.WARNING)
UnhappinessFromPopulationPercentageChangeOld2("Unhappiness from population decreased by [amount]% [cityFilter]", 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)
@ -178,6 +186,10 @@ 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)
EmbarkedUnitMovement1("Increases embarked movement +1", UniqueTarget.Global),
@Deprecated("As of 3.16.11", ReplaceWith("[+1] Movement <for [Embarked] units>"), DeprecationLevel.WARNING)
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),
@Deprecated("As of 3.17.5", ReplaceWith("[amount] Movement <for [All] units> <during a Golden Age>"), DeprecationLevel.WARNING)