feat: complete playtest parity improvements

This commit is contained in:
goose
2026-10-08 19:06:19 -04:00
parent cce25a1908
commit eca098b4b9
139 changed files with 3001 additions and 982 deletions
+4
View File
@@ -13,3 +13,7 @@ All binary art below is an unmodified 32×32 PNG copied from the local **Dungeon
| `assets/dcss/stairs.png` | `dungeon/gateways/stone_stairs_up.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none | | `assets/dcss/stairs.png` | `dungeon/gateways/stone_stairs_up.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none |
| `assets/dcss/player.png` | `player/base/kobold_female_new.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none | | `assets/dcss/player.png` | `player/base/kobold_female_new.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none |
| `assets/dcss/goblin.png` | `monster/goblin_new.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none | | `assets/dcss/goblin.png` | `monster/goblin_new.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none |
| `assets/dcss/war_dog.png` | `monster/animals/war_dog.png` | Dungeon Crawl Stone Soup Full | CC0 1.0 | none |
| `assets/audio/dungeon_exploration.wav` | generated specifically for this project | Dungeon Crawler World project | original project asset | procedural synthesis, 2026-10-08 |
| `assets/audio/dungeon_combat.wav` | generated specifically for this project | Dungeon Crawler World project | original project asset | procedural synthesis, 2026-10-08 |
| `assets/audio/dungeon_danger.wav` | generated specifically for this project | Dungeon Crawler World project | original project asset | procedural synthesis, 2026-10-08 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

+9 -7
View File
@@ -1,6 +1,6 @@
# Playing Dungeon Crawler World # Playing Dungeon Crawler World
Dungeon Crawler World is a desktop Godot prototype. It supports Linux x86_64 and Windows x86_64 exports. The reference display is 1280×720, but the window is resizable. Dungeon Crawler World is a desktop Godot prototype. It supports Linux x86_64 and Windows x86_64 exports. The reference display is 1920×1080, but the window is resizable.
## Install or run ## Install or run
@@ -38,7 +38,7 @@ The Linux script exports `build/linux/DungeonCrawlerWorld.x86_64` and smoke-laun
Choose **NEW RUN** at the main menu, choose a character, then enter the dungeon. **CONTINUE** loads the most recently updated occupied slot; **LOAD SLOT** opens a specific slot. Choose **NEW RUN** at the main menu, choose a character, then enter the dungeon. **CONTINUE** loads the most recently updated occupied slot; **LOAD SLOT** opens a specific slot.
The main menu exposes **CONTINUE** and **LOAD SLOT**. During an active run, the game API provides the five-slot Save/Load panel; builds that do not expose that command in the current UI should be treated as prototype builds and should not be represented as offering a player-facing manual-save shortcut. Saves are versioned JSON files below Godot's `user://saves` directory, named `slot1.json` through `slot5.json`. The exact native location is platform-dependent. To find it in a running build, open the Godot editor for the same project and use its user-data path, or inspect `ProjectSettings.globalize_path("user://")` from a debug tool. Copy the whole `saves` directory to back up a run; do not edit a save while the game is writing it. La sauvegarde est **manuelle** : pendant une partie, appuyez sur **V** (fonctionne aussi dans le jeu lancé depuis l’éditeur Godot) ou sur **Ctrl+S** dans une version autonome, puis choisissez l’un des cinq emplacements. Un message confirme l’emplacement écrit. Il n’est pas nécessaire d’avoir un menu Échap et le ciblage ou l’ouverture du panneau de sauvegarde ne consomme aucun tour. Le menu principal expose **CONTINUE** et **LOAD SLOT** pour reprendre la sauvegarde la plus récente ou choisir un emplacement. Les sauvegardes sont des fichiers JSON versionnés dans `user://saves`, nommés `slot1.json` à `slot5.json`. Leur chemin natif dépend de la plateforme. Copiez le dossier `saves` complet pour sauvegarder vos parties hors jeu; ne modifiez pas un fichier pendant son écriture.
The game recognizes its current schema and can migrate the supported parts of the supplied ASCII save shape. Unsupported legacy keys are reported rather than silently claimed as preserved. The game recognizes its current schema and can migrate the supported parts of the supplied ASCII save shape. Unsupported legacy keys are reported rather than silently claimed as preserved.
@@ -52,7 +52,9 @@ Press **F1** in a run for the current in-game control list. It is generated from
| Move north-west / north-east / south-west / south-east | **Q / keypad 9 / Z / C** | | Move north-west / north-east / south-west / south-east | **Q / keypad 9 / Z / C** |
| Interact, open doors/chests, use stairs | **Space** or **E** | | Interact, open doors/chests, use stairs | **Space** or **E** |
| Wait | **.** | | Wait | **.** |
| Melee / ranged / cast | **F / R / X** | | Attaque de mêlée | Se déplacer vers la case d’un ennemi adjacent |
| Attaque à distance / lancer un sort | **F / X** |
| Sauvegarder manuellement | **V** dans le debug Godot, ou **Ctrl+S** en version autonome, puis choisir un emplacement |
| Talk / rest | **T / H** | | Talk / rest | **T / H** |
| Inventory / crafting | **I / B** | | Inventory / crafting | **I / B** |
| Character / quests | **P / J** | | Character / quests | **P / J** |
@@ -63,13 +65,13 @@ Press **F1** in a run for the current in-game control list. It is generated from
| Options / help | **O / F1** | | Options / help | **O / F1** |
| Expand journal | **L** (shares the achievements default) | | Expand journal | **L** (shares the achievements default) |
Several commands open contextual panels. Within selection panels, use arrows to select, **Enter** or **Space** to confirm, and **Esc** to close. In the inventory, use **E** to equip, **U** to use, and **D** to drop the selected item. In the shop, **Tab** changes buy/sell mode. The Options panel supports UI scaling, a high-contrast/color-blind marker mode, and remapping the Inventory control; its displayed keys control ambience and effects volume. Plusieurs commandes ouvrent des panneaux contextuels. Dans les panneaux de sélection, utilisez les flèches pour choisir, **Entrée** ou **Espace** pour confirmer et **Échap** pour annuler. Avec une arme à distance équipée, **F** ouvre les cibles actuellement à portée et en ligne de vue; confirmer le tir consomme immédiatement un tour et les adversaires survivants se déplacent ou attaquent. **K** ouvre les ordres du familier : **Reste en arrière**, **Défends-moi** ou **Attaque à vue**. Dans l’inventaire, utilisez **E** pour équiper, **U** pour utiliser et **D** pour déposer. Dans la boutique, **Tab** change le mode achat/vente.
## Audio (optional) ## Musique et audio
The game works silently with no audio files. Playback only uses `AudioStream` resources registered in `user://audio/audio_import_manifest.tres`; it does not scan or decode arbitrary files from a directory. The manifest accepts these ambience contexts: `exploration`, `combat`, `danger`; and these SFX events: `attack_given`, `attack_received`, `menu_select`, `menu_cancel`, `item_use`, `death`. Le jeu contient trois ambiances originales intégrées : exploration, combat et danger. L’exploration démarre automatiquement avec la partie et le contexte passe à la musique de combat lors d’un affrontement. Le panneau Options contrôle séparément les volumes Ambiance et Effets.
This is intentionally a safe, Godot-native setup boundary. A setup/modding tool must import a supported sound into Godot and register the resulting `AudioStream` in the manifest. The Options panel changes separate Ambience and SFX bus volumes; missing, invalid, or unregistered audio remains silent and never blocks gameplay. La personnalisation reste sécurisée : le jeu ne parcourt et ne décode jamais des fichiers arbitraires. Un manifeste Godot optionnel dans `user://audio/audio_import_manifest.tres` peut remplacer individuellement les ressources intégrées avec des `AudioStream` déjà importés. Il reconnaît les contextes `exploration`, `combat`, `danger` et les effets `attack_given`, `attack_received`, `menu_select`, `menu_cancel`, `item_use`, `death`. Une entrée absente du manifeste utilisateur conserve la ressource intégrée correspondante.
## Known limitations ## Known limitations
@@ -0,0 +1,116 @@
# Playtest Parity Fixes Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Corriger les quatre écarts constatés en playtest concernant le jalon race/classe, la lisibilité de l’interface, la représentation du combat et le niveau principal.
**Architecture:** Conserver les domaines existants et corriger les branchements qui les exposent. La création de partie reste limitée aux paramètres de run; un panneau modal dédié consomme `ClassEngine` à l’entrée de l’étage 3. Le monde affiché reste piloté par `FloorState`, mais la surface et le profil de l’étage 1 sont alignés sur `DCWASCII`.
**Tech Stack:** Godot 4, GDScript, GUT 9.5.
**Spec:** Retours de playtest du 2026-10-07 et projet de référence `../DCWASCII` (`dcw/game.py`, `dcw/world/surface.py`, `dcw/world/generator.py`).
## Global Constraints
- Préserver la modification locale préexistante de `project.godot`.
- Ne pas confondre le niveau principal avec la minimap.
- Les choix de race puis de classe sont obligatoires à l’entrée de l’étage 3 du Donjon, pas à la création ni au niveau de personnage 3.
- Une attaque de mêlée reste déclenchée uniquement en tentant d’entrer dans la case adjacente occupée.
- Les noms techniques et le code restent en anglais.
---
### Task 1: Jalon race et classe de l’étage 3
**Files:**
- Modify: `scenes/menu/CharacterCreation.tscn`
- Modify: `scripts/presentation/menu/character_creation.gd`
- Modify: `scripts/presentation/menu/main_menu.gd`
- Modify: `scripts/game/game.gd`
- Modify: `scripts/domain/progression/class_engine.gd`
- Modify: `scripts/domain/run/run_state.gd`
- Create: `scenes/ui/RaceClassChoicePanel.tscn`
- Create: `scripts/presentation/race_class_choice_panel.gd`
- Test: `tests/e2e/test_new_run_creation_e2e.gd`
- Test: `tests/e2e/test_floor_three_race_class_e2e.gd`
**Interfaces:**
- Consumes: `ClassEngine.race_definitions()`, compatibility rules, `FloorTransition.transition()`.
- Produces: a mandatory `RaceClassChoicePanel`, an initially empty race/archetype, and a persisted `RunState.base_archetype` after confirmation.
- [ ] Add a failing creation-flow test proving there are no race/class controls and the new player has empty choices.
- [ ] Remove race/class fields and arguments from the creation flow.
- [ ] Add a failing floor-transition test proving entry to floor 3 opens a mandatory race-first modal.
- [ ] Add separate race and class application methods to `ClassEngine` and implement the modal sequence.
- [ ] Verify both focused E2E tests.
### Task 2: HUD and chest layout
**Files:**
- Modify: `scenes/Game.tscn`
- Modify: `scenes/ui/LootPanel.tscn`
- Test: `tests/unit/test_hud_layout.gd`
- Test: `tests/unit/test_loot_panel_layout.gd`
**Interfaces:**
- Consumes: existing HUD node paths retained for compatibility.
- Produces: non-overlapping visible rectangles at 1280×720.
- [ ] Add failing rectangle-intersection assertions for all visible HUD labels and chest panel sections.
- [ ] Give each visible HUD datum a distinct row and sufficient wrapping space.
- [ ] Put chest title, entries and action inside a vertical layout container.
- [ ] Verify focused layout tests.
### Task 3: Combat presentation and action wording
**Files:**
- Modify: `scripts/game/game.gd`
- Modify: `scripts/domain/turn_resolver.gd`
- Test: `tests/e2e/test_enemy_ai_e2e.gd`
- Test: `tests/unit/test_turn_resolver.gd`
**Interfaces:**
- Consumes: authoritative `ActorState.cell` positions and equipped main-hand metadata when available.
- Produces: synchronized enemy sprites after every resolved turn and melee messages that name the attack method.
- [ ] Add a failing E2E assertion that an enemy view follows the enemy state after movement.
- [ ] Resynchronize enemy views during player-action presentation updates.
- [ ] Add failing assertions that melee messages identify bare hands, equipped weapon, or natural attack while retaining damage wording.
- [ ] Add attack-method metadata to result messages without changing melee range rules.
- [ ] Verify focused combat tests.
### Task 4: Surface and procedural dungeon
**Files:**
- Modify: `scripts/domain/world/surface_generator.gd`
- Modify: `scripts/domain/world/floor_generator.gd`
- Modify: `scripts/game/game.gd`
- Modify: `tests/unit/test_surface_floor_transition.gd`
- Modify: `tests/unit/test_floor_generator_rooms.gd`
- Replace: `tests/unit/test_demo_map.gd`
- Replace: `tests/e2e/test_demo_map_chest_e2e.gd`
**Interfaces:**
- Consumes: reference surface contract (42×16, empty zone, corridor, door, stairs) and regular procedural formula `180 + floor*30`, `90 + floor*15`, `150 + floor*20`.
- Produces: the true reference surface at floor 0 and a 210×105, 170-room procedural floor 1.
- [ ] Add failing surface assertions for dimensions, empty population, entrance, door and stairs.
- [ ] Port the reference surface geometry.
- [ ] Add failing floor-1 profile assertions for map size and room target.
- [ ] Remove the obsolete shallow floor-1 profile and dead duplicate POC construction.
- [ ] Replace POC route tests with surface-to-generated-dungeon behavior tests.
- [ ] Verify world unit, integration and E2E tests.
### Task 5: Regression verification
**Files:**
- Modify only tests whose old expectations explicitly encoded the removed POC or creation-time class choice.
**Interfaces:**
- Consumes: `scripts/verify.sh` and focused GUT runners.
- Produces: passing unit, integration, E2E and visual verification without modifying `project.godot`.
- [ ] Run focused suites after every red/green cycle.
- [ ] Run `git diff --check`.
- [ ] Run `./scripts/verify.sh`.
- [ ] Inspect the regenerated visual captures for the main level, HUD and chest panel.
@@ -0,0 +1,107 @@
# Health Regeneration and Pets Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Porter dans le jeu Godot la régénération passive automatique des PV et rendre le familier créé avec la partie réellement configurable, persistant et utile en exploration/combat, conformément aux comportements de référence de DCWASCII.
**Architecture:** La formule de régénération reste une règle de domaine pure, appelée une seule fois à la fin de chaque tour résolu et appliquée silencieusement au joueur puis au familier vivant. Le familier reste l’agrégat `CompanionState` existant, enrichi avec son identité, ses caractéristiques de régénération et une IA agressive/défensive/soutien; la création, les transitions d’étage, l’UI et la sauvegarde consomment cet agrégat sans dupliquer les règles.
**Tech Stack:** Godot 4.7, GDScript, GUT 9.5, scènes `.tscn`, sauvegardes JSON.
**Spec:** Référence fonctionnelle `../DCWASCII/README.md` sections « Familier jouable » et « Système de soins », ainsi que `../DCWASCII/dcw/entities/{player,companion}.py`, `../DCWASCII/dcw/game.py`, `../DCWASCII/dcw/ai/companion_behaviors.py`.
## Global Constraints
- Préserver tous les changements locaux déjà présents; ne pas réinitialiser ni réécrire les modifications non liées.
- Régénération ASCII: `max(1, Endurance / 3)`, bonus `regen_bonus`, amplification de 15 % par rang de compétence Régénération au-delà du rang de base 1, puis multiplicateur de difficulté (1,5 / 1 / 0,75 / 0,5).
- La régénération est silencieuse, plafonnée aux PV max, active dès le niveau 1, une fois par tour consommé, et ne ranime jamais une entité morte.
- Le familier est optionnel, autonome, persistant, suit le joueur entre les étages et sa mort ne termine pas la partie.
- Conserver les coutures publiques et les sauvegardes existantes compatibles.
---
### Task 1: Passive health regeneration rule
**Files:**
- Create: `scripts/domain/combat/health_regeneration.gd`
- Test: `tests/unit/test_health_regeneration.gd`
**Interfaces:**
- Produces: `HealthRegeneration.amount(endurance: int, regeneration_skill: int, perk_bonus: int, difficulty_id: StringName) -> int`
- Produces: `HealthRegeneration.apply(actor: ActorState, endurance: int, regeneration_skill: int, perk_bonus: int, difficulty_id: StringName) -> int`
- [ ] **Step 1: Write the failing formula and cap/death tests**
- [ ] **Step 2: Run the focused test and confirm RED because the rule does not exist**
- [ ] **Step 3: Implement the exact ASCII formula and difficulty multipliers**
- [ ] **Step 4: Run the focused test and confirm GREEN**
### Task 2: End-of-turn regeneration integration
**Files:**
- Modify: `scripts/game/game.gd`
- Modify: `scripts/domain/entities/companion_state.gd`
- Test: `tests/e2e/test_health_regeneration_e2e.gd`
**Interfaces:**
- Consumes: `HealthRegeneration.apply(...)`
- Produces: automatic, silent player/pet healing through normal `submit_player_action` gameplay turns.
- [ ] **Step 1: Add an E2E test that damages the player, consumes real movement turns and observes exact healing without a regeneration journal event**
- [ ] **Step 2: Run it and confirm RED because completed turns do not heal**
- [ ] **Step 3: Add one centralized end-of-turn hook using the character model’s effective Endurance/skill/perk values and the run difficulty**
- [ ] **Step 4: Extend the test to a living pet and confirm dead actors remain at zero**
- [ ] **Step 5: Run focused unit/E2E tests and confirm GREEN**
### Task 3: Configurable pet identity and persistence
**Files:**
- Modify: `scripts/domain/run/run_settings.gd`
- Modify: `scripts/domain/entities/companion_state.gd`
- Modify: `scripts/presentation/menu/character_creation.gd`
- Modify: `scenes/menu/CharacterCreation.tscn`
- Modify: `scripts/infrastructure/save/save_repository.gd`
- Modify: `scripts/presentation/companion_panel.gd`
- Test: `tests/unit/test_companion.gd`
- Test: `tests/unit/test_save_repository.gd`
- Test: `tests/e2e/test_new_run_creation_e2e.gd`
**Interfaces:**
- Produces: optional `RunSettings.pet_name` and `RunSettings.pet_species`, with backward-compatible defaults.
- Produces: `CompanionState.name`, `species`, Endurance/skill/perk regeneration fields serialized with the companion.
- [ ] **Step 1: Add failing tests for identity defaults/custom values and save/load round-trip**
- [ ] **Step 2: Run focused tests and confirm RED**
- [ ] **Step 3: Add name/species fields shown only when the pet checkbox is enabled and pass them through `RunSettings`**
- [ ] **Step 4: Persist the complete companion record while accepting legacy companion records**
- [ ] **Step 5: Show name, species and PV in the companion panel**
- [ ] **Step 6: Run focused tests and confirm GREEN**
### Task 4: Functional autonomous pet behavior and floor following
**Files:**
- Modify: `scripts/domain/ai/companion_behaviors.gd`
- Modify: `scripts/domain/turn_resolver.gd`
- Modify: `scripts/game/game.gd`
- Test: `tests/unit/test_companion.gd`
- Test: `tests/e2e/test_pet_companion_e2e.gd`
**Interfaces:**
- Consumes: existing stances `FOLLOW`, `DEFEND`, `SUPPORT` as backward-compatible storage identifiers.
- Produces: aggressive chase/attack for `FOLLOW`, threat interception for `DEFEND`, low-PV player healing for `SUPPORT`, nearest-target enemy attacks, and adjacent pet placement after floor changes.
- [ ] **Step 1: Add one failing behavior test for aggressive chase and one for support healing**
- [ ] **Step 2: Run focused tests and confirm RED for the missing decisions**
- [ ] **Step 3: Implement deterministic nearest-enemy pursuit and a bounded support-heal action**
- [ ] **Step 4: Resolve heal actions and make enemies pursue/attack the nearer living player or pet, with ties favoring the pet**
- [ ] **Step 5: Add an E2E floor-transition assertion that the pet is placed next to the player**
- [ ] **Step 6: Run pet unit/integration/E2E tests and confirm GREEN**
### Task 5: Verification and parity evidence
**Files:**
- Modify: `docs/parity/ASCII_TEST_MATRIX.md` only if a new explicit mapping row/note is required.
- [ ] **Step 1: Run unit tests for regeneration, companions, settings and saves**
- [ ] **Step 2: Run pet/new-run/regeneration E2E tests**
- [ ] **Step 3: Run the project verification script and inspect failures**
- [ ] **Step 4: Confirm `git diff --check` and review the final diff for unrelated changes**
@@ -0,0 +1,103 @@
# Save, Ranged Combat, and Pet Controls Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Rendre la sauvegarde accessible sans menu Échap, déplacer l’attaque à distance sur `F` avec sélection de cible et tour ennemi immédiat, puis exposer trois comportements de familier en français avec un sprite temporaire de chien.
**Architecture:** Le menu principal reste le propriétaire du `SaveRepository`, mais le jeu actif lui demande d’ouvrir le panneau de sauvegarde par signal afin d’éviter un second dépôt et de conserver les cinq emplacements existants. Le ciblage à distance continue d’utiliser `RangedCombat` et `TargetingOverlay`; seules la touche, la validation des cibles et la résolution complète du tour sont renforcées. Les identifiants persistés des postures du familier restent compatibles, tandis que leurs libellés et règles deviennent « reste en arrière », « défends-moi » et « attaque à vue ».
**Tech Stack:** Godot 4.7, GDScript, GUT 9.5, scènes `.tscn`, sauvegardes JSON.
**Spec:** Retour de playtest utilisateur du 2026-10-08.
## Global Constraints
- Préserver tous les changements locaux déjà présents; ne pas réinitialiser ni réécrire les modifications non liées.
- L’attaque à distance se déclenche sur `F` seulement si une arme à distance est équipée; `Entrée` confirme et `Échap` annule la cible sans consommer de tour.
- Une attaque à distance valide consomme exactement un tour et fait immédiatement résoudre le déplacement ou l’attaque des adversaires survivants.
- Les trois comportements visibles du familier sont « Reste en arrière », « Défends-moi » et « Attaque à vue ».
- Le familier utilise temporairement un sprite animal de type chien compatible avec la licence CC0 existante.
- Conserver la lecture des anciennes sauvegardes et des anciennes valeurs de posture.
---
### Task 1: Sauvegarde accessible et explicite
**Files:**
- Modify: `project.godot`
- Modify: `scripts/game/input_bindings.gd`
- Modify: `scripts/game/game.gd`
- Modify: `scripts/presentation/menu/main_menu.gd`
- Modify: `scripts/presentation/save_load_panel.gd`
- Modify: `scenes/ui/SaveLoadPanel.tscn`
- Modify: `tests/unit/test_action_router.gd`
- Modify: `tests/e2e/test_save_load_e2e.gd`
- Modify: `docs/PLAYING.md`
**Interfaces:**
- Produces: input action `save` on `Ctrl+S`, routed as `PlayerAction(&"save")`.
- Produces: `Game.save_requested` connected by `MainMenu` to `show_save_slots()`.
- Produces: French save-panel feedback that states that saves are manual and confirms the slot written.
- [ ] Add a failing action-router assertion for `save` and an E2E test that `Ctrl+S` opens the save-slot panel during a run.
- [ ] Add the input binding/help label and the `Game.save_requested` signal branch.
- [ ] Connect the game signal in `MainMenu` and keep repository ownership there.
- [ ] Translate/clarify save-panel labels and update the player documentation.
- [ ] Run focused action-router and save/load tests.
### Task 2: Attaque à distance sur F et tour ennemi
**Files:**
- Modify: `project.godot`
- Modify: `scripts/game/input_bindings.gd`
- Modify: `scripts/game/game.gd`
- Modify: `scripts/presentation/targeting_overlay.gd`
- Modify: `tests/e2e/test_ranged_targeting_e2e.gd`
- Modify: `tests/e2e/test_input_action_router_e2e.gd`
- Modify: `docs/PLAYING.md`
**Interfaces:**
- Produces: `F` bound to `ranged`; the obsolete standalone `attack` input is removed because melee remains movement into an adjacent enemy.
- Produces: targeting candidates filtered by weapon range and line of sight.
- Consumes: `TurnResolver.append_enemy_response(...)` for every valid shot against a surviving enemy.
- [ ] Add failing E2E assertions proving `F` opens targeting, invalid/no-weapon input does not consume a turn, cancellation does not consume a turn, and a valid shot advances exactly one turn while the enemy approaches.
- [ ] Move `ranged` from `R` to `F` and remove the conflicting unused `attack` action from the input catalog/map.
- [ ] Filter displayed targets through `RangedCombat` validation without consuming ammunition.
- [ ] Keep confirmation/cancellation explicit in French and resolve one enemy response after a valid shot.
- [ ] Run focused ranged, input, turn-resolver, and combat tests.
### Task 3: Comportements du familier et sprite chien
**Files:**
- Modify: `scripts/domain/entities/companion_state.gd`
- Modify: `scripts/domain/ai/companion_behaviors.gd`
- Modify: `scripts/domain/turn_resolver.gd`
- Modify: `scripts/infrastructure/save/save_repository.gd`
- Modify: `scripts/presentation/companion_panel.gd`
- Modify: `scenes/Game.tscn`
- Create: `assets/dcss/war_dog.png`
- Modify: `assets/ASSET_REGISTRY.md`
- Modify: `tests/unit/test_companion.gd`
- Modify: `tests/e2e/test_pet_companion_e2e.gd`
**Interfaces:**
- Produces: persistent stances `stay_back`, `defend`, `attack_on_sight`, while mapping legacy `follow`, `defend`, `support` values.
- Produces: behavior rules where `stay_back` follows without engaging, `defend` attacks threats adjacent to the player, and `attack_on_sight` pursues the nearest living enemy.
- Produces: French UI labels/descriptions and `assets/dcss/war_dog.png` on `$World/Companion`.
- [ ] Add failing deterministic unit tests for the three named policies and an E2E panel-selection test for their French labels.
- [ ] Define the new stance identifiers and compatibility aliases/migration.
- [ ] Implement passive following, player defense, and nearest-enemy aggression.
- [ ] Replace support-only interception checks with the defend stance and update journal wording.
- [ ] Copy the local CC0 DCSS war-dog tile, wire it to the companion sprite, and register its source/license.
- [ ] Run focused companion, support-compatibility, save, and pet E2E tests.
### Task 4: Vérification
**Files:**
- Modify: `docs/parity/ASCII_TEST_MATRIX.md` only if a mapped contract needs an explicit note.
- [ ] Run all unit, integration, and E2E suites.
- [ ] Run the visual check and inspect the companion sprite and new HUD/help wording.
- [ ] Run `git diff --check` and inspect the final diff for unrelated changes.
@@ -0,0 +1,57 @@
# Temporary Starting Playtest Chests Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Garantir temporairement trois coffres dans la salle de départ d’une nouvelle partie pour tester la mêlée, la distance et un sort offensif.
**Architecture:** Un module `TemporaryPlaytestKit` isolé place trois coffres à récompense fixe sur l’étage de surface. `Game` l’appelle uniquement lors d’une nouvelle partie configurée, jamais lors du chargement d’une sauvegarde ni dans le générateur procédural. Les récompenses utilisent le flux normal des coffres; le payload de distance ajoute des munitions et le grimoire utilise l’effet normal `learn_spell`.
**Tech Stack:** Godot 4.5, GDScript, GUT.
**Spec:** Retour de playtest du 2026-10-08.
## Global Constraints
- Code explicitement temporaire et supprimable dans un fichier autonome.
- Exactement trois coffres de playtest sur une nouvelle surface.
- Aucun changement aux tables de loot ou aux étages procéduraux.
- Les sauvegardes chargées ne recréent pas les coffres.
- Récompenses fixes : mêlée, distance avec munitions, grimoire offensif.
---
### Task 1: Fixture temporaire de coffres
**Files:**
- Create: `scripts/game/temporary_playtest_kit.gd`
- Modify: `scripts/game/game.gd`
- Create: `tests/e2e/test_temporary_playtest_chests_e2e.gd`
**Interfaces:**
- Produces: `TemporaryPlaytestKit.apply_to_new_run(floor: FloorState) -> void`.
- [ ] Écrire un test E2E rouge instanciant une nouvelle partie et exigeant trois coffres fixes accessibles.
- [ ] Créer le module isolé avec trois cellules, trois récompenses et un marqueur metadata temporaire.
- [ ] Appeler le module seulement dans le chemin de nouvelle partie configurée.
- [ ] Vérifier qu’un chargement ne recrée aucun coffre.
### Task 2: Récompenses réellement testables
**Files:**
- Modify: `scripts/game/game.gd`
- Modify: `tests/e2e/test_temporary_playtest_chests_e2e.gd`
**Interfaces:**
- Consumes: payload coffre `ammunition` et effet d’objet `learn_spell`.
- Produces: munitions ajoutées lors de la récupération; `SpellState.learn(spell_id)` lors de l’utilisation du grimoire.
- [ ] Tester l’ouverture/récupération normale de chaque coffre.
- [ ] Ajouter les munitions du payload à `ActorState.ammunition` dans `_take_all_loot`.
- [ ] Après `InventoryState.use_item`, appliquer les effets `learn_spell` acceptés à `spell_state`.
- [ ] Vérifier qu’on peut équiper l’arme à distance, cibler avec F, et sélectionner le sort avec X après lecture.
### Task 3: Vérification
- [ ] Exécuter les tests ciblés coffre/inventaire/distance/magie.
- [ ] Exécuter les suites unitaires et E2E.
- [ ] Exécuter `git diff --check` et vérifier que le code temporaire reste contenu dans son module.
@@ -0,0 +1,144 @@
# UI, Input, Loot, and 1080p Fixes Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Corriger les panneaux à choix illisibles, rendre la sauvegarde accessible depuis le jeu embarqué dans l’éditeur, fiabiliser les flèches de déplacement, diversifier les coffres, matérialiser le butin des ennemis et migrer l’affichage de référence vers 1920×1080.
**Architecture:** Les panneaux modaux utilisent des conteneurs de mise en page plutôt que des offsets concurrents. Le routeur d’entrée conserve l’InputMap, mais expose une touche de sauvegarde sans modificateur qui n’est pas interceptée par l’éditeur et verrouille un seul déplacement par pression physique. Le résolveur de butin interdit de sélectionner deux fois le même objet pendant une résolution, tandis qu’une étape post-combat unique dans `Game` matérialise les tables de butin sur la cellule de mort pour toutes les voies létales. La résolution de référence devient un contrat 1920×1080 partagé par le projet, les tests et la capture visuelle.
**Tech Stack:** Godot 4.5, GDScript, GUT 9.5, scènes `.tscn`, JSON de contenu, scripts Bash/Python de vérification visuelle.
**Spec:** Retours de playtest et capture fournis le 2026-10-08.
## Global Constraints
- Préserver les nombreuses modifications locales déjà présentes et ne pas réinitialiser les fichiers hors périmètre.
- Les PNJ ne sont jamais des cibles de combat ou des sources de butin ennemi.
- Les corrections restent déterministes pour un seed et un contexte identiques.
- Les objets d’ennemis doivent être visibles au sol et passer par le flux de ramassage existant.
- Le viewport, la fenêtre de référence et les captures deviennent exactement 1920×1080.
- Les panneaux ne doivent plus superposer le récit, les choix et l’aide, y compris avec du texte long.
---
### Task 1: Résolution de référence 1920×1080
**Files:**
- Modify: `project.godot`
- Modify: `scripts/game/game.gd`
- Modify: `scripts/check-visual-capture.py`
- Modify: `scripts/run-visual-check.sh`
- Modify: `scripts/build-linux.sh`
- Modify: `tests/scripts/test_godot_import_runners.sh`
- Modify: `tests/unit/test_display_layout.gd`
- Modify: `tests/e2e/test_display_camera_grid_e2e.gd`
- Modify: `tests/unit/test_hud_layout.gd`
- Modify: `docs/PLAYING.md`
**Interfaces:**
- Produces: `Game.REFERENCE_VIEWPORT == Vector2i(1920, 1080)`.
- Produces: exact 1920×1080 PNG visual captures and smoke displays.
- [ ] Add failing assertions for the new project and `Game` reference dimensions.
- [ ] Change project viewport/window overrides and the public game constant.
- [ ] Update Xvfb, fake PNG and PNG validation dimensions; derive the measured dungeon crop from the new dimensions.
- [ ] Re-express the central HUD clearance area relative to `REFERENCE_VIEWPORT`.
- [ ] Run display, HUD, E2E camera and script-runner tests.
### Task 2: Panneaux de choix adaptatifs et non chevauchants
**Files:**
- Modify: `scenes/ui/EventPanel.tscn`
- Modify: `scenes/ui/DialoguePanel.tscn`
- Modify: `scenes/ui/QuestPanel.tscn`
- Modify: `scripts/presentation/event_panel.gd`
- Modify: `scripts/presentation/dialogue_panel.gd`
- Modify: `scripts/presentation/quest_panel.gd`
- Modify: affected E2E node paths
- Create: `tests/unit/test_choice_panel_layout.gd`
**Interfaces:**
- Produces: each modal as `PanelContainer > VBoxContainer Layout > Title, Body, Entries, Help`.
- Produces: distinct, contained narrative, choice and help rectangles at 1920×1080.
- [ ] Write a failing rectangle test with representative multiline narrative and choices for Event, Dialogue and Quest.
- [ ] Replace direct children and absolute offsets with one `VBoxContainer`, content margins and explicit vertical allocation.
- [ ] Update scripts and E2E paths from `$Body`/`$Entries` to `$Layout/Body`/`$Layout/Entries`.
- [ ] Verify at least 12 px logical separation and containment after two layout frames.
- [ ] Run choice-panel, dialogue, event and quest tests.
### Task 3: Sauvegarde utilisable depuis le debug embarqué et entrée fiable
**Files:**
- Modify: `project.godot`
- Modify: `scripts/game/input_bindings.gd`
- Modify: `scripts/game/action_router.gd`
- Modify: `scripts/game/game.gd`
- Modify: `scenes/Game.tscn`
- Modify: `tests/unit/test_action_router.gd`
- Modify: `tests/e2e/test_save_load_e2e.gd`
- Modify: `tests/e2e/test_input_action_router_e2e.gd`
- Modify: `docs/PLAYING.md`
**Interfaces:**
- Consumes: existing `save` player action and `Game.save_requested` signal.
- Produces: `V` as editor-safe save shortcut while retaining `Ctrl+S` for standalone/exported builds.
- Produces: one movement action per non-echo physical arrow press.
- [ ] Add a failing E2E test that opens save slots with plain `V` through real input.
- [ ] Add `V` as a second `save` binding and document why `Ctrl+S` is intercepted by the Godot editor’s own Save command in embedded play.
- [ ] Add a repeated alternating Up/Down E2E test proving every press is routed once and echo events do not create or swallow actions.
- [ ] Handle arrow physical keycodes deterministically before ambiguous action matching and ignore `InputEventKey.echo` for turn commands.
- [ ] Update the HUD/help text and run action/input/save tests.
### Task 4: Coffres sans objets répétés
**Files:**
- Modify: `scripts/domain/items/loot_resolver.gd`
- Modify: `scripts/domain/world/floor_populator.gd`
- Modify: `tests/unit/test_loot_resolver.gd`
- Modify: `tests/unit/test_floor_populator.gd`
- Modify: `tests/e2e/test_world_chest_loot_e2e.gd`
**Interfaces:**
- Produces: `LootResolver.resolve(...)` selects each `item_id` at most once per reward; explicit `min_qty/max_qty` remains the sole source of quantity.
- Produces: ordinary treasure rooms use `floor_treasure`, not arbitrary enemy or boss tables.
- [ ] Add a failing dominant-weight multi-roll test showing the same item is currently selected twice.
- [ ] Filter already-selected item IDs from subsequent weighted rolls while leaving gold/empty repeatable.
- [ ] Assert that generated treasure chests use the floor treasure table.
- [ ] Run resolver, chest, population and deterministic-generation tests.
### Task 5: Butin ennemi matérialisé et ramassable
**Files:**
- Modify: `scripts/game/game.gd`
- Modify: `scripts/domain/magic/magic_engine.gd`
- Modify: `scripts/presentation/loot_feedback.gd`
- Modify: `tests/e2e/test_melee_feedback_e2e.gd`
- Modify: `tests/e2e/test_ranged_targeting_e2e.gd`
- Modify: `tests/e2e/test_spell_casting_e2e.gd`
- Modify: `tests/unit/test_save_repository.gd`
**Interfaces:**
- Produces: one post-combat materialization step that resolves each `loot_dropped` descriptor exactly once.
- Produces: valid `ItemInstance` entries in `FloorState.ground_items[death_cell]` and immediate run gold credit.
- Produces: resolved `loot_dropped` payload containing `loot_table`, `items`, `gold`, and `empty`.
- [ ] Add a failing melee E2E assertion that a catalog-backed killed enemy leaves a ground item at its death cell.
- [ ] Resolve the enemy loot table using a stable `enemy:<floor>:<actor_id>` context before event journaling, create item instances, add them to `ground_items`, and credit gold.
- [ ] Add the missing loot descriptor to lethal spell outcomes so magic shares the same post-combat pipeline.
- [ ] Verify melee, ranged, companion and spell deaths each materialize once, and the existing interaction picks the item up.
- [ ] Verify save/load round-trips the generated drop and update feedback wording from “secured” to “dropped”.
### Task 6: Verification complète
**Files:**
- Modify: no production files unless a verified regression requires it.
- [ ] Run all unit tests.
- [ ] Run all integration tests.
- [ ] Run all E2E tests.
- [ ] Run visual capture and inspect both 1920×1080 images.
- [ ] Run matrix parity gate and `git diff --check`.
- [ ] Review the final diff for unrelated or generated temporary files.
+178 -42
View File
@@ -1,56 +1,192 @@
; Engine configuration file. ; Engine configuration file.
; GUT 9.5.0 is pinned under addons/gut. ; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5 config_version=5
[application] [application]
config/name="Dungeon Crawler World" config/name="Dungeon Crawler World"
run/main_scene="res://scenes/menu/MainMenu.tscn" run/main_scene="res://scenes/menu/MainMenu.tscn"
config/features=PackedStringArray("4.7")
[display] [display]
window/size/viewport_width=1280
window/size/viewport_height=720 window/size/viewport_width=1920
window/size/window_width_override=1280 window/size/viewport_height=1080
window/size/window_height_override=720 window/size/window_width_override=1920
window/size/resizable=true window/size/window_height_override=1080
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/default_filters/use_nearest_mipmap_filter=false
textures/canvas_textures/default_texture_filter=0
[editor_plugins] [editor_plugins]
enabled=PackedStringArray("res://addons/gut/plugin.cfg") enabled=PackedStringArray("res://addons/gut/plugin.cfg")
[input] [input]
interact={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":32),Object(InputEventKey,"physical_keycode":69)]}
move_north={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":87),Object(InputEventKey,"physical_keycode":4194320)]} interact={
move_south={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":83),Object(InputEventKey,"physical_keycode":4194322)]} "deadzone": 0.5,
move_west={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":65),Object(InputEventKey,"physical_keycode":4194319)]} "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":32,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
move_east={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":68),Object(InputEventKey,"physical_keycode":4194321)]} , 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":69,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
move_northwest={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":81)]} ]
move_northeast={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":4194447)]} }
move_southwest={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":90)]} move_north={
move_southeast={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":67)]} "deadzone": 0.5,
wait={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":46)]} "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":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
attack={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":70)]} , 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":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
ranged={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":82)]} ]
cast={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":88)]} }
talk={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":84)]} move_south={
rest={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":72)]} "deadzone": 0.5,
inventory={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":73)]} "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":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
crafting={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":66)]} , 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":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
character={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":80)]} ]
quest={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":74)]} }
companion={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":75)]} move_west={
party={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":71)]} "deadzone": 0.5,
achievements={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":76)]} "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":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
audience={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":85)]} , 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":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
recap={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":89)]} ]
factions={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":77)]} }
moderation={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":78)]} move_east={
map={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":4194308)]} "deadzone": 0.5,
help={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":4194332)]} "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":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
toggle_log={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":76)]} , 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":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
options={"deadzone":0.5,"events":[Object(InputEventKey,"physical_keycode":79)]} ]
}
move_northwest={
"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":81,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_northeast={
"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":4194447,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_southwest={
"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":90,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
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)
]
}
wait={
"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":46,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ranged={
"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":70,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
save={
"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":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, 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":86,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
cast={
"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":88,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
talk={
"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":84,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
rest={
"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":72,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
inventory={
"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":73,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
crafting={
"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":66,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
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)
]
}
quest={
"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":74,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
companion={
"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":75,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
party={
"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":71,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
achievements={
"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":76,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
audience={
"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":85,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
recap={
"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":89,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
factions={
"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":77,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
moderation={
"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":78,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
map={
"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":4194308,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
help={
"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":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
toggle_log={
"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":76,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
options={
"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":79,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
+99 -32
View File
@@ -1,10 +1,11 @@
[gd_scene load_steps=20 format=3] [gd_scene load_steps=24 format=3]
[ext_resource type="Script" path="res://scripts/game/game.gd" id="1_game"] [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"] [ext_resource type="Script" path="res://scripts/presentation/map_renderer.gd" id="2_map"]
[ext_resource type="Script" path="res://scripts/presentation/actor_view.gd" id="3_actor"] [ext_resource type="Script" path="res://scripts/presentation/actor_view.gd" id="3_actor"]
[ext_resource type="Script" path="res://scripts/presentation/hud.gd" id="4_hud"] [ext_resource type="Script" path="res://scripts/presentation/hud.gd" id="4_hud"]
[ext_resource type="Texture2D" path="res://assets/dcss/player.png" id="5_player"] [ext_resource type="Texture2D" path="res://assets/dcss/player.png" id="5_player"]
[ext_resource type="Texture2D" path="res://assets/dcss/war_dog.png" id="35_companion"]
[ext_resource type="Script" path="res://scripts/infrastructure/audio_library.gd" id="6_audio"] [ext_resource type="Script" path="res://scripts/infrastructure/audio_library.gd" id="6_audio"]
[ext_resource type="Script" path="res://scripts/presentation/event_presenter.gd" id="7_presenter"] [ext_resource type="Script" path="res://scripts/presentation/event_presenter.gd" id="7_presenter"]
[ext_resource type="PackedScene" path="res://scenes/overlays/CombatFeedback.tscn" id="8_feedback"] [ext_resource type="PackedScene" path="res://scenes/overlays/CombatFeedback.tscn" id="8_feedback"]
@@ -23,6 +24,7 @@
[ext_resource type="PackedScene" path="res://scenes/ui/PartyPanel.tscn" id="19_party"] [ext_resource type="PackedScene" path="res://scenes/ui/PartyPanel.tscn" id="19_party"]
[ext_resource type="PackedScene" path="res://scenes/ui/CharacterPanel.tscn" id="20_character"] [ext_resource type="PackedScene" path="res://scenes/ui/CharacterPanel.tscn" id="20_character"]
[ext_resource type="PackedScene" path="res://scenes/ui/ProgressionChoicePanel.tscn" id="21_progression_choice"] [ext_resource type="PackedScene" path="res://scenes/ui/ProgressionChoicePanel.tscn" id="21_progression_choice"]
[ext_resource type="PackedScene" path="res://scenes/ui/RaceClassChoicePanel.tscn" id="34_race_class_choice"]
[ext_resource type="PackedScene" path="res://scenes/ui/AchievementPanel.tscn" id="22_achievement"] [ext_resource type="PackedScene" path="res://scenes/ui/AchievementPanel.tscn" id="22_achievement"]
[ext_resource type="PackedScene" path="res://scenes/ui/AudiencePanel.tscn" id="23_audience"] [ext_resource type="PackedScene" path="res://scenes/ui/AudiencePanel.tscn" id="23_audience"]
[ext_resource type="PackedScene" path="res://scenes/ui/RecapPanel.tscn" id="24_recap"] [ext_resource type="PackedScene" path="res://scenes/ui/RecapPanel.tscn" id="24_recap"]
@@ -50,6 +52,25 @@ content_margin_top = 8.0
content_margin_right = 12.0 content_margin_right = 12.0
content_margin_bottom = 8.0 content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBox_xp_background"]
bg_color = Color(0.025, 0.055, 0.075, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(0.35, 0.48, 0.62, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[sub_resource type="StyleBoxFlat" id="StyleBox_xp_fill"]
bg_color = Color(0.35, 0.72, 1, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
[sub_resource type="StyleBoxFlat" id="StyleBox_prompt_panel"] [sub_resource type="StyleBoxFlat" id="StyleBox_prompt_panel"]
bg_color = Color(0.08, 0.12, 0.16, 0.94) bg_color = Color(0.08, 0.12, 0.16, 0.94)
border_width_left = 2 border_width_left = 2
@@ -92,8 +113,7 @@ script = ExtResource("3_actor")
[node name="Enemies" type="Node2D" parent="World"] [node name="Enemies" type="Node2D" parent="World"]
[node name="Companion" type="Sprite2D" parent="World"] [node name="Companion" type="Sprite2D" parent="World"]
texture = ExtResource("5_player") texture = ExtResource("35_companion")
modulate = Color(0.62, 0.87, 1, 1)
script = ExtResource("3_actor") script = ExtResource("3_actor")
[node name="Party" type="Node2D" parent="World"] [node name="Party" type="Node2D" parent="World"]
@@ -132,6 +152,8 @@ script = ExtResource("4_hud")
[node name="ProgressionChoicePanel" parent="HUD" instance=ExtResource("21_progression_choice")] [node name="ProgressionChoicePanel" parent="HUD" instance=ExtResource("21_progression_choice")]
[node name="RaceClassChoicePanel" parent="HUD" instance=ExtResource("34_race_class_choice")]
[node name="AchievementPanel" parent="HUD" instance=ExtResource("22_achievement")] [node name="AchievementPanel" parent="HUD" instance=ExtResource("22_achievement")]
[node name="AudiencePanel" parent="HUD" instance=ExtResource("23_audience")] [node name="AudiencePanel" parent="HUD" instance=ExtResource("23_audience")]
@@ -153,19 +175,29 @@ script = ExtResource("4_hud")
[node name="HelpPanel" parent="HUD" instance=ExtResource("30_help")] [node name="HelpPanel" parent="HUD" instance=ExtResource("30_help")]
[node name="AchievementToast" type="Label" parent="HUD"] [node name="AchievementToast" type="Label" parent="HUD"]
offset_left = 390.0 layout_mode = 1
anchors_preset = 10
anchor_left = 0.5
anchor_right = 0.5
offset_left = -360.0
offset_top = 18.0 offset_top = 18.0
offset_right = 890.0 offset_right = 360.0
offset_bottom = 48.0 offset_bottom = 48.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.82, 0.42, 1) theme_override_colors/font_color = Color(1, 0.82, 0.42, 1)
theme_override_font_sizes/font_size = 18 theme_override_font_sizes/font_size = 18
horizontal_alignment = 1 horizontal_alignment = 1
[node name="TitleLabel" type="Label" parent="HUD"] [node name="TitleLabel" type="Label" parent="HUD"]
offset_left = 390.0 layout_mode = 1
anchors_preset = 10
anchor_left = 0.5
anchor_right = 0.5
offset_left = -360.0
offset_top = 48.0 offset_top = 48.0
offset_right = 890.0 offset_right = 360.0
offset_bottom = 74.0 offset_bottom = 74.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0.75, 0.94, 0.55, 1) theme_override_colors/font_color = Color(0.75, 0.94, 0.55, 1)
theme_override_font_sizes/font_size = 16 theme_override_font_sizes/font_size = 16
horizontal_alignment = 1 horizontal_alignment = 1
@@ -184,8 +216,8 @@ layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 12.0 offset_left = 12.0
offset_top = 12.0 offset_top = 12.0
offset_right = 248.0 offset_right = 298.0
offset_bottom = 170.0 offset_bottom = 250.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_styles/panel = SubResource("StyleBox_hud_panel") theme_override_styles/panel = SubResource("StyleBox_hud_panel")
@@ -237,7 +269,7 @@ layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 26.0 offset_top = 26.0
offset_right = 236.0 offset_right = 286.0
offset_bottom = 46.0 offset_bottom = 46.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
@@ -248,21 +280,54 @@ theme_override_font_sizes/font_size = 18
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 48.0 offset_top = 47.0
offset_right = 236.0 offset_right = 286.0
offset_bottom = 68.0 offset_bottom = 73.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(0.7, 0.8, 1, 1) theme_override_colors/font_color = Color(0.7, 0.8, 1, 1)
theme_override_font_sizes/font_size = 18 theme_override_font_sizes/font_size = 18
[node name="ExperienceBar" type="ProgressBar" parent="HUD"]
layout_mode = 1
anchors_preset = 0
offset_left = 26.0
offset_top = 74.0
offset_right = 286.0
offset_bottom = 94.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
theme_override_styles/background = SubResource("StyleBox_xp_background")
theme_override_styles/fill = SubResource("StyleBox_xp_fill")
show_percentage = false
[node name="ExperienceLabel" type="Label" parent="HUD"]
layout_mode = 1
anchors_preset = 0
offset_left = 30.0
offset_top = 74.0
offset_right = 282.0
offset_bottom = 94.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
theme_override_colors/font_color = Color(0.92, 0.97, 1, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9)
theme_override_constants/shadow_offset_x = 1
theme_override_constants/shadow_offset_y = 1
theme_override_font_sizes/font_size = 14
text = "Niveau 1 — XP 0/100"
horizontal_alignment = 1
vertical_alignment = 1
[node name="GoldLabel" type="Label" parent="HUD"] [node name="GoldLabel" type="Label" parent="HUD"]
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 70.0 offset_top = 96.0
offset_right = 236.0 offset_right = 286.0
offset_bottom = 90.0 offset_bottom = 122.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(1, 0.84, 0.35, 1) theme_override_colors/font_color = Color(1, 0.84, 0.35, 1)
@@ -273,9 +338,9 @@ text = "Or: 0"
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 92.0 offset_top = 123.0
offset_right = 360.0 offset_right = 286.0
offset_bottom = 112.0 offset_bottom = 143.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(0.65, 1, 0.72, 1) theme_override_colors/font_color = Color(0.65, 1, 0.72, 1)
@@ -286,9 +351,9 @@ text = "Quêtes : aucune"
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 92.0 offset_top = 144.0
offset_right = 360.0 offset_right = 286.0
offset_bottom = 112.0 offset_bottom = 164.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(0.82, 0.7, 1, 1) theme_override_colors/font_color = Color(0.82, 0.7, 1, 1)
@@ -298,9 +363,9 @@ theme_override_font_sizes/font_size = 14
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 114.0 offset_top = 165.0
offset_right = 236.0 offset_right = 286.0
offset_bottom = 134.0 offset_bottom = 191.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(1, 0.8, 0.7, 1) theme_override_colors/font_color = Color(1, 0.8, 0.7, 1)
@@ -310,9 +375,9 @@ theme_override_font_sizes/font_size = 18
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 114.0 offset_top = 192.0
offset_right = 236.0 offset_right = 286.0
offset_bottom = 134.0 offset_bottom = 215.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1) theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
@@ -322,13 +387,15 @@ theme_override_font_sizes/font_size = 16
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
offset_left = 26.0 offset_left = 26.0
offset_top = 138.0 offset_top = 216.0
offset_right = 360.0 offset_right = 286.0
offset_bottom = 158.0 offset_bottom = 246.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(1, 0.76, 0.4, 1) theme_override_colors/font_color = Color(1, 0.76, 0.4, 1)
theme_override_font_sizes/font_size = 14 theme_override_font_sizes/font_size = 14
autowrap_mode = 2
clip_text = true
[node name="EventLog" type="RichTextLabel" parent="HUD"] [node name="EventLog" type="RichTextLabel" parent="HUD"]
layout_mode = 1 layout_mode = 1
@@ -378,6 +445,6 @@ grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
theme_override_colors/font_color = Color(0.82, 0.9, 1, 1) theme_override_colors/font_color = Color(0.82, 0.9, 1, 1)
theme_override_font_sizes/font_size = 14 theme_override_font_sizes/font_size = 14
text = "Déplacer : ZQSD / Flèches (nord-est : pavé num. 9) • Interagir : Espace ou E" text = "Déplacer : ZQSD / Flèches (nord-est : pavé num. 9) • Interagir : Espace ou E • Distance : F • Familier : K • Sauvegarder : V / Ctrl+S • Aide : F1"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
+17 -34
View File
@@ -35,9 +35,9 @@ anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -270.0 offset_left = -270.0
offset_top = -350.0 offset_top = -310.0
offset_right = 270.0 offset_right = 270.0
offset_bottom = 350.0 offset_bottom = 310.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_panel") theme_override_styles/panel = SubResource("StyleBox_panel")
@@ -68,43 +68,26 @@ custom_minimum_size = Vector2(0, 31)
layout_mode = 2 layout_mode = 2
placeholder_text = "Sans-Nom" placeholder_text = "Sans-Nom"
[node name="ArchetypeLabel" type="Label" parent="Panel/Layout/Fields"]
layout_mode = 2
text = "Base archetype"
[node name="ArchetypeOption" type="OptionButton" parent="Panel/Layout/Fields"]
custom_minimum_size = Vector2(0, 31)
layout_mode = 2
item_count = 3
selected = 0
popup/item_0/text = "Vanguard"
popup/item_0/id = 0
popup/item_0/metadata = "vanguard"
popup/item_1/text = "Mystic"
popup/item_1/id = 1
popup/item_1/metadata = "mystic"
popup/item_2/text = "Scout"
popup/item_2/id = 2
popup/item_2/metadata = "scout"
[node name="RaceLabel" type="Label" parent="Panel/Layout/Fields"]
layout_mode = 2
text = "Race"
[node name="RaceOption" type="OptionButton" parent="Panel/Layout/Fields"]
custom_minimum_size = Vector2(0, 31)
layout_mode = 2
[node name="RecommendationLabel" type="Label" parent="Panel/Layout/Fields"]
layout_mode = 2
autowrap_mode = 2
theme_override_colors/font_color = Color(0.72, 0.8, 0.92, 1)
[node name="PetCheck" type="CheckBox" parent="Panel/Layout/Fields"] [node name="PetCheck" type="CheckBox" parent="Panel/Layout/Fields"]
custom_minimum_size = Vector2(0, 27) custom_minimum_size = Vector2(0, 27)
layout_mode = 2 layout_mode = 2
text = "Bring a pet companion" text = "Bring a pet companion"
[node name="PetDetails" type="VBoxContainer" parent="Panel/Layout/Fields"]
visible = false
layout_mode = 2
theme_override_constants/separation = 4
[node name="PetNameEdit" type="LineEdit" parent="Panel/Layout/Fields/PetDetails"]
custom_minimum_size = Vector2(0, 31)
layout_mode = 2
placeholder_text = "Pet name (Familier)"
[node name="PetSpeciesEdit" type="LineEdit" parent="Panel/Layout/Fields/PetDetails"]
custom_minimum_size = Vector2(0, 31)
layout_mode = 2
placeholder_text = "Nature / species (Animal)"
[node name="SeedLabel" type="Label" parent="Panel/Layout/Fields"] [node name="SeedLabel" type="Label" parent="Panel/Layout/Fields"]
layout_mode = 2 layout_mode = 2
text = "Generation seed" text = "Generation seed"
+46 -25
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 32.0
content_margin_top = 22.0
content_margin_right = 32.0
content_margin_bottom = 22.0
[node name="DeathPanel" type="PanelContainer"] [node name="DeathPanel" type="PanelContainer"]
visible = false visible = false
@@ -22,40 +26,57 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -310.0 offset_left = -340.0
offset_top = -190.0 offset_top = -230.0
offset_right = 310.0 offset_right = 340.0
offset_bottom = 190.0 offset_bottom = 230.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_death_panel") theme_override_styles/panel = SubResource("StyleBox_death_panel")
script = ExtResource("1_death") script = ExtResource("1_death")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 16
anchor_left = 0.5
anchor_right = 0.5 [node name="Title" type="Label" parent="Layout"]
offset_left = -260.0 custom_minimum_size = Vector2(0, 42)
offset_top = 22.0 layout_mode = 2
offset_right = 260.0
offset_bottom = 54.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.38, 0.34, 1) theme_override_colors/font_color = Color(1, 0.38, 0.34, 1)
theme_override_font_sizes/font_size = 27 theme_override_font_sizes/font_size = 27
text = "VOUS ÊTES MORT" text = "VOUS ÊTES MORT"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
[node name="Body" type="RichTextLabel" parent="."] [node name="Body" type="RichTextLabel" parent="Layout"]
layout_mode = 1 layout_mode = 2
anchors_preset = 15 size_flags_vertical = 3
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 40.0
offset_top = 75.0
offset_right = -40.0
offset_bottom = -34.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/default_color = Color(1, 0.91, 0.9, 1) theme_override_colors/default_color = Color(1, 0.91, 0.9, 1)
theme_override_font_sizes/normal_font_size = 18 theme_override_font_sizes/normal_font_size = 18
[node name="Hint" type="Label" parent="Layout"]
custom_minimum_size = Vector2(0, 24)
layout_mode = 2
theme_override_colors/font_color = Color(1, 0.78, 0.72, 1)
theme_override_font_sizes/font_size = 15
horizontal_alignment = 1
[node name="Actions" type="HBoxContainer" parent="Layout"]
layout_mode = 2
theme_override_constants/separation = 12
alignment = 1
[node name="LoadButton" type="Button" parent="Layout/Actions"]
custom_minimum_size = Vector2(170, 42)
layout_mode = 2
text = "CHARGER"
[node name="NewRunButton" type="Button" parent="Layout/Actions"]
custom_minimum_size = Vector2(190, 42)
layout_mode = 2
text = "NOUVELLE PARTIE"
[node name="MenuButton" type="Button" parent="Layout/Actions"]
custom_minimum_size = Vector2(150, 42)
layout_mode = 2
text = "MENU PRINCIPAL"
+35 -55
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 36.0
content_margin_top = 28.0
content_margin_right = 36.0
content_margin_bottom = 28.0
[node name="DialoguePanel" type="PanelContainer"] [node name="DialoguePanel" type="PanelContainer"]
visible = false visible = false
@@ -22,70 +26,46 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -300.0 offset_left = -480.0
offset_top = -205.0 offset_top = -360.0
offset_right = 300.0 offset_right = 480.0
offset_bottom = 205.0 offset_bottom = 360.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_dialogue_panel") theme_override_styles/panel = SubResource("StyleBox_dialogue_panel")
script = ExtResource("1_dialogue") script = ExtResource("1_dialogue")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 16
anchor_left = 0.5
anchor_right = 0.5
offset_left = -270.0
offset_top = 18.0
offset_right = 270.0
offset_bottom = 46.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0.55, 0.9, 1, 1)
theme_override_font_sizes/font_size = 21
horizontal_alignment = 1
[node name="Body" type="RichTextLabel" parent="."] [node name="Title" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 42)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 theme_override_colors/font_color = Color(0.55, 0.9, 1, 1)
anchor_bottom = 1.0 theme_override_font_sizes/font_size = 24
offset_left = 30.0 horizontal_alignment = 1
offset_top = 58.0 vertical_alignment = 1
offset_right = -30.0
offset_bottom = -175.0 [node name="Body" type="RichTextLabel" parent="Layout"]
grow_horizontal = 2 custom_minimum_size = Vector2(0, 300)
grow_vertical = 2 layout_mode = 2
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 18 theme_override_font_sizes/normal_font_size = 20
[node name="Entries" type="RichTextLabel" parent="."] [node name="Entries" type="RichTextLabel" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 190)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 size_flags_vertical = 3
anchor_bottom = 1.0
offset_left = 30.0
offset_top = 238.0
offset_right = -30.0
offset_bottom = -48.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/default_color = Color(1, 0.9, 0.5, 1) theme_override_colors/default_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/normal_font_size = 17 theme_override_font_sizes/normal_font_size = 19
[node name="Help" type="Label" parent="."] [node name="Help" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 34)
anchors_preset = 10 layout_mode = 2
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -270.0
offset_top = -42.0
offset_right = 270.0
offset_bottom = -18.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0.55, 0.9, 1, 1) theme_override_colors/font_color = Color(0.55, 0.9, 1, 1)
theme_override_font_sizes/font_size = 16 theme_override_font_sizes/font_size = 17
text = "↑/↓ Choisir Entrée Confirmer Échap Partir" text = "↑/↓ Choisir Entrée Confirmer Échap Partir"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
+35 -55
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 36.0
content_margin_top = 28.0
content_margin_right = 36.0
content_margin_bottom = 28.0
[node name="EventPanel" type="PanelContainer"] [node name="EventPanel" type="PanelContainer"]
visible = false visible = false
@@ -22,70 +26,46 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -300.0 offset_left = -480.0
offset_top = -205.0 offset_top = -360.0
offset_right = 300.0 offset_right = 480.0
offset_bottom = 205.0 offset_bottom = 360.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_event_panel") theme_override_styles/panel = SubResource("StyleBox_event_panel")
script = ExtResource("1_event") script = ExtResource("1_event")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 16
anchor_left = 0.5
anchor_right = 0.5
offset_left = -270.0
offset_top = 18.0
offset_right = 270.0
offset_bottom = 46.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.84, 0.42, 1)
theme_override_font_sizes/font_size = 21
horizontal_alignment = 1
[node name="Body" type="RichTextLabel" parent="."] [node name="Title" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 42)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 theme_override_colors/font_color = Color(1, 0.84, 0.42, 1)
anchor_bottom = 1.0 theme_override_font_sizes/font_size = 24
offset_left = 30.0 horizontal_alignment = 1
offset_top = 58.0 vertical_alignment = 1
offset_right = -30.0
offset_bottom = -175.0 [node name="Body" type="RichTextLabel" parent="Layout"]
grow_horizontal = 2 custom_minimum_size = Vector2(0, 300)
grow_vertical = 2 layout_mode = 2
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 18 theme_override_font_sizes/normal_font_size = 20
[node name="Entries" type="RichTextLabel" parent="."] [node name="Entries" type="RichTextLabel" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 190)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 size_flags_vertical = 3
anchor_bottom = 1.0
offset_left = 30.0
offset_top = 238.0
offset_right = -30.0
offset_bottom = -48.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/default_color = Color(1, 0.9, 0.5, 1) theme_override_colors/default_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/normal_font_size = 17 theme_override_font_sizes/normal_font_size = 19
[node name="Help" type="Label" parent="."] [node name="Help" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 34)
anchors_preset = 10 layout_mode = 2
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -270.0
offset_top = -42.0
offset_right = 270.0
offset_bottom = -18.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.84, 0.42, 1) theme_override_colors/font_color = Color(1, 0.84, 0.42, 1)
theme_override_font_sizes/font_size = 16 theme_override_font_sizes/font_size = 17
text = "↑/↓ Choisir Entrée Confirmer Échap Partir" text = "↑/↓ Choisir Entrée Confirmer Échap Partir"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
+43 -25
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 24.0
content_margin_top = 18.0
content_margin_right = 24.0
content_margin_bottom = 18.0
[node name="InventoryPanel" type="PanelContainer"] [node name="InventoryPanel" type="PanelContainer"]
visible = false visible = false
@@ -23,43 +27,57 @@ anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -400.0 offset_left = -400.0
offset_top = -235.0 offset_top = -260.0
offset_right = 400.0 offset_right = 400.0
offset_bottom = 235.0 offset_bottom = 260.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_inventory_panel") theme_override_styles/panel = SubResource("StyleBox_inventory_panel")
script = ExtResource("1_inventory") script = ExtResource("1_inventory")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 12
anchor_left = 0.5
anchor_right = 0.5 [node name="Title" type="Label" parent="Layout"]
offset_left = -350.0 custom_minimum_size = Vector2(0, 34)
offset_top = 18.0 layout_mode = 2
offset_right = 350.0
offset_bottom = 46.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1) theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "INVENTORY" text = "INVENTAIRE"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
[node name="Entries" type="RichTextLabel" parent="."] [node name="Columns" type="HBoxContainer" parent="Layout"]
layout_mode = 0 layout_mode = 2
offset_left = 28.0 size_flags_vertical = 3
offset_top = 66.0 theme_override_constants/separation = 20
offset_right = 355.0
offset_bottom = 400.0 [node name="Entries" type="RichTextLabel" parent="Layout/Columns"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 18 theme_override_font_sizes/normal_font_size = 18
scroll_active = true
scroll_following = false
[node name="Details" type="RichTextLabel" parent="."] [node name="Details" type="RichTextLabel" parent="Layout/Columns"]
layout_mode = 0 custom_minimum_size = Vector2(400, 0)
offset_left = 380.0 layout_mode = 2
offset_top = 66.0 size_flags_horizontal = 3
offset_right = 770.0 size_flags_vertical = 3
offset_bottom = 420.0
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 17 theme_override_font_sizes/normal_font_size = 17
scroll_active = true
scroll_following = false
[node name="Footer" type="Label" parent="Layout"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/font_size = 16
text = "↑/↓ Sélectionner E Équiper U Utiliser D Jeter I Fermer"
horizontal_alignment = 1
vertical_alignment = 1
+20 -34
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 30.0
content_margin_top = 18.0
content_margin_right = 30.0
content_margin_bottom = 18.0
[node name="LootPanel" type="PanelContainer"] [node name="LootPanel" type="PanelContainer"]
visible = false visible = false
@@ -31,49 +35,31 @@ grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_loot_panel") theme_override_styles/panel = SubResource("StyleBox_loot_panel")
script = ExtResource("1_loot") script = ExtResource("1_loot")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 14
anchor_left = 0.5
anchor_right = 0.5 [node name="Title" type="Label" parent="Layout"]
offset_left = -180.0 custom_minimum_size = Vector2(0, 34)
offset_top = 18.0 layout_mode = 2
offset_right = 180.0
offset_bottom = 46.0
grow_horizontal = 2
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1) theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/font_size = 24 theme_override_font_sizes/font_size = 24
text = "COFFRE OUVERT" text = "COFFRE OUVERT"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
[node name="Entries" type="RichTextLabel" parent="."] [node name="Entries" type="RichTextLabel" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 148)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 size_flags_vertical = 3
anchor_bottom = 1.0
offset_left = 30.0
offset_top = 66.0
offset_right = -30.0
offset_bottom = -70.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 19 theme_override_font_sizes/normal_font_size = 19
[node name="TakeAll" type="Label" parent="."] [node name="TakeAll" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 30)
anchors_preset = 10 layout_mode = 2
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -180.0
offset_top = -52.0
offset_right = 180.0
offset_bottom = -22.0
grow_horizontal = 2
grow_vertical = 0
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1) theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
theme_override_font_sizes/font_size = 17 theme_override_font_sizes/font_size = 17
text = "Entrée / Espace — Tout prendre" text = "Entrée / Espace — Tout prendre"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
+35 -55
View File
@@ -13,6 +13,10 @@ corner_radius_top_left = 8
corner_radius_top_right = 8 corner_radius_top_right = 8
corner_radius_bottom_right = 8 corner_radius_bottom_right = 8
corner_radius_bottom_left = 8 corner_radius_bottom_left = 8
content_margin_left = 36.0
content_margin_top = 28.0
content_margin_right = 36.0
content_margin_bottom = 28.0
[node name="QuestPanel" type="PanelContainer"] [node name="QuestPanel" type="PanelContainer"]
visible = false visible = false
@@ -22,70 +26,46 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -300.0 offset_left = -480.0
offset_top = -205.0 offset_top = -360.0
offset_right = 300.0 offset_right = 480.0
offset_bottom = 205.0 offset_bottom = 360.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_quest_panel") theme_override_styles/panel = SubResource("StyleBox_quest_panel")
script = ExtResource("1_quest") script = ExtResource("1_quest")
[node name="Title" type="Label" parent="."] [node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 2
anchors_preset = 10 theme_override_constants/separation = 16
anchor_left = 0.5
anchor_right = 0.5
offset_left = -270.0
offset_top = 18.0
offset_right = 270.0
offset_bottom = 46.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0.55, 1, 0.67, 1)
theme_override_font_sizes/font_size = 21
horizontal_alignment = 1
[node name="Body" type="RichTextLabel" parent="."] [node name="Title" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 42)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 theme_override_colors/font_color = Color(0.55, 1, 0.67, 1)
anchor_bottom = 1.0 theme_override_font_sizes/font_size = 24
offset_left = 30.0 horizontal_alignment = 1
offset_top = 58.0 vertical_alignment = 1
offset_right = -30.0
offset_bottom = -175.0 [node name="Body" type="RichTextLabel" parent="Layout"]
grow_horizontal = 2 custom_minimum_size = Vector2(0, 300)
grow_vertical = 2 layout_mode = 2
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1) theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 17 theme_override_font_sizes/normal_font_size = 19
[node name="Entries" type="RichTextLabel" parent="."] [node name="Entries" type="RichTextLabel" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 190)
anchors_preset = 15 layout_mode = 2
anchor_right = 1.0 size_flags_vertical = 3
anchor_bottom = 1.0
offset_left = 30.0
offset_top = 220.0
offset_right = -30.0
offset_bottom = -48.0
grow_horizontal = 2
grow_vertical = 2
theme_override_colors/default_color = Color(0.7, 1, 0.75, 1) theme_override_colors/default_color = Color(0.7, 1, 0.75, 1)
theme_override_font_sizes/normal_font_size = 17 theme_override_font_sizes/normal_font_size = 19
[node name="Help" type="Label" parent="."] [node name="Help" type="Label" parent="Layout"]
layout_mode = 1 custom_minimum_size = Vector2(0, 34)
anchors_preset = 10 layout_mode = 2
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -270.0
offset_top = -42.0
offset_right = 270.0
offset_bottom = -18.0
grow_horizontal = 2
theme_override_colors/font_color = Color(0.55, 1, 0.67, 1) theme_override_colors/font_color = Color(0.55, 1, 0.67, 1)
theme_override_font_sizes/font_size = 16 theme_override_font_sizes/font_size = 17
text = "↑/↓ Choisir Entrée Accepter A Abandonner Échap Fermer" text = "↑/↓ Choisir Entrée Accepter A Abandonner Échap Fermer"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
+60
View File
@@ -0,0 +1,60 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="Script" path="res://scripts/presentation/race_class_choice_panel.gd" id="1_panel"]
[sub_resource type="StyleBoxFlat" id="StyleBox_panel"]
bg_color = Color(0.035, 0.055, 0.09, 0.99)
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color(0.96, 0.76, 0.28, 0.95)
corner_radius_top_left = 8
corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8
content_margin_left = 28.0
content_margin_top = 22.0
content_margin_right = 28.0
content_margin_bottom = 22.0
[node name="RaceClassChoicePanel" type="PanelContainer"]
visible = false
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -390.0
offset_top = -300.0
offset_right = 390.0
offset_bottom = 300.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBox_panel")
script = ExtResource("1_panel")
[node name="Layout" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 12
[node name="Title" type="Label" parent="Layout"]
custom_minimum_size = Vector2(0, 34)
layout_mode = 2
theme_override_colors/font_color = Color(0.96, 0.82, 0.42, 1)
theme_override_font_sizes/font_size = 23
horizontal_alignment = 1
[node name="Intro" type="Label" parent="Layout"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
autowrap_mode = 2
theme_override_colors/font_color = Color(0.8, 0.88, 1, 1)
horizontal_alignment = 1
[node name="Options" type="RichTextLabel" parent="Layout"]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.92, 0.95, 1, 1)
theme_override_font_sizes/normal_font_size = 16
+2 -2
View File
@@ -52,7 +52,7 @@ layout_mode = 2
theme_override_colors/font_color = Color(0.96, 0.84, 0.44, 1) theme_override_colors/font_color = Color(0.96, 0.84, 0.44, 1)
theme_override_font_sizes/font_size = 26 theme_override_font_sizes/font_size = 26
horizontal_alignment = 1 horizontal_alignment = 1
text = "LOAD RUN" text = "CHARGER UNE PARTIE"
[node name="Slots" type="VBoxContainer" parent="Panel/Layout"] [node name="Slots" type="VBoxContainer" parent="Panel/Layout"]
layout_mode = 2 layout_mode = 2
@@ -92,4 +92,4 @@ horizontal_alignment = 1
[node name="CancelButton" type="Button" parent="Panel/Layout"] [node name="CancelButton" type="Button" parent="Panel/Layout"]
custom_minimum_size = Vector2(0, 40) custom_minimum_size = Vector2(0, 40)
layout_mode = 2 layout_mode = 2
text = "BACK" text = "RETOUR"
+1 -1
View File
@@ -63,7 +63,7 @@ if [[ -z "${DISPLAY:-}" ]]; then
echo "build-linux: X11 smoke unavailable: DISPLAY is unset and xvfb-run is not installed." >&2 echo "build-linux: X11 smoke unavailable: DISPLAY is unset and xvfb-run is not installed." >&2
exit 2 exit 2
fi fi
runner=(xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24") runner=(xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24")
fi fi
smoke_log="build/linux/smoke.log" smoke_log="build/linux/smoke.log"
+14 -5
View File
@@ -13,9 +13,11 @@ import sys
import zlib import zlib
from pathlib import Path from pathlib import Path
WIDTH = 1280 WIDTH = 1920
HEIGHT = 720 HEIGHT = 1080
VIEWPORT = (256, 40, 1024, 678) # Central dungeon measurement region, proportionally equivalent to the former
# 16:9 reference crop while excluding the anchored HUD panels.
VIEWPORT = (384, 60, 1536, 1017)
UNKNOWN = (1, 2, 5) UNKNOWN = (1, 2, 5)
# Captured explored tiles are texture modulated, so classify their blue-black # Captured explored tiles are texture modulated, so classify their blue-black
# pixels by palette range rather than expecting one flat overlay color. # pixels by palette range rather than expecting one flat overlay color.
@@ -140,8 +142,15 @@ def luminance(rgb: tuple[int, int, int]) -> float:
def is_visible(pixel: tuple[int, int, int]) -> bool: def is_visible(pixel: tuple[int, int, int]) -> bool:
# The unmodulated grayscale floor texture includes these neutral bright texels. # Visible terrain can be either the neutral wall texture or the brown floor
return max(pixel) - min(pixel) <= 3 and max(pixel) >= 112 # texture. The authored surface begins in a large open room, so a capture is
# not required to include a wall inside the central measurement crop.
neutral_wall = max(pixel) - min(pixel) <= 3 and max(pixel) >= 112
unmodulated_floor = pixel in {
(23, 4, 0), (23, 7, 0), (10, 10, 0), (30, 13, 0),
(4, 4, 0), (41, 23, 1), (30, 9, 0), (66, 36, 6),
}
return neutral_wall or unmodulated_floor
def is_explored(pixel: tuple[int, int, int]) -> bool: def is_explored(pixel: tuple[int, int, int]) -> bool:
+52 -18
View File
@@ -3,33 +3,40 @@ extends RefCounted
const CompanionStateType = preload("res://scripts/domain/entities/companion_state.gd") const CompanionStateType = preload("res://scripts/domain/entities/companion_state.gd")
const PathfindingType = preload("res://scripts/domain/ai/pathfinding.gd") const PathfindingType = preload("res://scripts/domain/ai/pathfinding.gd")
const SUPPORT_HEAL_THRESHOLD := 0.5
const SUPPORT_HEAL_RANGE := 4
const SUPPORT_HEAL_AMOUNT := 2
static func decide(companion: CompanionState, player: ActorState, enemies: Dictionary[StringName, ActorState], map: GridMapState, blocked_cells: Dictionary[Vector2i, bool] = {}) -> Dictionary: static func decide(companion: CompanionState, player: ActorState, enemies: Dictionary[StringName, ActorState], map: GridMapState, blocked_cells: Dictionary[Vector2i, bool] = {}, detected_cells: Dictionary[Vector2i, bool] = {}) -> Dictionary:
if companion == null or not companion.is_alive(): if companion == null or not companion.is_alive():
return {"kind": &"idle"} return {"kind": &"idle"}
match companion.stance: match CompanionStateType.normalize_stance(companion.stance):
CompanionStateType.Stance.FOLLOW: CompanionStateType.Stance.STAY_BACK:
return _follow(companion.actor, player, map, blocked_cells) return _follow(companion.actor, player, map, blocked_cells)
CompanionStateType.Stance.DEFEND: CompanionStateType.Stance.DEFEND_ME:
return _defend(companion.actor, player, enemies, map, blocked_cells) return _defend(companion.actor, player, enemies, map, blocked_cells)
CompanionStateType.Stance.SUPPORT: CompanionStateType.Stance.ATTACK_ON_SIGHT:
return {"kind": &"idle"} return _aggressive(companion.actor, player, enemies, map, blocked_cells, detected_cells)
_: _:
return {"kind": &"idle"} return {"kind": &"idle"}
static func _aggressive(actor: ActorState, player: ActorState, enemies: Dictionary[StringName, ActorState], map: GridMapState, blocked_cells: Dictionary[Vector2i, bool], detected_cells: Dictionary[Vector2i, bool]) -> Dictionary:
var target := _nearest_enemy(actor.cell, enemies, detected_cells)
if target == null:
return _follow(actor, player, map, blocked_cells)
if actor.cell.distance_to(target.cell) <= 1.5:
return {"kind": &"melee", "target_id": target.id}
return _move_toward(actor, target.cell, player.cell, map, blocked_cells)
static func _support(actor: ActorState, player: ActorState, map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary:
if player.is_alive() and float(player.hit_points) / float(maxi(1, player.effective_max_hit_points())) < SUPPORT_HEAL_THRESHOLD and actor.cell.distance_to(player.cell) <= SUPPORT_HEAL_RANGE:
return {"kind": &"heal_player", "amount": SUPPORT_HEAL_AMOUNT}
return _follow(actor, player, map, blocked_cells)
static func _follow(actor: ActorState, player: ActorState, map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary: static func _follow(actor: ActorState, player: ActorState, map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary:
if actor.cell.distance_to(player.cell) <= 1.5: if actor.cell.distance_to(player.cell) <= 1.5:
return {"kind": &"idle"} return {"kind": &"idle"}
var occupied := blocked_cells.duplicate() return _move_toward(actor, player.cell, player.cell, map, blocked_cells)
occupied.erase(actor.cell)
occupied[player.cell] = true
var goals: Array[Vector2i] = []
for direction: Vector2i in PathfindingType.CARDINAL_DIRECTIONS:
var cell := player.cell + direction
if map.is_walkable(cell) and not occupied.has(cell):
goals.append(cell)
var path := PathfindingType.find_path_to_any(map, actor.cell, goals, occupied)
return {"kind": &"move", "to_cell": path.front()} if not path.is_empty() else {"kind": &"idle"}
static func _defend(actor: ActorState, player: ActorState, enemies: Dictionary[StringName, ActorState], map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary: static func _defend(actor: ActorState, player: ActorState, enemies: Dictionary[StringName, ActorState], map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary:
var targets: Array[ActorState] = [] var targets: Array[ActorState] = []
@@ -37,6 +44,33 @@ static func _defend(actor: ActorState, player: ActorState, enemies: Dictionary[S
if enemy.is_alive() and enemy.cell.distance_to(player.cell) <= 1.5: if enemy.is_alive() and enemy.cell.distance_to(player.cell) <= 1.5:
targets.append(enemy) targets.append(enemy)
targets.sort_custom(func(first: ActorState, second: ActorState) -> bool: return String(first.id) < String(second.id)) targets.sort_custom(func(first: ActorState, second: ActorState) -> bool: return String(first.id) < String(second.id))
if not targets.is_empty() and actor.cell.distance_to(targets[0].cell) <= 1.5: if not targets.is_empty():
return {"kind": &"melee", "target_id": targets[0].id} if actor.cell.distance_to(targets[0].cell) <= 1.5:
return {"kind": &"melee", "target_id": targets[0].id}
return _move_toward(actor, targets[0].cell, player.cell, map, blocked_cells)
return _follow(actor, player, map, blocked_cells) return _follow(actor, player, map, blocked_cells)
static func _move_toward(actor: ActorState, destination: Vector2i, player_cell: Vector2i, map: GridMapState, blocked_cells: Dictionary[Vector2i, bool]) -> Dictionary:
var occupied := blocked_cells.duplicate()
occupied.erase(actor.cell)
occupied[player_cell] = true
occupied[destination] = true
var goals: Array[Vector2i] = []
for direction: Vector2i in PathfindingType.CARDINAL_DIRECTIONS:
var cell := destination + direction
if map.is_walkable(cell) and not occupied.has(cell):
goals.append(cell)
var path := PathfindingType.find_path_to_any(map, actor.cell, goals, occupied)
return {"kind": &"move", "to_cell": path.front()} if not path.is_empty() else {"kind": &"idle"}
static func _nearest_enemy(origin: Vector2i, enemies: Dictionary[StringName, ActorState], detected_cells: Dictionary[Vector2i, bool]) -> ActorState:
var candidates: Array[ActorState] = []
for enemy: ActorState in enemies.values():
if enemy.is_alive() and detected_cells.has(enemy.cell):
candidates.append(enemy)
candidates.sort_custom(func(first: ActorState, second: ActorState) -> bool:
var first_distance := origin.distance_squared_to(first.cell)
var second_distance := origin.distance_squared_to(second.cell)
return String(first.id) < String(second.id) if first_distance == second_distance else first_distance < second_distance
)
return candidates[0] if not candidates.is_empty() else null
+2 -1
View File
@@ -15,7 +15,8 @@ func _init(scripted_rolls: Array[float] = []) -> void:
_rolls.assign(scripted_rolls) _rolls.assign(scripted_rolls)
func resolve_attack(attacker: ActorState, defender: ActorState, grant_xp: bool = true) -> Dictionary: func resolve_attack(attacker: ActorState, defender: ActorState, grant_xp: bool = true) -> Dictionary:
var events: Array[Dictionary] = [_event(&"attack_started", attacker, defender, {"stance": String(attacker.stance)})] var attack_method := String(attacker.metadata.get("melee_weapon_name", "mains nues" if attacker.id == &"player" else "attaque naturelle"))
var events: Array[Dictionary] = [_event(&"attack_started", attacker, defender, {"stance": String(attacker.stance), "attack_method": attack_method})]
var attack_score := attacker.accuracy - attacker.wound_severity(&"arms") * ARM_WOUND_PENALTY var attack_score := attacker.accuracy - attacker.wound_severity(&"arms") * ARM_WOUND_PENALTY
var defense_score := defender.defense * 3 - defender.wound_severity(&"legs") * LEG_WOUND_PENALTY var defense_score := defender.defense * 3 - defender.wound_severity(&"legs") * LEG_WOUND_PENALTY
if defender.stance == &"dodge": if defender.stance == &"dodge":
@@ -0,0 +1,24 @@
class_name HealthRegeneration
extends RefCounted
const ENDURANCE_DIVISOR := 3
const SKILL_AMPLIFIER := 0.15
const DIFFICULTY_MULTIPLIERS := {
&"touriste": 1.5,
&"crawler": 1.0,
&"veteran": 0.75,
&"masochiste": 0.5,
}
static func amount(endurance: int, regeneration_skill: int = 1, perk_bonus: int = 0, difficulty_id: StringName = &"crawler") -> int:
var base := maxi(1, endurance / ENDURANCE_DIVISOR)
var skill_bonus := maxi(0, regeneration_skill - 1)
var total := float(base + maxi(0, perk_bonus)) * (1.0 + float(skill_bonus) * SKILL_AMPLIFIER)
return maxi(0, int(total * float(DIFFICULTY_MULTIPLIERS.get(difficulty_id, 1.0))))
static func apply(actor: ActorState, endurance: int, regeneration_skill: int = 1, perk_bonus: int = 0, difficulty_id: StringName = &"crawler") -> int:
if actor == null or not actor.is_alive():
return 0
var before := actor.hit_points
actor.hit_points = mini(actor.effective_max_hit_points(), actor.hit_points + amount(endurance, regeneration_skill, perk_bonus, difficulty_id))
return actor.hit_points - before
@@ -0,0 +1 @@
uid://3ccnf6g0ily8
+3
View File
@@ -37,6 +37,9 @@ func resolve(map: GridMapState, attacker: ActorState, target: ActorState) -> Dic
"events": events, "events": events,
} }
func validation_reason(map: GridMapState, attacker: ActorState, target: ActorState) -> StringName:
return _validation_reason(map, attacker, target)
func _validation_reason(map: GridMapState, attacker: ActorState, target: ActorState) -> StringName: func _validation_reason(map: GridMapState, attacker: ActorState, target: ActorState) -> StringName:
if attacker == null or target == null or attacker == target or attacker.id == target.id or not target.is_alive(): if attacker == null or target == null or attacker == target or attacker.id == target.id or not target.is_alive():
return &"invalid_target" return &"invalid_target"
+40 -6
View File
@@ -4,36 +4,70 @@ extends RefCounted
# E4 deliberately owns only the companion's earned-XP ledger. F1 remains the # E4 deliberately owns only the companion's earned-XP ledger. F1 remains the
# sole owner of level thresholds and character progression. # sole owner of level thresholds and character progression.
class Stance: class Stance:
const STAY_BACK: StringName = &"stay_back"
const DEFEND_ME: StringName = &"defend_me"
const ATTACK_ON_SIGHT: StringName = &"attack_on_sight"
# Legacy identifiers remain readable for code and saves created before the
# player-facing behavior names were introduced.
const FOLLOW: StringName = &"follow" const FOLLOW: StringName = &"follow"
const DEFEND: StringName = &"defend" const DEFEND: StringName = &"defend"
const SUPPORT: StringName = &"support" const SUPPORT: StringName = &"support"
const ActorStateType = preload("res://scripts/domain/actor_state.gd") const ActorStateType = preload("res://scripts/domain/actor_state.gd")
const ExperienceType = preload("res://scripts/domain/progression/experience.gd") const ExperienceType = preload("res://scripts/domain/progression/experience.gd")
const VALID_STANCES: Array[StringName] = [Stance.FOLLOW, Stance.DEFEND, Stance.SUPPORT] const VALID_STANCES: Array[StringName] = [Stance.STAY_BACK, Stance.DEFEND_ME, Stance.ATTACK_ON_SIGHT]
var choice_id: StringName var choice_id: StringName
var actor: ActorState var actor: ActorState
var stance: StringName = Stance.FOLLOW var stance: StringName = Stance.STAY_BACK
var name := "Familier"
var species := "Animal"
var endurance := 4
var regeneration_skill := 1
var regeneration_perk_bonus := 0
func _init(new_choice_id: StringName, new_actor: ActorState) -> void: func _init(new_choice_id: StringName, new_actor: ActorState) -> void:
choice_id = new_choice_id choice_id = new_choice_id
actor = new_actor actor = new_actor
static func from_choice(new_choice_id: StringName, cell: Vector2i, hit_points: int = 8) -> CompanionState: static func from_choice(new_choice_id: StringName, cell: Vector2i, hit_points: int = 8, new_name: String = "Familier", new_species: String = "Animal") -> CompanionState:
var id := new_choice_id if not new_choice_id.is_empty() else &"moth" var id := new_choice_id if not new_choice_id.is_empty() else &"moth"
var companion_actor := ActorStateType.new(&"companion", cell, maxi(1, hit_points), 3, id, {"accuracy": 30, "xp": 0}) var companion_actor := ActorStateType.new(&"companion", cell, maxi(1, hit_points), 3, id, {"accuracy": 30, "xp": 0})
return CompanionState.new(id, companion_actor) var companion := CompanionState.new(id, companion_actor)
companion.name = new_name.strip_edges() if not new_name.strip_edges().is_empty() else "Familier"
companion.species = new_species.strip_edges() if not new_species.strip_edges().is_empty() else "Animal"
return companion
func is_alive() -> bool: func is_alive() -> bool:
return actor != null and actor.is_alive() return actor != null and actor.is_alive()
func set_stance(new_stance: StringName) -> bool: func set_stance(new_stance: StringName) -> bool:
if not new_stance in VALID_STANCES: var normalized := normalize_stance(new_stance)
if not normalized in VALID_STANCES:
return false return false
stance = new_stance stance = normalized
return true return true
static func normalize_stance(value: StringName) -> StringName:
match value:
Stance.FOLLOW, &"aggressif": return Stance.ATTACK_ON_SIGHT
Stance.DEFEND, Stance.SUPPORT, &"defensif", &"soutien": return Stance.DEFEND_ME
return value
static func stance_label(value: StringName) -> String:
match normalize_stance(value):
Stance.STAY_BACK: return "Reste en arrière"
Stance.DEFEND_ME: return "Défends-moi"
Stance.ATTACK_ON_SIGHT: return "Attaque à vue"
return "Inconnu"
static func stance_description(value: StringName) -> String:
match normalize_stance(value):
Stance.STAY_BACK: return "Suit le joueur sans engager les ennemis."
Stance.DEFEND_ME: return "Intercepte et attaque les ennemis qui menacent le joueur."
Stance.ATTACK_ON_SIGHT: return "Poursuit et attaque l’ennemi visible le plus proche."
return ""
# This is intentionally a neutral allocation seam: it records earned XP only # This is intentionally a neutral allocation seam: it records earned XP only
# and neither reads nor changes levels, thresholds, attributes, or skills. # and neither reads nor changes levels, thresholds, attributes, or skills.
func share_xp(player: ActorState, amount: int) -> Dictionary: func share_xp(player: ActorState, amount: int) -> Dictionary:
+2 -1
View File
@@ -7,6 +7,7 @@ const TrapEngineType = preload("res://scripts/domain/world/trap_engine.gd")
const SpecialInteractionsType = preload("res://scripts/domain/world/special_interactions.gd") const SpecialInteractionsType = preload("res://scripts/domain/world/special_interactions.gd")
const CompanionStateType = preload("res://scripts/domain/entities/companion_state.gd") const CompanionStateType = preload("res://scripts/domain/entities/companion_state.gd")
const PartyStateType = preload("res://scripts/domain/entities/party_state.gd") const PartyStateType = preload("res://scripts/domain/entities/party_state.gd")
const PLAYER_VISION_RADIUS := 6
var player: ActorState var player: ActorState
# E4 keeps the selected pet run-scoped rather than making it a floor entity. # E4 keeps the selected pet run-scoped rather than making it a floor entity.
@@ -109,7 +110,7 @@ func compute_visible_cells(game_map: GridMapState, origin: Vector2i, radius: int
return visible return visible
func update_exploration() -> void: func update_exploration() -> void:
visible_cells = compute_visible_cells(map, player.cell, 6) visible_cells = compute_visible_cells(map, player.cell, PLAYER_VISION_RADIUS)
for cell in visible_cells: for cell in visible_cells:
explored_cells[cell] = true explored_cells[cell] = true
@@ -71,6 +71,11 @@ func recompute_player(player) -> void:
player.normalize_resources() player.normalize_resources()
elif player is ActorState: elif player is ActorState:
player.recompute_equipment_modifiers(attributes, skills, combat) player.recompute_equipment_modifiers(attributes, skills, combat)
var main_hand := item_in_slot(&"main_hand")
if main_hand != null and main_hand.definition != null and StringName(main_hand.definition.raw.get("weapon_kind", "")) != &"ranged":
player.metadata["melee_weapon_name"] = main_hand.definition.name
else:
player.metadata.erase("melee_weapon_name")
func _accumulate_combat_modifiers(item: ItemInstance, combat: Dictionary[StringName, Variant]) -> void: func _accumulate_combat_modifiers(item: ItemInstance, combat: Dictionary[StringName, Variant]) -> void:
var raw := item.definition.raw var raw := item.definition.raw
@@ -92,6 +92,8 @@ func use_item(instance_id: StringName, default_target, identification: ItemIdent
var status := StringName(effect_data.get("status", "")) var status := StringName(effect_data.get("status", ""))
recipient.apply_status(StatusEffect.new(status, int(effect_data.get("duration", -1)), int(effect_data.get("magnitude", 0)), item.definition.id)) recipient.apply_status(StatusEffect.new(status, int(effect_data.get("duration", -1)), int(effect_data.get("magnitude", 0)), item.definition.id))
effects.append({"type": effect_type, "status": status}) effects.append({"type": effect_type, "status": status})
&"learn_spell":
effects.append({"type": effect_type, "spell": StringName(effect_data.get("spell", ""))})
_: _:
effects.append({"type": effect_type}) effects.append({"type": effect_type})
var consumed := remove_item(instance_id) var consumed := remove_item(instance_id)
+8 -2
View File
@@ -10,15 +10,21 @@ static func resolve(table: Dictionary, seed: String, context: String = "") -> Di
var items: Array[Dictionary] = [] var items: Array[Dictionary] = []
var gold := 0 var gold := 0
var entries: Array = table.get("entries", []) var entries: Array = table.get("entries", [])
var selected_item_ids: Dictionary[StringName, bool] = {}
var rolls := maxi(0, int(table.get("rolls", 0))) var rolls := maxi(0, int(table.get("rolls", 0)))
for _roll in range(rolls): for _roll in range(rolls):
var entry := _choose_entry(entries, rng) var eligible_entries := entries.filter(func(value) -> bool:
return not (value is Dictionary and value.has("item") and selected_item_ids.has(StringName(value.item)))
)
var entry := _choose_entry(eligible_entries, rng)
if entry.is_empty(): if entry.is_empty():
continue continue
if bool(entry.get("gold", false)): if bool(entry.get("gold", false)):
gold += _range_value(entry, "min_gold", "max_gold", rng) gold += _range_value(entry, "min_gold", "max_gold", rng)
elif entry.has("item"): elif entry.has("item"):
_append_item(items, StringName(entry.item), _range_value(entry, "min_qty", "max_qty", rng, 1)) var item_id := StringName(entry.item)
selected_item_ids[item_id] = true
_append_item(items, item_id, _range_value(entry, "min_qty", "max_qty", rng, 1))
return { return {
"items": items, "items": items,
"gold": gold, "gold": gold,
+11
View File
@@ -33,6 +33,17 @@ func resolve(map: GridMapState, caster: ActorState, target: ActorState, spell: D
var xp_event := _event(&"xp_granted", caster, target, spell, {}) var xp_event := _event(&"xp_granted", caster, target, spell, {})
xp_event.payload = xp_payload xp_event.payload = xp_payload
events.append(xp_event) events.append(xp_event)
events.append({
"kind": &"loot_dropped",
"actor_id": target.id,
"target_id": caster.id,
"cell": target.cell,
"payload": {
"loot_table": String(target.loot_table),
"actor_content_id": target.content_id,
"target_content_id": caster.content_id,
},
})
return {"valid": true, "reason": &"", "damage": damage, "events": events} return {"valid": true, "reason": &"", "damage": damage, "events": events}
func valid_targets(map: GridMapState, caster: ActorState, enemies: Dictionary[StringName, ActorState], spell: Dictionary, spells: SpellState) -> Dictionary[StringName, Vector2i]: func valid_targets(map: GridMapState, caster: ActorState, enemies: Dictionary[StringName, ActorState], spell: Dictionary, spells: SpellState) -> Dictionary[StringName, Vector2i]:
+32 -4
View File
@@ -33,7 +33,15 @@ func race_definitions() -> Array[Dictionary]:
var definitions: Array[Dictionary] = [] var definitions: Array[Dictionary] = []
for id: StringName in _races: for id: StringName in _races:
definitions.append(_races[id].duplicate(true)) definitions.append(_races[id].duplicate(true))
definitions.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: return String(a.id) < String(b.id)) definitions.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: return String(a.get("name", a.id)) < String(b.get("name", b.id)))
return definitions
func class_definitions(race_id: StringName = &"") -> Array[Dictionary]:
var definitions: Array[Dictionary] = []
for id: StringName in _classes:
if race_id.is_empty() or is_compatible(race_id, id):
definitions.append(_classes[id].duplicate(true))
definitions.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: return String(a.get("name", a.id)) < String(b.get("name", b.id)))
return definitions return definitions
func is_compatible(race_id: StringName, class_id: StringName) -> bool: func is_compatible(race_id: StringName, class_id: StringName) -> bool:
@@ -75,12 +83,32 @@ func apply_creation(player: PlayerState, race_id: StringName, class_id: StringNa
var choice := creation_choice(race_id, class_id) var choice := creation_choice(race_id, class_id)
if not bool(choice.get("accepted", false)): if not bool(choice.get("accepted", false)):
return choice return choice
var race := _races[race_id] var race_result := choose_race(player, race_id)
if not bool(race_result.get("accepted", false)):
return race_result
return choose_class(player, class_id)
func choose_race(player: PlayerState, race_id: StringName) -> Dictionary:
if player == null or not player.race.is_empty():
return {"accepted": false, "reason": &"already_chosen"}
if not _races.has(race_id):
return {"accepted": false, "reason": &"unknown_race"}
player.race = race_id player.race = race_id
_apply_bonuses(player, _races[race_id])
return {"accepted": true, "race_id": race_id}
func choose_class(player: PlayerState, class_id: StringName) -> Dictionary:
if player == null or not player.archetype.is_empty():
return {"accepted": false, "reason": &"already_chosen"}
if player.race.is_empty():
return {"accepted": false, "reason": &"race_required"}
if not _classes.has(class_id):
return {"accepted": false, "reason": &"unknown_class"}
if not is_compatible(player.race, class_id):
return {"accepted": false, "reason": &"incompatible"}
player.archetype = class_id player.archetype = class_id
_apply_bonuses(player, race)
_apply_bonuses(player, _classes[class_id]) _apply_bonuses(player, _classes[class_id])
return choice return {"accepted": true, "race_id": player.race, "class_id": class_id}
func eligible_evolutions(player: PlayerState) -> Array[Dictionary]: func eligible_evolutions(player: PlayerState) -> Array[Dictionary]:
var eligible: Array[Dictionary] = [] var eligible: Array[Dictionary] = []
+7 -1
View File
@@ -7,17 +7,23 @@ var seed: String
var difficulty_id: StringName var difficulty_id: StringName
var permadeath: bool var permadeath: bool
var pet_enabled: bool var pet_enabled: bool
var pet_name: String
var pet_species: String
func _init( func _init(
new_seed: String = "", new_seed: String = "",
new_difficulty_id: StringName = &"crawler", new_difficulty_id: StringName = &"crawler",
new_permadeath: bool = false, new_permadeath: bool = false,
new_pet_enabled: bool = false new_pet_enabled: bool = false,
new_pet_name: String = "Familier",
new_pet_species: String = "Animal"
) -> void: ) -> void:
seed = new_seed.strip_edges() seed = new_seed.strip_edges()
difficulty_id = new_difficulty_id difficulty_id = new_difficulty_id
permadeath = new_permadeath permadeath = new_permadeath
pet_enabled = new_pet_enabled pet_enabled = new_pet_enabled
pet_name = new_pet_name.strip_edges() if not new_pet_name.strip_edges().is_empty() else "Familier"
pet_species = new_pet_species.strip_edges() if not new_pet_species.strip_edges().is_empty() else "Animal"
func is_valid() -> bool: func is_valid() -> bool:
return not seed.is_empty() and difficulty_id in DIFFICULTY_IDS return not seed.is_empty() and difficulty_id in DIFFICULTY_IDS
+1 -1
View File
@@ -4,7 +4,7 @@ extends RefCounted
var seed: String var seed: String
var settings: RunSettings var settings: RunSettings
var player_name := "Sans-Nom" var player_name := "Sans-Nom"
var base_archetype: StringName = &"vanguard" var base_archetype: StringName = &""
var current_floor := 0 var current_floor := 0
var floors: Dictionary[int, FloorState] = {} var floors: Dictionary[int, FloorState] = {}
# Deadline records are intentionally independent from generated FloorState so # Deadline records are intentionally independent from generated FloorState so
+41 -15
View File
@@ -13,6 +13,15 @@ static func resolve_player_action(state: GameState, direction: Vector2i) -> Arra
return results return results
var player: ActorState = state.player var player: ActorState = state.player
var destination: Vector2i = player.cell + direction var destination: Vector2i = player.cell + direction
if abs(direction.x) == 1 and abs(direction.y) == 1:
# Diagonal movement cannot squeeze between blocking cardinal cells. A
# closed door must therefore gate the room instead of being bypassable at
# either corner; walls and chests obey the same geometry.
var horizontal := player.cell + Vector2i(direction.x, 0)
var vertical := player.cell + Vector2i(0, direction.y)
if not state.map.is_walkable(horizontal) or not state.map.is_walkable(vertical):
results.append(TurnResultType.new(player.id, &"blocked", player.cell, destination, &"", 0, "Your way is blocked."))
return results
var enemy: ActorState = _enemy_at(state, destination) var enemy: ActorState = _enemy_at(state, destination)
if enemy != null: if enemy != null:
# A companion-owning run takes the neutral shared-XP seam. Combat must # A companion-owning run takes the neutral shared-XP seam. Combat must
@@ -89,7 +98,8 @@ static func append_enemy_response(state: GameState, results: Array[TurnResult])
var enemy: ActorState = state.enemies.get(enemy_id) var enemy: ActorState = state.enemies.get(enemy_id)
if enemy == null or not enemy.is_alive(): if enemy == null or not enemy.is_alive():
continue continue
var decision: Dictionary = EnemyBehaviorsType.decide(enemy, state.player, state.map, occupied) var target := _enemy_target(state, enemy)
var decision: Dictionary = EnemyBehaviorsType.decide(enemy, target, state.map, occupied)
if decision.has("diagnostic"): if decision.has("diagnostic"):
results.append(TurnResultType.new( results.append(TurnResultType.new(
enemy.id, enemy.id,
@@ -103,25 +113,33 @@ static func append_enemy_response(state: GameState, results: Array[TurnResult])
)) ))
match decision.get("kind", &"idle"): match decision.get("kind", &"idle"):
&"melee": &"melee":
if _support_companion_intercepts(state, enemy, results): if target == state.player and _support_companion_intercepts(state, enemy, results):
continue continue
_append_combat_results(results, CombatEngineType.new().resolve_attack(enemy, state.player), enemy.cell, state.player.cell) _append_combat_results(results, CombatEngineType.new().resolve_attack(enemy, target), enemy.cell, target.cell)
if not state.player.is_alive(): if target == state.player and not state.player.is_alive():
return return
&"move": &"move":
var target: Vector2i = decision.get("to_cell", enemy.cell) var move_target: Vector2i = decision.get("to_cell", enemy.cell)
# The behavior contract has already rejected these cells; retain the # The behavior contract has already rejected these cells; retain the
# resolver guard as the authoritative state mutation boundary. # resolver guard as the authoritative state mutation boundary.
if state.map.is_walkable(target) and target != state.player.cell and not occupied.has(target): if state.map.is_walkable(move_target) and move_target != target.cell and not occupied.has(move_target):
var from: Vector2i = enemy.cell var from: Vector2i = enemy.cell
occupied.erase(from) occupied.erase(from)
enemy.cell = target enemy.cell = move_target
occupied[target] = true occupied[move_target] = true
results.append(TurnResultType.new(enemy.id, &"enemy_moved", from, target, &"", 0, "%s moves." % _actor_label(enemy.id))) results.append(TurnResultType.new(enemy.id, &"enemy_moved", from, move_target, &"", 0, "%s moves." % _actor_label(enemy.id)))
static func _enemy_target(state: GameState, enemy: ActorState) -> ActorState:
var companion: CompanionState = state.companion
if companion == null or not companion.is_alive():
return state.player
var player_distance := enemy.cell.distance_squared_to(state.player.cell)
var companion_distance := enemy.cell.distance_squared_to(companion.actor.cell)
return companion.actor if companion_distance <= player_distance else state.player
static func _support_companion_intercepts(state: GameState, enemy: ActorState, results: Array[TurnResult]) -> bool: static func _support_companion_intercepts(state: GameState, enemy: ActorState, results: Array[TurnResult]) -> bool:
var companion: CompanionState = state.companion var companion: CompanionState = state.companion
if companion == null or not companion.is_alive() or companion.stance != CompanionStateType.Stance.SUPPORT: if companion == null or not companion.is_alive() or CompanionStateType.normalize_stance(companion.stance) != CompanionStateType.Stance.DEFEND_ME:
return false return false
if companion.actor.cell.distance_to(state.player.cell) > 1.5: if companion.actor.cell.distance_to(state.player.cell) > 1.5:
return false return false
@@ -143,7 +161,8 @@ static func _append_companion_response(state: GameState, results: Array[TurnResu
return return
var occupied := _occupied_enemy_cells(state) var occupied := _occupied_enemy_cells(state)
occupied[companion.actor.cell] = true occupied[companion.actor.cell] = true
var decision := CompanionBehaviorsType.decide(companion, state.player, state.enemies, state.map, occupied) var detected_cells := state.compute_visible_cells(state.map, state.player.cell, state.PLAYER_VISION_RADIUS)
var decision := CompanionBehaviorsType.decide(companion, state.player, state.enemies, state.map, occupied, detected_cells)
match decision.get("kind", &"idle"): match decision.get("kind", &"idle"):
&"move": &"move":
var target: Vector2i = decision.get("to_cell", companion.actor.cell) var target: Vector2i = decision.get("to_cell", companion.actor.cell)
@@ -156,9 +175,15 @@ static func _append_companion_response(state: GameState, results: Array[TurnResu
if enemy != null and enemy.is_alive() and companion.actor.cell.distance_to(enemy.cell) <= 1.5: if enemy != null and enemy.is_alive() and companion.actor.cell.distance_to(enemy.cell) <= 1.5:
_append_combat_results(results, CombatEngineType.new().resolve_attack(companion.actor, enemy), companion.actor.cell, enemy.cell) _append_combat_results(results, CombatEngineType.new().resolve_attack(companion.actor, enemy), companion.actor.cell, enemy.cell)
results.back().kind = &"companion_melee" results.back().kind = &"companion_melee"
results.back().message = "Your companion defends you." results.back().message = "%s attacks." % companion.name
if not enemy.is_alive(): if not enemy.is_alive():
state.enemies.erase(enemy.id) state.enemies.erase(enemy.id)
&"heal_player":
var before := state.player.hit_points
state.player.hit_points = mini(state.player.effective_max_hit_points(), before + int(decision.get("amount", 0)))
var healed := state.player.hit_points - before
if healed > 0:
results.append(TurnResultType.new(companion.actor.id, &"companion_healed_player", companion.actor.cell, state.player.cell, state.player.id, -healed, "%s restores %d PV." % [companion.name, healed], {"healing": healed}))
static func _occupied_enemy_cells(state: GameState) -> Dictionary[Vector2i, bool]: static func _occupied_enemy_cells(state: GameState) -> Dictionary[Vector2i, bool]:
var occupied: Dictionary[Vector2i, bool] = {state.player.cell: true} var occupied: Dictionary[Vector2i, bool] = {state.player.cell: true}
@@ -176,10 +201,11 @@ static func _append_combat_results(results: Array[TurnResult], outcome: Dictiona
var target_id := StringName(first.target_id) var target_id := StringName(first.target_id)
var legacy_kind := &"melee" if actor_id == &"player" else &"enemy_melee" var legacy_kind := &"melee" if actor_id == &"player" else &"enemy_melee"
var damage := int(outcome.damage) var damage := int(outcome.damage)
var message := "You strike the goblin for %d." % damage if actor_id == &"player" else "%s hits you for %d." % [_actor_label(actor_id), damage] var attack_method := String(first.payload.get("attack_method", "mains nues" if actor_id == &"player" else "attaque naturelle"))
results.append(TurnResultType.new(actor_id, legacy_kind, from_cell, to_cell, target_id, damage, message, {"domain_events": descriptors})) var message := "You strike the goblin with %s for %d." % [attack_method, damage] if actor_id == &"player" else "%s hits you with %s for %d." % [_actor_label(actor_id), attack_method, damage]
results.append(TurnResultType.new(actor_id, legacy_kind, from_cell, to_cell, target_id, damage, message, {"domain_events": descriptors, "attack_method": attack_method}))
if not bool(outcome.hit): if not bool(outcome.hit):
results.back().message = "You miss the goblin." if actor_id == &"player" else "%s misses you." % _actor_label(actor_id) results.back().message = "You miss the goblin with %s." % attack_method if actor_id == &"player" else "%s misses you with %s." % [_actor_label(actor_id), attack_method]
if not (results.back().payload.domain_events as Array).filter(func(event: Dictionary) -> bool: return event.kind == &"actor_died").is_empty(): if not (results.back().payload.domain_events as Array).filter(func(event: Dictionary) -> bool: return event.kind == &"actor_died").is_empty():
var defeated := target_id if actor_id == &"player" else actor_id var defeated := target_id if actor_id == &"player" else actor_id
results.append(TurnResultType.new(defeated, &"enemy_defeated", to_cell, to_cell, actor_id, 0, "%s is defeated." % _actor_label(defeated))) results.append(TurnResultType.new(defeated, &"enemy_defeated", to_cell, to_cell, actor_id, 0, "%s is defeated." % _actor_label(defeated)))
+19 -9
View File
@@ -3,8 +3,6 @@ extends RefCounted
const MAX_MAP_SIZE := Vector2i(700, 350) const MAX_MAP_SIZE := Vector2i(700, 350)
const MAX_ROOM_COUNT := 500 const MAX_ROOM_COUNT := 500
const SHALLOW_ROOM_MIN_SIZE := Vector2i(5, 4)
const SHALLOW_ROOM_MAX_SIZE := Vector2i(10, 8)
const DEEP_ROOM_MIN_SIZE := Vector2i(4, 3) const DEEP_ROOM_MIN_SIZE := Vector2i(4, 3)
const DEEP_ROOM_MAX_SIZE := Vector2i(6, 5) const DEEP_ROOM_MAX_SIZE := Vector2i(6, 5)
const ROOM_PADDING := 2 const ROOM_PADDING := 2
@@ -38,13 +36,6 @@ const EconomyType = preload("res://scripts/domain/items/economy.gd")
# impractical. It is also the sole sizing input to generation, making a seed # impractical. It is also the sole sizing input to generation, making a seed
# and floor number reproduce exactly the same layout. # and floor number reproduce exactly the same layout.
static func generation_profile(floor_number: int) -> Dictionary: static func generation_profile(floor_number: int) -> Dictionary:
if floor_number <= 1:
return {
"map_size": Vector2i(80, 50),
"target_room_count": 8,
"room_min_size": SHALLOW_ROOM_MIN_SIZE,
"room_max_size": SHALLOW_ROOM_MAX_SIZE,
}
var normalized_floor := maxi(1, floor_number) var normalized_floor := maxi(1, floor_number)
return { return {
"map_size": Vector2i( "map_size": Vector2i(
@@ -75,6 +66,7 @@ static func generate(seed: String, floor_number: int, catalog: ContentCatalog) -
graph.add_local_loops(rooms, rng) graph.add_local_loops(rooms, rng)
for edge in graph.loop_edges: for edge in graph.loop_edges:
_carve_l_corridor_preserving_doors(map, _room_center(rooms[edge.from].bounds), _room_center(rooms[edge.to].bounds)) _carve_l_corridor_preserving_doors(map, _room_center(rooms[edge.from].bounds), _room_center(rooms[edge.to].bounds))
tree_door_cells = _remove_nonfunctional_doors(map, tree_door_cells)
for serialized_door in tree_door_cells: for serialized_door in tree_door_cells:
map.set_cell(Vector2i(int(serialized_door[0]), int(serialized_door[1])), GridMapStateType.CellKind.CLOSED_DOOR) map.set_cell(Vector2i(int(serialized_door[0]), int(serialized_door[1])), GridMapStateType.CellKind.CLOSED_DOOR)
@@ -176,6 +168,24 @@ static func _place_tree_boundary_doors(map: GridMapState, path: Array[Vector2i],
break break
return serialized_cells return serialized_cells
static func _remove_nonfunctional_doors(map: GridMapState, serialized_doors: Array[Array]) -> Array[Array]:
var functional: Array[Array] = []
for serialized_door: Array in serialized_doors:
var cell := Vector2i(int(serialized_door[0]), int(serialized_door[1]))
var walkable_directions: Array[Vector2i] = []
for direction: Vector2i in [Vector2i.LEFT, Vector2i.RIGHT, Vector2i.UP, Vector2i.DOWN]:
if map.is_walkable(cell + direction):
walkable_directions.append(direction)
var controls_straight_passage := walkable_directions.size() == 2 and (
(walkable_directions.has(Vector2i.LEFT) and walkable_directions.has(Vector2i.RIGHT))
or (walkable_directions.has(Vector2i.UP) and walkable_directions.has(Vector2i.DOWN))
)
if controls_straight_passage:
functional.append(serialized_door)
else:
map.set_cell(cell, GridMapStateType.CellKind.FLOOR)
return functional
static func _is_adjacent_to_serialized_door(cell: Vector2i, serialized_doors: Array[Array]) -> bool: static func _is_adjacent_to_serialized_door(cell: Vector2i, serialized_doors: Array[Array]) -> bool:
for serialized_door in serialized_doors: for serialized_door in serialized_doors:
var door_cell := Vector2i(int(serialized_door[0]), int(serialized_door[1])) var door_cell := Vector2i(int(serialized_door[0]), int(serialized_door[1]))
+2 -3
View File
@@ -55,11 +55,10 @@ static func _spawn_enemy(floor: FloorState, catalog: ContentCatalog, room: RoomS
return serial + 1 return serial + 1
static func _spawn_chest(floor: FloorState, catalog: ContentCatalog, room: RoomState, rng: DeterministicRng, occupied: Dictionary[Vector2i, bool]) -> void: static func _spawn_chest(floor: FloorState, catalog: ContentCatalog, room: RoomState, rng: DeterministicRng, occupied: Dictionary[Vector2i, bool]) -> void:
var definitions := SpawnRulesType.loot_tables(catalog) var definition := catalog.get_loot_table(&"floor_treasure")
var cell := _available_cell(floor, room, rng, occupied) var cell := _available_cell(floor, room, rng, occupied)
if definitions.is_empty() or cell == Vector2i(-1, -1): if definition.is_empty() or cell == Vector2i(-1, -1):
return return
var definition: Dictionary = definitions[rng.next_int() % definitions.size()]
floor.chests[cell] = { floor.chests[cell] = {
"loot_table_id": definition["id"], "loot_table_id": definition["id"],
"opened": false, "opened": false,
+25 -33
View File
@@ -3,44 +3,36 @@ extends RefCounted
const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd") const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd")
const FloorStateType = preload("res://scripts/domain/world/floor_state.gd") const FloorStateType = preload("res://scripts/domain/world/floor_state.gd")
const ActorStateType = preload("res://scripts/domain/actor_state.gd") const RoomStateType = preload("res://scripts/domain/world/room_state.gd")
# Floor zero deliberately remains an authored tutorial surface. Its geometry is const SURFACE_SIZE := Vector2i(42, 16)
# not derived from the run seed; RunState supplies persistence by caching it. const ENTRANCE := Vector2i(4, 7)
const DOOR := Vector2i(36, 7)
const EXIT := Vector2i(39, 7)
# The surface mirrors DCWASCII's current floor-zero contract: an empty authored
# staging area, a straight corridor, one door, and the stairs to the procedural
# dungeon. It intentionally contains no enemies, chest, deadline content, or
# seed-dependent population.
static func generate(_seed: String = "") -> FloorState: static func generate(_seed: String = "") -> FloorState:
var map := GridMapStateType.new(Vector2i(30, 20), GridMapStateType.CellKind.WALL) var map := GridMapStateType.new(SURFACE_SIZE, GridMapStateType.CellKind.WALL)
_carve_room(map, Rect2i(2, 12, 6, 5)) var entrance_room := RoomStateType.new(&"surface_entrance", Rect2i(2, 2, 18, 11), &"entrance")
_carve_room(map, Rect2i(2, 4, 7, 7)) var landing := RoomStateType.new(&"surface_landing", Rect2i(37, 6, 4, 3), &"open")
_carve_room(map, Rect2i(10, 2, 10, 6)) _carve_room(map, entrance_room.bounds)
_carve_room(map, Rect2i(21, 5, 7, 8)) for x in range(20, DOOR.x):
_carve_vertical_corridor(map, 4, 10, 12) map.set_cell(Vector2i(x, ENTRANCE.y), GridMapStateType.CellKind.FLOOR)
_carve_horizontal_corridor(map, 8, 10, 6) map.set_cell(DOOR, GridMapStateType.CellKind.CLOSED_DOOR)
_carve_horizontal_corridor(map, 18, 21, 6) _carve_room(map, landing.bounds)
_carve_vertical_corridor(map, 18, 4, 6) map.set_cell(EXIT, GridMapStateType.CellKind.STAIRS)
map.set_cell(Vector2i(4, 11), GridMapStateType.CellKind.CLOSED_DOOR)
map.set_cell(Vector2i(4, 7), GridMapStateType.CellKind.CHEST)
map.set_cell(Vector2i(18, 4), GridMapStateType.CellKind.STAIRS)
var floor := FloorStateType.new(map, 0, 0) var floor := FloorStateType.new(map, 0, 0)
floor.entrance = Vector2i(4, 12) floor.rooms = [entrance_room, landing]
floor.exit = Vector2i(18, 4) floor.entrance = ENTRANCE
floor.enemies[&"goblin"] = ActorStateType.new(&"goblin", Vector2i(24, 8), 6, 2) floor.exit = EXIT
floor.chests[Vector2i(4, 7)] = {
"loot_table_id": &"floor1_reward",
"opened": false,
}
floor.metadata = {"hand_authored": true, "theme": "surface"} floor.metadata = {"hand_authored": true, "theme": "surface"}
return floor return floor
static func _carve_room(map: GridMapState, room: Rect2i) -> void: static func _carve_room(map: GridMapState, bounds: Rect2i) -> void:
for y in range(room.position.y, room.end.y): for y in range(bounds.position.y, bounds.end.y):
for x in range(room.position.x, room.end.x): for x in range(bounds.position.x, bounds.end.x):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR) map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
static func _carve_horizontal_corridor(map: GridMapState, from_x: int, to_x: int, y: int) -> void:
for x in range(from_x, to_x + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
static func _carve_vertical_corridor(map: GridMapState, x: int, from_y: int, to_y: int) -> void:
for y in range(from_y, to_y + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
+15 -3
View File
@@ -50,12 +50,24 @@ static func trigger(floor: FloorState, player: ActorState, cell: Vector2i, catal
trap["discovered"] = true trap["discovered"] = true
floor.traps[cell] = trap floor.traps[cell] = trap
var payload := {"trap_id": StringName(trap.get("trap_id", "")), "damage": actual_damage} var payload := {"trap_id": StringName(trap.get("trap_id", "")), "damage": actual_damage}
var events: Array[Dictionary] = [{"kind": &"trap_triggered", "payload": payload}] var events: Array[Dictionary] = [_event(&"trap_triggered", player, cell, payload)]
# Content chance remains deterministic in this turn-based seam: a declared # Content chance remains deterministic in this turn-based seam: a declared
# majority chance applies, while lower chances are safely represented as no # majority chance applies, while lower chances are safely represented as no
# status until a future RNG-owned rules slice supplies a roll stream. # status until a future RNG-owned rules slice supplies a roll stream.
var status := StringName(definition.get("status", "")) # JSON `null` is a valid declaration for traps without a status effect.
# Convert only textual IDs; StringName(null) is not a valid constructor.
var status_value: Variant = definition.get("status")
var status := StringName(status_value) if status_value is String else &""
if not status.is_empty() and float(definition.get("status_chance", 0.0)) >= 0.5: if not status.is_empty() and float(definition.get("status_chance", 0.0)) >= 0.5:
player.apply_status(StatusEffectType.new(status, int(definition.get("status_duration", -1)), 0, StringName(trap.get("trap_id", "")))) player.apply_status(StatusEffectType.new(status, int(definition.get("status_duration", -1)), 0, StringName(trap.get("trap_id", ""))))
events.append({"kind": &"trap_status_applied", "payload": {"trap_id": StringName(trap.get("trap_id", "")), "status": status}}) events.append(_event(&"trap_status_applied", player, cell, {"trap_id": StringName(trap.get("trap_id", "")), "status": status}))
return {"triggered": true, "damage": actual_damage, "trap_id": StringName(trap.get("trap_id", "")), "message": String(definition.get("message", "A trap triggers.")), "events": events} return {"triggered": true, "damage": actual_damage, "trap_id": StringName(trap.get("trap_id", "")), "message": String(definition.get("message", "A trap triggers.")), "events": events}
static func _event(kind: StringName, player: ActorState, cell: Vector2i, payload: Dictionary) -> Dictionary:
return {
"kind": kind,
"actor_id": player.id,
"target_id": player.id,
"cell": cell,
"payload": payload,
}
+248 -59
View File
@@ -2,8 +2,10 @@ class_name Game
extends Node2D extends Node2D
signal game_started(settings: RunSettings, run_state: RunState) signal game_started(settings: RunSettings, run_state: RunState)
signal death_navigation_requested(action: StringName)
signal save_requested
const REFERENCE_VIEWPORT := Vector2i(1280, 720) const REFERENCE_VIEWPORT := Vector2i(1920, 1080)
const TILE_SIZE := Vector2i(32, 32) const TILE_SIZE := Vector2i(32, 32)
const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd") const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd")
const ActorStateType = preload("res://scripts/domain/actor_state.gd") const ActorStateType = preload("res://scripts/domain/actor_state.gd")
@@ -22,6 +24,8 @@ const SpellStateType = preload("res://scripts/domain/magic/spell_state.gd")
const TrapEngine = preload("res://scripts/domain/world/trap_engine.gd") const TrapEngine = preload("res://scripts/domain/world/trap_engine.gd")
const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd") const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd")
const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd") const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd")
const LootResolverType = preload("res://scripts/domain/items/loot_resolver.gd")
const TemporaryPlaytestKitType = preload("res://scripts/game/temporary_playtest_kit.gd")
const InventoryPanelType = preload("res://scripts/presentation/inventory_panel.gd") const InventoryPanelType = preload("res://scripts/presentation/inventory_panel.gd")
const EconomyType = preload("res://scripts/domain/items/economy.gd") const EconomyType = preload("res://scripts/domain/items/economy.gd")
const CraftingEngineType = preload("res://scripts/domain/items/crafting_engine.gd") const CraftingEngineType = preload("res://scripts/domain/items/crafting_engine.gd")
@@ -50,6 +54,7 @@ const SyndicateType = preload("res://scripts/domain/meta/syndicate.gd")
const FactionPanelType = preload("res://scripts/presentation/faction_panel.gd") const FactionPanelType = preload("res://scripts/presentation/faction_panel.gd")
const ModerationPanelType = preload("res://scripts/presentation/moderation_panel.gd") const ModerationPanelType = preload("res://scripts/presentation/moderation_panel.gd")
const DeathEngineType = preload("res://scripts/domain/run/death_engine.gd") const DeathEngineType = preload("res://scripts/domain/run/death_engine.gd")
const HealthRegenerationType = preload("res://scripts/domain/combat/health_regeneration.gd")
const TouristServiceType = preload("res://scripts/domain/world/tourist_service.gd") const TouristServiceType = preload("res://scripts/domain/world/tourist_service.gd")
const DeathPanelType = preload("res://scripts/presentation/death_panel.gd") const DeathPanelType = preload("res://scripts/presentation/death_panel.gd")
const VictoryPanelType = preload("res://scripts/presentation/victory_panel.gd") const VictoryPanelType = preload("res://scripts/presentation/victory_panel.gd")
@@ -75,6 +80,7 @@ const QuestStateType = preload("res://scripts/domain/narrative/quest_state.gd")
@onready var party_panel: PartyPanel = $HUD/PartyPanel @onready var party_panel: PartyPanel = $HUD/PartyPanel
@onready var character_panel: CharacterPanel = $HUD/CharacterPanel @onready var character_panel: CharacterPanel = $HUD/CharacterPanel
@onready var progression_choice_panel: ProgressionChoicePanel = $HUD/ProgressionChoicePanel @onready var progression_choice_panel: ProgressionChoicePanel = $HUD/ProgressionChoicePanel
@onready var race_class_choice_panel: RaceClassChoicePanel = $HUD/RaceClassChoicePanel
@onready var achievement_panel: AchievementPanel = $HUD/AchievementPanel @onready var achievement_panel: AchievementPanel = $HUD/AchievementPanel
@onready var audience_panel: AudiencePanel = $HUD/AudiencePanel @onready var audience_panel: AudiencePanel = $HUD/AudiencePanel
@onready var recap_panel: RecapPanel = $HUD/RecapPanel @onready var recap_panel: RecapPanel = $HUD/RecapPanel
@@ -102,8 +108,8 @@ var last_turn_results: Array[TurnResult] = []
var action_router: ActionRouter var action_router: ActionRouter
var pending_run_settings: RunSettings var pending_run_settings: RunSettings
var pending_player_name := "Sans-Nom" var pending_player_name := "Sans-Nom"
var pending_base_archetype: StringName = &"vanguard" var pending_base_archetype: StringName = &""
var pending_race: StringName = &"race_humain_standard" var pending_race: StringName = &""
var pending_loaded_run: Dictionary = {} var pending_loaded_run: Dictionary = {}
var floor_transition: FloorTransition var floor_transition: FloorTransition
var spell_catalog: ContentCatalog var spell_catalog: ContentCatalog
@@ -124,12 +130,14 @@ var moderation: Moderation
var death_engine: DeathEngine var death_engine: DeathEngine
var active_dialogue_npc: Dictionary = {} var active_dialogue_npc: Dictionary = {}
var active_event_index := -1 var active_event_index := -1
var _turn_start_player_hit_points := -1
var _turn_start_companion_hit_points := -1
func configure_new_run(settings: RunSettings, player_name: String, base_archetype: StringName, race: StringName = &"race_humain_standard") -> void: func configure_new_run(settings: RunSettings, player_name: String) -> void:
pending_run_settings = settings pending_run_settings = settings
pending_player_name = player_name pending_player_name = player_name
pending_base_archetype = base_archetype pending_base_archetype = &""
pending_race = race pending_race = &""
func configure_loaded_run(loaded: Dictionary) -> void: func configure_loaded_run(loaded: Dictionary) -> void:
pending_loaded_run = loaded pending_loaded_run = loaded
@@ -147,6 +155,9 @@ func _ready() -> void:
spell_targeting_overlay.target_selected.connect(_on_spell_target_selected) spell_targeting_overlay.target_selected.connect(_on_spell_target_selected)
spell_targeting_overlay.targeting_cancelled.connect(_cancel_spell_targeting) spell_targeting_overlay.targeting_cancelled.connect(_cancel_spell_targeting)
progression_choice_panel.choice_confirmed.connect(_choose_level_three_perk) progression_choice_panel.choice_confirmed.connect(_choose_level_three_perk)
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))
map_renderer.set_map(game_state.map) map_renderer.set_map(game_state.map)
_sync_map_renderer_visibility() _sync_map_renderer_visibility()
_sync_minimap() _sync_minimap()
@@ -175,6 +186,8 @@ func _initialize_run_state() -> void:
run_state.base_archetype = pending_base_archetype run_state.base_archetype = pending_base_archetype
spell_catalog = ContentCatalogType.load_from_directory("res://data/ascii") spell_catalog = ContentCatalogType.load_from_directory("res://data/ascii")
run_state.content_catalog = spell_catalog run_state.content_catalog = spell_catalog
if pending_run_settings != null:
_initialize_tutorial_kit()
crafting_engine = CraftingEngineType.new(spell_catalog) crafting_engine = CraftingEngineType.new(spell_catalog)
dialogue_engine = DialogueEngineType.new() dialogue_engine = DialogueEngineType.new()
event_engine = EventEngineType.new() event_engine = EventEngineType.new()
@@ -191,20 +204,24 @@ func _initialize_run_state() -> void:
moderation = ModerationType.new(run_state.moderation_state) moderation = ModerationType.new(run_state.moderation_state)
death_engine = DeathEngineType.new() death_engine = DeathEngineType.new()
_refresh_title() _refresh_title()
# The existing base-archetype menu is now the mandatory class choice. Race # New runs deliberately remain classless and raceless through dungeon floors
# defaults to the neutral human until the creation UI submits its selection. # one and two. The floor-three milestone applies both choices later.
# Preserve the no-class initial state used by dialogue gates in existing runs;
# menu creation assigns its explicit base class immediately after launch.
if pending_run_settings != null:
class_engine.apply_creation(dialogue_player, pending_race, run_state.base_archetype)
game_state.content_catalog = spell_catalog game_state.content_catalog = spell_catalog
spell_state = SpellStateType.new([&"spell_epines_empoisonnees"]) spell_state = SpellStateType.new([&"spell_epines_empoisonnees"])
floor_transition = FloorTransitionType.new(spell_catalog) floor_transition = FloorTransitionType.new(spell_catalog)
var initial_floor := floor_transition.initial_floor(run_state) var initial_floor := floor_transition.initial_floor(run_state)
if pending_run_settings != null:
TemporaryPlaytestKitType.apply_to_new_run(initial_floor)
game_state.set_floor_state(initial_floor) game_state.set_floor_state(initial_floor)
game_state.player.cell = initial_floor.entrance game_state.player.cell = initial_floor.entrance
# Direct Game-scene instantiation is the established automated-test seam.
# Production runs are always configured by MainMenu and keep the reference
# surface empty; the seam retains one deterministic actor for combat tests.
if pending_loaded_run.is_empty() and _is_automated_test_run():
game_state.enemies[&"goblin"] = ActorStateType.new(&"goblin", initial_floor.entrance + Vector2i(3, 0), 6, 2)
game_state.update_exploration()
if settings.pet_enabled: if settings.pet_enabled:
game_state.companion = CompanionStateType.from_choice(&"moth", initial_floor.entrance + Vector2i.RIGHT) game_state.companion = CompanionStateType.from_choice(&"moth", initial_floor.entrance + Vector2i.RIGHT, 8, settings.pet_name, settings.pet_species)
if pending_run_settings != null: if pending_run_settings != null:
var game_started := GameEventType.new( var game_started := GameEventType.new(
run_state.next_turn(), run_state.next_turn(),
@@ -215,8 +232,11 @@ func _initialize_run_state() -> void:
"difficulty_id": settings.difficulty_id, "difficulty_id": settings.difficulty_id,
"permadeath": settings.permadeath, "permadeath": settings.permadeath,
"pet_enabled": settings.pet_enabled, "pet_enabled": settings.pet_enabled,
"pet_name": settings.pet_name if settings.pet_enabled else "",
"pet_species": settings.pet_species if settings.pet_enabled else "",
"player_name": run_state.player_name, "player_name": run_state.player_name,
"base_archetype": run_state.base_archetype, "base_archetype": run_state.base_archetype,
"race": dialogue_player.race,
}, },
"%s begins a new run." % run_state.player_name, "%s begins a new run." % run_state.player_name,
&"player", &"player",
@@ -226,6 +246,17 @@ func _initialize_run_state() -> void:
run_state.append_events([game_started]) run_state.append_events([game_started])
_observe_achievements([game_started]) _observe_achievements([game_started])
func _initialize_tutorial_kit() -> void:
# Floors one and two use DCWASCII's class-neutral kit so combat is explicit
# and playable without pre-empting the floor-three class choice.
run_state.gold = 15
var knife := ItemInstanceType.new(ItemDefinitionType.from_catalog(spell_catalog, &"weapon_hunting_knife"), 1, &"tutorial-knife")
var bandage := ItemInstanceType.new(ItemDefinitionType.from_catalog(spell_catalog, &"consumable_bandage"), 1, &"tutorial-bandage")
run_state.inventory.add_item(knife)
run_state.inventory.add_item(bandage)
run_state.equipment.equip(run_state.inventory, knife.instance_id, game_state.player, run_state.identification)
_sync_player_equipment()
func _apply_loaded_run(loaded: Dictionary) -> void: func _apply_loaded_run(loaded: Dictionary) -> void:
run_state = loaded.get("run_state") run_state = loaded.get("run_state")
game_state = loaded.get("game_state") game_state = loaded.get("game_state")
@@ -258,6 +289,15 @@ func _apply_loaded_run(loaded: Dictionary) -> void:
game_state.update_exploration() game_state.update_exploration()
_refresh_title() _refresh_title()
func _is_automated_test_run() -> bool:
var arguments := OS.get_cmdline_args() + OS.get_cmdline_user_args()
if "--test-mode" in arguments:
return true
for argument in arguments:
if argument.begins_with("-g"):
return true
return false
func _get_capture_mode() -> String: func _get_capture_mode() -> String:
var arguments := OS.get_cmdline_user_args() var arguments := OS.get_cmdline_user_args()
if "--capture-exit" in arguments: if "--capture-exit" in arguments:
@@ -280,16 +320,42 @@ func _capture_visual_check(capture_mode: String) -> void:
get_tree().quit(0 if result == OK else 1) get_tree().quit(0 if result == OK else 1)
func _prepare_exit_capture_state() -> void: func _prepare_exit_capture_state() -> void:
game_state.map.set_cell(Vector2i(4, 10), GridMapStateType.CellKind.FLOOR) # Preserve the entrance exploration, then frame the authored surface exit.
game_state.map.set_cell(Vector2i(4, 7), GridMapStateType.CellKind.FLOOR) # This exercises visible, explored, and unknown rendering without depending
game_state.player.cell = Vector2i(18, 4) # on the removed prototype-map coordinates.
# The exit capture represents a reached stair route; make the B6 gate game_state.map.set_cell(Vector2i(36, 7), GridMapStateType.CellKind.FLOOR)
# eligible so the visual fixture remains valid without weakening gameplay. game_state.player.cell = game_state.floor_state.exit
run_state.current_floor_deadline().turns_remaining = FloorDeadline.STAIRS_OPEN_DAYS_BEFORE_COLLAPSE * FloorDeadline.TURNS_PER_DAY game_state.update_exploration()
_process_interact() _sync_map_renderer_visibility()
_sync_minimap()
player_view.refresh()
_sync_camera_to_player() _sync_camera_to_player()
func _input(event: InputEvent) -> void:
# Movement and wait commands belong to gameplay even if a previously opened
# Control retained keyboard focus. Handle them before focused UI consumes the
# arrow event; modal panels still own navigation and are handled below.
if event is InputEventKey and event.is_pressed() and not event.echo and not _has_modal_panel_open():
var physical_direction := _physical_movement_direction(event as InputEventKey)
if physical_direction != Vector2i.ZERO:
action_router.submit(PlayerActionType.new(&"move", physical_direction))
get_viewport().set_input_as_handled()
func _has_modal_panel_open() -> bool:
return options_panel.visible or help_panel.visible or faction_panel.visible or moderation_panel.visible or audience_panel.visible or recap_panel.visible or achievement_panel.visible or race_class_choice_panel.visible or progression_choice_panel.visible or character_panel.visible or party_panel.visible or companion_panel.visible or quest_panel.visible or event_panel.visible or dialogue_panel.visible or crafting_panel.visible or shop_panel.visible or inventory_panel.visible or loot_panel.visible or targeting_overlay.visible or spell_targeting_overlay.visible
func _physical_movement_direction(event: InputEventKey) -> Vector2i:
match event.physical_keycode:
KEY_UP: return Vector2i.UP
KEY_DOWN: return Vector2i.DOWN
KEY_LEFT: return Vector2i.LEFT
KEY_RIGHT: return Vector2i.RIGHT
return Vector2i.ZERO
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and event.echo:
get_viewport().set_input_as_handled()
return
if run_state != null and run_state.is_game_over: if run_state != null and run_state.is_game_over:
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
return return
@@ -347,6 +413,15 @@ func _unhandled_input(event: InputEvent) -> void:
return return
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
return return
if race_class_choice_panel.visible and event is InputEventKey and event.is_pressed():
if event.keycode == KEY_UP:
race_class_choice_panel.select_next(-1)
elif event.keycode == KEY_DOWN:
race_class_choice_panel.select_next(1)
elif event.keycode == KEY_ENTER or event.keycode == KEY_SPACE:
race_class_choice_panel.confirm()
get_viewport().set_input_as_handled()
return
if progression_choice_panel.visible and event is InputEventKey and event.is_pressed(): if progression_choice_panel.visible and event is InputEventKey and event.is_pressed():
if event.keycode == KEY_UP: if event.keycode == KEY_UP:
progression_choice_panel.select_next(-1) progression_choice_panel.select_next(-1)
@@ -535,9 +610,11 @@ func equip_test_ranged_weapon(definition: Dictionary, ammunition: int) -> void:
game_state.player.equip_ranged_weapon(definition, ammunition) game_state.player.equip_ranged_weapon(definition, ammunition)
func submit_player_action(action: PlayerAction) -> Array[GameEvent]: func submit_player_action(action: PlayerAction) -> Array[GameEvent]:
if run_state.is_game_over: if run_state.is_game_over or race_class_choice_panel.visible:
last_turn_results = [] last_turn_results = []
return [] return []
_turn_start_player_hit_points = game_state.player.hit_points
_turn_start_companion_hit_points = game_state.companion.actor.hit_points if game_state.companion != null else -1
match action.kind: match action.kind:
&"move": &"move":
last_turn_results = _process_action(action.direction) last_turn_results = _process_action(action.direction)
@@ -597,6 +674,10 @@ func submit_player_action(action: PlayerAction) -> Array[GameEvent]:
last_turn_results = [] last_turn_results = []
hud.toggle_log() hud.toggle_log()
return [] return []
&"save":
last_turn_results = []
save_requested.emit()
return []
&"ranged": &"ranged":
return _begin_targeting() return _begin_targeting()
&"ranged_target": &"ranged_target":
@@ -609,24 +690,25 @@ func submit_player_action(action: PlayerAction) -> Array[GameEvent]:
return _record_unavailable_action(action) return _record_unavailable_action(action)
func _begin_targeting() -> Array[GameEvent]: func _begin_targeting() -> Array[GameEvent]:
if game_state.player.ranged_weapon.is_empty():
return _record_non_turn_event(&"invalid_ranged_target", &"", {"reason": &"no_ranged_weapon", "damage": 0}, "Aucune arme à distance n’est équipée.")
var targets: Dictionary[StringName, Vector2i] = {} var targets: Dictionary[StringName, Vector2i] = {}
var ranged_combat := RangedCombatType.new()
for enemy_id: StringName in game_state.enemies: for enemy_id: StringName in game_state.enemies:
var enemy: ActorState = game_state.enemies[enemy_id] var enemy: ActorState = game_state.enemies[enemy_id]
if enemy.is_alive(): if enemy.is_alive() and ranged_combat.validation_reason(game_state.map, game_state.player, enemy).is_empty():
targets[enemy_id] = enemy.cell targets[enemy_id] = enemy.cell
if game_state.player.ranged_weapon.is_empty():
return _record_ranged_event(&"invalid_ranged_target", &"", {"reason": &"no_ranged_weapon", "damage": 0}, "No ranged weapon is equipped.")
if targets.is_empty(): if targets.is_empty():
return _record_ranged_event(&"invalid_ranged_target", &"", {"reason": &"invalid_target", "damage": 0}, "No valid ranged target.") return _record_non_turn_event(&"invalid_ranged_target", &"", {"reason": &"invalid_target", "damage": 0}, "Aucune cible valide à portée et en ligne de vue.")
targeting_overlay.begin(targets) targeting_overlay.begin(targets)
return _record_ranged_event(&"targeting_started", &"", {"target_ids": targeting_overlay.get_target_ids()}, "Choose a ranged target.") return _record_non_turn_event(&"targeting_started", &"", {"target_ids": targeting_overlay.get_target_ids()}, "Choisissez une cible à distance.")
func _on_target_selected(target_id: StringName) -> void: func _on_target_selected(target_id: StringName) -> void:
action_router.submit(PlayerActionType.new(&"ranged_target", Vector2i.ZERO, target_id)) action_router.submit(PlayerActionType.new(&"ranged_target", Vector2i.ZERO, target_id))
func _cancel_targeting() -> void: func _cancel_targeting() -> void:
targeting_overlay.finish() targeting_overlay.finish()
_record_ranged_event(&"targeting_cancelled", &"", {}, "Ranged targeting cancelled.") _record_non_turn_event(&"targeting_cancelled", &"", {}, "Ciblage à distance annulé.")
func _begin_spell_targeting() -> Array[GameEvent]: func _begin_spell_targeting() -> Array[GameEvent]:
var available: Array[StringName] = [] var available: Array[StringName] = []
@@ -707,6 +789,15 @@ func _process_ranged_target(target_id: StringName) -> Array[TurnResult]:
TurnResolver.append_enemy_response(game_state, results) TurnResolver.append_enemy_response(game_state, results)
return _resolve_player_action(results, true) return _resolve_player_action(results, true)
func _record_non_turn_event(kind: StringName, target_id: StringName, payload: Dictionary, message: String) -> Array[GameEvent]:
var event := GameEventType.new(run_state.current_turn, run_state.current_floor, kind, payload, message, &"player", target_id, game_state.player.cell)
var events: Array[GameEvent] = [event]
run_state.append_events(events)
event_presenter.enqueue(events)
event_presenter.present_next()
hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state)
return events
func _record_ranged_event(kind: StringName, target_id: StringName, payload: Dictionary, message: String) -> Array[GameEvent]: func _record_ranged_event(kind: StringName, target_id: StringName, payload: Dictionary, message: String) -> Array[GameEvent]:
var event := GameEventType.new(run_state.next_turn(), run_state.current_floor, kind, payload, message, &"player", target_id, game_state.player.cell) var event := GameEventType.new(run_state.next_turn(), run_state.current_floor, kind, payload, message, &"player", target_id, game_state.player.cell)
var events: Array[GameEvent] = [event] var events: Array[GameEvent] = [event]
@@ -796,7 +887,7 @@ func _process_interact() -> Array[TurnResult]:
# behavior and are deliberately not used as item sources in this slice. # behavior and are deliberately not used as item sources in this slice.
if game_state.floor_state.ground_items.has(game_state.player.cell): if game_state.floor_state.ground_items.has(game_state.player.cell):
return _process_ground_pickup() return _process_ground_pickup()
if _is_down_stairs() and not run_state.current_floor_deadline().can_descend(): if _is_down_stairs() and run_state.current_floor > 0 and not run_state.current_floor_deadline().can_descend():
var deadline := run_state.current_floor_deadline() var deadline := run_state.current_floor_deadline()
var blocked := _deadline_result( var blocked := _deadline_result(
&"stairs_refused", &"stairs_refused",
@@ -1369,6 +1460,7 @@ func _use_selected_inventory_item(target = null) -> void:
return return
var result := run_state.inventory.use_item(item.instance_id, game_state.player, run_state.identification, target) var result := run_state.inventory.use_item(item.instance_id, game_state.player, run_state.identification, target)
if bool(result.accepted): if bool(result.accepted):
_apply_item_use_effects(result.effects)
_record_ranged_event(&"item_used", &"", {"instance_id": item.instance_id, "effects": result.effects, "revealed": result.revealed}, "Used %s." % item.definition.name) _record_ranged_event(&"item_used", &"", {"instance_id": item.instance_id, "effects": result.effects, "revealed": result.revealed}, "Used %s." % item.definition.name)
elif result.reason == &"target_required": elif result.reason == &"target_required":
_record_ranged_event(&"item_targeting_started", &"", {"instance_id": item.instance_id, "target_kind": &"ally"}, "Choose an ally target for %s." % item.definition.name) _record_ranged_event(&"item_targeting_started", &"", {"instance_id": item.instance_id, "target_kind": &"ally"}, "Choose an ally target for %s." % item.definition.name)
@@ -1376,6 +1468,11 @@ func _use_selected_inventory_item(target = null) -> void:
_record_ranged_event(&"item_use_refused", &"", {"instance_id": item.instance_id, "reason": result.reason}, "Cannot use that item.") _record_ranged_event(&"item_use_refused", &"", {"instance_id": item.instance_id, "reason": result.reason}, "Cannot use that item.")
inventory_panel.refresh() inventory_panel.refresh()
func _apply_item_use_effects(effects: Array) -> void:
for effect: Dictionary in effects:
if StringName(effect.get("type", "")) == &"learn_spell":
spell_state.learn(StringName(effect.get("spell", "")))
# Public hook for the future party selector: it applies the currently selected # Public hook for the future party selector: it applies the currently selected
# ally-target consumable without coupling this D3 slice to a party UI. # ally-target consumable without coupling this D3 slice to a party UI.
func submit_inventory_ally_target(target) -> Array[GameEvent]: func submit_inventory_ally_target(target) -> Array[GameEvent]:
@@ -1422,15 +1519,19 @@ func _take_all_loot() -> void:
else: else:
refused_items.append({"item_id": StringName(item_data.get("item_id", "")), "quantity": int(item_data.get("quantity", 1)), "reason": result.reason}) refused_items.append({"item_id": StringName(item_data.get("item_id", "")), "quantity": int(item_data.get("quantity", 1)), "reason": result.reason})
var gold := int(pending_loot.get("gold", 0)) var gold := int(pending_loot.get("gold", 0))
var ammunition := maxi(0, int(pending_loot.get("ammunition", 0)))
run_state.gold += gold run_state.gold += gold
game_state.player.ammunition += ammunition
loot_panel.dismiss() loot_panel.dismiss()
var message := "Butin récupéré" var message := "Butin récupéré"
if gold > 0: if gold > 0:
message += " : +%d or" % gold message += " : +%d or" % gold
if ammunition > 0:
message += " : +%d munitions" % ammunition
if not refused_items.is_empty(): if not refused_items.is_empty():
message += " (inventaire plein pour certains objets)" message += " (inventaire plein pour certains objets)"
message += "." message += "."
_record_ranged_event(&"loot_taken", &"", {"items": accepted_items, "gold": gold, "refused_items": refused_items}, message) _record_ranged_event(&"loot_taken", &"", {"items": accepted_items, "gold": gold, "ammunition": ammunition, "refused_items": refused_items}, message)
pending_loot.clear() pending_loot.clear()
func _process_rest() -> Array[TurnResult]: func _process_rest() -> Array[TurnResult]:
@@ -1494,14 +1595,59 @@ func _transition_floor(stairs_cell: Vector2i) -> void:
game_state.set_floor_state(destination) game_state.set_floor_state(destination)
game_state.content_catalog = spell_catalog game_state.content_catalog = spell_catalog
game_state.player.cell = transition["arrival"] game_state.player.cell = transition["arrival"]
_place_companion_near_player()
game_state.update_exploration() game_state.update_exploration()
map_renderer.set_map(game_state.map) map_renderer.set_map(game_state.map)
_sync_map_renderer_visibility() _sync_map_renderer_visibility()
_sync_minimap() _sync_minimap()
player_view.set_actor(game_state.player) player_view.set_actor(game_state.player)
_sync_camera_to_player() # Camera bounds are map-specific. Recompute them before positioning the
# camera whenever a floor transition swaps the active map dimensions.
_configure_camera()
_sync_enemy_views() _sync_enemy_views()
hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state) hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state)
_check_floor_three_race_class_milestone()
func _place_companion_near_player() -> void:
if game_state.companion == null or not game_state.companion.is_alive():
return
var occupied: Dictionary[Vector2i, bool] = {game_state.player.cell: true}
for enemy: ActorState in game_state.enemies.values():
if enemy.is_alive():
occupied[enemy.cell] = true
for member: ActorState in game_state.party.living_members():
occupied[member.cell] = true
for direction: Vector2i in [Vector2i.LEFT, Vector2i.DOWN, Vector2i.RIGHT, Vector2i.UP]:
var candidate := game_state.player.cell + direction
if game_state.map.is_walkable(candidate) and not occupied.has(candidate):
game_state.companion.actor.cell = candidate
return
func _check_floor_three_race_class_milestone() -> void:
if run_state.current_floor != 3 or (not dialogue_player.race.is_empty() and not dialogue_player.archetype.is_empty()):
return
race_class_choice_panel.present_races(class_engine.race_definitions())
_record_ranged_event(
&"race_class_choice_required",
&"",
{"floor": run_state.current_floor},
"Niveau 3 du Donjon : choisissez votre race, puis votre classe."
)
func _choose_floor_three_race(race_id: StringName) -> void:
var result := class_engine.choose_race(dialogue_player, race_id)
if not bool(result.get("accepted", false)):
return
_record_ranged_event(&"race_chosen", race_id, {}, "Race choisie : %s." % race_id)
race_class_choice_panel.present_classes(class_engine.class_definitions(dialogue_player.race))
func _choose_floor_three_class(class_id: StringName) -> void:
var result := class_engine.choose_class(dialogue_player, class_id)
if not bool(result.get("accepted", false)):
return
run_state.base_archetype = dialogue_player.archetype
race_class_choice_panel.dismiss()
_record_ranged_event(&"class_chosen", class_id, {}, "Classe choisie : %s." % class_id)
func _process_action(direction: Vector2i) -> Array[TurnResult]: func _process_action(direction: Vector2i) -> Array[TurnResult]:
var results := game_state.try_player_action(direction) var results := game_state.try_player_action(direction)
@@ -1532,14 +1678,18 @@ func _append_collapse_damage(results: Array[TurnResult]) -> void:
# journal: results from one resolved player action are converted and appended once, # journal: results from one resolved player action are converted and appended once,
# and every resulting GameEvent shares that action's turn number. # and every resulting GameEvent shares that action's turn number.
func _resolve_player_action(results: Array[TurnResult], sync_camera: bool) -> Array[TurnResult]: func _resolve_player_action(results: Array[TurnResult], sync_camera: bool) -> Array[TurnResult]:
if _results_consume_turn(results):
_apply_passive_health_regeneration(results)
_sync_map_renderer_visibility() _sync_map_renderer_visibility()
_sync_minimap() _sync_minimap()
player_view.refresh() player_view.refresh()
_sync_companion_view() _sync_companion_view()
_sync_party_views() _sync_party_views()
_sync_enemy_views()
if sync_camera: if sync_camera:
_sync_camera_to_player() _sync_camera_to_player()
_dispatch_audio(results) _dispatch_audio(results)
_resolve_enemy_loot(results)
var events := _record_events(results) var events := _record_events(results)
_resolve_player_death_if_needed() _resolve_player_death_if_needed()
_append_level_up_events(events) _append_level_up_events(events)
@@ -1565,6 +1715,39 @@ func _resolve_player_action(results: Array[TurnResult], sync_camera: bool) -> Ar
hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state) hud.refresh(game_state, run_state.recent_events(run_state.log.size()), run_state)
return results return results
func _results_consume_turn(results: Array[TurnResult]) -> bool:
if results.is_empty():
return false
return not results.all(func(result: TurnResult) -> bool:
return result.kind in [&"blocked", &"nothing_to_interact", &"rest_refused", &"stairs_refused"]
)
func _apply_passive_health_regeneration(results: Array[TurnResult]) -> void:
_sync_dialogue_player_progression()
var player_took_damage := (_turn_start_player_hit_points >= 0 and game_state.player.hit_points < _turn_start_player_hit_points) or results.any(func(result: TurnResult) -> bool:
return result.damage > 0 and (result.target_id == game_state.player.id or result.kind == &"collapse_damage")
)
var perk_bonus := int(perk_engine.modifiers().get("regen_bonus", 0)) if perk_engine != null else 0
if not player_took_damage:
HealthRegenerationType.apply(
game_state.player,
dialogue_player.effective_attribute(&"end"),
dialogue_player.effective_skill(&"regeneration"),
perk_bonus,
run_state.settings.difficulty_id
)
var companion_took_damage := game_state.companion != null and ((_turn_start_companion_hit_points >= 0 and game_state.companion.actor.hit_points < _turn_start_companion_hit_points) or results.any(func(result: TurnResult) -> bool:
return result.damage > 0 and result.target_id == game_state.companion.actor.id
))
if game_state.companion != null and game_state.companion.is_alive() and not companion_took_damage:
HealthRegenerationType.apply(
game_state.companion.actor,
game_state.companion.endurance,
game_state.companion.regeneration_skill,
game_state.companion.regeneration_perk_bonus,
run_state.settings.difficulty_id
)
func _resolve_player_death_if_needed() -> void: func _resolve_player_death_if_needed() -> void:
if game_state.player.is_alive() or run_state.is_game_over: if game_state.player.is_alive() or run_state.is_game_over:
return return
@@ -1708,6 +1891,30 @@ func _append_level_up_events(events: Array[GameEvent]) -> void:
run_state.append_events([level_event]) run_state.append_events([level_event])
_check_progression_choices_and_evolutions() _check_progression_choices_and_evolutions()
func _resolve_enemy_loot(results: Array[TurnResult]) -> void:
var resolved_enemy_ids: Dictionary[StringName, bool] = {}
for result: TurnResult in results:
var descriptors: Array = result.payload.get("domain_events", [])
for descriptor: Dictionary in descriptors:
if descriptor.kind != &"loot_dropped" or descriptor.actor_id == &"player" or resolved_enemy_ids.has(StringName(descriptor.actor_id)):
continue
resolved_enemy_ids[StringName(descriptor.actor_id)] = true
var table_id := StringName(descriptor.payload.get("loot_table", ""))
var table := spell_catalog.get_loot_table(table_id) if spell_catalog != null else {}
var reward := LootResolverType.resolve(table, run_state.seed, "enemy:%d:%s" % [run_state.current_floor, descriptor.actor_id])
reward["loot_table"] = table_id
descriptor.payload = reward
var drop_cell: Vector2i = result.to_cell
for item_data: Dictionary in reward.items:
var definition := ItemDefinitionType.from_catalog(spell_catalog, StringName(item_data.get("item_id", "")))
if not definition.is_valid():
continue
if not game_state.floor_state.ground_items.has(drop_cell):
game_state.floor_state.ground_items[drop_cell] = []
game_state.floor_state.ground_items[drop_cell].append(ItemInstanceType.new(definition, int(item_data.get("quantity", 1))))
run_state.gold += int(reward.gold)
_sync_map_renderer_visibility()
func _record_events(results: Array[TurnResult]) -> Array[GameEvent]: func _record_events(results: Array[TurnResult]) -> Array[GameEvent]:
var events: Array[GameEvent] = [] var events: Array[GameEvent] = []
if results.is_empty(): if results.is_empty():
@@ -1764,34 +1971,12 @@ func _get_actor_view(actor_id: StringName) -> ActorView:
return enemy_views.get(actor_id) as ActorView return enemy_views.get(actor_id) as ActorView
func _create_initial_state() -> GameState: func _create_initial_state() -> GameState:
var map := GridMapStateType.new(Vector2i(30, 20), GridMapStateType.CellKind.WALL) # Run initialization immediately replaces this neutral shell with the authored
_carve_room(map, Rect2i(2, 12, 6, 5)) # surface. Keeping the shell content-free prevents the removed prototype map
_carve_room(map, Rect2i(2, 4, 7, 7)) # from becoming an accidental gameplay source again.
_carve_room(map, Rect2i(10, 2, 10, 6)) var map := GridMapStateType.new(Vector2i.ONE, GridMapStateType.CellKind.FLOOR)
_carve_room(map, Rect2i(21, 5, 7, 8)) var player := ActorStateType.new(&"player", Vector2i.ZERO, 12, 3)
_carve_vertical_corridor(map, 4, 10, 12) return GameStateType.new(map, player, {})
_carve_horizontal_corridor(map, 8, 10, 6)
_carve_horizontal_corridor(map, 18, 21, 6)
_carve_vertical_corridor(map, 18, 4, 6)
map.set_cell(Vector2i(4, 11), GridMapStateType.CellKind.CLOSED_DOOR)
map.set_cell(Vector2i(4, 7), GridMapStateType.CellKind.CHEST)
map.set_cell(Vector2i(18, 4), GridMapStateType.CellKind.STAIRS)
var player := ActorStateType.new(&"player", Vector2i(4, 12), 12, 3)
var goblin := ActorStateType.new(&"goblin", Vector2i(24, 8), 6, 2)
return GameStateType.new(map, player, {&"goblin": goblin})
func _carve_room(map: GridMapState, room: Rect2i) -> void:
for y in range(room.position.y, room.end.y):
for x in range(room.position.x, room.end.x):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
func _carve_horizontal_corridor(map: GridMapState, from_x: int, to_x: int, y: int) -> void:
for x in range(from_x, to_x + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
func _carve_vertical_corridor(map: GridMapState, x: int, from_y: int, to_y: int) -> void:
for y in range(from_y, to_y + 1):
map.set_cell(Vector2i(x, y), GridMapStateType.CellKind.FLOOR)
func _configure_camera() -> void: func _configure_camera() -> void:
var map_size := game_state.map.size * TILE_SIZE var map_size := game_state.map.size * TILE_SIZE
@@ -1863,4 +2048,8 @@ func _sync_enemy_views() -> void:
view.texture = preload("res://assets/dcss/goblin.png") view.texture = preload("res://assets/dcss/goblin.png")
enemies.add_child(view) enemies.add_child(view)
enemy_views[enemy_id] = view enemy_views[enemy_id] = view
enemy_views[enemy_id].set_actor(game_state.enemies[enemy_id]) var enemy: ActorState = game_state.enemies[enemy_id]
enemy_views[enemy_id].set_actor(enemy)
# Actor sprites must obey the same current-FOV contract as special map
# markers. Explored memory never reveals a live enemy.
enemy_views[enemy_id].visible = enemy.is_alive() and game_state.visible_cells.has(enemy.cell)
+5 -3
View File
@@ -4,6 +4,9 @@ extends RefCounted
# The Input Map owns physical bindings; this catalog gives every rebindable action # The Input Map owns physical bindings; this catalog gives every rebindable action
# its stable identifier, player command and user-facing French help name. # its stable identifier, player command and user-facing French help name.
const ACTIONS: Array[StringName] = [ const ACTIONS: Array[StringName] = [
# Modifier shortcuts must be checked before their unmodified key (Ctrl+S
# before south), otherwise Godot also considers the physical S match.
&"save",
&"interact", &"interact",
&"move_north", &"move_north",
&"move_south", &"move_south",
@@ -14,7 +17,6 @@ const ACTIONS: Array[StringName] = [
&"move_southwest", &"move_southwest",
&"move_southeast", &"move_southeast",
&"wait", &"wait",
&"attack",
&"ranged", &"ranged",
&"cast", &"cast",
&"talk", &"talk",
@@ -47,8 +49,8 @@ const HELP_NAMES := {
&"move_southeast": "Déplacer vers le sud-est", &"move_southeast": "Déplacer vers le sud-est",
&"wait": "Attendre", &"wait": "Attendre",
&"interact": "Interagir", &"interact": "Interagir",
&"attack": "Attaquer", &"ranged": "Attaque à distance / choisir une cible",
&"ranged": "Attaque à distance", &"save": "Sauvegarder manuellement (V ou Ctrl+S)",
&"cast": "Lancer un sort", &"cast": "Lancer un sort",
&"talk": "Parler", &"talk": "Parler",
&"rest": "Se reposer", &"rest": "Se reposer",
+47
View File
@@ -0,0 +1,47 @@
class_name TemporaryPlaytestKit
extends RefCounted
## TEMPORARY PLAYTEST FIXTURE
##
## Remove this file and its single call in Game once normal early-game loot and
## encounter balance can exercise melee, ranged, and offensive magic naturally.
## It deliberately does not modify procedural generation or authored loot tables.
const CHESTS := {
Vector2i(3, 6): {
"label": "MÊLÉE",
"items": [{"item_id": &"weapon_rusty_sword", "quantity": 1}],
"ammunition": 0,
},
Vector2i(5, 6): {
"label": "DISTANCE",
"items": [{"item_id": &"weapon_hand_crossbow", "quantity": 1}],
"ammunition": 20,
},
Vector2i(6, 6): {
"label": "MAGIE OFFENSIVE",
"items": [{"item_id": &"misc_grimoire_ombre", "quantity": 1}],
"ammunition": 0,
},
}
static func apply_to_new_run(floor: FloorState) -> void:
if floor == null or floor.floor_number != 0:
return
floor.metadata["temporary_playtest_chests"] = true
for cell: Vector2i in CHESTS:
var reward: Dictionary = CHESTS[cell]
floor.chests[cell] = {
"loot_table_id": &"",
"opened": false,
"temporary_playtest": true,
"label": reward.label,
"reward": {
"items": reward.items.duplicate(true),
"gold": 0,
"empty": false,
"trap": &"",
"ammunition": int(reward.ammunition),
},
}
floor.map.set_cell(cell, GridMapState.CellKind.CHEST)
@@ -0,0 +1 @@
uid://b1f30fl11cbkt
@@ -12,6 +12,11 @@ const AMBIENCE_CONTEXTS := [&"exploration", &"combat", &"danger"]
const SFX_EVENTS := [&"attack_given", &"attack_received", &"menu_select", &"menu_cancel", &"item_use", &"death"] const SFX_EVENTS := [&"attack_given", &"attack_received", &"menu_select", &"menu_cancel", &"item_use", &"death"]
const USER_AUDIO_DIRECTORY := "user://audio" const USER_AUDIO_DIRECTORY := "user://audio"
const USER_MANIFEST_PATH := "user://audio/audio_import_manifest.tres" const USER_MANIFEST_PATH := "user://audio/audio_import_manifest.tres"
const BUNDLED_AMBIENCE_PATHS := {
&"exploration": "res://assets/audio/dungeon_exploration.wav",
&"combat": "res://assets/audio/dungeon_combat.wav",
&"danger": "res://assets/audio/dungeon_danger.wav",
}
var ambience_streams: Dictionary = {} var ambience_streams: Dictionary = {}
var sfx_streams: Dictionary = {} var sfx_streams: Dictionary = {}
@@ -46,9 +51,23 @@ static func save_user_manifest(manifest: AudioImportManifest) -> Error:
return ResourceSaver.save(manifest, USER_MANIFEST_PATH) return ResourceSaver.save(manifest, USER_MANIFEST_PATH)
static func load_user_manifest() -> AudioImportManifest: static func load_user_manifest() -> AudioImportManifest:
var manifest := load_bundled_manifest()
if not FileAccess.file_exists(USER_MANIFEST_PATH): if not FileAccess.file_exists(USER_MANIFEST_PATH):
return AudioImportManifest.new() return manifest
var resource := ResourceLoader.load(USER_MANIFEST_PATH, "AudioImportManifest", ResourceLoader.CACHE_MODE_IGNORE) var resource := ResourceLoader.load(USER_MANIFEST_PATH, "AudioImportManifest", ResourceLoader.CACHE_MODE_IGNORE)
if resource is AudioImportManifest: if not resource is AudioImportManifest:
return resource as AudioImportManifest return manifest
return AudioImportManifest.new() var user_manifest := resource as AudioImportManifest
for context: StringName in user_manifest.ambience_streams:
manifest.register_ambience(context, user_manifest.ambience_for(context))
for event: StringName in user_manifest.sfx_streams:
manifest.register_sfx(event, user_manifest.sfx_for(event))
return manifest
static func load_bundled_manifest() -> AudioImportManifest:
var manifest := AudioImportManifest.new()
for context: StringName in BUNDLED_AMBIENCE_PATHS:
var stream := ResourceLoader.load(String(BUNDLED_AMBIENCE_PATHS[context])) as AudioStream
if stream != null:
manifest.register_ambience(context, stream)
return manifest
+12 -5
View File
@@ -20,12 +20,16 @@ var _last_ambience_path := ""
var _last_sfx_path := "" var _last_sfx_path := ""
func _init(manifest_or_legacy_root: Variant = null) -> void: func _init(manifest_or_legacy_root: Variant = null) -> void:
# The former API accepted an external directory override. Intentionally ignore
# it for compatibility: external paths are not a safe playback source.
if manifest_or_legacy_root is AudioImportManifest: if manifest_or_legacy_root is AudioImportManifest:
_manifest = manifest_or_legacy_root as AudioImportManifest _manifest = manifest_or_legacy_root as AudioImportManifest
else: elif manifest_or_legacy_root == null:
# Production instances load bundled music and optionally overlay the safe
# Godot-native user manifest.
_manifest = AudioImportManifestType.load_user_manifest() _manifest = AudioImportManifestType.load_user_manifest()
else:
# The former API accepted an external directory override. Keep explicit
# legacy instances isolated and silent: arbitrary files are never decoded.
_manifest = AudioImportManifestType.new()
func _ready() -> void: func _ready() -> void:
_ensure_players() _ensure_players()
@@ -40,9 +44,12 @@ func set_manifest(manifest: AudioImportManifest) -> void:
func set_ambience_context(context: String) -> void: func set_ambience_context(context: String) -> void:
if not context in AMBIENCE_CONTEXTS: if not context in AMBIENCE_CONTEXTS:
return return
var stream := _manifest.ambience_for(StringName(context))
if current_ambience_context == context and _ambience_player != null and _ambience_player.stream == stream and _ambience_player.playing:
return
current_ambience_context = context current_ambience_context = context
_last_ambience_path = "" _last_ambience_path = stream.resource_path if stream != null else ""
_set_ambience_stream(_manifest.ambience_for(StringName(context))) _set_ambience_stream(stream)
func play_sfx(event: String) -> void: func play_sfx(event: String) -> void:
_last_sfx_path = "" _last_sfx_path = ""
+29 -5
View File
@@ -116,7 +116,7 @@ func _serialize(run: RunState, game: GameState, dialogue_player) -> Dictionary:
identified.append(String(id)) identified.append(String(id))
return { return {
"version": SCHEMA_VERSION, "version": SCHEMA_VERSION,
"run": {"seed": run.seed, "settings": {"seed": run.settings.seed, "difficulty_id": String(run.settings.difficulty_id), "permadeath": run.settings.permadeath, "pet_enabled": run.settings.pet_enabled}, "player_name": run.player_name, "base_archetype": String(run.base_archetype), "current_floor": run.current_floor, "current_turn": run.current_turn, "gold": run.gold, "floors": floors, "floor_deadlines": deadlines, "inventory": run.inventory.to_dict(), "equipment": equipment, "identified_instance_ids": identified, "quest_records": run.quest_records, "achievement_state": run.achievement_state, "audience_state": run.audience_state, "recap_state": run.recap_state, "faction_war_state": run.faction_war_state, "moderation_state": run.moderation_state, "endgame_state": {"victory": run.endgame_state.victory}, "is_game_over": run.is_game_over, "death_outcome": String(run.death_outcome), "slot_policy": String(run.slot_policy), "log": _events_to_data(run.log), "meta": {}}, "run": {"seed": run.seed, "settings": {"seed": run.settings.seed, "difficulty_id": String(run.settings.difficulty_id), "permadeath": run.settings.permadeath, "pet_enabled": run.settings.pet_enabled, "pet_name": run.settings.pet_name, "pet_species": run.settings.pet_species}, "player_name": run.player_name, "base_archetype": String(run.base_archetype), "current_floor": run.current_floor, "current_turn": run.current_turn, "gold": run.gold, "floors": floors, "floor_deadlines": deadlines, "inventory": run.inventory.to_dict(), "equipment": equipment, "identified_instance_ids": identified, "quest_records": run.quest_records, "achievement_state": run.achievement_state, "audience_state": run.audience_state, "recap_state": run.recap_state, "faction_war_state": run.faction_war_state, "moderation_state": run.moderation_state, "endgame_state": {"victory": run.endgame_state.victory}, "is_game_over": run.is_game_over, "death_outcome": String(run.death_outcome), "slot_policy": String(run.slot_policy), "log": _events_to_data(run.log), "meta": {}},
"runtime": {"player": _actor_to_data(game.player), "companion": _companion_to_data(game.companion), "party": _actors_to_data(game.party.members), "dialogue_player": _dialogue_to_data(dialogue_player)}, "runtime": {"player": _actor_to_data(game.player), "companion": _companion_to_data(game.companion), "party": _actors_to_data(game.party.members), "dialogue_player": _dialogue_to_data(dialogue_player)},
"metadata": {"updated_at": Time.get_unix_time_from_system(), "source": "godot"}, "metadata": {"updated_at": Time.get_unix_time_from_system(), "source": "godot"},
} }
@@ -124,7 +124,7 @@ func _serialize(run: RunState, game: GameState, dialogue_player) -> Dictionary:
func _deserialize(data: Dictionary, catalog: ContentCatalog) -> Dictionary: func _deserialize(data: Dictionary, catalog: ContentCatalog) -> Dictionary:
var run_data: Dictionary = data.get("run", {}) var run_data: Dictionary = data.get("run", {})
var settings_data: Dictionary = run_data.get("settings", {}) var settings_data: Dictionary = run_data.get("settings", {})
var run := RunStateType.new(String(run_data.get("seed", "")), RunSettingsType.new(String(settings_data.get("seed", run_data.get("seed", ""))), StringName(settings_data.get("difficulty_id", "crawler")), bool(settings_data.get("permadeath", false)), bool(settings_data.get("pet_enabled", false)))) var run := RunStateType.new(String(run_data.get("seed", "")), RunSettingsType.new(String(settings_data.get("seed", run_data.get("seed", ""))), StringName(settings_data.get("difficulty_id", "crawler")), bool(settings_data.get("permadeath", false)), bool(settings_data.get("pet_enabled", false)), String(settings_data.get("pet_name", "Familier")), String(settings_data.get("pet_species", "Animal"))))
run.player_name = String(run_data.get("player_name", "Sans-Nom")); run.base_archetype = StringName(run_data.get("base_archetype", "vanguard")); run.current_floor = int(run_data.get("current_floor", 0)); run.current_turn = int(run_data.get("current_turn", 0)); run.gold = int(run_data.get("gold", 0)) run.player_name = String(run_data.get("player_name", "Sans-Nom")); run.base_archetype = StringName(run_data.get("base_archetype", "vanguard")); run.current_floor = int(run_data.get("current_floor", 0)); run.current_turn = int(run_data.get("current_turn", 0)); run.gold = int(run_data.get("gold", 0))
for key in (run_data.get("floors", {}) as Dictionary): for key in (run_data.get("floors", {}) as Dictionary):
var floor := _floor_from_data(run_data.floors[key], catalog) var floor := _floor_from_data(run_data.floors[key], catalog)
@@ -200,12 +200,36 @@ static func _actors_from_data(data: Array) -> Array[ActorState]:
static func _companion_to_data(companion: CompanionState): static func _companion_to_data(companion: CompanionState):
if companion == null: return null if companion == null: return null
return {"choice_id": String(companion.choice_id), "stance": String(companion.stance), "actor": _actor_to_data(companion.actor)} return {"choice_id": String(companion.choice_id), "stance": String(companion.stance), "name": companion.name, "species": companion.species, "endurance": companion.endurance, "regeneration_skill": companion.regeneration_skill, "regeneration_perk_bonus": companion.regeneration_perk_bonus, "actor": _actor_to_data(companion.actor)}
static func _companion_from_data(data) -> CompanionState: static func _companion_from_data(data) -> CompanionState:
if not data is Dictionary or data.is_empty(): return null if not data is Dictionary or data.is_empty(): return null
var actor := _actor_from_data(data.get("actor", {})); if actor == null: return null var actor_data: Dictionary = data.get("actor", {})
var companion := CompanionStateType.new(StringName(data.get("choice_id", "moth")), actor); companion.stance = StringName(data.get("stance", "follow")); return companion if actor_data.is_empty() and data.has("id"):
actor_data = {
"id": String(data.get("id", "companion")),
"cell": [int(data.get("x", 0)), int(data.get("y", 0))],
"hit_points": int(data.get("hp", 1)),
"max_hit_points": int(data.get("max_hp", data.get("hp", 1))),
"attack_damage": int(data.get("attack_damage", 3)),
"xp": int(data.get("xp", 0)),
}
var actor := _actor_from_data(actor_data); if actor == null: return null
var companion := CompanionStateType.new(StringName(data.get("choice_id", data.get("id", "moth"))), actor)
companion.stance = _legacy_companion_stance(StringName(data.get("stance", data.get("behavior", "stay_back"))))
companion.name = String(data.get("name", "Familier"))
companion.species = String(data.get("species", "Animal"))
var attributes: Dictionary = data.get("attributes", {})
var skills: Dictionary = data.get("skills", {})
var perks: Dictionary = data.get("perks", {})
companion.endurance = int(data.get("endurance", attributes.get("end", 4)))
companion.regeneration_skill = int(data.get("regeneration_skill", skills.get("regeneration", 1)))
companion.regeneration_perk_bonus = int(data.get("regeneration_perk_bonus", perks.get("regen_bonus", 0)))
return companion
static func _legacy_companion_stance(value: StringName) -> StringName:
var normalized := CompanionStateType.normalize_stance(value)
return normalized if normalized in CompanionStateType.VALID_STANCES else CompanionStateType.Stance.STAY_BACK
static func _events_to_data(events: Array[GameEvent]) -> Array: static func _events_to_data(events: Array[GameEvent]) -> Array:
var data: Array = [] var data: Array = []
+4 -4
View File
@@ -25,13 +25,13 @@ func select_next(delta: int) -> bool:
func refresh() -> void: func refresh() -> void:
if _companion == null: if _companion == null:
return return
title.text = "Companion command" title.text = _companion.name
var status := "Alive" if _companion.is_alive() else "Fallen" var status := "En vie" if _companion.is_alive() else "À terre"
body.text = "%s — %s\n\n%s\n\n←/→ Change stance Esc Close" % [String(_companion.choice_id).capitalize(), status, _stance_lines()] 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: func _stance_lines() -> String:
var lines: PackedStringArray = [] var lines: PackedStringArray = []
for stance: StringName in CompanionState.VALID_STANCES: for stance: StringName in CompanionState.VALID_STANCES:
var cursor := "> " if stance == _companion.stance else " " 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) return "\n".join(lines)
+14 -2
View File
@@ -1,12 +1,24 @@
class_name DeathPanel class_name DeathPanel
extends PanelContainer 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: func present(outcome: StringName, player_name: String, floor: int, level: int) -> void:
visible = true 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] 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: func dismiss() -> void:
visible = false visible = false
+3 -3
View File
@@ -1,9 +1,9 @@
class_name DialoguePanel class_name DialoguePanel
extends PanelContainer extends PanelContainer
@onready var title: Label = $Title @onready var title: Label = $Layout/Title
@onready var body: RichTextLabel = $Body @onready var body: RichTextLabel = $Layout/Body
@onready var entries: RichTextLabel = $Entries @onready var entries: RichTextLabel = $Layout/Entries
var _engine: DialogueEngine var _engine: DialogueEngine
var _state: DialogueState var _state: DialogueState
+3 -3
View File
@@ -1,9 +1,9 @@
class_name EventPanel class_name EventPanel
extends PanelContainer extends PanelContainer
@onready var title: Label = $Title @onready var title: Label = $Layout/Title
@onready var body: RichTextLabel = $Body @onready var body: RichTextLabel = $Layout/Body
@onready var entries: RichTextLabel = $Entries @onready var entries: RichTextLabel = $Layout/Entries
var _engine: EventEngine var _engine: EventEngine
var _definition: Dictionary = {} var _definition: Dictionary = {}
+3 -1
View File
@@ -20,5 +20,7 @@ func refresh() -> void:
if not events.is_empty() and events[0] is InputEventKey: if not events.is_empty() and events[0] is InputEventKey:
binding = OS.get_keycode_string((events[0] as InputEventKey).physical_keycode) binding = OS.get_keycode_string((events[0] as InputEventKey).physical_keycode)
lines.append("%s — %s" % [binding, InputBindingsType.help_name_for(action)]) 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) body.text = "\n".join(lines)
+16 -1
View File
@@ -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_health_label: Label = $PlayerHealthLabel
@onready var player_focus_label: Label = $PlayerFocusLabel @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 spell_label: Label = $SpellLabel
@onready var deadline_label: Label = $DeadlineLabel @onready var deadline_label: Label = $DeadlineLabel
@onready var gold_label: Label = $GoldLabel @onready var gold_label: Label = $GoldLabel
@@ -38,6 +40,7 @@ func refresh(state: GameState, events: Array[GameEvent] = [], run_state: RunStat
_run_state = run_state _run_state = run_state
player_health_label.text = "Player HP: %d/%d" % [state.player.hit_points, state.player.max_hit_points] 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] player_focus_label.text = "Focus: %d/%d" % [state.player.focus, state.player.max_focus]
_refresh_experience(state.player.progression)
if state.enemies.has(&"goblin"): if state.enemies.has(&"goblin"):
var goblin: ActorState = state.enemies[&"goblin"] var goblin: ActorState = state.enemies[&"goblin"]
enemy_health_label.text = "Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points] 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: for event in events:
event_log.append_text(event.message + "\n") 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: func get_context_prompt() -> String:
if _state == null: if _state == null:
return "" return ""
@@ -72,7 +85,7 @@ func get_context_prompt() -> String:
&"stairs": &"stairs":
if _state.floor_state.floor_number > 0 and _state.player.cell == _state.floor_state.entrance: if _state.floor_state.floor_number > 0 and _state.player.cell == _state.floor_state.entrance:
return STAIRS_UP_PROMPT 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() var deadline := _run_state.current_floor_deadline()
if not deadline.can_descend(): if not deadline.can_descend():
return "Escaliers verrouillés — encore %d jour(s) avant l’ouverture" % deadline.days_until_stairs_open() 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: func _deadline_status() -> String:
if _run_state == null: if _run_state == null:
return "" return ""
if _run_state.current_floor == 0:
return "Surface — aucun effondrement"
var deadline := _run_state.current_floor_deadline() var deadline := _run_state.current_floor_deadline()
var status := "Étage %d — %d jour(s) avant l’effondrement" % [_run_state.current_floor, deadline.remaining_days()] var status := "Étage %d — %d jour(s) avant l’effondrement" % [_run_state.current_floor, deadline.remaining_days()]
if deadline.collapsing: if deadline.collapsing:
+3 -3
View File
@@ -1,8 +1,8 @@
class_name InventoryPanel class_name InventoryPanel
extends PanelContainer extends PanelContainer
@onready var entries: RichTextLabel = $Entries @onready var entries: RichTextLabel = $Layout/Columns/Entries
@onready var details: RichTextLabel = $Details @onready var details: RichTextLabel = $Layout/Columns/Details
var selected_index := 0 var selected_index := 0
var _inventory: InventoryState var _inventory: InventoryState
@@ -53,7 +53,7 @@ func refresh() -> void:
var stats := _identification.display_stats(item) if _identification != null else "" 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 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 "" 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: func _equipment_summary() -> String:
if _equipment == null or _identification == null: if _equipment == null or _identification == null:
+1 -1
View File
@@ -49,7 +49,7 @@ func _color_for(presentation_kind: StringName) -> Color:
func _label_for(event: GameEvent, presentation_kind: StringName) -> String: func _label_for(event: GameEvent, presentation_kind: StringName) -> String:
match presentation_kind: match presentation_kind:
&"loot": return "✦ LOOT SECURED" &"loot": return "✦ BUTIN AU SOL"
&"trap": return "! TRAP" &"trap": return "! TRAP"
&"quest": return "✦ QUEST UPDATED" &"quest": return "✦ QUEST UPDATED"
_: return event.message _: return event.message
+1 -1
View File
@@ -1,7 +1,7 @@
class_name LootPanel class_name LootPanel
extends PanelContainer extends PanelContainer
@onready var entries: RichTextLabel = $Entries @onready var entries: RichTextLabel = $Layout/Entries
func present(reward: Dictionary, catalog: ContentCatalog) -> void: func present(reward: Dictionary, catalog: ContentCatalog) -> void:
entries.text = _reward_text(reward, catalog) entries.text = _reward_text(reward, catalog)
+10 -28
View File
@@ -1,49 +1,37 @@
class_name CharacterCreation class_name CharacterCreation
extends Control 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 signal cancelled
const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd") 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 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 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_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 seed_edit: LineEdit = $Panel/Layout/Fields/SeedEdit
@onready var difficulty_option: OptionButton = $Panel/Layout/Fields/DifficultyOption @onready var difficulty_option: OptionButton = $Panel/Layout/Fields/DifficultyOption
@onready var permadeath_option: OptionButton = $Panel/Layout/Fields/PermadeathOption @onready var permadeath_option: OptionButton = $Panel/Layout/Fields/PermadeathOption
@onready var validation_label: Label = $Panel/Layout/ValidationLabel @onready var validation_label: Label = $Panel/Layout/ValidationLabel
func _ready() -> void: func _ready() -> void:
_populate_races() pet_check.toggled.connect(func(enabled: bool) -> void: pet_details.visible = enabled)
race_option.item_selected.connect(_refresh_recommendation) pet_details.visible = pet_check.button_pressed
$Panel/Layout/Actions/StartRunButton.pressed.connect(_on_start_run_pressed) $Panel/Layout/Actions/StartRunButton.pressed.connect(_on_start_run_pressed)
$Panel/Layout/Actions/CancelButton.pressed.connect(func() -> void: cancelled.emit()) $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: func _on_start_run_pressed() -> void:
var selected_difficulty := DIFFICULTY_IDS[difficulty_option.selected] var selected_difficulty := DIFFICULTY_IDS[difficulty_option.selected]
var settings := RunSettingsType.new( var settings := RunSettingsType.new(
seed_edit.text, seed_edit.text,
selected_difficulty, selected_difficulty,
permadeath_option.get_selected_id() == 1, 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(): if not settings.is_valid():
validation_label.text = settings.validation_error() validation_label.text = settings.validation_error()
@@ -52,10 +40,4 @@ func _on_start_run_pressed() -> void:
var player_name := name_edit.text.strip_edges() var player_name := name_edit.text.strip_edges()
if player_name.is_empty(): if player_name.is_empty():
player_name = "Sans-Nom" player_name = "Sans-Nom"
var selected_archetype := ARCHETYPE_IDS[archetype_option.selected] run_requested.emit(settings, player_name)
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)
+22 -6
View File
@@ -29,7 +29,7 @@ func _ready() -> void:
save_load_panel.cancelled.connect(_show_main_menu) save_load_panel.cancelled.connect(_show_main_menu)
_show_main_menu() _show_main_menu()
if _get_capture_mode(): 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: func _get_capture_mode() -> bool:
var arguments := OS.get_cmdline_user_args() var arguments := OS.get_cmdline_user_args()
@@ -94,14 +94,14 @@ func _show_load_slots() -> void:
func show_save_slots() -> void: func show_save_slots() -> void:
_save_load_mode = "save" _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: func _on_save_load_slot_requested(slot: int) -> void:
var result := save_to_slot(slot) if _save_load_mode == "save" else load_slot(slot) var result := save_to_slot(slot) if _save_load_mode == "save" else load_slot(slot)
if bool(result.get("ok", false)): 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: 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: func save_to_slot(slot: int) -> Dictionary:
var game := get_node_or_null("Game") as Game var game := get_node_or_null("Game") as Game
@@ -122,17 +122,33 @@ func load_slot(slot: int) -> Dictionary:
game.name = "Game" game.name = "Game"
game.configure_loaded_run(loaded) game.configure_loaded_run(loaded)
add_child(game) add_child(game)
_connect_game_navigation(game)
menu.visible = false menu.visible = false
character_creation.visible = false character_creation.visible = false
return loaded 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 var game := GameScene.instantiate() as Game
game.name = "Game" game.name = "Game"
game.configure_new_run(settings, player_name, base_archetype, race) game.configure_new_run(settings, player_name)
add_child(game) add_child(game)
_connect_game_navigation(game)
menu.visible = false menu.visible = false
character_creation.visible = false character_creation.visible = false
game.game_started.connect(func(started_settings: RunSettings, run_state: RunState) -> void: game.game_started.connect(func(started_settings: RunSettings, run_state: RunState) -> void:
game_started.emit(started_settings, run_state) 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()
+3 -3
View File
@@ -1,9 +1,9 @@
class_name QuestPanel class_name QuestPanel
extends PanelContainer extends PanelContainer
@onready var title: Label = $Title @onready var title: Label = $Layout/Title
@onready var body: RichTextLabel = $Body @onready var body: RichTextLabel = $Layout/Body
@onready var entries: RichTextLabel = $Entries @onready var entries: RichTextLabel = $Layout/Entries
var _manager: QuestManager var _manager: QuestManager
var _quest_ids: Array[StringName] = [] 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
+3 -3
View File
@@ -18,7 +18,7 @@ func _ready() -> void:
func present(mode: String, slot_metas: Array[Dictionary], message: String = "") -> void: func present(mode: String, slot_metas: Array[Dictionary], message: String = "") -> void:
_mode = mode _mode = mode
visible = true 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 status_label.text = message
for index in range(slots.get_child_count()): for index in range(slots.get_child_count()):
var button := slots.get_child(index) as Button var button := slots.get_child(index) as Button
@@ -39,5 +39,5 @@ func _request_slot(slot: int) -> void:
func _label_for(meta: Dictionary) -> String: func _label_for(meta: Dictionary) -> String:
var slot := int(meta.get("slot", 0)) var slot := int(meta.get("slot", 0))
if not bool(meta.get("exists", false)): if not bool(meta.get("exists", false)):
return "SLOT %d — EMPTY" % slot return "EMPLACEMENT %d — VIDE" % slot
return "SLOT %d — %s — FLOOR %d" % [slot, String(meta.get("character_name", "?")), int(meta.get("floor", 0))] return "EMPLACEMENT %d — %s — ÉTAGE %d" % [slot, String(meta.get("character_name", "?")), int(meta.get("floor", 0))]
+1 -1
View File
@@ -64,4 +64,4 @@ func _refresh_label() -> void:
return return
var target_id := target_ids[_selected_index] var target_id := target_ids[_selected_index]
var cell: Vector2i = _targets[target_id] 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]
+1 -1
View File
@@ -24,7 +24,7 @@ rm -f "$initial_capture_path" "$exit_capture_path"
runner=() runner=()
if [[ -z "${DISPLAY:-}" ]]; then if [[ -z "${DISPLAY:-}" ]]; then
if command -v xvfb-run >/dev/null 2>&1; then if command -v xvfb-run >/dev/null 2>&1; then
runner=(xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24") runner=(xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24")
else else
echo "visual check unavailable: DISPLAY is unset and xvfb-run is not installed" | tee "$log_path" >&2 echo "visual check unavailable: DISPLAY is unset and xvfb-run is not installed" | tee "$log_path" >&2
exit 2 exit 2
+15
View File
@@ -10,6 +10,21 @@ func before_each() -> void:
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_bundled_music_switches_from_exploration_to_combat() -> void:
var audio := game.get_node("AudioLibrary") as AudioLibrary
var exploration_stream := audio.get_ambience_stream()
assert_not_null(exploration_stream)
assert_string_contains(exploration_stream.resource_path, "dungeon_exploration.wav")
var state := game.get_game_state()
var enemy: ActorState = state.enemies[&"goblin"]
enemy.cell = state.player.cell + Vector2i.RIGHT
game.submit_test_action(Vector2i.RIGHT)
assert_eq(audio.current_ambience_context, "combat")
assert_string_contains(audio.get_ambience_stream().resource_path, "dungeon_combat.wav")
assert_true(audio.get_ambience_player().playing)
func test_options_control_audio_buses_and_imported_manifest_playback_without_external_files() -> void: func test_options_control_audio_buses_and_imported_manifest_playback_without_external_files() -> void:
var audio = game.get_node("AudioLibrary") as AudioLibrary var audio = game.get_node("AudioLibrary") as AudioLibrary
var manifest := AudioImportManifest.new() var manifest := AudioImportManifest.new()
+14 -17
View File
@@ -11,21 +11,18 @@ func before_each() -> void:
func test_real_scene_walk_out_of_sight_exposes_visible_explored_and_unknown_fog_states() -> void: func test_real_scene_walk_out_of_sight_exposes_visible_explored_and_unknown_fog_states() -> void:
var renderer := game.get_node("World/MapRenderer") as MapRenderer var renderer := game.get_node("World/MapRenderer") as MapRenderer
var state := game.get_game_state() var state := game.get_game_state()
state.enemies.clear()
var old_cell := Vector2i(2, 7)
var new_cell := Vector2i(17, 7)
for step in range(7):
game.submit_test_action(Vector2i.RIGHT)
game.submit_test_interact() assert_true(state.visible_cells.has(new_cell))
var results := game.submit_test_action(Vector2i.UP) assert_true(state.explored_cells.has(old_cell))
assert_false(state.visible_cells.has(old_cell))
assert_eq(results[0].kind, &"moved") assert_false(state.explored_cells.has(Vector2i(41, 15)))
assert_true(state.visible_cells.has(Vector2i(4, 17))) assert_eq(renderer.get_cell_visibility_state(new_cell), &"visible")
assert_true(state.explored_cells.has(Vector2i(1, 12))) assert_eq(renderer.get_cell_visibility_state(old_cell), &"explored")
assert_false(state.visible_cells.has(Vector2i(1, 12))) assert_eq(renderer.get_cell_visibility_state(Vector2i(41, 15)), &"unknown")
assert_false(state.explored_cells.has(Vector2i(29, 19))) assert_eq(renderer.get_cell_render_color(new_cell), Color.WHITE)
assert_eq(renderer.get_cell_visibility_state(Vector2i(4, 17)), &"visible") assert_lt(renderer.get_cell_render_color(Vector2i(41, 15)).get_luminance(), renderer.get_cell_render_color(old_cell).get_luminance())
assert_eq(renderer.get_cell_visibility_state(Vector2i(1, 12)), &"explored")
assert_eq(renderer.get_cell_visibility_state(Vector2i(29, 19)), &"unknown")
assert_eq(renderer.get_cell_render_color(Vector2i(4, 17)), Color.WHITE)
assert_lt(
renderer.get_cell_render_color(Vector2i(29, 19)).get_luminance(),
renderer.get_cell_render_color(Vector2i(1, 12)).get_luminance()
)
assert_lte(renderer.get_cell_render_color(Vector2i(1, 12)).get_luminance(), 0.35)
+1 -1
View File
@@ -42,7 +42,7 @@ func test_real_bobka_dialogue_gives_three_free_rations_in_safe_room() -> void:
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var panel := game.get_node("HUD/DialoguePanel") as PanelContainer var panel := game.get_node("HUD/DialoguePanel") as PanelContainer
assert_true(panel.visible, "ration %d opens Bobka dialogue" % (ration_number + 1)) assert_true(panel.visible, "ration %d opens Bobka dialogue" % (ration_number + 1))
assert_string_contains((game.get_node("HUD/DialoguePanel/Entries") as RichTextLabel).get_parsed_text(), "Prendre une ration.") assert_string_contains((game.get_node("HUD/DialoguePanel/Layout/Entries") as RichTextLabel).get_parsed_text(), "Prendre une ration.")
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
assert_eq(run.inventory.count_by_definition(&"consumable_ration"), ration_number + 1) assert_eq(run.inventory.count_by_definition(&"consumable_ration"), ration_number + 1)
assert_eq(run.gold, gold_before) assert_eq(run.gold, gold_before)
+21 -64
View File
@@ -10,89 +10,46 @@ func before_each() -> void:
func test_configured_input_event_uses_the_same_action_path_as_submit_test_action() -> void: func test_configured_input_event_uses_the_same_action_path_as_submit_test_action() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var input_event := InputEventKey.new() state.enemies.clear()
input_event.physical_keycode = KEY_DOWN var input_event := _key_event(KEY_DOWN)
input_event.pressed = true
game._unhandled_input(input_event) game._unhandled_input(input_event)
assert_eq(state.player.cell, Vector2i(4, 8))
assert_eq(state.player.cell, Vector2i(4, 13)) assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "You move to (4, 8).")
assert_eq(game.get_node("HUD/EventLog").get_parsed_text(), "You move to (4, 13).\nThe goblin moves.\n")
var submitted_game := GameScene.instantiate() as Game var submitted_game := GameScene.instantiate() as Game
add_child_autofree(submitted_game) add_child_autofree(submitted_game)
await get_tree().process_frame await get_tree().process_frame
submitted_game.get_game_state().enemies.clear()
var test_results := submitted_game.submit_test_action(Vector2i.DOWN) var test_results := submitted_game.submit_test_action(Vector2i.DOWN)
assert_eq(submitted_game.get_game_state().player.cell, Vector2i(4, 8))
assert_eq(submitted_game.get_game_state().player.cell, Vector2i(4, 13))
assert_eq(test_results.size(), 2)
assert_eq(test_results[0].kind, &"moved") assert_eq(test_results[0].kind, &"moved")
assert_eq(test_results[0].from_cell, Vector2i(4, 12))
assert_eq(test_results[0].to_cell, Vector2i(4, 13))
assert_eq(test_results[1].kind, &"enemy_moved")
func test_real_game_scene_completes_walking_combat_and_defeat_route() -> void:
assert_not_null(game.get_node_or_null("World/MapRenderer"))
assert_not_null(game.get_node_or_null("World/Player"))
assert_not_null(game.get_node_or_null("World/Enemies"))
assert_not_null(game.get_node_or_null("Camera2D"))
assert_not_null(game.get_node_or_null("HUD/PlayerHealthLabel"))
assert_not_null(game.get_node_or_null("HUD/EnemyHealthLabel"))
assert_not_null(game.get_node_or_null("HUD/CombatSummaryLabel"))
assert_not_null(game.get_node_or_null("HUD/EventLog"))
func test_real_game_scene_completes_adjacent_bump_combat_and_defeat_route() -> void:
var state := game.get_game_state() var state := game.get_game_state()
state.enemies.clear()
var enemy := ActorState.new(&"goblin", state.player.cell + Vector2i.RIGHT, 6, 2)
state.enemies[enemy.id] = enemy
game._sync_enemy_views()
var hud := game.get_node("HUD") as GameHud var hud := game.get_node("HUD") as GameHud
var player_view := game.get_node("World/Player") as ActorView hud.refresh(state, [], game.get_run_state())
var enemy_view := game.get_node("World/Enemies/Goblin") as ActorView
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6") assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
assert_eq(hud.combat_summary_label.text, "Target: Goblin HP: 6/6")
# The new spawn is beside a wall and a closed door; neither consumes a turn.
var start := state.player.cell
var wall := game.submit_test_action(Vector2i(-1, -1))
assert_eq(wall.size(), 1)
assert_eq(wall[0].kind, &"blocked")
assert_eq(state.player.cell, start)
var door := game.submit_test_action(Vector2i.UP)
assert_eq(door.size(), 1)
assert_eq(door[0].kind, &"blocked")
assert_eq(state.player.cell, start)
assert_string_contains(hud.event_log.get_parsed_text(), "Your way is blocked.")
# Move the existing goblin onto the adapted combat lane after the map assertions.
state.enemies[&"goblin"].cell = start + Vector2i(2, 0)
var movement := game.submit_test_action(Vector2i.RIGHT)
assert_eq(movement[0].kind, &"moved")
assert_eq(state.player.cell, start + Vector2i.RIGHT)
assert_eq(movement[1].kind, &"enemy_melee")
await _wait_for_feedback()
assert_eq(player_view.last_damage, 2)
assert_string_contains(game.get_node("HUD/PlayerHealthLabel").text, "10/12")
assert_string_contains(hud.event_log.get_parsed_text(), "You move to (5, 12).")
assert_string_contains(hud.event_log.get_parsed_text(), "The goblin hits you for 2.")
var first_melee := game.submit_test_action(Vector2i.RIGHT) var first_melee := game.submit_test_action(Vector2i.RIGHT)
assert_eq(first_melee[0].kind, &"melee") assert_eq(first_melee[0].kind, &"melee")
assert_eq(first_melee[1].kind, &"enemy_melee") assert_eq(first_melee[1].kind, &"enemy_melee")
await _wait_for_feedback() assert_eq(state.player.cell, Vector2i(4, 7))
assert_eq(enemy_view.last_damage, 3) assert_eq(enemy.cell, Vector2i(5, 7))
assert_eq(player_view.last_damage, 2) assert_string_contains(hud.event_log.get_parsed_text(), "with mains nues")
assert_string_contains(game.get_node("HUD/EnemyHealthLabel").text, "3/6")
assert_eq(hud.combat_summary, "Target: Goblin HP: 3/6")
assert_eq(hud.combat_summary_label.text, "Target: Goblin HP: 3/6")
assert_string_contains(hud.event_log.get_parsed_text(), "You strike the goblin for 3.")
var lethal_melee := game.submit_test_action(Vector2i.RIGHT) var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
assert_eq(lethal_melee[0].kind, &"melee") assert_eq(lethal_melee[0].kind, &"melee")
assert_eq(lethal_melee[1].kind, &"enemy_defeated") assert_eq(lethal_melee[1].kind, &"enemy_defeated")
assert_false(state.enemies.has(&"goblin")) assert_false(state.enemies.has(&"goblin"))
await _wait_for_feedback()
assert_eq(game.get_node("World/Enemies").get_child_count(), 0)
assert_eq(game.get_node_or_null("World/Enemies/Goblin"), null)
assert_eq(game.get_node("HUD/EnemyHealthLabel").text, "No active target")
assert_eq(hud.combat_summary, "No active target") assert_eq(hud.combat_summary, "No active target")
assert_eq(hud.combat_summary_label.text, "No active target")
assert_string_contains(hud.event_log.get_parsed_text(), "The goblin is defeated.")
func _wait_for_feedback() -> void: func _key_event(keycode: Key) -> InputEventKey:
await get_tree().create_timer(0.34).timeout var event := InputEventKey.new()
event.keycode = keycode
event.physical_keycode = keycode
event.pressed = true
return event
+37 -5
View File
@@ -1,6 +1,7 @@
extends GutTest extends GutTest
const GameScene = preload("res://scenes/Game.tscn") const GameScene = preload("res://scenes/Game.tscn")
const MainMenuScene = preload("res://scenes/menu/MainMenu.tscn")
const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd") const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd")
const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd") const ItemDefinitionType = preload("res://scripts/domain/items/item_definition.gd")
const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd") const ItemInstanceType = preload("res://scripts/domain/items/item_instance.gd")
@@ -15,7 +16,12 @@ func test_classic_death_ends_actions_shows_death_panel_and_preserves_the_run_slo
assert_true(game.get_run_state().is_game_over) assert_true(game.get_run_state().is_game_over)
assert_eq(game.get_run_state().slot_policy, &"preserve") assert_eq(game.get_run_state().slot_policy, &"preserve")
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Classique") assert_string_contains((panel.get_node("Layout/Body") as RichTextLabel).get_parsed_text(), "Classique")
assert_true((panel.get_node("Layout/Actions/LoadButton") as Button).visible)
var navigation: Array[StringName] = []
game.connect("death_navigation_requested", func(action: StringName) -> void: navigation.append(action))
(panel.get_node("Layout/Actions/NewRunButton") as Button).pressed.emit()
assert_eq(navigation, [&"new_run"])
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"run_ended")) assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"run_ended"))
assert_eq(game.submit_test_action(Vector2i.RIGHT), []) assert_eq(game.submit_test_action(Vector2i.RIGHT), [])
@@ -27,9 +33,30 @@ func test_permadeath_death_retires_the_run_slot_and_reports_the_mode() -> void:
assert_true(game.get_run_state().is_game_over) assert_true(game.get_run_state().is_game_over)
assert_eq(game.get_run_state().slot_policy, &"retire") assert_eq(game.get_run_state().slot_policy, &"retire")
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "permanente") assert_string_contains((panel.get_node("Layout/Body") as RichTextLabel).get_parsed_text(), "permanente")
assert_false((panel.get_node("Layout/Actions/LoadButton") as Button).visible)
var navigation: Array[StringName] = []
game.connect("death_navigation_requested", func(action: StringName) -> void: navigation.append(action))
(panel.get_node("Layout/Actions/MenuButton") as Button).pressed.emit()
assert_eq(navigation, [&"menu"])
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"permadeath_run_retired")) assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"permadeath_run_retired"))
func test_death_navigation_returns_to_the_real_main_menu_and_opens_requested_flow() -> void:
var menu := MainMenuScene.instantiate() as MainMenu
add_child_autofree(menu)
await get_tree().process_frame
await get_tree().process_frame
menu._start_new_run(RunSettingsType.new("death-nav", &"crawler", false), "Death Nav")
await get_tree().process_frame
var game := menu.get_node("Game") as Game
game.death_navigation_requested.emit(&"new_run")
await get_tree().process_frame
assert_null(menu.get_node_or_null("Game"))
assert_false(menu.get_node("Menu").visible)
assert_true(menu.get_node("CharacterCreation").visible)
func test_qualified_narrative_resurrection_continues_the_real_game_without_showing_death_panel() -> void: func test_qualified_narrative_resurrection_continues_the_real_game_without_showing_death_panel() -> void:
var game := await _game(true) var game := await _game(true)
var state := game.get_game_state() var state := game.get_game_state()
@@ -50,16 +77,21 @@ func test_qualified_narrative_resurrection_continues_the_real_game_without_showi
func _kill_player_through_real_enemy_turn(game: Game) -> void: func _kill_player_through_real_enemy_turn(game: Game) -> void:
var state := game.get_game_state() var state := game.get_game_state()
var enemy: ActorState = state.enemies[&"goblin"] var enemy: ActorState = state.enemies.get(&"goblin")
if enemy == null:
enemy = ActorState.new(&"goblin", state.player.cell + Vector2i.RIGHT, 6, 2)
state.enemies[enemy.id] = enemy
enemy.cell = state.player.cell + Vector2i.RIGHT enemy.cell = state.player.cell + Vector2i.RIGHT
enemy.weapon_damage = state.player.hit_points enemy.weapon_damage = state.player.hit_points
enemy.damage_variance = 0 enemy.damage_variance = 0
enemy.accuracy = 30 enemy.accuracy = 30
game.submit_test_interact() var results: Array[TurnResult] = []
TurnResolver.append_enemy_response(state, results)
game._resolve_player_action(results, false)
func _game(permadeath: bool) -> Game: func _game(permadeath: bool) -> Game:
var game := GameScene.instantiate() as Game var game := GameScene.instantiate() as Game
game.configure_new_run(RunSettingsType.new("F6-E2E", &"crawler", permadeath), "F6 Hero", &"vanguard") game.configure_new_run(RunSettingsType.new("F6-E2E", &"crawler", permadeath), "F6 Hero")
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
return game return game
+16 -33
View File
@@ -8,48 +8,31 @@ func before_each() -> void:
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_real_input_opens_door_then_chest_and_preserves_stairs_route() -> void: func test_real_input_opens_surface_door_and_reaches_the_generated_first_floor() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var hud := game.get_node("HUD") as GameHud var hud := game.get_node("HUD") as GameHud
var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label
var event_log := game.get_node("HUD/EventLog") as RichTextLabel var event_log := game.get_node("HUD/EventLog") as RichTextLabel
state.enemies.erase(&"goblin") assert_eq(state.map.size, Vector2i(42, 16))
assert_eq(state.floor_state.floor_number, 0)
assert_true(state.floor_state.chests.is_empty())
assert_eq(state.map.size, Vector2i(30, 20)) state.player.cell = Vector2i(35, 7)
assert_eq(prompt_label.text, "Espace — Ouvrir la porte") hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Ouvrir la porte")
game._unhandled_input(_key_event(KEY_E)) game._unhandled_input(_key_event(KEY_E))
assert_eq(game.last_turn_results[0].kind, &"door_opened") assert_eq(game.last_turn_results[0].kind, &"door_opened")
assert_eq(state.map.get_cell(Vector2i(4, 11)), GridMapState.CellKind.FLOOR) assert_eq(state.map.get_cell(Vector2i(36, 7)), GridMapState.CellKind.FLOOR)
for keycode in [KEY_UP, KEY_UP, KEY_UP, KEY_UP]: for step in range(4):
game._unhandled_input(_key_event(keycode)) game._unhandled_input(_key_event(KEY_RIGHT))
assert_eq(state.player.cell, Vector2i(4, 8)) assert_eq(state.player.cell, state.floor_state.exit)
assert_eq(prompt_label.text, "Espace — Ouvrir le coffre") assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_UP)) game._unhandled_input(_key_event(KEY_E))
assert_eq(state.player.cell, Vector2i(4, 8))
assert_eq(state.map.get_cell(Vector2i(4, 7)), GridMapState.CellKind.CHEST)
assert_string_contains(event_log.get_parsed_text(), "Your way is blocked.")
game._unhandled_input(_key_event(KEY_SPACE))
assert_eq(game.last_turn_results[0].kind, &"chest_opened")
assert_eq(state.map.get_cell(Vector2i(4, 7)), GridMapState.CellKind.FLOOR)
assert_eq(hud.get_context_prompt(), "")
assert_string_contains(event_log.get_parsed_text(), "Coffre ouvert :")
assert_true(game.get_node("HUD/LootPanel").visible)
game._unhandled_input(_key_event(KEY_SPACE))
assert_false(game.get_node("HUD/LootPanel").visible)
game._unhandled_input(_key_event(KEY_UP))
assert_eq(state.player.cell, Vector2i(4, 7))
for keycode in [KEY_UP, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_UP, KEY_UP]:
game._unhandled_input(_key_event(keycode))
assert_eq(state.player.cell, Vector2i(18, 4))
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state())
assert_eq(prompt_label.text, "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_SPACE))
assert_eq(game.get_run_state().current_floor, 1) assert_eq(game.get_run_state().current_floor, 1)
assert_eq(game.get_game_state().player.cell, game.get_game_state().floor_state.entrance) assert_eq(state.map.size, Vector2i(210, 105))
assert_eq(state.floor_state.rooms.size(), 170)
assert_false(state.floor_state.metadata.get("hand_authored", true))
assert_string_contains(event_log.get_parsed_text(), "You descend the stairs.") assert_string_contains(event_log.get_parsed_text(), "You descend the stairs.")
func _key_event(keycode: Key) -> InputEventKey: func _key_event(keycode: Key) -> InputEventKey:
+3 -3
View File
@@ -18,8 +18,8 @@ func test_real_merchant_dialogue_choice_opens_shop_and_journals_choice() -> void
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var panel := game.get_node("HUD/DialoguePanel") as PanelContainer var panel := game.get_node("HUD/DialoguePanel") as PanelContainer
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((game.get_node("HUD/DialoguePanel/Title") as Label).text, "Marchand") assert_string_contains((game.get_node("HUD/DialoguePanel/Layout/Title") as Label).text, "Marchand")
assert_string_contains((game.get_node("HUD/DialoguePanel/Entries") as RichTextLabel).get_parsed_text(), "Voir toute sa marchandise.") assert_string_contains((game.get_node("HUD/DialoguePanel/Layout/Entries") as RichTextLabel).get_parsed_text(), "Voir toute sa marchandise.")
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"dialogue_started") assert_eq(game.get_run_state().recent_events(1)[0].kind, &"dialogue_started")
await _dispatch_key(KEY_DOWN) await _dispatch_key(KEY_DOWN)
@@ -36,7 +36,7 @@ func test_real_guide_dialogue_hides_and_reveals_condition_gated_choice_then_jour
state.floor_state.npcs[&"guide-e2e"] = ActorState.new(&"guide-e2e", state.player.cell + Vector2i.RIGHT, 1, 0, &"npc_guide_mordecai") state.floor_state.npcs[&"guide-e2e"] = ActorState.new(&"guide-e2e", state.player.cell + Vector2i.RIGHT, 1, 0, &"npc_guide_mordecai")
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var entries := game.get_node("HUD/DialoguePanel/Entries") as RichTextLabel var entries := game.get_node("HUD/DialoguePanel/Layout/Entries") as RichTextLabel
assert_false(entries.get_parsed_text().contains("Parlez-moi du choix de race")) assert_false(entries.get_parsed_text().contains("Parlez-moi du choix de race"))
await _dispatch_key(KEY_ESCAPE) await _dispatch_key(KEY_ESCAPE)
+1 -1
View File
@@ -17,7 +17,7 @@ func test_real_game_keyboard_movement_keeps_actor_in_cell_and_updates_camera_wit
var hud_screen_position: Vector2 = player_health_label.get_global_rect().position var hud_screen_position: Vector2 = player_health_label.get_global_rect().position
var start_cell := state.player.cell var start_cell := state.player.cell
assert_eq(Game.REFERENCE_VIEWPORT, Vector2i(1280, 720)) assert_eq(Game.REFERENCE_VIEWPORT, Vector2i(1920, 1080))
assert_true(renderer.get_cell_rect(start_cell).encloses(game.get_actor_cell_rect(&"player"))) assert_true(renderer.get_cell_rect(start_cell).encloses(game.get_actor_cell_rect(&"player")))
var keyboard_event := InputEventKey.new() var keyboard_event := InputEventKey.new()
+11 -34
View File
@@ -1,46 +1,23 @@
extends GutTest extends GutTest
const GameScene = preload("res://scenes/Game.tscn") const GameScene = preload("res://scenes/Game.tscn")
var game: Game
func before_each() -> void: func test_real_game_keyboard_space_and_test_seam_open_surface_door_then_allow_walking_through_it() -> void:
game = GameScene.instantiate() var game := GameScene.instantiate() as Game
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_input_map_binds_space_and_e_to_interact() -> void:
assert_true(InputMap.action_has_event(&"interact", _key_event(KEY_SPACE)))
assert_true(InputMap.action_has_event(&"interact", _key_event(KEY_E)))
func test_real_game_keyboard_space_and_test_seam_open_door_then_allow_walking_through_it() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var hud := game.get_node("HUD") as GameHud var log := game.get_node("HUD/EventLog") as RichTextLabel
var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label state.player.cell = Vector2i(35, 7)
var event_log := game.get_node("HUD/EventLog") as RichTextLabel (game.get_node("HUD") as GameHud).refresh(state, [], game.get_run_state())
var door_cell := Vector2i(4, 11)
game._unhandled_input(_key_event(KEY_SPACE)) game._unhandled_input(_key_event(KEY_SPACE))
assert_eq(game.last_turn_results[0].kind, &"door_opened")
assert_eq(state.map.get_cell(Vector2i(36, 7)), GridMapState.CellKind.FLOOR)
assert_string_contains(log.get_parsed_text(), "You open the door.")
assert_eq(state.map.get_cell(door_cell), GridMapState.CellKind.FLOOR) game.submit_test_action(Vector2i.RIGHT)
assert_eq(hud.get_context_prompt(), "") assert_eq(state.player.cell, Vector2i(36, 7))
assert_eq(prompt_label.text, "")
assert_string_contains(event_log.get_parsed_text(), "You open the door.")
var move_results := game.submit_test_action(Vector2i.UP)
assert_eq(move_results[0].kind, &"moved")
assert_eq(state.player.cell, door_cell)
var submitted_game := GameScene.instantiate() as Game
add_child_autofree(submitted_game)
await get_tree().process_frame
var submitted_results: Array[TurnResult] = submitted_game.submit_test_interact()
assert_eq(submitted_results[0].kind, &"door_opened")
assert_eq(submitted_game.get_game_state().map.get_cell(door_cell), GridMapState.CellKind.FLOOR)
var e_game := GameScene.instantiate() as Game
add_child_autofree(e_game)
await get_tree().process_frame
e_game._unhandled_input(_key_event(KEY_E))
assert_eq(e_game.get_game_state().map.get_cell(door_cell), GridMapState.CellKind.FLOOR)
func _key_event(keycode: Key) -> InputEventKey: func _key_event(keycode: Key) -> InputEventKey:
var event := InputEventKey.new() var event := InputEventKey.new()
+8 -20
View File
@@ -8,30 +8,19 @@ func before_each() -> void:
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_real_input_event_completes_door_to_stairs_descent_and_arrives_on_floor_one() -> void: func test_real_input_event_completes_surface_door_to_generated_dungeon_descent() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var hud := game.get_node("HUD") as GameHud var hud := game.get_node("HUD") as GameHud
var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label
var event_log := game.get_node("HUD/EventLog") as RichTextLabel var event_log := game.get_node("HUD/EventLog") as RichTextLabel
var initial_map := state.map var initial_map := state.map
var initial_map_size := state.map.size state.player.cell = Vector2i(35, 7)
state.enemies.erase(&"goblin")
game._unhandled_input(_key_event(KEY_SPACE))
assert_eq(state.map.get_cell(Vector2i(4, 11)), GridMapState.CellKind.FLOOR)
for keycode in [KEY_UP, KEY_UP, KEY_UP, KEY_UP]:
game._unhandled_input(_key_event(keycode))
assert_eq(state.player.cell, Vector2i(4, 8))
game._unhandled_input(_key_event(KEY_E))
assert_true(game.get_node("HUD/LootPanel").visible)
game._unhandled_input(_key_event(KEY_SPACE))
assert_false(game.get_node("HUD/LootPanel").visible)
for keycode in [KEY_UP, KEY_UP, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_RIGHT, KEY_UP, KEY_UP]:
game._unhandled_input(_key_event(keycode))
assert_eq(state.player.cell, Vector2i(18, 4))
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state()) hud.refresh(state, [], game.get_run_state())
game._unhandled_input(_key_event(KEY_SPACE))
for step in range(4):
game._unhandled_input(_key_event(KEY_RIGHT))
assert_eq(state.player.cell, Vector2i(39, 7))
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier") assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_E)) game._unhandled_input(_key_event(KEY_E))
@@ -41,8 +30,7 @@ func test_real_input_event_completes_door_to_stairs_descent_and_arrives_on_floor
assert_string_contains(event_log.get_parsed_text(), "You open the door.") assert_string_contains(event_log.get_parsed_text(), "You open the door.")
assert_string_contains(event_log.get_parsed_text(), "You descend the stairs.") assert_string_contains(event_log.get_parsed_text(), "You descend the stairs.")
assert_ne(state.map, initial_map) assert_ne(state.map, initial_map)
assert_ne(state.map.size, initial_map_size) assert_eq(state.map.size, Vector2i(210, 105))
assert_eq(initial_map.get_cell(Vector2i(18, 4)), GridMapState.CellKind.STAIRS)
assert_eq(state.player.cell, state.floor_state.entrance) assert_eq(state.player.cell, state.floor_state.entrance)
func _key_event(keycode: Key) -> InputEventKey: func _key_event(keycode: Key) -> InputEventKey:
+25 -2
View File
@@ -4,12 +4,34 @@ const ActorState = preload("res://scripts/domain/actor_state.gd")
const GridMapState = preload("res://scripts/domain/grid_map_state.gd") const GridMapState = preload("res://scripts/domain/grid_map_state.gd")
const GameScene = preload("res://scenes/Game.tscn") const GameScene = preload("res://scenes/Game.tscn")
func test_enemy_view_is_hidden_until_its_cell_enters_current_field_of_view() -> void:
var game := GameScene.instantiate() as Game
add_child_autofree(game)
await get_tree().process_frame
var state := game.get_game_state()
state.enemies.clear()
var enemy := ActorState.new(&"hidden_enemy", Vector2i(24, 8), 6, 2)
state.enemies[enemy.id] = enemy
game._sync_enemy_views()
var view := game.enemy_views[enemy.id] as ActorView
assert_false(state.visible_cells.has(enemy.cell))
assert_false(view.visible)
enemy.cell = state.player.cell + Vector2i.RIGHT
game.sync_presentation_for_testing()
game._sync_enemy_views()
assert_true(state.visible_cells.has(enemy.cell))
assert_true(view.visible)
func test_real_game_enemy_detects_approaches_attacks_and_dies_with_feedback() -> void: func test_real_game_enemy_detects_approaches_attacks_and_dies_with_feedback() -> void:
var game := GameScene.instantiate() as Game var game := GameScene.instantiate() as Game
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
var state := game.get_game_state() var state := game.get_game_state()
var enemy: ActorState = state.enemies[&"goblin"] var enemy := ActorState.new(&"goblin", state.player.cell + Vector2i(3, 0), 3, 2)
state.enemies[enemy.id] = enemy
game._sync_enemy_views()
enemy.cell = state.player.cell + Vector2i(3, 0) enemy.cell = state.player.cell + Vector2i(3, 0)
enemy.hit_points = 3 enemy.hit_points = 3
enemy.max_hit_points = 3 enemy.max_hit_points = 3
@@ -19,8 +41,9 @@ func test_real_game_enemy_detects_approaches_attacks_and_dies_with_feedback() ->
var approach := game.submit_test_action(Vector2i.DOWN) var approach := game.submit_test_action(Vector2i.DOWN)
assert_eq(approach.map(func(result: TurnResult) -> StringName: return result.kind), [&"moved", &"enemy_moved"]) assert_eq(approach.map(func(result: TurnResult) -> StringName: return result.kind), [&"moved", &"enemy_moved"])
assert_eq(enemy.cell, Vector2i(6, 12)) assert_eq(enemy.cell, state.player.cell + Vector2i(2, -1))
assert_ne(enemy.cell, state.player.cell) assert_ne(enemy.cell, state.player.cell)
assert_eq((game.get_node("World/Enemies/Goblin") as ActorView).position, Vector2(enemy.cell * ActorView.TILE_SIZE))
# A real contextual action keeps the player in place, allowing the detected # A real contextual action keeps the player in place, allowing the detected
# enemy to execute its adjacent C2 melee turn. # enemy to execute its adjacent C2 melee turn.
+2 -2
View File
@@ -25,7 +25,7 @@ func test_inventory_keyboard_flow_equips_live_combat_weapon_uses_consumable_and_
await _dispatch_key(KEY_I) await _dispatch_key(KEY_I)
var panel := game.get_node("HUD/InventoryPanel") as PanelContainer var panel := game.get_node("HUD/InventoryPanel") as PanelContainer
var details := game.get_node("HUD/InventoryPanel/Details") as RichTextLabel var details := game.get_node("HUD/InventoryPanel/Layout/Columns/Details") as RichTextLabel
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains(details.get_parsed_text(), "Epee rouillee") assert_string_contains(details.get_parsed_text(), "Epee rouillee")
assert_eq(state.player.weapon_damage, 3) assert_eq(state.player.weapon_damage, 3)
@@ -57,7 +57,7 @@ func test_inventory_ui_reveals_unidentified_equipment_and_shows_slot_comparison(
inventory.add_item(mysterious) inventory.add_item(mysterious)
await _dispatch_key(KEY_I) await _dispatch_key(KEY_I)
var details := game.get_node("HUD/InventoryPanel/Details") as RichTextLabel var details := game.get_node("HUD/InventoryPanel/Layout/Columns/Details") as RichTextLabel
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
await _dispatch_key(KEY_DOWN) await _dispatch_key(KEY_DOWN)
assert_string_contains(details.get_parsed_text(), "Unidentified weapon") assert_string_contains(details.get_parsed_text(), "Unidentified weapon")
+5 -5
View File
@@ -18,8 +18,8 @@ func test_real_input_dispatches_one_shot_note_event_and_persists_completion() ->
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var panel := game.get_node("HUD/EventPanel") as PanelContainer var panel := game.get_node("HUD/EventPanel") as PanelContainer
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Title") as Label).text, "Événement") assert_string_contains((panel.get_node("Layout/Title") as Label).text, "Événement")
assert_string_contains((panel.get_node("Entries") as RichTextLabel).get_parsed_text(), "Prendre la note") assert_string_contains((panel.get_node("Layout/Entries") as RichTextLabel).get_parsed_text(), "Prendre la note")
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"event_started") assert_eq(game.get_run_state().recent_events(1)[0].kind, &"event_started")
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
@@ -45,11 +45,11 @@ func test_real_input_solves_pressure_plate_puzzle_and_journals_reward() -> void:
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var panel := game.get_node("HUD/EventPanel") as PanelContainer var panel := game.get_node("HUD/EventPanel") as PanelContainer
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Title") as Label).text, "Énigme") assert_string_contains((panel.get_node("Layout/Title") as Label).text, "Énigme")
assert_string_contains((panel.get_node("Entries") as RichTextLabel).get_parsed_text(), "Chercher un mecanisme") assert_string_contains((panel.get_node("Layout/Entries") as RichTextLabel).get_parsed_text(), "Chercher un mecanisme")
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "compartiment cache") assert_string_contains((panel.get_node("Layout/Body") as RichTextLabel).get_parsed_text(), "compartiment cache")
assert_eq(game.get_run_state().gold, 25) assert_eq(game.get_run_state().gold, 25)
assert_true(game.get_run_state().inventory.items.any(func(item: ItemInstance) -> bool: return item.definition.id == &"consumable_stimpack")) assert_true(game.get_run_state().inventory.items.any(func(item: ItemInstance) -> bool: return item.definition.id == &"consumable_stimpack"))
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
+15 -25
View File
@@ -11,29 +11,19 @@ func before_each() -> void:
func test_real_game_updates_fog_after_public_action_and_preserves_opaque_fov() -> void: func test_real_game_updates_fog_after_public_action_and_preserves_opaque_fov() -> void:
var renderer := game.get_node("World/MapRenderer") as MapRenderer var renderer := game.get_node("World/MapRenderer") as MapRenderer
var state := game.get_game_state() var state := game.get_game_state()
var opaque_obstacle := Vector2i(4, 11) state.enemies.clear()
var cell_behind_obstacle := Vector2i(4, 10) var old_cell := Vector2i(2, 7)
assert_true(state.visible_cells.has(opaque_obstacle)) var new_cell := Vector2i(17, 7)
assert_false(state.visible_cells.has(cell_behind_obstacle)) for step in range(7):
var results := game.submit_test_action(Vector2i.RIGHT)
assert_eq(results[0].kind, &"moved")
game.submit_test_interact() assert_true(state.explored_cells.has(old_cell))
var results := game.submit_test_action(Vector2i.UP) assert_false(state.visible_cells.has(old_cell))
assert_eq(renderer.get_cell_visibility_state(old_cell), &"explored")
assert_eq(results[0].kind, &"moved") assert_eq(renderer.get_cell_render_color(old_cell), renderer.EXPLORED_DIM_COLOR)
assert_true(state.explored_cells.has(Vector2i(1, 12))) assert_true(state.visible_cells.has(new_cell))
assert_false(state.visible_cells.has(Vector2i(1, 12))) assert_eq(renderer.get_cell_visibility_state(new_cell), &"visible")
# This is the instantiated Game.tscn scene, driven through its public action assert_eq(renderer.get_cell_render_color(new_cell), Color.WHITE)
# seam: moving out of sight leaves one explored, one visible, and one unknown cell. assert_false(state.explored_cells.has(Vector2i(41, 15)))
assert_eq(renderer.get_cell_visibility_state(Vector2i(1, 12)), &"explored") assert_eq(renderer.get_cell_visibility_state(Vector2i(41, 15)), &"unknown")
assert_eq(renderer.get_cell_render_color(Vector2i(1, 12)), renderer.EXPLORED_DIM_COLOR)
assert_true(state.visible_cells.has(Vector2i(4, 17)))
assert_eq(renderer.get_cell_visibility_state(Vector2i(4, 17)), &"visible")
assert_eq(renderer.get_cell_render_color(Vector2i(4, 17)), Color.WHITE)
assert_false(state.explored_cells.has(Vector2i(29, 19)))
assert_eq(renderer.get_cell_visibility_state(Vector2i(29, 19)), &"unknown")
assert_eq(renderer.get_cell_render_color(Vector2i(29, 19)), Color(0.005, 0.008, 0.02, 1.0))
assert_lt(
renderer.get_cell_render_color(Vector2i(29, 19)).get_luminance(),
renderer.get_cell_render_color(Vector2i(1, 12)).get_luminance()
)
assert_lte(renderer.get_cell_render_color(Vector2i(1, 12)).get_luminance(), 0.35)
+1 -1
View File
@@ -26,7 +26,7 @@ func test_level_three_open_choice_blocks_actions_until_a_perk_is_chosen_and_jour
assert_true(game.get_run_state().recent_events(8).any(func(event: GameEvent) -> bool: return event.kind == &"level_three_choice_required")) assert_true(game.get_run_state().recent_events(8).any(func(event: GameEvent) -> bool: return event.kind == &"level_three_choice_required"))
await _dispatch_key(KEY_RIGHT) await _dispatch_key(KEY_RIGHT)
assert_eq(state.player.cell, Vector2i(4, 12)) assert_eq(state.player.cell, Vector2i(4, 7))
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
assert_false(panel.visible) assert_false(panel.visible)
assert_eq(game.get_perk_engine().rank_for(&"increvable"), 1) assert_eq(game.get_perk_engine().rank_for(&"increvable"), 1)
@@ -0,0 +1,39 @@
extends GutTest
const GameScene = preload("res://scenes/Game.tscn")
const FloorGeneratorType = preload("res://scripts/domain/world/floor_generator.gd")
func test_entering_dungeon_floor_three_requires_race_then_class_before_play_continues() -> void:
var game := GameScene.instantiate() as Game
add_child_autofree(game)
await get_tree().process_frame
var state := game.get_game_state()
var run := game.get_run_state()
var floor_two := FloorGeneratorType.generate(run.seed, 2, game.spell_catalog)
run.current_floor = 2
run.set_floor_state(floor_two)
state.set_floor_state(floor_two)
state.player.cell = floor_two.exit
run.current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
game.submit_test_interact()
await get_tree().process_frame
var panel := game.get_node("HUD/RaceClassChoicePanel") as PanelContainer
assert_eq(run.current_floor, 3)
assert_true(panel.visible)
assert_eq(game.get_dialogue_player().race, &"")
assert_eq(game.get_dialogue_player().archetype, &"")
var frozen_cell := state.player.cell
game.submit_test_action(Vector2i.RIGHT)
assert_eq(state.player.cell, frozen_cell)
panel.confirm()
await get_tree().process_frame
assert_ne(game.get_dialogue_player().race, &"")
assert_eq(game.get_dialogue_player().archetype, &"")
panel.confirm()
await get_tree().process_frame
assert_ne(game.get_dialogue_player().archetype, &"")
assert_eq(run.base_archetype, game.get_dialogue_player().archetype)
assert_false(panel.visible)
@@ -0,0 +1 @@
uid://dxy3qbc6qj0gf
+44
View File
@@ -0,0 +1,44 @@
extends GutTest
const GameScene = preload("res://scenes/Game.tscn")
const RunSettingsType = preload("res://scripts/domain/run/run_settings.gd")
const PlayerActionType = preload("res://scripts/domain/run/player_action.gd")
var game: Game
func before_each() -> void:
game = GameScene.instantiate()
game.configure_new_run(RunSettingsType.new("PASSIVE-REGEN-E2E", &"crawler", false, true), "Regenerator")
add_child_autofree(game)
await get_tree().process_frame
await get_tree().process_frame
game.get_game_state().enemies.clear()
func test_a_real_turn_silently_regenerates_player_and_living_companion_health() -> void:
var state := game.get_game_state()
state.player.hit_points = state.player.max_hit_points - 4
state.companion.actor.hit_points = state.companion.actor.max_hit_points - 4
var log_size := game.get_run_state().log.size()
game.submit_player_action(PlayerActionType.new(&"move", _walkable_direction()))
assert_eq(state.player.hit_points, state.player.max_hit_points - 3)
assert_eq(state.companion.actor.hit_points, state.companion.actor.max_hit_points - 3)
var new_events := game.get_run_state().recent_events(game.get_run_state().log.size() - log_size)
assert_false(new_events.any(func(event: GameEvent) -> bool: return event.kind == &"health_regenerated"))
func test_a_dead_companion_is_not_revived_by_the_players_turn() -> void:
var state := game.get_game_state()
state.companion.actor.hit_points = 0
game.submit_player_action(PlayerActionType.new(&"move", _walkable_direction()))
assert_eq(state.companion.actor.hit_points, 0)
func _walkable_direction() -> Vector2i:
var state := game.get_game_state()
for direction in [Vector2i.UP, Vector2i.RIGHT, Vector2i.DOWN, Vector2i.LEFT]:
if state.map.is_walkable(state.player.cell + direction):
return direction
fail_test("The generated start must provide a walkable cardinal action.")
return Vector2i.ZERO
@@ -0,0 +1 @@
uid://cxyqev4mq3tk7
+16 -28
View File
@@ -8,39 +8,27 @@ func before_each() -> void:
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_real_game_exposes_door_and_stairs_prompts_with_help_and_event_log() -> void: func test_real_game_exposes_surface_door_and_stairs_prompts_with_help_and_event_log() -> void:
var hud := game.get_node("HUD") as GameHud
var state := game.get_game_state() var state := game.get_game_state()
var help_label := game.get_node("HUD/HelpLabel") as Label var hud := game.get_node("HUD") as GameHud
var prompt_label := game.get_node("HUD/ContextPromptLabel") as Label var prompt := game.get_node("HUD/ContextPromptLabel") as Label
var event_log := game.get_node("HUD/EventLog") as RichTextLabel state.player.cell = Vector2i(35, 7)
hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Ouvrir la porte") assert_eq(hud.get_context_prompt(), "Espace — Ouvrir la porte")
assert_eq(prompt_label.text, "Espace — Ouvrir la porte") assert_eq(prompt.text, "Espace — Ouvrir la porte")
assert_string_contains(help_label.text, "Déplacer : ZQSD / Flèches")
assert_string_contains(help_label.text, "nord-est : pavé num. 9")
assert_string_contains(help_label.text, "Interagir : Espace ou E")
var interact_event := InputEventKey.new() game._unhandled_input(_key_event(KEY_E))
interact_event.keycode = KEY_SPACE state.player.cell = state.floor_state.exit
interact_event.physical_keycode = KEY_SPACE
interact_event.pressed = true
game._unhandled_input(interact_event)
assert_eq(hud.get_context_prompt(), "")
assert_eq(state.map.get_cell(Vector2i(4, 11)), GridMapState.CellKind.FLOOR)
state.map.set_cell(Vector2i(4, 11), GridMapState.CellKind.FLOOR)
state.player.cell = Vector2i(18, 4)
game.get_run_state().current_floor_deadline().turns_remaining = 2 * FloorDeadline.TURNS_PER_DAY
hud.refresh(state, [], game.get_run_state()) hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier") assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
assert_eq(prompt_label.text, "Espace — Descendre l’escalier") game._unhandled_input(_key_event(KEY_E))
var stairs_results := game.submit_test_interact()
assert_eq(stairs_results[0].kind, &"stairs_used")
assert_eq(game.get_run_state().current_floor, 1) assert_eq(game.get_run_state().current_floor, 1)
assert_eq(hud.get_context_prompt(), "Espace — Monter l’escalier") assert_eq(hud.get_context_prompt(), "Espace — Monter l’escalier")
assert_eq(prompt_label.text, "Espace — Monter l’escalier") assert_eq(prompt.text, "Espace — Monter l’escalier")
var results := game.submit_test_action(Vector2i.LEFT) func _key_event(keycode: Key) -> InputEventKey:
assert_eq(results[0].kind, &"moved") var event := InputEventKey.new()
assert_string_contains(event_log.get_parsed_text(), "You move to") event.keycode = keycode
event.physical_keycode = keycode
event.pressed = true
return event
+43 -23
View File
@@ -10,38 +10,58 @@ func before_each() -> void:
func test_input_pipeline_routes_e_interaction_and_movement_through_action_router() -> void: func test_input_pipeline_routes_e_interaction_and_movement_through_action_router() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var start_cell := state.player.cell state.player.cell = Vector2i(35, 7)
(game.get_node("HUD") as GameHud).refresh(state, [], game.get_run_state())
game._unhandled_input(_key_event(KEY_E))
assert_eq(game.last_turn_results[0].kind, &"door_opened")
game._unhandled_input(_key_event(KEY_RIGHT))
assert_eq(game.last_turn_results[0].kind, &"moved")
assert_eq(state.player.cell, Vector2i(36, 7))
await _dispatch_key(KEY_E) func test_repeated_vertical_arrow_presses_each_move_exactly_once_and_echo_is_ignored() -> void:
assert_eq(state.map.get_cell(Vector2i(4, 11)), GridMapState.CellKind.FLOOR) var state := game.get_game_state()
assert_eq(game.get_run_state().recent_events(2)[0].kind, &"door_opened") state.enemies.clear()
state.player.cell = Vector2i(4, 7)
var starting_turn := game.get_run_state().current_turn
await _dispatch_key(KEY_DOWN) for _index in range(6):
assert_eq(state.player.cell, start_cell + Vector2i.DOWN) game._unhandled_input(_key_event(KEY_DOWN))
assert_eq(game.get_run_state().recent_events(2)[0].kind, &"moved") game._unhandled_input(_key_event(KEY_UP))
assert_eq(state.player.cell, Vector2i(4, 7))
assert_eq(game.get_run_state().current_turn, starting_turn + 12)
var echo_event := _key_event(KEY_DOWN)
echo_event.echo = true
game._unhandled_input(echo_event)
assert_eq(state.player.cell, Vector2i(4, 7))
assert_eq(game.get_run_state().current_turn, starting_turn + 12)
func test_arrow_movement_is_not_lost_when_a_hud_control_keeps_keyboard_focus() -> void:
var state := game.get_game_state()
state.enemies.clear()
state.player.cell = Vector2i(4, 7)
var focused_control := LineEdit.new()
focused_control.focus_mode = Control.FOCUS_ALL
focused_control.text = "A control that consumes navigation keys"
game.get_node("HUD").add_child(focused_control)
focused_control.grab_focus()
await get_tree().process_frame
Input.parse_input_event(_key_event(KEY_DOWN))
await get_tree().process_frame
assert_eq(state.player.cell, Vector2i(4, 8))
func test_input_pipeline_routes_inventory_input_to_the_live_panel_and_journal() -> void: func test_input_pipeline_routes_inventory_input_to_the_live_panel_and_journal() -> void:
var panel := game.get_node("HUD/InventoryPanel") as PanelContainer game._unhandled_input(_key_event(KEY_I))
var event_log := game.get_node("HUD/EventLog") as RichTextLabel assert_true((game.get_node("HUD/InventoryPanel") as PanelContainer).visible)
await _dispatch_key(KEY_I)
var event := game.get_run_state().recent_events(1)[0] var event := game.get_run_state().recent_events(1)[0]
assert_eq(event.kind, &"inventory_opened") assert_eq(event.kind, &"inventory_opened")
assert_eq(event.payload, {"item_count": 0}) assert_eq(event.payload, {"item_count": 0})
assert_eq(event.turn, 1)
assert_true(panel.visible)
assert_string_contains(event_log.get_parsed_text(), "Inventory opened")
func _dispatch_key(keycode: Key) -> void: func _key_event(keycode: Key) -> InputEventKey:
Input.parse_input_event(_key_event(keycode, true))
await get_tree().process_frame
Input.parse_input_event(_key_event(keycode, false))
await get_tree().process_frame
func _key_event(keycode: Key, pressed: bool) -> InputEventKey:
var event := InputEventKey.new() var event := InputEventKey.new()
event.keycode = keycode event.keycode = keycode
event.physical_keycode = keycode event.physical_keycode = keycode
event.pressed = pressed event.pressed = true
return event return event
+5
View File
@@ -24,6 +24,11 @@ func test_real_character_input_opens_panel_and_allocates_level_up_points_without
assert_eq(state.player.progression.attribute_points, 1) assert_eq(state.player.progression.attribute_points, 1)
assert_eq(state.player.progression.skill_points, 1) assert_eq(state.player.progression.skill_points, 1)
assert_true(game.get_run_state().recent_events(8).any(func(event: GameEvent) -> bool: return event.kind == &"level_up")) assert_true(game.get_run_state().recent_events(8).any(func(event: GameEvent) -> bool: return event.kind == &"level_up"))
var xp_bar := game.get_node("HUD/ExperienceBar") as ProgressBar
var xp_label := game.get_node("HUD/ExperienceLabel") as Label
assert_eq(xp_bar.value, 0.0)
assert_eq(xp_bar.max_value, 200.0)
assert_eq(xp_label.text, "Niveau 2 — XP 0/200")
await _dispatch_key(KEY_P) await _dispatch_key(KEY_P)
var panel := game.get_node("HUD/CharacterPanel") as PanelContainer var panel := game.get_node("HUD/CharacterPanel") as PanelContainer
+8
View File
@@ -11,6 +11,7 @@ func test_real_game_resolves_damage_and_death_before_a3_feedback_and_journals_st
enemy.cell = state.player.cell + Vector2i.RIGHT enemy.cell = state.player.cell + Vector2i.RIGHT
enemy.hit_points = 3 enemy.hit_points = 3
enemy.max_hit_points = 3 enemy.max_hit_points = 3
enemy.loot_table = &"floor1_reward"
var presenter := game.get_node("EventPresenter") as EventPresenter var presenter := game.get_node("EventPresenter") as EventPresenter
var observed: Array[GameEvent] = [] var observed: Array[GameEvent] = []
presenter.event_presented.connect(func(event: GameEvent) -> void: presenter.event_presented.connect(func(event: GameEvent) -> void:
@@ -24,6 +25,13 @@ func test_real_game_resolves_damage_and_death_before_a3_feedback_and_journals_st
var recent := game.get_run_state().recent_events(8).filter(func(event: GameEvent) -> bool: return event.kind in [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"]) var recent := game.get_run_state().recent_events(8).filter(func(event: GameEvent) -> bool: return event.kind in [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"])
assert_eq(recent.map(func(event: GameEvent) -> StringName: return event.kind), [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"]) assert_eq(recent.map(func(event: GameEvent) -> StringName: return event.kind), [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"])
assert_eq(recent[2].payload.damage, 3) assert_eq(recent[2].payload.damage, 3)
assert_true(state.floor_state.ground_items.has(enemy.cell))
if state.floor_state.ground_items.has(enemy.cell):
assert_false(state.floor_state.ground_items[enemy.cell].is_empty())
assert_true(state.floor_state.ground_items[enemy.cell][0] is ItemInstance)
var loot_event: GameEvent = recent.filter(func(event: GameEvent) -> bool: return event.kind == &"loot_dropped")[0]
assert_true(loot_event.payload.has("items"))
assert_true(loot_event.payload.has("gold"))
await _wait_for_feedback(observed) await _wait_for_feedback(observed)
assert_eq(observed.map(func(event: GameEvent) -> StringName: return event.kind), [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"]) assert_eq(observed.map(func(event: GameEvent) -> StringName: return event.kind), [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"])
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated") assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated")
+10 -2
View File
@@ -22,8 +22,12 @@ func test_actual_menu_creation_flow_starts_game_and_emits_event() -> void:
assert_true(creation.visible) assert_true(creation.visible)
(creation.get_node("Panel/Layout/Fields/NameEdit") as LineEdit).text = "A6 Hero" (creation.get_node("Panel/Layout/Fields/NameEdit") as LineEdit).text = "A6 Hero"
(creation.get_node("Panel/Layout/Fields/ArchetypeOption") as OptionButton).select(1) assert_null(creation.get_node_or_null("Panel/Layout/Fields/ArchetypeOption"))
assert_null(creation.get_node_or_null("Panel/Layout/Fields/RaceOption"))
(creation.get_node("Panel/Layout/Fields/PetCheck") as CheckBox).button_pressed = true (creation.get_node("Panel/Layout/Fields/PetCheck") as CheckBox).button_pressed = true
await get_tree().process_frame
(creation.get_node("Panel/Layout/Fields/PetDetails/PetNameEdit") as LineEdit).text = "Donut"
(creation.get_node("Panel/Layout/Fields/PetDetails/PetSpeciesEdit") as LineEdit).text = "Chatte devenue intelligente"
(creation.get_node("Panel/Layout/Fields/SeedEdit") as LineEdit).text = "A6-E2E-SEED" (creation.get_node("Panel/Layout/Fields/SeedEdit") as LineEdit).text = "A6-E2E-SEED"
(creation.get_node("Panel/Layout/Fields/DifficultyOption") as OptionButton).select(2) (creation.get_node("Panel/Layout/Fields/DifficultyOption") as OptionButton).select(2)
(creation.get_node("Panel/Layout/Fields/PermadeathOption") as OptionButton).select(1) (creation.get_node("Panel/Layout/Fields/PermadeathOption") as OptionButton).select(1)
@@ -39,8 +43,12 @@ func test_actual_menu_creation_flow_starts_game_and_emits_event() -> void:
assert_eq(game.get_run_state().settings.difficulty_id, &"veteran") assert_eq(game.get_run_state().settings.difficulty_id, &"veteran")
assert_true(game.get_run_state().settings.permadeath) assert_true(game.get_run_state().settings.permadeath)
assert_true(game.get_run_state().settings.pet_enabled) assert_true(game.get_run_state().settings.pet_enabled)
assert_eq(game.get_game_state().companion.name, "Donut")
assert_eq(game.get_game_state().companion.species, "Chatte devenue intelligente")
assert_eq(game.get_run_state().player_name, "A6 Hero") assert_eq(game.get_run_state().player_name, "A6 Hero")
assert_eq(game.get_run_state().base_archetype, &"mystic") assert_eq(game.get_run_state().base_archetype, &"")
assert_eq(game.get_dialogue_player().race, &"")
assert_eq(game.get_dialogue_player().archetype, &"")
assert_eq(game.get_run_state().current_floor, 0) assert_eq(game.get_run_state().current_floor, 0)
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"game_started") assert_eq(game.get_run_state().recent_events(1)[0].kind, &"game_started")
assert_eq(started_events.size(), 1) assert_eq(started_events.size(), 1)
+16
View File
@@ -25,6 +25,22 @@ func before_each() -> void:
func after_each() -> void: func after_each() -> void:
OS.set_environment("DCW_AUDIO_HOME", previous_audio_home) OS.set_environment("DCW_AUDIO_HOME", previous_audio_home)
func test_normal_game_starts_with_bundled_exploration_music_playing() -> void:
# This scene uses the production AudioLibrary rather than the isolated
# replacement installed by before_each.
game.queue_free()
await get_tree().process_frame
game = GameScene.instantiate()
add_child_autofree(game)
await get_tree().process_frame
var audio := game.get_node("AudioLibrary") as AudioLibrary
assert_eq(audio.current_ambience_context, "exploration")
assert_true(audio.has_playable_ambience())
assert_true(audio.get_ambience_player().playing)
if audio.get_ambience_stream() != null:
assert_string_contains(audio.get_ambience_stream().resource_path, "assets/audio/")
func test_real_game_resolves_combat_with_empty_audio_home() -> void: func test_real_game_resolves_combat_with_empty_audio_home() -> void:
var audio = game.get_node("AudioLibrary") var audio = game.get_node("AudioLibrary")
+24 -4
View File
@@ -9,7 +9,7 @@ var game: Game
func before_each() -> void: func before_each() -> void:
game = GameScene.instantiate() game = GameScene.instantiate()
game.configure_new_run(RunSettings.new("E4-PET-E2E", &"crawler", false, true), "Pet Tester", &"vanguard") game.configure_new_run(RunSettings.new("E4-PET-E2E", &"crawler", false, true), "Pet Tester")
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
await get_tree().process_frame await get_tree().process_frame
@@ -24,20 +24,40 @@ func test_pet_choice_spawns_visible_companion_and_real_input_changes_command_sta
await _dispatch_key(KEY_K) await _dispatch_key(KEY_K)
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Follow") var panel_text := (panel.get_node("Body") as RichTextLabel).get_parsed_text()
assert_string_contains(panel_text, "Reste en arrière")
assert_string_contains(panel_text, "Défends-moi")
assert_string_contains(panel_text, "Attaque à vue")
await _dispatch_key(KEY_RIGHT) await _dispatch_key(KEY_RIGHT)
assert_eq(companion.stance, CompanionState.Stance.DEFEND) assert_eq(companion.stance, CompanionState.Stance.DEFEND_ME)
assert_string_contains(String(game.get_run_state().recent_events(1)[0].kind), "companion_stance") assert_string_contains(String(game.get_run_state().recent_events(1)[0].kind), "companion_stance")
await _dispatch_key(KEY_ESCAPE) await _dispatch_key(KEY_ESCAPE)
assert_false(panel.visible) assert_false(panel.visible)
func test_companion_uses_the_temporary_dog_sprite() -> void:
var companion_sprite := game.get_node("World/Companion") as Sprite2D
assert_not_null(companion_sprite.texture)
assert_string_contains(companion_sprite.texture.resource_path, "war_dog.png")
func test_floor_transition_places_the_living_pet_next_to_the_player() -> void:
var state := game.get_game_state()
state.player.cell = state.floor_state.exit
state.exit_reached = false
game.get_run_state().current_floor_deadline().turns_remaining = 0
game.submit_player_action(preload("res://scripts/domain/run/player_action.gd").new(&"interact"))
assert_eq(game.get_run_state().current_floor, 1)
assert_lte(state.companion.actor.cell.distance_to(state.player.cell), 1.0)
assert_ne(state.companion.actor.cell, state.player.cell)
func test_live_enemy_attack_is_intercepted_in_support_and_companion_death_leaves_player_run_alive() -> void: func test_live_enemy_attack_is_intercepted_in_support_and_companion_death_leaves_player_run_alive() -> void:
var state := game.get_game_state() var state := game.get_game_state()
var companion := state.companion var companion := state.companion
companion.actor.hit_points = 1 companion.actor.hit_points = 1
companion.actor.max_hit_points = 1 companion.actor.max_hit_points = 1
companion.actor.cell = state.player.cell + Vector2i.RIGHT companion.actor.cell = state.player.cell + Vector2i.RIGHT
assert_true(companion.set_stance(CompanionState.Stance.SUPPORT)) assert_true(companion.set_stance(CompanionState.Stance.DEFEND_ME))
var enemy: ActorState = state.enemies.values()[0] var enemy: ActorState = state.enemies.values()[0]
enemy.cell = state.player.cell + Vector2i.LEFT enemy.cell = state.player.cell + Vector2i.LEFT
enemy.weapon_damage = 20 enemy.weapon_damage = 20
+1 -1
View File
@@ -37,7 +37,7 @@ func test_real_interact_picks_visible_ground_item_then_inventory_action_opens_li
await _dispatch_key(KEY_I) await _dispatch_key(KEY_I)
var panel := game.get_node("HUD/InventoryPanel") as PanelContainer var panel := game.get_node("HUD/InventoryPanel") as PanelContainer
var entries := game.get_node("HUD/InventoryPanel/Entries") as RichTextLabel var entries := game.get_node("HUD/InventoryPanel/Layout/Columns/Entries") as RichTextLabel
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains(entries.get_parsed_text(), "Bandage x2") assert_string_contains(entries.get_parsed_text(), "Bandage x2")
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"inventory_opened") assert_eq(game.get_run_state().recent_events(1)[0].kind, &"inventory_opened")
+1 -1
View File
@@ -24,7 +24,7 @@ func test_real_input_board_accepts_tracks_completes_rewards_and_journals_quest()
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var panel := game.get_node("HUD/QuestPanel") as PanelContainer var panel := game.get_node("HUD/QuestPanel") as PanelContainer
assert_true(panel.visible) assert_true(panel.visible)
assert_string_contains((panel.get_node("Entries") as RichTextLabel).get_parsed_text(), "Prime : gobelins") assert_string_contains((panel.get_node("Layout/Entries") as RichTextLabel).get_parsed_text(), "Prime : gobelins")
assert_eq(game.get_run_state().recent_events(1)[0].kind, &"quest_board_read") assert_eq(game.get_run_state().recent_events(1)[0].kind, &"quest_board_read")
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
+43
View File
@@ -11,6 +11,7 @@ func test_real_game_ranged_action_opens_targeting_selects_enemy_and_resolves_dam
enemy.cell = state.player.cell + Vector2i(3, 0) enemy.cell = state.player.cell + Vector2i(3, 0)
enemy.hit_points = 6 enemy.hit_points = 6
enemy.max_hit_points = 6 enemy.max_hit_points = 6
enemy.loot_table = &"floor1_reward"
game.equip_test_ranged_weapon({ game.equip_test_ranged_weapon({
"id": "weapon_hand_crossbow", "weapon_kind": "ranged", "damage": 6, "id": "weapon_hand_crossbow", "weapon_kind": "ranged", "damage": 6,
"damage_variance": 0, "accuracy": 0, "range": 4, "damage_variance": 0, "accuracy": 0, "range": 4,
@@ -31,6 +32,7 @@ func test_real_game_ranged_action_opens_targeting_selects_enemy_and_resolves_dam
game.submit_test_target(&"goblin") game.submit_test_target(&"goblin")
assert_false(state.enemies.has(&"goblin")) # immediate domain resolution precedes A3 presentation assert_false(state.enemies.has(&"goblin")) # immediate domain resolution precedes A3 presentation
assert_true(state.floor_state.ground_items.has(enemy.cell))
assert_eq(state.player.ammunition, 1) assert_eq(state.player.ammunition, 1)
assert_false(overlay.visible) assert_false(overlay.visible)
var recent := game.get_run_state().recent_events(8) var recent := game.get_run_state().recent_events(8)
@@ -38,6 +40,36 @@ func test_real_game_ranged_action_opens_targeting_selects_enemy_and_resolves_dam
await _wait_for_projectile(presented) await _wait_for_projectile(presented)
assert_eq(presented.size(), 1) assert_eq(presented.size(), 1)
func test_f_targeting_can_be_cancelled_without_a_turn_and_valid_shot_spends_one_turn_while_enemy_approaches() -> void:
var game := GameScene.instantiate() as Game
add_child_autofree(game)
await get_tree().process_frame
var state := game.get_game_state()
var enemy: ActorState = state.enemies[&"goblin"]
state.player.cell = Vector2i(4, 7)
enemy.cell = Vector2i(8, 7)
enemy.ai_behavior = &"aggressive"
enemy.vision_range = 8
game.equip_test_ranged_weapon({
"id": "weapon_hand_crossbow", "weapon_kind": "ranged", "damage": 1,
"damage_variance": 0, "accuracy": 100, "range": 6,
}, 2)
var starting_turn := game.get_run_state().current_turn
await _dispatch_key(KEY_F)
var overlay := game.get_node("HUD/TargetingOverlay") as TargetingOverlay
assert_true(overlay.visible)
assert_eq(game.get_run_state().current_turn, starting_turn, "Choosing a target does not spend a turn.")
await _dispatch_key(KEY_ESCAPE)
assert_false(overlay.visible)
assert_eq(game.get_run_state().current_turn, starting_turn, "Cancelling targeting does not spend a turn.")
await _dispatch_key(KEY_F)
await _dispatch_key(KEY_ENTER)
assert_eq(game.get_run_state().current_turn, starting_turn + 1)
assert_eq(enemy.cell, Vector2i(7, 7), "A surviving enemy immediately advances after the shot.")
assert_eq(state.player.ammunition, 1)
func test_real_game_rejects_blocked_target_without_damage_or_ammunition_loss() -> void: func test_real_game_rejects_blocked_target_without_damage_or_ammunition_loss() -> void:
var game := GameScene.instantiate() as Game var game := GameScene.instantiate() as Game
add_child_autofree(game) add_child_autofree(game)
@@ -60,6 +92,17 @@ func test_real_game_rejects_blocked_target_without_damage_or_ammunition_loss() -
assert_eq(rejected.size(), 1) assert_eq(rejected.size(), 1)
assert_eq(rejected[0].payload.reason, &"line_of_sight_blocked") assert_eq(rejected[0].payload.reason, &"line_of_sight_blocked")
func _dispatch_key(keycode: Key) -> void:
var event := InputEventKey.new()
event.keycode = keycode
event.physical_keycode = keycode
event.pressed = true
Input.parse_input_event(event)
await get_tree().process_frame
event.pressed = false
Input.parse_input_event(event)
await get_tree().process_frame
func _wait_for_projectile(presented: Array[GameEvent]) -> void: func _wait_for_projectile(presented: Array[GameEvent]) -> void:
var deadline := Time.get_ticks_msec() + 1000 var deadline := Time.get_ticks_msec() + 1000
while presented.is_empty() and Time.get_ticks_msec() < deadline: while presented.is_empty() and Time.get_ticks_msec() < deadline:
+1 -1
View File
@@ -20,7 +20,7 @@ func test_wandering_crawler_dialogue_recruits_visible_party_member_and_opens_par
await _dispatch_key(KEY_E) await _dispatch_key(KEY_E)
var dialogue := game.get_node("HUD/DialoguePanel") as PanelContainer var dialogue := game.get_node("HUD/DialoguePanel") as PanelContainer
assert_true(dialogue.visible) assert_true(dialogue.visible)
assert_string_contains((dialogue.get_node("Entries") as RichTextLabel).get_parsed_text(), "Rejoindre le groupe.") assert_string_contains((dialogue.get_node("Layout/Entries") as RichTextLabel).get_parsed_text(), "Rejoindre le groupe.")
await _dispatch_key(KEY_ENTER) await _dispatch_key(KEY_ENTER)
assert_false(dialogue.visible) assert_false(dialogue.visible)
+1 -1
View File
@@ -9,7 +9,7 @@ func before_each() -> void:
await get_tree().process_frame await get_tree().process_frame
func test_real_input_event_records_one_action_turn_and_hud_renders_its_run_state_messages() -> void: func test_real_input_event_records_one_action_turn_and_hud_renders_its_run_state_messages() -> void:
game._unhandled_input(_key_event(KEY_DOWN)) game._unhandled_input(_key_event(KEY_LEFT))
var run := game.get_run_state() var run := game.get_run_state()
var events := run.recent_events(2) var events := run.recent_events(2)
var event_log := game.get_node("HUD/EventLog") as RichTextLabel var event_log := game.get_node("HUD/EventLog") as RichTextLabel
+27
View File
@@ -17,6 +17,21 @@ func before_each() -> void:
func after_each() -> void: func after_each() -> void:
repository.delete_all() repository.delete_all()
func test_editor_safe_v_opens_manual_save_slots_and_writes_the_selected_slot() -> void:
await _start_new_run("Sauvegarde manuelle", "SAVE-SHORTCUT")
var game := menu.get_node("Game") as Game
await _dispatch_key(KEY_V)
var panel := menu.get_node("SaveLoadPanel") as SaveLoadPanel
assert_true(panel.visible)
assert_eq(panel.title_label.text, "SAUVEGARDER LA PARTIE")
assert_string_contains(panel.status_label.text, "manuelle")
panel.slot_requested.emit(1)
assert_true(repository.list_slots()[0].exists)
assert_string_contains(panel.status_label.text, "emplacement 1")
assert_eq(game.get_run_state().current_turn, 1, "Opening the save panel must not consume a gameplay turn.")
func test_save_restart_and_load_slot_restores_equal_run_state() -> void: func test_save_restart_and_load_slot_restores_equal_run_state() -> void:
await _start_new_run("G1 restart hero", "G1-E2E-SEED") await _start_new_run("G1 restart hero", "G1-E2E-SEED")
var original := menu.get_node("Game") as Game var original := menu.get_node("Game") as Game
@@ -55,6 +70,18 @@ func _start_new_run(name: String, seed: String) -> void:
await _click_button(creation.get_node("Panel/Layout/Actions/StartRunButton") as Button) await _click_button(creation.get_node("Panel/Layout/Actions/StartRunButton") as Button)
await get_tree().process_frame await get_tree().process_frame
func _dispatch_key(keycode: Key, ctrl_pressed: bool = false) -> void:
var pressed := InputEventKey.new()
pressed.keycode = keycode
pressed.physical_keycode = keycode
pressed.ctrl_pressed = ctrl_pressed
pressed.pressed = true
Input.parse_input_event(pressed)
await get_tree().process_frame
pressed.pressed = false
Input.parse_input_event(pressed)
await get_tree().process_frame
func _click_button(button: Button) -> void: func _click_button(button: Button) -> void:
assert_not_null(button) assert_not_null(button)
var click_position := button.get_global_rect().get_center() var click_position := button.get_global_rect().get_center()
+18
View File
@@ -10,6 +10,24 @@ func before_each() -> void:
add_child_autofree(game) add_child_autofree(game)
await get_tree().process_frame await get_tree().process_frame
func test_walking_on_an_undiscovered_trap_records_complete_structured_events() -> void:
var state := game.get_game_state()
state.enemies.clear()
state.player.perception = 0
var trap_cell := state.player.cell + Vector2i.RIGHT
state.floor_state.traps[trap_cell] = {"trap_id": &"trap_dart"}
game._unhandled_input(_key_event(KEY_RIGHT))
assert_eq(state.player.cell, trap_cell)
var trap_events := game.get_run_state().recent_events(8).filter(func(event: GameEvent) -> bool: return event.kind in [&"trap_triggered", &"trap_status_applied"])
# One structured trigger, one structured status, plus the legacy TurnResult
# compatibility event are all journaled with complete actor/cell metadata.
assert_eq(trap_events.size(), 3)
assert_eq(trap_events.filter(func(event: GameEvent) -> bool: return event.kind == &"trap_status_applied").size(), 1)
assert_true(trap_events.all(func(event: GameEvent) -> bool: return event.actor_id == state.player.id and event.cell == trap_cell))
assert_true(state.player.has_status(&"poison"))
func test_real_input_route_reveals_secret_discovers_and_disarms_trap_then_uses_shrine_and_reads_board() -> void: func test_real_input_route_reveals_secret_discovers_and_disarms_trap_then_uses_shrine_and_reads_board() -> void:
var state := game.get_game_state() var state := game.get_game_state()
state.enemies.clear() state.enemies.clear()

Some files were not shown because too many files have changed in this diff Show More