From 83655bbd348dc7bbabc4c8189d14d196a4e8e909 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 25 Feb 2024 22:45:21 +0200 Subject: [PATCH] Resolves #11193 - above/below HP conditionals work outside of combat --- core/src/com/unciv/models/ruleset/unique/Conditionals.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt index 2fefcd8b54..3a8131acaa 100644 --- a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt +++ b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt @@ -202,10 +202,10 @@ object Conditionals { UniqueType.ConditionalUnitWithoutPromotion -> relevantUnit?.promotions?.promotions?.contains(condition.params[0]) == false UniqueType.ConditionalAttacking -> state.combatAction == CombatAction.Attack UniqueType.ConditionalDefending -> state.combatAction == CombatAction.Defend - UniqueType.ConditionalAboveHP -> - state.ourCombatant != null && state.ourCombatant.getHealth() > condition.params[0].toInt() - UniqueType.ConditionalBelowHP -> - state.ourCombatant != null && state.ourCombatant.getHealth() < condition.params[0].toInt() + UniqueType.ConditionalAboveHP -> state.unit != null && state.unit.health > condition.params[0].toInt() + || state.ourCombatant != null && state.ourCombatant.getHealth() > condition.params[0].toInt() + UniqueType.ConditionalBelowHP -> state.unit != null && state.unit.health < condition.params[0].toInt() + ||state.ourCombatant != null && state.ourCombatant.getHealth() < condition.params[0].toInt() UniqueType.ConditionalHasNotUsedOtherActions -> state.unit == null || // So we get the action as a valid action in BaseUnit.hasUnique() state.unit.abilityToTimesUsed.isEmpty()