magefree / magefree/mage

Permanents vs. Tokens vs Cards rework discussion

Open
#11,482 4 comments 0 reactions 0 assignees View on GitHub
Developers Discussion
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

I'm still figuring out the exact details, but I'd like to see if others agree with this as a good direction for a rework.

When I refer to `Card/Token` I'm referring to a new class which would be similar to the current `Token` class, used to represent the current base characteristics for a `Permanent`, while still inheriting from `CardImpl`.

The idea is to make `Permanent`s store a `Set` representing the physical cards that the permanent would become if it moves to a different zone, with the actual Permanent inheriting from `Card/Token` for the characteristics that the permanent has. Tokens would then be a `Permanent` with an empty `Set` of cards, plus a boolean on the characteristics `Card/Token`. If a card would be moved onto the battlefield, it would instead create a new `Permanent` with copied characteristics, and the card itself stored as the only object in the `Permanent`'s `Set`.

`Spell` would also need a separation from the `Card/Token` it will become and the (optional) `Card` it's storing - the latter would *not* be copied when the `Spell` is copied by a game effect (it would be copied if the entire game state is being copied)


This could also allow simpler implementations of abilities like Bestow, Prototype, and Transform. Those abilities could make changes to the characteristics `Card/Token` on the permanent rather than needing to set up continuous effects and then be accounted for separately if the permanent is copied. It would also standardize Meld to use the same basic mechanics as all card movement - the rework would require all move actions to properly handle any number of cards in the held `Set`.

This rework would help clear up the majority of issues with implementing Mutate. It would handle the stacking of many cards into a single permanent using the same code as Meld. Removing the distinction between tokens and permanents means that Mutate changing a token into a nontoken is also not the problem it could be currently.

This shares some ideas with #10972 but is notably different: that proposal would require Permanents to not be Cards at all. While I think that could be a nice change it would require even more drastic reworks to properly separate everything.

Since this would be a major rework, I'd like opinions on if I should continue work in this direction or not before I spend too much time trying to figure out the exact details of everything involved and then implementing it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.