feat: add combat save/load and TUI combat display#7
Merged
Conversation
Save/load combat state: CombatState and RNGPosition are now serialized in SaveData, with RestoreRNG wired into both CLI and TUI load paths. Old saves without combat fields load cleanly (zero-value defaults). TUI combat display: lipgloss bordered boxes for COMBAT (health bars), VICTORY (green, enemy at 0 HP), DEFEAT (red, player at 0 HP), and GAME OVER screens. Dynamic combat prompt, game over input blocking, combat-aware line coloring, HP in status bar. Game content fixes: goblin blade becomes takeable after defeating the goblin, added "use key on case" / "open case" rules for the armory display case, gold counter shown in inventory output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CombatStateandRNGPositionserialized inSaveData,RestoreRNGwired into CLI and TUI load paths. Backward compatible with old saves.Plan
docs/design/combat-implementation.md— Phase 4, tasks 29-35 (all complete).Files changed
engine/save/save.goCombat+RNGPositiontoSaveData,Save(),ApplySave()engine/save/save_test.goengine/engine.gocli/cli.goRestoreRNGafter load, combat in/state, combat in/helptui/combat.gohealthBar,renderCombatStatus,renderVictory,renderDefeat,renderGameOver,injectBorderTitletui/style.golineKindvalues + styles for combat/game-over/pre-styledtui/tui.gotui/status.gotui/tui_test.goTestHealthBar,TestInjectBorderTitlegames/lost_crown/enemies.luaSetPropgames/lost_crown/rules.luause_key_on_case,open_case_with_keyrulesdocs/design/combat-implementation.mdTest plan
go test ./...— all greengolangci-lint run— clean/save→/quit→ relaunch →/load→ combat resumesinventoryshows gold after loottake bladeworks after goblin dies🤖 Generated with Claude Code