Skip to content

fix(forge-game): set tokenSpawningAbility on Endure-created tokens#4

Merged
delebedev merged 1 commit intostablefrom
endure-token-spawning-ability
May 5, 2026
Merged

fix(forge-game): set tokenSpawningAbility on Endure-created tokens#4
delebedev merged 1 commit intostablefrom
endure-token-spawning-ability

Conversation

@delebedev
Copy link
Copy Markdown
Owner

Summary

EndureEffect creates its Spirit token via TokenInfo.getProtoType(...) directly but forgets to call result.setTokenSpawningAbility(sa) afterward. Every other token-creating effect in forge-game does this:

Class Location
TokenEffectBase.createTokenTable line 46
TokenEffectBase.makeTokenTableInternal line 59
AmassEffect.resolve line 69
CopyPermanentEffect.resolve line 308
ReplaceTokenEffect lines 82, 136

Card.tokenSpawningAbility is the canonical back-reference from a token to the SA that produced it. Engine resolution doesn't depend on it (Endure works fine in vanilla Forge today) — but any consumer that traces a token back to its source ability (replay tooling, custom GUIs, simulation harnesses) sees a null source for Endure tokens.

Change

One line, mirroring AmassEffect line 69:

```java
result.setTokenSpawningAbility(sa);
```

placed right after the token prototype is built and PT set.

Test plan

  • No behavioural change for vanilla Forge — Endure resolves identically (counters / token branches both fire as before).
  • `Card.tokenSpawningAbility` is now non-null on Endure-spawned tokens, consistent with Amass / generic token-creating effects.
  • No new test added — the fix is one missing line in a pattern that the rest of the codebase already follows; covered by existing token-effect smoke checks.

PATCHES.md

Added a new "Engine fixes" section noting this as a fork-local patch.

EndureEffect creates its Spirit token via TokenInfo.getProtoType(...) but
omits the result.setTokenSpawningAbility(sa) call that every other
token-creating effect in forge-game performs:

- TokenEffectBase.createTokenTable
- TokenEffectBase.makeTokenTableInternal
- AmassEffect.resolve
- CopyPermanentEffect.resolve
- ReplaceTokenEffect (replacement and creation paths)

Card.tokenSpawningAbility is the canonical back-reference from a token
to the SA that produced it. Engine resolution doesn't depend on it, but
any consumer that traces a token to its source ability (replay tooling,
custom GUIs, simulation harnesses) sees a null source for Endure tokens.

The fix mirrors AmassEffect line 69 — a single setTokenSpawningAbility(sa)
call right after the token prototype is built.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@delebedev delebedev merged commit 80eb9b4 into stable May 5, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant