From 8b479eaf08b40db54524550f01b307aaa1d01276 Mon Sep 17 00:00:00 2001 From: goose Date: Sat, 3 Oct 2026 21:52:08 -0400 Subject: [PATCH] feat: port death and resurrection --- scenes/Game.tscn | 3 ++ scenes/ui/DeathPanel.tscn | 61 +++++++++++++++++++++ scripts/domain/run/death_engine.gd | 45 ++++++++++++++++ scripts/domain/run/death_engine.gd.uid | 1 + scripts/domain/run/run_state.gd | 5 ++ scripts/game/game.gd | 37 +++++++++++++ scripts/presentation/death_panel.gd | 12 +++++ scripts/presentation/death_panel.gd.uid | 1 + task-F6-report.md | 51 ++++++++++++++++++ tests/e2e/test_death_mode_e2e.gd | 65 +++++++++++++++++++++++ tests/e2e/test_death_mode_e2e.gd.uid | 1 + tests/unit/test_death_resurrection.gd | 52 ++++++++++++++++++ tests/unit/test_death_resurrection.gd.uid | 1 + 13 files changed, 335 insertions(+) create mode 100644 scenes/ui/DeathPanel.tscn create mode 100644 scripts/domain/run/death_engine.gd create mode 100644 scripts/domain/run/death_engine.gd.uid create mode 100644 scripts/presentation/death_panel.gd create mode 100644 scripts/presentation/death_panel.gd.uid create mode 100644 task-F6-report.md create mode 100644 tests/e2e/test_death_mode_e2e.gd create mode 100644 tests/e2e/test_death_mode_e2e.gd.uid create mode 100644 tests/unit/test_death_resurrection.gd create mode 100644 tests/unit/test_death_resurrection.gd.uid diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 109365a..9ad4bf2 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -26,6 +26,7 @@ [ext_resource type="PackedScene" path="res://scenes/ui/RecapPanel.tscn" id="24_recap"] [ext_resource type="PackedScene" path="res://scenes/ui/FactionPanel.tscn" id="25_faction"] [ext_resource type="PackedScene" path="res://scenes/ui/ModerationPanel.tscn" id="26_moderation"] +[ext_resource type="PackedScene" path="res://scenes/ui/DeathPanel.tscn" id="27_death"] [sub_resource type="StyleBoxFlat" id="StyleBox_hud_panel"] bg_color = Color(0.035, 0.055, 0.09, 0.9) @@ -129,6 +130,8 @@ script = ExtResource("4_hud") [node name="ModerationPanel" parent="HUD" instance=ExtResource("26_moderation")] +[node name="DeathPanel" parent="HUD" instance=ExtResource("27_death")] + [node name="AchievementToast" type="Label" parent="HUD"] offset_left = 390.0 offset_top = 18.0 diff --git a/scenes/ui/DeathPanel.tscn b/scenes/ui/DeathPanel.tscn new file mode 100644 index 0000000..18b56fb --- /dev/null +++ b/scenes/ui/DeathPanel.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=3 format=3] + +[ext_resource type="Script" path="res://scripts/presentation/death_panel.gd" id="1_death"] + +[sub_resource type="StyleBoxFlat" id="StyleBox_death_panel"] +bg_color = Color(0.08, 0.015, 0.02, 0.98) +border_width_left = 4 +border_width_top = 4 +border_width_right = 4 +border_width_bottom = 4 +border_color = Color(0.9, 0.2, 0.18, 0.98) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 + +[node name="DeathPanel" type="PanelContainer"] +visible = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -310.0 +offset_top = -190.0 +offset_right = 310.0 +offset_bottom = 190.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBox_death_panel") +script = ExtResource("1_death") + +[node name="Title" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -260.0 +offset_top = 22.0 +offset_right = 260.0 +offset_bottom = 54.0 +grow_horizontal = 2 +theme_override_colors/font_color = Color(1, 0.38, 0.34, 1) +theme_override_font_sizes/font_size = 27 +text = "VOUS ÊTES MORT" +horizontal_alignment = 1 + +[node name="Body" type="RichTextLabel" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 40.0 +offset_top = 75.0 +offset_right = -40.0 +offset_bottom = -34.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_colors/default_color = Color(1, 0.91, 0.9, 1) +theme_override_font_sizes/normal_font_size = 18 diff --git a/scripts/domain/run/death_engine.gd b/scripts/domain/run/death_engine.gd new file mode 100644 index 0000000..f648bd9 --- /dev/null +++ b/scripts/domain/run/death_engine.gd @@ -0,0 +1,45 @@ +class_name DeathEngine +extends RefCounted + +# Resurrection is deliberately data-gated: this quest-only item is authored by +# the dedicated narrative event and is excluded from generic loot/shop flows. +const NARRATIVE_PHYLACTERY_ID: StringName = &"misc_phylactere_narratif" +const RESURRECTION_HP_FRACTION := 0.25 + +const SLOT_POLICY_ACTIVE: StringName = &"active" +const SLOT_POLICY_PRESERVE: StringName = &"preserve" +const SLOT_POLICY_RETIRE: StringName = &"retire" + +func resolve(combat_player: ActorState, narrative_player: PlayerState, inventory: InventoryState, permadeath: bool) -> Dictionary: + if combat_player == null or combat_player.is_alive(): + return {"outcome": &"alive", "game_over": false, "slot_policy": SLOT_POLICY_ACTIVE} + var phylactery := _phylactery(inventory) + if phylactery != null: + inventory.remove_item(phylactery.instance_id) + combat_player.hit_points = maxi(1, int(float(combat_player.max_hit_points) * RESURRECTION_HP_FRACTION)) + if narrative_player != null: + narrative_player.modify_attribute(&"end", -1) + narrative_player.flags[&"marked_by_death"] = true + return { + "outcome": &"resurrected", + "game_over": false, + "slot_policy": SLOT_POLICY_ACTIVE, + "item_id": NARRATIVE_PHYLACTERY_ID, + "hit_points": combat_player.hit_points, + "message": "Le phylactère se brise en poussière. Vous respirez de nouveau, marqué par la mort (-1 Endurance permanent).", + } + var outcome: StringName = &"permadeath" if permadeath else &"classic_death" + return { + "outcome": outcome, + "game_over": true, + "slot_policy": SLOT_POLICY_RETIRE if permadeath else SLOT_POLICY_PRESERVE, + "message": "Vous vous effondrez. Le donjon continue sans vous.", + } + +func _phylactery(inventory: InventoryState) -> ItemInstance: + if inventory == null: + return null + for item: ItemInstance in inventory.items: + if item.definition.id == NARRATIVE_PHYLACTERY_ID: + return item + return null diff --git a/scripts/domain/run/death_engine.gd.uid b/scripts/domain/run/death_engine.gd.uid new file mode 100644 index 0000000..e749b9c --- /dev/null +++ b/scripts/domain/run/death_engine.gd.uid @@ -0,0 +1 @@ +uid://op1djmwb15ua diff --git a/scripts/domain/run/run_state.gd b/scripts/domain/run/run_state.gd index 3fbef21..bc90002 100644 --- a/scripts/domain/run/run_state.gd +++ b/scripts/domain/run/run_state.gd @@ -34,6 +34,11 @@ var recap_state: Dictionary = {} # independently from panels and current FloorDeadline instances. var faction_war_state: Dictionary = {} var moderation_state: Dictionary = {} +# F6 owns final run lifecycle state. G1's save repository can later consume the +# explicit slot policy rather than inferring it from a transient death panel. +var is_game_over := false +var death_outcome: StringName = &"" +var slot_policy: StringName = &"active" func _init(new_seed: String, new_settings: RunSettings = null) -> void: settings = new_settings if new_settings != null else RunSettings.new(new_seed) diff --git a/scripts/game/game.gd b/scripts/game/game.gd index 8d5e496..d52a8ce 100644 --- a/scripts/game/game.gd +++ b/scripts/game/game.gd @@ -49,6 +49,8 @@ const ModerationType = preload("res://scripts/domain/meta/moderation.gd") const SyndicateType = preload("res://scripts/domain/meta/syndicate.gd") const FactionPanelType = preload("res://scripts/presentation/faction_panel.gd") const ModerationPanelType = preload("res://scripts/presentation/moderation_panel.gd") +const DeathEngineType = preload("res://scripts/domain/run/death_engine.gd") +const DeathPanelType = preload("res://scripts/presentation/death_panel.gd") @onready var event_presenter: EventPresenter = $EventPresenter @onready var map_renderer: MapRenderer = $World/MapRenderer @onready var player_view: ActorView = $World/Player @@ -73,6 +75,7 @@ const ModerationPanelType = preload("res://scripts/presentation/moderation_panel @onready var recap_panel: RecapPanel = $HUD/RecapPanel @onready var faction_panel: FactionPanel = $HUD/FactionPanel @onready var moderation_panel: ModerationPanel = $HUD/ModerationPanel +@onready var death_panel: DeathPanel = $HUD/DeathPanel @onready var achievement_toast: Label = $HUD/AchievementToast @onready var title_label: Label = $HUD/TitleLabel @onready var companion_view: ActorView = $World/Companion @@ -108,6 +111,7 @@ var audience_state: AudienceState var recap_log: RecapLog var faction_war: FactionWar var moderation: Moderation +var death_engine: DeathEngine var active_dialogue_npc: Dictionary = {} var active_event_index := -1 @@ -168,6 +172,7 @@ func _initialize_run_state() -> void: recap_log = RecapLogType.new(run_state.recap_state) faction_war = FactionWarType.new(spell_catalog, run_state.faction_war_state) moderation = ModerationType.new(run_state.moderation_state) + death_engine = DeathEngineType.new() _refresh_title() # The existing base-archetype menu is now the mandatory class choice. Race # defaults to the neutral human until the creation UI submits its selection. @@ -236,6 +241,9 @@ func _prepare_exit_capture_state() -> void: _sync_camera_to_player() func _unhandled_input(event: InputEvent) -> void: + if run_state != null and run_state.is_game_over: + get_viewport().set_input_as_handled() + return if faction_panel.visible and event is InputEventKey and event.is_pressed(): if event.keycode == KEY_ESCAPE or event.is_action_pressed(&"factions"): _close_faction_panel() @@ -454,6 +462,9 @@ func equip_test_ranged_weapon(definition: Dictionary, ammunition: int) -> void: game_state.player.equip_ranged_weapon(definition, ammunition) func submit_player_action(action: PlayerAction) -> Array[GameEvent]: + if run_state.is_game_over: + last_turn_results = [] + return [] match action.kind: &"move": last_turn_results = _process_action(action.direction) @@ -1413,6 +1424,7 @@ func _resolve_player_action(results: Array[TurnResult], sync_camera: bool) -> Ar _sync_camera_to_player() _dispatch_audio(results) var events := _record_events(results) + _resolve_player_death_if_needed() _append_level_up_events(events) _observe_achievements(events) _observe_audience(events) @@ -1436,6 +1448,31 @@ func _resolve_player_action(results: Array[TurnResult], sync_camera: bool) -> Ar hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state) return results +func _resolve_player_death_if_needed() -> void: + if game_state.player.is_alive() or run_state.is_game_over: + return + var outcome := death_engine.resolve(game_state.player, dialogue_player, run_state.inventory, run_state.settings.permadeath) + var kind: StringName = &"narrative_resurrection" if outcome.outcome == &"resurrected" else (&"permadeath_run_retired" if outcome.outcome == &"permadeath" else &"run_ended") + run_state.is_game_over = bool(outcome.game_over) + run_state.death_outcome = outcome.outcome + run_state.slot_policy = outcome.slot_policy + run_state.append_events([GameEventType.new( + run_state.current_turn, + run_state.current_floor, + kind, + {"outcome": outcome.outcome, "slot_policy": outcome.slot_policy, "item_id": outcome.get("item_id", &"")}, + String(outcome.message), + game_state.player.id, + &"", + game_state.player.cell + )]) + if run_state.is_game_over: + death_panel.present(run_state.death_outcome, run_state.player_name, run_state.current_floor, game_state.player.progression.level) + else: + # The narrative model owns permanent attributes. The prototype combat actor + # has no primary-attribute model, so preserve its combat max HP and resume. + player_view.refresh() + func _observe_achievements(events: Array[GameEvent]) -> void: if achievement_manager == null: return diff --git a/scripts/presentation/death_panel.gd b/scripts/presentation/death_panel.gd new file mode 100644 index 0000000..56451f8 --- /dev/null +++ b/scripts/presentation/death_panel.gd @@ -0,0 +1,12 @@ +class_name DeathPanel +extends PanelContainer + +@onready var body: RichTextLabel = $Body + +func present(outcome: StringName, player_name: String, floor: int, level: int) -> void: + visible = true + var mode := "Mort permanente : la sauvegarde de cette run est retirée." if outcome == &"permadeath" else "Classique : la sauvegarde de cette run reste disponible." + body.text = "%s n'aura pas survécu au donjon.\n\nNiveau atteint : %d Étage : %d\n\n%s\n\nLe donjon, lui, continuera sans vous." % [player_name, level, floor, mode] + +func dismiss() -> void: + visible = false diff --git a/scripts/presentation/death_panel.gd.uid b/scripts/presentation/death_panel.gd.uid new file mode 100644 index 0000000..57c5114 --- /dev/null +++ b/scripts/presentation/death_panel.gd.uid @@ -0,0 +1 @@ +uid://d2v3qwtooihs5 diff --git a/task-F6-report.md b/task-F6-report.md new file mode 100644 index 0000000..212eed9 --- /dev/null +++ b/task-F6-report.md @@ -0,0 +1,51 @@ +# Task F6 — Death, Permadeath, and Narrative Resurrection + +## Scope + +Implemented F6 exclusively in the Godot port worktree: + +- Added a run-domain `DeathEngine` that resolves a dead player into one of three explicit outcomes: + - **classic death**: ends the run while preserving its slot policy; + - **permadeath**: ends the run and marks the slot policy for retirement; + - **qualified narrative resurrection**: consumes the existing quest-only `misc_phylactere_narratif`, restores 25% of combat HP (minimum 1), applies permanent `-1 Endurance`, and records `marked_by_death`. +- Added persistent run lifecycle fields (`is_game_over`, `death_outcome`, `slot_policy`) so the later G1 save repository has an authoritative policy rather than inferring it from UI state. +- Wired the death resolver directly after every resolved player action. Final death journals either `run_ended` or `permadeath_run_retired`, displays the new `DeathPanel`, and blocks all subsequent routed or raw input. Resurrection journals `narrative_resurrection` and resumes the run without opening the panel. +- Added `scenes/ui/DeathPanel.tscn` and its focused presenter script, with player, floor, level, and death-mode/slot-policy messaging. +- Added strict TDD coverage: + - unit tests for the phylactery’s consumption, 25% recovery, permanent cost/flag, and classic/permadeath policies; + - real Game-scene E2E tests which kill the player through an actual adjacent enemy turn and verify classic panel/action lock, permadeath retirement, and narrative continuation. + +No DCWASCII source was changed. No unrelated port behavior was changed. + +## TDD and Root Cause + +The red tests first failed as intended because `death_engine.gd`, `RunState` death lifecycle fields, and `HUD/DeathPanel` did not exist. Before F6, combat and collapse could reduce the player to zero HP and emit a normal `actor_died` descriptor, but the Game action pipeline had no authoritative player-death transition. Consequently it neither terminated/locked a run nor had a place to apply the data-backed narrative exception. + +The root fix is a single post-resolution lifecycle boundary in `Game._resolve_player_death_if_needed()`, backed by the isolated `DeathEngine`. This keeps combat responsible for damage only, keeps the rare exception tied to the existing narrative quest item instead of a generic service, and makes final slot policy explicit for the future save layer. + +## Verification + +### Red → green + +- Initial unit red run failed with the expected missing `res://scripts/domain/run/death_engine.gd`, unknown `DeathEngine`, and resulting absent death contract. +- Initial E2E red run failed with the expected missing `HUD/DeathPanel` and absent `RunState.is_game_over` lifecycle state. +- Green targeted runs passed: + - Unit: **178 / 178** tests, **1,331** assertions. + - E2E: **54 / 54** tests, **531** assertions. + +### Full verification + +`./scripts/verify.sh` completed successfully with Godot 4.5.0: + +- Unit: **178 / 178** tests passed, **1,331** assertions +- Integration: **10 / 10** tests passed, **59,462** assertions +- E2E: **54 / 54** tests passed, **531** assertions +- Visual capture verification passed: + - `artifacts/visual-check.png`: `dungeon_non_black_pixels=489308`, `visible_pixels=17524`, `explored_pixels=10438`, `explored_luminance=0.012`, `unknown_pixels=365325`, `unknown_luminance=0.001` + - `artifacts/visual-check-exit.png`: `dungeon_non_black_pixels=489252`, `visible_pixels=17404`, `explored_pixels=17146`, `explored_luminance=0.012`, `unknown_pixels=439497`, `unknown_luminance=0.001` + +The runner reported only known third-party GUT invalid-UID/resource-cleanup warnings; there were no application parse errors, script errors, test failures, or visual failures. + +## Git + +All intended F6 source, scene, test, UID, and report files are included in one local commit. No push and no pull request were created. diff --git a/tests/e2e/test_death_mode_e2e.gd b/tests/e2e/test_death_mode_e2e.gd new file mode 100644 index 0000000..350f7fe --- /dev/null +++ b/tests/e2e/test_death_mode_e2e.gd @@ -0,0 +1,65 @@ +extends GutTest + +const GameScene = preload("res://scenes/Game.tscn") +const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd") +const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd") +const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd") + +const PHYLACTERY_ID: StringName = &"misc_phylactere_narratif" + +func test_classic_death_ends_actions_shows_death_panel_and_preserves_the_run_slot() -> void: + var game := await _game(false) + _kill_player_through_real_enemy_turn(game) + + var panel := game.get_node("HUD/DeathPanel") as PanelContainer + assert_true(game.get_run_state().is_game_over) + assert_eq(game.get_run_state().slot_policy, &"preserve") + assert_true(panel.visible) + assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Classique") + assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"run_ended")) + assert_eq(game.submit_test_action(Vector2i.RIGHT), []) + +func test_permadeath_death_retires_the_run_slot_and_reports_the_mode() -> void: + var game := await _game(true) + _kill_player_through_real_enemy_turn(game) + + var panel := game.get_node("HUD/DeathPanel") as PanelContainer + assert_true(game.get_run_state().is_game_over) + assert_eq(game.get_run_state().slot_policy, &"retire") + assert_true(panel.visible) + assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "permanente") + assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"permadeath_run_retired")) + +func test_qualified_narrative_resurrection_continues_the_real_game_without_showing_death_panel() -> void: + var game := await _game(true) + var state := game.get_game_state() + game.get_run_state().inventory.add_item(ItemInstanceType.new(ItemDefinitionType.from_catalog(game.spell_catalog, PHYLACTERY_ID))) + var end_before := game.get_dialogue_player().attributes.get_attribute(&"end") + + _kill_player_through_real_enemy_turn(game) + + var panel := game.get_node("HUD/DeathPanel") as PanelContainer + assert_false(game.get_run_state().is_game_over) + assert_eq(game.get_run_state().slot_policy, &"active") + assert_false(panel.visible) + assert_eq(state.player.hit_points, maxi(1, int(state.player.max_hit_points * 0.25))) + assert_eq(game.get_dialogue_player().attributes.get_attribute(&"end"), end_before - 1) + assert_true(game.get_dialogue_player().flags.get(&"marked_by_death", false)) + assert_false(game.get_run_state().inventory.items.any(func(item: ItemInstance) -> bool: return item.definition.id == PHYLACTERY_ID)) + assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"narrative_resurrection")) + +func _kill_player_through_real_enemy_turn(game: Game) -> void: + var state := game.get_game_state() + var enemy: ActorState = state.enemies[&"goblin"] + enemy.cell = state.player.cell + Vector2i.RIGHT + enemy.weapon_damage = state.player.hit_points + enemy.damage_variance = 0 + enemy.accuracy = 30 + game.submit_test_interact() + +func _game(permadeath: bool) -> Game: + var game := GameScene.instantiate() as Game + game.configure_new_run(RunSettingsType.new("F6-E2E", &"crawler", permadeath), "F6 Hero", &"vanguard") + add_child_autofree(game) + await get_tree().process_frame + return game diff --git a/tests/e2e/test_death_mode_e2e.gd.uid b/tests/e2e/test_death_mode_e2e.gd.uid new file mode 100644 index 0000000..5dc8344 --- /dev/null +++ b/tests/e2e/test_death_mode_e2e.gd.uid @@ -0,0 +1 @@ +uid://bnl4q3sr20sx4 diff --git a/tests/unit/test_death_resurrection.gd b/tests/unit/test_death_resurrection.gd new file mode 100644 index 0000000..26af6c7 --- /dev/null +++ b/tests/unit/test_death_resurrection.gd @@ -0,0 +1,52 @@ +extends GutTest + +const DeathEngineType = preload("res://scripts/domain/run/death_engine.gd") +const ActorStateType = preload("res://scripts/domain/actor_state.gd") +const PlayerStateType = preload("res://scripts/domain/entities/player_state.gd") +const ContentCatalogType = preload("res://scripts/domain/content/content_catalog.gd") +const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd") +const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd") +const InventoryStateType = preload("res://scripts/domain/inventory/inventory_state.gd") + +const PHYLACTERY_ID: StringName = &"misc_phylactere_narratif" + +func test_qualified_narrative_phylactery_consumes_it_and_restores_a_dead_player_at_a_permanent_cost() -> void: + var combat_player := ActorStateType.new(&"player", Vector2i.ZERO, 100, 3) + combat_player.hit_points = 0 + var narrative_player := PlayerStateType.new({"attributes": {"end": 6}}) + var inventory := InventoryStateType.new() + inventory.add_item(ItemInstanceType.new(ItemDefinitionType.from_catalog(_catalog(), PHYLACTERY_ID))) + var engine: DeathEngine = DeathEngineType.new() + + var result := engine.resolve(combat_player, narrative_player, inventory, false) + + assert_eq(result.outcome, &"resurrected") + assert_false(result.game_over) + assert_eq(result.slot_policy, DeathEngine.SLOT_POLICY_ACTIVE) + assert_true(combat_player.is_alive()) + assert_eq(combat_player.hit_points, 25) + assert_eq(narrative_player.attributes.get_attribute(&"end"), 5) + assert_true(narrative_player.flags.get(&"marked_by_death", false)) + assert_false(inventory.items.any(func(item: ItemInstance) -> bool: return item.definition.id == PHYLACTERY_ID)) + assert_string_contains(String(result.message).to_lower(), "phylact") + +func test_final_death_keeps_a_classic_slot_but_retires_a_permadeath_slot() -> void: + var engine: DeathEngine = DeathEngineType.new() + + var classic := engine.resolve(_dead_combat_player(), PlayerStateType.new(), InventoryStateType.new(), false) + var permadeath := engine.resolve(_dead_combat_player(), PlayerStateType.new(), InventoryStateType.new(), true) + + assert_eq(classic.outcome, &"classic_death") + assert_true(classic.game_over) + assert_eq(classic.slot_policy, DeathEngine.SLOT_POLICY_PRESERVE) + assert_eq(permadeath.outcome, &"permadeath") + assert_true(permadeath.game_over) + assert_eq(permadeath.slot_policy, DeathEngine.SLOT_POLICY_RETIRE) + +func _dead_combat_player() -> ActorState: + var player := ActorStateType.new(&"player", Vector2i.ZERO, 12, 3) + player.hit_points = 0 + return player + +func _catalog() -> ContentCatalog: + return ContentCatalogType.load_from_directory("res://data/ascii") diff --git a/tests/unit/test_death_resurrection.gd.uid b/tests/unit/test_death_resurrection.gd.uid new file mode 100644 index 0000000..45bbd62 --- /dev/null +++ b/tests/unit/test_death_resurrection.gd.uid @@ -0,0 +1 @@ +uid://ikx8kg34k3ls -- 2.54.0