Implement phase-3 adjacency, movement-state, and tile-control ability primitives

This commit is contained in:
Shard
2026-03-27 17:58:02 +00:00
parent e887a8c670
commit 8f0ed9d68f
5 changed files with 216 additions and 15 deletions
@@ -27,6 +27,9 @@ using SOR.Database.Enums;
[PolyType(typeof(DestinationTileAffinityIsCondition), "DestinationTileAffinityIs")]
[PolyType(typeof(PreviousTileAffinityIsCondition), "PreviousTileAffinityIs")]
[PolyType(typeof(MovedFromOrIntoAffinityCondition), "MovedFromOrIntoAffinity")]
[PolyType(typeof(IsAdjacentToTileWithAffinityCondition), "IsAdjacentToTileWithAffinity")]
[PolyType(typeof(IsOnOrAdjacentToTileWithAffinityCondition), "IsOnOrAdjacentToTileWithAffinity")]
[PolyType(typeof(IsCurrentlyMovingCondition), "IsCurrentlyMoving")]
// Player (§6.2)
[PolyType(typeof(SPAtLeastCondition), "SPAtLeast")]
[PolyType(typeof(SPAtMostCondition), "SPAtMost")]
@@ -48,6 +51,7 @@ using SOR.Database.Enums;
// Battlefield (§6.5)
[PolyType(typeof(UnitCountOnBattlefieldCondition), "UnitCountOnBattlefield")]
[PolyType(typeof(CardInZoneCondition), "CardInZone")]
[PolyType(typeof(ControlledTileCountWithAffinityCondition), "ControlledTileCountWithAffinity")]
public abstract class Condition
{
/// <summary>
@@ -93,6 +97,9 @@ public sealed class MovementTypeIsCondition : Condition { public MovementType Mo
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; } }
public sealed class IsAdjacentToTileWithAffinityCondition : Condition { public Affinity Affinity { get; set; } }
public sealed class IsOnOrAdjacentToTileWithAffinityCondition : Condition { public Affinity Affinity { get; set; } }
public sealed class IsCurrentlyMovingCondition : Condition { }
// ── Player conditions (§6.2) ──────────────────────────────────────────────────
@@ -136,3 +143,11 @@ public sealed class CardInZoneCondition : Condition
public string CardRef { get; set; } = string.Empty;
public string Zone { get; set; } = "Hand";
}
public sealed class ControlledTileCountWithAffinityCondition : Condition
{
public Affinity Affinity { get; set; }
public Comparator Comparator { get; set; } = Comparator.GreaterThanOrEqual;
public int N { get; set; }
public string Ownership { get; set; } = "Owner";
}
@@ -25,6 +25,8 @@ using SOR.Database.Enums;
[PolyType(typeof(WithinRangeFilter), "WithinRange")]
[PolyType(typeof(IsSelfFilter), "IsSelf")]
[PolyType(typeof(IsExactSelfFilter), "IsExactSelf")]
[PolyType(typeof(IsAdjacentToUnitMatchingFilter), "IsAdjacentToUnitMatching")]
[PolyType(typeof(IsAdjacentToTileMatchingFilter), "IsAdjacentToTileMatching")]
// ── Tile filters ─────────────────────────────────────────────────────────────
[PolyType(typeof(TileAffinityMatchesFilter), "TileAffinityMatches")]
[PolyType(typeof(TileAffinityMatchesFilter), "TileAffinityMatchesFilter")] // legacy alias (typo in admin v1)
@@ -98,6 +100,17 @@ public sealed class IsSelfFilter : Filter { }
/// </summary>
public sealed class IsExactSelfFilter : Filter { }
public sealed class IsAdjacentToUnitMatchingFilter : Filter
{
public string Ownership { get; set; } = "Any";
public Filter[]? UnitFilters { get; set; }
}
public sealed class IsAdjacentToTileMatchingFilter : Filter
{
public Filter[]? TileFilters { get; set; }
}
// ── Tile filter implementations ───────────────────────────────────────────────
public sealed class TileAffinityMatchesFilter : Filter
@@ -97,6 +97,7 @@ public sealed class OnDamageDealtTrigger : TriggerEvent
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 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; } }