Conversation
Phase 1 of the combat system implementation. Adds the core infrastructure for turn-based 1v1 combat that runs through the existing rules pipeline. - Types: CombatState, BehaviorEntry, LootEntry, PlayerStats on GameDef - Deterministic RNG with position tracking for save/load - State helpers: InCombat(), GetStat(), SetStat() with override layering - New effects: start_combat, end_combat, damage, heal, set_stat - Combat engine: DamageCalc (1d6+atk-def, min 1), EnemyTurn (weighted AI), default attack/defend/flee behavior - Step() modifications: combat command restriction, go→flee rewrite, enemy turn after player turn, round management - Loader: Enemy constructor, combat condition/effect Lua helpers, enemy stat/behavior/loot compilation, validation - Parser: defend/block/guard and flee/escape aliases - Content: Lost Crown cave goblin encounter with auto-engage - Design docs: combat PRD, technical design, implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents re-triggering combat when already in combat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add --script <file> and --trace CLI flags for running scripted command sequences. Commands are echoed after the prompt so output reads like an interactive session. Lines starting with # are treated as comments. Includes sample combat test script at games/lost_crown/scripts/test_combat.txt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The path to the goblin requires: take book, read book, talk to elara, ask about passage, then push wall. Updated script with correct sequence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The damage effect set alive=false and emitted enemy_defeated but never cleared combat state, allowing dead enemies to keep acting. Now clears combat state and emits combat_ended alongside enemy_defeated. Adds integration tests through Step() to verify combat ends on defeat, dead enemies don't get turns, and post-combat behavior is correct. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ProcessLoot() that rolls each item in the enemy's loot table against its chance percentage, producing give_item effects for successful drops and inc_counter for gold. Wired into Step() after enemy_defeated event. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace defer f.Close() with explicit close before return to avoid exitAfterDefer warning from gocritic. 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
--script <file>and--traceCLI flags for automated game playback (echo commands, skip#comments)attack_goblinrule to guard against re-triggering combat withNot(InCombat())Key changes
types/— NewEnemyDef,CombatState, combat-related effect typesengine/rng.go— Deterministic RNG for reproducible combat rollsengine/combat.go— Combat engine: turn resolution, damage calc, enemy behavior selectionengine/effects/— New combat effects (start_combat,damage,end_combat, etc.)engine/rules/conditions.go—InCombat()condition for rule matchingengine/state/— Combat state tracking on game stateloader/—Enemy()and combat Lua API constructors, validation for enemy defscli/—EchoInputfield,#comment skipping,--scriptand--traceflagsgames/lost_crown/enemies.lua— Sample goblin enemy with loot and combat rulesdocs/design/— Combat PRD, design doc, and implementation planTest plan
go test ./engine/...— combat engine, RNG, effects, conditions, state testsgo test ./loader/...— combat content loading testsgo test ./cli/...— echo input, comment skipping, existing CLI testsmake build && bin/questcore --script games/lost_crown/scripts/test_combat.txt games/lost_crown/— end-to-end script playbackmake ci— full CI passes🤖 Generated with Claude Code