[High] [Feature] Implement non-combat room gameplay: Library, Recovery, Treasure, Puzzle #262
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Non-Combat Room Gameplay: Library, Recovery, Treasure, Puzzle
Gap Summary
The current implementation in
combat-descent-actions.tslines 128-132:None of these rooms have timed progression, player interaction, or meaningful effects. The
FloorStatetype already has progress fields (libraryProgress,recoveryProgress,puzzleProgress, etc.) but nothing ticks them.What Each Room Should Do
1. Library Room
Current behavior: Grants a single flat XP amount (
50 × (1 + floor/10)) to a random discipline, then immediately advances.Desired behavior:
2. Recovery Room
Current behavior: Instantly skipped, nothing happens.
Desired behavior:
3. Treasure Room
Current behavior: Instantly skipped, nothing happens.
Desired behavior:
4. Puzzle Room
Current behavior: Instantly skipped, nothing happens. The
puzzleProgress/puzzleRequiredfields exist onFloorStatebut are never ticked.Desired behavior:
constants/rooms.tsPUZZLE_ROOMS)State Changes Needed
FloorStatetype (types/game.ts)The existing progress fields are already present but need to be properly used:
New fields needed:
combat-state.types.tsNew actions needed:
Store Logic Changes
combat-descent-actions.tsReplace the stub handling in
advanceRoomOrFloor():New handler functions needed:
onEnterLibraryRoom()— rewrite: setlibraryProgress = 0,libraryRequired = 1(1 hour),libraryStayed = false; do NOT calladvanceRoomOrFloorimmediatelyonEnterRecoveryRoom()— new: setrecoveryProgress = 0,recoveryRequired = 1,recoveryStayed = false; apply 10× regen/conversion multiplieronEnterTreasureRoom()— new: settreasureProgress = 0,treasureRequired = 1; pre-generate loot table based on flooronEnterPuzzleRoom()— new: setpuzzleProgress = 0, calculatepuzzleRequiredbased on floor and attunement levelsNew tick handler:
tickNonCombatRoom()Called every game tick when the current room is non-combat:
HOURS_PER_TICKadvanceRoomOrFloor()stayLongedis false and player pressed "Stay", add 1 more hour torequiredand setstayed = trueUI Changes
RoomDisplay.tsxEach non-combat room type needs:
SpireCombatPage.tsxcurrentRoomprogress fields toRoomDisplayLoot System (Treasure Room)
Create a new modular loot generation function:
The
LOOT_DROPSdata already exists indata/loot-drops.ts. The function should be easy to extend with new loot tables in the future.Files to Change
stores/combat-descent-actions.tsonEnterLibraryRoom; addonEnterRecoveryRoom,onEnterTreasureRoom,onEnterPuzzleRoom; addtickNonCombatRoom; addskipNonCombatRoomandstayLongerInRoomactionsstores/combat-state.types.tsstores/combatStore.tsstores/pipelines/combat-tick.tscomponents/game/tabs/SpireCombatPage/RoomDisplay.tsxcomponents/game/tabs/SpireCombatPage/SpireCombatPage.tsxutils/spire-utils.tsgenerateTreasureLoot()functiontypes/game.tsFloorStateOut of Scope
LOOT_DROPS)PUZZLE_ROOMS)Acceptance Criteria
Starting implementation of non-combat room gameplay (Library, Recovery, Treasure, Puzzle). Reading source files first.
Implementation complete. All non-combat rooms now have timed progression, player interaction, and meaningful effects:
Library Room: 1-hour timed progression, grants 25× discipline XP to a random discipline, with Skip and "Stay 1 Hour More" buttons.
Recovery Room: 1-hour timed progression, grants 10× mana regen and conversion rates, with Skip and "Stay 1 Hour More" buttons.
Treasure Room: 1-hour timed progression, grants 2-15 items scaling with floor (mostly materials, rare equipment), loot revealed progressively at 10%/50%/95%/100% thresholds, listed in activity log, with Skip button.
Puzzle Room: Up to 24-hour timed progression (floor-scaled: 4h/8h/16h/24h base), reduced by attunement levels (up to 90% reduction), mandatory (no skip/stay buttons), thematic text per puzzle type.
Files changed:
types/game.ts— Added treasure/stayed fields to FloorStatecombat-state.types.ts— Added new action types (AdvanceRoomFn)combat-descent-actions.ts— Rewrote room entry handlers, removed auto-skipnon-combat-room-actions.ts— New file with all tick/skip/stay logiccombatStore.ts— Wired new actionsgameStore.ts— Added non-combat room tick phase with recovery boostspire-utils.ts— Added generateTreasureLoot functionRoomDisplay.tsx— Progress bars, thematic text, skip/stay buttonsSpireCombatPage.tsx— Wired skip/stay buttons to store actionsAll 916 tests pass, all files under 400 lines, no circular dependencies.