Attribute Buffer charges to the card or potion that granted them #310
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!310
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/buffer-charge-ledger"
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 merges every application into one Counter power, so the first pass (#308) pooled all outcomes onto the power aggregate. That was the wrong precedent.
Free Attack and Free Skill pool because Unrelenting and Pounce are their only sources, so pooling costs them nothing. Buffer has two — the Buffer card and Lucky Tonic — which makes the right analogues
PlayerBlockLedgerand the Poison ownership ledger, both multi-contributor and both already solved with a contributor ledger documented as heuristic.Buffer is also more determinate than block, not less: charges are discrete, so a spend consumes exactly one ledger unit rather than an arbitrary slice of a fungible pool.
The ledger
PendingCombat.PlayerBufferLedgerholds aBufferChargeChunkper application with its owning card instance or potion sequence. A confirmed spend pops one charge oldest-first and credits that chunk''s owner with the prevented HP.cardSourcefor the card; a newLuckyTonic.OnUseframe for the potion, which applies Buffer with a null card source and previously had no way to be told apart from the card.Surfaces
CardAggregategains per-card charges granted/used and HP loss prevented; rows sit alongside the existing per-card block rows.PotionRunHistoryEntrygains the same three. Lucky Tonic had no Buffer rows at all before this — everything it granted was displaying on the Buffer card.PowerAggregatestays as the power family total, the same layering as per-card block alongside the shared block pool.Tests
BufferChargeLedgerTestspins the FIFO invariant headlessly through aRunBufferLedgerForTestseam mirroringRunBlockLedgerForTest: oldest-first across mixed card/potion sources, two Buffer copies each owning only their own charges, unspent charges crediting no prevention, and spends past the end of the ledger crediting nobody.Fixture and
SchemaLoadingTestsassertions added for the new persisted fields, including that the pooled total stays greater than either contributor alone.Notes
LuckyTonic.OnUseis a newly introduced Harmony target, so potion attribution needs one full game restart before it resolves live — the same restart already pending for theBufferPowerhooks from #308.