* Added one more Morph test.

This commit is contained in:
LevelX2 2015-03-25 00:30:03 +01:00
parent 4b985b322f
commit f1b279d650
4 changed files with 48 additions and 9 deletions

View file

@ -57,7 +57,7 @@ public class GreenSunsZenith extends CardImpl {
public GreenSunsZenith(UUID ownerId) {
super(ownerId, 81, "Green Sun's Zenith", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{G}");
this.expansionSetCode = "MBS";
this.color.setGreen(true);
// Search your library for a green creature card with converted mana cost X or less,
// put it onto the battlefield, then shuffle your library.
// Shuffle Green Sun's Zenith into its owner's library.
@ -96,8 +96,7 @@ class GreenSunsZenithSearchEffect extends OneShotEffect {
int xValue = source.getManaCostsToPay().getX() + 1;
FilterCard filter = new FilterCard("green creature card with converted mana cost " + xValue + " or less");
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {

View file

@ -28,14 +28,13 @@
package mage.sets.morningtide;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.Mana;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
@ -48,7 +47,6 @@ import mage.target.common.TargetControlledCreaturePermanent;
*/
public class HeritageDruid extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Elves you control");
static {
@ -61,10 +59,12 @@ public class HeritageDruid extends CardImpl {
this.expansionSetCode = "MOR";
this.subtype.add("Elf");
this.subtype.add("Druid");
this.color.setGreen(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 3, 0, 0, 0, 0, 0), new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, false))));
// Tap three untapped Elves you control: Add {G}{G}{G} to your mana pool.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 3, 0, 0, 0, 0, 0), new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true))));
}
public HeritageDruid(final HeritageDruid card) {

View file

@ -27,9 +27,11 @@
*/
package org.mage.test.cards.abilities.keywords;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -430,4 +432,41 @@ public class MorphTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Akroma, Angel of Fury", 1);
}
/**
* Check if a face down Morph creature gets exiled, it will
* be face up in exile zone.
*/
@Test
public void testExileFaceDownCreature() {
addCard(Zone.HAND, playerA, "Birchlore Rangers", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.HAND, playerB, "Swords to Plowshares", 1);
addCard(Zone.BATTLEFIELD, playerB, "Plains", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Birchlore Rangers");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Swords to Plowshares", "face down creature");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 22); // + 2 from Swords to Plowshares
assertLife(playerB, 20);
assertGraveyardCount(playerB, "Swords to Plowshares", 1);
assertExileCount("Birchlore Rangers", 1);
for (Card card: currentGame.getExile().getAllCards(currentGame)) {
if (card.getName().equals("Birchlore Rangers")) {
Assert.assertEquals("Birchlore Rangers has to be face up in exile", false, card.isFaceDown(currentGame));
break;
}
}
}
}

View file

@ -48,6 +48,7 @@ public class TapTargetCost extends CostImpl {
public TapTargetCost(TargetControlledPermanent target) {
this.target = target;
this.target.setNotTarget(true); // costs are never targeted
this.text =
new StringBuilder("Tap ")
.append(target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") ? "":CardUtil.numberToText(target.getMaxNumberOfTargets()))