From e9476a3775845d6da2b35d005c1a879297711d7a Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 19 Mar 2026 15:49:16 -0400 Subject: [PATCH] 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 Co-Authored-By: Happy --- Server/src/SOR.Game/Abilities/AbilitySystem.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs index ae867a3..a4164e3 100644 --- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs +++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs @@ -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: