docs(plan): incorporate Ruin bug fixes as Phase 6

From Ruin-IssueResolution.md -- four fixes in priority order:

6-D (highest): stop double OnRuinActivation execution -- source Ruin's abilities
  fire once via FireRuinAbilities; FireTrigger must skip source unit to prevent
  the same abilities re-firing through the general trigger pipeline.
  Note: new ActivateRuinAbilityEffect (Phase 1.8/5.7) must use the same guard.

6-C: server enforce tile.RuinId == null in candidate set + NO_VALID_RUIN_TILE error code

6-B: client preflight -- compute valid no-ruin tiles before showing confirm dialog;
  block and show message if none available

6-A: client confirm dialog before channeling a Ruin card

Delivery note: Phase 6-D must land before Phase 5.7 so the source-skip guard
is in place before ActivateRuinAbilityEffect can trigger through the pipeline.

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>
This commit is contained in:
dingo
2026-04-19 11:58:42 -04:00
co-authored by Claude Happy
parent 0f4593ac7c
commit ad98116973
+108 -5
View File
@@ -782,6 +782,104 @@ Each item is independently mergeable after Phase 1 lands.
---
## Phase 6 -- Ruin Bug Fixes
Full detail in Ruin-IssueResolution.md. Summarized here for sequencing alongside
the ability system work.
These fixes are largely independent of Phases 1-5 and can land before or alongside
the model expansion. Recommended order within this phase: D -> C -> B -> A.
### 6-D -- Server: Stop double execution of OnRuinActivation abilities (HIGHEST PRIORITY)
File: SOR.Game/Abilities/AbilitySystem.cs
Root cause: FireRuinAbilities selects one eligible OnRuinActivation ability at random
and executes it, then emits a RuinActivation trigger event. FireTrigger then scans all
field cards for OnRuinActivationTrigger matches, which includes the source Ruin itself,
causing its other OnRuinActivation abilities to also fire via the general trigger path.
Fix (minimal-risk): in FireTrigger, when occurrence.Kind == TriggerEventKind.RuinActivation,
skip OnRuinActivationTrigger abilities on the source Ruin
(where unit.InstanceId == occurrence.Data?.SourceId). Non-source observer cards
continue to receive the event normally.
Interaction with Phase 1 model work:
The new ActivateRuinAbilityEffect (Phase 1.8) programmatically fires a Ruin ability
from an effect. It must use the same source-skip guard so it does not also double-fire
through the trigger pipeline when it emits its activation event.
Acceptance criteria:
- Exactly one of the source Ruin's eligible OnRuinActivation abilities executes per tick.
- Observer cards with OnRuinActivation triggers still react to the event.
- No regression on other trigger kinds.
### 6-C -- Server: Enforce no-ruin tile placement
File: SOR.Game/GameEngine.cs (Ruin branch in ChannelCard)
Fix: change candidate tile set from "affinity-valid" to
"affinity-valid AND tile.RuinId == null". Keep random selection among filtered candidates.
Return NO_VALID_RUIN_TILE error code if filtered set is empty (distinct from generic
NO_VALID_TILE for clearer client handling).
Acceptance criteria:
- A Ruin is never placed on a tile already containing another Ruin.
- Existing Ruins on the board are never overwritten by new Ruin channels.
### 6-B -- Client: Preflight check before sending play_card for a Ruin
File: Client/origin-client/scenes/game/game_screen.gd
Before showing the confirmation dialog (6-A), compute candidate tiles locally:
- Affinity-valid for the Ruin card
- tile.ruinId is null/empty
If no candidates: do not proceed to confirmation. Show user-facing message:
"No valid tile available for this Ruin."
This is UX protection only. Server (6-C) remains authoritative.
Acceptance criteria:
- Client blocks channel attempt when zero valid no-ruin tiles exist.
- User receives a clear reason message.
### 6-A -- Client: Confirmation prompt before channeling a Ruin
File: Client/origin-client/scenes/game/game_screen.gd
In _on_hand_card_clicked, under cardType == "Ruin", replace the immediate send with
a confirm dialog:
Title: Channel Ruin?
Body: Ruin placement is random. Continue?
Buttons: Cancel / Channel
Only call Game.send_play_card(iid, 0, 0) on explicit Channel confirmation.
Acceptance criteria:
- Clicking a Ruin card does not instantly channel.
- Cancel does nothing.
- Confirm channels exactly once.
### 6 -- Test Plan
Server unit tests:
- Ruin candidate filtering: board where all affinity-valid tiles have existing Ruins
returns NO_VALID_RUIN_TILE.
- Mixed board: selected tile never has RuinId set.
- Single-ability execution: Ruin with 3 eligible OnRuinActivation abilities; run
turn-start activation; assert exactly 1 executes for the source Ruin.
- Observer behavior: another card's OnRuinActivation trigger still fires when the
source Ruin activates.
Integration tests:
- Play Ruin from hand in a live session; confirm dialog shown; Cancel sends no
request; Confirm sends request once.
- Simulate board with no valid no-ruin tiles; verify client preflight blocks send.
- Multi-turn simulation confirms one source Ruin effect per activation tick.
---
## Phased Delivery Order
Phase 0 (cleanup)
@@ -790,13 +888,16 @@ Each item is independently mergeable after Phase 1 lands.
|
Phase 2 (DB migration)
|
Phase 3 (Card Editor revamp) <-- depends on Phase 2
Phase 4 (Visual Ability Builder) <-- depends on Phase 1
Phase 3 (Card Editor revamp) <-- depends on Phase 2
Phase 4 (Visual Ability Builder) <-- depends on Phase 1
Phase 6 (Ruin bug fixes) <-- independent; can land any time; D before C before B before A
|
Phase 5 (Engine updates) <-- depends on Phase 1 + Phase 2
Phase 5 (Engine updates) <-- depends on Phase 1 + Phase 2
Phases 3 and 4 run concurrently after Phase 2.
Phases 3, 4, and 6 run concurrently after their respective dependencies.
Phase 5 sub-items are independently mergeable once Phase 1 is in.
Phase 6-D should land before Phase 5.7 (ActivateRuinAbilityEffect) to ensure the
source-skip guard is in place before the new effect type can trigger through it.
---
@@ -821,6 +922,8 @@ Phase 5 sub-items are independently mergeable once Phase 1 is in.
SOR.Admin/Components/Pages/Cards/CardEditor.razor | Accordion layout revamp (Phase 3)
SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor | Replace with visual node builder (Phase 4)
SOR.Admin/wwwroot/js/ability-builder.js | New: zoom/pan/port hit-test JS interop
SOR.Game/Abilities/AbilitySystem.cs | Phase 5 engine updates (iterative sub-PRs)
SOR.Game/Abilities/AbilitySystem.cs | Phase 5 engine updates + Phase 6-D source-skip fix
SOR.Game/GameEngine.cs | Phase 6-C: no-ruin tile filter + NO_VALID_RUIN_TILE error
Client/origin-client/scenes/game/game_screen.gd | Phase 6-A/B: Ruin confirm dialog + preflight check
DELETE AbilityBuilderR2-Draft.razor | Phase 0
DELETE AbilityBuilderR3.razor | Phase 0