From b2e40a892be6dc7aa995c44d44283acdd22df5a1 Mon Sep 17 00:00:00 2001 From: 9kgsofrice <65415105+9kgsofrice@users.noreply.github.com> Date: Wed, 2 Dec 2020 17:49:13 +0000 Subject: [PATCH] unique "[] units gain the [] promotion" affects exisiting units (#3387) * "[] units gain the [] promotion" unique affects existing units * removed toString() and flipped && * probably this is closer to what you had in mind :) --- core/src/com/unciv/models/ruleset/Unique.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/com/unciv/models/ruleset/Unique.kt b/core/src/com/unciv/models/ruleset/Unique.kt index 5ee8b10e99..eb19be9d07 100644 --- a/core/src/com/unciv/models/ruleset/Unique.kt +++ b/core/src/com/unciv/models/ruleset/Unique.kt @@ -78,6 +78,15 @@ object UniqueTriggerActivation { "+20% attack bonus to all Military Units for 30 turns" -> civInfo.policies.autocracyCompletedTurns = 30 "Reveals the entire map" -> civInfo.exploredTiles.addAll(civInfo.gameInfo.tileMap.values.asSequence().map { it.position }) + + "[] units gain the [] promotion" -> { + val filter = unique.params[0] + val promotion = unique.params[1] + for (unit in civInfo.getCivUnits()) + if (unit.matchesCategory(filter) + || (civInfo.gameInfo.ruleSet.unitPromotions.values.any { it.name == promotion + && unit.type.name in it.unitTypes })) + unit.promotions.addPromotion(promotion, isFree = true)} } }