fix(stats): non-attack damage now lands in damage_taken - bleed ticks, recurring spell damage (Acid Arrow) and cure-spells-damage-undead (SRD Cure Light Wounds negative-energy hit, attributed to the caster's damage_dealt) were invisible to attrition while attacks were counted; transcripts and RNG untouched
This commit is contained in:
@@ -78,3 +78,27 @@ class TestCureDamagesUndead:
|
||||
engine._cast_spell(c, t, "Cure Light Wounds")
|
||||
assert t.hp == 18
|
||||
assert any("+13 HP" in line for line in engine._transcript)
|
||||
|
||||
|
||||
class TestCureUndeadAttrition:
|
||||
"""Given: a cure spell delivered to an undead
|
||||
When: the negative-energy damage lands
|
||||
Then: it counts as damage in attrition (dealer + taker), while healing a
|
||||
living target records no damage either way."""
|
||||
|
||||
def test_undead_damage_recorded_for_both_sides(self) -> None:
|
||||
engine, c, t = _make_engine(
|
||||
_caster(), _undead(), [1, 8], target_pos=(1, 0), target_side="players"
|
||||
)
|
||||
engine._cast_spell(c, t, "Cure Light Wounds")
|
||||
assert engine._stats["skeleton"].damage_taken == 13
|
||||
assert engine._stats["caster"].damage_dealt == 13
|
||||
|
||||
def test_living_heal_records_no_damage(self) -> None:
|
||||
engine, c, t = _make_engine(
|
||||
_caster(), _make_target(), [1, 8], target_pos=(1, 0), target_side="players"
|
||||
)
|
||||
t.hp = 5
|
||||
engine._cast_spell(c, t, "Cure Light Wounds")
|
||||
assert engine._stats["caster"].damage_dealt == 0
|
||||
assert engine._stats["target"].damage_taken == 0
|
||||
|
||||
Reference in New Issue
Block a user