mirror of
https://github.com/correl/mage.git
synced 2025-04-11 17:00:08 -09:00
* Nissa, Sage Animist - Added test for +1 ability.
This commit is contained in:
parent
ae4580fadc
commit
819d341fbb
2 changed files with 23 additions and 11 deletions
Mage.Sets/src/mage/sets/magicorigins
Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords
|
@ -28,6 +28,7 @@
|
|||
package mage.sets.magicorigins;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -112,19 +113,18 @@ class NissaSageAnimistPlusOneEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
CardsImpl cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.revealCards("Nissa, Sage Animist", cards, game);
|
||||
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
|
||||
Zone targetZone = Zone.HAND;
|
||||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
return controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
|
||||
} else {
|
||||
return controller.moveCards(card, Zone.LIBRARY, Zone.HAND, source, game);
|
||||
targetZone = Zone.BATTLEFIELD;
|
||||
}
|
||||
return controller.moveCards(card, null, targetZone, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,23 +44,35 @@ public class TransformTest extends CardTestPlayerBase {
|
|||
|
||||
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.
|
||||
// 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.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");
|
||||
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();
|
||||
|
||||
assertPermanentCount(playerA, "Forest", 7);
|
||||
assertGraveyardCount(playerB, "Rootrunner", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Nissa, Vastwood Seer", 0);
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue