Make Entity inherit from Object
Entity gains location from Object and narrows x/y back to int (entities always have spatial coordinates). No behavioral change — all existing tests pass unchanged.
This commit is contained in:
parent
d9e9d1b785
commit
51dc583818
1 changed files with 11 additions and 5 deletions
|
|
@ -2,14 +2,20 @@
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
|
from mudlib.object import Object
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Entity:
|
class Entity(Object):
|
||||||
"""Base class for anything with position and identity in the world."""
|
"""Base class for anything with position and identity in the world.
|
||||||
|
|
||||||
name: str
|
Inherits name, location from Object. Narrows x, y to int (entities
|
||||||
x: int
|
always have spatial coordinates).
|
||||||
y: int
|
"""
|
||||||
|
|
||||||
|
# Entities always have spatial coordinates (override Object's int | None)
|
||||||
|
x: int = 0
|
||||||
|
y: int = 0
|
||||||
# Combat stats
|
# Combat stats
|
||||||
pl: float = 100.0 # power level (health and damage multiplier)
|
pl: float = 100.0 # power level (health and damage multiplier)
|
||||||
stamina: float = 100.0 # current stamina
|
stamina: float = 100.0 # current stamina
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue