(Underdepths): First pass

This commit is contained in:
AlexKucera committed 2026-08-12 15:48:41 +02:00
1 parent 7c9699a7eb
commit da780bd75f
31 files changed
+3554

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
from __future__ import annotations
from dataclasses import dataclass
from entities.entity import Entity
@dataclass(slots=True)
class Enemy(Entity):
hp: int
max_hp: int
power: int
armor: int
accuracy: int
evasion: int
crit_chance: float
speed: int
behavior: str
xp_reward: int
last_known_position: tuple[int, int] | None = None
ranged_power: int = 0
has_split: bool = False
+16
View File
@@ -0,0 +1,16 @@
from __future__ import annotations
from dataclasses import dataclass
@dataclass(slots=True)
class Entity:
x: int
y: int
glyph: str
color: tuple[int, int, int]
name: str
@property
def position(self) -> tuple[int, int]:
return self.x, self.y
+18
View File
@@ -0,0 +1,18 @@
from __future__ import annotations
from dataclasses import dataclass
from entities.entity import Entity
@dataclass(slots=True)
class Item(Entity):
category: str
power_bonus: int = 0
armor_bonus: int = 0
crit_bonus: float = 0.0
evasion_bonus: float = 0.0
effect: str = ""
amount: int = 0
duration: int = 0
radius: int = 0
+56
View File
@@ -0,0 +1,56 @@
from __future__ import annotations
from dataclasses import dataclass, field
from data.constants import (
PLAYER_ACCURACY,
PLAYER_ARMOR,
PLAYER_COLOR,
PLAYER_CRIT_CHANCE,
PLAYER_EVASION,
PLAYER_GLYPH,
PLAYER_MAX_HP,
PLAYER_POWER,
PLAYER_SPEED,
)
from entities.entity import Entity
from entities.item import Item
@dataclass(slots=True)
class Player(Entity):
hp: int
max_hp: int
power: int
armor: int
accuracy: int
evasion: int
crit_chance: float
speed: int
level: int
xp: int
inventory: list[Item] = field(default_factory=list)
weapon: Item | None = None
armor_item: Item | None = None
strength_turns: int = 0
invisibility_turns: int = 0
def create_player(x: int, y: int) -> Player:
return Player(
x=x,
y=y,
glyph=PLAYER_GLYPH,
color=PLAYER_COLOR,
name="You",
hp=PLAYER_MAX_HP,
max_hp=PLAYER_MAX_HP,
power=PLAYER_POWER,
armor=PLAYER_ARMOR,
accuracy=PLAYER_ACCURACY,
evasion=PLAYER_EVASION,
crit_chance=PLAYER_CRIT_CHANCE,
speed=PLAYER_SPEED,
level=1,
xp=0,
)