2.5 KiB
2.5 KiB
Task C4 — Ranged Combat, Ammunition, and Targeting
Scope completed
C4 implements player ranged combat only. It deliberately does not implement spellcasting or change the existing cast command.
- Added a data-backed active ranged weapon and non-negative ammunition count to
ActorState, including floor-state round-trip persistence. - Added
RangedCombat, which validates a living non-self target, equipped ranged weapon, available ammunition, Chebyshev weapon range, and Bresenham line of sight before mutating state. - Valid shots consume exactly one ammunition, reuse the established combat engine for hit/damage/critical/armor behavior, and emit ordered ranged/projectile/combat domain events. Invalid shots do not spend ammunition or deal damage.
- Added the
Raction flow: a HUD targeting overlay lists living enemies, supports arrow-key target cycling, Enter confirmation, and Escape cancellation. - Added projectile feedback presentation. Domain damage/death resolution remains immediate; feedback is subsequently queued through the existing event presenter.
- Added deterministic unit coverage for hit/ammunition, out-of-range rejection, line-of-sight rejection, empty ammunition, and invalid self-targeting; E2E coverage verifies target selection, immediate resolution before presentation, and blocked-target rejection.
Verification
Executed from the C4 worktree with Godot 4.5:
GODOT_BIN=/snap/bin/godot4 ./scripts/verify.sh
Results:
| Suite | Tests | Assertions | Result |
|---|---|---|---|
| Unit | 108 | 859 | Passed |
| Integration | 7 | 9,255 | Passed |
| E2E | 25 | 257 | Passed |
| Total | 140 | 10,371 | Passed |
The full verifier also ran the visual capture twice and passed both measurements:
| Capture | Size | Dungeon pixels | Visible | Explored | Unknown fog |
|---|---|---|---|---|---|
artifacts/visual-check.png |
1280×720 | 489,308 | 17,524 | 10,438 | 366,411 |
artifacts/visual-check-exit.png |
1280×720 | 489,252 | 17,404 | 17,146 | 440,583 |
The capture files and artifacts/visual-check.log are intentionally ignored build artifacts. Verification emitted only pre-existing GUT invalid-UID/resource-exit warnings; it emitted no parse or script errors, and the verifier exited successfully.
Delivery boundary
Changes are confined to ranged weapon/ammunition state, ranged validation and resolution, targeting UI/input, projectile feedback, their tests, and this report. No magic or cast implementation is included.