feat(combat): metamagic
This commit is contained in:
@@ -80,10 +80,12 @@ class DiceExpr(BaseModel):
|
||||
|
||||
def mean(self) -> float:
|
||||
"""Expected value: count * (sides + 1) / 2 + bonus."""
|
||||
if self.count == 0:
|
||||
return float(self.bonus)
|
||||
return self.count * (self.sides + 1) / 2 + self.bonus
|
||||
|
||||
def max_value(self) -> int:
|
||||
"""Maximum possible value: count * sides + bonus."""
|
||||
return self.count * self.sides + self.bonus
|
||||
|
||||
|
||||
def parse_dice(text: str) -> DiceExpr:
|
||||
"""Parse a dice notation string into a DiceExpr.
|
||||
|
||||
Reference in New Issue
Block a user