diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor index 11ba1ff..b2a6762 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor @@ -207,6 +207,14 @@ +
+
+ + +
+
} @@ -807,7 +815,7 @@ ActivePlayer explicitly activates on their turnRange, Cost, UsesPerTurn PassiveAlways in effect while unit is on battlefieldActions (target=Self) AuraApplies Actions to units entering range; fires OnEnterAuraRange / OnLeaveAuraRange triggers. On Leave: Persist = keep effect duration, Clear = revert immediately, Linger = switch to linger durationAuraRange, Actions, ClearOnLeave / LingerDuration - TriggeredFires automatically when a specific game event occursTriggerEvent, Actions + TriggeredFires automatically when a specific game event occursTriggerEvent, TriggerLimitPerTurn, Actions @@ -906,6 +914,8 @@ DefenseIs / SPAtLeast / STAtLeastStat comparisons HasGenus / HasAbilitySubject has a genus tag / named ability IsOnTileWithAffinitySubject's tile matches the specified affinity + DestinationTileAffinityIs / PreviousTileAffinityIsOn move-triggered abilities, checks the moved-to / moved-from tile affinity + MovedFromOrIntoAffinityOn move-triggered abilities, passes if either origin or destination tile matches affinity IsAdjacentToSubject is adjacent to a unit matching Ownership WithinRangeOfSubject is within N tiles of a unit matching Ownership UnitCountOnBattlefieldTotal matching units on board satisfies comparator @@ -1150,7 +1160,7 @@ new("Genus & Affinity", ["AddGenus", "RemoveGenus", "SetAffinity", "SetBaseAffinity1", "SetBaseAffinity2", "PushAffinity", "PushFinalAffinity"]), new("Ability Mgmt", ["AddAbility", "RemoveAbility", "EnableAbility", "DisableAbility"]), - new("Displacement", ["PushUnit", "PullUnit", "DisplaceUnit"]), + new("Displacement", ["PushUnit", "PullUnit", "DisplaceUnit", "RepositionUnit"]), new("Control", ["TakeControl", "GrantMovementControl", "SetFixedSacrificeReturn"]), new("Token & Deferred", ["SummonToken", "ApplyOnEvent"]), ]; @@ -1161,12 +1171,13 @@ [ new("Turn / Timing", ["IsOwnTurn", "IsOpponentTurn", "IsAllyTurn", "IsActivePlayerTurn"]), new("Unit", ["HealthBelow", "HealthAbove", "DefenseIs", "HasGenus", "HasAbility", - "IsOnTileWithAffinity", "IsAdjacentTo", "WithinRangeOf", "MovementTypeIs"]), + "IsOnTileWithAffinity", "IsAdjacentTo", "WithinRangeOf", "MovementTypeIs", + "DestinationTileAffinityIs", "PreviousTileAffinityIs", "MovedFromOrIntoAffinity"]), new("Player", ["SPAtLeast", "SPAtMost", "STAtLeast", "STAtMost", "HandSizeAtLeast", "HandSizeAtMost", "DeckSizeAtLeast", "DiscardSizeAtLeast"]), new("Tile", ["TileAffinityMatches", "TileIsOccupied", "TileIsUnoccupied"]), new("Battlefield", ["UnitCountOnBattlefield", "CardInZone"]), - new("Composite", ["AND", "OR", "XOR"]), + new("Composite", ["AND", "OR", "XOR", "NOT"]), ]; // ── Effect type categories for rendering ───────────────────────────────────── @@ -1260,6 +1271,7 @@ Name = node["Name"]?.GetValue() ?? "", Description = node["Description"]?.GetValue() ?? "", UsesPerTurn = node["UsesPerTurn"]?.GetValue() ?? 1, + TriggerLimitPerTurn = node["TriggerLimitPerTurn"]?.GetValue(), RangeMin = node["Range"]?["Min"]?.GetValue(), RangeMax = node["Range"]?["Max"]?.GetValue(), RangeRequiresLos = node["Range"]?["RequiresLos"]?.GetValue() ?? false, @@ -1373,6 +1385,7 @@ Comparator = c["Comparator"]?.GetValue() ?? "GreaterThanOrEqual", Zone = c["Zone"]?.GetValue() ?? "Hand", CardRef = c["CardRef"]?.GetValue() ?? "", + InnerConditionJson = c["Condition"]?.ToJsonString() ?? "{\"$type\":\"IsOwnTurn\"}", }; private static EffectDraft ParseEffect(JsonObject eff) @@ -1447,6 +1460,14 @@ { d.Tiles = ReadInt("Tiles"); d.Direction = ReadStr("Direction", "North"); } + else if (typeKey == "RepositionUnit") + { + d.Tiles = ReadInt("Tiles"); + d.AdjacentToSource = ReadBool("AdjacentToSource"); + d.RelativeToTargetRef = ReadStr("RelativeToTargetRef", ""); + d.AdjacentToRelativeTarget = ReadBool("AdjacentToRelativeTarget"); + d.AllowRelativeTargetTile = ReadBool("AllowRelativeTargetTile"); + } else if (typeKey == "SetAttackRange") { d.Min = ReadInt("Min"); d.Max = ReadInt("Max", 2); @@ -1606,6 +1627,8 @@ else if (ab.TypeStr == "Triggered" && !string.IsNullOrEmpty(ab.TriggerType)) { node["TriggerEvent"] = CompileTrigger(ab); + if (ab.TriggerLimitPerTurn is > 0) + node["TriggerLimitPerTurn"] = ab.TriggerLimitPerTurn.Value; } if (ab.Conditions.Count > 0) @@ -1704,6 +1727,9 @@ node["AbilityRef"] = c.AbilityRef; break; case "IsOnTileWithAffinity": case "TileAffinityMatches": + case "DestinationTileAffinityIs": + case "PreviousTileAffinityIs": + case "MovedFromOrIntoAffinity": node["Affinity"] = c.Affinity; break; case "IsAdjacentTo": node["UnitType"] = c.UnitType; node["Ownership"] = c.Ownership; break; @@ -1720,6 +1746,19 @@ node["Comparator"] = c.Comparator; node["N"] = c.N; break; case "CardInZone": node["CardRef"] = c.CardRef; node["Zone"] = c.Zone; break; + case "NOT": + try + { + var inner = JsonNode.Parse(string.IsNullOrWhiteSpace(c.InnerConditionJson) + ? "{\"$type\":\"IsOwnTurn\"}" + : c.InnerConditionJson) as JsonObject; + node["Condition"] = inner ?? new JsonObject { ["$type"] = "IsOwnTurn" }; + } + catch + { + node["Condition"] = new JsonObject { ["$type"] = "IsOwnTurn" }; + } + break; } return node; } @@ -1887,6 +1926,14 @@ { node["Tiles"] = d.Tiles; node["Direction"] = d.Direction; } + else if (d.TypeKey == "RepositionUnit") + { + node["Tiles"] = d.Tiles; + if (d.AdjacentToSource) node["AdjacentToSource"] = true; + if (!string.IsNullOrWhiteSpace(d.RelativeToTargetRef)) node["RelativeToTargetRef"] = d.RelativeToTargetRef; + if (d.AdjacentToRelativeTarget) node["AdjacentToRelativeTarget"] = true; + if (d.AllowRelativeTargetTile) node["AllowRelativeTargetTile"] = true; + } else if (d.TypeKey == "SetAttackRange") { node["Min"] = d.Min; node["Max"] = d.Max; @@ -2051,7 +2098,7 @@ this, e => { c.AbilityRef = e.Value?.ToString() ?? ""; Compile(); })); __builder.CloseElement(); } - else if (t is "IsOnTileWithAffinity" or "TileAffinityMatches") + else if (t is "IsOnTileWithAffinity" or "TileAffinityMatches" or "DestinationTileAffinityIs" or "PreviousTileAffinityIs" or "MovedFromOrIntoAffinity") { BuildSelect(__builder, AffinityValues, c.Affinity, v => { c.Affinity = v; Compile(); }, 120); } @@ -2096,6 +2143,17 @@ __builder.CloseElement(); BuildSelect(__builder, ZoneValues, c.Zone, v => { c.Zone = v; Compile(); }, 110); } + else if (t == "NOT") + { + __builder.OpenElement(0, "input"); + __builder.AddAttribute(1, "class", "form-control form-control-sm font-monospace"); + __builder.AddAttribute(2, "style", "width:360px"); + __builder.AddAttribute(3, "placeholder", "Inner condition JSON e.g. {\"$type\":\"IsOwnTurn\"}"); + __builder.AddAttribute(4, "value", c.InnerConditionJson); + __builder.AddAttribute(5, "onchange", EventCallback.Factory.Create( + this, e => { c.InnerConditionJson = e.Value?.ToString() ?? ""; Compile(); })); + __builder.CloseElement(); + } // AND/OR/XOR + no-field types: no extra inputs }; @@ -2151,6 +2209,21 @@ BuildIntInput(__builder, d.Tiles, v => { d.Tiles = v; Compile(); }, 70, "Tiles"); BuildSelect(__builder, DirectionValues, d.Direction, v => { d.Direction = v; Compile(); }, 110); } + else if (t == "RepositionUnit") + { + BuildIntInput(__builder, d.Tiles, v => { d.Tiles = v; Compile(); }, 70, "Tiles"); + BuildCheckbox(__builder, "Adj Source", d.AdjacentToSource, v => { d.AdjacentToSource = v; Compile(); }); + BuildCheckbox(__builder, "Adj Ref", d.AdjacentToRelativeTarget, v => { d.AdjacentToRelativeTarget = v; Compile(); }); + BuildCheckbox(__builder, "Allow Ref Tile", d.AllowRelativeTargetTile, v => { d.AllowRelativeTargetTile = v; Compile(); }); + __builder.OpenElement(0, "input"); + __builder.AddAttribute(1, "class", "form-control form-control-sm"); + __builder.AddAttribute(2, "style", "width:160px"); + __builder.AddAttribute(3, "placeholder", "RelativeToTargetRef"); + __builder.AddAttribute(4, "value", d.RelativeToTargetRef); + __builder.AddAttribute(5, "onchange", EventCallback.Factory.Create( + this, e => { d.RelativeToTargetRef = e.Value?.ToString() ?? ""; Compile(); })); + __builder.CloseElement(); + } else if (t == "SetAttackRange") { BuildIntInput(__builder, d.Min, v => { d.Min = v; Compile(); }, 70, "Min"); @@ -2703,6 +2776,7 @@ public string TriggerOccupantOwnership { get; set; } = ""; public string TriggerUnitOwnership { get; set; } = "Any"; public string TriggerAuraOwnership { get; set; } = "Owner"; + public int? TriggerLimitPerTurn { get; set; } // Ability-level duration (overrides per-action Duration when set; "" = per-action) public string DurationStr { get; set; } = ""; public int DurationN { get; set; } = 1; @@ -2751,6 +2825,10 @@ public int Tiles { get; set; } = 1; public int BlockedDamage{ get; set; } = 0; public string Direction { get; set; } = "North"; + public bool AdjacentToSource { get; set; } = false; + public string RelativeToTargetRef { get; set; } = ""; + public bool AdjacentToRelativeTarget { get; set; } = false; + public bool AllowRelativeTargetTile { get; set; } = false; public int Min { get; set; } = 1; public int Max { get; set; } = 2; public string DurationType { get; set; } = "UntilEndOfTurn"; @@ -2816,6 +2894,7 @@ public string Comparator { get; set; } = "GreaterThanOrEqual"; public string Zone { get; set; } = "Hand"; public string CardRef { get; set; } = ""; + public string InnerConditionJson { get; set; } = "{\"$type\":\"IsOwnTurn\"}"; } private sealed class CostDraft diff --git a/Server/src/SOR.Game/Abilities/AbilityContext.cs b/Server/src/SOR.Game/Abilities/AbilityContext.cs index b71412e..e6d84d8 100644 --- a/Server/src/SOR.Game/Abilities/AbilityContext.cs +++ b/Server/src/SOR.Game/Abilities/AbilityContext.cs @@ -40,6 +40,11 @@ public sealed class TriggerEventData public string? SourceId { get; init; } /// Instance ID of the unit/player the event acted upon. public string? TargetId { get; init; } + + /// For movement events: previous tile coordinate. + public Coord? PreviousTile { get; init; } + /// For movement events: destination tile coordinate. + public Coord? DestinationTile { get; init; } } /// diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs index 7303f17..7aa310f 100644 --- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs +++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs @@ -33,6 +33,9 @@ public static class AbilitySystem }, }; + // Runtime limiter for Triggered abilities: (source instance, ability key, turn) -> count + private static readonly Dictionary<(string SourceInstanceId, string AbilityKey, int Turn), int> _triggerCountsPerTurn = new(); + // ── Parsing ──────────────────────────────────────────────────────────────── public static AbilityDefinition[] ParseAbilities(string? json) @@ -208,6 +211,16 @@ public static class AbilitySystem if (def.ActivationConditions.Any(c => !EvaluateCondition(c, ctx, unit))) continue; + if (def.TriggerLimitPerTurn is > 0) + { + var abilityKey = !string.IsNullOrWhiteSpace(def.Name) ? def.Name! : $"idx:{i}"; + var key = (unit.InstanceId, abilityKey, state.TurnNumber); + _triggerCountsPerTurn.TryGetValue(key, out var used); + if (used >= def.TriggerLimitPerTurn.Value) + continue; + _triggerCountsPerTurn[key] = used + 1; + } + ExecuteActions(def.Actions, ctx, clientTargets: null, forceDuration: def.Duration); } } @@ -1257,10 +1270,47 @@ public static class AbilitySystem var duOwner = ctx.State.Players.Values .FirstOrDefault(p => p.Field.Any(f => f.InstanceId == fc5.InstanceId)); if (duOwner is null) break; - ctx.State.Board.RemoveUnit(fc5.InstanceId); - ctx.State.Board.PlaceUnit(newPos5, fc5.InstanceId, duOwner.AccountId); - fc5.Position = newPos5; - EvaluateAuraTransitions(ctx.State, fc5.InstanceId, oldPos5, newPos5); + MoveUnitAndEmit(fc5, duOwner.AccountId, oldPos5, newPos5, ctx); + break; + } + case RepositionUnitEffect rpe when target is FieldCard fc7: + { + if (!fc7.Position.HasValue || ctx.State.Board is null) break; + var owner = ctx.State.Players.Values.FirstOrDefault(p => p.Field.Any(f => f.InstanceId == fc7.InstanceId)); + if (owner is null) break; + + var from = fc7.Position.Value; + var maxDist = Math.Max(1, rpe.Tiles); + var board = ctx.State.Board; + + var candidates = board.Tiles.Values + .Where(t => t.IsEmpty) + .Select(t => t.Coord) + .Where(c => from.ManhattanDistance(c) <= maxDist) + .ToList(); + + if (rpe.AdjacentToSource && ctx.Source is FieldCard src && src.Position.HasValue) + candidates = candidates.Where(c => c.IsOrthogonallyAdjacentTo(src.Position!.Value)).ToList(); + + Coord? refCoord = null; + if (!string.IsNullOrWhiteSpace(rpe.RelativeToTargetRef)) + { + refCoord = ResolveCoordReference(rpe.RelativeToTargetRef!, ctx); + if (refCoord.HasValue) + { + if (rpe.AdjacentToRelativeTarget) + candidates = candidates.Where(c => c.IsOrthogonallyAdjacentTo(refCoord.Value)).ToList(); + if (!rpe.AllowRelativeTargetTile) + candidates = candidates.Where(c => c != refCoord.Value).ToList(); + } + } + + if (rpe.DestinationTileFilters is { Length: > 0 }) + candidates = candidates.Where(c => TileMatchesFilters(rpe.DestinationTileFilters, board.GetTile(c)!, ctx)).ToList(); + + if (candidates.Count == 0) break; + var to = candidates[Random.Shared.Next(candidates.Count)]; + MoveUnitAndEmit(fc7, owner.AccountId, from, to, ctx); break; } @@ -1496,9 +1546,47 @@ public static class AbilitySystem .FirstOrDefault(p => p.Field.Any(f => f.InstanceId == unit.InstanceId)); if (ownerEntry is null) return; - board.RemoveUnit(unit.InstanceId); - board.PlaceUnit(newPos, unit.InstanceId, ownerEntry.AccountId); - unit.Position = newPos; + MoveUnitAndEmit(unit, ownerEntry.AccountId, unitPos, newPos, ctx); + } + + private static Coord? ResolveCoordReference(string targetRef, AbilityContext ctx) + { + if (targetRef.StartsWith("Action", StringComparison.OrdinalIgnoreCase)) + { + var tail = targetRef[6..]; + var dot = tail.IndexOf('.'); + if (dot > 0 && int.TryParse(tail[..dot], out var actionNum)) + { + if (ctx.ResolvedTargets.TryGetValue(actionNum - 1, out var targets)) + { + var first = targets.FirstOrDefault(); + if (first is Coord c) return c; + if (first is FieldCard fc && fc.Position.HasValue) return fc.Position.Value; + } + } + } + return null; + } + + private static void MoveUnitAndEmit(FieldCard unit, string ownerId, Coord from, Coord to, AbilityContext ctx) + { + if (ctx.State.Board is null) return; + ctx.State.Board.RemoveUnit(unit.InstanceId); + ctx.State.Board.PlaceUnit(to, unit.InstanceId, ownerId); + unit.Position = to; + EvaluateAuraTransitions(ctx.State, unit.InstanceId, from, to); + FireTrigger(ctx.State, new TriggerOccurrence + { + Kind = TriggerEventKind.UnitMove, + ActorId = ownerId, + UnitType = unit.CardType, + Data = new TriggerEventData + { + SourceId = unit.InstanceId, + PreviousTile = from, + DestinationTile = to, + }, + }); } // ── Zone helpers ────────────────────────────────────────────────────────── @@ -1585,6 +1673,8 @@ public static class AbilitySystem return or.Conditions.Any(c => EvaluateCondition(c, ctx, subject)); case XorCondition xor: return xor.Conditions.Count(c => EvaluateCondition(c, ctx, subject)) == 1; + case NotCondition not: + return !EvaluateCondition(not.Condition, ctx, subject); case HealthBelowCondition hb when subject is CardInstance ci: return (ci.CurrentHealth ?? 0) < hb.N; @@ -1605,6 +1695,35 @@ public static class AbilitySystem } case MovementTypeIsCondition mti when subject is CardInstance ci: return ci.MovementType == mti.MovementType; + case DestinationTileAffinityIsCondition dta: + { + if (ctx.EventData?.DestinationTile is not Coord to || ctx.State.Board is null) return false; + var tile = ctx.State.Board.GetTile(to); + return tile is not null && AffinitySystem.Resolve(tile.Base1, tile.Base2) == dta.Affinity; + } + case PreviousTileAffinityIsCondition pta: + { + if (ctx.EventData?.PreviousTile is not Coord from || ctx.State.Board is null) return false; + var tile = ctx.State.Board.GetTile(from); + return tile is not null && AffinitySystem.Resolve(tile.Base1, tile.Base2) == pta.Affinity; + } + case MovedFromOrIntoAffinityCondition mfa: + { + if (ctx.State.Board is null) return false; + var fromOk = false; + var toOk = false; + if (ctx.EventData?.PreviousTile is Coord from) + { + var t = ctx.State.Board.GetTile(from); + fromOk = t is not null && AffinitySystem.Resolve(t.Base1, t.Base2) == mfa.Affinity; + } + if (ctx.EventData?.DestinationTile is Coord to) + { + var t = ctx.State.Board.GetTile(to); + toOk = t is not null && AffinitySystem.Resolve(t.Base1, t.Base2) == mfa.Affinity; + } + return fromOk || toOk; + } case SPAtLeastCondition spal: return player.CurrentSp >= spal.N; case SPAtMostCondition spam: return player.CurrentSp <= spam.N; diff --git a/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs b/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs index f8ec3ea..6a5cb9b 100644 --- a/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs +++ b/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs @@ -51,6 +51,12 @@ public sealed class AbilityDefinition /// The event that fires this ability. Must be set for Triggered type. public TriggerEvent? TriggerEvent { get; set; } + /// + /// Maximum number of times this Triggered ability may resolve per turn. + /// Null or <= 0 means unlimited. + /// + public int? TriggerLimitPerTurn { get; set; } + /// /// Optional display name shown in the admin tool and client ability list. /// Not required for game logic. diff --git a/Server/src/SOR.Game/Abilities/Models/Conditions.cs b/Server/src/SOR.Game/Abilities/Models/Conditions.cs index 186c563..38226c8 100644 --- a/Server/src/SOR.Game/Abilities/Models/Conditions.cs +++ b/Server/src/SOR.Game/Abilities/Models/Conditions.cs @@ -13,6 +13,7 @@ using SOR.Database.Enums; [PolyType(typeof(AndCondition), "AND")] [PolyType(typeof(OrCondition), "OR")] [PolyType(typeof(XorCondition), "XOR")] +[PolyType(typeof(NotCondition), "NOT")] // Unit (§6.1) [PolyType(typeof(HealthBelowCondition), "HealthBelow")] [PolyType(typeof(HealthAboveCondition), "HealthAbove")] @@ -23,6 +24,9 @@ using SOR.Database.Enums; [PolyType(typeof(IsAdjacentToCondition), "IsAdjacentTo")] [PolyType(typeof(WithinRangeOfCondition), "WithinRangeOf")] [PolyType(typeof(MovementTypeIsCondition), "MovementTypeIs")] +[PolyType(typeof(DestinationTileAffinityIsCondition), "DestinationTileAffinityIs")] +[PolyType(typeof(PreviousTileAffinityIsCondition), "PreviousTileAffinityIs")] +[PolyType(typeof(MovedFromOrIntoAffinityCondition), "MovedFromOrIntoAffinity")] // Player (§6.2) [PolyType(typeof(SPAtLeastCondition), "SPAtLeast")] [PolyType(typeof(SPAtMostCondition), "SPAtMost")] @@ -59,6 +63,7 @@ public abstract class Condition public sealed class AndCondition : Condition { public Condition[] Conditions { get; set; } = []; } public sealed class OrCondition : Condition { public Condition[] Conditions { get; set; } = []; } public sealed class XorCondition : Condition { public Condition[] Conditions { get; set; } = []; } +public sealed class NotCondition : Condition { public Condition Condition { get; set; } = new IsOwnTurnCondition(); } // ── Unit conditions (§6.1) ──────────────────────────────────────────────────── @@ -85,6 +90,9 @@ public sealed class WithinRangeOfCondition : Condition } public sealed class MovementTypeIsCondition : Condition { public MovementType MovementType { get; set; } } +public sealed class DestinationTileAffinityIsCondition : Condition { public Affinity Affinity { get; set; } } +public sealed class PreviousTileAffinityIsCondition : Condition { public Affinity Affinity { get; set; } } +public sealed class MovedFromOrIntoAffinityCondition : Condition { public Affinity Affinity { get; set; } } // ── Player conditions (§6.2) ────────────────────────────────────────────────── diff --git a/Server/src/SOR.Game/Abilities/Models/Effects.cs b/Server/src/SOR.Game/Abilities/Models/Effects.cs index 2f3c7a1..d62c62d 100644 --- a/Server/src/SOR.Game/Abilities/Models/Effects.cs +++ b/Server/src/SOR.Game/Abilities/Models/Effects.cs @@ -81,9 +81,10 @@ using SOR.Database.Enums; [PolyType(typeof(DOTEffect), "DOT")] [PolyType(typeof(HOTEffect), "HOT")] // §5.9 Displacement -[PolyType(typeof(PushUnitEffect), "PushUnit")] -[PolyType(typeof(PullUnitEffect), "PullUnit")] -[PolyType(typeof(DisplaceUnitEffect), "DisplaceUnit")] +[PolyType(typeof(PushUnitEffect), "PushUnit")] +[PolyType(typeof(PullUnitEffect), "PullUnit")] +[PolyType(typeof(DisplaceUnitEffect), "DisplaceUnit")] +[PolyType(typeof(RepositionUnitEffect),"RepositionUnit")] // §5.10 Control [PolyType(typeof(TakeControlEffect), "TakeControl")] [PolyType(typeof(GrantMovementControlEffect), "GrantMovementControl")] @@ -219,6 +220,15 @@ public sealed class PullUnitEffect : Effect public int BlockedDamage { get; set; } = 0; } public sealed class DisplaceUnitEffect : Effect { public int Tiles { get; set; } = 1; public string Direction { get; set; } = "North"; } +public sealed class RepositionUnitEffect : Effect +{ + public int Tiles { get; set; } = 1; + public bool AdjacentToSource { get; set; } + public string? RelativeToTargetRef { get; set; } + public bool AdjacentToRelativeTarget { get; set; } + public bool AllowRelativeTargetTile { get; set; } + public Filter[]? DestinationTileFilters { get; set; } +} // ── §5.10 Control effects ───────────────────────────────────────────────────── diff --git a/Server/src/SOR.Game/GameEngine.cs b/Server/src/SOR.Game/GameEngine.cs index 58dafbc..9bee078 100644 --- a/Server/src/SOR.Game/GameEngine.cs +++ b/Server/src/SOR.Game/GameEngine.cs @@ -647,7 +647,7 @@ public static class GameEngine Kind = TriggerEventKind.UnitMove, ActorId = actorId, UnitType = unit.CardType, - Data = new TriggerEventData { SourceId = unitInstanceId }, + Data = new TriggerEventData { SourceId = unitInstanceId, PreviousTile = from, DestinationTile = targetPos }, }); // Fire UnitOccupyRuin if the destination tile has a Ruin.