mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Modal Double Faces cards - fixed that it can be returned to battlefield as second side instead the main side only (#7212);
This commit is contained in:
parent
c20a75382f
commit
fde24f349f
2 changed files with 54 additions and 7 deletions
|
@ -452,9 +452,6 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
checkExileCount("exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1);
|
||||
|
||||
// return at the end
|
||||
showBattlefield("hmm b", 2, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
showExile("hmm e", 2, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
showGraveyard("hmm g", 2, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
checkPermanentCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1);
|
||||
checkExileCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 0);
|
||||
|
||||
|
@ -464,6 +461,46 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ExileAsSecondSideAndReturnAsMainSide() {
|
||||
// https://github.com/magefree/mage/issues/7212
|
||||
|
||||
// When Flickerwisp enters the battlefield, exile another target permanent. Return that card to the battlefield
|
||||
// under its owner’s control at the beginning of the next end step.
|
||||
addCard(Zone.HAND, playerA, "Flickerwisp"); // {1}{W}{W}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
//
|
||||
// Akoum Warrior {5}{R} - creature
|
||||
// Akoum Teeth - land
|
||||
addCard(Zone.HAND, playerA, "Akoum Warrior");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
|
||||
|
||||
// prepare mdf permanent as land
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth");
|
||||
checkPermanentCount("prepare", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 0);
|
||||
checkPermanentCount("prepare", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth", 1);
|
||||
|
||||
// exile
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flickerwisp");
|
||||
addTarget(playerA, "Akoum Teeth");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkPermanentCount("exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 0);
|
||||
checkPermanentCount("exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth", 0);
|
||||
checkExileCount("exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1); // exile as main card
|
||||
checkExileCount("exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth", 0);
|
||||
|
||||
// return at the end
|
||||
checkPermanentCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 1);
|
||||
checkPermanentCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth", 0);
|
||||
checkExileCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Warrior", 0);
|
||||
checkExileCount("return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Akoum Teeth", 0);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_ChooseName_AsCreature() {
|
||||
// rules:
|
||||
|
|
|
@ -77,11 +77,21 @@ public final class ZonesHandler {
|
|||
if (info.event.getToZone().equals(Zone.BATTLEFIELD)) {
|
||||
Card card = game.getCard(info.event.getTargetId());
|
||||
if (card instanceof ModalDoubleFacesCard || card instanceof ModalDoubleFacesCardHalf) {
|
||||
System.out.println("!"); // TODO: remove after mdf test fixes
|
||||
}
|
||||
boolean forceToMainSide = false;
|
||||
|
||||
if (card instanceof ModalDoubleFacesCard) {
|
||||
info.event.setTargetId(((ModalDoubleFacesCard) card).getLeftHalfCard().getId());
|
||||
// if effect put half mdf card to battlefield then it must be the main side only (example: return targeted half card to battle)
|
||||
if (card instanceof ModalDoubleFacesCardHalf && !source.getAbilityType().isPlayCardAbility()) {
|
||||
forceToMainSide = true;
|
||||
}
|
||||
|
||||
// if effect put mdf card to battlefield then it must be main side only
|
||||
if (card instanceof ModalDoubleFacesCard) {
|
||||
forceToMainSide = true;
|
||||
}
|
||||
|
||||
if (forceToMainSide) {
|
||||
info.event.setTargetId(((ModalDoubleFacesCard) card.getMainCard()).getLeftHalfCard().getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue