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, )