Skip to content

Dev menu improvements: "Add Token to Battlefield" + search + quantity select#9748

Open
MostCromulent wants to merge 4 commits intoCard-Forge:masterfrom
MostCromulent:devmenu
Open

Dev menu improvements: "Add Token to Battlefield" + search + quantity select#9748
MostCromulent wants to merge 4 commits intoCard-Forge:masterfrom
MostCromulent:devmenu

Conversation

@MostCromulent
Copy link
Contributor

Screenshot 2026-02-14 172821 Screenshot 2026-02-14 172838 Screenshot 2026-02-14 180209 Screenshot 2026-02-14 180223

3 additions to dev menu functionality to make it easier to work with tokens:


Add Token to Battlefield: Adds a new "Add Token to Battlefield" option to the dev panel, wired through the same CDev/VDev/DevModeMenu/IDevModeCheats pattern as existing cheats. Tokens are deduplicated by name and lazy-loaded from TokenDb on first use. Creature tokens prompt for summoning sickness (or auto-set it for tokens with haste).

Quantity selector for card additions: The existing "Add Card to Zone" dev cheats (hand, battlefield, library, graveyard, exile) now prompt for a quantity after selecting a card, allowing multiple copies to be added at once. Prompts that depend on the card (summoning sickness, top/bottom of library) are asked once and reused for all copies. The entire quantity loop runs within a single invoke() call to avoid race conditions from concurrent zone modifications.

ListChooser search field: Adds an inline search/filter text field to the ListChooser dialog for lists with more than 25 items, matching the existing mobile ListChooser behavior. Search results prioritize starts-with matches (sorted by name length for closer matches first), followed by contains matches.

This has broader application than just the dev menu, but there are few dialogs that often have more than 25 entries so in practice this is only likely to affect:
- Dev menu card/token selection (10,000+ card faces, 1,000+ tokens)
- Card naming during gameplay (e.g. Pithing Needle, Cabal Therapy — all legal card names)

In any event this aligns with list functionality in mobile, and is probably a QOL improvement anyway.


🤖 Generated with Claude Code

…menu option

- Add inline search field to ListChooser for lists >25 items with
  starts-with-first priority sorting by name length for closer matches
- Add "Add Token to Battlefield" dev menu option with quantity selector
  and summoning sickness prompt
- Fix race condition in card/token quantity loops by wrapping in single
  invoke() call instead of per-iteration invoke()
- Clean up manual search/filter code in PlayerControllerHuman

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hanmac
Copy link
Contributor

Hanmac commented Feb 14, 2026

probably need to add PT to the Name select if its not a named token
(not ending with "Token")

Show power/toughness in brackets for all tokens in the "Add Token to
Battlefield" chooser. Deduplication key now includes P/T so tokens with
the same name but different stats (e.g. 16 Elemental Token variants)
appear as separate entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dracontes
Copy link
Contributor

dracontes commented Feb 16, 2026

I have to say, the search field on the "Add Card to [Zone]" prompt has been on my personal wishlist for a fair bit. Tested out that part of this PR and it works as well as I'd want and expect 👍

I did test the "Add Token to Battlefield" part and searching for either named or game-defined noncreature tokens turns up this, which I don't think is at all the expected behavior.

image

Also I think "Name the token" at the top of the prompt would be more apt.

ETA: And perhaps have the token search ignore dungeon cards.

image

- Filter out dungeon cards from token list
- Show P/T using string values (fixes */* displaying as 0/0)
- Include color in display to distinguish same-named tokens
- Only append oracle text when needed to disambiguate tokens
  that share the same name, color, and P/T
- Rename dialog title from "Name the card" to "Name the token"
- Fix potential NPE when token has no color defined

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MostCromulent
Copy link
Contributor Author

I did test the "Add Token to Battlefield" part and searching for either named or game-defined noncreature tokens turns up this, which I don't think is at all the expected behavior.

Also I think "Name the token" at the top of the prompt would be more apt.

ETA: And perhaps have the token search ignore dungeon cards.

All 3 issues addressed on latest commit (code was previously trying to assign power/toughness to non-creature tokens).

Also improved the de-duplication logic so it doesn't collapse same-named creature tokens into one entry if they have different colors or different abilities. Will now disambiguate same-name tokens by P/T, color and, if necessary, oracle text.

Screenshot 2026-02-16 190752 Screenshot 2026-02-16 190806

Only apply oracle-text disambiguation to generic tokens (names ending
in " Token"). Named tokens are unique by definition and don't need it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dracontes
Copy link
Contributor

All 3 issues addressed on latest commit (code was previously trying to assign power/toughness to non-creature tokens).

These issues have been adequately addressed.

Also improved the de-duplication logic so it doesn't collapse same-named creature tokens into one entry if they have different colors or different abilities. Will now disambiguate same-name tokens by P/T, color and, if necessary, oracle text.

I was going to ask about this, so good show on it for the most part. I did notice that while the \tokenscripts folder shows two Pest tokens, to wit, those produced by Nuisance Engine and the Strixhaven ones, the prompt search only turns up the latter.

image

@Jetz72
Copy link
Contributor

Jetz72 commented Feb 16, 2026

Any thoughts on adding this to the mobile/adventure UI's dev menu as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants