Pair forge generated with the forge that never got swung #346

Merged
nelsong6 merged 1 commit from claude/forge-counterpart into main 2026-10-17 09:53:06 -07:00
nelsong6 commented 2026-10-10 21:43:46 -07:00 (Migrated from github.com)

TotalForgeGenerated had no counterpart, and forge needs one more than most
stats do, because of what forge actually is. From the game's own docs:

AfterForge — runs after a player triggers a Forge effect, increasing the
damage of Sovereign Blade.

ForgeCmd.Forge mints a Sovereign Blade into hand on the first forge of a
combat, and every forge after it calls IncreaseSovereignBladeDamage. So forge
is per combat, it is not a spendable pool, and it only becomes damage if you
swing. A card that forges 9 across a fight you never swing in generated 9 forge
of nothing — and the generated total alone could not say so.

Approach

A third provenance ledger beside block and energy, with one simplification the
others do not get: a Blade's damage is its accumulated forge, so playing it
cashes in every outstanding chunk at once. There is no FIFO/LIFO question to
settle here. Combat end charges the remainder back to the cards that granted it,
newest-first.

Consumed at the card-play path, not from a damage observer. The swing can be
fully blocked, or land on a target already dying that emits no damage entry, and
the forge was spent either way. "Wasted" here means never swung, not swung for
nothing
— blocked and overkill are already their own stats.

A gap I'm stating rather than hiding

IncreaseSovereignBladeDamage adds the amount to every Blade including
exhausted ones. So forging after a Blade has been exhausted also buffs that dead
copy, which can never be swung. The new Blade minted by that same forge can be,
so the chunk counts as live and the duplicate buff is not counted as waste. It
produces no damage and no waste either way; if you'd rather it counted as waste,
that's a one-line change.

Surfaces

  • Card tooltip, full and compact: one Forge gained/wasted row (18/6.5,
    36%) rather than the two a pair would cost — the #330 convention.
  • Deck-view sort menu: Forge wasted under Cost.

Verification

  • forge-wasted-ledger-run.json, which also pins that the wasted half keeps the
    fractional shape the generated half has (forge is decimal-backed in the game's
    command path).
  • SchemaLoadingTests historical and resumable, plus an older-shape case
    proving a pre-ledger run keeps its generated total and reads zero wasted.
  • ForgeLedgerConservationTests: swung leaves nothing wasted, never-swung
    charges each card exactly its own grant, and fractional forge does not round.
  • Full suite: 2163 passed, 0 failed.

No new Harmony targets — both write points sit inside handlers that already run,
so hot reload was sufficient (439 classes patched, 0 failed).

Found while doing this

TotalStarsGenerated has the same gap. Stars are Regent's separate spendable
pool, so it's the direct analogue of the energy ledger in #331 rather than this
one. Not in here; worth adding to the audit list.

🤖 Generated with Claude Code

`TotalForgeGenerated` had no counterpart, and forge needs one more than most stats do, because of what forge actually is. From the game's own docs: > `AfterForge` — runs after a player triggers a Forge effect, increasing the > damage of Sovereign Blade. `ForgeCmd.Forge` mints a Sovereign Blade into hand on the **first** forge of a combat, and every forge after it calls `IncreaseSovereignBladeDamage`. So forge is per combat, it is not a spendable pool, and it only becomes damage if you swing. A card that forges 9 across a fight you never swing in generated 9 forge of nothing — and the generated total alone could not say so. ## Approach A third provenance ledger beside block and energy, with one simplification the others do not get: a Blade's damage **is** its accumulated forge, so playing it cashes in every outstanding chunk at once. There is no FIFO/LIFO question to settle here. Combat end charges the remainder back to the cards that granted it, newest-first. **Consumed at the card-play path, not from a damage observer.** The swing can be fully blocked, or land on a target already dying that emits no damage entry, and the forge was spent either way. "Wasted" here means *never swung*, not *swung for nothing* — blocked and overkill are already their own stats. ## A gap I'm stating rather than hiding `IncreaseSovereignBladeDamage` adds the amount to **every** Blade including exhausted ones. So forging after a Blade has been exhausted also buffs that dead copy, which can never be swung. The new Blade minted by that same forge can be, so the chunk counts as live and the duplicate buff is not counted as waste. It produces no damage and no waste either way; if you'd rather it counted as waste, that's a one-line change. ## Surfaces - Card tooltip, full and compact: one **Forge gained/wasted** row (`18/6.5`, `36%`) rather than the two a pair would cost — the #330 convention. - Deck-view sort menu: **Forge wasted** under Cost. ## Verification - `forge-wasted-ledger-run.json`, which also pins that the wasted half keeps the fractional shape the generated half has (forge is decimal-backed in the game's command path). - `SchemaLoadingTests` historical and resumable, plus an older-shape case proving a pre-ledger run keeps its generated total and reads zero wasted. - `ForgeLedgerConservationTests`: swung leaves nothing wasted, never-swung charges each card exactly its own grant, and fractional forge does not round. - Full suite: 2163 passed, 0 failed. No new Harmony targets — both write points sit inside handlers that already run, so hot reload was sufficient (439 classes patched, 0 failed). ## Found while doing this `TotalStarsGenerated` has the same gap. Stars are Regent's separate spendable pool, so it's the direct analogue of the energy ledger in #331 rather than this one. Not in here; worth adding to the audit list. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens!346
No description provided.