Files
mtg-online-drafter/docs/development/devlog/2025-12-18-203000_fix_restart_game.md
2025-12-18 20:26:42 +01:00

20 lines
971 B
Markdown

---
title: Fix Restart Game Action
status: Completed
---
## Objectives
- Fix the "Restart Game" button not actually resetting the game state fully (players were left with empty hands).
## Diagnosis
- The `restartGame` method in `GameManager` correctly reset the global state (turn, phase, step) and moved cards back to the library.
- However, it **failed to trigger the initial card draw** (Mulligan phase start).
- This happened because `RulesEngine.startGame()` (which handles the initial draw loop) was never called after the reset.
## Fix Implemented
- Updated `GameManager.ts` to instantiate a new `RulesEngine` and call `.startGame()` at the end of `restartGame`.
- This ensures that after resetting variables, the engine immediately shuffles libraries and deals 7 cards to each player, effectively restarting the match.
## Verification
- Clicking "Restart Game" now properly resets life totals, clears the board, and deals a fresh opening hand to all players.