Mi2dRPGamEng/engine/species.py

32 lines
1.2 KiB
Python

from __future__ import annotations
from dataclasses import dataclass, field
from engine.character import BodyPart
@dataclass(frozen=True)
class AbilityDef:
"""An ability a species can perform, gated on the body parts it needs to work."""
id: str
name: str
required_slots: tuple[str, ...] = ()
@dataclass(frozen=True)
class SpeciesDef:
"""A species/preset a Character is based off: default anatomy + blood-loss thresholds."""
id: str
name: str
genders: list[str] = field(default_factory=list) # open marker: species defines its own valid gender values
default_body_parts: list[BodyPart] = field(default_factory=list)
default_organs: list[str] = field(default_factory=list) # organ_def ids; placed by each organ's own host_slot
body_type: str = "biped" # coarse anatomical shape (e.g. "biped", "quadruped") - gates which
# clothing fits at all, regardless of arm count; see ItemDef.compatible_body_types
abilities: list[AbilityDef] = field(default_factory=list)
blood_danger_threshold: float = 50.0 # % blood remaining
blood_critical_threshold: float = 25.0
health_item_compatibility: list[str] = field(default_factory=list) # placeholder for future health-item tagging