(Underdepths) Pass 2
This commit is contained in:
1 parent
4a5a92cb74
commit
b49c285c89
37 files changed
+5590
No files matched your search
@@ -0,0 +1,89 @@
|
||||
|
||||
=== Phase 1 — BSP dungeon generation ===
|
||||
PASS: floor 0: 9 rooms, size ok, no overlaps
|
||||
PASS: floor 1: 6 rooms, size ok, no overlaps
|
||||
PASS: floor 2: 9 rooms, size ok, no overlaps
|
||||
PASS: floor 3: 9 rooms, size ok, no overlaps
|
||||
PASS: floor 4: 9 rooms, size ok, no overlaps
|
||||
PASS: all room centers reachable by flood fill
|
||||
+--------------------------------------------------------------------------------+
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
|##........###.....##############################################################|
|
||||
|##........###.....##############################################################|
|
||||
|##.........................#####################################################|
|
||||
|##........###.....########.#####################################################|
|
||||
|#####..###################.#####################################################|
|
||||
|#####..###################.#####################################################|
|
||||
|#####..###################.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|###................#######.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|###....###.........#######.#####################################################|
|
||||
|######.###.........#######.#####################################################|
|
||||
|######.###################.#####################################################|
|
||||
|######.###################.#####################################################|
|
||||
|##.........##......#######.#####################################################|
|
||||
|##.........##......#######.#####################################################|
|
||||
|##.........##......#######.#####################################################|
|
||||
|##.........##......##..........#################################################|
|
||||
|##.................##..........#################################################|
|
||||
|######.######......##..........#################################################|
|
||||
|######.######......##..........#################################################|
|
||||
|##.........##......##..........#################################################|
|
||||
|##.........##########..........#################################################|
|
||||
|##.........##########..........#################################################|
|
||||
|##.........##########..........#################################################|
|
||||
|##.........#####################################################################|
|
||||
|######.#########################################################################|
|
||||
|######.#########################################################################|
|
||||
|######.#########################################################################|
|
||||
|######.#########################################################################|
|
||||
|######.#########################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|####..........##################################################################|
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
|################################################################################|
|
||||
+--------------------------------------------------------------------------------+
|
||||
PASS: ASCII render printed
|
||||
|
||||
=== Phase 2 — FOV, A*, combat, AI ===
|
||||
PASS: FOV: walled-in player occluded (sees 9 tiles, none past ring)
|
||||
PASS: FOV: open field sees 197 tiles within radius
|
||||
PASS: A*: path (2, 2)->(17, 17) len 31 through gap, contiguous
|
||||
PASS: A*: handles blocked/wall target without crashing
|
||||
PASS: combat: 1000 swings, hit=852, crit=81, mean hit dmg=8.8
|
||||
PASS: AI: goblin chased along corridor (2->3)
|
||||
|
||||
=== Phase 3 — enemies, items, XP/leveling ===
|
||||
PASS: enemy roster: all 8 kinds spawn with correct stats
|
||||
PASS: boss dragon present with boss-scale HP
|
||||
PASS: equip weapon: power 4->8
|
||||
PASS: equip armor: armor 0->4
|
||||
PASS: item categories present: ['armor', 'potion', 'scroll', 'weapon']
|
||||
PASS: XP: gained 30 -> level 1->2, full heal
|
||||
PASS: XP: level-up granted stat increases
|
||||
|
||||
=== Phase 4 — save/load, menus, pickup/descent, audio ===
|
||||
PASS: save/load: turn, level, floor, position restored
|
||||
PASS: menus: session state readable (dead)
|
||||
PASS: actions: ('wait',) advances turn
|
||||
PASS: pickup: ('pickup',) added item to inventory
|
||||
PASS: pickup: item removed from floor
|
||||
PASS: descent: ('descend',) floor 0->1
|
||||
PASS: audio: plays effects without raising (enabled=True)
|
||||
|
||||
==== RESULT: 27 passed, 0 failed ====
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
|
||||
=== Smoke playthrough (headless) ===
|
||||
PASS: explore: moved, turn=5, pos=(5,5)
|
||||
PASS: combat: engaged enemy (fought=True)
|
||||
PASS: pickup: exercised
|
||||
PASS: descend: floor 0->1
|
||||
PASS: save/load mid-play: state preserved
|
||||
PASS: death path: state=dead (no crash)
|
||||
|
||||
==== RESULT: 6 passed, 0 failed ====
|
||||
@@ -0,0 +1,52 @@
|
||||
[1;36m[pipeline][0m Underdepths pipeline — start state = 1 stop_after = 5 (pi=pi python=python3)
|
||||
[1;36m[pipeline][0m =================== PHASE 2 ===================
|
||||
[1;36m[pipeline][0m build phase 2 / fov (timeout 1500s, log logs/phase2_fov.log)
|
||||
[1;36m[pipeline][0m build phase 2 / behaviors (timeout 1500s, log logs/phase2_behaviors.log)
|
||||
[1;36m[pipeline][0m gate: python3 tests/smoke.py --phase 2
|
||||
|
||||
=== Phase 2 — FOV, A*, combat, AI ===
|
||||
PASS: FOV: walled-in player occluded (sees 9 tiles, none past ring)
|
||||
PASS: FOV: open field sees 197 tiles within radius
|
||||
PASS: A*: path (2, 2)->(17, 17) len 31 through gap, contiguous
|
||||
PASS: A*: handles blocked/wall target without crashing
|
||||
PASS: combat: 1000 swings, hit=852, crit=81, mean hit dmg=8.8
|
||||
PASS: AI: goblin chased along corridor (2->3)
|
||||
|
||||
==== RESULT: 6 passed, 0 failed ====
|
||||
[1;36m[pipeline][0m =================== PHASE 2 GATE PASSED ===================
|
||||
[1;36m[pipeline][0m =================== PHASE 3 ===================
|
||||
[1;36m[pipeline][0m build phase 3 / content (timeout 1500s, log logs/phase3_content.log)
|
||||
[1;36m[pipeline][0m gate: python3 tests/smoke.py --phase 3
|
||||
|
||||
=== Phase 3 — enemies, items, XP/leveling ===
|
||||
PASS: enemy roster: all 8 kinds spawn with correct stats
|
||||
PASS: boss dragon present with boss-scale HP
|
||||
PASS: equip weapon: power 4->8
|
||||
PASS: equip armor: armor 0->4
|
||||
PASS: item categories present: ['armor', 'potion', 'scroll', 'weapon']
|
||||
PASS: XP: gained 30 -> level 1->2, full heal
|
||||
PASS: XP: level-up granted stat increases
|
||||
|
||||
==== RESULT: 7 passed, 0 failed ====
|
||||
[1;36m[pipeline][0m =================== PHASE 3 GATE PASSED ===================
|
||||
[1;36m[pipeline][0m =================== PHASE 4 ===================
|
||||
[1;36m[pipeline][0m build phase 4 / polish (timeout 1500s, log logs/phase4_polish.log)
|
||||
[1;36m[pipeline][0m gate: python3 tests/smoke.py --phase 4
|
||||
|
||||
=== Phase 4 — save/load, menus, pickup/descent, audio ===
|
||||
PASS: save/load: turn, level, floor, position restored
|
||||
PASS: menus: session state readable (dead)
|
||||
PASS: actions: ('wait',) advances turn
|
||||
PASS: pickup: ('pickup',) added item to inventory
|
||||
PASS: pickup: item removed from floor
|
||||
PASS: descent: ('descend',) floor 0->1
|
||||
PASS: audio: plays effects without raising (enabled=True)
|
||||
|
||||
==== RESULT: 7 passed, 0 failed ====
|
||||
[1;36m[pipeline][0m =================== PHASE 4 GATE PASSED ===================
|
||||
[1;36m[pipeline][0m =================== GOAL BACKSTOP ===================
|
||||
[1;36m[pipeline][0m evidence: smoke --all=1 --play=1 headless-launch=1
|
||||
[1;36m[pipeline][0m =================== ALL ACCEPTANCE GATES GREEN ===================
|
||||
[1;36m[pipeline][0m =================== BUILD COMPLETE (state=5) ===================
|
||||
[1;36m[pipeline][0m Play it: python3 main.py
|
||||
[1;36m[pipeline][0m Test it: python3 tests/smoke.py --phase all
|
||||
@@ -0,0 +1,21 @@
|
||||
Phase 1 is complete. ✅ `python3 tests/smoke.py --phase 1` → **7 passed, 0 failed** (exit 0).
|
||||
|
||||
## Summary
|
||||
|
||||
Created all Phase 1 files plus the `__init__.py` package markers:
|
||||
|
||||
| File | What it does |
|
||||
|------|-------------|
|
||||
| `data/constants.py` | All tuning constants: map size, tile ids, `LEVEL_XP`/`LEVEL_HP_GAIN`/`LEVEL_POWER_GAIN`, `PLAYER_BASE`, `COLORS`, room bounds, BSP split range (5–8), and the per-floor `SPAWN_TABLE` (floor 9 → 0 enemies / 2 potions) |
|
||||
| `entities/entity.py` | `@dataclass(slots=True) Rect` (read-only `.center`, `.intersects()` on interiors) and base `Entity` |
|
||||
| `entities/player.py` | `Player` + `make_player(x,y)` with `total_power`/`total_armor` (reads item `.stats`), `gain_xp` (threshold via `LEVEL_XP[level]`), `level_up` (stat grants + full heal), `equip` (returns previous to inventory), `heal` |
|
||||
| `entities/enemy.py` | `Enemy` + `make_enemy(kind,x,y)`; reads `data.enemies.ENEMIES` if present else an inline fallback roster matching plan.md for all 8 kinds (incl. `ranged_power` for archer, `can_split` for slime) |
|
||||
| `engine/map_gen.py` | `GameMap` dataclass, `generate_floor(...)`, `is_walkable(...)`. Recursive BSP (alternating/aspect axis, 5–8 splits) carving margin-shrunk rooms inside disjoint leaves → guaranteed no overlaps; sibling rooms joined by L-corridors → full flood-fill connectivity; stairs in the farthest room from spawn; floor 9 = single 20×15 boss arena, no stairs. Spawns items/enemies only if `data.items`/`data.enemies` exist (skipped cleanly in phase 1) |
|
||||
| `main.py` | Real pygame loop: forces dummy SDL drivers, 1280×800 window, generates floor 0, renders colored rects per tile + stairs + player, arrows/hjkl/yubn movement with walkability check, Esc to quit, 60 FPS cap; runs cleanly headless |
|
||||
|
||||
Key design guarantees that satisfy the gate:
|
||||
- **No room overlaps** — rooms are carved strictly inside disjoint BSP leaves with a clamped margin, so interiors can never overlap (touching boundaries return `False` from the strict-inequality `intersects`).
|
||||
- **Full connectivity** — recursive sibling-room corridor joining means every room center is reachable from `rooms[0].center` by a floor-only flood fill.
|
||||
- **Correct indexing** — `tiles[y][x]`, 1-tile wall border, `MAP_W=80`×`MAP_H=50`.
|
||||
|
||||
`.build_state` advanced to `1`.
|
||||
@@ -0,0 +1,28 @@
|
||||
Done. `ai/behaviors.py` is implemented and the phase 2 gate passes.
|
||||
|
||||
## Summary
|
||||
|
||||
Created **`ai/behaviors.py`** with the exact required signature:
|
||||
|
||||
```python
|
||||
take_enemy_turn(enemy, game_map, player, enemy_visible:set) -> list[str]
|
||||
```
|
||||
|
||||
### Behaviors implemented (one action per call)
|
||||
- **wander** — 50/50 wait or step to a random walkable 8-neighbour; never seeks the player.
|
||||
- **chase** — player visible → set `last_known_pos`, melee (`resolve_attack`) when Chebyshev-adjacent, else one A* step toward the player (`engine.pathfinding.astar`); not visible → step toward `last_known_pos`, and wander once reached/absent.
|
||||
- **flee** — below 30% max HP, step to the neighbour maximizing Chebyshev distance from the player; otherwise behave as chase.
|
||||
- **ranged** — visible & distance > 3 → ranged shot using `ranged_power` (falling back to `power`) with a distance hit penalty, logging **"fires at you"** and mutating `player.hp`; visible & distance ≤ 2 → kite away; not visible → wander.
|
||||
- **phase** — moves one Chebyshev step toward the player **ignoring walls** (may occupy wall tiles), acting only every other turn; adjacent → melee.
|
||||
- **split** — behaves as chase (splitting-on-death is the death handler's job).
|
||||
|
||||
### Design notes
|
||||
- Mutates enemy/player positions and `player.hp` only; **never** mutates `game_map`.
|
||||
- Unknown behaviors gracefully fall back to wander so a bad roster entry can't crash the loop.
|
||||
- Two robustness adapters, all confined to this file:
|
||||
- **`_AttackerView`** — `resolve_attack` reads `accuracy`/`crit_chance`/`weapon_bonus` directly, but the slotted `Enemy` model only guarantees `power`/`armor`/`name`. The view supplies the enemy's real power/name plus `getattr` combat defaults (picked up automatically if phase 3 adds them).
|
||||
- **`_phase_should_act`** — prefers `enemy._phase_toggled` (per the spec), and falls back to a module-level dict keyed by `id(enemy)` for the slotted enemy (spec also explicitly permits "a module-level set").
|
||||
|
||||
### Verification
|
||||
- `__main__` self-check: exercises chase-advance, adjacent melee, wander bounds, flee, ranged-fire, ranged-kite, phase toggle, split-as-chase, and unknown-behavior fallback → **all passed**.
|
||||
- `python3 tests/smoke.py --phase 2` → **6 passed, 0 failed**, including `AI: goblin chased along corridor (2->3)`.
|
||||
@@ -0,0 +1,30 @@
|
||||
The module is complete and correct. Here's a summary of what was delivered:
|
||||
|
||||
## `engine/combat.py` — Phase 2 Combat
|
||||
|
||||
**`resolve_attack(attacker, defender, log=None) -> dict`** implements the exact spec from `plan.md`:
|
||||
|
||||
| Step | Formula |
|
||||
|------|---------|
|
||||
| Hit chance | `clamp(0.7 + (accuracy − evasion)·0.05, 0.1, 0.95)` |
|
||||
| Hit roll | `random() < hit_chance` |
|
||||
| Base damage | `power + getattr(weapon_bonus, 0)` |
|
||||
| Reduced | `max(0, base − defender.armor)` |
|
||||
| Crit | `random() < crit_chance` |
|
||||
| Damage | `reduced · (2 if crit else 1)` |
|
||||
| Apply | `defender.hp −= damage` |
|
||||
| Kill | `hp ≤ 0` → `killed=True`, flip `is_alive=False` if present |
|
||||
|
||||
Returns `{"hit": bool, "crit": bool, "damage": int, "killed": bool}`.
|
||||
|
||||
### Key design decisions
|
||||
- **Pure logic, no pygame** — only `from random import random`.
|
||||
- **Duck-typed defender** — works for any object with `hp`/`armor`/`evasion`; `is_alive` is optional (guarded with `hasattr`).
|
||||
- **Robust HP mutation** — computes `new_hp` first, then attempts `defender.hp = new_hp`. The smoke test passes an **immutable `namedtuple`** as defender, which would crash a naive `defender.hp −= damage`. By computing `new_hp` up-front, the return dict (`damage`, `killed`) stays correct even when the write is rejected. Real mutable combatants (`Player`/`Enemy` dataclasses) behave exactly per spec.
|
||||
- **Human-readable log** lines: `"X hits Y for N damage!"`, `"Critical hit! X hits Y for N damage!"`, `"X misses Y"`, plus `"X defeats Y!"` on a kill.
|
||||
|
||||
### Verification
|
||||
- `__main__` self-check: **6/6 passed** (forced hit/crit/miss, kill path, clamp bounds `[0.1, 0.95]`, defender-without-`is_alive`).
|
||||
- `python3 tests/smoke.py --phase 2`: **combat assertions PASS** — `1000 swings, hit=852, crit=81, mean hit dmg=8.8` (hit-rate ≈0.85, mean ≈8.8 as expected).
|
||||
|
||||
The two remaining gate failures (`engine.fov`, `ai.behaviors`) are **out of scope** for this task ("create `engine/combat.py` ONLY") — they belong to the FOV and AI sub-tasks of Phase 2.
|
||||
@@ -0,0 +1,18 @@
|
||||
FOV is complete and both assertions pass:
|
||||
|
||||
- **PASS: FOV: walled-in player occluded (sees 9 tiles, none past ring)**
|
||||
- **PASS: FOV: open field sees 197 tiles within radius**
|
||||
|
||||
The only failure is `import ai.behaviors / entities.enemy` — that's the AI module owned by another worker, which the task explicitly says may still fail ("just ensure FOV passes"). A* and combat also pass since those workers already shipped.
|
||||
|
||||
## Summary
|
||||
|
||||
Created **`engine/fov.py`** only, implementing `compute_fov(width, height, tiles, ox, oy, radius=8) -> set[tuple[int,int]]` via **Björn Bergström recursive shadowcasting** over 8 octants, from scratch with no libraries and no pygame.
|
||||
|
||||
Key implementation details:
|
||||
- **8 octants** driven by the standard `_OCTANTS` multiplier table; each octant scanned by a recursive `cast_light` tracking a slope window `[start, end]`.
|
||||
- **Walls block beyond**: when a wall follows open floor, a child scan is spawned for the slope band past it; the wall run is marked `blocked`. The critical `if blocked: break` after each row stops the scan once a whole row sits in shadow — this is what makes the walled-in ring fully occlude (sees exactly origin + 8 walls).
|
||||
- **Wall-adjacency rule**: a single additive post-pass lights any wall 8-adjacent to a visible floor tile (room boundaries always show).
|
||||
- **Origin always visible**, and every returned tile satisfies `dx²+dy² ≤ radius²` (Euclidean, hence also within the Chebyshev bound).
|
||||
- **Pure**: only reads `tiles[y][x]` (wall = `== 0`); all bookkeeping is in a local `set`. Out-of-bounds is treated as solid rock. The self-check even verifies `tiles` is byte-for-byte unchanged.
|
||||
- A `__main__` self-check exercises the walled-in, open-field, and wall-pillar cases (the latter confirming a pillar hides the floor directly behind it but reveals the floor beside-behind it).
|
||||
@@ -0,0 +1,24 @@
|
||||
Confirmed. Both failures are entirely outside my scope:
|
||||
- **`can't set attribute`** → `engine/combat.py:79` does `defender.hp -= damage` on the test's immutable `namedtuple` Fighter — combat module bug, owned by others.
|
||||
- **FOV/AI** → `engine.fov` and `ai.behaviors` modules don't exist yet — owned by others.
|
||||
|
||||
This matches the prompt's explicit note ("FOV/combat/AI owned by others may fail").
|
||||
|
||||
## Done — `engine/pathfinding.py` created
|
||||
|
||||
**A* gate results (mine):**
|
||||
- ✅ `PASS: A*: path (2,2)->(17,17) len 31 through gap, contiguous`
|
||||
- ✅ `PASS: A*: handles blocked/wall target without crashing`
|
||||
- ✅ `python3 engine/pathfinding.py` self-check → `pathfinding self-check OK`
|
||||
|
||||
**Implementation highlights:**
|
||||
- Exact signature: `astar(width, height, tiles, start, goal, blocked: frozenset = frozenset()) -> list[tuple[int,int]] | None`
|
||||
- **Manhattan heuristic** (admissible + consistent for uniform 4-connected cost → first goal pop is a shortest path)
|
||||
- **4-neighbour** moves, step cost 1
|
||||
- walkable = in-bounds ∧ `tiles[y][x] == 1` ∧ not in `blocked`
|
||||
- **Deterministic tie-break**: priority queue holds `(f, counter, x, y)` with a monotonic `counter` (FIFO among equal `f`, and `counter` guarantees heapq never compares `(x,y)`)
|
||||
- **Lazy deletion** via a `closed` set so a node can be pushed multiple times cheaply
|
||||
- Path returned **inclusive** `[start … goal]`; `None` when unreachable / out-of-bounds / un-walkable endpoints; `[start]` when `start == goal`
|
||||
- **Pure / no mutation**: only local `g_score`, `came_from`, `closed`, `open_heap` are touched — inputs verified byte-for-byte unchanged in self-check #10
|
||||
- No pygame, no third-party deps (only `heapq`)
|
||||
- `__main__` self-check covers: optimal open-field length, contiguity/walkability, L-routes, `start==goal`, sealed-room `None`, single-gap threading, `blocked` closing the gap → `None`, determinism across repeated calls, out-of-bounds `None`, and input non-mutation.
|
||||
@@ -0,0 +1,13 @@
|
||||
Phase 3 is complete. All gates pass (exit 0 for phases 1, 2, and 3).
|
||||
|
||||
## Summary of Phase 3 work
|
||||
|
||||
**New files created:**
|
||||
- **`data/enemies.py`** — `ENEMIES` roster with exact plan.md values for all 8 kinds (rat 8/3/0/1/wander/5 … ancient_dragon 120/15/8/1/chase/200), plus `ranged_power:6` for the skeleton archer and `can_split:True` for green slime. Includes `ENEMY_FLOORS` kind→(min,max) windows.
|
||||
- **`data/items.py`** — full 13-item catalog (4 weapons, 3 armor, 3 potions, 3 scrolls), each with `category`/`stats`/`effect`. `ITEM_BY_FLOOR(floor, rng)` does depth-scaled distribution (better gear deeper, consumables uniform).
|
||||
- **`entities/item.py`** — `Item` as `@dataclass(slots=True)` with `name, category, x, y, stats, effect, glyph, color`; `make_item(name,x,y)` reads `ITEMS` and copies stats/effect per-instance.
|
||||
|
||||
**Updated files:**
|
||||
- **`entities/player.py`** — added `total_crit_chance()` / `total_evasion()` (fold in War Hammer −5% crit and Plate Armor −10% evasion), strength-potion bonus in `total_power()`, `tick_effects()`, `quaff(idx, log)` (heal/strength/invisibility, consumes item) and `read_scroll(idx, ctx, log, target)` (fireball AoE+XP+split, teleport, mapping). That's 6 distinct working effects.
|
||||
- **`engine/combat.py`** — `resolve_attack` now prefers `total_power/total_armor/total_crit_chance/total_evasion` accessors (so equipped gear matters) while keeping the namedtuple fallback for the phase-2 contract; added `handle_enemy_death` (XP, corpse removal, green-slime→2 small_slime split only when `can_split`) and `check_player_death` (safe hp≤0 path).
|
||||
- **`engine/map_gen.py`** — `spawn_entities` now spawns enemies gated by `ENEMY_FLOORS` and items via `ITEM_BY_FLOOR`, respecting per-floor count tables, avoiding the player's spawn room; floor 9 builds the boss arena with exactly one ancient_dragon + two healing potions, no other enemies, no stairs.
|
||||
@@ -0,0 +1,21 @@
|
||||
Phase 4 is complete and nothing regressed. Here's a summary of what was built:
|
||||
|
||||
## Phase 4 — Polish, Audio, Persist: Complete
|
||||
|
||||
**New files:**
|
||||
|
||||
- **`engine/serializers.py`** — Thin JSON converters for `Rect`, `Item`, `Enemy`, `Player`, `GameMap`. Tuples→lists, sets→lists; `visible` grids excluded (recomputed on load); effects timers persisted.
|
||||
|
||||
- **`engine/game_state.py`** — `GameSession` (`@dataclass(slots=True)`) as the single source of truth: `player`, `dungeon` (all 10 floors), `current_floor`, `log` (capped at 50), `turn`, `state`, `rng_seed`. Implements `new_game`, `apply_action` (move/pickup/descend/save/quaff/read/equip/wait), `to_dict`/`from_dict`, `save`/`load`. Each turn: runs all live enemies with per-enemy FOV (player tile hidden when invisible), recomputes player FOV into `visible`+`explored`, then resolves death/victory. Fixed a stale-floor bug so post-descent processing targets the new floor.
|
||||
|
||||
- **`engine/audio.py`** — `AudioEngine` synthesizes 8 tones (hit/miss/damage/pickup/stairs/levelup/death/victory) with stdlib `array` written straight into `pygame.mixer.Sound(buffer=...)` (no numpy, no asset files). Mixer init is fully guarded; never raises; plays are no-ops when disabled/muted.
|
||||
|
||||
- **`render/camera.py`** — Player-centered, map-clamped viewport (50×30 tiles).
|
||||
|
||||
- **`render/renderer.py`** — Colored 16×16 tiles (visible/explored/unexplored), type-coded entities, stairs glyph, top bar (floor/HP/level/XP), color-coded log panel, equipment + sound bottom bar, context prompts (`Press G to pick up <name>` / `Press > (Shift+.) to descend`), plus main-menu and end-screen drawing.
|
||||
|
||||
- **`main.py`** (rewritten) — Full state machine: menu (New Game/Continue[only if save]/How to Play/Quit) with keyboard+mouse; How-to-Play before each New Game and via `?`; `g`/`>`/`i`/`e`/`q`/`r`/`S`/`m`/Esc all wired to `apply_action` tuples; death screen deletes save → menu on keypress; victory screen likewise. Headless-safe: under dummy drivers it runs a scripted playthrough (menu→play→save→continue→help→mute) and exits 0, cleaning up its own test save.
|
||||
|
||||
**Verification:**
|
||||
- Phase 4: 7/7 ✅ · Phase all: 27/27 ✅ · Smoke play: 6/6 ✅ · Phases 1–3 re-verified ✅
|
||||
- `python main.py` headless exits 0; audio survives forced mixer failure; 8-run randomized stress + forced full-descent-to-victory integration tests had **0 crashes**; save/load mid-descent and effects-timer persistence confirmed.
|
||||
Reference in new issue
Block a user