Files
ProgressQuest-cli/pqcli/config.py
T
Dash c0c6c8aeba mechanic: move word lists to data files
The word lists (monsters, spells, equipment, races, classes, titles and
so on) now live in pqcli/data/*.json instead of pqcli/config.py. A
GameData object loaded at startup is passed to the simulation and UIs.

Users can replace any list by putting NAME.json in
$XDG_CONFIG_HOME/pqcli/data/ or a directory given with --data-dir.
--dump-data DIR copies the built-in files out for editing. Malformed
files are reported and pqcli exits before starting the UI.

Combat task descriptions come from the new combat_verbs list, with
{target} standing for the enemy. The built-in list holds only "Executing
{target}", and a single verb consumes no random roll, so stock gameplay
is unchanged. Recorded traces in tests/fixtures pin this down.

Monster, Race and Class stay in pqcli.config so existing saves still
load.

Resolves #3
2026-10-17 15:55:41 +02:00

76 lines
1.3 KiB
Python

import enum
import typing as T
from dataclasses import dataclass
class StatType(enum.Enum):
strength = "STR"
condition = "CON"
dexterity = "DEX"
intelligence = "INT"
wisdom = "WIS"
charisma = "CHA"
hp_max = "HP Max"
mp_max = "MP Max"
class EquipmentType(enum.Enum):
weapon = "Weapon"
shield = "Shield"
helm = "Helm"
hauberk = "Hauberk"
brassairts = "Brassairts"
vambraces = "Vambraces"
gauntlets = "Gauntlets"
gambeson = "Gambeson"
cuisses = "Cuisses"
greaves = "Greaves"
sollerets = "Sollerets"
PRIME_STATS = [
StatType.strength,
StatType.condition,
StatType.dexterity,
StatType.intelligence,
StatType.wisdom,
StatType.charisma,
]
ALL_STATS = PRIME_STATS + [StatType.hp_max, StatType.mp_max]
# The word lists live in pqcli/data/*.json (see pqcli.game_data).
# Saves pickle Monster, Race and Class instances by import path, so these
# classes must stay in this module.
@dataclass
class Modifier:
name: str
quality: int
@dataclass
class EquipmentPreset:
name: str
quality: int
@dataclass
class Monster:
name: str
level: int
item: T.Optional[str]
@dataclass
class Race:
name: str
attr: T.List[StatType]
@dataclass
class Class:
name: str
attr: T.List[StatType]