- Fix [PolyType] attribute placement bug in Effects.cs (silent poly-deser failure) - Add SpiritToken guard to BazaarBuyPrebuiltDeck and CollectionSelectStarterDeck handlers - Wire CostGroup payment into ActivateAbility with PendingCostGroupPick pause support - Add PendingActionGroupPick, PendingCostGroupPick, PendingBranchPick models + GameState props - Add Phase 5 engine switch cases: ModifyChannelRange, RelocateRuin, ActivateRuinAbility, DisableRuinForDuration, CloneSpiritAsToken, DestroyToken, SkipTurn, ModifyCardsDrawnThisTurn, StackDeck, SearchAndPlace, ChangeAttackType, ObstructMovement, AscendFromZone stubs - Add ActionGroup recursion (ResolveActionGroup AND-flatten / OR-XOR interactive pick) - Add ResumeActionGroupPick, ResumeCostGroupPick, ResumeBranchPick methods - Add ChooseOne ChooserRole branching + TargetSelector.Chooser (Random early-return) - Change SearchDeckEffect.ThenAction → ThenGroup: ActionGroup? - Change ApplyOnEventEffect.Effects → Actions: Action[] - Add SOR.Tools console project with cutover-abilities command (EffectsJsonCutover) - AbilityBuilder: add ActionGroupDraft, SubGroups, Compile Groups[], ParseJson Groups[], CompileActionNode/ParseActionNode helpers, nested sub-group UI section - Add Tile.RuinDisabledUntilTurn, PlayerState.SkipTurnCount/CardsDrawnThisTurnBonus, CardInstance.AttackType nullable override - Add SOR.Tools to solution Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
473 lines
28 KiB
C#
473 lines
28 KiB
C#
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>
|
||
// §5.1 Stat modification
|
||
[PolyType(typeof(ModifyHealthEffect), "ModifyHealth")]
|
||
[PolyType(typeof(ModifyDefenseEffect), "ModifyDefense")]
|
||
[PolyType(typeof(ModifyDamageEffect), "ModifyDamage")]
|
||
[PolyType(typeof(ModifyMPEffect), "ModifyMP")]
|
||
[PolyType(typeof(SetMovementTypeEffect), "SetMovementType")]
|
||
[PolyType(typeof(SetAttackRangeEffect), "SetAttackRange")]
|
||
[PolyType(typeof(ModifyMinAttackRangeEffect), "ModifyMinAttackRange")]
|
||
[PolyType(typeof(ModifyMaxAttackRangeEffect), "ModifyMaxAttackRange")]
|
||
[PolyType(typeof(ModifyCostEffect), "ModifyCost")]
|
||
[PolyType(typeof(SetAffinityEffect), "SetAffinity")]
|
||
[PolyType(typeof(GrantAdditionalAttackEffect), "GrantAdditionalAttack")]
|
||
[PolyType(typeof(SetStatModMultiplierEffect), "SetStatModMultiplier")]
|
||
// §5.2 Flag modification — unit
|
||
[PolyType(typeof(SetCanMoveEffect), "SetCanMove")]
|
||
[PolyType(typeof(SetCanAttackEffect), "SetCanAttack")]
|
||
[PolyType(typeof(SetCanDefendEffect), "SetCanDefend")]
|
||
[PolyType(typeof(SetCanBeAttackedEffect), "SetCanBeAttacked")]
|
||
[PolyType(typeof(SetCanBeBlockedEffect), "SetCanBeBlocked")]
|
||
[PolyType(typeof(SetCanBeObstructedEffect), "SetCanBeObstructed")]
|
||
[PolyType(typeof(SetCanUseAbilityEffect), "SetCanUseAbility")]
|
||
[PolyType(typeof(SetCanBeSacrificedEffect), "SetCanBeSacrificed")]
|
||
// §5.2 Flag modification — player
|
||
[PolyType(typeof(SetCanDrawCardsEffect), "SetCanDrawCards")]
|
||
[PolyType(typeof(SetAccumulatesSPEffect), "SetAccumulatesSP")]
|
||
[PolyType(typeof(SetCanChannelSpiritEffect), "SetCanChannelSpirit")]
|
||
[PolyType(typeof(SetCanSacrificeSpiritEffect), "SetCanSacrificeSpirit")]
|
||
[PolyType(typeof(SetCanAscendArchSpiritEffect), "SetCanAscendArchSpirit")]
|
||
[PolyType(typeof(SetCanTransitionArchSpiritEffect), "SetCanTransitionArchSpirit")]
|
||
[PolyType(typeof(SetCanChannelRepentanceEffect), "SetCanChannelRepentance")]
|
||
[PolyType(typeof(SetCanChannelInstinctEffect), "SetCanChannelInstinct")]
|
||
[PolyType(typeof(SetCanChannelRuinEffect), "SetCanChannelRuin")]
|
||
[PolyType(typeof(SetCanChannelTerramorphaMonoEffect), "SetCanChannelTerramorphaMono")]
|
||
[PolyType(typeof(SetCanChannelTerramorphaDiEffect), "SetCanChannelTerramorphaDi")]
|
||
[PolyType(typeof(SetCanChannelTerramorphaTriEffect), "SetCanChannelTerramorphaTri")]
|
||
// §5.3 Ability modification
|
||
[PolyType(typeof(AddAbilityEffect), "AddAbility")]
|
||
[PolyType(typeof(RemoveAbilityEffect), "RemoveAbility")]
|
||
[PolyType(typeof(EnableAbilityEffect), "EnableAbility")]
|
||
[PolyType(typeof(DisableAbilityEffect),"DisableAbility")]
|
||
// §5.4 Genus modification
|
||
[PolyType(typeof(AddGenusEffect), "AddGenus")]
|
||
[PolyType(typeof(RemoveGenusEffect), "RemoveGenus")]
|
||
// §5.5 Player resource modification
|
||
[PolyType(typeof(ModifySPEffect), "ModifySP")]
|
||
[PolyType(typeof(ModifySPAccumulationEffect), "ModifySPAccumulation")]
|
||
[PolyType(typeof(ModifySTEffect), "ModifyST")]
|
||
[PolyType(typeof(ModifyCardsDrawnPerTurnEffect), "ModifyCardsDrawnPerTurn")]
|
||
// §5.6 Tile modification
|
||
[PolyType(typeof(SetBaseAffinity1Effect), "SetBaseAffinity1")]
|
||
[PolyType(typeof(SetBaseAffinity2Effect), "SetBaseAffinity2")]
|
||
[PolyType(typeof(PushAffinityEffect), "PushAffinity")]
|
||
[PolyType(typeof(PushFinalAffinityEffect), "PushFinalAffinity")]
|
||
// §5.7 Zone / card operations
|
||
[PolyType(typeof(DrawCardsEffect), "DrawCards")]
|
||
[PolyType(typeof(DiscardCardsEffect), "DiscardCards")]
|
||
[PolyType(typeof(ReturnToHandEffect), "ReturnToHand")]
|
||
[PolyType(typeof(ReturnToDeckEffect), "ReturnToDeck")]
|
||
[PolyType(typeof(ReturnToBattlefieldEffect), "ReturnToBattlefield")]
|
||
[PolyType(typeof(SendToDiscardEffect), "SendToDiscard")]
|
||
[PolyType(typeof(SearchDeckEffect), "SearchDeck")]
|
||
[PolyType(typeof(ShuffleDeckEffect), "ShuffleDeck")]
|
||
[PolyType(typeof(RevealCardsEffect), "RevealCards")]
|
||
[PolyType(typeof(PlaceOnDeckEffect), "PlaceOnDeck")]
|
||
[PolyType(typeof(ChannelCardEffect), "ChannelCard")]
|
||
// §5.8 Combat / damage
|
||
[PolyType(typeof(DealDamageEffect), "DealDamage")]
|
||
[PolyType(typeof(HealEffect), "Heal")]
|
||
[PolyType(typeof(DealDamageToSelfEffect), "DealDamageToSelf")]
|
||
[PolyType(typeof(DOTEffect), "DOT")]
|
||
[PolyType(typeof(HOTEffect), "HOT")]
|
||
[PolyType(typeof(PreventDeathEffect), "PreventDeath")]
|
||
[PolyType(typeof(PreventNextDamageEffect), "PreventNextDamage")]
|
||
[PolyType(typeof(SetHealthMinimumEffect), "SetHealthMinimum")]
|
||
[PolyType(typeof(ClearPreventDeathEffect), "__ClearPreventDeath")]
|
||
[PolyType(typeof(ClearPreventNextDamageEffect), "__ClearPreventNextDamage")]
|
||
// §5.9 Displacement
|
||
[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")]
|
||
[PolyType(typeof(SetFixedSacrificeReturnEffect),"SetFixedSacrificeReturn")]
|
||
// §5.11 Token
|
||
[PolyType(typeof(SummonTokenEffect), "SummonToken")]
|
||
// §5.12 Deferred
|
||
[PolyType(typeof(ApplyOnEventEffect), "ApplyOnEvent")]
|
||
// §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")]
|
||
public abstract class Effect { }
|
||
|
||
// ── §5.1 Stat modification ────────────────────────────────────────────────────
|
||
|
||
public enum StatTarget { Current, Max }
|
||
|
||
/// <summary>
|
||
/// How to apply the Amount to the current stat value.
|
||
/// "Add" (default) and "Subtract" use the Amount directly (positive integer recommended;
|
||
/// Subtract flips the sign before applying). "Multiply" and "Divide" treat Amount as
|
||
/// the multiplier/divisor integer (e.g. Multiply 2 = ×2). "Percent" treats Amount as
|
||
/// a percentage (e.g. Percent 50 adds 50% of the base value).
|
||
/// </summary>
|
||
public enum StatModOperator { Add, Subtract, Multiply, Divide, Percent }
|
||
|
||
public sealed class ModifyHealthEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
public sealed class ModifyDefenseEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
public sealed class ModifyDamageEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
public sealed class ModifyMPEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
|
||
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 ModifyMinAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
public sealed class ModifyMaxAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||
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 group applied to each found card. The found card is pre-loaded as the resolved
|
||
/// target so chained targeting within the group can reference it via "Action0.Target".
|
||
/// Null means the card is moved to hand.
|
||
/// </summary>
|
||
public ActionGroup? ThenGroup { 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; }
|
||
public sealed class PreventDeathEffect : Effect
|
||
{
|
||
/// <summary>After preventing death, set the unit's HP to this value instead of leaving at 0. Null = leave at 1.</summary>
|
||
public int? DamageTakenSetToHp { get; set; }
|
||
/// <summary>When true, the lethal hit's damage is fully ignored (unit takes 0). DamageTakenSetToHp is ignored when this is true.</summary>
|
||
public bool DamageIgnored { get; set; }
|
||
}
|
||
public sealed class PreventNextDamageEffect : Effect
|
||
{
|
||
public ValueExpr? MaxAmount { get; set; }
|
||
/// <summary>How many times this shield can absorb hits before expiring. Default 1.</summary>
|
||
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 { }
|
||
|
||
// ── §5.9 Displacement ─────────────────────────────────────────────────────────
|
||
|
||
public sealed class PushUnitEffect : Effect
|
||
{
|
||
public int Tiles { get; set; } = 1;
|
||
/// <summary>
|
||
/// Direct HP damage dealt to the pushed unit if it cannot complete the full push
|
||
/// (blocked by a boundary or another unit). 0 = no knockback damage.
|
||
/// </summary>
|
||
public int BlockedDamage { get; set; } = 0;
|
||
}
|
||
|
||
public sealed class PullUnitEffect : Effect
|
||
{
|
||
public int Tiles { get; set; } = 1;
|
||
/// <summary>
|
||
/// Direct HP damage dealt to the pulled unit if it cannot complete the full pull
|
||
/// (blocked by a boundary or another unit). 0 = no knockback damage.
|
||
/// </summary>
|
||
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 ─────────────────────────────────────────────────────
|
||
|
||
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.13 ArchSpirit zone operations ─────────────────────────────────────────
|
||
|
||
/// <summary>Ascend the target ArchSpirit using a previous-tier card from the given zone.</summary>
|
||
public sealed class AscendFromZoneEffect : Effect
|
||
{
|
||
/// <summary>"Hand" | "Deck" | "Discard"</summary>
|
||
public string Zone { get; set; } = "Hand";
|
||
public bool IgnoreCost { get; set; }
|
||
}
|
||
|
||
/// <summary>Transition the target ArchSpirit using a same-tier card from the given zone.</summary>
|
||
public sealed class TransitionFromZoneEffect : Effect
|
||
{
|
||
/// <summary>"Hand" | "Deck" | "Discard"</summary>
|
||
public string Zone { get; set; } = "Hand";
|
||
public bool IgnoreCost { get; set; }
|
||
}
|
||
|
||
/// <summary>Modify the min and/or max channel range of the target ArchSpirit by the given deltas.</summary>
|
||
public sealed class ModifyChannelRangeEffect : Effect
|
||
{
|
||
public int MinDelta { get; set; }
|
||
public int MaxDelta { get; set; }
|
||
}
|
||
|
||
// ── §5.14 Ruin manipulation ───────────────────────────────────────────────────
|
||
|
||
/// <summary>Move the target Ruin to the tile resolved by the action's TargetSelector.</summary>
|
||
public sealed class RelocateRuinEffect : Effect { }
|
||
|
||
/// <summary>
|
||
/// 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.
|
||
/// </summary>
|
||
public sealed class ActivateRuinAbilityEffect : Effect
|
||
{
|
||
public string? AbilityRef { get; set; }
|
||
public bool Random { get; set; } = true;
|
||
/// <summary>When true, all targets for the activated ability are chosen by the ability system rather than the player.</summary>
|
||
public bool ChooseAllTargets { get; set; }
|
||
}
|
||
|
||
/// <summary>Disable the target Ruin's abilities for the given duration.</summary>
|
||
public sealed class DisableRuinForDurationEffect : Effect
|
||
{
|
||
public DurationModel Duration { get; set; } = DurationModel.EndOfTurn;
|
||
}
|
||
|
||
// ── §5.15 Enhanced channeling ─────────────────────────────────────────────────
|
||
|
||
/// <summary>
|
||
/// Unified channel-card effect with full zone and constraint control.
|
||
/// Supersedes the minimal <see cref="ChannelCardEffect"/>.
|
||
/// </summary>
|
||
public sealed class ChannelCardFromZoneEffect : Effect
|
||
{
|
||
/// <summary>"Hand" | "Deck" | "Discard"</summary>
|
||
public string Zone { get; set; } = "Hand";
|
||
/// <summary>Who controls the channeled unit. "Self" | "Ally" | "Opponent" | "Random" | "Target"</summary>
|
||
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; }
|
||
/// <summary>Keep the card in its original zone after channeling (e.g. Instinct/Repentance with KeepInHand).</summary>
|
||
public bool KeepInZone { get; set; }
|
||
/// <summary>When true, the player selects the destination tile (removes random placement for Ruins).</summary>
|
||
public bool TargetTile { get; set; }
|
||
/// <summary>Card must be within the source ArchSpirit's channel range.</summary>
|
||
public bool InOwnChannelRange { get; set; }
|
||
/// <summary>Card must be within the target ArchSpirit's channel range.</summary>
|
||
public bool InTargetChannelRange { get; set; }
|
||
public Filter[]? Filters { get; set; }
|
||
}
|
||
|
||
// ── §5.16 Token / spirit operations ──────────────────────────────────────────
|
||
|
||
/// <summary>
|
||
/// Clone the target Spirit as a SpiritToken placed on an adjacent tile or within channel range.
|
||
/// </summary>
|
||
public sealed class CloneSpiritAsTokenEffect : Effect
|
||
{
|
||
/// <summary>"NeighborTile" | "RandomInChannelRange" | "TargetTile"</summary>
|
||
public string DestinationScope { get; set; } = "NeighborTile";
|
||
}
|
||
|
||
/// <summary>Destroy the target SpiritToken immediately.</summary>
|
||
public sealed class DestroyTokenEffect : Effect { }
|
||
|
||
/// <summary>Override the ST returned to the controlling player when a Spirit is sacrificed.</summary>
|
||
public sealed class ModifySacrificeTokenReturnEffect : Effect
|
||
{
|
||
public int StAmount { get; set; }
|
||
}
|
||
|
||
// ── §5.17 Player operations ───────────────────────────────────────────────────
|
||
|
||
/// <summary>The target player skips their next turn.</summary>
|
||
public sealed class SkipTurnEffect : Effect { }
|
||
|
||
/// <summary>Add or subtract from the number of cards the target player draws this turn only.</summary>
|
||
public sealed class ModifyCardsDrawnThisTurnEffect : Effect
|
||
{
|
||
public ValueExpr Amount { get; set; } = new();
|
||
}
|
||
|
||
// ── §5.18 Zone operations ─────────────────────────────────────────────────────
|
||
|
||
/// <summary>
|
||
/// Let the controlling player view and reorder the top N cards of the target player's deck.
|
||
/// </summary>
|
||
public sealed class StackDeckEffect : Effect
|
||
{
|
||
public int Count { get; set; } = 1;
|
||
/// <summary>"Self" | "Opponent" | "Random"</summary>
|
||
public string Chooser { get; set; } = "Self";
|
||
}
|
||
|
||
/// <summary>
|
||
/// Search the target player's deck for cards matching Filters, put Count of them
|
||
/// into the Destination zone, then optionally shuffle the deck.
|
||
/// </summary>
|
||
public sealed class SearchAndPlaceEffect : Effect
|
||
{
|
||
public Filter[]? Filters { get; set; }
|
||
public int Count { get; set; } = 1;
|
||
/// <summary>"Hand" | "Discard" | "Battlefield"</summary>
|
||
public string Destination { get; set; } = "Hand";
|
||
public bool ShuffleAfter { get; set; } = true;
|
||
}
|
||
|
||
// ── §5.19 Unit manipulation ───────────────────────────────────────────────────
|
||
|
||
/// <summary>Change the target unit's attack type.</summary>
|
||
public sealed class ChangeAttackTypeEffect : Effect
|
||
{
|
||
public AttackType AttackType { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 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.
|
||
/// </summary>
|
||
public sealed class ObstructMovementTypeEffect : Effect
|
||
{
|
||
public MovementType MovementType { get; set; }
|
||
public DurationModel Duration { get; set; } = DurationModel.EndOfTurn;
|
||
}
|
||
|
||
/// <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!;
|
||
/// <summary>
|
||
/// Full action tree executed when the trigger fires. Supports chained targeting and
|
||
/// nested ActionGroups. Replaces the old flat Effect[] for recursive ability trees.
|
||
/// </summary>
|
||
public Action[] Actions { get; set; } = [];
|
||
}
|