diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs index f6c066e..f94b187 100644 --- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs +++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs @@ -497,6 +497,19 @@ public static class AbilitySystem if (selector.Type == TargetType.Tile) { + // Battlefield scope with All=true: enumerate every board tile server-side. + // The client does not (and should not) send coords for board-wide tile effects. + if (selector.Scope == TargetScope.Battlefield && selector.Count.All + && ctx.State.Board is { } board) + { + var allTiles = board.Tiles.Values + .Select(t => (object)t.Coord) + .ToList(); + if (activationRange is not null) + allTiles = FilterTargetsByAbilityRange(allTiles, ctx, activationRange); + return allTiles; + } + if (clientTargets is null) return []; var tiles = clientTargets .Where(t => t.ActionIndex == actionIndex && t.Coord is not null) @@ -994,16 +1007,20 @@ public static class AbilitySystem } case SetAffinityEffect sa when target is Coord coord: { - // SetAffinity on a tile overrides Base2 (the dominant slot) and tracks the - // original value for duration-based reversal. + // SetAffinity on a tile writes both slots so the resolved affinity is unambiguous, + // and tracks a reversal for each slot so both are restored when the duration expires. var tile = ctx.State.Board?.GetTile(coord); if (tile is null) break; + var origBase1 = tile.Base1; var origBase2 = tile.Base2; - tile.Base2 = ResolveAffinity(sa.Affinity, ctx); - TrackEffect( - new SetBaseAffinity2Effect { Affinity = new AffinityExpr { Fixed = origBase2 } }, - $"tile:{coord.X},{coord.Y}", - duration, ctx); + var newAff = ResolveAffinity(sa.Affinity, ctx); + tile.Base1 = newAff; + tile.Base2 = newAff; + var tileRef = $"tile:{coord.X},{coord.Y}"; + TrackEffect(new SetBaseAffinity1Effect { Affinity = new AffinityExpr { Fixed = origBase1 } }, + tileRef, duration, ctx); + TrackEffect(new SetBaseAffinity2Effect { Affinity = new AffinityExpr { Fixed = origBase2 } }, + tileRef, duration, ctx); break; }