Notify when Barbs don't give more XP (#6115)

* Updates to allow BarbXP gain check

* Remove from ICombatant

* Revert Battle.kt

* Fix code in BattleTable

* Add template.properties entry

* Fix space issue

* Silly autoformatting

Co-authored-by: temurakami <spellman23@gmail.com>
This commit is contained in:
itanasi
2022-02-08 01:42:24 -08:00
committed by GitHub
parent 92f0be995d
commit 1420ad845c
3 changed files with 10 additions and 1 deletions

View File

@ -873,6 +873,7 @@ Attack =
Bombard =
NUKE =
Captured! =
Cannot gain more XP from Barbarians =
# Battle modifier categories

View File

@ -30,4 +30,4 @@ interface ICombatant {
return this is CityCombatant
}
fun isCivilian() = this is MapUnitCombatant && this.unit.isCivilian()
}
}

View File

@ -163,6 +163,14 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
row().pad(2f)
}
// from Battle.addXp(), check for can't gain more XP from Barbarians
val modConstants = attacker.getCivInfo().gameInfo.ruleSet.modOptions.constants
if (attacker is MapUnitCombatant && (attacker as MapUnitCombatant).unit.promotions.totalXpProduced() >= modConstants.maxXPfromBarbarians
&& defender.getCivInfo().isBarbarian()){
add("Cannot gain more XP from Barbarians".tr().toLabel(fontSize = 16).apply { wrap=true }).width(quarterScreen)
row()
}
var damageToDefender = BattleDamage.calculateDamageToDefender(attacker,null,defender)
var damageToAttacker = BattleDamage.calculateDamageToAttacker(attacker,null,defender)