magefree / magefree/mage

Rework meld cards to more robust implementation

Open
#14,982 0 comments 0 reactions 1 assignee Claimed by @Jmlundeen View on GitHub
refactoring
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

[Scryfall search for 7 pairs of meld cards](https://scryfall.com/search?q=o%3Ameld&unique=cards&as=grid&order=name)

Meld is currently implemented as a janky collection of brittle hacks. See issues #9642, #12084, #5103, and checks for `instanceof MeldCard` in effect code instead of consistent engine handling.

See #14061 and #14900 for examples that may be useful inspiration for a better approach.

> [712.4.](https://yawgatog.com/resources/magic-rules/#R7124) [Meld cards](https://yawgatog.com/resources/magic-rules/#meld_cards) have a Magic [card](https://yawgatog.com/resources/magic-rules/#card) face on one side and half of an oversized [card](https://yawgatog.com/resources/magic-rules/#card) face on the other.
[712.4a.](https://yawgatog.com/resources/magic-rules/#R7124a) One [card](https://yawgatog.com/resources/magic-rules/#card) in each [meld](https://yawgatog.com/resources/magic-rules/#meld) pair has an [ability](https://yawgatog.com/resources/magic-rules/#ability) that [exiles](https://yawgatog.com/resources/magic-rules/#exile) both that [object](https://yawgatog.com/resources/magic-rules/#object) and its counterpart and [melds](https://yawgatog.com/resources/magic-rules/#meld) them. To [meld](https://yawgatog.com/resources/magic-rules/#meld) the two [cards](https://yawgatog.com/resources/magic-rules/#card) in a [meld](https://yawgatog.com/resources/magic-rules/#meld) pair, put them onto the [battlefield](https://yawgatog.com/resources/magic-rules/#battlefield) with their back faces up and combined (see rule [701.42](https://yawgatog.com/resources/magic-rules/#R70142), "[Meld](https://yawgatog.com/resources/magic-rules/#meld)"). The resulting [permanent](https://yawgatog.com/resources/magic-rules/#permanent) is a single [object](https://yawgatog.com/resources/magic-rules/#object) represented by two [cards](https://yawgatog.com/resources/magic-rules/#card).
[712.4b.](https://yawgatog.com/resources/magic-rules/#R7124b) The back faces of a [meld](https://yawgatog.com/resources/magic-rules/#meld) pair are used only to determine the [characteristics](https://yawgatog.com/resources/magic-rules/#characteristics) of the melded [permanent](https://yawgatog.com/resources/magic-rules/#permanent) that pair [becomes](https://yawgatog.com/resources/magic-rules/#becomes) on the [battlefield](https://yawgatog.com/resources/magic-rules/#battlefield). If a rule or [effect](https://yawgatog.com/resources/magic-rules/#effect) references the back face of a [meld card](https://yawgatog.com/resources/magic-rules/#meld_cards) when not part of a melded [permanent](https://yawgatog.com/resources/magic-rules/#permanent) on the [battlefield](https://yawgatog.com/resources/magic-rules/#battlefield), it fails to determine its [characteristics](https://yawgatog.com/resources/magic-rules/#characteristics), regardless of which parts of the melded [permanent](https://yawgatog.com/resources/magic-rules/#permanent) is represented on that [card](https://yawgatog.com/resources/magic-rules/#card)'s back face.
[712.4c.](https://yawgatog.com/resources/magic-rules/#R7124c) Unlike other [double-faced cards](https://yawgatog.com/resources/magic-rules/#double-faced_cards), [meld cards](https://yawgatog.com/resources/magic-rules/#meld_cards) cannot be transformed or converted. Any instructions to do so are ignored.

> [701.42.](https://yawgatog.com/resources/magic-rules/#R70142) [Meld](https://yawgatog.com/resources/magic-rules/#meld)
[701.42a.](https://yawgatog.com/resources/magic-rules/#R70142a) [Meld](https://yawgatog.com/resources/magic-rules/#meld) is a [keyword action](https://yawgatog.com/resources/magic-rules/#keyword_action) that appears in an [ability](https://yawgatog.com/resources/magic-rules/#ability) on one [card](https://yawgatog.com/resources/magic-rules/#card) in a [meld](https://yawgatog.com/resources/magic-rules/#meld) pair. To [meld](https://yawgatog.com/resources/magic-rules/#meld) the two [cards](https://yawgatog.com/resources/magic-rules/#card) in a [meld](https://yawgatog.com/resources/magic-rules/#meld) pair, put them onto the [battlefield](https://yawgatog.com/resources/magic-rules/#battlefield) with their back faces up and combined. The resulting [permanent](https://yawgatog.com/resources/magic-rules/#permanent) is a single [object](https://yawgatog.com/resources/magic-rules/#object) represented by two [cards](https://yawgatog.com/resources/magic-rules/#card). See rule [712](https://yawgatog.com/resources/magic-rules/#R712), "[Double-Faced Cards](https://yawgatog.com/resources/magic-rules/#double-faced_cards)."
[701.42b.](https://yawgatog.com/resources/magic-rules/#R70142b) Only two [cards](https://yawgatog.com/resources/magic-rules/#card) belonging to the same [meld](https://yawgatog.com/resources/magic-rules/#meld) pair can be melded. [Tokens](https://yawgatog.com/resources/magic-rules/#token), [cards](https://yawgatog.com/resources/magic-rules/#card) that aren't [meld cards](https://yawgatog.com/resources/magic-rules/#meld_cards), or [meld cards](https://yawgatog.com/resources/magic-rules/#meld_cards) that don't form a [meld](https://yawgatog.com/resources/magic-rules/#meld) pair can't be melded.
[701.42c.](https://yawgatog.com/resources/magic-rules/#R70142c) If an [effect](https://yawgatog.com/resources/magic-rules/#effect) instructs a [player](https://yawgatog.com/resources/magic-rules/#player) to [meld](https://yawgatog.com/resources/magic-rules/#meld) [objects](https://yawgatog.com/resources/magic-rules/#object) that can't be melded, they stay in their current [zone](https://yawgatog.com/resources/magic-rules/#zone).
Example: A [player](https://yawgatog.com/resources/magic-rules/#player) owns and [controls](https://yawgatog.com/resources/magic-rules/#control_controller) Midnight Scavengers and a [token](https://yawgatog.com/resources/magic-rules/#token) that's a [copy](https://yawgatog.com/resources/magic-rules/#copy) of Graf Rats. At the beginning of combat, both are exiled but can't be melded. Midnight Scavengers remains exiled and the exiled [token](https://yawgatog.com/resources/magic-rules/#token) ceases to exist.

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.