mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
[ZNR] Fixed MDF cards with put to battlefield effects (#7174)
This commit is contained in:
parent
ac98417532
commit
cff67085b7
3 changed files with 80 additions and 0 deletions
|
@ -492,4 +492,61 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Single_GlasspoolMimic_NormalPlay() {
|
||||
// https://github.com/magefree/mage/issues/7174
|
||||
|
||||
// Glasspool Mimic
|
||||
// You may have Glasspool Mimic enter the battlefield as a copy of a creature you control, except it’s a Shapeshifter Rogue in addition to its other types.
|
||||
addCard(Zone.HAND, playerA, "Glasspool Mimic"); // {2}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
|
||||
|
||||
// cast and make copy of bear
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Glasspool Mimic");
|
||||
setChoice(playerA, "Yes"); // as copy
|
||||
setChoice(playerA, "Balduvian Bears"); // copy of
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Balduvian Bears", 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Single_GlasspoolMimic_FromNonHand() {
|
||||
// https://github.com/magefree/mage/issues/7174
|
||||
|
||||
// Glasspool Mimic
|
||||
// You may have Glasspool Mimic enter the battlefield as a copy of a creature you control, except it’s a Shapeshifter Rogue in addition to its other types.
|
||||
addCard(Zone.HAND, playerA, "Glasspool Mimic"); // {2}{U}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
|
||||
//
|
||||
// Aether Vial
|
||||
// {T}: You may put a creature card with converted mana cost equal to the number of charge counters on Aether Vial from your hand onto the battlefield.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Aether Vial", 1);
|
||||
|
||||
// prepare charge counters
|
||||
setChoice(playerA, "Yes"); // +1 charge on turn 1
|
||||
setChoice(playerA, "Yes"); // +1 charge on turn 3
|
||||
setChoice(playerA, "Yes"); // +1 charge on turn 5
|
||||
|
||||
// put card from hand to battlefield
|
||||
activateAbility(5, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: You may put a creature card");
|
||||
setChoice(playerA, "Yes"); // put card
|
||||
setChoice(playerA, "Glasspool Mimic"); // select card with cmc 3 from hand
|
||||
//
|
||||
setChoice(playerA, "Yes"); // put to battlefield as copy
|
||||
setChoice(playerA, "Balduvian Bears"); // copy of
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(5, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Balduvian Bears", 2);
|
||||
}
|
||||
}
|
|
@ -64,6 +64,23 @@ public final class ZonesHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// process Modal Double Faces cards (e.g. put card from hand)
|
||||
// rules:
|
||||
// If an effect puts a double-faced card onto the battlefield, it enters with its front face up.
|
||||
// If that front face can’t be put onto the battlefield, it doesn’t enter the battlefield.
|
||||
// For example, if an effect exiles Sejiri Glacier and returns it to the battlefield,
|
||||
// it remains in exile because an instant can’t be put onto the battlefield.
|
||||
for (ListIterator<ZoneChangeInfo> itr = zoneChangeInfos.listIterator(); itr.hasNext(); ) {
|
||||
ZoneChangeInfo info = itr.next();
|
||||
if (info.event.getToZone().equals(Zone.BATTLEFIELD)) {
|
||||
Card card = game.getCard(info.event.getTargetId());
|
||||
if (card instanceof ModalDoubleFacesCard) {
|
||||
info.event.setTargetId(((ModalDoubleFacesCard) card).getLeftHalfCard().getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zoneChangeInfos.removeIf(zoneChangeInfo -> !maybeRemoveFromSourceZone(zoneChangeInfo, game));
|
||||
int createOrder = 0;
|
||||
for (ZoneChangeInfo zoneChangeInfo : zoneChangeInfos) {
|
||||
|
@ -243,6 +260,7 @@ public final class ZonesHandler {
|
|||
meld.updateZoneChangeCounter(game, unmelded.subInfo.get(unmelded.subInfo.size() - 1).event);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle all normal cases
|
||||
ZoneChangeEvent event = info.event;
|
||||
Card card = getTargetCard(game, event.getTargetId());
|
||||
|
@ -272,6 +290,7 @@ public final class ZonesHandler {
|
|||
if (card instanceof MeldCard) {
|
||||
permanent = new PermanentMeld(card, event.getPlayerId(), game);
|
||||
} else if (card instanceof ModalDoubleFacesCard) {
|
||||
// main mdf card must be processed before that call (e.g. only halfes can be moved to battlefield)
|
||||
throw new IllegalStateException("Unexpected trying of move mdf card to battlefield instead half");
|
||||
} else if (card instanceof Permanent) {
|
||||
throw new IllegalStateException("Unexpected trying of move permanent to battlefield instead card");
|
||||
|
|
|
@ -464,6 +464,10 @@ public class GameEvent implements Serializable {
|
|||
return targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(UUID targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public UUID getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue