From 871dcfaf7d1660c51952b7d9ae25e01a42ae480a Mon Sep 17 00:00:00 2001 From: yairm210 Date: Wed, 19 Jan 2022 14:42:09 +0200 Subject: [PATCH] Deprecated old uniques --- .../com/unciv/logic/city/CityConstructions.kt | 16 +++------------ core/src/com/unciv/logic/map/TileInfo.kt | 20 +++++-------------- .../unciv/models/ruleset/tech/Technology.kt | 19 ------------------ .../unciv/models/ruleset/unique/UniqueType.kt | 17 ++++++++-------- docs/uniques.md | 8 ++++---- 5 files changed, 20 insertions(+), 60 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 0d3bf1488b..1bbab6c4aa 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -88,15 +88,6 @@ class CityConstructions { val stats = Stats() for (building in getBuiltBuildings()) stats.add(building.getStats(cityInfo)) - - - // Deprecated since 3.17.11 - for (unique in cityInfo.getLocalMatchingUniques(UniqueType.StatsWithTech)) { - if (cityInfo.civInfo.tech.isResearched(unique.params[1])) - stats.add(unique.stats) - } - // - return stats } @@ -139,10 +130,9 @@ class CityConstructions { fun addFreeBuildings() { // "Gain a free [buildingName] [cityFilter]" - val uniqueList = cityInfo.getLocalMatchingUniques(UniqueType.GainFreeBuildings, StateForConditionals(cityInfo.civInfo, cityInfo)).toMutableList() - // Deprecated - "Provides a free [buildingName] [cityFilter]" - uniqueList.addAll(cityInfo.getLocalMatchingUniques(UniqueType.ProvidesFreeBuildings, StateForConditionals(cityInfo.civInfo, cityInfo))) - for (unique in uniqueList) { + val freeBuildingUniques = cityInfo.getLocalMatchingUniques(UniqueType.GainFreeBuildings, StateForConditionals(cityInfo.civInfo, cityInfo)) + + for (unique in freeBuildingUniques) { val freeBuildingName = cityInfo.civInfo.getEquivalentBuilding(unique.params[0]).name val citiesThatApply = when (unique.params[1]) { "in this city" -> listOf(cityInfo) diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index f3a69f8544..9e6052d2b3 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -377,26 +377,16 @@ open class TileInfo { if (hasViewableResource(observingCiv) && tileResource.improvement == improvement.name) stats.add(tileResource.improvementStats!!.clone()) // resource-specific improvement - // Deprecated since 3.17.10 - for (unique in improvement.getMatchingUniques(UniqueType.StatsWithTech)) { - if (observingCiv.tech.isResearched(unique.params[1])) - stats.add(unique.stats) - } - // - - for (unique in improvement.getMatchingUniques(UniqueType.Stats, StateForConditionals(civInfo = observingCiv, cityInfo = city))) { + val conditionalState = StateForConditionals(civInfo = observingCiv, cityInfo = city) + for (unique in improvement.getMatchingUniques(UniqueType.Stats, conditionalState)) { stats.add(unique.stats) } if (city != null) { - val tileUniques = city.getMatchingUniques(UniqueType.StatsFromTiles, StateForConditionals(civInfo = observingCiv, cityInfo = city)) + val tileUniques = city.getMatchingUniques(UniqueType.StatsFromTiles, conditionalState) .filter { city.matchesFilter(it.params[2]) } - val improvementUniques = - // Deprecated since 3.17.10 - improvement.getMatchingUniques(UniqueType.StatsOnTileWithTech) - .filter { observingCiv.tech.isResearched(it.params[2]) } + - // - improvement.getMatchingUniques(UniqueType.ImprovementStatsOnTile, StateForConditionals(civInfo = observingCiv, cityInfo = city)) + val improvementUniques = + improvement.getMatchingUniques(UniqueType.ImprovementStatsOnTile, conditionalState) for (unique in tileUniques + improvementUniques) { if (improvement.matchesFilter(unique.params[1]) diff --git a/core/src/com/unciv/models/ruleset/tech/Technology.kt b/core/src/com/unciv/models/ruleset/tech/Technology.kt index a6e0b395c3..2621f8698c 100644 --- a/core/src/com/unciv/models/ruleset/tech/Technology.kt +++ b/core/src/com/unciv/models/ruleset/tech/Technology.kt @@ -39,13 +39,6 @@ class Technology: RulesetObject() { for (improvement in ruleset.tileImprovements.values) { for (unique in improvement.uniqueObjects) { - // Deprecated since 3.17.10 - if (unique.isOfType(UniqueType.StatsWithTech) && unique.params.last() == name) - lineList += "[${unique.params[0]}] from every [${improvement.name}]" - else if (unique.isOfType(UniqueType.StatsOnTileWithTech) && unique.params.last() == name) - lineList += "[${unique.params[0]}] from every [${improvement.name}] on [${unique.params[1]}] tiles" - else - // if (unique.isOfType(UniqueType.Stats)) { val requiredTech = unique.conditionals.firstOrNull { it.isOfType(UniqueType.ConditionalTech) }?.params?.get(0) if (requiredTech != name) continue @@ -217,18 +210,6 @@ class Technology: RulesetObject() { var wantEmpty = true for (improvement in ruleset.tileImprovements.values) for (unique in improvement.uniqueObjects) { - // Deprecated since 3.17.10 - if (unique.isOfType(UniqueType.StatsWithTech) && unique.params.last() == name) { - if (wantEmpty) { lineList += FormattedLine(); wantEmpty = false } - lineList += FormattedLine("[${unique.params[0]}] from every [${improvement.name}]", - link = improvement.makeLink()) - } else if (unique.isOfType(UniqueType.StatsOnTileWithTech) && unique.params.last() == name) { - if (wantEmpty) { lineList += FormattedLine(); wantEmpty = false } - lineList += FormattedLine("[${unique.params[0]}] from every [${improvement.name}] on [${unique.params[1]}] tiles", - link = improvement.makeLink()) - } - else - // if (unique.isOfType(UniqueType.Stats)) { val requiredTech = unique.conditionals.firstOrNull { it.isOfType(UniqueType.ConditionalTech) }?.params?.get(0) if (requiredTech != name) continue diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 896d29f13b..2f1ca504ad 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -145,8 +145,6 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: GainFreeBuildings("Gain a free [buildingName] [cityFilter]", UniqueTarget.Global), - @Deprecated("As of 3.17.7", ReplaceWith("Gain a free [buildingName] [cityFilter]"), DeprecationLevel.WARNING) - ProvidesFreeBuildings("Provides a free [buildingName] [cityFilter]", UniqueTarget.Global), FreeExtraBeliefs("May choose [amount] additional [beliefType] beliefs when [foundingOrEnhancing] a religion", UniqueTarget.Global), FreeExtraAnyBeliefs("May choose [amount] additional belief(s) of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global), @@ -457,10 +455,6 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: ////// region Improvement uniques ImprovementBuildableByFreshWater("Can also be built on tiles adjacent to fresh water", UniqueTarget.Improvement), ImprovementStatsOnTile("[stats] from [tileFilter] tiles", UniqueTarget.Improvement), - @Deprecated("As of 3.17.10", ReplaceWith("[stats] from [tileFilter] tiles "), DeprecationLevel.WARNING) - StatsOnTileWithTech("[stats] on [tileFilter] tiles once [tech] is discovered", UniqueTarget.Improvement), - @Deprecated("As of 3.17.10", ReplaceWith("[stats] "), DeprecationLevel.WARNING) - StatsWithTech("[stats] once [tech] is discovered", UniqueTarget.Improvement, UniqueTarget.Building), ImprovementStatsForAdjacencies("[stats] for each adjacent [tileFilter]", UniqueTarget.Improvement), CanBuildOutsideBorders("Can be built outside your borders", UniqueTarget.Improvement), @@ -475,8 +469,6 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: DamagesAdjacentEnemyUnits("Adjacent enemy units ending their turn take [amount] damage", UniqueTarget.Improvement), @Deprecated("As of 3.18.17", ReplaceWith("Adjacent enemy units ending their turn take [30] damage"), DeprecationLevel.WARNING) DamagesAdjacentEnemyUnitsOld("Deal [amount] damage to adjacent enemy units", UniqueTarget.Improvement), - @Deprecated("As of 3.17.10", ReplaceWith("Adjacent enemy units ending their turn take [30] damage"), DeprecationLevel.WARNING) - DamagesAdjacentEnemyUnitsForExactlyThirtyDamage("Deal 30 damage to adjacent enemy units", UniqueTarget.Improvement), GreatImprovement("Great Improvement", UniqueTarget.Improvement), IsAncientRuinsEquivalent("Provides a random bonus when entered", UniqueTarget.Improvement), @@ -589,7 +581,14 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: // region DEPRECATED AND REMOVED - + @Deprecated("As of 3.17.10 - removed 3.18.19", ReplaceWith("[stats] from [tileFilter] tiles "), DeprecationLevel.ERROR) + StatsOnTileWithTech("[stats] on [tileFilter] tiles once [tech] is discovered", UniqueTarget.Improvement), + @Deprecated("As of 3.17.10 - removed 3.18.19", ReplaceWith("[stats] "), DeprecationLevel.ERROR) + StatsWithTech("[stats] once [tech] is discovered", UniqueTarget.Improvement, UniqueTarget.Building), + @Deprecated("As of 3.17.10 - removed 3.18.19", ReplaceWith("Adjacent enemy units ending their turn take [30] damage"), DeprecationLevel.ERROR) + DamagesAdjacentEnemyUnitsForExactlyThirtyDamage("Deal 30 damage to adjacent enemy units", UniqueTarget.Improvement), + @Deprecated("As of 3.17.7 - removed 3.18.19", ReplaceWith("Gain a free [buildingName] [cityFilter]"), DeprecationLevel.ERROR) + ProvidesFreeBuildings("Provides a free [buildingName] [cityFilter]", UniqueTarget.Global), @Deprecated("As of 3.17.10 - removed 3.18.18", ReplaceWith("[+amount]% [stat] [cityFilter]"), DeprecationLevel.ERROR) StatPercentBonusCitiesDeprecated("+[amount]% [stat] [cityFilter]", UniqueTarget.Global), @Deprecated("As of 3.17.10 - removed 3.18.18", ReplaceWith("[+amount]% [stat] [in all cities]"), DeprecationLevel.ERROR) diff --git a/docs/uniques.md b/docs/uniques.md index 973506d37e..384bcb452d 100644 --- a/docs/uniques.md +++ b/docs/uniques.md @@ -1284,7 +1284,6 @@ Applicable to: Conditional - "City-State Influence degrades [amount]% slower" - Deprecated As of 3.18.17, replace with "[-amount]% City-State Influence degradation" - "Quantity of Resources gifted by City-States increased by [amount]%" - Deprecated As of 3.18.17, replace with "[+amount]% resources gifted by City-States" - "Happiness from Luxury Resources gifted by City-States increased by [amount]%" - Deprecated As of 3.18.17, replace with "[+amount]% Happiness from luxury resources gifted by City-States" - - "Provides a free [buildingName] [cityFilter]" - Deprecated As of 3.17.7, replace with "Gain a free [buildingName] [cityFilter]" - "-[amount]% food consumption by specialists [cityFilter]" - Deprecated As of 3.18.2, replace with "[-amount]% Food consumption by specialists [cityFilter]" - "50% of excess happiness added to culture towards policies" - Deprecated As of 3.18.2, replace with "[50]% of excess happiness converted to [Culture]" - "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] starting from the [era] at an increasing price ([amount])" - Deprecated As of 3.17.9, replace with "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount]) " @@ -1302,6 +1301,7 @@ Applicable to: Conditional - "Melee units pay no movement cost to pillage" - Deprecated As of 3.18.17, replace with "No movement cost to pillage " - "[mapUnitFilter] units gain [amount]% more Experience from combat" - Deprecated As of 3.18.12, replace with "[amount]% XP gained from combat " - "[amount]% maintenance costs for [mapUnitFilter] units" - Deprecated As of 3.18.14, replace with "[amount]% maintenance costs " + - "Provides a free [buildingName] [cityFilter]" - Deprecated As of 3.17.7 - removed 3.18.19, replace with "Gain a free [buildingName] [cityFilter]" - "+[amount]% [stat] [cityFilter]" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [cityFilter]" - "+[amount]% [stat] in all cities" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [in all cities]" - "[amount]% [stat] while the empire is happy" - Deprecated As of 3.17.1 - removed 3.18.18, replace with "[amount]% [stat] [in all cities] " @@ -1321,7 +1321,7 @@ Applicable to: Conditional - "+[amount]% Production when constructing a [buildingName]" - Deprecated As of 3.17.10 - removed 3.18.5, replace with "[amount]% Production when constructing [buildingFilter] buildings [cityFilter]" - "+[amount]% Production when constructing [constructionFilter] [cityFilter]" - Deprecated As of 3.17.10 - removed 3.18.5, replace with "[amount]% Production when constructing [buildingFilter] buildings [cityFilter]" - "Not displayed as an available construction unless [buildingName] is built" - Deprecated As of 3.16.11, replace with "Not displayed as an available construction without [buildingName]" - - "[stats] once [tech] is discovered" - Deprecated As of 3.17.10, replace with "[stats] " + - "[stats] once [tech] is discovered" - Deprecated As of 3.17.10 - removed 3.18.19, replace with "[stats] " - "Cannot enter ocean tiles until Astronomy" - Deprecated As of 3.18.6, replace with "Cannot enter ocean tiles " - "[amount]% Bonus XP gain" - Deprecated As of 3.18.12, replace with "[amount]% XP gained from combat" - "+[amount]% Strength when attacking" - Deprecated As of 3.17.5 - removed 3.18.5, replace with "[amount]% Strength " @@ -1331,7 +1331,7 @@ Applicable to: Conditional - "+[amount]% Strength in [tileFilter]" - Deprecated As of 3.17.5 - removed 3.18.5, replace with "[amount]% Strength " - "[amount] Visibility Range" - Deprecated As of 3.17.5 - removed 3.18.5, replace with "[amount] Sight" - "Limited Visibility" - Deprecated As of 3.17.5 - removed 3.18.5, replace with "[-1] Sight" - - "[stats] on [tileFilter] tiles once [tech] is discovered" - Deprecated As of 3.17.10, replace with "[stats] from [tileFilter] tiles " - "Cannot be built on [tileFilter] tiles until [tech] is discovered" - Deprecated As of 3.18.5, replace with "Cannot be built on [tileFilter] tiles " - "Deal [amount] damage to adjacent enemy units" - Deprecated As of 3.18.17, replace with "Adjacent enemy units ending their turn take [30] damage" - - "Deal 30 damage to adjacent enemy units" - Deprecated As of 3.17.10, replace with "Adjacent enemy units ending their turn take [30] damage" \ No newline at end of file + - "[stats] on [tileFilter] tiles once [tech] is discovered" - Deprecated As of 3.17.10 - removed 3.18.19, replace with "[stats] from [tileFilter] tiles " + - "Deal 30 damage to adjacent enemy units" - Deprecated As of 3.17.10 - removed 3.18.19, replace with "Adjacent enemy units ending their turn take [30] damage" \ No newline at end of file