Add phase-1 ability primitives and builder support

This commit is contained in:
Shard
2026-03-27 15:40:57 +00:00
parent a656c701c0
commit 9e4fbd12a7
7 changed files with 243 additions and 16 deletions
@@ -51,6 +51,12 @@ public sealed class AbilityDefinition
/// <summary>The event that fires this ability. Must be set for Triggered type.</summary>
public TriggerEvent? TriggerEvent { get; set; }
/// <summary>
/// Maximum number of times this Triggered ability may resolve per turn.
/// Null or <= 0 means unlimited.
/// </summary>
public int? TriggerLimitPerTurn { get; set; }
/// <summary>
/// Optional display name shown in the admin tool and client ability list.
/// Not required for game logic.
@@ -13,6 +13,7 @@ using SOR.Database.Enums;
[PolyType(typeof(AndCondition), "AND")]
[PolyType(typeof(OrCondition), "OR")]
[PolyType(typeof(XorCondition), "XOR")]
[PolyType(typeof(NotCondition), "NOT")]
// Unit (§6.1)
[PolyType(typeof(HealthBelowCondition), "HealthBelow")]
[PolyType(typeof(HealthAboveCondition), "HealthAbove")]
@@ -23,6 +24,9 @@ using SOR.Database.Enums;
[PolyType(typeof(IsAdjacentToCondition), "IsAdjacentTo")]
[PolyType(typeof(WithinRangeOfCondition), "WithinRangeOf")]
[PolyType(typeof(MovementTypeIsCondition), "MovementTypeIs")]
[PolyType(typeof(DestinationTileAffinityIsCondition), "DestinationTileAffinityIs")]
[PolyType(typeof(PreviousTileAffinityIsCondition), "PreviousTileAffinityIs")]
[PolyType(typeof(MovedFromOrIntoAffinityCondition), "MovedFromOrIntoAffinity")]
// Player (§6.2)
[PolyType(typeof(SPAtLeastCondition), "SPAtLeast")]
[PolyType(typeof(SPAtMostCondition), "SPAtMost")]
@@ -59,6 +63,7 @@ public abstract class Condition
public sealed class AndCondition : Condition { public Condition[] Conditions { get; set; } = []; }
public sealed class OrCondition : Condition { public Condition[] Conditions { get; set; } = []; }
public sealed class XorCondition : Condition { public Condition[] Conditions { get; set; } = []; }
public sealed class NotCondition : Condition { public Condition Condition { get; set; } = new IsOwnTurnCondition(); }
// ── Unit conditions (§6.1) ────────────────────────────────────────────────────
@@ -85,6 +90,9 @@ public sealed class WithinRangeOfCondition : Condition
}
public sealed class MovementTypeIsCondition : Condition { public MovementType MovementType { get; set; } }
public sealed class DestinationTileAffinityIsCondition : Condition { public Affinity Affinity { get; set; } }
public sealed class PreviousTileAffinityIsCondition : Condition { public Affinity Affinity { get; set; } }
public sealed class MovedFromOrIntoAffinityCondition : Condition { public Affinity Affinity { get; set; } }
// ── Player conditions (§6.2) ──────────────────────────────────────────────────
@@ -81,9 +81,10 @@ using SOR.Database.Enums;
[PolyType(typeof(DOTEffect), "DOT")]
[PolyType(typeof(HOTEffect), "HOT")]
// §5.9 Displacement
[PolyType(typeof(PushUnitEffect), "PushUnit")]
[PolyType(typeof(PullUnitEffect), "PullUnit")]
[PolyType(typeof(DisplaceUnitEffect), "DisplaceUnit")]
[PolyType(typeof(PushUnitEffect), "PushUnit")]
[PolyType(typeof(PullUnitEffect), "PullUnit")]
[PolyType(typeof(DisplaceUnitEffect), "DisplaceUnit")]
[PolyType(typeof(RepositionUnitEffect),"RepositionUnit")]
// §5.10 Control
[PolyType(typeof(TakeControlEffect), "TakeControl")]
[PolyType(typeof(GrantMovementControlEffect), "GrantMovementControl")]
@@ -219,6 +220,15 @@ public sealed class PullUnitEffect : Effect
public int BlockedDamage { get; set; } = 0;
}
public sealed class DisplaceUnitEffect : Effect { public int Tiles { get; set; } = 1; public string Direction { get; set; } = "North"; }
public sealed class RepositionUnitEffect : Effect
{
public int Tiles { get; set; } = 1;
public bool AdjacentToSource { get; set; }
public string? RelativeToTargetRef { get; set; }
public bool AdjacentToRelativeTarget { get; set; }
public bool AllowRelativeTargetTile { get; set; }
public Filter[]? DestinationTileFilters { get; set; }
}
// ── §5.10 Control effects ─────────────────────────────────────────────────────