Skip to content

[WIP] Group identical permanents into numbered stacks#9751

Draft
MostCromulent wants to merge 7 commits intoCard-Forge:masterfrom
MostCromulent:tokengroup
Draft

[WIP] Group identical permanents into numbered stacks#9751
MostCromulent wants to merge 7 commits intoCard-Forge:masterfrom
MostCromulent:tokengroup

Conversation

@MostCromulent
Copy link
Contributor

@MostCromulent MostCromulent commented Feb 14, 2026

WORK IN PROGRESS!

This is a preliminary and not-at-all-bug-free implementation of numbered creature/token stacking to make large board states more manageable.

Any group of identical permanents larger than 4 can be automatically grouped into a numbered stack - rather than rendering every card only 4 will render and the rest will be counted in a badge on in the top-left corner. Grouping operates for the purpose of UI rendering only - as far as the engine is concerned all of the grouped creatures/tokens/etc are still processed individually.

Click on the badge number to declare the entire group, click on an individual card to split it off and declare one-by-one.

Welcome any testing or feedback from others.


Screenshot 2026-02-14 232046 Untitled

Summary

  • Adds a new "Group Identical Permanents" setting with three modes: Off, Tokens & Creatures, and All Permanents
  • Groups identical cards into compressed stacks with a count badge (×N) when 5+ are present, showing up to 4 cards visually with extras hidden behind the stack
  • Individual cards can be split from groups by clicking them (e.g. to declare individual attackers), and re-merged by clicking again
  • Shift-click or clicking the number badge selects the entire group at once (e.g. to declare all as attackers/blockers)
  • Blockers assigned to different attackers are kept in separate groups so combat assignments remain visually clear
  • Accessible in-game via Game menu → Group Identical Permanents, with immediate live toggle

Details

Grouping criteria — cards group only when they share the same name and have matching state (counters, P/T, summoning sickness, cloned status, and when grouping is enabled: tapped state, damage, rules text).

Combat interaction — during attacker declaration, splitting a card from a group declares it as an attacker. Split attackers regroup with each other. When the last card in a group is declared as an attacker, it merges with the existing attacker group. Un-clicking a split attacker un-declares and re-merges it. During blocker declaration, blockers assigned to different attackers remain in separate visual groups.


🤖 Generated with Claude Code

MostCromulent and others added 4 commits February 14, 2026 14:54
Visually groups identical permanents into stacks with count badges.
Groups of 5+ show a ×N badge; clicking it selects all for batch
attack/block. Configurable via Game > Card Overlays menu with three
modes: Off, Tokens & Creatures, All Permanents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
isBadgeHit() was comparing container-relative mouse coordinates against
panel-internal badge coordinates, so the hit test always failed. Use
getCardX()/getCardY() to convert to the correct coordinate space.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation UX

- Group blockers by which attacker they're assigned to block (separate piles per attacker)
- Split cards from groups for attacker/blocker declaration with proper regrouping
- Only allow splitting cards the game accepts (skip summoning-sick creatures)
- Cards regroup with other tapped attackers after declaration via deferred layout
- Move Group Permanents menu from Card Overlays submenu to Game menu
- Group Permanents menu immediately refreshes the play area layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lower the split threshold from 5 to 2 when grouping is enabled, so
cards can be individually split from groups that have dropped below 5.
Mark solo cards as split when declared as attackers so they merge with
other split attackers from the same group. Track un-split state to
prevent re-adding cards to splitCardIds when un-declaring attackers.

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

Looks cool! Does it interfere or replace this?

image

@MostCromulent
Copy link
Contributor Author

Does it interfere or replace this?

It respects the token row preference (i.e. it will group both creatures and tokens but place them in separate rows).

It overrides the existing stack preference if its enabled, since it's kind of built on top of it. The preferences could probably be integrated together since they are doing a similar sort of thing, so you end up with a "Group and Stack Permanents" option with:

  • Off: default behaviour without the existing stack preference.
  • Stack: existing stack preference (no grouping).
  • Group creatures/tokens: new functionality.
  • Group all permanents: new functionality.

Is the "group" vs "stack" naming intuitive? When I think of a "stack" I think more along the lines of what this PR does where it puts everything in one big pile than what the existing stack preference does, but I don't want to go and re-label existing functionality since people are used to it.

Replace separate "Stack Creatures" checkbox and "Group Permanents" submenu
with a single "Stack/Group Permanents" submenu offering four options:
Default, Stack Creatures, Group Creatures/Tokens, Group All Permanents.
Add "Tokens in Separate Row" checkbox. All options include descriptive
tooltips and trigger immediate layout updates. PlayArea now derives all
layout flags from the single UI_GROUP_PERMANENTS preference.

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

I note current default behavior with the existing "stack creatures" preference turned on is that creatures + enchantments + artifacts are in stacks of 4, while lands + tokens are in stacks of 5.

Is there a reason for that difference?

If we integrate the stack/group functions together should we replace with a default stack size of 5 for everything, or should we flow this on and maintain the 4 vs 5 stack size for the new grouping function as well?

Right-clicking the count badge on a group of 5+ identical permanents
now prompts for how many to select, then declares that many as
attackers/blockers and splits them into a separate visual pile.

- Add manual constructor to MouseTriggerEvent for synthetic triggers
- Gate prompt on active input (getActivateDescription) to prevent
  showing during opponent's turn
- Skip selectCard for already-declared cards to avoid toggling them off
- Clear stale splitCardIds before marking selected subset to ensure
  correct visual separation after repeated split/merge cycles

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

You can now right-click the number badge and it will prompt how many creatures/tokens from the pile you want to declare, rather than needing to click them individually.

Screenshot 2026-02-15 101856 Screenshot 2026-02-15 101909

Right-click badge on a group of all-attackers/blockers now undeclares N
cards (button=3 trigger) instead of doing a visual-only split. Prompt
text adapts to game phase: "declare as attackers", "assign as blockers",
or "remove from combat".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tool4ever tool4ever added QOL Quality of Life Desktop labels Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Desktop QOL Quality of Life

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants