(Underdepths) Pass 5
This commit is contained in:
53 files changed
+5020
No files matched your search
@@ -0,0 +1,38 @@
|
||||
"""Enemy entity: stat block + AI behavior descriptor.
|
||||
|
||||
Full field set per the tests/smoke.py contract. Stats are populated by
|
||||
data/enemies.make_enemy (phase 3); the defaults exist so a bare Enemy() is
|
||||
always constructible.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Enemy:
|
||||
x: int = 0
|
||||
y: int = 0
|
||||
kind: str = ""
|
||||
name: str = ""
|
||||
hp: int = 1
|
||||
max_hp: int = 1
|
||||
power: int = 1
|
||||
armor: int = 0
|
||||
accuracy: int = 4
|
||||
evasion: int = 0
|
||||
crit_chance: float = 0.0
|
||||
ranged_power: int = 0
|
||||
speed: int = 1
|
||||
behavior: str = "wander"
|
||||
xp_value: int = 0
|
||||
last_known_pos: Any = None
|
||||
can_split: bool = False
|
||||
sprite_key: str = ""
|
||||
|
||||
@property
|
||||
def xp(self) -> int:
|
||||
# Contract field is xp_value; gates/tests read .xp. One descriptor,
|
||||
# no extra storage (slots-safe: name is not a slot).
|
||||
return self.xp_value
|
||||
Reference in new issue
Block a user