magefree / magefree/mage

CreateTokenEffect needs to be refactored to allow creating multiple types of tokens in one CreateTokenEvent

Open
#10,811 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug refactoring
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Issue:
When multiple tokens of a different type are created such as by [[Trostani's Summoner]], they currently create multiple `CreateTokenEvent`s which cause problems with replacement effects such as [[Queen Allenal of Ruadach]] and [[Peregrin Took]] which add more additional tokens than they should.

Proposed solution:
- Create a `TokenBatch` or similar, which can contain a collection of `Token`s and `CreateTokenCopyTargetEffect`s (or something else that can specify "Create a token copy that's different" for [[Soul Separator]] support) which are then `putOntoTheBattlefield` in a single `CreateTokenEvent` which already supports creating a collection of tokens.
- Refactor `CreateTokenEffect` to take a `TokenBatch` instead of `Token`, retaining the `Token` constructors with a "encase the `Token` in a `TokenBatch`, then use the `TokenBatch` constructors" to reduce duplicated code rather than making a separate `CreateTokenBatchEffect` but not requiring every `CreateTokenEffect` to be rewritten.
- Rewrite (or initially write) the following cards (and possibly more) to use `TokenBatch`es to properly create all their multiple tokens in a single `CreateTokenEvent`:
Bestial Menace, Farmer Cotton, Fae Offering, Battle for Bretagard, Forbidden Friendship, Old Rutstein, Somberwald Beastmaster, Song of Earendil, probably Stangg Echo Warrior, Specimen Collector, ~~Soul Separator~~, The Eleventh Hour, Triplicate Titan, Trostani's Summoner, Wurmcoil Engine, Clone Legion, Elminster's Simulacrum, Hate Mirage, Hour of Eternity, Haunting Imitation, Kindred Charge, March of Progress, Mirror March, Mirror-Style Master, Parallel Evolution, Red Sun's Twilight, Rhys the Redeemed, Saheeli the Gifted, Second Harvest, Twinflame, Ocelot Pride

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing CreateTokenEffect and CreateTokenEvent, then inspect how the listed cards create multiple token types. Determine how a TokenBatch would preserve CreateTokenCopyTargetEffect behavior while putting all tokens onto the battlefield in one event. Done means the affected cards use the batch approach and replacement effects no longer overproduce tokens.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.