feat(models): combat resources

This commit is contained in:
ctan
2026-08-29 20:29:31 +02:00
parent 5c393ec66c
commit 53aa3567f2
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -180,9 +180,18 @@ class CombatantState:
# New duration-tracked fields
active_buffs: list[ActiveBuff] = field(default_factory=list)
active_conditions: list[ActiveCondition] = field(default_factory=list)
resources_left: dict[str, int] = field(default_factory=dict)
moved_this_turn: bool = False
power_attack: bool = False
def spend_resource(self, name: str, n: int = 1) -> bool:
"""Spend n points of a resource. Returns True if successful, False if insufficient."""
current = self.resources_left.get(name, 0)
if current < n:
return False
self.resources_left[name] = current - n
return True
@property
def active(self) -> bool:
return self.hp > 0