fix(combat): separate standard attack (single swing) from full attack (iteratives)
This commit is contained in:
@@ -1202,3 +1202,37 @@ def test_withdraw_provokes_after_first_square() -> None:
|
||||
"round 1 foe2: wait",
|
||||
"battle over: draw after 1 rounds",
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Standard attack (single swing, no iteratives — PF1e standard action) #
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
def _move_then_attack(
|
||||
engine: CombatEngine, state: CombatantState
|
||||
) -> tuple[Action, ...]:
|
||||
return (
|
||||
Action(kind="move", target_id="orc"),
|
||||
Action(kind="attack", target_id="orc"),
|
||||
)
|
||||
|
||||
|
||||
def test_move_attack_single_swing() -> None:
|
||||
"""move+attack gives ONE attack at highest BAB; move+full_attack gives iteratives."""
|
||||
gob = make_combatant("gob", hp=20, ac=15, attack_bonus=6, speed=30, initiative_mod=10)
|
||||
orc = make_combatant("orc", hp=20, ac=15, attack_bonus=1, speed=0)
|
||||
states = [make_state(gob, "players", (0, 0)), make_state(orc, "monsters", (3, 0))]
|
||||
engine = CombatEngine(
|
||||
ScriptedRng([20, 1, 10, 15, 3]),
|
||||
make_grid(), states, round_cap=1, policy=_move_then_attack,
|
||||
)
|
||||
result = engine.run()
|
||||
assert result.transcript == (
|
||||
"initiative: gob d20=20+10=30",
|
||||
"initiative: orc d20=1+0=1",
|
||||
"round 1 gob: move (0,0)->(1,0)->(2,0)",
|
||||
"round 1 gob: short sword vs orc d20=10+6=16 AC 15 -> HIT 15 damage (20->5)",
|
||||
"round 1 orc: short sword vs orc d20=3+1=4 AC 15 -> MISS",
|
||||
"battle over: draw after 1 rounds",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user