Adjust city attack strength. Also shown in unittable when selected.

This commit is contained in:
Duan Tao
2019-01-12 20:33:30 +08:00
parent abd9d6d9a4
commit c198db0641
4 changed files with 9 additions and 4 deletions

View File

@ -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
},

View File

@ -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 {

View File

@ -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
}
}

View File

@ -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
}