From 135a502990ae0bab3d5a9255ef936f83c2f7c312 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 11 Jun 2018 18:37:19 +0300 Subject: [PATCH] Unit that was set up doesn't lose its Set Up status if it attacks --- core/src/com/unciv/logic/battle/Battle.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index e5435a82bc..f64d2041dc 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -170,13 +170,14 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) { } if(attacker is MapUnitCombatant) { - if (attacker.unit.hasUnique("Can move after attacking")){ + val unit = attacker.unit + if (unit.hasUnique("Can move after attacking")){ if(!attacker.getUnitType().isMelee() || !defender.isDefeated()) // if it was a melee attack and we won, then the unit ALREADY got movement points deducted, for the movement to the enemie's tile! - attacker.unit.currentMovement = max(0f, attacker.unit.currentMovement - 1) + unit.currentMovement = max(0f, unit.currentMovement - 1) } - else attacker.unit.currentMovement = 0f - attacker.unit.attacksThisTurn+=1 - attacker.unit.action=null // for instance, if it was fortified + else unit.currentMovement = 0f + unit.attacksThisTurn+=1 + if(unit.isFortified()) attacker.unit.action=null // but not, for instance, if it's Set Up - then it should definitely keep the action! } }