* Nissa, Sage Animist - Added test for +1 ability.

This commit is contained in:
LevelX2 2015-10-09 14:55:39 +02:00
parent ae4580fadc
commit 819d341fbb
2 changed files with 23 additions and 11 deletions

View file

@ -28,6 +28,7 @@
package mage.sets.magicorigins; package mage.sets.magicorigins;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
@ -112,19 +113,18 @@ class NissaSageAnimistPlusOneEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.getLibrary().size() > 0) { MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && controller != null && controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().getFromTop(game); Card card = controller.getLibrary().getFromTop(game);
if (card == null) { if (card == null) {
return false; return false;
} }
CardsImpl cards = new CardsImpl(); controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
cards.add(card); Zone targetZone = Zone.HAND;
controller.revealCards("Nissa, Sage Animist", cards, game);
if (card.getCardType().contains(CardType.LAND)) { if (card.getCardType().contains(CardType.LAND)) {
return controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); targetZone = Zone.BATTLEFIELD;
} else {
return controller.moveCards(card, Zone.LIBRARY, Zone.HAND, source, game);
} }
return controller.moveCards(card, null, targetZone, source, game);
} }
return true; return true;
} }

View file

@ -44,23 +44,35 @@ public class TransformTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, "Forest"); addCard(Zone.LIBRARY, playerA, "Forest");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
// When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library. // When Nissa, Vastwood Seer enters the battlefield, you may search your library for a basic Forest card, reveal it, put it into your hand, then shuffle your library.
// Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control. // Whenever a land enters the battlefield under your control, if you control seven or more lands, exile Nissa, then return her to the battlefield transformed under her owner's control.
addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer"); addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer");
addCard(Zone.BATTLEFIELD, playerB, "Forest", 2);
// {G}{G}, Sacrifice Rootrunner: Put target land on top of its owner's library.
addCard(Zone.BATTLEFIELD, playerB, "Rootrunner"); // {2}{G}{G}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
setStopAt(1, PhaseStep.BEGIN_COMBAT); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "{G}{G}", "Swamp");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "+1: Reveal");
setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertPermanentCount(playerA, "Forest", 7); assertGraveyardCount(playerB, "Rootrunner", 1);
assertPermanentCount(playerA, "Nissa, Vastwood Seer", 0); assertPermanentCount(playerA, "Nissa, Vastwood Seer", 0);
assertPermanentCount(playerA, "Nissa, Sage Animist", 1); assertPermanentCount(playerA, "Nissa, Sage Animist", 1);
assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 3);
assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 4);
assertPermanentCount(playerA, "Forest", 6);
assertPermanentCount(playerA, "Swamp", 1);
} }
@Test @Test