Fix ReturnToHandEffect: revoke passives + skip target conditions at activation
- Skip ActivationConditions with Subject=="Target" in ActivateAbility (mirrors
AbilitiesJson code path) so conditions like IsOnTileWithAffinity{Target,Lake}
aren't evaluated against the source unit at activation time
- Add RevokePassivesForSource call in ReturnToHandEffect before removing the
unit from the field, matching SendToDiscardEffect pattern
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:
@@ -90,8 +90,11 @@ public static class AbilitySystem
|
||||
|
||||
var ctx = new AbilityContext { State = state, ActorId = actorId, Source = source };
|
||||
|
||||
// Evaluate source-side ActivationConditions only (Subject != "Target").
|
||||
// Target-subject conditions restrict which targets are valid; they are
|
||||
// enforced by the client and applied per-target inside ExecuteActions.
|
||||
if (def.ActivationConditions is { Length: > 0 })
|
||||
foreach (var cond in def.ActivationConditions)
|
||||
foreach (var cond in def.ActivationConditions.Where(c => c.Subject != "Target"))
|
||||
if (!EvaluateCondition(cond, ctx, source))
|
||||
throw new GameException("ABILITY_CONDITION_NOT_MET");
|
||||
|
||||
@@ -961,7 +964,13 @@ public static class AbilitySystem
|
||||
case ReturnToHandEffect when target is CardInstance ci:
|
||||
{
|
||||
var owner = FindCardOwner(ctx.State, ci.InstanceId);
|
||||
if (owner is not null) { RemoveFromAllZones(owner, ci, ctx.State.Board); owner.Hand.Add(ci); }
|
||||
if (owner is not null)
|
||||
{
|
||||
if (owner.Field.Any(f => f.InstanceId == ci.InstanceId))
|
||||
RevokePassivesForSource(ctx.State, ci.InstanceId);
|
||||
RemoveFromAllZones(owner, ci, ctx.State.Board);
|
||||
owner.Hand.Add(ci);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ReturnToDeckEffect rtd when target is CardInstance ci:
|
||||
|
||||
Reference in New Issue
Block a user