M2b: Block absorption attribution (effective / wasted block) #14
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#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
M2a (block gained) shipped — we track how much block each card contributed using
BlockGainedEntry.CardPlayfor direct attribution. That's the easy side of block.This issue tracks the hard side: which card's block actually absorbed incoming damage vs. got wasted at turn end?
Why it's hard
STS2 block is a pooled resource. When Defend adds 5 block and Warcry adds 3, the game just increments a single block counter to 8. When damage hits, it subtracts from the pool — no per-card tag telling us "2 of those 4 absorbed came from Defend".
Same issue for waste: at turn-end block decay, we don't know which card's contributions got zeroed out.
Proposed approach
Maintain a runtime block provenance list during combat:
List<(string cardInstanceId, int remainingAmount)>.BlockGainedEntrywithCardPlay: append(instanceId, amount)to the list.DamageReceivedEntrywhere receiver is the player: split theBlockedDamageamount across entries proportionally to theirremainingAmount, decrement each entry, drop entries that hit zero.Why proportional over FIFO/LIFO
The game doesn't actually use an order — the pool is flat. Proportional is the only split that's mathematically fair across cards with different contribution sizes. FIFO would make the first-applied Defend look disproportionately "effective" vs. a later-applied Warcry, which isn't real information.
New
CardAggregatefieldsTotalBlockEffective— block absorbed before expiring (HP actually saved by this card's block)TotalBlockWasted— block that expired at turn end without absorbing anythingDisplay
Once these are populated, the tooltip's block section becomes:
Same "whole number + %" layout as Overkill/Blocked on the damage side. Can share the 3-col table logic.
Open questions
CombatManagermust have a per-turn-end signal. Needs investigation.DamageReceivedEntry.Result.BlockedDamagefire for fully-blocked hits? (We saw earlier that the game might skip DamageReceivedEntry entirely for some edge cases.)Definition of done
Consolidating block-attribution tracking into #6 as of April 20, 2026 so the remaining M2 work lives in one place. Closing this as a duplicate/superseded issue after merging the useful implementation detail into #6.