Interum manual push
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
/// <summary>Ability type determines activation model and required fields.</summary>
|
||||
public enum AbilityType
|
||||
{
|
||||
/// <summary>Manually activated by the controlling player. Costs optional range and UsesPerTurn.</summary>
|
||||
Active,
|
||||
/// <summary>Always active while the unit is in play and conditions are met. No activation, no cost.</summary>
|
||||
Passive,
|
||||
/// <summary>Always-on area effect anchored to a unit's position. Evaluated per-turn and on unit entry.</summary>
|
||||
Aura,
|
||||
/// <summary>Automatically fires when a matching TriggerEvent occurs.</summary>
|
||||
Triggered,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The top-level definition of a unit ability or card effect.
|
||||
/// Stored as JSONB in CardDefinition.AbilitiesJson (array) and CardDefinition.EffectsJson.
|
||||
///
|
||||
/// All four ability types share the Action/Effect/Condition model.
|
||||
/// Type-specific fields are non-null only for the relevant type.
|
||||
/// </summary>
|
||||
public sealed class AbilityDefinition
|
||||
{
|
||||
public AbilityType Type { get; set; }
|
||||
public Condition[]? ActivationConditions { get; set; }
|
||||
public Action[] Actions { get; set; } = [];
|
||||
|
||||
// ── Active only ──────────────────────────────────────────────────────────
|
||||
public CostEntry[]? Cost { get; set; }
|
||||
public AbilityRange? Range { get; set; }
|
||||
/// <summary>How many times this Active ability may be used per turn (default 1).</summary>
|
||||
public int UsesPerTurn { get; set; } = 1;
|
||||
|
||||
// ── Aura only ────────────────────────────────────────────────────────────
|
||||
public AbilityRange? AuraRange { get; set; }
|
||||
|
||||
// ── Triggered only ───────────────────────────────────────────────────────
|
||||
/// <summary>The event that fires this ability. Must be set for Triggered type.</summary>
|
||||
public TriggerEvent? TriggerEvent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional display name shown in the admin tool and client ability list.
|
||||
/// Not required for game logic.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
// ── Value expression ──────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// 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"
|
||||
/// </summary>
|
||||
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 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An affinity value that may be fixed or a dynamic reference.
|
||||
/// E.g.: "Self.Affinity", "Action1.Target.Affinity".
|
||||
/// </summary>
|
||||
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, Owner, Ally, Enemy, Any, Random, Target }
|
||||
|
||||
public sealed class TargetCount
|
||||
{
|
||||
/// <summary>Exact number of targets; or the maximum when UpTo=true.</summary>
|
||||
public int N { get; set; } = 1;
|
||||
/// <summary>Player may select fewer than N valid targets.</summary>
|
||||
public bool UpTo { get; set; }
|
||||
/// <summary>Target all valid entities (N is ignored).</summary>
|
||||
public bool All { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines how targets are resolved for a single Action.
|
||||
/// Scope + Type + Ownership narrow the pool; Filters refine further.
|
||||
/// </summary>
|
||||
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 ────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A single cost element for an Active ability.
|
||||
/// Multiple CostEntry items must all be paid simultaneously before the ability resolves.
|
||||
/// </summary>
|
||||
public sealed class CostEntry
|
||||
{
|
||||
public CostType Type { get; set; }
|
||||
public int Amount { get; set; } = 1;
|
||||
/// <summary>Optional filter for targeted costs (e.g. "Discard a Spirit card from hand").</summary>
|
||||
public Filter[]? Filters { get; set; }
|
||||
}
|
||||
|
||||
// ── Ability range ─────────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class AbilityRange
|
||||
{
|
||||
public int Min { get; set; } = 1;
|
||||
public int Max { get; set; } = 1;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using SOR.Database.Enums;
|
||||
|
||||
// ── Condition base ────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// A boolean predicate evaluated against a subject entity.
|
||||
/// The default subject is Self (the source unit or ability owner).
|
||||
/// Override with Subject = "Target" to evaluate against the current action's resolved target.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// Composite
|
||||
[JsonDerivedType(typeof(AndCondition), "AND")]
|
||||
[JsonDerivedType(typeof(OrCondition), "OR")]
|
||||
[JsonDerivedType(typeof(XorCondition), "XOR")]
|
||||
// Unit (§6.1)
|
||||
[JsonDerivedType(typeof(HealthBelowCondition), "HealthBelow")]
|
||||
[JsonDerivedType(typeof(HealthAboveCondition), "HealthAbove")]
|
||||
[JsonDerivedType(typeof(DefenseIsCondition), "DefenseIs")]
|
||||
[JsonDerivedType(typeof(HasGenusCondition), "HasGenus")]
|
||||
[JsonDerivedType(typeof(HasAbilityCondition), "HasAbility")]
|
||||
[JsonDerivedType(typeof(IsOnTileWithAffinityCondition), "IsOnTileWithAffinity")]
|
||||
[JsonDerivedType(typeof(IsAdjacentToCondition), "IsAdjacentTo")]
|
||||
[JsonDerivedType(typeof(WithinRangeOfCondition), "WithinRangeOf")]
|
||||
[JsonDerivedType(typeof(MovementTypeIsCondition), "MovementTypeIs")]
|
||||
// Player (§6.2)
|
||||
[JsonDerivedType(typeof(SPAtLeastCondition), "SPAtLeast")]
|
||||
[JsonDerivedType(typeof(SPAtMostCondition), "SPAtMost")]
|
||||
[JsonDerivedType(typeof(STAtLeastCondition), "STAtLeast")]
|
||||
[JsonDerivedType(typeof(STAtMostCondition), "STAtMost")]
|
||||
[JsonDerivedType(typeof(HandSizeAtLeastCondition), "HandSizeAtLeast")]
|
||||
[JsonDerivedType(typeof(HandSizeAtMostCondition), "HandSizeAtMost")]
|
||||
[JsonDerivedType(typeof(DeckSizeAtLeastCondition), "DeckSizeAtLeast")]
|
||||
[JsonDerivedType(typeof(DiscardSizeAtLeastCondition), "DiscardSizeAtLeast")]
|
||||
// Tile (§6.3)
|
||||
[JsonDerivedType(typeof(TileAffinityMatchesCondition), "TileAffinityMatches")]
|
||||
[JsonDerivedType(typeof(TileIsOccupiedCondition), "TileIsOccupied")]
|
||||
[JsonDerivedType(typeof(TileIsUnoccupiedCondition), "TileIsUnoccupied")]
|
||||
// Turn/timing (§6.4)
|
||||
[JsonDerivedType(typeof(IsOwnTurnCondition), "IsOwnTurn")]
|
||||
[JsonDerivedType(typeof(IsOpponentTurnCondition), "IsOpponentTurn")]
|
||||
[JsonDerivedType(typeof(IsAllyTurnCondition), "IsAllyTurn")]
|
||||
[JsonDerivedType(typeof(IsActivePlayerTurnCondition), "IsActivePlayerTurn")]
|
||||
// Battlefield (§6.5)
|
||||
[JsonDerivedType(typeof(UnitCountOnBattlefieldCondition), "UnitCountOnBattlefield")]
|
||||
[JsonDerivedType(typeof(CardInZoneCondition), "CardInZone")]
|
||||
public abstract class Condition
|
||||
{
|
||||
/// <summary>
|
||||
/// Which entity to evaluate this condition against.
|
||||
/// "Self" (default) = the source unit / ability owner.
|
||||
/// "Target" = the current action's resolved target.
|
||||
/// </summary>
|
||||
public string Subject { get; set; } = "Self";
|
||||
}
|
||||
|
||||
// ── Composite conditions ──────────────────────────────────────────────────────
|
||||
|
||||
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; } = []; }
|
||||
|
||||
// ── Unit conditions (§6.1) ────────────────────────────────────────────────────
|
||||
|
||||
public sealed class HealthBelowCondition : Condition { public int N { get; set; } }
|
||||
public sealed class HealthAboveCondition : Condition { public int N { get; set; } }
|
||||
public sealed class DefenseIsCondition : Condition { public int N { get; set; } }
|
||||
public sealed class HasGenusCondition : Condition { public string Tag { get; set; } = string.Empty; }
|
||||
/// <summary>Unit must have an ability with the given reference name.</summary>
|
||||
public sealed class HasAbilityCondition : Condition { public string AbilityRef { get; set; } = string.Empty; }
|
||||
public sealed class IsOnTileWithAffinityCondition : Condition { public Affinity Affinity { get; set; } }
|
||||
|
||||
public sealed class IsAdjacentToCondition : Condition
|
||||
{
|
||||
public string UnitType { get; set; } = "Unit";
|
||||
public string Ownership { get; set; } = "Any";
|
||||
}
|
||||
|
||||
public sealed class WithinRangeOfCondition : Condition
|
||||
{
|
||||
/// <summary>Reference to another action's target, e.g. "Action1.Target".</summary>
|
||||
public string Target { get; set; } = string.Empty;
|
||||
public int Min { get; set; } = 1;
|
||||
public int Max { get; set; } = 1;
|
||||
}
|
||||
|
||||
public sealed class MovementTypeIsCondition : Condition { public MovementType MovementType { get; set; } }
|
||||
|
||||
// ── Player conditions (§6.2) ──────────────────────────────────────────────────
|
||||
|
||||
public sealed class SPAtLeastCondition : Condition { public int N { get; set; } }
|
||||
public sealed class SPAtMostCondition : Condition { public int N { get; set; } }
|
||||
public sealed class STAtLeastCondition : Condition { public int N { get; set; } }
|
||||
public sealed class STAtMostCondition : Condition { public int N { get; set; } }
|
||||
public sealed class HandSizeAtLeastCondition : Condition { public int N { get; set; } }
|
||||
public sealed class HandSizeAtMostCondition : Condition { public int N { get; set; } }
|
||||
public sealed class DeckSizeAtLeastCondition : Condition { public int N { get; set; } }
|
||||
public sealed class DiscardSizeAtLeastCondition : Condition { public int N { get; set; } }
|
||||
|
||||
// ── Tile conditions (§6.3) ────────────────────────────────────────────────────
|
||||
|
||||
public sealed class TileAffinityMatchesCondition : Condition { public Affinity Affinity { get; set; } }
|
||||
public sealed class TileIsOccupiedCondition : Condition { public string? UnitType { get; set; } }
|
||||
public sealed class TileIsUnoccupiedCondition : Condition { }
|
||||
|
||||
// ── Turn/timing conditions (§6.4) ────────────────────────────────────────────
|
||||
|
||||
public sealed class IsOwnTurnCondition : Condition { }
|
||||
public sealed class IsOpponentTurnCondition : Condition { }
|
||||
public sealed class IsAllyTurnCondition : Condition { }
|
||||
public sealed class IsActivePlayerTurnCondition : Condition { public string Ownership { get; set; } = "Owner"; }
|
||||
|
||||
// ── Battlefield conditions (§6.5) ─────────────────────────────────────────────
|
||||
|
||||
public enum Comparator { Equal, NotEqual, LessThan, LessThanOrEqual, GreaterThan, GreaterThanOrEqual }
|
||||
|
||||
public sealed class UnitCountOnBattlefieldCondition : Condition
|
||||
{
|
||||
public string Ownership { get; set; } = "Enemy";
|
||||
public string UnitType { get; set; } = "Unit";
|
||||
public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
|
||||
public int N { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CardInZoneCondition : Condition
|
||||
{
|
||||
/// <summary>Reference to a specific card instance ID or definition ID.</summary>
|
||||
public string CardRef { get; set; } = string.Empty;
|
||||
public string Zone { get; set; } = "Hand";
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
/// <summary>How long an applied effect persists.</summary>
|
||||
public enum DurationType
|
||||
{
|
||||
/// <summary>One-time change; no ongoing tracking required.</summary>
|
||||
Instant,
|
||||
/// <summary>Expires at the end of the current active player's turn.</summary>
|
||||
UntilEndOfTurn,
|
||||
/// <summary>Expires at the start of the ability-owner's next turn.</summary>
|
||||
UntilStartOfOwnerTurn,
|
||||
/// <summary>Expires at the start of the source unit's owner's next turn.</summary>
|
||||
UntilStartOfSourceOwnerTurn,
|
||||
/// <summary>Expires after exactly N turns have elapsed.</summary>
|
||||
ForNTurns,
|
||||
/// <summary>Active while a condition evaluates to true; expires when it becomes false.</summary>
|
||||
WhileCondition,
|
||||
/// <summary>Persists for the entire match; never expires.</summary>
|
||||
PermanentInMatch,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duration descriptor attached to every Action in the ability model.
|
||||
/// Governs how long the action's effects remain active.
|
||||
/// </summary>
|
||||
public sealed class DurationModel
|
||||
{
|
||||
public DurationType Type { get; set; } = DurationType.Instant;
|
||||
|
||||
/// <summary>Turn count for <see cref="DurationType.ForNTurns"/>.</summary>
|
||||
public int? N { get; set; }
|
||||
|
||||
/// <summary>Condition evaluated each turn for <see cref="DurationType.WhileCondition"/>.</summary>
|
||||
public Condition? Condition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional ownership scope for timing anchors.
|
||||
/// E.g., "Owner" scopes "UntilEndOfTurn" to the ability-owner's turn end specifically.
|
||||
/// </summary>
|
||||
public string? PlayerScope { get; set; }
|
||||
|
||||
public static DurationModel Instant => new() { Type = DurationType.Instant };
|
||||
public static DurationModel Permanent => new() { Type = DurationType.PermanentInMatch };
|
||||
public static DurationModel EndOfTurn => new() { Type = DurationType.UntilEndOfTurn };
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using SOR.Database.Enums;
|
||||
|
||||
// ── Effect base ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The atomic unit of game-state mutation delivered to a resolved target.
|
||||
/// All effects share a DurationModel (from their containing Action).
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// §5.1 Stat modification
|
||||
[JsonDerivedType(typeof(ModifyHealthEffect), "ModifyHealth")]
|
||||
[JsonDerivedType(typeof(ModifyDefenseEffect), "ModifyDefense")]
|
||||
[JsonDerivedType(typeof(ModifyDamageEffect), "ModifyDamage")]
|
||||
[JsonDerivedType(typeof(ModifyMPEffect), "ModifyMP")]
|
||||
[JsonDerivedType(typeof(SetMovementTypeEffect), "SetMovementType")]
|
||||
[JsonDerivedType(typeof(SetAttackRangeEffect), "SetAttackRange")]
|
||||
[JsonDerivedType(typeof(ModifyCostEffect), "ModifyCost")]
|
||||
[JsonDerivedType(typeof(SetAffinityEffect), "SetAffinity")]
|
||||
[JsonDerivedType(typeof(GrantAdditionalAttackEffect), "GrantAdditionalAttack")]
|
||||
[JsonDerivedType(typeof(SetStatModMultiplierEffect), "SetStatModMultiplier")]
|
||||
// §5.2 Flag modification — unit
|
||||
[JsonDerivedType(typeof(SetCanMoveEffect), "SetCanMove")]
|
||||
[JsonDerivedType(typeof(SetCanAttackEffect), "SetCanAttack")]
|
||||
[JsonDerivedType(typeof(SetCanDefendEffect), "SetCanDefend")]
|
||||
[JsonDerivedType(typeof(SetCanBeAttackedEffect), "SetCanBeAttacked")]
|
||||
[JsonDerivedType(typeof(SetCanBeBlockedEffect), "SetCanBeBlocked")]
|
||||
[JsonDerivedType(typeof(SetCanBeObstructedEffect), "SetCanBeObstructed")]
|
||||
[JsonDerivedType(typeof(SetCanUseAbilityEffect), "SetCanUseAbility")]
|
||||
[JsonDerivedType(typeof(SetCanBeSacrificedEffect), "SetCanBeSacrificed")]
|
||||
// §5.2 Flag modification — player
|
||||
[JsonDerivedType(typeof(SetCanDrawCardsEffect), "SetCanDrawCards")]
|
||||
[JsonDerivedType(typeof(SetAccumulatesSPEffect), "SetAccumulatesSP")]
|
||||
[JsonDerivedType(typeof(SetCanChannelSpiritEffect), "SetCanChannelSpirit")]
|
||||
[JsonDerivedType(typeof(SetCanSacrificeSpiritEffect), "SetCanSacrificeSpirit")]
|
||||
[JsonDerivedType(typeof(SetCanAscendArchSpiritEffect), "SetCanAscendArchSpirit")]
|
||||
[JsonDerivedType(typeof(SetCanTransitionArchSpiritEffect), "SetCanTransitionArchSpirit")]
|
||||
[JsonDerivedType(typeof(SetCanChannelRepentanceEffect), "SetCanChannelRepentance")]
|
||||
[JsonDerivedType(typeof(SetCanChannelInstinctEffect), "SetCanChannelInstinct")]
|
||||
[JsonDerivedType(typeof(SetCanChannelRuinEffect), "SetCanChannelRuin")]
|
||||
[JsonDerivedType(typeof(SetCanChannelTerramorphaMonoEffect), "SetCanChannelTerramorphaMono")]
|
||||
[JsonDerivedType(typeof(SetCanChannelTerramorphaDiEffect), "SetCanChannelTerramorphaDi")]
|
||||
[JsonDerivedType(typeof(SetCanChannelTerramorphaTriEffect), "SetCanChannelTerramorphaTri")]
|
||||
// §5.3 Ability modification
|
||||
[JsonDerivedType(typeof(AddAbilityEffect), "AddAbility")]
|
||||
[JsonDerivedType(typeof(RemoveAbilityEffect), "RemoveAbility")]
|
||||
[JsonDerivedType(typeof(EnableAbilityEffect), "EnableAbility")]
|
||||
[JsonDerivedType(typeof(DisableAbilityEffect),"DisableAbility")]
|
||||
// §5.4 Genus modification
|
||||
[JsonDerivedType(typeof(AddGenusEffect), "AddGenus")]
|
||||
[JsonDerivedType(typeof(RemoveGenusEffect), "RemoveGenus")]
|
||||
// §5.5 Player resource modification
|
||||
[JsonDerivedType(typeof(ModifySPEffect), "ModifySP")]
|
||||
[JsonDerivedType(typeof(ModifySPAccumulationEffect), "ModifySPAccumulation")]
|
||||
[JsonDerivedType(typeof(ModifySTEffect), "ModifyST")]
|
||||
[JsonDerivedType(typeof(ModifyCardsDrawnPerTurnEffect), "ModifyCardsDrawnPerTurn")]
|
||||
// §5.6 Tile modification
|
||||
[JsonDerivedType(typeof(SetBaseAffinity1Effect), "SetBaseAffinity1")]
|
||||
[JsonDerivedType(typeof(SetBaseAffinity2Effect), "SetBaseAffinity2")]
|
||||
[JsonDerivedType(typeof(PushAffinityEffect), "PushAffinity")]
|
||||
[JsonDerivedType(typeof(PushFinalAffinityEffect), "PushFinalAffinity")]
|
||||
// §5.7 Zone / card operations
|
||||
[JsonDerivedType(typeof(DrawCardsEffect), "DrawCards")]
|
||||
[JsonDerivedType(typeof(DiscardCardsEffect), "DiscardCards")]
|
||||
[JsonDerivedType(typeof(ReturnToHandEffect), "ReturnToHand")]
|
||||
[JsonDerivedType(typeof(ReturnToDeckEffect), "ReturnToDeck")]
|
||||
[JsonDerivedType(typeof(ReturnToBattlefieldEffect), "ReturnToBattlefield")]
|
||||
[JsonDerivedType(typeof(SendToDiscardEffect), "SendToDiscard")]
|
||||
[JsonDerivedType(typeof(SearchDeckEffect), "SearchDeck")]
|
||||
[JsonDerivedType(typeof(ShuffleDeckEffect), "ShuffleDeck")]
|
||||
[JsonDerivedType(typeof(RevealCardsEffect), "RevealCards")]
|
||||
[JsonDerivedType(typeof(PlaceOnDeckEffect), "PlaceOnDeck")]
|
||||
[JsonDerivedType(typeof(ChannelCardEffect), "ChannelCard")]
|
||||
// §5.8 Combat / damage
|
||||
[JsonDerivedType(typeof(DealDamageEffect), "DealDamage")]
|
||||
[JsonDerivedType(typeof(HealEffect), "Heal")]
|
||||
[JsonDerivedType(typeof(DealDamageToSelfEffect), "DealDamageToSelf")]
|
||||
[JsonDerivedType(typeof(DOTEffect), "DOT")]
|
||||
[JsonDerivedType(typeof(HOTEffect), "HOT")]
|
||||
// §5.9 Displacement
|
||||
[JsonDerivedType(typeof(PushUnitEffect), "PushUnit")]
|
||||
[JsonDerivedType(typeof(PullUnitEffect), "PullUnit")]
|
||||
[JsonDerivedType(typeof(DisplaceUnitEffect), "DisplaceUnit")]
|
||||
// §5.10 Control
|
||||
[JsonDerivedType(typeof(TakeControlEffect), "TakeControl")]
|
||||
[JsonDerivedType(typeof(GrantMovementControlEffect), "GrantMovementControl")]
|
||||
[JsonDerivedType(typeof(SetFixedSacrificeReturnEffect),"SetFixedSacrificeReturn")]
|
||||
// §5.11 Token
|
||||
[JsonDerivedType(typeof(SummonTokenEffect), "SummonToken")]
|
||||
// §5.12 Deferred
|
||||
[JsonDerivedType(typeof(ApplyOnEventEffect), "ApplyOnEvent")]
|
||||
public abstract class Effect { }
|
||||
|
||||
// ── §5.1 Stat modification ────────────────────────────────────────────────────
|
||||
|
||||
public enum StatTarget { Current, Max }
|
||||
|
||||
public sealed class ModifyHealthEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
public sealed class ModifyDefenseEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
public sealed class ModifyDamageEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifyMPEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
|
||||
public sealed class SetMovementTypeEffect : Effect { public MovementType MovementType { get; set; } }
|
||||
public sealed class SetAttackRangeEffect : Effect { public int Min { get; set; } public int Max { get; set; } }
|
||||
public sealed class ModifyCostEffect : Effect { public int? Sp { get; set; } public int? St { get; set; } }
|
||||
public sealed class SetAffinityEffect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
public sealed class GrantAdditionalAttackEffect : Effect { public int N { get; set; } = 1; }
|
||||
public sealed class SetStatModMultiplierEffect : Effect { public string Stat { get; set; } = string.Empty; public double Multiplier { get; set; } = 1.0; }
|
||||
|
||||
// ── §5.2 Flag modification — unit ─────────────────────────────────────────────
|
||||
|
||||
public sealed class SetCanMoveEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanAttackEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanDefendEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanBeAttackedEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanBeBlockedEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanBeObstructedEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanUseAbilityEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanBeSacrificedEffect : Effect { public bool Value { get; set; } }
|
||||
|
||||
// ── §5.2 Flag modification — player ───────────────────────────────────────────
|
||||
|
||||
public sealed class SetCanDrawCardsEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetAccumulatesSPEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelSpiritEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanSacrificeSpiritEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanAscendArchSpiritEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanTransitionArchSpiritEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelRepentanceEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelInstinctEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelRuinEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelTerramorphaMonoEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelTerramorphaDiEffect : Effect { public bool Value { get; set; } }
|
||||
public sealed class SetCanChannelTerramorphaTriEffect : Effect { public bool Value { get; set; } }
|
||||
|
||||
// ── §5.3 Ability modification ─────────────────────────────────────────────────
|
||||
|
||||
public sealed class AddAbilityEffect : Effect { public AbilityDefinition AbilityDef { get; set; } = new(); }
|
||||
/// <summary>AbilityRef is the ability name (matches AbilityDefinition.Name).</summary>
|
||||
public sealed class RemoveAbilityEffect : Effect { public string AbilityRef { get; set; } = string.Empty; }
|
||||
public sealed class EnableAbilityEffect : Effect { public string AbilityRef { get; set; } = string.Empty; }
|
||||
public sealed class DisableAbilityEffect: Effect { public string AbilityRef { get; set; } = string.Empty; }
|
||||
|
||||
// ── §5.4 Genus modification ───────────────────────────────────────────────────
|
||||
|
||||
public sealed class AddGenusEffect : Effect { public string Tag { get; set; } = string.Empty; }
|
||||
public sealed class RemoveGenusEffect : Effect { public string Tag { get; set; } = string.Empty; }
|
||||
|
||||
// ── §5.5 Player resource modification ─────────────────────────────────────────
|
||||
|
||||
public sealed class ModifySPEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifySPAccumulationEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifySTEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifyCardsDrawnPerTurnEffect: Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
|
||||
// ── §5.6 Tile modification ────────────────────────────────────────────────────
|
||||
|
||||
public sealed class SetBaseAffinity1Effect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
public sealed class SetBaseAffinity2Effect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
public sealed class PushAffinityEffect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
public sealed class PushFinalAffinityEffect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
|
||||
// ── §5.7 Zone / card operations ───────────────────────────────────────────────
|
||||
|
||||
public sealed class DrawCardsEffect : Effect { public int N { get; set; } = 1; public string Player { get; set; } = "Owner"; }
|
||||
public sealed class DiscardCardsEffect : Effect { public int N { get; set; } = 1; public string Player { get; set; } = "Owner"; public Filter[]? Filters { get; set; } }
|
||||
public sealed class ReturnToHandEffect : Effect { } // target is the card (from action target)
|
||||
public sealed class ReturnToDeckEffect : Effect { public string Position { get; set; } = "top"; } // top | bottom | random
|
||||
public sealed class ReturnToBattlefieldEffect : Effect { public string? Controller { get; set; } public Filter[]? TileFilter { get; set; } }
|
||||
public sealed class SendToDiscardEffect: Effect { }
|
||||
public sealed class SearchDeckEffect : Effect
|
||||
{
|
||||
public Filter[]? Filters { get; set; }
|
||||
public int Count { get; set; } = 1;
|
||||
/// <summary>Action applied to each found card (SearchResult references current card).</summary>
|
||||
public Action? ThenAction { get; set; }
|
||||
}
|
||||
public sealed class ShuffleDeckEffect : Effect { public string Player { get; set; } = "Owner"; }
|
||||
public sealed class RevealCardsEffect : Effect { public int N { get; set; } = 1; public string ToOwnership { get; set; } = "Any"; }
|
||||
public sealed class PlaceOnDeckEffect : Effect { public string Position { get; set; } = "top"; }
|
||||
public sealed class ChannelCardEffect : Effect
|
||||
{
|
||||
public bool PayCost { get; set; } = true;
|
||||
public double? CostMultiplier { get; set; }
|
||||
}
|
||||
|
||||
// ── §5.8 Combat / damage ──────────────────────────────────────────────────────
|
||||
|
||||
public sealed class DealDamageEffect : Effect { public ValueExpr Amount { get; set; } = new(); public bool BypassDefense { get; set; } }
|
||||
public sealed class HealEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class DealDamageToSelfEffect : Effect { public ValueExpr Amount { get; set; } = new(); public bool BypassDefense { get; set; } }
|
||||
public sealed class DOTEffect : Effect { public ValueExpr Amount { get; set; } = new(); public DurationModel Duration { get; set; } = DurationModel.EndOfTurn; public bool BypassDefense { get; set; } }
|
||||
public sealed class HOTEffect : Effect { public ValueExpr Amount { get; set; } = new(); public DurationModel Duration { get; set; } = DurationModel.EndOfTurn; }
|
||||
|
||||
// ── §5.9 Displacement ─────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class PushUnitEffect : Effect { public int Tiles { get; set; } = 1; }
|
||||
public sealed class PullUnitEffect : Effect { public int Tiles { get; set; } = 1; }
|
||||
public sealed class DisplaceUnitEffect : Effect { public int Tiles { get; set; } = 1; public string Direction { get; set; } = "North"; }
|
||||
|
||||
// ── §5.10 Control effects ─────────────────────────────────────────────────────
|
||||
|
||||
public sealed class TakeControlEffect : Effect { public DurationModel Duration { get; set; } = DurationModel.EndOfTurn; }
|
||||
public sealed class GrantMovementControlEffect : Effect { public int N { get; set; } = 1; }
|
||||
/// <summary>Overrides the sacrifice formula: controller receives exactly StAmount ST instead.</summary>
|
||||
public sealed class SetFixedSacrificeReturnEffect : Effect { public int StAmount { get; set; } }
|
||||
|
||||
// ── §5.11 Token summoning ─────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Summons a SpiritToken onto a player-selected tile meeting the filter.
|
||||
/// TokenDefJson is a JSONB blob matching a mini-CardDefinition for the token.
|
||||
/// </summary>
|
||||
public sealed class SummonTokenEffect : Effect
|
||||
{
|
||||
public string TokenDefJson { get; set; } = "{}";
|
||||
public Filter[]? TileFilter { get; set; }
|
||||
}
|
||||
|
||||
// ── §5.12 Deferred effects ────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Schedules effects to fire once the next time the specified trigger event occurs.
|
||||
/// Consumed after firing. Cancelled if source leaves battlefield before event fires.
|
||||
/// </summary>
|
||||
public sealed class ApplyOnEventEffect : Effect
|
||||
{
|
||||
public TriggerEvent Trigger { get; set; } = null!;
|
||||
public Effect[] Effects { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
using SOR.Database.Enums;
|
||||
|
||||
// ── Filter base ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Narrows which entities a TargetSelector or condition matches.
|
||||
/// Unit/card filters apply to spirits and ArchSpirits; tile filters to board tiles.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// ── Unit / card filters ──────────────────────────────────────────────────────
|
||||
[JsonDerivedType(typeof(GenusContainsFilter), "GenusContains")]
|
||||
[JsonDerivedType(typeof(AffinityMatchesFilter), "AffinityMatches")]
|
||||
[JsonDerivedType(typeof(HealthBelowFilter), "HealthBelow")]
|
||||
[JsonDerivedType(typeof(HealthAboveFilter), "HealthAbove")]
|
||||
[JsonDerivedType(typeof(DamageRangeFilter), "DamageRange")]
|
||||
[JsonDerivedType(typeof(DefenseRangeFilter), "DefenseRange")]
|
||||
[JsonDerivedType(typeof(MPRangeFilter), "MPRange")]
|
||||
[JsonDerivedType(typeof(HasFlagFilter), "HasFlag")]
|
||||
[JsonDerivedType(typeof(TierIsFilter), "TierIs")]
|
||||
[JsonDerivedType(typeof(IsAdjacentToSourceFilter), "IsAdjacentToSource")]
|
||||
[JsonDerivedType(typeof(CardTypeIsFilter), "CardTypeIs")]
|
||||
[JsonDerivedType(typeof(CardSPCostRangeFilter), "CardSPCostRange")]
|
||||
[JsonDerivedType(typeof(CardSTCostRangeFilter), "CardSTCostRange")]
|
||||
[JsonDerivedType(typeof(WithinRangeFilter), "WithinRange")]
|
||||
[JsonDerivedType(typeof(IsSelfFilter), "IsSelf")]
|
||||
// ── Tile filters ─────────────────────────────────────────────────────────────
|
||||
[JsonDerivedType(typeof(TileAffinityMatchesFilter), "TileAffinityMatches")]
|
||||
[JsonDerivedType(typeof(TileIsOccupiedFilter), "TileIsOccupied")]
|
||||
[JsonDerivedType(typeof(TileIsUnoccupiedFilter), "TileIsUnoccupied")]
|
||||
[JsonDerivedType(typeof(TileWithinRangeFilter), "TileWithinRange")]
|
||||
[JsonDerivedType(typeof(TileIsAdjacentToUnitFilter), "TileIsAdjacentToUnit")]
|
||||
[JsonDerivedType(typeof(TileIsOnPlayerSideFilter), "TileIsOnPlayerSide")]
|
||||
[JsonDerivedType(typeof(TileIsInArchSpiritChannelRangeFilter), "TileIsInArchSpiritChannelRange")]
|
||||
public abstract class Filter { }
|
||||
|
||||
// ── Unit / card filter implementations ───────────────────────────────────────
|
||||
|
||||
/// <summary>Unit's genus array must contain the given tag.</summary>
|
||||
public sealed class GenusContainsFilter : Filter
|
||||
{
|
||||
public string Tag { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Unit's affinity must match.</summary>
|
||||
public sealed class AffinityMatchesFilter : Filter
|
||||
{
|
||||
public Affinity Affinity { get; set; }
|
||||
}
|
||||
|
||||
public sealed class HealthBelowFilter : Filter { public int N { get; set; } }
|
||||
public sealed class HealthAboveFilter : Filter { public int N { get; set; } }
|
||||
|
||||
public sealed class DamageRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
public sealed class DefenseRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
public sealed class MPRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
|
||||
/// <summary>
|
||||
/// Unit must have the specified boolean flag set to true.
|
||||
/// Flag names: CanAttack, CanMove, CanDefend, CanBeAttacked, CanBeBlocked, CanBeSacrificed, etc.
|
||||
/// </summary>
|
||||
public sealed class HasFlagFilter : Filter
|
||||
{
|
||||
public string Flag { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>ArchSpirit must be at the specified tier number.</summary>
|
||||
public sealed class TierIsFilter : Filter
|
||||
{
|
||||
public int Tier { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Target unit must be orthogonally adjacent to the ability's source unit.</summary>
|
||||
public sealed class IsAdjacentToSourceFilter : Filter { }
|
||||
|
||||
public sealed class CardTypeIsFilter : Filter
|
||||
{
|
||||
public CardType CardType { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CardSPCostRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
public sealed class CardSTCostRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
|
||||
/// <summary>Unit must be within Min..Max Manhattan distance of the ability's source unit.</summary>
|
||||
public sealed class WithinRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
|
||||
/// <summary>Matches only the exact unit that owns this ability (not all friendly units).</summary>
|
||||
public sealed class IsSelfFilter : Filter { }
|
||||
|
||||
// ── Tile filter implementations ───────────────────────────────────────────────
|
||||
|
||||
public sealed class TileAffinityMatchesFilter : Filter
|
||||
{
|
||||
public Affinity Affinity { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Tile must be occupied; optionally restrict to a specific unit type.</summary>
|
||||
public sealed class TileIsOccupiedFilter : Filter
|
||||
{
|
||||
public string? UnitType { get; set; } // "Spirit" | "ArchSpirit" | "SpiritToken" | null (any)
|
||||
}
|
||||
|
||||
public sealed class TileIsUnoccupiedFilter : Filter { }
|
||||
|
||||
public sealed class TileWithinRangeFilter : Filter { public int Min { get; set; } public int Max { get; set; } }
|
||||
|
||||
public sealed class TileIsAdjacentToUnitFilter : Filter
|
||||
{
|
||||
public string Ownership { get; set; } = "Any"; // TargetOwnership as string
|
||||
public Filter? UnitFilter { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Tile falls within the starting placement side of the specified player ownership group.</summary>
|
||||
public sealed class TileIsOnPlayerSideFilter : Filter
|
||||
{
|
||||
public string Ownership { get; set; } = "Owner";
|
||||
}
|
||||
|
||||
/// <summary>Tile is within the active ArchSpirit's channeling range for the specified player.</summary>
|
||||
public sealed class TileIsInArchSpiritChannelRangeFilter : Filter
|
||||
{
|
||||
public string Ownership { get; set; } = "Owner";
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
// ── TriggerEvent base ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the game event that causes a Triggered ability to fire.
|
||||
/// Every event supports an optional ownership scope applied to the acting entity
|
||||
/// and most accept an optional filter for further narrowing.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// §8.1 Turn phase
|
||||
[JsonDerivedType(typeof(OnTurnStartTrigger), "OnTurnStart")]
|
||||
[JsonDerivedType(typeof(OnTurnEndTrigger), "OnTurnEnd")]
|
||||
// §8.2 Channeling
|
||||
[JsonDerivedType(typeof(OnChanneledTrigger), "OnChanneled")]
|
||||
// §8.3 ArchSpirit tier actions
|
||||
[JsonDerivedType(typeof(OnAscendTrigger), "OnAscend")]
|
||||
[JsonDerivedType(typeof(OnTransitionTrigger), "OnTransition")]
|
||||
// §8.4 Unit actions
|
||||
[JsonDerivedType(typeof(OnUnitMoveTrigger), "OnUnitMove")]
|
||||
[JsonDerivedType(typeof(OnUnitAttackTrigger), "OnUnitAttack")]
|
||||
[JsonDerivedType(typeof(OnUnitAbilityActivatedTrigger), "OnUnitAbilityActivated")]
|
||||
[JsonDerivedType(typeof(OnUnitMPSpentTrigger), "OnUnitMPSpent")]
|
||||
// §8.5 Damage and healing
|
||||
[JsonDerivedType(typeof(OnDamageDealtTrigger), "OnDamageDealt")]
|
||||
[JsonDerivedType(typeof(OnDamagePreventedTrigger), "OnDamagePrevented")]
|
||||
[JsonDerivedType(typeof(OnHealedTrigger), "OnHealed")]
|
||||
// §8.6 Unit lifecycle
|
||||
[JsonDerivedType(typeof(OnUnitEnterBattlefieldTrigger), "OnUnitEnterBattlefield")]
|
||||
[JsonDerivedType(typeof(OnUnitLeaveBattlefieldTrigger), "OnUnitLeaveBattlefield")]
|
||||
[JsonDerivedType(typeof(OnUnitDeathTrigger), "OnUnitDeath")]
|
||||
[JsonDerivedType(typeof(OnUnitSentToDiscardTrigger), "OnUnitSentToDiscard")]
|
||||
[JsonDerivedType(typeof(OnSpiritSacrificedTrigger), "OnSpiritSacrificed")]
|
||||
[JsonDerivedType(typeof(OnTokenSummonedTrigger), "OnTokenSummoned")]
|
||||
// §8.7 Unit state changes
|
||||
[JsonDerivedType(typeof(OnStatModifiedTrigger), "OnStatModified")]
|
||||
[JsonDerivedType(typeof(OnAbilityAddedTrigger), "OnAbilityAdded")]
|
||||
[JsonDerivedType(typeof(OnAbilityRemovedTrigger), "OnAbilityRemoved")]
|
||||
[JsonDerivedType(typeof(OnGenusChangedTrigger), "OnGenusChanged")]
|
||||
// §8.8 Ruin
|
||||
[JsonDerivedType(typeof(OnRuinActivationTrigger), "OnRuinActivation")]
|
||||
[JsonDerivedType(typeof(OnUnitOccupyRuinTrigger), "OnUnitOccupyRuin")]
|
||||
// §8.9 Tile
|
||||
[JsonDerivedType(typeof(OnTileAffinityChangedTrigger), "OnTileAffinityChanged")]
|
||||
// §8.10 Player resources
|
||||
[JsonDerivedType(typeof(OnSPGainedTrigger), "OnSPGained")]
|
||||
[JsonDerivedType(typeof(OnSPSpentTrigger), "OnSPSpent")]
|
||||
[JsonDerivedType(typeof(OnSTGainedTrigger), "OnSTGained")]
|
||||
[JsonDerivedType(typeof(OnSTSpentTrigger), "OnSTSpent")]
|
||||
// §8.11 Card zone events
|
||||
[JsonDerivedType(typeof(OnCardDrawnTrigger), "OnCardDrawn")]
|
||||
[JsonDerivedType(typeof(OnCardDiscardedTrigger), "OnCardDiscarded")]
|
||||
[JsonDerivedType(typeof(OnCardReturnedToHandTrigger), "OnCardReturnedToHand")]
|
||||
[JsonDerivedType(typeof(OnCardReturnedToDeckTrigger), "OnCardReturnedToDeck")]
|
||||
[JsonDerivedType(typeof(OnDeckShuffledTrigger), "OnDeckShuffled")]
|
||||
[JsonDerivedType(typeof(OnCardsRevealedTrigger), "OnCardsRevealed")]
|
||||
// §8.12 Effect and targeting lifecycle
|
||||
[JsonDerivedType(typeof(OnTargetedByAbilityTrigger), "OnTargetedByAbility")]
|
||||
[JsonDerivedType(typeof(OnEffectAppliedTrigger), "OnEffectApplied")]
|
||||
[JsonDerivedType(typeof(OnEnterAuraRangeTrigger), "OnEnterAuraRange")]
|
||||
[JsonDerivedType(typeof(OnLeaveAuraRangeTrigger), "OnLeaveAuraRange")]
|
||||
public abstract class TriggerEvent { }
|
||||
|
||||
// ── §8.1 Turn phase ───────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnTurnStartTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; }
|
||||
public sealed class OnTurnEndTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; }
|
||||
|
||||
// ── §8.2 Channeling ───────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnChanneledTrigger : TriggerEvent
|
||||
{
|
||||
public string CardType { get; set; } = "Spirit";
|
||||
public string Ownership { get; set; } = "Owner";
|
||||
public Filter? Filter { get; set; }
|
||||
}
|
||||
|
||||
// ── §8.3 ArchSpirit tier actions ──────────────────────────────────────────────
|
||||
|
||||
public sealed class OnAscendTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; }
|
||||
public sealed class OnTransitionTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; }
|
||||
|
||||
// ── §8.4 Unit actions ─────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnUnitMoveTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitAttackTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitAbilityActivatedTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitMPSpentTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } public int? Amount { get; set; } }
|
||||
|
||||
// ── §8.5 Damage and healing ───────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnDamageDealtTrigger : TriggerEvent
|
||||
{
|
||||
public string SourceOwnership { get; set; } = "Any";
|
||||
public string TargetOwnership { get; set; } = "Any";
|
||||
public string DamageType { get; set; } = "Any"; // "HP" | "Defense" | "Any"
|
||||
public int? Amount { get; set; }
|
||||
}
|
||||
public sealed class OnDamagePreventedTrigger : TriggerEvent { public string TargetOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnHealedTrigger : TriggerEvent { public string TargetOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } public int? Amount { get; set; } }
|
||||
|
||||
// ── §8.6 Unit lifecycle ───────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnUnitEnterBattlefieldTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitLeaveBattlefieldTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitDeathTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnUnitSentToDiscardTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } public string? CausedBy { get; set; } }
|
||||
public sealed class OnSpiritSacrificedTrigger : TriggerEvent { public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnTokenSummonedTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
|
||||
// ── §8.7 Unit state changes ───────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnStatModifiedTrigger : TriggerEvent { public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } public string? Stat { get; set; } }
|
||||
public sealed class OnAbilityAddedTrigger : TriggerEvent { public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnAbilityRemovedTrigger: TriggerEvent { public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnGenusChangedTrigger : TriggerEvent { public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
|
||||
// ── §8.8 Ruin ────────────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnRuinActivationTrigger : TriggerEvent { public string RuinOwnership { get; set; } = "Any"; public string? OccupantOwnership { get; set; } }
|
||||
public sealed class OnUnitOccupyRuinTrigger : TriggerEvent { public string UnitOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
|
||||
// ── §8.9 Tile ────────────────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnTileAffinityChangedTrigger : TriggerEvent { public Filter? Filter { get; set; } }
|
||||
|
||||
// ── §8.10 Player resources ────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnSPGainedTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public int? Amount { get; set; } }
|
||||
public sealed class OnSPSpentTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public int? Amount { get; set; } }
|
||||
public sealed class OnSTGainedTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public int? Amount { get; set; } }
|
||||
public sealed class OnSTSpentTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public int? Amount { get; set; } }
|
||||
|
||||
// ── §8.11 Card zone events ────────────────────────────────────────────────────
|
||||
|
||||
public sealed class OnCardDrawnTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnCardDiscardedTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public Filter? Filter { get; set; } public string? Cause { get; set; } }
|
||||
public sealed class OnCardReturnedToHandTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnCardReturnedToDeckTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnDeckShuffledTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; }
|
||||
public sealed class OnCardsRevealedTrigger : TriggerEvent { public string Player { get; set; } = "Owner"; public Filter? Filter { get; set; } }
|
||||
|
||||
// ── §8.12 Effect and targeting lifecycle ──────────────────────────────────────
|
||||
|
||||
public sealed class OnTargetedByAbilityTrigger : TriggerEvent { public string TargetOwnership { get; set; } = "Owner"; public string SourceOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnEffectAppliedTrigger : TriggerEvent { public string TargetOwnership { get; set; } = "Owner"; public string SourceOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnEnterAuraRangeTrigger : TriggerEvent { public string AuraOwnership { get; set; } = "Owner"; public string UnitOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
public sealed class OnLeaveAuraRangeTrigger : TriggerEvent { public string AuraOwnership { get; set; } = "Owner"; public string UnitOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
|
||||
Reference in New Issue
Block a user