1.1 KiB
1.1 KiB
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
- Missing Handler: The
GameManager.handleActionswitch statement lacked acase 'DRAW_CARD'. - Access Control: The
RulesEngine.drawCardmethod wasprivate, preventing external invocation even if the handler existed.
Solution
- Made
drawCardPublic: UpdatedRulesEngine.tsto changedrawCardvisibility fromprivatetopublic. - Added Handler: Updated
GameManager.tsto include acase 'DRAW_CARD'inhandleAction. This handler instantiates aRulesEnginefor the current game and callsengine.drawCard(actorId).
Outcome
Users can now manually draw cards from their library interactions (click or context menu) during gameplay.