mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
Python 3.10 is the minimum, so annotations use `X | None`, `list[X]` and friends, enforced by ruff's pyupgrade rules. The remaining typing names are imported directly, with abstract types coming from collections.abc. first() is now generic over the item and default.
75 lines
1.3 KiB
Python
75 lines
1.3 KiB
Python
import enum
|
|
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: str | None
|
|
|
|
|
|
@dataclass
|
|
class Race:
|
|
name: str
|
|
attr: list[StatType]
|
|
|
|
|
|
@dataclass
|
|
class Class:
|
|
name: str
|
|
attr: list[StatType]
|