feat(combat): effect and condition durations
This commit is contained in:
@@ -20,6 +20,8 @@ from typing import TYPE_CHECKING, Literal
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterable
|
||||
|
||||
from pf1e_simulator.conditions import Condition
|
||||
|
||||
BonusType = Literal[
|
||||
"", # untyped — stacks with everything
|
||||
"dodge", # stacks with itself
|
||||
@@ -65,6 +67,40 @@ class StatModifier:
|
||||
weapon_filter: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ActiveBuff:
|
||||
"""A temporary buff with a remaining duration in rounds.
|
||||
|
||||
- ``modifiers``: the stat modifiers this buff provides.
|
||||
- ``rounds_left``: how many more rounds this buff lasts (decremented at
|
||||
the start of the affected creature's turn). When it reaches 0, the buff
|
||||
expires and is removed.
|
||||
- ``source``: a human-readable description of what created this buff
|
||||
(e.g. "spell: bull's strength", "charge", "class ability: inspire courage").
|
||||
"""
|
||||
|
||||
modifiers: tuple[StatModifier, ...]
|
||||
rounds_left: int
|
||||
source: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ActiveCondition:
|
||||
"""A temporary condition with a remaining duration in rounds.
|
||||
|
||||
- ``condition``: the Condition definition (modifiers + behavioral flags).
|
||||
- ``rounds_left``: how many more rounds this condition lasts (decremented at
|
||||
the start of the affected creature's turn). When it reaches 0, the condition
|
||||
expires and is removed.
|
||||
- ``source``: a human-readable description of what created this condition
|
||||
(e.g. "spell: hold person", "monster ability: fear aura").
|
||||
"""
|
||||
|
||||
condition: Condition
|
||||
rounds_left: int
|
||||
source: str
|
||||
|
||||
|
||||
def resolve_modifiers(modifiers: Iterable[StatModifier]) -> int:
|
||||
"""Sum stat modifiers applying PF1e stacking rules.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user