2.1 KiB
2.1 KiB
AGENTS.md
Run
python main.py
Pure stdlib. No dependencies, no build, no test/lint tooling.
Entrypoints
main.py:main_game_loop()— game startfunction_list.py:startGame()— character creation (returnsname, 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 ofmain.py,scene.py,function_list.py— sibling imports break without it.classis a reserved keyword, so the project usesclass_everywhere (parameter/attribute names, e.g.Player.__init__(self, ..., class_)).- Race/class modules export
RACESandCLASSESdicts (e.g.RACES["Elf"],CLASSES["Wizard"]). The underlying classes (Race,CharacterClass) are preserved for instantiation if needed. CharacterClass.__init__receivesclass_as a parameter — do not confuse with Python'sclassstatement.
Architecture
scene.py— a directed graph ofSceneobjects linked viaadd_exit(direction, scene). TheSceneclass also holdsavailable_items(free pickups) andlootable_items(container contents). Containers use theContainerclass which has adescription,lock_dc/trap_dc(DC for detecting locks/traps via an Intelligence check), and visiblecontents. Locked containers can't be opened (contents hidden); trapped containers trigger if opened without detection/disarming. Usescene.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—Spellobjects grouped intoSPELL_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).