Added test for Nissa, Sage Animist -7 ability.

This commit is contained in:
LevelX2 2020-01-06 12:58:50 +01:00
parent 30b13d2d0c
commit e565863bd2
3 changed files with 83 additions and 53 deletions

View file

@ -48,7 +48,7 @@ public final class NissaSageAnimist extends CardImpl {
// -7: Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands.
Ability ability = new LoyaltyAbility(new UntapTargetEffect(), -7);
ability.addTarget(new TargetLandPermanent(0, 6, StaticFilters.FILTER_LANDS, false));
ability.addTarget(new TargetLandPermanent(0, 6, StaticFilters.FILTER_LAND, false));
ability.addEffect(new NissaSageAnimistMinusAnimateEffect());
this.addAbility(ability);
}
@ -127,54 +127,4 @@ class NissaSageAnimistMinusAnimateEffect extends OneShotEffect {
}
return true;
}
// class NissaSageAnimistMinusSevenEffect extends ContinuousEffectImpl {
//
// NissaSageAnimistMinusSevenEffect() {
// super(Duration.EndOfGame, Outcome.BecomeCreature);
// this.staticText = "They become 6/6 Elemental creatures. They're still lands";
// }
//
// NissaSageAnimistMinusSevenEffect(final NissaSageAnimistMinusSevenEffect effect) {
// super(effect);
// }
//
// @Override
// public NissaSageAnimistMinusSevenEffect copy() {
// return new NissaSageAnimistMinusSevenEffect(this);
// }
//
// @Override
// public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
// for (UUID permanentId : this.getTargetPointer().getTargets(game, source)) {
// Permanent permanent = game.getPermanent(permanentId);
// if (permanent != null) {
// switch (layer) {
// case TypeChangingEffects_4:
// permanent.addCardType(CardType.CREATURE);
// if (!permanent.hasSubtype(SubType.ELEMENTAL, game)) {
// permanent.getSubtype(game).add(SubType.ELEMENTAL);
// }
// break;
// case PTChangingEffects_7:
// if (sublayer == SubLayer.SetPT_7b) {
// permanent.getToughness().setValue(6);
// permanent.getPower().setValue(6);
// }
// }
// }
// }
// return true;
// }
//
// @Override
// public boolean apply(Game game, Ability source) {
// return false;
// }
//
// @Override
// public boolean hasLayer(Layer layer) {
// return layer == Layer.TypeChangingEffects_4 || layer == Layer.PTChangingEffects_7;
// }
// }
}

View file

@ -0,0 +1,80 @@
package org.mage.test.cards.planeswalker;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class NissaVastwoodSeerTest extends CardTestPlayerBase {
// https://github.com/magefree/mage/issues/5677
/*
EDH again, I'm playing Nissa, Vastwood Seer as my commander.
I got her to 7 loyalty, used her -7 to untap lands and make them into creatures. So far so good.
Nissa died, went back to command zone, lands stayed as creatures (as they should).
Next turn I replay Nissa, but the moment I try to cast another spell (or activate an ability,
maybe it was directly on replaying her, can't remember exactly), all my 6 creature lands are back to being regular lands.
A few turns later, my opponent uses overloaded cyclonic rift, which also bounces Nissa to my hand.
Not entirely sure, but I believe it again took at least until priority got passed for my lands to reappear,
maybe even until I tried to activate an ability or cast something.
This was not a 1 time thing either.
After replaying Nissa (again) and casting another card, my creature lands went back to being regular lands again.
Later I used her -2 to kill her, which (after putting another spell on the stack) got me my creature lands back again.
*/
@Test
public void NissaVastwoodSeerAnimationTest() {
setStrictChooseMode(true);
addCard(Zone.LIBRARY, playerA, "Forest");
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.
// Nissa, Sage Animist
// +1: Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand.
// -2: Create a legendary 4/4 green Elemental creature token named Ashaya, the Awoken World.
// -7: Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands.
addCard(Zone.HAND, playerA, "Nissa, Vastwood Seer");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nissa, Vastwood Seer");
setChoice(playerA, "Yes");
addTarget(playerA, "Forest");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "+1: Reveal");
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "+1: Reveal");
activateAbility(5, PhaseStep.POSTCOMBAT_MAIN, playerA, "+1: Reveal");
activateAbility(7, PhaseStep.POSTCOMBAT_MAIN, playerA, "+1: Reveal");
activateAbility(9, PhaseStep.POSTCOMBAT_MAIN, playerA, "-7: Untap up to six target");
addTarget(playerA, "Forest^Forest^Forest^Forest^Forest^Forest");
setStopAt(9, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Nissa, Vastwood Seer", 0);
assertPermanentCount(playerA, "Nissa, Sage Animist", 0);
assertGraveyardCount(playerA, "Nissa, Vastwood Seer", 1);
assertPermanentCount(playerA, "Swamp", 1);
assertType("Forest", CardType.CREATURE, SubType.ELEMENTAL);
assertPermanentCount(playerA, "Forest", 6);
assertPowerToughness(playerA, "Forest", 6, 6, Filter.ComparisonScope.All);
}
}

View file

@ -73,9 +73,9 @@ public class TargetCardInLibrary extends TargetCard {
}
cards.sort(Comparator.comparing(MageObject::getName));
Cards cardsId = new CardsImpl();
for (Card card : cards) {
cards.forEach((card) -> {
cardsId.add(card);
}
});
while (!isChosen() && !doneChosing()) {
if (!player.canRespond()) {