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:
2026-09-19 17:02:21 +02:00
parent 7fefce4653
commit 0ad627c97c
4 changed files with 72 additions and 1 deletions
+18
View File
@@ -89,6 +89,24 @@ def test_bleed_to_death_ends_battle() -> None:
assert any("a: bleed 5 (hp -8->-13)" in line for line in eng._transcript)
def test_bleed_tick_records_damage_taken() -> None:
"""Attrition (README "dégâts subis"): bleed is damage - the tick lands in
damage_taken with no attributed dealer (no attack source)."""
eng = _engine(
[_combatant("a"), _combatant("b")],
[(0, 0), (0, 1)],
["players", "monsters"],
[],
)
a, _b = eng._states
a.bleed_damage = 2
eng._apply_bleed_damage(a)
assert a.hp == 98
assert eng._stats["a"].damage_taken == 2
assert eng._stats["a"].damage_dealt == 0
assert eng._stats["b"].damage_taken == 0
def test_heal_spell_clears_bleed() -> None:
eng = _engine(
[_combatant("a"), _combatant("b")],