Track the damage Buffer's charges actually prevented #308
No reviewers
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens!308
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/buffer-damage-prevented"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Buffer is a Counter power with no per-application identity: every application merges into one
BufferPowerwith an integerAmount, so charges from the Buffer card and Lucky Tonic are indistinguishable at the power. Outcomes therefore go to the pooledPowerAggregate, matching Feel No Pain, Rupture, Free Attack, and Free Skill.What it records
BufferChargesGranted— positive applications to the tracked player. Sits ahead of the card-source requirement inRecordPowerReceived, because Lucky Tonic also grants Buffer with a null card source.BufferChargesUsed— only spends the power's own follow-up callback confirmed.BufferDamagePrevented— the drop acrossBufferPower.ModifyHpLostAfterOstyLate, which returns 0 for its owner. That is post-Block unblocked HP loss, not the attack's printed or intended damage.Charges that never fired are
granted - used; Buffer does not survive a combat, so that difference is exact at run level and needs no separate persisted field.Why the hook pair
Arm on the modifier, commit on
AfterModifyingHpLostAfterOsty. The arm is gated on the samedecimal.Truncate(before) != decimal.Truncate(after)testHook.ModifyHpLostuses to decide which modifiers get the follow-up call, so every armed prevention pairs with exactly one confirmed charge and a fully blocked or zero-damage hit burns none.The commit runs on the prefix, ahead of
PowerCmd.Decrement, which early-returns whileCombatManager.IsEnding. Waiting for the decrement would discard preventions that genuinely stopped HP loss in the killing-blow window.Hook.ModifyHpLostis called from exactly one place,CreatureCmd.Damage, so Buffer never touches card-cost or curse HP loss.Notes
POWER.BUFFER_POWER, the canonical runtime id, becauseTryGetByPowermatches onpower.Id.SchemaLoadingTestsassertions added for the new persisted fields;NotInDeckViewTestsregistry list updated.