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 mudlib.object import Object
|
||||
|
||||
|
||||
@dataclass
|
||||
class Entity:
|
||||
"""Base class for anything with position and identity in the world."""
|
||||
class Entity(Object):
|
||||
"""Base class for anything with position and identity in the world.
|
||||
|
||||
name: str
|
||||
x: int
|
||||
y: int
|
||||
Inherits name, location from Object. Narrows x, y to int (entities
|
||||
always have spatial coordinates).
|
||||
"""
|
||||
|
||||
# Entities always have spatial coordinates (override Object's int | None)
|
||||
x: int = 0
|
||||
y: int = 0
|
||||
# Combat stats
|
||||
pl: float = 100.0 # power level (health and damage multiplier)
|
||||
stamina: float = 100.0 # current stamina
|
||||
|
|
|
|||
Loading…
Reference in a new issue