Added health conditionals (#5707)

* Added health conditionals

* Whenefied conditional
This commit is contained in:
Xander Lenstra 2021-11-27 18:52:54 +01:00 committed by GitHub
parent ce158d0c44
commit 4107ff3386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -83,6 +83,10 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|| (state.unit != null && state.unit.matchesFilter(condition.params[0]))
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.ConditionalInTiles ->
state.attackedTile != null && state.attackedTile.matchesFilter(condition.params[0])
UniqueType.ConditionalVsLargerCiv -> {

View File

@ -433,6 +433,8 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
ConditionalDefending("when defending", UniqueTarget.Conditional),
ConditionalInTiles("when fighting in [tileFilter] tiles", UniqueTarget.Conditional),
ConditionalForeignContinent("on foreign continents", UniqueTarget.Conditional),
ConditionalAboveHP("when above [amount] HP", UniqueTarget.Conditional),
ConditionalBelowHP("when below [amount] HP", UniqueTarget.Conditional),
/////// tile conditionals
ConditionalNeighborTiles("with [amount] to [amount] neighboring [tileFilter] tiles", UniqueTarget.Conditional),

View File

@ -213,7 +213,7 @@ class Translations : LinkedHashMap<String, TranslationEntry>(){
// Whenever this string is changed, it should also be changed in the translation files!
// It is mostly used as the template for translating the order of conditionals
const val englishConditionalOrderingString =
"<for [mapUnitFilter] units> <vs cities> <vs [mapUnitFilter] units> <when fighting in [tileFilter] tiles> <when attacking> <when defending> <if this city has at least [amount] specialists> <when at war> <when not at war> <while the empire is happy> <during a Golden Age> <during the [era]> <before the [era]> <starting from the [era]> <with [techOrPolicy]> <without [techOrPolicy]>"
"<for [mapUnitFilter] units> <above [amount] HP> <below [amount] HP> <vs cities> <vs [mapUnitFilter] units> <when fighting in [tileFilter] tiles> <when attacking> <when defending> <if this city has at least [amount] specialists> <when at war> <when not at war> <while the empire is happy> <during a Golden Age> <during the [era]> <before the [era]> <starting from the [era]> <with [techOrPolicy]> <without [techOrPolicy]>"
const val conditionalUniqueOrderString = "ConditionalsPlacement"
const val shouldCapitalizeString = "StartWithCapitalLetter"
}