# AGENTS.md ## Run ```bash python main.py ``` Pure stdlib. No dependencies, no build, no test/lint tooling. ## Entrypoints - `main.py:main_game_loop()` — game start - `function_list.py:startGame()` — character creation (returns `name, gender, age, race, class_, pre_allocated_stats`) ## Play vs. debug To skip character creation during playtesting, replace `startGame()` with a pre-generated character and assign stats directly (see `main.py:274-290` and `function_list.py:14-94` for the 3 pre-gens). ## Quirks - `sys.path.append('.')` is required at the top of `main.py`, `scene.py`, `function_list.py` — sibling imports break without it. - `class` is a reserved keyword, so the project uses `class_` everywhere (parameter/attribute names, e.g. `Player.__init__(self, ..., class_)`). - Race/class modules export `RACES` and `CLASSES` dicts (e.g. `RACES["Elf"]`, `CLASSES["Wizard"]`). The underlying classes (`Race`, `CharacterClass`) are preserved for instantiation if needed. - `CharacterClass.__init__` receives `class_` as a parameter — do not confuse with Python's `class` statement. ## Architecture - `scene.py` — a directed graph of `Scene` objects linked via `add_exit(direction, scene)`. The `Scene` class also holds `available_items` (free pickups) and `lootable_items` (container contents). Containers use the `Container` class which has a `description`, `lock_dc` / `trap_dc` (DC for detecting locks/traps via an Intelligence check), and visible `contents`. Locked containers can't be opened (contents hidden); trapped containers trigger if opened without detection/disarming. Use `scene.add_corpse(enemy_name, items_dict)` to drop a lootable corpse when an enemy dies. - `player.py` — `Player`, `Inventory` (equipped slots, carried items, weight/encumbrance, currency), item hierarchy (`Item` → `Weapon`, `Armor`, `Money`). - `spell_list.py` — `Spell` objects grouped into `SPELL_LISTS[class_name][spell_level]`. Casting uses an SRD-style slot system with upcasting. - `enum_list.py` — shared enums (`Slots`, `DamageType`, `ItemType`, `SaveType`, etc.). - Modifier formula: `mod = -5 + stat // 2` (standard D&D 5e).