feat: Implement game restart, battlefield styling with art crops and tapped stacks, and initial draw fixes.
Some checks failed
Build and Deploy / build (push) Failing after 1m10s
Some checks failed
Build and Deploy / build (push) Failing after 1m10s
This commit is contained in:
15
docs/development/devlog/2024-12-18-185500_manual_draw_fix.md
Normal file
15
docs/development/devlog/2024-12-18-185500_manual_draw_fix.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 2024-12-18 - Implement Manual Card Draw
|
||||
|
||||
## Problem
|
||||
The user reported that clicking on the library or using the "Draw Card" context menu option had no effect. The frontend was correctly emitting the `DRAW_CARD` action (via `game_action` channel/event), but the `GameManager` (which handles manual/legacy actions) had no case handler for it, causing the action to be ignored.
|
||||
|
||||
## Root Cause
|
||||
1. **Missing Handler**: The `GameManager.handleAction` switch statement lacked a `case 'DRAW_CARD'`.
|
||||
2. **Access Control**: The `RulesEngine.drawCard` method was `private`, preventing external invocation even if the handler existed.
|
||||
|
||||
## Solution
|
||||
1. **Made `drawCard` Public**: Updated `RulesEngine.ts` to change `drawCard` visibility from `private` to `public`.
|
||||
2. **Added Handler**: Updated `GameManager.ts` to include a `case 'DRAW_CARD'` in `handleAction`. This handler instantiates a `RulesEngine` for the current game and calls `engine.drawCard(actorId)`.
|
||||
|
||||
## Outcome
|
||||
Users can now manually draw cards from their library interactions (click or context menu) during gameplay.
|
||||
Reference in New Issue
Block a user