(Underdepths) Prepare for Pass 4
This commit is contained in:
33 files changed
+123
-4173
No files matched your search
@@ -1,68 +0,0 @@
|
||||
"""Enemy: AI behavior tag, stats. Built from the data/enemies roster."""
|
||||
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from entities.entity import Entity
|
||||
from data.enemies import ENEMIES
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Enemy(Entity):
|
||||
hp: int = 0
|
||||
max_hp: int = 0
|
||||
power: int = 0
|
||||
armor: int = 0
|
||||
accuracy: int = 0
|
||||
evasion: int = 0
|
||||
crit_chance: float = 0.0
|
||||
speed: int = 1
|
||||
behavior: str = ""
|
||||
xp_value: int = 0
|
||||
ranged_power: int = 0
|
||||
last_known_pos: tuple[int, int] | None = None
|
||||
act_counter: int = 0
|
||||
can_split: bool = False
|
||||
|
||||
@property
|
||||
def effective_power(self) -> int:
|
||||
return self.power
|
||||
|
||||
@property
|
||||
def effective_armor(self) -> int:
|
||||
return self.armor
|
||||
|
||||
@property
|
||||
def effective_accuracy(self) -> int:
|
||||
return self.accuracy
|
||||
|
||||
@property
|
||||
def effective_evasion(self) -> int:
|
||||
return self.evasion
|
||||
|
||||
@property
|
||||
def effective_crit_chance(self) -> float:
|
||||
return self.crit_chance
|
||||
|
||||
|
||||
def make_enemy(kind: str, x: int, y: int) -> Enemy:
|
||||
stats: dict[str, Any] = ENEMIES[kind]
|
||||
hp = int(stats["hp"])
|
||||
return Enemy(
|
||||
x=x, y=y, name=kind, color=tuple(stats["color"]),
|
||||
hp=hp,
|
||||
max_hp=hp,
|
||||
power=int(stats["power"]),
|
||||
armor=int(stats["armor"]),
|
||||
accuracy=int(stats["accuracy"]),
|
||||
evasion=int(stats["evasion"]),
|
||||
crit_chance=float(stats["crit_chance"]),
|
||||
speed=int(stats["speed"]),
|
||||
behavior=str(stats["behavior"]),
|
||||
xp_value=int(stats["xp"]),
|
||||
ranged_power=int(stats["ranged_power"]),
|
||||
last_known_pos=None,
|
||||
act_counter=0,
|
||||
can_split=(kind == "Green Slime"),
|
||||
)
|
||||
Reference in new issue
Block a user