Prevent playing lands on NDFC backs

It should not be possible to play a land on the back of a nonmodal
(transforming) double-faced card from anywhere.
This commit is contained in:
matoro 2026-01-23 03:29:14 -05:00
parent 57ad5749a4
commit 220b87eaff
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,62 @@
package org.mage.test.cards.conditional.twofaced;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author matoro
*/
public class TwoFacedLandAllowedTest extends CardTestPlayerBase {
/**
* Tests that you are not allowed to play a land on the back of a transforming double-faced card.
*/
@Test
public void testTransformingNotAllowed() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Ojer Taq, Deepest Foundation");
checkPlayableAbility("Should not be able to play land", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Temple of Civilization", false);
setStopAt(1, PhaseStep.END_TURN);
execute();
}
/**
* Tests that you are still allowed to play a land on the back of a modal double-faced card.
*/
@Test
public void testModalAllowed() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Sink into Stupor");
checkPlayableAbility("Should be able to play land", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Soporific Springs", true);
setStopAt(1, PhaseStep.END_TURN);
execute();
}
/**
* Tests that you are still allowed to play a land on the front of a transforming double-faced card.
*/
@Test
public void testTransformingFront() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Balamb Garden, SeeD Academy");
checkPlayableAbility("Should be able to play land", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Balamb Garden, SeeD Academy", true);
setStopAt(1, PhaseStep.END_TURN);
execute();
}
/**
* Tests that you can still transform a nonmodal double-faced card with a land on the back.
*/
@Test
public void testActivateTransformationAllowed() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Tarrian's Journal");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, {T}, Discard your hand: Transform {this}.");
setStopAt(1, PhaseStep.END_TURN);
execute();
checkPermanentCount("Successfully transformed", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Tomb of Aclazotz", 1);
}
}

View file

@ -1,6 +1,9 @@
package mage.cards;
import mage.ObjectColor;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.PlayLandAbility;
import mage.abilities.SpellAbility;
import mage.constants.*;
import mage.game.Game;
@ -46,4 +49,16 @@ public class TransformingDoubleFacedCardHalf extends DoubleFacedCardHalf {
public TransformingDoubleFacedCard getParentCard() {
return (TransformingDoubleFacedCard) parentCard;
}
@Override
public Abilities<Ability> getAbilities() {
final Abilities<Ability> all = super.getAbilities();
// lands on the back of transforming double-faced cards should not be playable
if (this.isBackSide()) {
all.removeIf(ability -> ability instanceof PlayLandAbility);
}
return all;
}
}