feat: complete playtest parity improvements
This commit is contained in:
@@ -25,13 +25,13 @@ func select_next(delta: int) -> bool:
|
||||
func refresh() -> void:
|
||||
if _companion == null:
|
||||
return
|
||||
title.text = "Companion command"
|
||||
var status := "Alive" if _companion.is_alive() else "Fallen"
|
||||
body.text = "%s — %s\n\n%s\n\n←/→ Change stance Esc Close" % [String(_companion.choice_id).capitalize(), status, _stance_lines()]
|
||||
title.text = _companion.name
|
||||
var status := "En vie" if _companion.is_alive() else "À terre"
|
||||
body.text = "%s — %s\nPV %d/%d\n\nComportement :\n%s\n\n%s\n\n←/→ Changer K ou Échap Fermer" % [_companion.species, status, _companion.actor.hit_points, _companion.actor.effective_max_hit_points(), _stance_lines(), CompanionState.stance_description(_companion.stance)]
|
||||
|
||||
func _stance_lines() -> String:
|
||||
var lines: PackedStringArray = []
|
||||
for stance: StringName in CompanionState.VALID_STANCES:
|
||||
var cursor := "> " if stance == _companion.stance else " "
|
||||
lines.append("%s%s" % [cursor, String(stance).capitalize()])
|
||||
lines.append("%s%s" % [cursor, CompanionState.stance_label(stance)])
|
||||
return "\n".join(lines)
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
class_name DeathPanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var body: RichTextLabel = $Body
|
||||
signal navigation_requested(action: StringName)
|
||||
|
||||
@onready var body: RichTextLabel = $Layout/Body
|
||||
@onready var hint: Label = $Layout/Hint
|
||||
@onready var load_button: Button = $Layout/Actions/LoadButton
|
||||
|
||||
func _ready() -> void:
|
||||
load_button.pressed.connect(func() -> void: navigation_requested.emit(&"load"))
|
||||
$Layout/Actions/NewRunButton.pressed.connect(func() -> void: navigation_requested.emit(&"new_run"))
|
||||
$Layout/Actions/MenuButton.pressed.connect(func() -> void: navigation_requested.emit(&"menu"))
|
||||
|
||||
func present(outcome: StringName, player_name: String, floor: int, level: int) -> void:
|
||||
visible = true
|
||||
var mode := "Mort permanente : la sauvegarde de cette run est retirée." if outcome == &"permadeath" else "Classique : la sauvegarde de cette run reste disponible."
|
||||
var classic := outcome != &"permadeath"
|
||||
var mode := "Mort permanente : cette run est terminée." if not classic else "Classique : vous pouvez charger une sauvegarde existante."
|
||||
body.text = "%s n'aura pas survécu au donjon.\n\nNiveau atteint : %d Étage : %d\n\n%s\n\nLe donjon, lui, continuera sans vous." % [player_name, level, floor, mode]
|
||||
load_button.visible = classic
|
||||
hint.text = "Choisissez une sauvegarde, une nouvelle partie ou le menu principal." if classic else "Commencez une nouvelle partie ou retournez au menu principal."
|
||||
|
||||
func dismiss() -> void:
|
||||
visible = false
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class_name DialoguePanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var title: Label = $Title
|
||||
@onready var body: RichTextLabel = $Body
|
||||
@onready var entries: RichTextLabel = $Entries
|
||||
@onready var title: Label = $Layout/Title
|
||||
@onready var body: RichTextLabel = $Layout/Body
|
||||
@onready var entries: RichTextLabel = $Layout/Entries
|
||||
|
||||
var _engine: DialogueEngine
|
||||
var _state: DialogueState
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class_name EventPanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var title: Label = $Title
|
||||
@onready var body: RichTextLabel = $Body
|
||||
@onready var entries: RichTextLabel = $Entries
|
||||
@onready var title: Label = $Layout/Title
|
||||
@onready var body: RichTextLabel = $Layout/Body
|
||||
@onready var entries: RichTextLabel = $Layout/Entries
|
||||
|
||||
var _engine: EventEngine
|
||||
var _definition: Dictionary = {}
|
||||
|
||||
@@ -20,5 +20,7 @@ func refresh() -> void:
|
||||
if not events.is_empty() and events[0] is InputEventKey:
|
||||
binding = OS.get_keycode_string((events[0] as InputEventKey).physical_keycode)
|
||||
lines.append("%s — %s" % [binding, InputBindingsType.help_name_for(action)])
|
||||
lines.append("\nF1 / ? — fermer")
|
||||
lines.append("\nCiblage : flèches, Entrée pour confirmer, Échap pour annuler")
|
||||
lines.append("Sauvegarde : V (éditeur) ou Ctrl+S (jeu autonome), puis choix d’un emplacement")
|
||||
lines.append("F1 / Échap — fermer")
|
||||
body.text = "\n".join(lines)
|
||||
|
||||
@@ -13,6 +13,8 @@ const QUEST_BOARD_PROMPT := "Espace — Lire le tableau des quêtes"
|
||||
|
||||
@onready var player_health_label: Label = $PlayerHealthLabel
|
||||
@onready var player_focus_label: Label = $PlayerFocusLabel
|
||||
@onready var experience_bar: ProgressBar = $ExperienceBar
|
||||
@onready var experience_label: Label = $ExperienceLabel
|
||||
@onready var spell_label: Label = $SpellLabel
|
||||
@onready var deadline_label: Label = $DeadlineLabel
|
||||
@onready var gold_label: Label = $GoldLabel
|
||||
@@ -38,6 +40,7 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
|
||||
_run_state = run_state
|
||||
player_health_label.text = "Player HP: %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_experience(state.player.progression)
|
||||
if state.enemies.has(&"goblin"):
|
||||
var goblin: ActorState = state.enemies[&"goblin"]
|
||||
enemy_health_label.text = "Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points]
|
||||
@@ -55,6 +58,16 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
|
||||
for event in events:
|
||||
event_log.append_text(event.message + "\n")
|
||||
|
||||
func _refresh_experience(experience: Experience) -> void:
|
||||
var current_level_start := experience.xp_for_level(experience.level)
|
||||
var next_level_total := experience.next_level_xp()
|
||||
var level_progress := experience.total_xp - current_level_start
|
||||
var level_required := next_level_total - current_level_start
|
||||
experience_bar.min_value = 0
|
||||
experience_bar.max_value = level_required
|
||||
experience_bar.value = level_progress
|
||||
experience_label.text = "Niveau %d — XP %d/%d" % [experience.level, level_progress, level_required]
|
||||
|
||||
func get_context_prompt() -> String:
|
||||
if _state == null:
|
||||
return ""
|
||||
@@ -72,7 +85,7 @@ func get_context_prompt() -> String:
|
||||
&"stairs":
|
||||
if _state.floor_state.floor_number > 0 and _state.player.cell == _state.floor_state.entrance:
|
||||
return STAIRS_UP_PROMPT
|
||||
if _run_state != null:
|
||||
if _run_state != null and _state.floor_state.floor_number > 0:
|
||||
var deadline := _run_state.current_floor_deadline()
|
||||
if not deadline.can_descend():
|
||||
return "Escaliers verrouillés — encore %d jour(s) avant l’ouverture" % deadline.days_until_stairs_open()
|
||||
@@ -101,6 +114,8 @@ func _quest_tracker() -> String:
|
||||
func _deadline_status() -> String:
|
||||
if _run_state == null:
|
||||
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:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class_name InventoryPanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var entries: RichTextLabel = $Entries
|
||||
@onready var details: RichTextLabel = $Details
|
||||
@onready var entries: RichTextLabel = $Layout/Columns/Entries
|
||||
@onready var details: RichTextLabel = $Layout/Columns/Details
|
||||
|
||||
var selected_index := 0
|
||||
var _inventory: InventoryState
|
||||
@@ -53,7 +53,7 @@ func refresh() -> void:
|
||||
var stats := _identification.display_stats(item) if _identification != null else ""
|
||||
var description := String(item.definition.raw.get("description", "")) if _identification == null or _identification.is_identified(item) else "Its properties are not yet known."
|
||||
var comparison := _equipment.comparison_for(item, _identification) if _equipment != null else ""
|
||||
details.text = "%s\n%s\n%s\n\n%s\n\n%s\n↑/↓ Select E Equip U Use D Drop I Close" % [name, stats, description, comparison, equipment_summary]
|
||||
details.text = "%s\n%s\n%s\n\n%s\n\n%s" % [name, stats, description, comparison, equipment_summary]
|
||||
|
||||
func _equipment_summary() -> String:
|
||||
if _equipment == null or _identification == null:
|
||||
|
||||
@@ -49,7 +49,7 @@ func _color_for(presentation_kind: StringName) -> Color:
|
||||
|
||||
func _label_for(event: GameEvent, presentation_kind: StringName) -> String:
|
||||
match presentation_kind:
|
||||
&"loot": return "✦ LOOT SECURED"
|
||||
&"loot": return "✦ BUTIN AU SOL"
|
||||
&"trap": return "! TRAP"
|
||||
&"quest": return "✦ QUEST UPDATED"
|
||||
_: return event.message
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class_name LootPanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var entries: RichTextLabel = $Entries
|
||||
@onready var entries: RichTextLabel = $Layout/Entries
|
||||
|
||||
func present(reward: Dictionary, catalog: ContentCatalog) -> void:
|
||||
entries.text = _reward_text(reward, catalog)
|
||||
|
||||
@@ -1,49 +1,37 @@
|
||||
class_name CharacterCreation
|
||||
extends Control
|
||||
|
||||
signal run_requested(settings: RunSettings, player_name: String, base_archetype: StringName, race: StringName)
|
||||
signal run_requested(settings: RunSettings, player_name: String)
|
||||
signal cancelled
|
||||
|
||||
const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd")
|
||||
const ClassEngineType = preload("res://scripts/domain/progression/class_engine.gd")
|
||||
const DIFFICULTY_IDS: Array[StringName] = [&"touriste", &"crawler", &"veteran", &"masochiste"]
|
||||
const ARCHETYPE_IDS: Array[StringName] = [&"vanguard", &"mystic", &"scout"]
|
||||
|
||||
@onready var name_edit: LineEdit = $Panel/Layout/Fields/NameEdit
|
||||
@onready var archetype_option: OptionButton = $Panel/Layout/Fields/ArchetypeOption
|
||||
@onready var race_option: OptionButton = $Panel/Layout/Fields/RaceOption
|
||||
@onready var recommendation_label: Label = $Panel/Layout/Fields/RecommendationLabel
|
||||
@onready var pet_check: CheckBox = $Panel/Layout/Fields/PetCheck
|
||||
@onready var pet_details: VBoxContainer = $Panel/Layout/Fields/PetDetails
|
||||
@onready var pet_name_edit: LineEdit = $Panel/Layout/Fields/PetDetails/PetNameEdit
|
||||
@onready var pet_species_edit: LineEdit = $Panel/Layout/Fields/PetDetails/PetSpeciesEdit
|
||||
@onready var seed_edit: LineEdit = $Panel/Layout/Fields/SeedEdit
|
||||
@onready var difficulty_option: OptionButton = $Panel/Layout/Fields/DifficultyOption
|
||||
@onready var permadeath_option: OptionButton = $Panel/Layout/Fields/PermadeathOption
|
||||
@onready var validation_label: Label = $Panel/Layout/ValidationLabel
|
||||
|
||||
func _ready() -> void:
|
||||
_populate_races()
|
||||
race_option.item_selected.connect(_refresh_recommendation)
|
||||
pet_check.toggled.connect(func(enabled: bool) -> void: pet_details.visible = enabled)
|
||||
pet_details.visible = pet_check.button_pressed
|
||||
$Panel/Layout/Actions/StartRunButton.pressed.connect(_on_start_run_pressed)
|
||||
$Panel/Layout/Actions/CancelButton.pressed.connect(func() -> void: cancelled.emit())
|
||||
|
||||
func _populate_races() -> void:
|
||||
var engine := ClassEngineType.load_default()
|
||||
for race in engine.race_definitions():
|
||||
race_option.add_item(String(race.get("name", race.get("id", ""))))
|
||||
race_option.set_item_metadata(race_option.item_count - 1, StringName(race.get("id", "")))
|
||||
_refresh_recommendation(race_option.selected)
|
||||
|
||||
func _refresh_recommendation(_selected: int) -> void:
|
||||
var race_id := StringName(race_option.get_item_metadata(race_option.selected))
|
||||
var recommendations := ClassEngineType.load_default().recommendations_for(race_id)
|
||||
recommendation_label.text = "Recommended: %s" % (", ".join(PackedStringArray(recommendations.map(func(id: StringName) -> String: return String(id).capitalize()))) if not recommendations.is_empty() else "Recommended: any base class")
|
||||
|
||||
func _on_start_run_pressed() -> void:
|
||||
var selected_difficulty := DIFFICULTY_IDS[difficulty_option.selected]
|
||||
var settings := RunSettingsType.new(
|
||||
seed_edit.text,
|
||||
selected_difficulty,
|
||||
permadeath_option.get_selected_id() == 1,
|
||||
pet_check.button_pressed
|
||||
pet_check.button_pressed,
|
||||
pet_name_edit.text,
|
||||
pet_species_edit.text
|
||||
)
|
||||
if not settings.is_valid():
|
||||
validation_label.text = settings.validation_error()
|
||||
@@ -52,10 +40,4 @@ func _on_start_run_pressed() -> void:
|
||||
var player_name := name_edit.text.strip_edges()
|
||||
if player_name.is_empty():
|
||||
player_name = "Sans-Nom"
|
||||
var selected_archetype := ARCHETYPE_IDS[archetype_option.selected]
|
||||
var selected_race := StringName(race_option.get_item_metadata(race_option.selected))
|
||||
var choice := ClassEngineType.load_default().creation_choice(selected_race, selected_archetype)
|
||||
if not bool(choice.get("accepted", false)):
|
||||
validation_label.text = "Choose a compatible race and base archetype."
|
||||
return
|
||||
run_requested.emit(settings, player_name, selected_archetype, selected_race)
|
||||
run_requested.emit(settings, player_name)
|
||||
|
||||
@@ -29,7 +29,7 @@ func _ready() -> void:
|
||||
save_load_panel.cancelled.connect(_show_main_menu)
|
||||
_show_main_menu()
|
||||
if _get_capture_mode():
|
||||
_start_new_run(RunSettings.new("visual-check", &"crawler", false, false), "Visual Check", &"vanguard", &"race_humain_standard")
|
||||
_start_new_run(RunSettings.new("visual-check", &"crawler", false, false), "Visual Check")
|
||||
|
||||
func _get_capture_mode() -> bool:
|
||||
var arguments := OS.get_cmdline_user_args()
|
||||
@@ -94,14 +94,14 @@ func _show_load_slots() -> void:
|
||||
|
||||
func show_save_slots() -> void:
|
||||
_save_load_mode = "save"
|
||||
save_load_panel.present(_save_load_mode, _save_repository.list_slots())
|
||||
save_load_panel.present(_save_load_mode, _save_repository.list_slots(), "La sauvegarde est manuelle. Choisissez un emplacement.")
|
||||
|
||||
func _on_save_load_slot_requested(slot: int) -> void:
|
||||
var result := save_to_slot(slot) if _save_load_mode == "save" else load_slot(slot)
|
||||
if bool(result.get("ok", false)):
|
||||
_show_main_menu() if _save_load_mode == "load" else save_load_panel.set_status("Saved to slot %d." % slot)
|
||||
_show_main_menu() if _save_load_mode == "load" else save_load_panel.set_status("Partie sauvegardée dans l’emplacement %d." % slot)
|
||||
else:
|
||||
save_load_panel.set_status(String(result.get("error", "Save operation failed.")))
|
||||
save_load_panel.set_status(String(result.get("error", "Échec de la sauvegarde.")))
|
||||
|
||||
func save_to_slot(slot: int) -> Dictionary:
|
||||
var game := get_node_or_null("Game") as Game
|
||||
@@ -122,17 +122,33 @@ func load_slot(slot: int) -> Dictionary:
|
||||
game.name = "Game"
|
||||
game.configure_loaded_run(loaded)
|
||||
add_child(game)
|
||||
_connect_game_navigation(game)
|
||||
menu.visible = false
|
||||
character_creation.visible = false
|
||||
return loaded
|
||||
|
||||
func _start_new_run(settings: RunSettings, player_name: String, base_archetype: StringName, race: StringName = &"race_humain_standard") -> void:
|
||||
func _start_new_run(settings: RunSettings, player_name: String) -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
game.name = "Game"
|
||||
game.configure_new_run(settings, player_name, base_archetype, race)
|
||||
game.configure_new_run(settings, player_name)
|
||||
add_child(game)
|
||||
_connect_game_navigation(game)
|
||||
menu.visible = false
|
||||
character_creation.visible = false
|
||||
game.game_started.connect(func(started_settings: RunSettings, run_state: RunState) -> void:
|
||||
game_started.emit(started_settings, run_state)
|
||||
)
|
||||
|
||||
func _connect_game_navigation(game: Game) -> void:
|
||||
game.death_navigation_requested.connect(_on_death_navigation_requested.bind(game))
|
||||
game.save_requested.connect(show_save_slots)
|
||||
|
||||
func _on_death_navigation_requested(action: StringName, game: Game) -> void:
|
||||
if not is_instance_valid(game):
|
||||
return
|
||||
game.queue_free()
|
||||
_show_main_menu()
|
||||
if action == &"load":
|
||||
_show_load_slots()
|
||||
elif action == &"new_run":
|
||||
_show_character_creation()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class_name QuestPanel
|
||||
extends PanelContainer
|
||||
|
||||
@onready var title: Label = $Title
|
||||
@onready var body: RichTextLabel = $Body
|
||||
@onready var entries: RichTextLabel = $Entries
|
||||
@onready var title: Label = $Layout/Title
|
||||
@onready var body: RichTextLabel = $Layout/Body
|
||||
@onready var entries: RichTextLabel = $Layout/Entries
|
||||
|
||||
var _manager: QuestManager
|
||||
var _quest_ids: Array[StringName] = []
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
class_name RaceClassChoicePanel
|
||||
extends PanelContainer
|
||||
|
||||
signal race_confirmed(race_id: StringName)
|
||||
signal class_confirmed(class_id: StringName)
|
||||
|
||||
@onready var title: Label = $Layout/Title
|
||||
@onready var intro: Label = $Layout/Intro
|
||||
@onready var options: RichTextLabel = $Layout/Options
|
||||
|
||||
var _stage: StringName = &"race"
|
||||
var _choices: Array[Dictionary] = []
|
||||
var _selected_index := 0
|
||||
|
||||
func present_races(choices: Array[Dictionary]) -> void:
|
||||
_stage = &"race"
|
||||
_present(choices)
|
||||
|
||||
func present_classes(choices: Array[Dictionary]) -> void:
|
||||
_stage = &"class"
|
||||
_present(choices)
|
||||
|
||||
func dismiss() -> void:
|
||||
visible = false
|
||||
_choices.clear()
|
||||
_selected_index = 0
|
||||
|
||||
func select_next(delta: int) -> void:
|
||||
if _choices.is_empty():
|
||||
return
|
||||
_selected_index = posmod(_selected_index + delta, _choices.size())
|
||||
refresh()
|
||||
|
||||
func confirm() -> void:
|
||||
if _choices.is_empty():
|
||||
return
|
||||
var choice_id := StringName(_choices[_selected_index].get("id", ""))
|
||||
if _stage == &"race":
|
||||
race_confirmed.emit(choice_id)
|
||||
else:
|
||||
class_confirmed.emit(choice_id)
|
||||
|
||||
func stage() -> StringName:
|
||||
return _stage
|
||||
|
||||
func _present(choices: Array[Dictionary]) -> void:
|
||||
_choices = choices.duplicate(true)
|
||||
_selected_index = 0
|
||||
visible = true
|
||||
refresh()
|
||||
|
||||
func refresh() -> void:
|
||||
title.text = "NIVEAU 3 — CHOIX DE %s" % ("RACE" if _stage == &"race" else "CLASSE")
|
||||
intro.text = "Choisissez votre race, puis votre classe. Ce choix est permanent."
|
||||
var lines := PackedStringArray()
|
||||
for index in _choices.size():
|
||||
var choice := _choices[index]
|
||||
var marker := ">" if index == _selected_index else " "
|
||||
lines.append("%s %s" % [marker, String(choice.get("name", choice.get("id", "")))])
|
||||
var description := String(choice.get("description", ""))
|
||||
if not description.is_empty():
|
||||
lines.append(" %s" % description)
|
||||
options.text = "\n".join(lines) + "\n\nHaut/Bas : sélectionner Entrée : confirmer"
|
||||
@@ -0,0 +1 @@
|
||||
uid://chvjdg03j75dt
|
||||
@@ -18,7 +18,7 @@ func _ready() -> void:
|
||||
func present(mode: String, slot_metas: Array[Dictionary], message: String = "") -> void:
|
||||
_mode = mode
|
||||
visible = true
|
||||
title_label.text = "SAVE RUN" if mode == "save" else "LOAD RUN"
|
||||
title_label.text = "SAUVEGARDER LA PARTIE" if mode == "save" else "CHARGER UNE PARTIE"
|
||||
status_label.text = message
|
||||
for index in range(slots.get_child_count()):
|
||||
var button := slots.get_child(index) as Button
|
||||
@@ -39,5 +39,5 @@ func _request_slot(slot: int) -> void:
|
||||
func _label_for(meta: Dictionary) -> String:
|
||||
var slot := int(meta.get("slot", 0))
|
||||
if not bool(meta.get("exists", false)):
|
||||
return "SLOT %d — EMPTY" % slot
|
||||
return "SLOT %d — %s — FLOOR %d" % [slot, String(meta.get("character_name", "?")), int(meta.get("floor", 0))]
|
||||
return "EMPLACEMENT %d — VIDE" % slot
|
||||
return "EMPLACEMENT %d — %s — ÉTAGE %d" % [slot, String(meta.get("character_name", "?")), int(meta.get("floor", 0))]
|
||||
|
||||
@@ -64,4 +64,4 @@ func _refresh_label() -> void:
|
||||
return
|
||||
var target_id := target_ids[_selected_index]
|
||||
var cell: Vector2i = _targets[target_id]
|
||||
target_label.text = "Cible : %s (%d, %d) — Entrée pour tirer, Échap pour annuler" % [String(target_id).capitalize(), cell.x, cell.y]
|
||||
target_label.text = "Cible : %s (%d, %d) — Flèches : choisir • Entrée : tirer • Échap : annuler" % [String(target_id).capitalize(), cell.x, cell.y]
|
||||
|
||||
Reference in New Issue
Block a user