feat(combat): add concealment miss chance, sneak attack, and Precise Shot

This commit is contained in:
2026-09-10 10:22:50 +02:00
parent a1c43e83af
commit 97f4429c2b
7 changed files with 682 additions and 40 deletions
+11 -1
View File
@@ -32,6 +32,10 @@ class Rng(Protocol):
"""Return roll_die(20)."""
...
def d100(self) -> int:
"""Return roll_die(100)."""
...
def choice_index(self, n: int) -> int:
"""Return a uniform integer in 0..n-1 for deterministic tie-breaks."""
...
@@ -49,6 +53,9 @@ class SeededRng:
def d20(self) -> int:
return self.roll_die(20)
def d100(self) -> int:
return self.roll_die(100)
def choice_index(self, n: int) -> int:
return self._rng.randrange(n)
@@ -56,7 +63,7 @@ class SeededRng:
class ScriptedRng:
"""Rng that pops predetermined values from a queue.
Each call to roll_die, d20, or choice_index consumes one value.
Each call to roll_die, d20, d100, or choice_index consumes one value.
Raises RngExhaustedError when the queue is empty.
"""
@@ -71,6 +78,9 @@ class ScriptedRng:
def d20(self) -> int:
return self.roll_die(20)
def d100(self) -> int:
return self.roll_die(100)
def choice_index(self, _n: int) -> int:
if not self._queue:
raise RngExhaustedError(_EXHAUSTED_MSG)