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
+27 -2
View File
@@ -5,18 +5,23 @@ const DOOR_PROMPT := "Espace — Ouvrir la porte"
const CHEST_PROMPT := "Espace — Ouvrir le coffre"
const STAIRS_PROMPT := "Espace — Descendre l’escalier"
const STAIRS_UP_PROMPT := "Espace — Monter l’escalier"
const BED_PROMPT := "H — Se reposer (coûte 1 jour)"
const EXIT_REACHED_PROMPT := "Sortie atteinte — prochain étage bientôt disponible"
@onready var player_health_label: Label = $PlayerHealthLabel
@onready var deadline_label: Label = $DeadlineLabel
@onready var enemy_health_label: Label = $EnemyHealthLabel
@onready var combat_summary_label: Label = $CombatSummaryLabel
@onready var event_log: RichTextLabel = $EventLog
@onready var context_prompt_label: Label = $ContextPromptLabel
var combat_summary := ""
var _state: GameState
var _run_state: RunState
func refresh(state: GameState, events: Array[GameEvent] = []) -> void:
func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunState = null) -> void:
_state = state
if run_state != null:
_run_state = run_state
player_health_label.text = "Player HP: %d/%d" % [state.player.hit_points, state.player.max_hit_points]
if state.enemies.has(&"goblin"):
var goblin: ActorState = state.enemies[&"goblin"]
@@ -26,6 +31,7 @@ func refresh(state: GameState, events: Array[GameEvent] = []) -> void:
enemy_health_label.text = "No active target"
combat_summary = "No active target"
combat_summary_label.text = combat_summary
deadline_label.text = _deadline_status()
context_prompt_label.text = get_context_prompt()
# The supplied RunState journal events are the only source for journal text.
event_log.clear()
@@ -41,8 +47,27 @@ func get_context_prompt() -> String:
&"closed_door":
return DOOR_PROMPT
&"stairs":
return STAIRS_UP_PROMPT if _state.floor_state.floor_number > 0 and _state.player.cell == _state.floor_state.entrance else STAIRS_PROMPT
if _state.floor_state.floor_number > 0 and _state.player.cell == _state.floor_state.entrance:
return STAIRS_UP_PROMPT
if _run_state != null:
var deadline := _run_state.current_floor_deadline()
if not deadline.can_descend():
return "Escaliers verrouillés — encore %d jour(s) avant l’ouverture" % deadline.days_until_stairs_open()
return STAIRS_PROMPT
&"bed":
return BED_PROMPT
&"exit_reached":
return EXIT_REACHED_PROMPT
_:
return ""
func _deadline_status() -> String:
if _run_state == null:
return ""
var deadline := _run_state.current_floor_deadline()
var status := "Étage %d — %d jour(s) avant l’effondrement" % [_run_state.current_floor, deadline.remaining_days()]
if deadline.collapsing:
return status + " — EFFONDREMENT"
if deadline.can_descend():
return status + " — escaliers ouverts"
return status + " — escaliers dans %d jour(s)" % deadline.days_until_stairs_open()