namespace SOR.Game.Abilities.Models; // ── Value expression ────────────────────────────────────────────────────────── /// /// An integer value that may be a fixed constant or a dynamic runtime reference. /// Dynamic references (§4.5) use dot-path notation, e.g.: /// "EventData.Amount", "Self.Damage", "Action1.Target.Defense" /// public sealed class ValueExpr { public int? Fixed { get; set; } public string? Ref { get; set; } [System.Text.Json.Serialization.JsonIgnore] public bool IsDynamic => Ref is not null; public static implicit operator ValueExpr(int n) => new() { Fixed = n }; } /// /// An affinity value that may be fixed or a dynamic reference. /// E.g.: "Self.Affinity", "Action1.Target.Affinity". /// public sealed class AffinityExpr { public SOR.Database.Enums.Affinity? Fixed { get; set; } public string? Ref { get; set; } } // ── Target selector ─────────────────────────────────────────────────────────── public enum TargetScope { Hand, Deck, Discard, Battlefield, Player, AnyZone } public enum TargetType { Unit, ArchSpirit, Spirit, SpiritToken, Ruin, Tile, Card, Player } public enum TargetOwnership { Self, ExactSelf, Owner, Ally, Enemy, Any, Random, Target } public sealed class TargetCount { /// Exact number of targets; or the maximum when UpTo=true. public int N { get; set; } = 1; /// Player may select fewer than N valid targets. public bool UpTo { get; set; } /// Target all valid entities (N is ignored). public bool All { get; set; } } /// /// Defines how targets are resolved for a single Action. /// Scope + Type + Ownership narrow the pool; Filters refine further. /// public sealed class TargetSelector { public TargetScope Scope { get; set; } public TargetType Type { get; set; } public TargetOwnership Ownership { get; set; } public TargetCount Count { get; set; } = new(); public Filter[]? Filters { get; set; } } // ── Action ──────────────────────────────────────────────────────────────────── /// /// The atomic unit of targeting and effect delivery within an ability. /// All effects within one action share the same target and duration. /// Actions within an ability resolve sequentially; a prior action's resolved /// target is accessible in subsequent actions via chained targeting filters. /// public sealed class Action { public TargetSelector Target { get; set; } = new(); public Condition[]? Conditions { get; set; } public Effect[] Effects { get; set; } = []; public DurationModel? Duration { get; set; } } // ── ChooseOne ───────────────────────────────────────────────────────────────── /// /// Presents the controlling player with a set of mutually exclusive action branches. /// Exactly one branch is selected and its actions resolve; other branches are skipped. /// ChooseOne may appear anywhere an Action[] is accepted. /// public sealed class ChooseOne { public Branch[] Branches { get; set; } = []; } public sealed class Branch { public string Label { get; set; } = string.Empty; public Action[] Actions { get; set; } = []; } // ── Cost entry ──────────────────────────────────────────────────────────────── public enum CostType { SpiritPoints, SacrificeTokens, DiscardFromHand, MillTopOfDeck, MillBottomOfDeck, SendSpiritFromBattlefieldToDiscard, DealDamageToOwnArchSpirit, DealDamageToOwnSpirit, } /// /// A single cost element for an Active ability. /// Multiple CostEntry items must all be paid simultaneously before the ability resolves. /// public sealed class CostEntry { public CostType Type { get; set; } public int Amount { get; set; } = 1; /// Optional filter for targeted costs (e.g. "Discard a Spirit card from hand"). public Filter[]? Filters { get; set; } } // ── Ability range ───────────────────────────────────────────────────────────── public sealed class AbilityRange { public int Min { get; set; } = 1; public int Max { get; set; } = 1; /// /// When true, the engine validates that a clear line of sight exists between the /// caster and the target tile/unit before allowing the ability to be used. /// public bool RequiresLos { get; set; } = false; /// /// When true, only targets that lie on a straight cardinal or diagonal line from /// the caster are valid (e.g. Push, Pull, beam-style abilities). /// public bool LinearOnly { get; set; } = false; }