From d825352bf42181c4e49c34ec9096de1b54272b1a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 14 Apr 2021 18:52:10 +0300 Subject: [PATCH] Converted all "Bonus vs unitType" effects to "+[amount]% Strength vs [unitType]" Open terrain and rough terrain bonuses are now generic and uniques --- .../jsons/Civ V - Vanilla/Terrains.json | 12 ++-- .../jsons/Civ V - Vanilla/UnitPromotions.json | 70 +++++++++---------- .../com/unciv/logic/battle/BattleDamage.kt | 4 +- core/src/com/unciv/logic/map/TileInfo.kt | 2 +- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/android/assets/jsons/Civ V - Vanilla/Terrains.json b/android/assets/jsons/Civ V - Vanilla/Terrains.json index 937368689a..079240aea7 100644 --- a/android/assets/jsons/Civ V - Vanilla/Terrains.json +++ b/android/assets/jsons/Civ V - Vanilla/Terrains.json @@ -22,7 +22,7 @@ "movementCost": 1, "defenceBonus": -0.1, "RGB": [97,171,58], - "uniques": ["Occurs at temperature between [-0.4] and [0.8] and humidity between [0.5] and [1]"] + "uniques": ["Occurs at temperature between [-0.4] and [0.8] and humidity between [0.5] and [1]", "Open terrain"] }, { "name": "Plains", @@ -33,7 +33,7 @@ "defenceBonus": -0.1, "RGB": [168,185,102], "uniques": ["Occurs at temperature between [-0.4] and [0.8] and humidity between [0] and [0.5]", - "Occurs at temperature between [0.8] and [1] and humidity between [0.7] and [1]"] + "Occurs at temperature between [0.8] and [1] and humidity between [0.7] and [1]", "Open terrain"] }, { "name": "Tundra", @@ -42,7 +42,7 @@ "movementCost": 1, "defenceBonus": -0.1, "RGB": [189,204,191], - "uniques": ["Occurs at temperature between [-1] and [-0.4] and humidity between [0.5] and [1]"] + "uniques": ["Occurs at temperature between [-1] and [-0.4] and humidity between [0.5] and [1]", "Open terrain"] }, { "name": "Desert", @@ -50,7 +50,7 @@ "movementCost": 1, "defenceBonus": -0.1, "RGB": [ 230, 230, 113], - "uniques": ["Occurs at temperature between [0.8] and [1] and humidity between [0] and [0.7]"] + "uniques": ["Occurs at temperature between [0.8] and [1] and humidity between [0] and [0.7]", "Open terrain"] }, { "name": "Lakes", @@ -82,7 +82,7 @@ "movementCost": 1, "defenceBonus": -0.1, "RGB": [231, 242, 249], - "uniques": ["Occurs at temperature between [-1] and [-0.4] and humidity between [0] and [0.5]"] + "uniques": ["Occurs at temperature between [-1] and [-0.4] and humidity between [0] and [0.5]", "Open terrain"] }, // Terrain features @@ -146,7 +146,7 @@ "food": 2, "movementCost": 1, "defenceBonus": -0.1, - "occursOn": ["Desert"] + "occursOn": ["Desert", "Open terrain"] }, { "name": "Ice", diff --git a/android/assets/jsons/Civ V - Vanilla/UnitPromotions.json b/android/assets/jsons/Civ V - Vanilla/UnitPromotions.json index fedec94a6b..6ae0e1e391 100644 --- a/android/assets/jsons/Civ V - Vanilla/UnitPromotions.json +++ b/android/assets/jsons/Civ V - Vanilla/UnitPromotions.json @@ -9,44 +9,44 @@ // Ranged+Siege { "name": "Accuracy I", - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Accuracy II", "prerequisites": ["Accuracy I"], - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Accuracy III", "prerequisites": ["Accuracy II"], - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Barrage I", - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Barrage II", "prerequisites": ["Barrage I"], - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Barrage III", "prerequisites": ["Barrage II"], - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Siege","Ranged"] }, { "name": "Volley", "prerequisites": ["Accuracy I","Barrage I"], - "effect": "Bonus vs City 50%", + "effect": "+[50]% Strength vs [City]", "unitTypes": ["Ranged","Siege"] }, { @@ -65,61 +65,61 @@ // Melee, Mounted+Armor { "name": "Shock I", - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Shock II", "prerequisites": ["Shock I"], - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Shock III", "prerequisites": ["Shock II"], - "effect": "Bonus vs units in open terrain 15%", + "effect": "+[15]% Strength in [Open terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Drill I", - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Drill II", "prerequisites": ["Drill I"], - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Drill III", "prerequisites": ["Drill II"], - "effect": "Bonus vs units in rough terrain 15%", + "effect": "+[15]% Strength in [Rough terrain]", "unitTypes": ["Melee","Mounted","Armor"] }, { "name": "Charge", "prerequisites": ["Shock II","Drill II"], - "effect": "Bonus vs wounded units 33%", + "effect": "+[33]% Strength vs [wounded units]", "unitTypes": ["Mounted","Armor"] }, { "name": "Besiege", // Not called "Siege" in order to not conflict with siege type units for translations "prerequisites": ["Shock II","Drill II"], - "effect": "Bonus vs City 50%", + "effect": "+[50]% Strength vs [City]", "unitTypes": ["Melee"] }, { "name": "Formation I", "prerequisites": ["Shock II","Drill II"], - "effect": "Bonus vs Mounted 33%", + "effect": "+[33]% Strength vs [Mounted]", "unitTypes": ["Melee","Mounted"] }, { "name": "Formation II", "prerequisites": ["Formation I"], - "effect": "Bonus vs Mounted 33%", + "effect": "+[33]% Strength vs [Mounted]", "unitTypes": ["Melee","Mounted"] }, @@ -171,37 +171,37 @@ // Water melee { "name": "Boarding Party I", - "effect": "Bonus vs water units 15%", + "effect": "+[33]% Strength vs [Water units]", "unitTypes": ["WaterMelee"] }, { "name": "Boarding Party II", "prerequisites": ["Boarding Party I"], - "effect": "Bonus vs water units 15%", + "effect": "+[33]% Strength vs [Water units]", "unitTypes": ["WaterMelee"] }, { "name": "Boarding Party III", "prerequisites": ["Boarding Party II"], - "effect": "Bonus vs water units 15%", + "effect": "+[33]% Strength vs [Water units]", "unitTypes": ["WaterMelee"] }, { "name": "Coastal Raider I", - "effect": "Bonus vs City 15%", + "effect": "+[15]% Strength vs [City]", "unitTypes": ["WaterMelee"] }, { "name": "Coastal Raider II", "prerequisites": ["Coastal Raider I"], - "effect": "Bonus vs City 15%", + "effect": "+[15]% Strength vs [City]", "unitTypes": ["WaterMelee"] }, { "name": "Coastal Raider III", "prerequisites": ["Coastal Raider II"], - "effect": "Bonus vs City 15%", + "effect": "+[15]% Strength vs [City]", "unitTypes": ["WaterMelee"] }, @@ -263,19 +263,19 @@ // Bomber { "name": "Siege I", - "effect": "Bonus vs City 33%", + "effect": "+[33]% Strength vs [City]", "unitTypes": ["Bomber"] }, { "name": "Siege II", "prerequisites": ["Siege I"], - "effect": "Bonus vs City 33%", + "effect": "+[33]% Strength vs [City]", "unitTypes": ["Bomber"] }, { "name": "Siege III", "prerequisites": ["Siege II"], - "effect": "Bonus vs City 34%", + "effect": "+[34]% Strength vs [City]", "unitTypes": ["Bomber"] }, { @@ -385,13 +385,13 @@ { "name": "Ambush I", - "effect": "Bonus vs Armor 25%", + "effect": "+[25]% Strength vs [Armor]", "unitTypes": ["Melee","Fighter","Bomber"] }, { "name": "Ambush II", "prerequisites": ["Ambush I"], - "effect": "Bonus vs Armor 25%", + "effect": "+[25]% Strength vs [Armor]", "unitTypes": ["Melee","Fighter","Bomber"] }, @@ -399,44 +399,44 @@ // Water ranged and air units { "name": "Bombardment I", - "effect": "Bonus vs land units 33%", + "effect": "+[33]% Strength vs [land units]", "unitTypes": ["WaterRanged","Fighter","Bomber"] }, { "name": "Bombardment II", "prerequisites": ["Bombardment I"], - "effect": "Bonus vs land units 33%", + "effect": "+[33]% Strength vs [land units]", "unitTypes": ["WaterRanged","Fighter","Bomber"] }, { "name": "Bombardment III", "prerequisites": ["Bombardment II"], - "effect": "Bonus vs land units 34%", + "effect": "+[34]% Strength vs [land units]", "unitTypes": ["WaterRanged","Fighter","Bomber"] }, // Targeting I has different requirements for air and waterranged units, this was the cleanest way to do so { "name": "Targeting I", - "effect": "Bonus vs water units 15%", + "effect": "+[15]% Strength vs [water units]", "unitTypes": ["WaterRanged"] }, { "name": "Targeting I (air)", "prerequisites": ["Interception I","Dogfighting I", "Siege I","Bombardment I"], - "effect": "Bonus vs water units 15%", + "effect": "+[15]% Strength vs [water units]", "unitTypes": ["Fighter","Bomber"] }, { "name": "Targeting II", "prerequisites": ["Targeting I","Targeting I (air)"], - "effect": "Bonus vs water units 15%", + "effect": "+[15]% Strength vs [water units]", "unitTypes": ["WaterRanged","Fighter","Bomber"] }, { "name": "Targeting III", "prerequisites": ["Targeting II"], - "effect": "Bonus vs water units 15%", + "effect": "+[15]% Strength vs [water units]", "unitTypes": ["WaterRanged"] }, diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index 60915989d7..902ca3c17a 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -201,7 +201,7 @@ object BattleDamage { private fun getTileSpecificModifiers(unit: MapUnitCombatant, tile: TileInfo): Counter { val modifiers = Counter() - for (unique in unit.unit.getMatchingUniques("+[]% combat bonus in []") // deprecated as of 3.14.1 + for (unique in unit.unit.getMatchingUniques("+[]% combat bonus in []") // deprecated as of 3.14.1 - changed to "+[]% Strength in []" + unit.unit.getMatchingUniques("+[]% Strength in []") + unit.getCivInfo().getMatchingUniques("+[]% combat bonus for units fighting in []")) { val filter = unique.params[1] @@ -220,10 +220,10 @@ object BattleDamage { modifiers["Haka War Dance"] = -10 + // Deprecated as of 3.14.1 - changed to "+[15]% Strength in [Rough terrain]" val isRoughTerrain = tile.isRoughTerrain() for (BDM in getBattleDamageModifiersOfUnit(unit.unit)) { val text = BDM.getText() - // this will change when we change over everything to ints if (BDM.vs == "units in open terrain" && !isRoughTerrain) modifiers.add(text, (BDM.modificationAmount).toInt()) if (BDM.vs == "units in rough terrain" && isRoughTerrain) modifiers.add(text, (BDM.modificationAmount).toInt()) } diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index bb2651871e..9cf37a417a 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -379,7 +379,7 @@ open class TileInfo { || filter == "River" && isAdjacentToRiver() || terrainFeatures.contains(filter) || baseTerrainObject.uniques.contains(filter) - || getTerrainFeatures().any { it.uniques.contains(filter) } + || terrainFeatures.isNotEmpty() && getTerrainFeatures().last().uniques.contains(filter) || improvement == filter || civInfo != null && hasViewableResource(civInfo) && resource == filter || filter == "Water" && isWater