Fix: implement Passive ability execution with per-target conditions
Passive abilities (e.g. 'All Merfolk +1 attack') were never executed
because AbilityType.Passive had no runtime processing.
Three root causes fixed:
1. Passive abilities are now applied when units enter the battlefield
and reversed when they leave (new DurationType.WhileSourceOnBattlefield).
- ApplyPassivesForSource: runs a unit's passives against all current targets
- ApplyPassivesToNewTarget: applies existing passives to a newly-entered unit
- RevokePassivesForSource: reverses all passive effects on source death/leave
- Hooked into GameEngine.Channel, Transition and AbilitySystem
ReturnToBattlefield, SummonToken, KillUnit, SendToDiscard
2. Action conditions with Subject="Target" now filter per-target instead of
aborting the entire action (which evaluated against ctx.Source).
Source-level conditions still gate the whole action; target-level ones
are evaluated individually and skip non-matching targets.
3. ExecuteActions/ResolveTargets gain a restrictTargets parameter used by
ApplyPassivesToNewTarget to avoid double-applying existing passive buffs
to units that already received them when the passive source entered.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -15,6 +15,8 @@ public enum DurationType
|
||||
ForNTurns,
|
||||
/// <summary>Active while a condition evaluates to true; expires when it becomes false.</summary>
|
||||
WhileCondition,
|
||||
/// <summary>Active while the ability's source unit is on the battlefield; revoked on leave/death.</summary>
|
||||
WhileSourceOnBattlefield,
|
||||
/// <summary>Persists for the entire match; never expires.</summary>
|
||||
PermanentInMatch,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user