3.6 KiB
3.6 KiB
Gameplay TODO
Target-gated Repentance/Instinct resolution
Problem
Repentance and Instinct are resolved through EffectsJson action lists. Some actions can be defined with explicit target selectors (Player, Tile, Spirit, ArchSpirit, Ruin, etc.).
If an action semantically requires a target, allowing the card to resolve without one can produce ambiguous or unintended behavior (silent no-op, wrong implicit target, or inconsistent rules enforcement).
Why this matters
- Rules integrity: cards that say "choose a target" must not resolve without a legal choice.
- Determinism: server-side resolution should be unambiguous and reproducible.
- Client UX: players should get a clear validation error instead of a partial/quiet mis-resolution.
- Future-proofing: as more conditional and chained actions are added, implicit target fallbacks become high-risk.
Current state
ChannelCardnow enforcesCanChannel*restrictions (includingCanChannelRepentanceandCanChannelInstinct).- Instinct is now quick-play (any turn except Setup/Placement/GameOver).
- Ability model supports explicit target types and per-action target indexing.
SearchDeckEffectis declared in effect models but currently missing server-side execution inAbilitySystem.ExecuteEffect(seegameplay-effects-gap.md).
Required fix
Add strict server-side target validation for Repentance/Instinct action execution:
- Per action, determine whether target input is mandatory from
TargetSelector:- mandatory: specific target type with
Count.N > 0and notAll, notUpTo - optional:
All == trueorUpTo == truewhere fewer thanNis allowed
- mandatory: specific target type with
- If mandatory and no matching client target(s) are supplied, reject play (
INSUFFICIENT_TARGETSor equivalent). - Validate target kind compatibility:
Tileactions requireCoord- unit/card/player actions require
InstanceId(or player resolution contract)
- Validate ownership/scope/filter legality during resolution (already mostly present) and return explicit error on mismatch.
- Keep behavior deterministic for multi-action cards: each action uses
ActionIndex-scoped targets only.
Acceptance criteria
- A Repentance/Instinct card with required targets cannot resolve without valid target payload.
- Invalid target payload fails with explicit error.
- Optional-target actions still resolve when legal to do so.
- Existing non-targeted Repentance/Instinct cards continue to work unchanged.
Aura transition walkthrough scenario (movement)
Goal scenario: "A spirit moves on the battlefield and another spirit enters its aura range."
Current flow in engine
GameEngine.MoveUnit(...)validates movement/path/MP.- Unit position is updated on board.
AbilitySystem.EvaluateAuraTransitions(state, movingUnitId, from, to)runs.- System checks both:
- stationary aura units vs moving unit transition
- moving unit's own aura vs stationary units
- If range crossing occurs:
- outside -> inside =>
EnterAuraRangetrigger fires - inside -> outside =>
LeaveAuraRangetrigger fires
- outside -> inside =>
- Triggered abilities are evaluated via
FireTrigger(...)and matching triggered actions execute.
Test case outline
- Place Aura Spirit A (with AuraRange 1..1 and an
OnEnterAuraRangetrigger). - Place Spirit B outside A's range.
- Move B one tile so Manhattan distance to A becomes 1.
- Expected:
EnterAuraRangetrigger emitted withSourceId=A,TargetId=B.- Any matching triggered actions on A resolve.
Notes
- Aura enter/leave also has dedicated helpers for summon/death transitions:
EvaluateAurasOnEnter(...)EvaluateAurasOnLeave(...)