diff --git a/Server/src/SOR.Ai/Heuristics/ActionCandidateGenerator.cs b/Server/src/SOR.Ai/Heuristics/ActionCandidateGenerator.cs
index 47b0981..60972aa 100644
--- a/Server/src/SOR.Ai/Heuristics/ActionCandidateGenerator.cs
+++ b/Server/src/SOR.Ai/Heuristics/ActionCandidateGenerator.cs
@@ -1,3 +1,4 @@
+#pragma warning disable CS0618 // Authorized reader of obsolete Actions/Cost fields for backwards-compat
namespace SOR.Ai.Heuristics;
using SOR.Ai.Core;
diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs
index 32f0ea3..6424d03 100644
--- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs
+++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs
@@ -1,3 +1,4 @@
+#pragma warning disable CS0618 // AbilitySystem is the authorized reader of obsolete Actions/Cost fields for backwards-compat migration
namespace SOR.Game.Abilities;
using System.Text.Json;
diff --git a/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs b/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs
index 83a1765..785e0cb 100644
--- a/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs
+++ b/Server/src/SOR.Game/Abilities/Models/AbilityDefinition.cs
@@ -24,9 +24,25 @@ public sealed class AbilityDefinition
{
public AbilityType Type { get; set; }
public Condition[]? ActivationConditions { get; set; }
+ ///
+ /// Logical grouping of action steps (AND/OR/XOR). Replaces .
+ /// If null at read-time, the engine wraps in an And group automatically.
+ ///
+ public ActionGroup? ActionGroup { get; set; }
+
+ /// Flat action list. Replaced by ; kept for migration reads only.
+ [System.Obsolete("Use ActionGroup instead. This field is read for backwards-compat only.")]
public Action[] Actions { get; set; } = [];
// ── Active only ──────────────────────────────────────────────────────────
+ ///
+ /// Logical cost grouping (AND/OR/XOR). Replaces .
+ /// If null, the engine falls back to for migration reads.
+ ///
+ public CostGroup? CostGroup { get; set; }
+
+ /// Flat cost array. Replaced by ; kept for migration reads only.
+ [System.Obsolete("Use CostGroup instead. This field is read for backwards-compat only.")]
public CostEntry[]? Cost { get; set; }
public AbilityRange? Range { get; set; }
/// How many times this Active ability may be used per turn (default 1).
@@ -46,6 +62,16 @@ public sealed class AbilityDefinition
/// Null means effects expire at their own configured Duration.
///
public DurationModel? LingerDuration { get; set; }
+ ///
+ /// Actions fired once for each unit that enters this aura's range.
+ /// The entering unit is the resolved target for these actions.
+ ///
+ public ActionGroup? OnEnterAuraActions { get; set; }
+ ///
+ /// Actions fired once for each unit that leaves this aura's range.
+ /// The leaving unit is the resolved target for these actions.
+ ///
+ public ActionGroup? OnLeaveAuraActions { get; set; }
// ── Triggered only ───────────────────────────────────────────────────────
/// The event that fires this ability. Must be set for Triggered type.
diff --git a/Server/src/SOR.Game/Abilities/Models/Action.cs b/Server/src/SOR.Game/Abilities/Models/Action.cs
index bb3c15e..32361a3 100644
--- a/Server/src/SOR.Game/Abilities/Models/Action.cs
+++ b/Server/src/SOR.Game/Abilities/Models/Action.cs
@@ -34,6 +34,12 @@ 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 }
+///
+/// Who makes the selection from the valid target pool.
+/// Distinct from , which filters whose entities qualify.
+///
+public enum TargetChooser { Self, Opponent, Ally, Random }
+
public sealed class TargetCount
{
/// Exact number of targets; or the maximum when UpTo=true.
@@ -52,7 +58,14 @@ public sealed class TargetSelector
{
public TargetScope Scope { get; set; }
public TargetType Type { get; set; }
+ /// Filters whose entities qualify as valid targets.
public TargetOwnership Ownership { get; set; }
+ ///
+ /// Who makes the selection from the valid target pool.
+ /// Self/Opponent/Ally emits a PendingTargetPick to the appropriate client.
+ /// Random resolves immediately server-side with no client prompt.
+ ///
+ public TargetChooser Chooser { get; set; } = TargetChooser.Self;
public TargetCount Count { get; set; } = new();
public Filter[]? Filters { get; set; }
}
@@ -84,13 +97,19 @@ public sealed class Action
// ── 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.
+/// Within a single action step (target already resolved), presents a set of mutually
+/// exclusive effect branches. Exactly one branch is selected; others are skipped.
+/// Use for "deal damage OR push the same target." For grouping distinct action steps
+/// with different targets, use instead.
///
public sealed class ChooseOne
{
public Branch[] Branches { get; set; } = [];
+ ///
+ /// Who selects the branch.
+ /// "Self" = controlling player, "Opponent" = opposing player, "Random" = server picks.
+ ///
+ public string ChooserRole { get; set; } = "Self";
}
public sealed class Branch
@@ -99,6 +118,35 @@ public sealed class Branch
public Action[] Actions { get; set; } = [];
}
+// ── ActionGroup ───────────────────────────────────────────────────────────────
+
+///
+/// Logical grouping of ability-level action steps with AND / OR / XOR semantics.
+/// Replaces the flat Action[] on .
+///
+/// AND — all children execute sequentially (same as the old flat list).
+/// OR — the chooser picks exactly one child (leaf Action or nested group) to execute;
+/// emits PendingActionGroupPick when ChooserRole is Self or Opponent.
+/// XOR — same resolution as OR; signals mutually-exclusive design intent.
+///
+/// Groups can nest arbitrarily. The engine descends recursively.
+///
+public sealed class ActionGroup
+{
+ public ActionGroupLogicOp LogicOp { get; set; } = ActionGroupLogicOp.And;
+ ///
+ /// For OR/XOR: who selects which child executes.
+ /// "Self" / "Opponent" emits PendingActionGroupPick. "Random" resolves server-side.
+ ///
+ public string ChooserRole { get; set; } = "Self";
+ /// Leaf action steps in this group.
+ public Action[] Actions { get; set; } = [];
+ /// Nested child groups. Evaluated after leaf Actions in AND mode; same pool as Actions in OR/XOR.
+ public ActionGroup[] Groups { get; set; } = [];
+}
+
+public enum ActionGroupLogicOp { And, Or, Xor }
+
// ── Cost entry ────────────────────────────────────────────────────────────────
public enum CostType
@@ -149,6 +197,35 @@ public sealed class CostEntry
public CostPickMode? PickMode { get; set; }
}
+// ── CostGroup ─────────────────────────────────────────────────────────────────
+
+///
+/// Logical grouping of ability costs with AND / OR / XOR semantics.
+/// Replaces the flat CostEntry[] on .
+///
+/// AND — all entries must be paid (same as the old flat array).
+/// OR — the chooser selects one entry or child group to pay;
+/// emits PendingCostGroupPick when ChooserRole is Self or Opponent.
+/// XOR — same resolution as OR; signals mutually-exclusive design intent.
+///
+/// Groups can nest arbitrarily. Example: (pay 2 SP AND discard 1 card) OR (pay 6 SP).
+///
+public sealed class CostGroup
+{
+ public CostGroupLogicOp LogicOp { get; set; } = CostGroupLogicOp.And;
+ ///
+ /// For OR/XOR: who selects which option is paid.
+ /// "Self" / "Opponent" emits PendingCostGroupPick. "Random" resolves server-side.
+ ///
+ public string ChooserRole { get; set; } = "Self";
+ /// Leaf cost entries in this group.
+ public CostEntry[] Entries { get; set; } = [];
+ /// Nested child groups. In AND mode all pay; in OR/XOR the chooser picks one.
+ public CostGroup[] Groups { get; set; } = [];
+}
+
+public enum CostGroupLogicOp { And, Or, Xor }
+
// ── Ability range ─────────────────────────────────────────────────────────────
public sealed class AbilityRange
diff --git a/Server/src/SOR.Game/Abilities/Models/Conditions.cs b/Server/src/SOR.Game/Abilities/Models/Conditions.cs
index c85ff35..922c878 100644
--- a/Server/src/SOR.Game/Abilities/Models/Conditions.cs
+++ b/Server/src/SOR.Game/Abilities/Models/Conditions.cs
@@ -52,6 +52,19 @@ using SOR.Database.Enums;
[PolyType(typeof(UnitCountOnBattlefieldCondition), "UnitCountOnBattlefield")]
[PolyType(typeof(CardInZoneCondition), "CardInZone")]
[PolyType(typeof(ControlledTileCountWithAffinityCondition), "ControlledTileCountWithAffinity")]
+// Extended unit (§6.6)
+[PolyType(typeof(UnitTypeIsCondition), "UnitTypeIs")]
+[PolyType(typeof(OwnershipIsCondition), "OwnershipIs")]
+[PolyType(typeof(IsThisCardCondition), "IsThisCard")]
+[PolyType(typeof(UnitPropertyCompareCondition), "UnitPropertyCompare")]
+[PolyType(typeof(PlayerPropertyCompareCondition), "PlayerPropertyCompare")]
+[PolyType(typeof(HandContainsCountCondition), "HandContainsCount")]
+[PolyType(typeof(CardDefinitionCountInZoneCondition),"CardDefinitionCountInZone")]
+[PolyType(typeof(IsInRangeOfUnitCondition), "IsInRangeOfUnit")]
+[PolyType(typeof(TileOccupantCondition), "TileOccupant")]
+[PolyType(typeof(SurroundingTileCondition), "SurroundingTile")]
+[PolyType(typeof(SPAccumulationCompareCondition), "SPAccumulationCompare")]
+[PolyType(typeof(CostOfCardsInHandCondition), "CostOfCardsInHand")]
public abstract class Condition
{
///
@@ -151,3 +164,129 @@ public sealed class ControlledTileCountWithAffinityCondition : Condition
public int N { get; set; }
public string Ownership { get; set; } = "Owner";
}
+
+// ── §6.6 Extended unit conditions ─────────────────────────────────────────────
+
+/// Subject unit's CardType must match. Values: "Spirit", "ArchSpirit", "SpiritToken".
+[PolyType(typeof(UnitTypeIsCondition), "UnitTypeIs")]
+public sealed class UnitTypeIsCondition : Condition
+{
+ public string UnitType { get; set; } = "Spirit";
+}
+
+/// Subject unit is owned by the specified player group.
+[PolyType(typeof(OwnershipIsCondition), "OwnershipIs")]
+public sealed class OwnershipIsCondition : Condition
+{
+ /// "Self" | "Ally" | "Opponent" | "Owner"
+ public string Ownership { get; set; } = "Owner";
+}
+
+/// Subject is the exact card instance that owns this ability (by InstanceId).
+[PolyType(typeof(IsThisCardCondition), "IsThisCard")]
+public sealed class IsThisCardCondition : Condition { }
+
+///
+/// Generic numeric comparison against a named unit property.
+/// PropertyName values: "Damage", "Defense", "MaxDefense", "Health", "MaxHealth",
+/// "MovementPoints", "MaxMovementPoints", "MinAttackRange", "MaxAttackRange",
+/// "MinChannelRange", "MaxChannelRange", "Tier".
+///
+[PolyType(typeof(UnitPropertyCompareCondition), "UnitPropertyCompare")]
+public sealed class UnitPropertyCompareCondition : Condition
+{
+ public string PropertyName { get; set; } = string.Empty;
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int Value { get; set; }
+}
+
+///
+/// Generic numeric comparison against a named player resource.
+/// PropertyName values: "SP", "ST", "SPAccumulation", "HandSize", "DeckSize", "DiscardSize".
+/// Subject field ("Self", "Owner", "Ally", "Opponent") identifies which player.
+///
+[PolyType(typeof(PlayerPropertyCompareCondition), "PlayerPropertyCompare")]
+public sealed class PlayerPropertyCompareCondition : Condition
+{
+ public string PropertyName { get; set; } = "SP";
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int Value { get; set; }
+}
+
+/// The specified player's hand contains at least N cards of the given type and/or affinity.
+[PolyType(typeof(HandContainsCountCondition), "HandContainsCount")]
+public sealed class HandContainsCountCondition : Condition
+{
+ public string? CardType { get; set; } // null = any
+ public Affinity? Affinity { get; set; } // null = any
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int N { get; set; } = 1;
+}
+
+///
+/// X copies of the source card's definition exist in the given zone(s) for the given ownership.
+///
+[PolyType(typeof(CardDefinitionCountInZoneCondition), "CardDefinitionCountInZone")]
+public sealed class CardDefinitionCountInZoneCondition : Condition
+{
+ /// "Hand" | "Deck" | "Discard" | "Battlefield"
+ public string Zone { get; set; } = "Hand";
+ /// "Self" | "Ally" | "Opponent" | "Any"
+ public string Ownership { get; set; } = "Any";
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int N { get; set; } = 1;
+}
+
+/// Subject unit is within [Min, Max] Manhattan distance of a unit matching type + ownership.
+[PolyType(typeof(IsInRangeOfUnitCondition), "IsInRangeOfUnit")]
+public sealed class IsInRangeOfUnitCondition : Condition
+{
+ public int Min { get; set; } = 1;
+ public int Max { get; set; } = 1;
+ public string UnitType { get; set; } = "Unit";
+ public string Ownership { get; set; } = "Any";
+ public Filter[]? UnitFilters { get; set; }
+}
+
+/// The tile the subject unit occupies is occupied by a unit matching the given type/ownership/filters.
+[PolyType(typeof(TileOccupantCondition), "TileOccupant")]
+public sealed class TileOccupantCondition : Condition
+{
+ public string UnitType { get; set; } = "Unit";
+ public string Ownership { get; set; } = "Any";
+ public Filter[]? UnitFilters { get; set; }
+}
+
+/// At least N surrounding tiles within [Min, Max] distance match the given affinity/occupancy filters.
+[PolyType(typeof(SurroundingTileCondition), "SurroundingTile")]
+public sealed class SurroundingTileCondition : Condition
+{
+ public int Min { get; set; } = 1;
+ public int Max { get; set; } = 1;
+ public Comparator TileCountComparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int TileCount { get; set; } = 1;
+ public Filter[]? TileFilters { get; set; }
+}
+
+/// Compares the source player's SP accumulation per turn against a value.
+[PolyType(typeof(SPAccumulationCompareCondition), "SPAccumulationCompare")]
+public sealed class SPAccumulationCompareCondition : Condition
+{
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int Value { get; set; }
+}
+
+///
+/// The aggregate channeling cost (SP or ST) of cards matching the given filters in the player's hand
+/// meets the comparator threshold.
+///
+[PolyType(typeof(CostOfCardsInHandCondition), "CostOfCardsInHand")]
+public sealed class CostOfCardsInHandCondition : Condition
+{
+ /// "SP" | "ST"
+ public string CostType { get; set; } = "SP";
+ public string? CardType { get; set; } // null = any
+ public Affinity? Affinity { get; set; } // null = any
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int Value { get; set; }
+}
diff --git a/Server/src/SOR.Game/Abilities/Models/Effects.cs b/Server/src/SOR.Game/Abilities/Models/Effects.cs
index 233e154..597bee6 100644
--- a/Server/src/SOR.Game/Abilities/Models/Effects.cs
+++ b/Server/src/SOR.Game/Abilities/Models/Effects.cs
@@ -211,8 +211,19 @@ public sealed class HealEffect : Effect { public ValueExpr Amount {
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; }
-public sealed class PreventDeathEffect : Effect { }
-public sealed class PreventNextDamageEffect : Effect { public ValueExpr? MaxAmount { get; set; } }
+public sealed class PreventDeathEffect : Effect
+{
+ /// After preventing death, set the unit's HP to this value instead of leaving at 0. Null = leave at 1.
+ public int? DamageTakenSetToHp { get; set; }
+ /// When true, the lethal hit's damage is fully ignored (unit takes 0). DamageTakenSetToHp is ignored when this is true.
+ public bool DamageIgnored { get; set; }
+}
+public sealed class PreventNextDamageEffect : Effect
+{
+ public ValueExpr? MaxAmount { get; set; }
+ /// How many times this shield can absorb hits before expiring. Default 1.
+ public int Times { get; set; } = 1;
+}
public sealed class SetHealthMinimumEffect : Effect { public int Minimum { get; set; } = 1; }
public sealed class ClearPreventDeathEffect : Effect { }
public sealed class ClearPreventNextDamageEffect : Effect { }
@@ -268,8 +279,196 @@ public sealed class SummonTokenEffect : Effect
public Filter[]? TileFilter { get; set; }
}
+// ── §5.13 ArchSpirit zone operations ─────────────────────────────────────────
+
+[PolyType(typeof(AscendFromZoneEffect), "AscendFromZone")]
+[PolyType(typeof(TransitionFromZoneEffect), "TransitionFromZone")]
+[PolyType(typeof(ModifyChannelRangeEffect), "ModifyChannelRange")]
+
+// ── §5.14 Ruin manipulation ───────────────────────────────────────────────────
+
+[PolyType(typeof(RelocateRuinEffect), "RelocateRuin")]
+[PolyType(typeof(ActivateRuinAbilityEffect), "ActivateRuinAbility")]
+[PolyType(typeof(DisableRuinForDurationEffect), "DisableRuinForDuration")]
+
+// ── §5.15 Enhanced channeling ─────────────────────────────────────────────────
+
+[PolyType(typeof(ChannelCardFromZoneEffect), "ChannelCardFromZone")]
+
+// ── §5.16 Token / spirit operations ──────────────────────────────────────────
+
+[PolyType(typeof(CloneSpiritAsTokenEffect), "CloneSpiritAsToken")]
+[PolyType(typeof(DestroyTokenEffect), "DestroyToken")]
+[PolyType(typeof(ModifySacrificeTokenReturnEffect),"ModifySacrificeTokenReturn")]
+
+// ── §5.17 Player operations ───────────────────────────────────────────────────
+
+[PolyType(typeof(SkipTurnEffect), "SkipTurn")]
+[PolyType(typeof(ModifyCardsDrawnThisTurnEffect), "ModifyCardsDrawnThisTurn")]
+
+// ── §5.18 Zone operations ─────────────────────────────────────────────────────
+
+[PolyType(typeof(StackDeckEffect), "StackDeck")]
+[PolyType(typeof(SearchAndPlaceEffect), "SearchAndPlace")]
+
+// ── §5.19 Unit manipulation ───────────────────────────────────────────────────
+
+[PolyType(typeof(ChangeAttackTypeEffect), "ChangeAttackType")]
+[PolyType(typeof(ObstructMovementTypeEffect), "ObstructMovementType")]
+
// ── §5.12 Deferred effects ────────────────────────────────────────────────────
+// ── §5.13 ArchSpirit zone operations ──────────────────────────────────────────
+
+/// Ascend the target ArchSpirit using a previous-tier card from the given zone.
+public sealed class AscendFromZoneEffect : Effect
+{
+ /// "Hand" | "Deck" | "Discard"
+ public string Zone { get; set; } = "Hand";
+ public bool IgnoreCost { get; set; }
+}
+
+/// Transition the target ArchSpirit using a same-tier card from the given zone.
+public sealed class TransitionFromZoneEffect : Effect
+{
+ /// "Hand" | "Deck" | "Discard"
+ public string Zone { get; set; } = "Hand";
+ public bool IgnoreCost { get; set; }
+}
+
+/// Modify the min and/or max channel range of the target ArchSpirit by the given deltas.
+public sealed class ModifyChannelRangeEffect : Effect
+{
+ public int MinDelta { get; set; }
+ public int MaxDelta { get; set; }
+}
+
+// ── §5.14 Ruin manipulation ───────────────────────────────────────────────────
+
+/// Move the target Ruin to the tile resolved by the action's TargetSelector.
+public sealed class RelocateRuinEffect : Effect { }
+
+///
+/// Programmatically activate one of the target Ruin's OnRuinActivation abilities.
+/// If Random is true, a random eligible ability is chosen (same as normal activation).
+/// If AbilityRef is set, that specific ability is activated.
+/// The source-skip guard in FireTrigger must be applied to avoid double-firing.
+///
+public sealed class ActivateRuinAbilityEffect : Effect
+{
+ public string? AbilityRef { get; set; }
+ public bool Random { get; set; } = true;
+ /// When true, all targets for the activated ability are chosen by the ability system rather than the player.
+ public bool ChooseAllTargets { get; set; }
+}
+
+/// Disable the target Ruin's abilities for the given duration.
+public sealed class DisableRuinForDurationEffect : Effect
+{
+ public DurationModel Duration { get; set; } = DurationModel.EndOfTurn;
+}
+
+// ── §5.15 Enhanced channeling ─────────────────────────────────────────────────
+
+///
+/// Unified channel-card effect with full zone and constraint control.
+/// Supersedes the minimal .
+///
+public sealed class ChannelCardFromZoneEffect : Effect
+{
+ /// "Hand" | "Deck" | "Discard"
+ public string Zone { get; set; } = "Hand";
+ /// Who controls the channeled unit. "Self" | "Ally" | "Opponent" | "Random" | "Target"
+ public string UnderControlOf { get; set; } = "Self";
+ public bool IgnoreChannelCost { get; set; }
+ public bool IgnoreTurnConstraint { get; set; }
+ public bool IgnoreChannelRange { get; set; }
+ public bool IgnoreAffinity { get; set; }
+ /// Keep the card in its original zone after channeling (e.g. Instinct/Repentance with KeepInHand).
+ public bool KeepInZone { get; set; }
+ /// When true, the player selects the destination tile (removes random placement for Ruins).
+ public bool TargetTile { get; set; }
+ /// Card must be within the source ArchSpirit's channel range.
+ public bool InOwnChannelRange { get; set; }
+ /// Card must be within the target ArchSpirit's channel range.
+ public bool InTargetChannelRange { get; set; }
+ public Filter[]? Filters { get; set; }
+}
+
+// ── §5.16 Token / spirit operations ──────────────────────────────────────────
+
+///
+/// Clone the target Spirit as a SpiritToken placed on an adjacent tile or within channel range.
+///
+public sealed class CloneSpiritAsTokenEffect : Effect
+{
+ /// "NeighborTile" | "RandomInChannelRange" | "TargetTile"
+ public string DestinationScope { get; set; } = "NeighborTile";
+}
+
+/// Destroy the target SpiritToken immediately.
+public sealed class DestroyTokenEffect : Effect { }
+
+/// Override the ST returned to the controlling player when a Spirit is sacrificed.
+public sealed class ModifySacrificeTokenReturnEffect : Effect
+{
+ public int StAmount { get; set; }
+}
+
+// ── §5.17 Player operations ───────────────────────────────────────────────────
+
+/// The target player skips their next turn.
+public sealed class SkipTurnEffect : Effect { }
+
+/// Add or subtract from the number of cards the target player draws this turn only.
+public sealed class ModifyCardsDrawnThisTurnEffect : Effect
+{
+ public ValueExpr Amount { get; set; } = new();
+}
+
+// ── §5.18 Zone operations ─────────────────────────────────────────────────────
+
+///
+/// Let the controlling player view and reorder the top N cards of the target player's deck.
+///
+public sealed class StackDeckEffect : Effect
+{
+ public int Count { get; set; } = 1;
+ /// "Self" | "Opponent" | "Random"
+ public string Chooser { get; set; } = "Self";
+}
+
+///
+/// Search the target player's deck for cards matching Filters, put Count of them
+/// into the Destination zone, then optionally shuffle the deck.
+///
+public sealed class SearchAndPlaceEffect : Effect
+{
+ public Filter[]? Filters { get; set; }
+ public int Count { get; set; } = 1;
+ /// "Hand" | "Discard" | "Battlefield"
+ public string Destination { get; set; } = "Hand";
+ public bool ShuffleAfter { get; set; } = true;
+}
+
+// ── §5.19 Unit manipulation ───────────────────────────────────────────────────
+
+/// Change the target unit's attack type.
+public sealed class ChangeAttackTypeEffect : Effect
+{
+ public AttackType AttackType { get; set; }
+}
+
+///
+/// Causes the target unit to obstruct a given movement type as if it had that movement type itself.
+/// E.g. a ground unit blocking Fly-movement paths.
+///
+public sealed class ObstructMovementTypeEffect : Effect
+{
+ public MovementType MovementType { get; set; }
+ public DurationModel Duration { get; set; } = DurationModel.EndOfTurn;
+}
+
///
/// Schedules effects to fire once the next time the specified trigger event occurs.
/// Consumed after firing. Cancelled if source leaves battlefield before event fires.
diff --git a/Server/src/SOR.Game/Abilities/Models/Filters.cs b/Server/src/SOR.Game/Abilities/Models/Filters.cs
index 3fcbc8e..579012a 100644
--- a/Server/src/SOR.Game/Abilities/Models/Filters.cs
+++ b/Server/src/SOR.Game/Abilities/Models/Filters.cs
@@ -36,6 +36,9 @@ using SOR.Database.Enums;
[PolyType(typeof(TileIsAdjacentToUnitFilter), "TileIsAdjacentToUnit")]
[PolyType(typeof(TileIsOnPlayerSideFilter), "TileIsOnPlayerSide")]
[PolyType(typeof(TileIsInArchSpiritChannelRangeFilter), "TileIsInArchSpiritChannelRange")]
+[PolyType(typeof(OwnershipFilter), "Ownership")]
+[PolyType(typeof(UnitPropertyFilter), "UnitProperty")]
+[PolyType(typeof(TileOccupancyFilter), "TileOccupancy")]
public abstract class Filter { }
// ── Unit / card filter implementations ───────────────────────────────────────
@@ -145,3 +148,41 @@ public sealed class TileIsInArchSpiritChannelRangeFilter : Filter
{
public string Ownership { get; set; } = "Owner";
}
+
+// ── Additional filters ────────────────────────────────────────────────────────
+
+/// Unit must be owned by the specified player group.
+[PolyType(typeof(OwnershipFilter), "Ownership")]
+public sealed class OwnershipFilter : Filter
+{
+ /// "Self" | "Ally" | "Opponent" | "Owner" | "Any"
+ public string Ownership { get; set; } = "Any";
+}
+
+/// Generic numeric comparison against a named unit property.
+[PolyType(typeof(UnitPropertyFilter), "UnitProperty")]
+public sealed class UnitPropertyFilter : Filter
+{
+ ///
+ /// Property name: "Damage", "Defense", "MaxDefense", "Health", "MaxHealth",
+ /// "MovementPoints", "MaxMovementPoints", "MinAttackRange", "MaxAttackRange",
+ /// "MinChannelRange", "MaxChannelRange", "Tier".
+ ///
+ public string PropertyName { get; set; } = string.Empty;
+ public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public int Value { get; set; }
+}
+
+///
+/// Tile must be occupied by a unit of the given type and ownership.
+/// Use instead of when ownership matters.
+///
+[PolyType(typeof(TileOccupancyFilter), "TileOccupancy")]
+public sealed class TileOccupancyFilter : Filter
+{
+ /// "Spirit" | "ArchSpirit" | "SpiritToken" | "Ruin" | "Unit" (any)
+ public string UnitType { get; set; } = "Unit";
+ /// "Self" | "Ally" | "Opponent" | "Any"
+ public string Ownership { get; set; } = "Any";
+ public Filter[]? UnitFilters { get; set; }
+}
diff --git a/Server/src/SOR.Game/Abilities/Models/Triggers.cs b/Server/src/SOR.Game/Abilities/Models/Triggers.cs
index 10c203d..3085c55 100644
--- a/Server/src/SOR.Game/Abilities/Models/Triggers.cs
+++ b/Server/src/SOR.Game/Abilities/Models/Triggers.cs
@@ -72,9 +72,11 @@ public sealed class OnTurnEndTrigger : TriggerEvent { public string Player { g
public sealed class OnChanneledTrigger : TriggerEvent
{
- public string CardType { get; set; } = "Spirit";
- public string Ownership { get; set; } = "Owner";
- public Filter? Filter { get; set; }
+ public string CardType { get; set; } = "Spirit";
+ public string Ownership { get; set; } = "Owner";
+ public Filter? Filter { get; set; }
+ /// When set, trigger only fires when this exact card definition is channeled.
+ public Guid? CardDefinitionId { get; set; }
}
// ── §8.3 ArchSpirit tier actions ──────────────────────────────────────────────
@@ -87,22 +89,42 @@ public sealed class OnTransitionTrigger : TriggerEvent { public string Ownership
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; } }
+public sealed class OnUnitMPSpentTrigger : TriggerEvent { public string Ownership { get; set; } = "Owner"; public Filter? Filter { get; set; } public int? Amount { get; set; } public Comparator AmountComparator { get; set; } = Comparator.GreaterThanOrEqual; }
// ── §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 Filter? SourceFilter { get; set; }
+ 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 Comparator AmountComparator { get; set; } = Comparator.GreaterThanOrEqual;
+ public Filter? SourceFilter { get; set; }
+}
+public sealed class OnDamagePreventedTrigger : TriggerEvent
+{
+ public string TargetOwnership { get; set; } = "Any";
+ public Filter? Filter { get; set; }
+ public int? Amount { get; set; }
+ public Comparator AmountComparator { get; set; } = Comparator.GreaterThanOrEqual;
+}
+public sealed class OnHealedTrigger : TriggerEvent
+{
+ public string TargetOwnership { get; set; } = "Any";
+ public Filter? Filter { get; set; }
+ public int? Amount { get; set; }
+ public Comparator AmountComparator { get; set; } = Comparator.GreaterThanOrEqual;
+}
+public sealed class BeforeUnitDeathTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
+public sealed class BeforeDamageAppliedTrigger : TriggerEvent
+{
+ public string SourceOwnership { get; set; } = "Any";
+ public string TargetOwnership { get; set; } = "Any";
+ public Filter? Filter { get; set; }
+ public int? Amount { get; set; }
+ public Comparator AmountComparator { get; set; } = Comparator.GreaterThanOrEqual;
}
-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; } }
-public sealed class BeforeUnitDeathTrigger : TriggerEvent { public string UnitType { get; set; } = "Unit"; public string Ownership { get; set; } = "Any"; public Filter? Filter { get; set; } }
-public sealed class BeforeDamageAppliedTrigger : TriggerEvent { public string SourceOwnership { get; set; } = "Any"; public string TargetOwnership { get; set; } = "Any"; public Filter? Filter { get; set; } }
// ── §8.6 Unit lifecycle ───────────────────────────────────────────────────────
@@ -122,8 +144,21 @@ public sealed class OnGenusChangedTrigger : TriggerEvent { public string Owners
// ── §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; } }
+public sealed class OnRuinActivationTrigger : TriggerEvent
+{
+ public string RuinOwnership { get; set; } = "Any";
+ public string? OccupantOwnership { get; set; }
+ /// Additional filters applied to the occupant unit at the time of Ruin activation.
+ public Filter[]? OccupantFilters { get; set; }
+}
+
+public sealed class OnUnitOccupyRuinTrigger : TriggerEvent
+{
+ public string UnitOwnership { get; set; } = "Any";
+ public Filter? Filter { get; set; }
+ /// Additional filters applied to the occupying unit.
+ public Filter[]? OccupantFilters { get; set; }
+}
// ── §8.9 Tile ────────────────────────────────────────────────────────────────