feat: add floor time pressure and gated stairs

This commit is contained in:
goose
2026-10-03 00:25:24 -04:00
parent 4b9776ce20
commit 4b6521d308
22 changed files with 388 additions and 11 deletions
+2
View File
@@ -41,6 +41,8 @@ func test_real_input_opens_door_then_chest_and_preserves_stairs_route() -> void:
for keycode in [KEY_UP, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_UP, KEY_UP]:
game._unhandled_input(_key_event(keycode))
assert_eq(state.player.cell, Vector2i(18, 4))
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state())
assert_eq(prompt_label.text, "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_SPACE))
assert_eq(game.get_run_state().current_floor, 1)
@@ -27,6 +27,8 @@ func test_real_input_event_completes_door_to_stairs_descent_and_arrives_on_floor
game._unhandled_input(_key_event(keycode))
assert_eq(state.player.cell, Vector2i(18, 4))
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_E))
+2 -1
View File
@@ -31,7 +31,8 @@ func test_real_game_exposes_door_and_stairs_prompts_with_help_and_event_log() ->
state.map.set_cell(Vector2i(4, 11), GridMapState.CellKind.FLOOR)
state.player.cell = Vector2i(18, 4)
hud.refresh(state)
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
assert_eq(prompt_label.text, "Espace — Descendre l’escalier")
var stairs_results := game.submit_test_interact()
+1
View File
@@ -22,6 +22,7 @@ func test_actual_menu_new_run_descends_to_generated_floor_one_and_returns_to_sur
var surface := game.get_game_state().floor_state
assert_true(surface.metadata.get("hand_authored", false))
game.get_game_state().player.cell = surface.exit
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
game.submit_test_interact()
await get_tree().process_frame
+40
View File
@@ -0,0 +1,40 @@
extends GutTest
const GameScene = preload("res://scenes/Game.tscn")
var game: Game
func before_each() -> void:
game = GameScene.instantiate()
add_child_autofree(game)
await get_tree().process_frame
func test_real_game_early_down_stairs_are_blocked_then_rest_makes_descent_eligible() -> void:
var state := game.get_game_state()
var hud := game.get_node("HUD") as GameHud
var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label
var log := game.get_node("HUD/EventLog") as RichTextLabel
state.enemies.clear()
state.player.cell = state.floor_state.exit
assert_string_contains(hud.get_context_prompt(), "encore 13 jour")
game._unhandled_input(_key_event(KEY_E))
assert_eq(game.get_run_state().current_floor, 0)
assert_eq(prompt_label.text, hud.get_context_prompt())
assert_string_contains(log.get_parsed_text(), "Les escaliers refusent")
assert_string_contains(log.get_parsed_text(), "13 jour")
game.advance_floor_deadline(13 * FloorDeadline.REAL_SECONDS_PER_DAY)
assert_eq(game.get_run_state().deadline_for(0).remaining_days(), 2)
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_E))
assert_eq(game.get_run_state().current_floor, 1)
assert_eq(state.player.cell, state.floor_state.entrance)
assert_eq(hud.get_context_prompt(), "Espace — Monter l’escalier")
func _key_event(keycode: Key) -> InputEventKey:
var event := InputEventKey.new()
event.keycode = keycode
event.physical_keycode = keycode
event.pressed = true
return event
+1
View File
@@ -0,0 +1 @@
uid://br1b1ews1owee