diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs index 2b279ec..f6c066e 100644 --- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs +++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs @@ -992,6 +992,20 @@ public static class AbilitySystem if (tile is not null) tile.Base2 = ResolveAffinity(pfa.Affinity, ctx); break; } + 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. + var tile = ctx.State.Board?.GetTile(coord); + if (tile is null) break; + 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); + break; + } // ── §5.7 Zone / card operations ─────────────────────────────────── case DrawCardsEffect dc: @@ -1576,6 +1590,26 @@ public static class AbilitySystem }; } + // ── Tile conditions (§6.3) ─────────────────────────────────────── + case TileIsOccupiedCondition tioc when subject is Coord coord: + { + var tile = ctx.State.Board?.GetTile(coord); + if (tile is null || tile.IsEmpty) return false; + if (tioc.UnitType is null or "Unit") return true; + return FindUnitType(ctx.State, tile.OccupantId!) == tioc.UnitType; + } + case TileIsUnoccupiedCondition when subject is Coord coord: + { + var tile = ctx.State.Board?.GetTile(coord); + return tile is not null && tile.IsEmpty; + } + case TileAffinityMatchesCondition tamc when subject is Coord coord: + { + var tile = ctx.State.Board?.GetTile(coord); + return tile is not null + && AffinitySystem.Resolve(tile.Base1, tile.Base2) == tamc.Affinity; + } + default: return true; } @@ -2031,6 +2065,15 @@ public static class AbilitySystem if (tgt is not null) break; if (p.AccountId == ae.TargetRef) { tgt = p; break; } } + // Tile target: reference format is "tile:X,Y". + if (tgt is null && ae.TargetRef.StartsWith("tile:")) + { + var parts = ae.TargetRef[5..].Split(','); + if (parts.Length == 2 + && int.TryParse(parts[0], out var tx) + && int.TryParse(parts[1], out var ty)) + tgt = new Coord(tx, ty); + } if (tgt is null) return; var src = state.Players.Values