pre-push commit
This commit is contained in:
64
battleflow/models.py
Normal file
64
battleflow/models.py
Normal file
@@ -0,0 +1,64 @@
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass, field, asdict
|
||||
from typing import List, Dict
|
||||
|
||||
@dataclass
|
||||
class Actor:
|
||||
id: str
|
||||
name: str
|
||||
init: float
|
||||
hp: int = 0
|
||||
ac: int = 0
|
||||
type: str = 'pc' # 'pc' | 'npc' | 'monster'
|
||||
note: str = ''
|
||||
avatar: str = '' # URL or local filename under /avatars
|
||||
active: bool = True
|
||||
visible: bool = True
|
||||
dead: bool = False
|
||||
conc: bool = False
|
||||
reveal_ac: bool = False
|
||||
effects: List[str] = field(default_factory=list)
|
||||
|
||||
@dataclass
|
||||
class Preset:
|
||||
id: str
|
||||
name: str
|
||||
hp: int = 0
|
||||
ac: int = 0
|
||||
type: str = 'pc'
|
||||
note: str = ''
|
||||
avatar: str = ''
|
||||
|
||||
@dataclass
|
||||
class PresetGroup:
|
||||
id: str
|
||||
name: str
|
||||
member_ids: List[str] = field(default_factory=list) # preset ids
|
||||
|
||||
# Conditions + icons
|
||||
KNOWN_CONDITIONS = [
|
||||
'poisoned','prone','grappled','restrained','stunned','blinded','deafened',
|
||||
'charmed','frightened','paralyzed','petrified','unconscious'
|
||||
]
|
||||
CONDITION_ICON_FILES: Dict[str, str] = { c: f"{c}.svg" for c in KNOWN_CONDITIONS }
|
||||
|
||||
CURATED_ICON_SLUGS: Dict[str, tuple] = {
|
||||
'blinded': ('delapouite', 'blindfold'),
|
||||
'deafened': ('skoll', 'hearing-disabled'),
|
||||
'charmed': ('lorc', 'charm'),
|
||||
'frightened': ('lorc', 'terror'),
|
||||
'poisoned': ('sbed', 'poison-cloud'),
|
||||
'prone': ('delapouite', 'half-body-crawling'),
|
||||
'grappled': ('lorc', 'grab'),
|
||||
'restrained': ('lorc', 'manacles'),
|
||||
'stunned': ('skoll', 'knockout'),
|
||||
'paralyzed': ('delapouite', 'frozen-body'),
|
||||
'petrified': ('delapouite', 'stone-bust'),
|
||||
'unconscious':('lorc', 'coma'),
|
||||
}
|
||||
|
||||
CONDITION_EMOJI = {
|
||||
'poisoned':'☠️','prone':'🧎','grappled':'🤝','restrained':'🪢','stunned':'💫',
|
||||
'blinded':'🙈','deafened':'🧏','charmed':'💖','frightened':'😱','paralyzed':'🧍',
|
||||
'petrified':'🪨','unconscious':'💤'
|
||||
}
|
||||
Reference in New Issue
Block a user