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 :)
This commit is contained in:
9kgsofrice
2020-12-02 17:49:13 +00:00
committed by GitHub
parent 80688eb4a5
commit b2e40a892b

View File

@ -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)}
}
}