Files
DungeonCrawlerWorld/docs/superpowers/plans/2026-10-08-save-ranged-pet-controls.md
T

6.2 KiB
Raw Blame History

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.