As per one of Derek’s dev journals, traits in Fallen Enchantress can be made conditional, with the following tags existing: vsDamaged, vsHigher, vsLower, vsOtherAllegiance, vsUnitType, WhenUnderPercentHitPoints, xActions.
I would like to propose a couple of extra tags:
WhenAtLeastXAlliesWithTraitY – trait is active when there are at least X allies with trait Y on the battlefield.
This allows generation of combat scenarios where a boss monster is powered by servitor monsters (floating eyes etc.), getting power-ups from them. The player’s units then need to attack these eyes whilst avoiding the boss monster until it is sufficiently weakened. The boss monster has several traits which each give bonuses (one grants magic immunity when at least 4 allies are present, another grants ranged immunity when at least 6 allies are present, a third one grants high defenses when at least 2 allies are present).
Alternatively, it can be used for a general-soldiers pairing. For example, “General” trait is active when at least 3 allies with “Soldier” trait are present on the battlefield. Its effect is to grant all allies a +X to initiative.
Coding – the traits’ conditional check would need to be recalculated when the number of allies on the battlefield changes - either a death, a summon, or a change of unit allegiance (i.e. some sort of confusion spell).
UntilAfterAttack – the trait’s effects disappear after the unit takes an attack action (an action that can damage an enemy on success). An alternative to xActions, it is more tactically engaging for the player to use, as they are not forced to rush into action with the unit, but can use it against the best target.
Examples would be Stealth\Invisibility (+X to defense, + 2 * X to ranged defense), that would be broken by attack, and Poisoned Weapon (+poison damage on first attack).
Coding – the traits’ conditional check would need to be recalculated at the end of turn, turning it off if the unit took an offensive action.