Compare commits
9
Commits
78f4744c3f
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb600fbdf6 | ||
|
|
0f2eeac912 | ||
|
|
069537e737 | ||
|
|
70aa27d232 | ||
|
|
a2d5918b36 | ||
|
|
f9ef3d72aa | ||
|
|
bbf89a9f36 | ||
|
|
bc67e5ed88 | ||
|
|
c410f830e3 |
@@ -39,3 +39,4 @@ Reusable UI components copied from the local prototype kit documented by the por
|
||||
| `assets/ui/dark_fantasy/illustration_equipement.png` | `DungeonCrawlerWorld_UI_Assets/captures/illustration_equipement.png` | DungeonCrawlerWorld prototype UI kit | project prototype asset | none; equipment illustration TextureRect |
|
||||
| `assets/ui/dark_fantasy/dungeon_ui_background.png` | `DungeonCrawlerWorld_UI_Assets/captures/c4dc05cf-9f60-4620-a0af-f067852ba23b.png` | DungeonCrawlerWorld prototype UI kit | project prototype asset | none; reusable HUD background capture, tracked under portable pack identifier rather than an absolute workstation path |
|
||||
| `assets/ui/dark_fantasy/dark_fantasy_theme.tres` | authored in project from imported UI kit colors/textures | Dungeon Crawler World project | original project asset | Godot Theme: parchment text, gold accents, charcoal panels, ornamental textured borders, focused/hover button states, 16–22 px readable defaults |
|
||||
| `assets/ui/dark_fantasy/gold_coin.svg` | authored in project | Dungeon Crawler World project | original project asset | simple original SVG; readable round gold currency icon for HUD/GoldIcon |
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
|
||||
<circle cx="32" cy="32" r="29" fill="#3f2608"/>
|
||||
<circle cx="32" cy="32" r="25" fill="#d59620" stroke="#ffe58a" stroke-width="4"/>
|
||||
<circle cx="32" cy="32" r="17" fill="#f6bd3a" stroke="#9d5e0e" stroke-width="3"/>
|
||||
<path d="M32 18v28M24 25h13a6 6 0 010 12H27" fill="none" stroke="#6d3d08" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 451 B |
+2
-2
@@ -75,7 +75,7 @@ move_southwest={
|
||||
}
|
||||
move_southeast={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194441,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
wait={
|
||||
@@ -121,7 +121,7 @@ crafting={
|
||||
}
|
||||
character={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
quest={
|
||||
|
||||
+56
-11
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=24 format=3]
|
||||
[gd_scene load_steps=26 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/game/game.gd" id="1_game"]
|
||||
[ext_resource type="Script" path="res://scripts/presentation/map_renderer.gd" id="2_map"]
|
||||
@@ -43,6 +43,7 @@
|
||||
[ext_resource type="Texture2D" path="res://assets/ui/dark_fantasy/jauge_vie_pleine.png" id="40_hud_health"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ui/dark_fantasy/jauge_focus_pleine.png" id="41_hud_focus"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ui/dark_fantasy/jauge_xp_pleine.png" id="42_hud_xp"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ui/dark_fantasy/gold_coin.svg" id="43_hud_gold_coin"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBox_hud_panel"]
|
||||
texture = ExtResource("37_hud_panel")
|
||||
@@ -71,6 +72,8 @@ corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBox_legacy_transparent"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_prompt_panel"]
|
||||
bg_color = Color(0.10, 0.075, 0.042, 0.98)
|
||||
border_width_left = 2
|
||||
@@ -234,21 +237,42 @@ theme_override_colors/font_color = Color(1, 0.82, 0.42, 1)
|
||||
theme_override_font_sizes/font_size = 18
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
visible = false
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
theme_override_colors/font_color = Color(0.95, 0.79, 0.36, 1)
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
text = "Étage 0"
|
||||
|
||||
[node name="TitleNotificationLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
visible = false
|
||||
theme_override_colors/font_color = Color(1, 0.88, 0.52, 1)
|
||||
theme_override_colors/font_outline_color = Color(0.06, 0.035, 0.015, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="TitleNotificationTimer" type="Timer" parent="HUD"]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
|
||||
[node name="AchievementToastTimer" type="Timer" parent="HUD"]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
|
||||
[node name="HeaderValuesLabel" type="Label" parent="HUD" groups=["hud_header_values"]]
|
||||
layout_mode = 0
|
||||
theme_override_colors/font_color = Color(0.86, 0.78, 0.58, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
text = "Sans-Nom • Étage 0 • Salle inconnue • 0 cases explorées"
|
||||
text = ""
|
||||
visible = false
|
||||
|
||||
[node name="ResponsiveLayout" type="Control" parent="HUD"]
|
||||
layout_mode = 3
|
||||
@@ -337,13 +361,13 @@ theme_override_styles/panel = SubResource("StyleBox_section")
|
||||
[node name="CharacterSectionTitle" type="Label" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_colors/font_color = Color(0.96, 0.9, 0.7, 1)
|
||||
theme_override_colors/font_color = Color(0.96, 0.84, 0.48, 1)
|
||||
theme_override_colors/font_outline_color = Color(0.06, 0.035, 0.015, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.85)
|
||||
theme_override_constants/outline_size = 2
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_constants/shadow_offset_x = 1
|
||||
theme_override_constants/shadow_offset_y = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "PERSONNAGE"
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -397,13 +421,13 @@ theme_override_styles/panel = SubResource("StyleBox_section")
|
||||
[node name="JournalSectionTitle" type="Label" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_colors/font_color = Color(0.96, 0.9, 0.7, 1)
|
||||
theme_override_colors/font_color = Color(0.96, 0.84, 0.48, 1)
|
||||
theme_override_colors/font_outline_color = Color(0.06, 0.035, 0.015, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.85)
|
||||
theme_override_constants/outline_size = 2
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_constants/shadow_offset_x = 1
|
||||
theme_override_constants/shadow_offset_y = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "JOURNAL"
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -428,10 +452,14 @@ theme_override_styles/panel = SubResource("StyleBox_hud_panel")
|
||||
[node name="StatsPanel" type="PanelContainer" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
show_behind_parent = true
|
||||
theme_override_styles/panel = SubResource("StyleBox_legacy_transparent")
|
||||
|
||||
[node name="LogPanel" type="PanelContainer" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
show_behind_parent = true
|
||||
theme_override_styles/panel = SubResource("StyleBox_legacy_transparent")
|
||||
|
||||
[node name="PromptPanel" type="PanelContainer" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
@@ -466,7 +494,8 @@ layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_colors/font_color = Color(0.96, 0.84, 0.48, 1)
|
||||
theme_override_font_sizes/font_size = 21
|
||||
text = "Sans-Nom"
|
||||
text = ""
|
||||
visible = false
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CharacterLevelLabel" type="Label" parent="HUD/ResponsiveLayout" groups=["hud_character_values"]]
|
||||
@@ -532,15 +561,23 @@ vertical_alignment = 1
|
||||
layout_mode = 0
|
||||
theme_override_colors/font_color = Color(0.75, 0.9, 0.72, 1)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "État : 12 PV • 3 Focus"
|
||||
text = ""
|
||||
visible = false
|
||||
autowrap_mode = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="GoldIcon" type="TextureRect" parent="HUD"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("43_hud_gold_coin")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="GoldLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
theme_override_colors/font_color = Color(1, 0.84, 0.35, 1)
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "Or : 0"
|
||||
text = "0"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuestTrackerLabel" type="Label" parent="HUD"]
|
||||
@@ -553,18 +590,24 @@ vertical_alignment = 1
|
||||
|
||||
[node name="SpellLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
text = ""
|
||||
visible = false
|
||||
theme_override_colors/font_color = Color(0.82, 0.7, 1, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="EnemyHealthLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
text = ""
|
||||
visible = false
|
||||
theme_override_colors/font_color = Color(1, 0.8, 0.7, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CombatSummaryLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
text = ""
|
||||
visible = false
|
||||
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
autowrap_mode = 2
|
||||
@@ -572,6 +615,8 @@ vertical_alignment = 1
|
||||
|
||||
[node name="DeadlineLabel" type="Label" parent="HUD"]
|
||||
layout_mode = 0
|
||||
text = ""
|
||||
visible = false
|
||||
theme_override_colors/font_color = Color(1, 0.76, 0.4, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
autowrap_mode = 2
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/presentation/character_panel.gd" id="1_character"]
|
||||
[ext_resource type="Texture2D" path="res://assets/ui/dark_fantasy/panel_64x64_nine_patch_source.png" id="2_panel"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_character_panel"]
|
||||
bg_color = Color(0.035, 0.055, 0.09, 0.97)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(0.66, 0.82, 0.42, 0.95)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBox_character_panel"]
|
||||
texture = ExtResource("2_panel")
|
||||
texture_margin_left = 10.0
|
||||
texture_margin_top = 10.0
|
||||
texture_margin_right = 10.0
|
||||
texture_margin_bottom = 10.0
|
||||
modulate_color = Color(0.22, 0.2, 0.16, 0.98)
|
||||
|
||||
[node name="CharacterPanel" type="PanelContainer"]
|
||||
visible = false
|
||||
@@ -22,10 +19,10 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -220.0
|
||||
offset_top = -170.0
|
||||
offset_right = 220.0
|
||||
offset_bottom = 170.0
|
||||
offset_left = -360.0
|
||||
offset_top = -320.0
|
||||
offset_right = 360.0
|
||||
offset_bottom = 320.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBox_character_panel")
|
||||
@@ -36,13 +33,15 @@ layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -185.0
|
||||
offset_top = 18.0
|
||||
offset_right = 185.0
|
||||
offset_bottom = 46.0
|
||||
offset_left = -310.0
|
||||
offset_top = 22.0
|
||||
offset_right = 310.0
|
||||
offset_bottom = 54.0
|
||||
grow_horizontal = 2
|
||||
theme_override_colors/font_color = Color(0.75, 0.94, 0.55, 1)
|
||||
theme_override_font_sizes/font_size = 21
|
||||
theme_override_colors/font_color = Color(1, 0.88, 0.52, 1)
|
||||
theme_override_colors/font_outline_color = Color(0.08, 0.045, 0.015, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_font_sizes/font_size = 24
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Body" type="RichTextLabel" parent="."]
|
||||
@@ -50,11 +49,11 @@ layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 30.0
|
||||
offset_top = 62.0
|
||||
offset_right = -30.0
|
||||
offset_bottom = -24.0
|
||||
offset_left = 42.0
|
||||
offset_top = 76.0
|
||||
offset_right = -42.0
|
||||
offset_bottom = -30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
|
||||
theme_override_font_sizes/normal_font_size = 17
|
||||
theme_override_colors/default_color = Color(0.95, 0.93, 0.8, 1)
|
||||
theme_override_font_sizes/normal_font_size = 18
|
||||
|
||||
+40
-8
@@ -92,7 +92,9 @@ const QuestStateType = preload("res://scripts/domain/narrative/quest_state.gd")
|
||||
@onready var options_panel: OptionsPanel = $HUD/OptionsPanel
|
||||
@onready var help_panel: HelpPanel = $HUD/HelpPanel
|
||||
@onready var achievement_toast: Label = $HUD/AchievementToast
|
||||
@onready var title_label: Label = $HUD/TitleLabel
|
||||
@onready var achievement_toast_timer: Timer = $HUD/AchievementToastTimer
|
||||
@onready var title_notification_label: Label = $HUD/TitleNotificationLabel
|
||||
@onready var title_notification_timer: Timer = $HUD/TitleNotificationTimer
|
||||
@onready var companion_view: ActorView = $World/Companion
|
||||
@onready var party_views: Node2D = $World/Party
|
||||
const FACTION_WAR_MIN_FLOOR := 9
|
||||
@@ -132,6 +134,7 @@ var active_dialogue_npc: Dictionary = {}
|
||||
var active_event_index := -1
|
||||
var _turn_start_player_hit_points := -1
|
||||
var _turn_start_companion_hit_points := -1
|
||||
var _title_notifications_enabled := false
|
||||
|
||||
func configure_new_run(settings: RunSettings, player_name: String) -> void:
|
||||
pending_run_settings = settings
|
||||
@@ -158,6 +161,9 @@ func _ready() -> void:
|
||||
race_class_choice_panel.race_confirmed.connect(_choose_floor_three_race)
|
||||
race_class_choice_panel.class_confirmed.connect(_choose_floor_three_class)
|
||||
death_panel.navigation_requested.connect(func(action: StringName) -> void: death_navigation_requested.emit(action))
|
||||
title_notification_timer.timeout.connect(_hide_title_notification)
|
||||
achievement_toast_timer.timeout.connect(_hide_achievement_toast)
|
||||
_title_notifications_enabled = true
|
||||
map_renderer.set_map(game_state.map)
|
||||
_sync_map_renderer_visibility()
|
||||
_sync_minimap()
|
||||
@@ -311,6 +317,7 @@ func _get_capture_mode() -> String:
|
||||
func _capture_visual_check(capture_mode: String) -> void:
|
||||
if capture_mode == "exit":
|
||||
_prepare_exit_capture_state()
|
||||
_refresh_capture_hud()
|
||||
# Camera2D applies its scroll during the frame cycle. Force it before the
|
||||
# deterministic capture so the world is framed around the capture state.
|
||||
camera.force_update_scroll()
|
||||
@@ -328,6 +335,11 @@ func _capture_visual_check(capture_mode: String) -> void:
|
||||
var result := image.save_png(capture_path)
|
||||
get_tree().quit(0 if result == OK else 1)
|
||||
|
||||
func _refresh_capture_hud() -> void:
|
||||
# Capture startup appends game_started after the normal first HUD refresh.
|
||||
# Refresh only on the capture path so production rendering remains untouched.
|
||||
hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state)
|
||||
|
||||
func _prepare_exit_capture_state() -> void:
|
||||
# Preserve the entrance exploration, then frame the authored surface exit.
|
||||
# This exercises visible, explored, and unknown rendering without depending
|
||||
@@ -1010,7 +1022,7 @@ func _toggle_character_panel() -> Array[GameEvent]:
|
||||
_close_character_panel(false)
|
||||
return _record_ranged_event(&"character_panel_closed", &"", {}, "Character panel closed.")
|
||||
_sync_dialogue_player_progression()
|
||||
character_panel.present(dialogue_player, game_state.player.progression)
|
||||
character_panel.present(dialogue_player, game_state.player.progression, run_state.player_name, _current_title())
|
||||
return _record_ranged_event(&"character_panel_opened", &"", {"level": game_state.player.progression.level}, "Character panel opened.")
|
||||
|
||||
func _spend_character_attribute(key: StringName) -> void:
|
||||
@@ -1812,6 +1824,8 @@ func _observe_achievements(events: Array[GameEvent]) -> void:
|
||||
var achievement_id := StringName(definition.get("id", ""))
|
||||
var message := "Succès débloqué : %s" % String(definition.get("name", achievement_id))
|
||||
achievement_toast.text = message
|
||||
achievement_toast.visible = true
|
||||
achievement_toast_timer.start()
|
||||
run_state.log.insert(insertion_index, GameEventType.new(
|
||||
event.turn,
|
||||
event.floor,
|
||||
@@ -1881,13 +1895,31 @@ func _current_title() -> Dictionary:
|
||||
return title_engine.refresh(_title_context()) if title_engine != null else {}
|
||||
|
||||
func _refresh_title() -> void:
|
||||
var title := _current_title()
|
||||
if title.is_empty():
|
||||
run_state.current_title_id = &""
|
||||
title_label.text = ""
|
||||
if run_state == null:
|
||||
return
|
||||
run_state.current_title_id = StringName(title.get("id", ""))
|
||||
title_label.text = "Titre : %s" % String(title.get("name", title.get("id", "")))
|
||||
var title := _current_title()
|
||||
var previous_title_id := run_state.current_title_id
|
||||
var current_title_id := StringName(title.get("id", ""))
|
||||
run_state.current_title_id = current_title_id
|
||||
if title.is_empty():
|
||||
# A title loss is not an announcement; it must also clear a still-visible
|
||||
# notification from the prior title.
|
||||
_hide_title_notification()
|
||||
return
|
||||
# Boot and load establish the state silently. Only a real later transition
|
||||
# deserves the temporary overlay; the permanent top bar belongs to GameHud.
|
||||
if _title_notifications_enabled and current_title_id != previous_title_id:
|
||||
title_notification_label.text = String(title.get("name", current_title_id))
|
||||
title_notification_label.visible = true
|
||||
title_notification_timer.start()
|
||||
|
||||
func _hide_title_notification() -> void:
|
||||
title_notification_label.visible = false
|
||||
title_notification_label.text = ""
|
||||
|
||||
func _hide_achievement_toast() -> void:
|
||||
achievement_toast.visible = false
|
||||
achievement_toast.text = ""
|
||||
|
||||
func _append_level_up_events(events: Array[GameEvent]) -> void:
|
||||
var levels_gained := 0
|
||||
|
||||
@@ -3,16 +3,26 @@ extends PanelContainer
|
||||
|
||||
const SkillTreeType = preload("res://scripts/domain/progression/skill_tree.gd")
|
||||
|
||||
const ATTRIBUTE_LABELS := {
|
||||
&"str_": "Force", &"agi": "Agilité", &"end": "Endurance", &"per": "Perception",
|
||||
&"int_": "Intelligence", &"wil": "Volonté", &"cha": "Charisme", &"luc": "Chance",
|
||||
}
|
||||
const FEATURED_SKILLS := {&"melee": "Corps à corps", &"ranged": "Distance", &"dodge": "Esquive"}
|
||||
|
||||
@onready var title: Label = $Title
|
||||
@onready var body: RichTextLabel = $Body
|
||||
|
||||
var _player: PlayerState
|
||||
var _experience: Experience
|
||||
var _skill_tree: SkillTree
|
||||
var _player_name := "Sans-Nom"
|
||||
var _title_definition: Dictionary = {}
|
||||
|
||||
func present(player: PlayerState, experience: Experience) -> void:
|
||||
func present(player: PlayerState, experience: Experience, player_name: String = "Sans-Nom", title_definition: Dictionary = {}) -> void:
|
||||
_player = player
|
||||
_experience = experience
|
||||
_player_name = player_name
|
||||
_title_definition = title_definition.duplicate(true)
|
||||
_skill_tree = SkillTreeType.new(experience, player.attributes, player.skills)
|
||||
visible = true
|
||||
refresh()
|
||||
@@ -22,6 +32,7 @@ func dismiss() -> void:
|
||||
_player = null
|
||||
_experience = null
|
||||
_skill_tree = null
|
||||
_title_definition.clear()
|
||||
|
||||
func spend_attribute(key: StringName) -> Dictionary:
|
||||
if _skill_tree == null:
|
||||
@@ -42,13 +53,26 @@ func spend_skill(key: StringName) -> Dictionary:
|
||||
func refresh() -> void:
|
||||
if _player == null or _experience == null:
|
||||
return
|
||||
title.text = "Character"
|
||||
body.text = "Level %d — XP %d/%d\nAttribute points: %d\nSkill points: %d\n\n[A] Strength: %d\n[S] Melee: %d\n\nA / S Allocate Esc Close" % [
|
||||
_experience.level,
|
||||
_experience.total_xp,
|
||||
_experience.next_level_xp(),
|
||||
_experience.attribute_points,
|
||||
_experience.skill_points,
|
||||
_player.attributes.get_attribute(&"str_"),
|
||||
_player.effective_skill(&"melee"),
|
||||
var title_name := String(_title_definition.get("name", "Sans titre"))
|
||||
var flavor := String(_title_definition.get("flavor", "Aucune légende n’est encore écrite."))
|
||||
title.text = "FICHE DE PERSONNAGE"
|
||||
var lines := [
|
||||
"Nom : %s" % _player_name,
|
||||
"Titre : %s" % title_name,
|
||||
flavor,
|
||||
"",
|
||||
"Niveau %d — XP %d/%d" % [_experience.level, _experience.total_xp, _experience.next_level_xp()],
|
||||
"Points d’attribut : %d" % _experience.attribute_points,
|
||||
"Points de compétence : %d" % _experience.skill_points,
|
||||
"",
|
||||
"Caractéristiques :",
|
||||
]
|
||||
for key: StringName in ATTRIBUTE_LABELS:
|
||||
lines.append("%s : %d" % [ATTRIBUTE_LABELS[key], _player.attributes.get_attribute(key)])
|
||||
lines.append("")
|
||||
lines.append("Compétences principales :")
|
||||
for key: StringName in FEATURED_SKILLS:
|
||||
lines.append("%s : %d" % [FEATURED_SKILLS[key], _player.effective_skill(key)])
|
||||
lines.append("")
|
||||
lines.append("A / S Allouer (Force / Corps à corps) Échap Fermer")
|
||||
body.text = "\n".join(lines)
|
||||
|
||||
+155
-60
@@ -14,6 +14,19 @@ const QUEST_BOARD_PROMPT := "Espace — Lire le tableau des quêtes"
|
||||
const REFERENCE_VIEWPORT := Vector2(1920.0, 1080.0)
|
||||
const MIN_LAYOUT_SCALE := 0.66
|
||||
const MIN_FONT_SCALE := 0.66
|
||||
const STATUS_EFFECT_NAMES := {
|
||||
&"poison": "Empoisonnement",
|
||||
&"bleeding": "Saignement",
|
||||
&"burning": "Brûlure",
|
||||
&"sepsis": "Septicémie",
|
||||
&"stunned": "Étourdi",
|
||||
&"feared": "Effrayé",
|
||||
&"confused": "Confus",
|
||||
&"wounded": "Blessé",
|
||||
&"fatigued": "Fatigué",
|
||||
&"strengthened": "Renforcé",
|
||||
&"regenerating": "Régénération",
|
||||
}
|
||||
|
||||
@onready var player_health_label: Label = $PlayerHealthLabel
|
||||
@onready var player_focus_label: Label = $PlayerFocusLabel
|
||||
@@ -23,6 +36,7 @@ const MIN_FONT_SCALE := 0.66
|
||||
@onready var experience_label: Label = $ExperienceLabel
|
||||
@onready var spell_label: Label = $SpellLabel
|
||||
@onready var deadline_label: Label = $DeadlineLabel
|
||||
@onready var gold_icon: TextureRect = $GoldIcon
|
||||
@onready var gold_label: Label = $GoldLabel
|
||||
@onready var quest_tracker_label: Label = $QuestTrackerLabel
|
||||
@onready var enemy_health_label: Label = $EnemyHealthLabel
|
||||
@@ -31,12 +45,15 @@ const MIN_FONT_SCALE := 0.66
|
||||
@onready var character_name_label: Label = $ResponsiveLayout/CharacterNameLabel
|
||||
@onready var character_level_label: Label = $ResponsiveLayout/CharacterLevelLabel
|
||||
@onready var header_values_label: Label = $HeaderValuesLabel
|
||||
@onready var title_label: Label = $TitleLabel
|
||||
@onready var event_log: RichTextLabel = $EventLog
|
||||
@onready var log_panel: PanelContainer = $ResponsiveLayout/LogPanel
|
||||
@onready var context_prompt_label: Label = $ContextPromptLabel
|
||||
@onready var action_hint_label: Label = $ResponsiveLayout/PromptPanel/ActionHintLabel
|
||||
@onready var responsive_layout: Control = $ResponsiveLayout
|
||||
|
||||
const HIDDEN_JOURNAL_KINDS: Array[StringName] = [&"moved", &"enemy_moved", &"companion_moved", &"party_moved", &"episode_published"]
|
||||
|
||||
var combat_summary := ""
|
||||
var log_expanded := false
|
||||
var _state: GameState
|
||||
@@ -103,38 +120,38 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
|
||||
_set_rect($ResponsiveLayout/HelpPanel, origin + Vector2(1120, 968) * scale, Vector2(772, 84) * scale)
|
||||
_set_rect($ResponsiveLayout/QuickSlotStrip, origin + Vector2(28, 968) * scale, Vector2(442, 84) * scale)
|
||||
|
||||
_set_rect($ResponsiveLayout/CharacterSectionTitle, origin + Vector2(44, 118) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/ObjectivesSectionTitle, origin + Vector2(44, 430) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/StatusSectionTitle, origin + Vector2(44, 616) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/JournalSectionTitle, origin + Vector2(1472, 118) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/MapSectionTitle, origin + Vector2(1472, 534) * scale, Vector2(400, 24) * scale)
|
||||
# Every title has a deliberate 18px inset: it stays clear of the nine-patch border.
|
||||
_set_rect($ResponsiveLayout/CharacterSectionTitle, origin + Vector2(44, 128) * scale, Vector2(400, 28) * scale)
|
||||
_set_rect($ResponsiveLayout/ObjectivesSectionTitle, origin + Vector2(44, 440) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/StatusSectionTitle, origin + Vector2(44, 620) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/JournalSectionTitle, origin + Vector2(1472, 128) * scale, Vector2(400, 28) * scale)
|
||||
_set_rect($ResponsiveLayout/MapSectionTitle, origin + Vector2(1472, 544) * scale, Vector2(400, 24) * scale)
|
||||
_set_rect($ResponsiveLayout/QuickSlotHint, origin + Vector2(38, 980) * scale, Vector2(420, 60) * scale)
|
||||
|
||||
_set_rect($AchievementToast, origin + Vector2(1080, 18) * scale, Vector2(420, 25) * scale)
|
||||
_set_rect($TitleLabel, origin + Vector2(480, 18) * scale, Vector2(570, 26) * scale)
|
||||
_set_rect($AchievementToast, origin + Vector2(1450, 48) * scale, Vector2(420, 25) * scale)
|
||||
_set_rect($TitleLabel, origin + Vector2(675, 24) * scale, Vector2(570, 34) * scale)
|
||||
_set_rect($TitleNotificationLabel, origin + Vector2(650, 52) * scale, Vector2(620, 26) * scale)
|
||||
_set_rect($HeaderValuesLabel, origin + Vector2(480, 51) * scale, Vector2(960, 26) * scale)
|
||||
# Identity leads the character card. The portrait stays at the mockup's 140px
|
||||
# width and the source aspect ratio (127:140); vital gauges form a clear column.
|
||||
_set_rect($ResponsiveLayout/PortraitIllustration, origin + Vector2(44, 160) * scale, Vector2(140, 154.33) * scale)
|
||||
# Character identity is the section title. The legacy name label remains hidden.
|
||||
_set_rect($ResponsiveLayout/CharacterNameLabel, origin + Vector2(202, 154) * scale, Vector2(226, 30) * scale)
|
||||
_set_rect($ResponsiveLayout/CharacterLevelLabel, origin + Vector2(202, 184) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($PlayerHealthLabel, origin + Vector2(202, 210) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($HealthBar, origin + Vector2(202, 234) * scale, Vector2(226, 18) * scale)
|
||||
_set_rect($PlayerFocusLabel, origin + Vector2(202, 258) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($FocusBar, origin + Vector2(202, 282) * scale, Vector2(226, 18) * scale)
|
||||
_set_rect($ExperienceBar, origin + Vector2(44, 326) * scale, Vector2(384, 22) * scale)
|
||||
_set_rect($ExperienceLabel, origin + Vector2(48, 326) * scale, Vector2(376, 22) * scale)
|
||||
_set_rect($CharacterStatusLabel, origin + Vector2(44, 356) * scale, Vector2(384, 20) * scale)
|
||||
_set_rect($GoldLabel, origin + Vector2(44, 382) * scale, Vector2(384, 20) * scale)
|
||||
_set_rect($ResponsiveLayout/CharacterLevelLabel, origin + Vector2(202, 164) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($PlayerHealthLabel, origin + Vector2(202, 194) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($HealthBar, origin + Vector2(202, 218) * scale, Vector2(226, 18) * scale)
|
||||
_set_rect($PlayerFocusLabel, origin + Vector2(202, 242) * scale, Vector2(226, 22) * scale)
|
||||
_set_rect($FocusBar, origin + Vector2(202, 266) * scale, Vector2(226, 18) * scale)
|
||||
_set_rect($ExperienceBar, origin + Vector2(44, 306) * scale, Vector2(384, 22) * scale)
|
||||
_set_rect($ExperienceLabel, origin + Vector2(48, 306) * scale, Vector2(376, 22) * scale)
|
||||
_set_rect($GoldIcon, origin + Vector2(44, 366) * scale, Vector2(24, 24) * scale)
|
||||
_set_rect($GoldLabel, origin + Vector2(76, 366) * scale, Vector2(120, 24) * scale)
|
||||
|
||||
_set_rect($QuestTrackerLabel, origin + Vector2(52, 462) * scale, Vector2(376, 112) * scale)
|
||||
_set_rect($QuestTrackerLabel, origin + Vector2(52, 482) * scale, Vector2(376, 92) * scale)
|
||||
|
||||
_set_rect($SpellLabel, origin + Vector2(44, 648) * scale, Vector2(386, 24) * scale)
|
||||
_set_rect($EnemyHealthLabel, origin + Vector2(44, 678) * scale, Vector2(386, 24) * scale)
|
||||
_set_rect($CombatSummaryLabel, origin + Vector2(44, 708) * scale, Vector2(386, 42) * scale)
|
||||
_set_rect($DeadlineLabel, origin + Vector2(44, 760) * scale, Vector2(386, 116) * scale)
|
||||
_layout_status_slots(origin, scale)
|
||||
|
||||
_set_rect($EventLog, origin + Vector2(1476, 154) * scale, Vector2(396, 340) * scale)
|
||||
_set_rect($EventLog, origin + Vector2(1476, 164) * scale, Vector2(396, 330) * scale)
|
||||
_set_rect($ContextPromptLabel, origin + Vector2(506, 1008) * scale, Vector2(578, 30) * scale)
|
||||
_set_rect($HelpLabel, origin + Vector2(1132, 980) * scale, Vector2(742, 58) * scale)
|
||||
var minimap := get_node_or_null("Minimap") as Control
|
||||
@@ -148,11 +165,44 @@ func _set_rect(control: Control, position: Vector2, control_size: Vector2) -> vo
|
||||
control.position = position
|
||||
control.size = control_size
|
||||
|
||||
func _layout_status_slots(origin: Vector2, scale: float) -> void:
|
||||
# StatusSection ends at y=928. At reference, slots follow the authored
|
||||
# 664/780/824px composition. At compact scale labels retain enough physical
|
||||
# height to wrap all effects, so the bounded stack is bottom-aligned instead.
|
||||
var x := origin.x + 44.0 * scale
|
||||
var width := 386.0 * scale
|
||||
var character_y := origin.y + 664.0 * scale
|
||||
var character_height := 100.0 * scale
|
||||
var target_height := 24.0 * scale
|
||||
var deadline_height := 60.0 * scale
|
||||
var gap := 18.0 * scale
|
||||
if scale < 1.0:
|
||||
# These are physical compact-layout heights (not artboard-scaled): the
|
||||
# multi-effect row needs its full wrapped minimum while all rows remain
|
||||
# inside StatusSection at 1280×720 with a visible 12px gap.
|
||||
character_height = 97.0
|
||||
target_height = 23.0
|
||||
deadline_height = 28.0
|
||||
gap = 12.0
|
||||
# Keep the StatusSection title clear while remaining above its lower edge.
|
||||
character_y = maxf(origin.y + 662.0 * scale, origin.y + 928.0 * scale - character_height - target_height - deadline_height - 2.0 * gap)
|
||||
var target_y := character_y + character_height + gap
|
||||
var deadline_y := target_y + target_height + gap
|
||||
_set_rect($CharacterStatusLabel, Vector2(x, character_y), Vector2(width, character_height))
|
||||
_set_rect($EnemyHealthLabel, Vector2(x, target_y), Vector2(width, target_height))
|
||||
_set_rect($DeadlineLabel, Vector2(x, deadline_y), Vector2(width, deadline_height))
|
||||
# Dormant labels share a hidden lower slot. _refresh_status_section clears
|
||||
# and hides them before showing actionable information.
|
||||
var dormant_y := origin.y + 896.0 * scale
|
||||
_set_rect($SpellLabel, Vector2(x, dormant_y), Vector2(width, 20.0 * scale))
|
||||
_set_rect($CombatSummaryLabel, Vector2(x, dormant_y), Vector2(width, 20.0 * scale))
|
||||
|
||||
func _apply_text_scale(layout_scale: float) -> void:
|
||||
var font_scale := clampf(layout_scale, MIN_FONT_SCALE, 1.0)
|
||||
for control: Control in [
|
||||
$AchievementToast,
|
||||
$TitleLabel,
|
||||
$TitleNotificationLabel,
|
||||
$HeaderValuesLabel,
|
||||
$ResponsiveLayout/QuickSlotHint,
|
||||
$PlayerHealthLabel,
|
||||
@@ -167,7 +217,6 @@ func _apply_text_scale(layout_scale: float) -> void:
|
||||
$EnemyHealthLabel,
|
||||
$CombatSummaryLabel,
|
||||
$DeadlineLabel,
|
||||
$EventLog,
|
||||
action_hint_label,
|
||||
$ContextPromptLabel,
|
||||
$HelpLabel,
|
||||
@@ -178,6 +227,14 @@ func _apply_text_scale(layout_scale: float) -> void:
|
||||
control.set_meta(&"base_font_size", base_size)
|
||||
control.add_theme_font_size_override(&"font_size", roundi(base_size * font_scale))
|
||||
|
||||
# RichTextLabel does not use Label's font_size theme key. Keep the journal
|
||||
# independently readable at 720p without changing the rest of the HUD scale.
|
||||
var event_log_base_size: int = event_log.get_meta(&"base_normal_font_size", 0)
|
||||
if event_log_base_size == 0:
|
||||
event_log_base_size = event_log.get_theme_font_size(&"normal_font_size")
|
||||
event_log.set_meta(&"base_normal_font_size", event_log_base_size)
|
||||
event_log.add_theme_font_size_override(&"normal_font_size", max(12, roundi(event_log_base_size * font_scale)))
|
||||
|
||||
func _layout_expanded_log(origin: Vector2, scale: float) -> void:
|
||||
# Explicit expansion may temporarily consume the MapSection, never the world.
|
||||
_set_rect(log_panel, origin + Vector2(1456, 110) * scale, Vector2(436, 818) * scale)
|
||||
@@ -191,33 +248,87 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
|
||||
_state = state
|
||||
if run_state != null:
|
||||
_run_state = run_state
|
||||
player_health_label.text = "PV du joueur : %d/%d" % [state.player.hit_points, state.player.max_hit_points]
|
||||
player_health_label.text = "PV : %d/%d" % [state.player.hit_points, state.player.max_hit_points]
|
||||
player_focus_label.text = "Focus : %d/%d" % [state.player.focus, state.player.max_focus]
|
||||
_refresh_live_gauge(health_bar, state.player.hit_points, state.player.max_hit_points)
|
||||
_refresh_live_gauge(focus_bar, state.player.focus, state.player.max_focus)
|
||||
_refresh_experience(state.player.progression)
|
||||
_refresh_header_values()
|
||||
character_name_label.text = _run_state.player_name if _run_state != null else "Sans-Nom"
|
||||
title_label.text = "Étage %d" % state.floor_state.floor_number
|
||||
var player_name := _run_state.player_name if _run_state != null else "Sans-Nom"
|
||||
$ResponsiveLayout/CharacterSectionTitle.text = player_name
|
||||
character_name_label.text = ""
|
||||
character_name_label.visible = false
|
||||
character_level_label.text = "Niveau %d" % state.player.progression.level
|
||||
character_status_label.text = "État : prêt à explorer"
|
||||
if state.enemies.has(&"goblin"):
|
||||
var goblin: ActorState = state.enemies[&"goblin"]
|
||||
combat_summary = "Gobelin — PV : %d/%d" % [goblin.hit_points, goblin.max_hit_points]
|
||||
enemy_health_label.text = combat_summary
|
||||
combat_summary_label.text = ""
|
||||
else:
|
||||
combat_summary = "Aucune cible active"
|
||||
enemy_health_label.text = combat_summary
|
||||
combat_summary_label.text = ""
|
||||
deadline_label.text = _deadline_status()
|
||||
gold_label.text = "Or : %d" % (_run_state.gold if _run_state != null else 0)
|
||||
_refresh_status_section(state)
|
||||
gold_label.text = str(_run_state.gold if _run_state != null else 0)
|
||||
quest_tracker_label.text = _quest_tracker()
|
||||
action_hint_label.text = "F : Distance • X : Magie • K : Familier"
|
||||
context_prompt_label.text = get_context_prompt()
|
||||
# The supplied RunState journal events are the only source for journal text.
|
||||
event_log.clear()
|
||||
for event in events:
|
||||
event_log.append_text(_localized_event_message(event) + "\n")
|
||||
if _should_show_in_journal(event):
|
||||
event_log.append_text(_localized_event_message(event) + "\n")
|
||||
|
||||
func _refresh_status_section(state: GameState) -> void:
|
||||
for label: Label in [character_status_label, spell_label, enemy_health_label, combat_summary_label, deadline_label]:
|
||||
label.text = ""
|
||||
label.visible = false
|
||||
combat_summary = ""
|
||||
|
||||
var effects: Array[String] = []
|
||||
for effect: StatusEffect in state.player.status_effects:
|
||||
var name := String(STATUS_EFFECT_NAMES.get(effect.key, String(effect.key).capitalize()))
|
||||
if state.player.status_effects.size() <= 3:
|
||||
effects.append("%s (%d tours)" % [name, effect.duration])
|
||||
else:
|
||||
effects.append("%s %d" % [name, effect.duration])
|
||||
if not effects.is_empty():
|
||||
# Compact separators preserve every effect and duration in the fixed slot.
|
||||
var prefix := "Effets : " if effects.size() <= 3 else "Effets (%d) : " % effects.size()
|
||||
character_status_label.text = prefix + (", ".join(effects) if effects.size() <= 3 else " • ".join(effects))
|
||||
character_status_label.visible = true
|
||||
|
||||
var target := _active_target(state)
|
||||
if target != null:
|
||||
combat_summary = "%s — PV : %d/%d" % [_target_name(target), target.hit_points, target.max_hit_points]
|
||||
enemy_health_label.text = combat_summary
|
||||
enemy_health_label.visible = true
|
||||
|
||||
var deadline_status := _deadline_status()
|
||||
if not deadline_status.is_empty():
|
||||
deadline_label.text = deadline_status
|
||||
deadline_label.visible = true
|
||||
|
||||
func _active_target(state: GameState) -> ActorState:
|
||||
var candidates: Array[ActorState] = []
|
||||
for enemy: ActorState in state.enemies.values():
|
||||
if enemy.is_alive() and bool(state.visible_cells.get(enemy.cell, false)):
|
||||
candidates.append(enemy)
|
||||
if candidates.is_empty():
|
||||
return null
|
||||
candidates.sort_custom(func(left: ActorState, right: ActorState) -> bool:
|
||||
var left_distance := state.player.cell.distance_squared_to(left.cell)
|
||||
var right_distance := state.player.cell.distance_squared_to(right.cell)
|
||||
if left_distance != right_distance:
|
||||
return left_distance < right_distance
|
||||
return String(left.id) < String(right.id)
|
||||
)
|
||||
return candidates[0]
|
||||
|
||||
func _target_name(target: ActorState) -> String:
|
||||
if target.id == &"goblin" or target.content_id == &"goblin":
|
||||
return "Gobelin"
|
||||
if _run_state != null and _run_state.content_catalog != null:
|
||||
var definition := _run_state.content_catalog.get_enemy(target.content_id)
|
||||
if not definition.is_empty():
|
||||
return String(definition.get("name", "Ennemi"))
|
||||
# Never expose an actor/content identifier as player-facing HUD text.
|
||||
return "Ennemi"
|
||||
|
||||
func _should_show_in_journal(event: GameEvent) -> bool:
|
||||
return event.kind not in HIDDEN_JOURNAL_KINDS
|
||||
|
||||
## Converts only the structured events the HUD owns into French. Domain messages
|
||||
## remain untouched and provide the presentation fallback for every other kind.
|
||||
@@ -471,19 +582,10 @@ func _refresh_live_gauge(gauge: ProgressBar, current: int, maximum: int) -> void
|
||||
gauge.value = clampi(current, 0, maximum)
|
||||
|
||||
func _refresh_header_values() -> void:
|
||||
if _state == null:
|
||||
return
|
||||
var player_name := _run_state.player_name if _run_state != null else "Sans-Nom"
|
||||
var floor_number := _state.floor_state.floor_number
|
||||
var room_id := _state.floor_state.map.get_room_id(_state.player.cell)
|
||||
# Surface corridor cells deliberately have no map room id. Derive their
|
||||
# containing room for display only; presentation must never alter domain state.
|
||||
if room_id.is_empty():
|
||||
for room: RoomState in _state.floor_state.rooms:
|
||||
if room.bounds.has_point(_state.player.cell):
|
||||
room_id = room.id
|
||||
break
|
||||
header_values_label.text = "%s • Étage %d • Salle %s • %d cases explorées" % [player_name, floor_number, String(room_id), _state.explored_cells.size()]
|
||||
# Kept solely as a stable node path for older UI integrations. The floor is
|
||||
# now the single permanent top-bar value and is refreshed above.
|
||||
header_values_label.text = ""
|
||||
header_values_label.visible = false
|
||||
|
||||
func _refresh_experience(experience: Experience) -> void:
|
||||
var current_level_start := experience.xp_for_level(experience.level)
|
||||
@@ -539,14 +641,7 @@ func _quest_tracker() -> String:
|
||||
return "◆ %s — terminée" % String(definition.get("title", state.quest_id))
|
||||
|
||||
func _deadline_status() -> String:
|
||||
if _run_state == null:
|
||||
if _run_state == null or _run_state.current_floor <= 0:
|
||||
return ""
|
||||
if _run_state.current_floor == 0:
|
||||
return "Surface — aucun effondrement"
|
||||
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()
|
||||
return "Effondrement du niveau dans %d jours" % deadline.remaining_days()
|
||||
|
||||
@@ -36,7 +36,24 @@ func test_real_hit_unlocks_reward_toast_journal_claim_and_title_refresh() -> voi
|
||||
assert_string_contains((game.get_node("HUD/AchievementToast") as Label).text, "Premier coup")
|
||||
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"achievement_unlocked"))
|
||||
assert_eq(game.get_run_state().current_title_id, &"striker")
|
||||
assert_string_contains((game.get_node("HUD/TitleLabel") as Label).text, "Frappeur")
|
||||
var permanent_title := game.get_node_or_null("HUD/TitleLabel") as Label
|
||||
var notification := game.get_node_or_null("HUD/TitleNotificationLabel") as Label
|
||||
var notification_timer := game.get_node_or_null("HUD/TitleNotificationTimer") as Timer
|
||||
assert_not_null(permanent_title)
|
||||
assert_not_null(notification, "HUD requires a separate temporary TitleNotificationLabel")
|
||||
assert_not_null(notification_timer, "HUD requires TitleNotificationTimer")
|
||||
if permanent_title != null:
|
||||
assert_eq(permanent_title.text, "Étage 0", "The permanent TopBar title remains the current floor")
|
||||
if notification == null or notification_timer == null:
|
||||
return
|
||||
assert_true(notification.visible, "A newly earned title needs a temporary notification")
|
||||
assert_eq(notification.text, "Frappeur")
|
||||
assert_true(notification_timer.one_shot)
|
||||
assert_eq(notification_timer.wait_time, 5.0)
|
||||
# The real five-second expiry is intentionally verified by the dedicated
|
||||
# transition test below, rather than manually emitting this timer's signal.
|
||||
if permanent_title != null:
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
await _dispatch_key(KEY_L)
|
||||
assert_true(panel.visible)
|
||||
@@ -45,6 +62,56 @@ func test_real_hit_unlocks_reward_toast_journal_claim_and_title_refresh() -> voi
|
||||
assert_true(game.get_run_state().recent_events(3).any(func(event: GameEvent) -> bool: return event.kind == &"achievement_reward_claimed"))
|
||||
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Récompense reçue")
|
||||
|
||||
func test_title_notification_only_announces_real_transitions_and_expires_after_its_timer() -> void:
|
||||
var permanent_title := game.get_node_or_null("HUD/TitleLabel") as Label
|
||||
var notification := game.get_node_or_null("HUD/TitleNotificationLabel") as Label
|
||||
var notification_timer := game.get_node_or_null("HUD/TitleNotificationTimer") as Timer
|
||||
assert_not_null(permanent_title)
|
||||
assert_not_null(notification)
|
||||
assert_not_null(notification_timer)
|
||||
if permanent_title == null or notification == null or notification_timer == null:
|
||||
return
|
||||
|
||||
assert_false(notification.visible, "Initialization must not announce the established title")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "Refreshing the same current title stays silent")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([])
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "Losing a title or receiving no title stays silent")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([
|
||||
{"id": "renewed", "name": "Renouveau", "rank": 1, "conditions": []},
|
||||
])
|
||||
game._refresh_title()
|
||||
assert_true(notification.visible, "A real title transition needs a temporary notification")
|
||||
assert_eq(notification.text, "Renouveau")
|
||||
assert_true(notification_timer.time_left > 0.0)
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([])
|
||||
game._refresh_title()
|
||||
assert_false(notification.visible, "A title loss clears an in-flight notification")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
game.title_engine = TitleEngineType.new([
|
||||
{"id": "renewed", "name": "Renouveau", "rank": 1, "conditions": []},
|
||||
])
|
||||
game._refresh_title()
|
||||
assert_true(notification.visible, "Regaining a title is a real transition")
|
||||
await notification_timer.timeout
|
||||
await get_tree().process_frame
|
||||
assert_false(notification.visible, "The actual five-second timer hides the notification")
|
||||
assert_eq(notification.text, "")
|
||||
assert_eq(permanent_title.text, "Étage 0")
|
||||
|
||||
func _dispatch_key(keycode: Key) -> void:
|
||||
Input.parse_input_event(_key_event(keycode, true))
|
||||
await get_tree().process_frame
|
||||
|
||||
@@ -15,5 +15,5 @@ func test_current_game_event_and_hud_remain_available_with_attributes_domain_loa
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
assert_eq(state.enemies[&"goblin"].hit_points, 3)
|
||||
assert_true(game.get_run_state().recent_events(2).any(func(event: GameEvent) -> bool: return event.kind == &"melee"))
|
||||
assert_true(hud.player_health_label.text.contains("PV du joueur :"))
|
||||
assert_eq(hud.player_health_label.text, "PV : %d/%d" % [state.player.hit_points, state.player.max_hit_points])
|
||||
assert_true(hud.event_log.get_parsed_text().contains("Vous frappez le gobelin"))
|
||||
|
||||
@@ -21,9 +21,21 @@ func test_real_actions_build_audience_unlock_sponsor_publish_episode_and_open_pa
|
||||
assert_gte(game.audience_state.spectacle_score(), 1)
|
||||
assert_eq(game.audience_state.followers(), 50)
|
||||
assert_eq(game.audience_state.unlocked_sponsors(), [&"first_sponsor"])
|
||||
var run_state := game.get_run_state()
|
||||
var episode_events := run_state.recent_events(run_state.log.size()).filter(func(event: GameEvent) -> bool: return event.kind == &"episode_published")
|
||||
assert_eq(game.recap_log.episodes().size(), 1)
|
||||
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"sponsor_unlocked"))
|
||||
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"episode_published"))
|
||||
assert_true(run_state.recent_events(run_state.log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"sponsor_unlocked"))
|
||||
assert_eq(episode_events.size(), 1, "RunState must retain the published episode event")
|
||||
var episode := game.recap_log.episodes()[0]
|
||||
assert_eq(int(episode.get("number", 0)), 1)
|
||||
assert_eq(int(episode.get("turn", 0)), run_state.current_turn)
|
||||
assert_gte(int(episode.get("spectacle", 0)), 1)
|
||||
assert_eq(int(episode.get("followers", 0)), 50)
|
||||
assert_eq(episode.get("sponsors", []), [&"first_sponsor"])
|
||||
|
||||
var event_log := game.get_node("HUD/EventLog") as RichTextLabel
|
||||
assert_eq(event_log.get_parsed_text().find("Épisode 1 publié"), -1)
|
||||
assert_eq(event_log.get_parsed_text().find(episode_events[0].message), -1)
|
||||
|
||||
await _dispatch_key(KEY_U)
|
||||
var audience_panel := game.get_node("HUD/AudiencePanel") as PanelContainer
|
||||
|
||||
@@ -14,7 +14,8 @@ func test_configured_input_event_uses_the_same_action_path_as_submit_test_action
|
||||
var input_event := _key_event(KEY_DOWN)
|
||||
game._unhandled_input(input_event)
|
||||
assert_eq(state.player.cell, Vector2i(4, 8))
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "Vous vous déplacez vers (4, 8).")
|
||||
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"moved")
|
||||
assert_eq(game.get_node("HUD/EventLog").get_parsed_text(), "")
|
||||
|
||||
var submitted_game := GameScene.instantiate() as Game
|
||||
add_child_autofree(submitted_game)
|
||||
@@ -46,7 +47,8 @@ func test_real_game_scene_completes_adjacent_bump_combat_and_defeat_route() -> v
|
||||
assert_eq(lethal_melee[0].kind, &"melee")
|
||||
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
||||
assert_false(state.enemies.has(&"goblin"))
|
||||
assert_eq(hud.combat_summary, "Aucune cible active")
|
||||
assert_eq(hud.combat_summary, "")
|
||||
assert_false((hud.get_node("EnemyHealthLabel") as Label).visible)
|
||||
|
||||
func _key_event(keycode: Key) -> InputEventKey:
|
||||
var event := InputEventKey.new()
|
||||
|
||||
@@ -30,10 +30,26 @@ func test_real_character_input_opens_panel_and_allocates_level_up_points_without
|
||||
assert_eq(xp_bar.max_value, 200.0)
|
||||
assert_eq(xp_label.text, "Niveau 2 — XP 0/200")
|
||||
|
||||
await _dispatch_key(KEY_P)
|
||||
var panel := game.get_node("HUD/CharacterPanel") as PanelContainer
|
||||
assert_true(panel.visible)
|
||||
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Level 2")
|
||||
game.get_run_state().player_name = "Dame Ysabel"
|
||||
await _dispatch_key(KEY_P)
|
||||
assert_false(panel.visible, "P must no longer open the character sheet")
|
||||
await _dispatch_key(KEY_C)
|
||||
assert_true(panel.visible, "The physical C key opens the character sheet")
|
||||
var sheet_text := (panel.get_node("Body") as RichTextLabel).get_parsed_text()
|
||||
assert_string_contains(sheet_text, "Nom : Dame Ysabel")
|
||||
assert_string_contains(sheet_text, "Titre : Bleu du Donjon")
|
||||
assert_string_contains(sheet_text, "Vous n'avez encore rien prouve.")
|
||||
assert_string_contains(sheet_text, "Niveau 2")
|
||||
assert_string_contains(sheet_text, "XP")
|
||||
assert_string_contains(sheet_text, "Points d’attribut")
|
||||
assert_string_contains(sheet_text, "Points de compétence")
|
||||
for attribute_name: String in ["Force", "Agilité", "Endurance", "Perception", "Intelligence", "Volonté", "Charisme", "Chance"]:
|
||||
assert_string_contains(sheet_text, attribute_name, "The sheet must list %s" % attribute_name)
|
||||
for skill_name: String in ["Compétences principales", "Corps à corps", "Distance", "Esquive"]:
|
||||
assert_string_contains(sheet_text, skill_name, "The sheet must list %s" % skill_name)
|
||||
assert_string_contains(sheet_text, "A / S")
|
||||
assert_string_contains(sheet_text, "Échap")
|
||||
await _dispatch_key(KEY_A)
|
||||
assert_eq(state.player.progression.attribute_points, 0)
|
||||
assert_eq(game.get_dialogue_player().attributes.get_attribute(&"str_"), 5)
|
||||
|
||||
@@ -13,18 +13,14 @@ func test_real_input_event_records_one_action_turn_and_hud_renders_its_run_state
|
||||
var run := game.get_run_state()
|
||||
var events := run.recent_events(2)
|
||||
var event_log := game.get_node("HUD/EventLog") as RichTextLabel
|
||||
var expected_hud_text := "Vous vous déplacez vers (3, 7).\nLe gobelin se déplace.\n"
|
||||
|
||||
# One input resolves movement plus an enemy response. They are one player action,
|
||||
# so their journal events share action turn 1 and are present exactly once.
|
||||
# so their RunState events share action turn 1 and are present exactly once.
|
||||
assert_eq(events.size(), 2)
|
||||
assert_eq(events.map(func(event: GameEvent) -> StringName: return event.kind), [&"moved", &"enemy_moved"])
|
||||
assert_eq(events.map(func(event: GameEvent) -> int: return event.turn), [1, 1])
|
||||
assert_eq(run.current_turn, 1)
|
||||
assert_eq(event_log.get_parsed_text(), expected_hud_text)
|
||||
assert_string_contains(event_log.get_parsed_text(), "Vous vous déplacez vers (3, 7).")
|
||||
assert_string_contains(event_log.get_parsed_text(), "Le gobelin se déplace.")
|
||||
assert_eq(event_log.get_parsed_text().find(events[1].message), -1)
|
||||
# The HUD filters movement-only batches without mutating the RunState journal.
|
||||
assert_eq(event_log.get_parsed_text(), "")
|
||||
|
||||
func _key_event(keycode: Key) -> InputEventKey:
|
||||
var event := InputEventKey.new()
|
||||
|
||||
@@ -20,7 +20,7 @@ func test_real_merchant_interaction_opens_shop_and_purchase_updates_inventory_an
|
||||
game.get_run_state().gold = 100
|
||||
var no_events: Array[GameEvent] = []
|
||||
game.get_node("HUD").refresh(state, no_events, game.get_run_state())
|
||||
assert_eq((game.get_node("HUD/GoldLabel") as Label).text, "Or : 100")
|
||||
assert_eq((game.get_node("HUD/GoldLabel") as Label).text, "100")
|
||||
|
||||
await _dispatch_key(KEY_E)
|
||||
var dialogue_entries := game.get_node("HUD/DialoguePanel/Layout/Entries") as RichTextLabel
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd")
|
||||
|
||||
func test_capture_preparation_refreshes_the_real_name_and_started_journal() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
game.configure_new_run(RunSettingsType.new("visual-check", &"crawler", false, false), "Visual Check")
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
var character_title := game.get_node_or_null("HUD/ResponsiveLayout/CharacterSectionTitle") as Label
|
||||
var event_log := game.get_node_or_null("HUD/EventLog") as RichTextLabel
|
||||
assert_not_null(hud)
|
||||
assert_not_null(character_title)
|
||||
assert_not_null(event_log)
|
||||
if hud == null or character_title == null or event_log == null:
|
||||
return
|
||||
assert_eq(character_title.text, "Visual Check")
|
||||
assert_eq(event_log.get_parsed_text(), "", "Startup initially refreshes before game_started is appended")
|
||||
|
||||
game._refresh_capture_hud()
|
||||
assert_eq(character_title.text, "Visual Check")
|
||||
assert_string_contains(event_log.get_parsed_text(), "Visual Check commence une nouvelle aventure.")
|
||||
@@ -0,0 +1 @@
|
||||
uid://d00r2dqs4yi56
|
||||
@@ -30,6 +30,16 @@ func test_f_starts_ranged_targeting_and_ctrl_s_or_v_requests_a_manual_save() ->
|
||||
assert_eq(router.action_from_input(_action_event(&"ranged")).kind, &"ranged")
|
||||
assert_eq(router.action_from_input(_action_event(&"save")).kind, &"save")
|
||||
|
||||
func test_character_opens_with_physical_c_while_p_is_free_and_southeast_uses_keypad_3() -> void:
|
||||
var character_c := _key_event(KEY_C)
|
||||
var legacy_character_p := _key_event(KEY_P)
|
||||
var southeast_keypad_3 := _key_event(KEY_KP_3)
|
||||
|
||||
assert_true(InputMap.action_has_event(&"character", character_c), "C is the physical character-sheet binding")
|
||||
assert_false(InputMap.action_has_event(&"character", legacy_character_p), "P must no longer open the character sheet")
|
||||
assert_true(InputMap.action_has_event(&"move_southeast", southeast_keypad_3), "South-east is bound to keypad 3")
|
||||
assert_false(InputMap.action_has_event(&"move_southeast", character_c), "C must no longer move south-east")
|
||||
|
||||
func test_action_from_input_maps_the_complete_command_vocabulary() -> void:
|
||||
var router := ActionRouter.new(null)
|
||||
var expected := {
|
||||
|
||||
@@ -19,10 +19,13 @@ func test_combat_routes_damage_feedback_and_exposes_current_target_summary() ->
|
||||
var enemy_view := game.get_node("World/Enemies/Goblin") as ActorView
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
|
||||
assert_string_contains(hud.combat_summary, "Gobelin")
|
||||
assert_string_contains(hud.combat_summary, "PV")
|
||||
assert_eq(hud.combat_summary.find("Target"), -1)
|
||||
assert_eq(hud.combat_summary.find("HP"), -1)
|
||||
assert_eq(hud.combat_summary, "Gobelin — PV : 6/6")
|
||||
assert_true((hud.get_node("EnemyHealthLabel") as Label).visible)
|
||||
assert_eq((hud.get_node("EnemyHealthLabel") as Label).text, "Gobelin — PV : 6/6")
|
||||
for label_name: String in ["CharacterStatusLabel", "SpellLabel", "CombatSummaryLabel", "DeadlineLabel"]:
|
||||
var label := hud.get_node(label_name) as Label
|
||||
assert_false(label.visible, "%s must stay hidden while only the target is actionable" % label_name)
|
||||
assert_eq(label.text, "")
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
await _wait_for_feedback()
|
||||
assert_eq(player_view.last_damage, 2)
|
||||
@@ -36,9 +39,10 @@ func test_combat_routes_damage_feedback_and_exposes_current_target_summary() ->
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
await _wait_for_feedback()
|
||||
assert_false(is_instance_valid(enemy_view))
|
||||
assert_eq(hud.combat_summary, "Aucune cible active")
|
||||
assert_eq(hud.get_node("EnemyHealthLabel").text, "Aucune cible active")
|
||||
assert_eq(_visible_text_occurrences(hud, "Aucune cible active"), 1, "The no-target state must have one visible string, never a duplicate")
|
||||
assert_eq(hud.combat_summary, "")
|
||||
assert_eq((hud.get_node("EnemyHealthLabel") as Label).text, "")
|
||||
assert_false((hud.get_node("EnemyHealthLabel") as Label).visible)
|
||||
assert_eq(_visible_text_occurrences(hud, "Aucune cible active"), 0, "The no-target state must never expose a no-target placeholder")
|
||||
assert_eq(_visible_text_occurrences(hud, "No active target"), 0, "The no-target state must never expose the English fallback")
|
||||
assert_string_contains(hud.event_log.get_parsed_text(), "Vous frappez le gobelin avec mains nues")
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ func test_hud_replaces_its_log_with_the_supplied_journal_events() -> void:
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
var state := game.get_game_state()
|
||||
|
||||
hud.refresh(state, [GameEvent.new(1, 0, &"moved", {}, "obsolete transient message")])
|
||||
hud.refresh(state, [GameEvent.new(2, 0, &"blocked", {}, "authoritative journal message")])
|
||||
hud.refresh(state, [
|
||||
GameEvent.new(1, 0, &"moved", {}, "obsolete transient message"),
|
||||
GameEvent.new(2, 0, &"blocked", {}, "authoritative journal message"),
|
||||
])
|
||||
|
||||
assert_eq(hud.event_log.get_parsed_text(), "Votre chemin est bloqué.\n")
|
||||
|
||||
@@ -27,7 +27,8 @@ func test_hud_localizes_current_structured_journal_events_without_using_the_engl
|
||||
GameEvent.new(14, 0, &"companion_intercepted", {}, "Your companion intercepts the attack.", &"goblin", &"companion"),
|
||||
GameEvent.new(15, 0, &"companion_died", {}, "Your companion falls, but your run continues.", &"companion", &"player"),
|
||||
GameEvent.new(16, 0, &"companion_moved", {}, "Your companion follows.", &"companion", &"player"),
|
||||
GameEvent.new(17, 0, &"episode_published", {"number": 7}, "Episode 7 published."),
|
||||
GameEvent.new(17, 0, &"party_moved", {}, "The party moves.", &"player"),
|
||||
GameEvent.new(18, 0, &"episode_published", {"number": 7}, "Episode 7 published."),
|
||||
]
|
||||
|
||||
hud.refresh(state, events, game.get_run_state())
|
||||
@@ -35,8 +36,6 @@ func test_hud_localizes_current_structured_journal_events_without_using_the_engl
|
||||
var journal_text := hud.event_log.get_parsed_text()
|
||||
for expected: String in [
|
||||
"Ariane commence une nouvelle aventure.",
|
||||
"Vous vous déplacez vers (6, 8).",
|
||||
"Le gobelin se déplace.",
|
||||
"Votre chemin est bloqué.",
|
||||
"Vous frappez le gobelin avec épée courte et lui infligez 3 dégâts.",
|
||||
"Le gobelin vous frappe avec griffes et vous inflige 2 dégâts.",
|
||||
@@ -49,15 +48,37 @@ func test_hud_localizes_current_structured_journal_events_without_using_the_engl
|
||||
"Butin — au sol : Bandage x2, Couteau de chasse x1 ; or récupéré : 12.",
|
||||
"Votre familier intercepte l’attaque du gobelin.",
|
||||
"Votre familier tombe, mais votre aventure continue.",
|
||||
"Votre familier vous suit.",
|
||||
"Épisode 7 publié.",
|
||||
]:
|
||||
assert_string_contains(journal_text, expected)
|
||||
for english_source: String in ["Ariane begins a new run.", "You move to (6, 8).", "The goblin moves.", "Your way is blocked.", "You strike the goblin with a short sword for 3.", "The goblin hits you with claws for 2.", "The goblin is defeated.", "You attack.", "You hit.", "You deal 3 damage.", "You gain experience.", "Loot dropped.", "Your companion intercepts the attack.", "Your companion falls, but your run continues.", "Your companion follows.", "Episode 7 published."]:
|
||||
for hidden_event: String in ["You move to (6, 8).", "The goblin moves.", "Your companion follows.", "The party moves.", "Vous vous déplacez vers (6, 8).", "Le gobelin se déplace.", "Votre familier vous suit.", "Épisode 7 publié.", "Episode 7 published."]:
|
||||
assert_eq(journal_text.find(hidden_event), -1, "GameHud must omit movement and episode publication events from the journal even when they provide source messages")
|
||||
for english_source: String in ["Ariane begins a new run.", "Your way is blocked.", "You strike the goblin with a short sword for 3.", "The goblin hits you with claws for 2.", "The goblin is defeated.", "You attack.", "You hit.", "You deal 3 damage.", "You gain experience.", "Loot dropped.", "Your companion intercepts the attack.", "Your companion falls, but your run continues."]:
|
||||
assert_eq(journal_text.find(english_source), -1, "GameHud must localize %s from structured event data, not reuse its source message" % english_source)
|
||||
for technical_id: String in ["consumable_bandage", "weapon_hunting_knife"]:
|
||||
assert_eq(journal_text.find(technical_id), -1, "GameHud must resolve %s through the content catalog" % technical_id)
|
||||
|
||||
|
||||
func test_hud_hides_movement_and_episode_publication_in_a_mixed_batch() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
var state := game.get_game_state()
|
||||
var events: Array[GameEvent] = [
|
||||
GameEvent.new(1, 0, &"moved", {"to_cell": Vector2i(5, 7)}, "You move.", &"player"),
|
||||
GameEvent.new(1, 0, &"enemy_moved", {}, "The goblin moves.", &"goblin", &"player"),
|
||||
GameEvent.new(1, 0, &"companion_moved", {}, "Your companion follows.", &"companion", &"player"),
|
||||
GameEvent.new(1, 0, &"party_moved", {}, "The party moves.", &"player"),
|
||||
GameEvent.new(1, 0, &"episode_published", {"number": 1}, "Episode 1 published."),
|
||||
GameEvent.new(1, 0, &"blocked", {}, "Your way is blocked.", &"player"),
|
||||
GameEvent.new(1, 0, &"loot_dropped", {"items": [], "gold": 4}, "Loot dropped.", &"goblin", &"player"),
|
||||
GameEvent.new(1, 0, &"melee", {"damage": 3, "attack_method": "épée courte"}, "You strike.", &"player", &"goblin"),
|
||||
]
|
||||
|
||||
hud.refresh(state, events, game.get_run_state())
|
||||
|
||||
assert_eq(hud.event_log.get_parsed_text(), "Votre chemin est bloqué.\nOr récupéré : 4.\nVous frappez le gobelin avec épée courte et lui infligez 3 dégâts.\n")
|
||||
|
||||
func test_hud_distinguishes_dropped_enemy_items_from_immediately_collected_gold() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
add_child_autofree(game)
|
||||
@@ -107,11 +128,9 @@ func test_hud_localizes_generated_enemy_ids_from_live_state_and_catalog_after_re
|
||||
var generated_id := &"enemy_scavenger_07"
|
||||
state.enemies[generated_id] = ActorState.new(generated_id, Vector2i(5, 8), 22, 5, &"enemy_scavenger")
|
||||
|
||||
# Movement events are deliberately not journal entries, including generated enemies.
|
||||
hud.refresh(state, [GameEvent.new(1, 0, &"enemy_moved", {}, "The scavenger moves.", generated_id, &"player")], game.get_run_state())
|
||||
var live_text := hud.event_log.get_parsed_text()
|
||||
assert_string_contains(live_text, "Le pillard efflanque se déplace.")
|
||||
assert_eq(live_text.find("enemy_scavenger_07"), -1)
|
||||
assert_eq(live_text.find("_"), -1)
|
||||
assert_eq(hud.event_log.get_parsed_text(), "")
|
||||
|
||||
state.enemies.erase(generated_id)
|
||||
hud.refresh(state, [GameEvent.new(2, 0, &"enemy_melee", {"damage": 2, "attack_method": "griffes"}, "The scavenger hits you.", generated_id, &"player")], game.get_run_state())
|
||||
@@ -182,7 +201,7 @@ func test_hud_uses_french_spacing_for_focus_and_gold_labels() -> void:
|
||||
game.get_run_state().gold = 42
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
assert_eq(hud.player_focus_label.text, "Focus : %d/%d" % [state.player.focus, state.player.max_focus])
|
||||
assert_eq(hud.gold_label.text, "Or : 42")
|
||||
assert_eq(hud.gold_label.text, "42")
|
||||
|
||||
func test_hud_keeps_the_domain_message_for_unknown_journal_event_kinds() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
|
||||
+318
-85
@@ -1,6 +1,7 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
const StatusEffectType = preload("res://scripts/domain/combat/status_effect.gd")
|
||||
const HEADER_VALUES_GROUP := &"hud_header_values"
|
||||
const CHARACTER_VALUES_GROUP := &"hud_character_values"
|
||||
const COMMAND_HINTS_GROUP := &"hud_command_hints"
|
||||
@@ -81,6 +82,8 @@ func test_hud_preserves_legacy_responsive_panel_paths() -> void:
|
||||
return
|
||||
assert_true(stats_panel.get_global_rect().encloses(player_health.get_global_rect()))
|
||||
assert_true(log_panel.get_global_rect().encloses(event_log.get_global_rect()))
|
||||
_assert_legacy_panel_is_transparent_and_behind(stats_panel)
|
||||
_assert_legacy_panel_is_transparent_and_behind(log_panel)
|
||||
assert_true(prompt_panel.get_global_rect().encloses(prompt.get_global_rect()))
|
||||
assert_true(help_panel.get_global_rect().encloses(help.get_global_rect()))
|
||||
|
||||
@@ -157,7 +160,7 @@ func test_live_hud_content_is_enclosed_by_its_intended_shell_region() -> void:
|
||||
_assert_controls_enclosed(right_rail, [hud.get_node_or_null("EventLog") as Control], "RightRail")
|
||||
_assert_controls_enclosed(command_bar, _controls_in_group(hud, COMMAND_HINTS_GROUP), "CommandBar")
|
||||
|
||||
func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
func test_dynamic_hud_groups_refresh_live_character_and_command_values_without_a_redundant_header() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
@@ -166,13 +169,13 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
if layout == null:
|
||||
return
|
||||
var top_bar := layout.get_node_or_null("TopBar") as Control
|
||||
var left_rail := layout.get_node_or_null("LeftRail") as Control
|
||||
var command_bar := layout.get_node_or_null("CommandBar") as Control
|
||||
assert_not_null(top_bar, "ResponsiveLayout requires a TopBar")
|
||||
assert_not_null(left_rail, "ResponsiveLayout requires a LeftRail")
|
||||
assert_not_null(command_bar, "ResponsiveLayout requires a CommandBar")
|
||||
if top_bar == null or left_rail == null or command_bar == null:
|
||||
var header_values := hud.get_node_or_null("HeaderValuesLabel") as Label
|
||||
assert_not_null(left_rail)
|
||||
assert_not_null(command_bar)
|
||||
assert_not_null(header_values, "Legacy HeaderValuesLabel remains an explicitly hidden empty compatibility control")
|
||||
if left_rail == null or command_bar == null or header_values == null:
|
||||
return
|
||||
|
||||
var state := game.get_game_state()
|
||||
@@ -182,29 +185,15 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
state.player.cell = state.floor_state.entrance
|
||||
hud.refresh(state, [], run)
|
||||
|
||||
var header_values := _labels_in_group(hud, HEADER_VALUES_GROUP)
|
||||
var character_values := _labels_in_group(hud, CHARACTER_VALUES_GROUP)
|
||||
var command_hints := _labels_in_group(hud, COMMAND_HINTS_GROUP)
|
||||
assert_gte(header_values.size(), 1, "TopBar exposes dynamic header values through the hud_header_values group")
|
||||
assert_gte(character_values.size(), 1, "LeftRail exposes dynamic character values through the hud_character_values group")
|
||||
assert_gte(command_hints.size(), 1, "CommandBar exposes dynamic hints through the hud_command_hints group")
|
||||
if header_values.is_empty() or character_values.is_empty() or command_hints.is_empty():
|
||||
assert_false(header_values.visible, "HeaderValuesLabel must not duplicate top-bar information")
|
||||
assert_eq(header_values.text, "", "HeaderValuesLabel must be empty when hidden")
|
||||
if character_values.is_empty() or command_hints.is_empty():
|
||||
return
|
||||
|
||||
var header_text := _combined_label_text(header_values)
|
||||
var character_text := _combined_label_text(character_values)
|
||||
var expected_room_id := ""
|
||||
for room: RoomState in state.floor_state.rooms:
|
||||
if room.bounds.has_point(state.player.cell):
|
||||
expected_room_id = String(room.id)
|
||||
break
|
||||
assert_ne(expected_room_id, "", "The player's authored room must be discoverable from its bounds")
|
||||
assert_string_contains(header_text, run.player_name)
|
||||
assert_string_contains(header_text, str(state.floor_state.floor_number))
|
||||
assert_string_contains(header_text, expected_room_id)
|
||||
assert_string_contains(header_text, str(state.explored_cells.size()))
|
||||
assert_string_contains(character_text, str(state.player.hit_points))
|
||||
_assert_controls_enclosed(top_bar, header_values, "TopBar")
|
||||
assert_string_contains(_combined_label_text(character_values), str(state.player.hit_points))
|
||||
_assert_controls_enclosed(left_rail, character_values, "LeftRail")
|
||||
|
||||
state.player.cell = Vector2i(35, 7)
|
||||
@@ -213,23 +202,19 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
assert_string_contains(_combined_label_text(command_hints), "Ouvrir la porte")
|
||||
_assert_controls_enclosed(command_bar, command_hints, "CommandBar")
|
||||
|
||||
func test_compact_1280_layout_scales_header_text_and_keeps_it_inside_the_top_bar() -> void:
|
||||
func test_compact_1280_layout_keeps_the_hidden_legacy_header_out_of_the_top_bar_content() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
|
||||
hud.apply_viewport_layout(Vector2(1280, 720))
|
||||
var top_bar := hud.get_node_or_null("ResponsiveLayout/TopBar") as Control
|
||||
var header := hud.get_node_or_null("HeaderValuesLabel") as Label
|
||||
assert_not_null(top_bar, "ResponsiveLayout requires a TopBar")
|
||||
assert_not_null(header, "HUD requires HeaderValuesLabel")
|
||||
if top_bar == null or header == null:
|
||||
assert_not_null(header, "HUD retains HeaderValuesLabel as a compatibility node")
|
||||
if header == null:
|
||||
return
|
||||
|
||||
assert_eq(header.get_theme_font_size(&"font_size"), 11, "The compact shell scales the 16px header value font to the 1280x720 artboard")
|
||||
assert_true(top_bar.get_global_rect().encloses(header.get_global_rect()), "The compact header remains inside its TopBar")
|
||||
assert_lte(header.get_minimum_size().y, header.size.y, "The compact header has enough height for its scaled text")
|
||||
assert_false(header.visible, "The compact TopBar must not revive the removed header values")
|
||||
assert_eq(header.text, "")
|
||||
|
||||
func test_compact_1280_layout_contains_live_hud_regions_without_covering_the_play_area() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -316,9 +301,19 @@ func test_compact_1280_layout_contains_live_hud_regions_without_covering_the_pla
|
||||
if label != null:
|
||||
assert_gte(label.get_theme_font_size(&"font_size"), 9, "%s must keep a readable compact font" % label.name)
|
||||
var journal := hud.get_node_or_null("EventLog") as RichTextLabel
|
||||
var journal_title := layout.get_node_or_null("JournalSectionTitle") as Label
|
||||
var character_title := layout.get_node_or_null("CharacterSectionTitle") as Label
|
||||
assert_not_null(journal)
|
||||
assert_not_null(journal_title)
|
||||
assert_not_null(character_title)
|
||||
if journal != null:
|
||||
assert_gte(journal.get_theme_font_size(&"normal_font_size"), 9, "The compact journal font must remain readable")
|
||||
var journal_font_size := journal.get_theme_font_size(&"normal_font_size")
|
||||
assert_gte(journal_font_size, 12, "The compact journal must retain a 12px normal font")
|
||||
assert_gte(journal.size.y / journal_font_size, 12.0, "The compact journal must retain at least twelve lines of visible space")
|
||||
if journal_title != null:
|
||||
assert_gte(journal_title.get_theme_font_size(&"font_size"), 14, "The compact journal title must remain readable")
|
||||
if character_title != null:
|
||||
assert_gte(character_title.get_theme_font_size(&"font_size"), 14, "The compact character title must remain readable")
|
||||
|
||||
func test_non_sixteen_by_nine_viewports_center_the_artboard_and_mask_every_outside_band() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -371,27 +366,169 @@ func test_non_sixteen_by_nine_viewports_center_the_artboard_and_mask_every_outsi
|
||||
assert_eq(top.size.y, 0.0)
|
||||
assert_eq(bottom.size.y, 0.0)
|
||||
|
||||
func test_long_deadline_text_wraps_and_stays_inside_the_left_rail() -> void:
|
||||
func test_status_section_only_shows_actionable_information_without_a_floor_zero_placeholder() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var state := game.get_game_state()
|
||||
var run := game.get_run_state()
|
||||
run.current_floor = 1
|
||||
run.ensure_floor_deadline(1)
|
||||
state.enemies.clear()
|
||||
run.current_floor = 0
|
||||
hud.refresh(state, [], run)
|
||||
await get_tree().process_frame
|
||||
var status := hud.get_node_or_null("ResponsiveLayout/StatusSection") as Control
|
||||
var status_title := hud.get_node_or_null("ResponsiveLayout/StatusSectionTitle") as Label
|
||||
assert_not_null(status)
|
||||
assert_not_null(status_title)
|
||||
if status_title != null:
|
||||
assert_true(status_title.visible)
|
||||
assert_eq(status_title.text, "ÉTAT")
|
||||
for label_name: String in ["CharacterStatusLabel", "EnemyHealthLabel", "CombatSummaryLabel", "SpellLabel", "DeadlineLabel"]:
|
||||
var label := hud.get_node_or_null(label_name) as Label
|
||||
assert_not_null(label, "HUD requires %s" % label_name)
|
||||
if label != null:
|
||||
assert_eq(label.text, "", "%s must be cleared in the neutral state" % label_name)
|
||||
assert_false(label.visible, "%s must be hidden in the neutral state" % label_name)
|
||||
assert_eq(hud.combat_summary, "")
|
||||
assert_eq(_visible_text_occurrences(hud, "Aucune cible active"), 0)
|
||||
assert_eq(_visible_text_occurrences(hud, "prêt à explorer"), 0)
|
||||
|
||||
var left_rail := hud.get_node_or_null("ResponsiveLayout/LeftRail") as Control
|
||||
var deadline := hud.get_node_or_null("DeadlineLabel") as Label
|
||||
assert_not_null(left_rail, "ResponsiveLayout requires a LeftRail")
|
||||
assert_not_null(deadline, "HUD requires DeadlineLabel")
|
||||
if left_rail == null or deadline == null:
|
||||
func test_status_section_formats_active_player_effects_in_french() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
assert_true(left_rail.get_global_rect().encloses(deadline.get_global_rect()))
|
||||
assert_lte(deadline.get_minimum_size().x, deadline.size.x)
|
||||
assert_gt(deadline.size.y, deadline.get_line_height())
|
||||
var state := game.get_game_state()
|
||||
state.enemies.clear()
|
||||
state.player.apply_status(StatusEffectType.new(&"poison", 3))
|
||||
state.player.apply_status(StatusEffectType.new(&"strengthened", 2))
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
var effects := hud.get_node_or_null("CharacterStatusLabel") as Label
|
||||
assert_not_null(effects)
|
||||
if effects == null:
|
||||
return
|
||||
assert_true(effects.visible)
|
||||
assert_eq(effects.text, "Effets : Empoisonnement (3 tours), Renforcé (2 tours)")
|
||||
assert_eq(effects.text.findn("prêt à explorer"), -1)
|
||||
|
||||
func test_generated_visible_target_uses_catalog_name_and_never_reveals_hidden_enemies() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var state := game.get_game_state()
|
||||
state.enemies.clear()
|
||||
state.visible_cells.clear()
|
||||
var nearest_visible := ActorState.new(&"enemy_scavenger_07", state.player.cell + Vector2i.RIGHT, 22, 5, &"enemy_scavenger")
|
||||
var farther_visible := ActorState.new(&"enemy_scavenger_08", state.player.cell + Vector2i(3, 0), 22, 5, &"enemy_scavenger")
|
||||
farther_visible.take_damage(5)
|
||||
var nearer_hidden := ActorState.new(&"enemy_scavenger_hidden", state.player.cell + Vector2i.DOWN, 22, 5, &"enemy_scavenger")
|
||||
state.enemies[nearest_visible.id] = nearest_visible
|
||||
state.enemies[farther_visible.id] = farther_visible
|
||||
state.enemies[nearer_hidden.id] = nearer_hidden
|
||||
state.visible_cells[nearest_visible.cell] = true
|
||||
state.visible_cells[farther_visible.cell] = true
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
var target_label := hud.get_node_or_null("EnemyHealthLabel") as Label
|
||||
assert_not_null(target_label)
|
||||
if target_label == null:
|
||||
return
|
||||
assert_true(target_label.visible)
|
||||
assert_eq(target_label.text, "Pillard efflanque — PV : 22/22")
|
||||
assert_eq(target_label.text.find("enemy_scavenger_07"), -1, "HUD must never expose a technical actor id")
|
||||
|
||||
state.visible_cells.erase(nearest_visible.cell)
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
assert_true(target_label.visible)
|
||||
assert_eq(target_label.text, "Pillard efflanque — PV : 17/22", "The next nearest visible living target must be selected")
|
||||
|
||||
farther_visible.take_damage(farther_visible.hit_points)
|
||||
hud.refresh(state, [], game.get_run_state())
|
||||
assert_false(target_label.visible, "A living enemy outside FOV must not be revealed")
|
||||
assert_eq(target_label.text, "")
|
||||
assert_eq(hud.combat_summary, "")
|
||||
|
||||
func test_visible_status_labels_are_contained_separated_and_non_overlapping_at_reference_and_compact_sizes() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var state := game.get_game_state()
|
||||
var run := game.get_run_state()
|
||||
state.enemies.clear()
|
||||
state.visible_cells.clear()
|
||||
var target := ActorState.new(&"enemy_scavenger_07", state.player.cell + Vector2i.RIGHT, 22, 5, &"enemy_scavenger")
|
||||
state.enemies[target.id] = target
|
||||
state.visible_cells[target.cell] = true
|
||||
for effect_key: StringName in StatusEffectType.DEFINITIONS.keys():
|
||||
state.player.apply_status(StatusEffectType.new(effect_key))
|
||||
run.current_floor = 1
|
||||
run.ensure_floor_deadline(1).turns_remaining = 15 * FloorDeadline.TURNS_PER_DAY
|
||||
for viewport_size: Vector2 in [Vector2(1920, 1080), Vector2(1280, 720)]:
|
||||
hud.apply_viewport_layout(viewport_size)
|
||||
hud.refresh(state, [], run)
|
||||
await get_tree().process_frame
|
||||
var status := hud.get_node_or_null("ResponsiveLayout/StatusSection") as Control
|
||||
var effects := hud.get_node_or_null("CharacterStatusLabel") as Label
|
||||
var target_label := hud.get_node_or_null("EnemyHealthLabel") as Label
|
||||
var deadline := hud.get_node_or_null("DeadlineLabel") as Label
|
||||
assert_not_null(status)
|
||||
assert_not_null(effects)
|
||||
assert_not_null(target_label)
|
||||
assert_not_null(deadline)
|
||||
if status == null or effects == null or target_label == null or deadline == null:
|
||||
continue
|
||||
assert_true(effects.visible)
|
||||
assert_true(target_label.visible)
|
||||
assert_true(deadline.visible)
|
||||
assert_string_contains(effects.text, "Empoisonnement")
|
||||
assert_string_contains(effects.text, "Régénération")
|
||||
for effect: StatusEffect in state.player.status_effects:
|
||||
assert_string_contains(effects.text, str(effect.duration), "Every active effect duration must remain represented")
|
||||
assert_lte(effects.get_minimum_size().x, effects.size.x, "Effects text must fit its assigned width at %s" % viewport_size)
|
||||
assert_lte(effects.get_minimum_size().y, effects.size.y, "Effects text must fit its assigned height at %s" % viewport_size)
|
||||
var visible_labels := _visible_status_labels(hud)
|
||||
assert_eq(visible_labels.size(), 3, "The configured state must expose exactly effects, target, and deadline")
|
||||
for label: Label in visible_labels:
|
||||
assert_true(status.get_global_rect().encloses(label.get_global_rect()), "%s must stay inside StatusSection at %s" % [label.name, viewport_size])
|
||||
for index in visible_labels.size():
|
||||
for other_index in range(index + 1, visible_labels.size()):
|
||||
var first := visible_labels[index].get_global_rect()
|
||||
var second := visible_labels[other_index].get_global_rect()
|
||||
assert_false(first.intersects(second), "%s must not overlap %s at %s" % [visible_labels[index].name, visible_labels[other_index].name, viewport_size])
|
||||
var upper := first if first.position.y <= second.position.y else second
|
||||
var lower := second if upper == first else first
|
||||
assert_gte(lower.position.y - upper.end.y, 12.0, "Visible status labels need at least 12px vertical separation at %s" % viewport_size)
|
||||
|
||||
func test_deadline_label_is_hidden_on_floor_zero_and_uses_only_the_live_collapse_countdown_afterward() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var state := game.get_game_state()
|
||||
var run := game.get_run_state()
|
||||
var deadline := hud.get_node_or_null("DeadlineLabel") as Label
|
||||
assert_not_null(deadline, "HUD requires DeadlineLabel")
|
||||
if deadline == null:
|
||||
return
|
||||
|
||||
run.current_floor = 0
|
||||
hud.refresh(state, [], run)
|
||||
assert_eq(deadline.text, "", "Floor zero has no collapse deadline")
|
||||
assert_false(deadline.visible, "Floor zero must not show an empty deadline slot")
|
||||
|
||||
run.current_floor = 1
|
||||
var floor_deadline := run.ensure_floor_deadline(1)
|
||||
floor_deadline.turns_remaining = 15 * floor_deadline.TURNS_PER_DAY
|
||||
hud.refresh(state, [], run)
|
||||
assert_true(deadline.visible)
|
||||
assert_eq(deadline.text, "Effondrement du niveau dans 15 jours")
|
||||
assert_eq(deadline.text.findn("escalier"), -1, "DeadlineLabel must not mention stairs")
|
||||
assert_eq(deadline.text.findn("Étage"), -1, "DeadlineLabel must not repeat the floor")
|
||||
|
||||
floor_deadline.rest()
|
||||
hud.refresh(state, [], run)
|
||||
assert_eq(deadline.text, "Effondrement du niveau dans 14 jours", "The displayed count must follow the live deadline")
|
||||
|
||||
func test_event_log_and_log_panel_never_intersect_the_hud_minimap_at_reference_and_compact_sizes() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -465,6 +602,13 @@ func test_named_left_and_right_rail_sections_are_visible_enclosed_and_non_overla
|
||||
_assert_named_non_overlapping_sections(layout, "LeftRail", ["CharacterSection", "ObjectivesSection", "StatusSection"])
|
||||
_assert_named_non_overlapping_sections(layout, "RightRail", ["JournalSection", "MapSection"])
|
||||
|
||||
func _assert_legacy_panel_is_transparent_and_behind(panel: PanelContainer) -> void:
|
||||
assert_true(panel.has_theme_stylebox_override(&"panel"), "%s requires an explicit local panel style rather than an inherited theme style" % panel.name)
|
||||
var style := panel.get_theme_stylebox(&"panel")
|
||||
assert_not_null(style, "%s requires an explicit local transparent panel style" % panel.name)
|
||||
assert_true(style is StyleBoxEmpty or (style is StyleBoxFlat and (style as StyleBoxFlat).bg_color.a == 0.0), "%s must not repaint over section headings" % panel.name)
|
||||
assert_true(panel.show_behind_parent, "%s must draw behind its parent and section titles" % panel.name)
|
||||
|
||||
func _assert_named_non_overlapping_sections(layout: Control, rail_name: String, section_names: Array[String]) -> void:
|
||||
var rail := layout.get_node_or_null(rail_name) as Control
|
||||
assert_not_null(rail, "ResponsiveLayout requires %s" % rail_name)
|
||||
@@ -483,20 +627,21 @@ func _assert_named_non_overlapping_sections(layout: Control, rail_name: String,
|
||||
for other_index in range(index + 1, sections.size()):
|
||||
assert_false(sections[index].get_global_rect().intersects(sections[other_index].get_global_rect()), "%s must not overlap %s" % [sections[index].name, sections[other_index].name])
|
||||
|
||||
func test_character_section_exposes_live_name_and_level_labels() -> void:
|
||||
func test_character_section_title_shows_the_real_run_name_without_a_redundant_name_label() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var character_section := layout.get_node_or_null("CharacterSection") as Control if layout != null else null
|
||||
var section_title := layout.get_node_or_null("CharacterSectionTitle") as Label if layout != null else null
|
||||
var name_label := layout.get_node_or_null("CharacterNameLabel") as Label if layout != null else null
|
||||
var level_label := layout.get_node_or_null("CharacterLevelLabel") as Label if layout != null else null
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
assert_not_null(character_section, "ResponsiveLayout requires CharacterSection")
|
||||
assert_not_null(name_label, "CharacterSection requires CharacterNameLabel")
|
||||
assert_not_null(section_title, "CharacterSection requires CharacterSectionTitle")
|
||||
assert_not_null(level_label, "CharacterSection requires CharacterLevelLabel")
|
||||
if layout == null or character_section == null or name_label == null or level_label == null:
|
||||
if layout == null or character_section == null or section_title == null or level_label == null:
|
||||
return
|
||||
|
||||
var state := game.get_game_state()
|
||||
@@ -505,12 +650,16 @@ func test_character_section_exposes_live_name_and_level_labels() -> void:
|
||||
state.player.progression.set_total_xp(125)
|
||||
hud.refresh(state, [], run)
|
||||
|
||||
assert_true(name_label.visible, "CharacterNameLabel must be visible")
|
||||
assert_true(level_label.visible, "CharacterLevelLabel must be visible")
|
||||
assert_true(character_section.get_global_rect().encloses(name_label.get_global_rect()), "CharacterSection must contain CharacterNameLabel")
|
||||
assert_true(character_section.get_global_rect().encloses(level_label.get_global_rect()), "CharacterSection must contain CharacterLevelLabel")
|
||||
assert_string_contains(name_label.text, run.player_name, "CharacterNameLabel must show the real player name")
|
||||
assert_string_contains(level_label.text, str(state.player.progression.level), "CharacterLevelLabel must show the real player level")
|
||||
assert_true(section_title.visible)
|
||||
assert_eq(section_title.text, run.player_name, "The card heading is the run's real name, not PERSONNAGE")
|
||||
assert_ne(section_title.text, "PERSONNAGE")
|
||||
assert_true(name_label == null or not name_label.visible, "CharacterNameLabel must be absent or invisible because the title already names the run")
|
||||
if name_label != null:
|
||||
assert_eq(name_label.text, "", "The hidden duplicate must not retain a second visible identity")
|
||||
assert_true(level_label.visible)
|
||||
assert_true(character_section.get_global_rect().encloses(section_title.get_global_rect()))
|
||||
assert_true(character_section.get_global_rect().encloses(level_label.get_global_rect()))
|
||||
assert_string_contains(level_label.text, str(state.player.progression.level))
|
||||
|
||||
func test_character_portrait_uses_mockup_width_and_preserves_its_aspect_ratio_at_reference_size() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -558,7 +707,7 @@ func test_section_titles_are_visible_contained_and_readable_at_reference_size()
|
||||
assert_true(section.get_global_rect().encloses(title.get_global_rect()), "%s must contain %s" % [section_names[index], title_names[index]])
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 16, "%s must use at least a 16px font at 1920x1080" % title_names[index])
|
||||
|
||||
func test_top_bar_contains_readable_non_overlapping_title_and_header_values() -> void:
|
||||
func test_top_bar_defaults_to_a_single_floor_title_without_legacy_values_or_notifications() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
@@ -569,16 +718,23 @@ func test_top_bar_contains_readable_non_overlapping_title_and_header_values() ->
|
||||
var top_bar := layout.get_node_or_null("TopBar") as Control if layout != null else null
|
||||
var title := hud.get_node_or_null("TitleLabel") as Label
|
||||
var header_values := hud.get_node_or_null("HeaderValuesLabel") as Label
|
||||
var achievement_toast := hud.get_node_or_null("AchievementToast") as Label
|
||||
var title_notification := hud.get_node_or_null("TitleNotificationLabel") as Label
|
||||
assert_not_null(top_bar, "ResponsiveLayout requires TopBar")
|
||||
assert_not_null(title, "TopBar requires TitleLabel")
|
||||
assert_not_null(header_values, "TopBar requires HeaderValuesLabel")
|
||||
if top_bar == null or title == null or header_values == null:
|
||||
assert_not_null(header_values, "Legacy HeaderValuesLabel must be explicitly hidden")
|
||||
assert_not_null(achievement_toast, "HUD retains AchievementToast")
|
||||
assert_not_null(title_notification, "HUD requires a separate temporary TitleNotificationLabel")
|
||||
if top_bar == null or title == null or header_values == null or achievement_toast == null or title_notification == null:
|
||||
return
|
||||
assert_true(top_bar.get_global_rect().encloses(title.get_global_rect()), "TopBar must contain TitleLabel")
|
||||
assert_true(top_bar.get_global_rect().encloses(header_values.get_global_rect()), "TopBar must contain HeaderValuesLabel")
|
||||
assert_false(title.get_global_rect().intersects(header_values.get_global_rect()), "TitleLabel and HeaderValuesLabel must not intersect")
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 20, "TitleLabel must use at least a 20px font at 1920x1080")
|
||||
assert_gte(header_values.get_theme_font_size(&"font_size"), 15, "HeaderValuesLabel must use at least a 15px font at 1920x1080")
|
||||
assert_true(title.visible, "TitleLabel is the sole default visible TopBar value")
|
||||
assert_eq(title.text, "Étage 0")
|
||||
assert_false(header_values.visible)
|
||||
assert_eq(header_values.text, "")
|
||||
assert_false(achievement_toast.visible)
|
||||
assert_false(title_notification.visible)
|
||||
assert_true(top_bar.get_global_rect().encloses(title.get_global_rect()))
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 20)
|
||||
|
||||
func test_command_bar_subzones_are_distinct_and_contain_their_text() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -621,6 +777,22 @@ func test_command_bar_subzones_are_distinct_and_contain_their_text() -> void:
|
||||
if help_panel != null and help_text != null:
|
||||
assert_true(help_panel.get_global_rect().encloses(help_text.get_global_rect()), "HelpPanel must contain its text")
|
||||
|
||||
func _visible_status_labels(hud: GameHud) -> Array[Label]:
|
||||
var labels: Array[Label] = []
|
||||
for label_name: String in ["CharacterStatusLabel", "SpellLabel", "EnemyHealthLabel", "CombatSummaryLabel", "DeadlineLabel"]:
|
||||
var label := hud.get_node_or_null(label_name) as Label
|
||||
if label != null and label.visible:
|
||||
labels.append(label)
|
||||
return labels
|
||||
|
||||
func _visible_text_occurrences(hud: GameHud, needle: String) -> int:
|
||||
var occurrences := 0
|
||||
for node in hud.find_children("*", "Label", true, false):
|
||||
var label := node as Label
|
||||
if label != null and label.visible and label.text.contains(needle):
|
||||
occurrences += 1
|
||||
return occurrences
|
||||
|
||||
func _assert_play_area_is_centered_and_inside_effective_viewport(play_area_frame: Control) -> void:
|
||||
var viewport_rect := get_viewport().get_visible_rect()
|
||||
var expected_viewport := Vector2(Game.REFERENCE_VIEWPORT)
|
||||
@@ -721,26 +893,73 @@ func test_decorative_equipment_and_header_art_are_absent_or_hidden() -> void:
|
||||
var decorative := layout.get_node_or_null(decorative_name) as Control
|
||||
assert_true(decorative == null or not decorative.visible, "%s must be absent or invisible rather than adding decorative visual noise" % decorative_name)
|
||||
|
||||
func test_objectives_and_status_keep_the_requested_vertical_breathing_room() -> void:
|
||||
func test_objectives_and_status_keep_separate_titles_and_content_at_reference_and_compact_sizes() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
hud.apply_viewport_layout(Vector2(1920, 1080))
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var objectives := layout.get_node_or_null("ObjectivesSection") as Control if layout != null else null
|
||||
var status := layout.get_node_or_null("StatusSection") as Control if layout != null else null
|
||||
var status_title := layout.get_node_or_null("StatusSectionTitle") as Label if layout != null else null
|
||||
assert_not_null(objectives)
|
||||
assert_not_null(status)
|
||||
assert_not_null(status_title)
|
||||
if objectives == null or status == null or status_title == null:
|
||||
return
|
||||
assert_gte(status.get_global_rect().position.y - objectives.get_global_rect().end.y, 24.0, "Objectives and Status need at least 24px of vertical separation at 1920x1080")
|
||||
assert_gte(status_title.get_global_rect().position.y - status.get_global_rect().position.y, 14.0, "ÉTAT title needs at least 14px top inset")
|
||||
for viewport_size: Vector2 in [Vector2(1920, 1080), Vector2(1280, 720)]:
|
||||
hud.apply_viewport_layout(viewport_size)
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var objectives := layout.get_node_or_null("ObjectivesSection") as Control if layout != null else null
|
||||
var status := layout.get_node_or_null("StatusSection") as Control if layout != null else null
|
||||
var objectives_title := layout.get_node_or_null("ObjectivesSectionTitle") as Label if layout != null else null
|
||||
var status_title := layout.get_node_or_null("StatusSectionTitle") as Label if layout != null else null
|
||||
var quest_content := hud.get_node_or_null("QuestTrackerLabel") as Control
|
||||
var status_content := hud.get_node_or_null("CharacterStatusLabel") as Control
|
||||
assert_not_null(objectives, "ObjectivesSection is required at %s" % viewport_size)
|
||||
assert_not_null(status, "StatusSection is required at %s" % viewport_size)
|
||||
assert_not_null(objectives_title)
|
||||
assert_not_null(status_title)
|
||||
assert_not_null(quest_content)
|
||||
assert_not_null(status_content)
|
||||
if objectives == null or status == null or objectives_title == null or status_title == null or quest_content == null or status_content == null:
|
||||
continue
|
||||
assert_true(status.get_global_rect().encloses(status_content.get_global_rect()), "CharacterStatusLabel belongs inside StatusSection at %s" % viewport_size)
|
||||
assert_true(objectives.get_global_rect().encloses(objectives_title.get_global_rect()))
|
||||
assert_true(objectives.get_global_rect().encloses(quest_content.get_global_rect()))
|
||||
assert_true(status.get_global_rect().encloses(status_title.get_global_rect()))
|
||||
assert_false(status_content.get_global_rect().intersects(objectives.get_global_rect()), "CharacterStatusLabel must not touch ObjectivesSection at %s" % viewport_size)
|
||||
assert_false(objectives_title.get_global_rect().intersects(quest_content.get_global_rect()), "Objectives title and content must be distinct at %s" % viewport_size)
|
||||
assert_false(status_title.get_global_rect().intersects(status_content.get_global_rect()), "Status title and content must be distinct at %s" % viewport_size)
|
||||
assert_false(objectives.get_global_rect().intersects(status.get_global_rect()), "Objectives and status frames must remain separate at %s" % viewport_size)
|
||||
if viewport_size == Vector2(1920, 1080):
|
||||
assert_gte(status.get_global_rect().position.y - objectives.get_global_rect().end.y, 24.0)
|
||||
assert_gte(status_title.get_global_rect().position.y - status.get_global_rect().position.y, 14.0)
|
||||
|
||||
func test_character_and_journal_titles_are_outlined_light_and_readable() -> void:
|
||||
func test_player_health_and_gold_use_the_final_compact_character_section_contract() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
var state := game.get_game_state()
|
||||
var run := game.get_run_state()
|
||||
run.gold = 15
|
||||
hud.refresh(state, [], run)
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var character_section := layout.get_node_or_null("CharacterSection") as Control if layout != null else null
|
||||
var health := hud.get_node_or_null("PlayerHealthLabel") as Label
|
||||
var gold_icon := hud.get_node_or_null("GoldIcon") as TextureRect
|
||||
var gold_label := hud.get_node_or_null("GoldLabel") as Label
|
||||
assert_not_null(character_section)
|
||||
assert_not_null(health)
|
||||
assert_not_null(gold_icon, "CharacterSection requires GoldIcon")
|
||||
assert_not_null(gold_label)
|
||||
if character_section == null or health == null or gold_icon == null or gold_label == null:
|
||||
return
|
||||
assert_eq(health.text, "PV : %d/%d" % [state.player.hit_points, state.player.max_hit_points])
|
||||
assert_true(gold_icon.visible)
|
||||
assert_not_null(gold_icon.texture)
|
||||
if gold_icon.texture != null:
|
||||
assert_true(_texture_has_gold_coin_path(gold_icon.texture), "GoldIcon must use the gold_coin SVG or PNG asset")
|
||||
assert_eq(gold_label.text, "15", "GoldLabel contains the numeric value only")
|
||||
assert_true(character_section.get_global_rect().encloses(gold_icon.get_global_rect()))
|
||||
assert_true(character_section.get_global_rect().encloses(gold_label.get_global_rect()))
|
||||
var currency_bottom := maxf(gold_icon.get_global_rect().end.y, gold_label.get_global_rect().end.y)
|
||||
assert_gte(character_section.get_global_rect().end.y - currency_bottom, 16.0, "The currency icon/value union needs a >=16px bottom margin")
|
||||
|
||||
func test_character_and_journal_titles_use_the_final_large_outlined_light_style() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
@@ -751,14 +970,25 @@ func test_character_and_journal_titles_are_outlined_light_and_readable() -> void
|
||||
assert_not_null(layout)
|
||||
if layout == null:
|
||||
return
|
||||
for title_name: String in ["CharacterSectionTitle", "JournalSectionTitle"]:
|
||||
var title := layout.get_node_or_null(title_name) as Label
|
||||
assert_not_null(title, "ResponsiveLayout requires %s" % title_name)
|
||||
if title == null:
|
||||
for specification: Dictionary in [
|
||||
{"section": "CharacterSection", "title": "CharacterSectionTitle"},
|
||||
{"section": "JournalSection", "title": "JournalSectionTitle"},
|
||||
]:
|
||||
var section := layout.get_node_or_null(String(specification.section)) as Control
|
||||
var title := layout.get_node_or_null(String(specification.title)) as Label
|
||||
assert_not_null(section)
|
||||
assert_not_null(title, "ResponsiveLayout requires %s" % specification.title)
|
||||
if section == null or title == null:
|
||||
continue
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 16, "%s needs at least a 16px font at 1920x1080" % title_name)
|
||||
assert_gte(title.get_theme_constant(&"outline_size"), 2, "%s needs a >=2px contour" % title_name)
|
||||
assert_gte(title.get_theme_color(&"font_color").get_luminance(), 0.60, "%s needs a light font color" % title_name)
|
||||
assert_gte(title.get_theme_font_size(&"font_size"), 20, "%s needs a >=20px font at 1920x1080" % title.name)
|
||||
assert_gte(title.get_theme_constant(&"outline_size"), 3, "%s needs a >=3px contour" % title.name)
|
||||
var font_color := title.get_theme_color(&"font_color")
|
||||
assert_gte(font_color.r, 0.95, "%s must use an explicit gold/yellow red channel" % title.name)
|
||||
assert_gte(font_color.g, 0.70, "%s must use an explicit gold/yellow green channel" % title.name)
|
||||
assert_lte(font_color.g, 0.90, "%s must use an explicit gold/yellow green channel" % title.name)
|
||||
assert_lte(font_color.b, 0.55, "%s must use an explicit gold/yellow blue channel" % title.name)
|
||||
assert_eq(font_color.a, 1.0, "%s must be fully opaque" % title.name)
|
||||
assert_gte(title.get_global_rect().position.y - section.get_global_rect().position.y, 16.0, "%s needs a >=16px vertical inset" % title.name)
|
||||
|
||||
func test_command_bar_keeps_all_three_zones_readable_at_reference_and_compact_sizes() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
@@ -798,6 +1028,9 @@ func test_command_bar_keeps_all_three_zones_readable_at_reference_and_compact_si
|
||||
assert_lte(help.get_minimum_size().x, help.size.x, "The right help zone must fit its complete label at %s" % viewport_size)
|
||||
assert_eq(prompt.text, "F : Distance • X : Magie • K : Familier", "The center zone must contain exactly the three requested command notions")
|
||||
|
||||
func _texture_has_gold_coin_path(texture: Texture2D) -> bool:
|
||||
return _texture_uses_path(texture, "res://assets/ui/dark_fantasy/gold_coin.svg") or _texture_uses_path(texture, "res://assets/ui/dark_fantasy/gold_coin.png")
|
||||
|
||||
func _texture_uses_path(texture: Texture2D, expected_path: String) -> bool:
|
||||
if texture == null:
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user