From c198db0641613cefdbdc18a36bb6c1a89e1ae1b9 Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Sat, 12 Jan 2019 20:33:30 +0800 Subject: [PATCH] Adjust city attack strength. Also shown in unittable when selected. --- android/assets/jsons/Policies.json | 2 +- core/src/com/unciv/logic/battle/BattleDamage.kt | 4 ++++ core/src/com/unciv/logic/battle/CityCombatant.kt | 5 ++--- core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/android/assets/jsons/Policies.json b/android/assets/jsons/Policies.json index 54ad10c9d7..2c94cb0f01 100644 --- a/android/assets/jsons/Policies.json +++ b/android/assets/jsons/Policies.json @@ -18,7 +18,7 @@ }, { name:"Oligarchy", - description:"Units in cities cost no Maintenance", + description:"Units in cities cost no Maintenance, garrisoned city +50% attacking strength", row:1, column:5 }, diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index 886970cc02..621415d178 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -111,6 +111,10 @@ class BattleDamage{ else modifiers["Attacker Bonus"] = bonus } } + else if (attacker is CityCombatant) { + if (attacker.getCivInfo().policies.isAdopted("Oligarchy") && attacker.city.getCenterTile().militaryUnit != null) + modifiers["Oligarchy"] = 0.5f + } if (attacker.isMelee()) { val numberOfAttackersSurroundingDefender = defender.getTile().neighbors.count { diff --git a/core/src/com/unciv/logic/battle/CityCombatant.kt b/core/src/com/unciv/logic/battle/CityCombatant.kt index 57dcc1353e..7c5d7084ba 100644 --- a/core/src/com/unciv/logic/battle/CityCombatant.kt +++ b/core/src/com/unciv/logic/battle/CityCombatant.kt @@ -22,7 +22,7 @@ class CityCombatant(val city: CityInfo) : ICombatant { } override fun getUnitType(): UnitType = UnitType.City - override fun getAttackingStrength(): Int = getCityStrength()/5 // I remember reading this but I don't recall where + override fun getAttackingStrength(): Int = getCityStrength()*2/5 // I remember reading this but I don't recall where override fun getDefendingStrength(): Int{ if(isDefeated()) return 1 return getCityStrength() @@ -54,5 +54,4 @@ class CityCombatant(val city: CityInfo) : ICombatant { } override fun toString(): String {return city.name} // for debug - -} \ No newline at end of file +} diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt index 3e9a747922..c757356ea0 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt @@ -113,6 +113,8 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){ unitDescriptionTable.defaults().pad(2f).padRight(5f) unitDescriptionTable.add("Strength".tr()) unitDescriptionTable.add(CityCombatant(city).getCityStrength().toString()).row() + unitDescriptionTable.add("Ranged Strength".tr()) + unitDescriptionTable.add(CityCombatant(city).getAttackingStrength().toString()).row() selectedUnitHasChanged = true }