Add browser debugging support

This commit is contained in:
2026-06-22 10:50:03 +09:00
parent 00f7af66e0
commit 48a1a9ccbb
8 changed files with 323 additions and 34 deletions

33
docs/debugging.md Normal file
View File

@@ -0,0 +1,33 @@
# Debugging
## VS Code
1. Open this folder in VS Code.
2. Run `Debug Heros Web (Chrome)` from Run and Debug.
3. VS Code starts the Vite dev server and opens Chrome at `http://localhost:5173`.
4. Set breakpoints in `src/game/scenes/*.ts`.
## Browser Console
Development builds expose:
```js
window.__HEROS_GAME__
window.__HEROS_DEBUG__
```
Useful commands:
```js
__HEROS_DEBUG__.activeScenes()
__HEROS_DEBUG__.battle()
__HEROS_DEBUG__.goToBattle()
__HEROS_DEBUG__.toggleBattleOverlay()
```
## Battle Hotkeys
- `F9`: Toggle battle debug overlay.
- `F10`: Log battle state to the browser console.
The battle debug state includes turn, phase, selected unit, pending move, acted units, unit coordinates, attack intents, and bond progress.