* Reality Scramble - fix that the last matching card is put onto the battlefield instead of the first matching card (fixes #5290).

This commit is contained in:
Quercitron 2018-09-01 15:06:12 +03:00
parent a0776d7b66
commit 470fd4c75a
2 changed files with 38 additions and 1 deletions

View file

@ -38,7 +38,9 @@ public final class RealityScramble extends CardImpl {
public RealityScramble(UUID ownerId, CardSetInfo setInfo) { public RealityScramble(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}{R}");
// Put target permanent you own on the bottom of your library. Reveal cards from the top of your library until you reveal a card that shares a card type with that permanent. Put that card onto the battlefield and the rest on the bottom of your library in a random order. // Put target permanent you own on the bottom of your library. Reveal cards from the top of your library
// until you reveal a card that shares a card type with that permanent. Put that card onto the battlefield
// and the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new RealityScrambleEffect()); this.getSpellAbility().addEffect(new RealityScrambleEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addTarget(new TargetPermanent(filter));
@ -99,6 +101,9 @@ class RealityScrambleEffect extends OneShotEffect {
break; break;
} }
} }
if (cardToPlay != null) {
break;
}
} }
controller.revealCards(source, toReveal, game); controller.revealCards(source, toReveal, game);
if (cardToPlay != null) { if (cardToPlay != null) {

View file

@ -0,0 +1,32 @@
package org.mage.test.cards.single.c18;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author Quercitron
*/
public class RealityScrambleTest extends CardTestPlayerBase {
@Test
public void testFirstCardIsCast() {
// Put target permanent you own on the bottom of your library. Reveal cards from the top of your library until
// you reveal a card that shares a card type with that permanent. Put that card onto the battlefield and
// the rest on the bottom of your library in a random order.
addCard(Zone.HAND, playerA, "Reality Scramble");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.LIBRARY, playerA, "Storm Crow");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reality Scramble", "Grizzly Bears");
execute();
assertPermanentCount(playerA, "Grizzly Bears", 0);
assertPermanentCount(playerA, "Storm Crow", 1);
}
}