Better fix, will also solve future problems of this sort

This commit is contained in:
Yair Morgenstern
2022-02-12 22:04:08 +02:00
parent 901c8a81a5
commit 63f927af83
2 changed files with 3 additions and 2 deletions

View File

@ -265,7 +265,7 @@ object Battle {
for (unique in plunderingUnit.unit.getMatchingUniques(UniqueType.DamageUnitsPlunder, checkCivInfoUniques = true)) { for (unique in plunderingUnit.unit.getMatchingUniques(UniqueType.DamageUnitsPlunder, checkCivInfoUniques = true)) {
if (plunderedUnit.matchesCategory(unique.params[1])) { if (plunderedUnit.matchesCategory(unique.params[1])) {
val percentage = unique.params[0].toFloat() val percentage = unique.params[0].toFloat()
plunderedGoods.add(Stat.valueOf(unique.params[2]), percentage / 100f * min(damageDealt,100)) plunderedGoods.add(Stat.valueOf(unique.params[2]), percentage / 100f * damageDealt)
} }
} }

View File

@ -25,7 +25,8 @@ class MapUnitCombatant(val unit: MapUnit) : ICombatant {
override fun takeDamage(damage: Int) { override fun takeDamage(damage: Int) {
unit.health -= damage unit.health -= damage
if(isDefeated()) unit.destroy() if (unit.health < 0) unit.health = 0
if (isDefeated()) unit.destroy()
} }
override fun getAttackingStrength(): Int { override fun getAttackingStrength(): Int {