* Spark Double - fixed that copy of spark contains legendary type (#6097)

This commit is contained in:
Oleg Agafonov 2019-12-18 17:46:46 +04:00
parent fbff54145e
commit 23ef0e4269
7 changed files with 143 additions and 24 deletions

View file

@ -1,5 +1,9 @@
package org.mage.test.cards.copy;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.CardType;
import mage.constants.PhaseStep;
@ -7,6 +11,7 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@ -154,4 +159,91 @@ public class SparkDoubleTest extends CardTestPlayerBase {
Assert.assertEquals("must add 1 loyalty", 4 + 1, spark.getCounters(currentGame).getCount(CounterType.LOYALTY));
Assert.assertEquals("must add 1 creature counter", 1, spark.getCounters(currentGame).getCount(CounterType.P1P1));
}
@Test
public void test_CopyOfSparksCopy_BySpell() {
/*
Spark Double isnt legendary if it copies a legendary permanent, and this exception is copiable.
If something else copies Spark Double later, that copy also wont be legendary.
If you control two or more permanents with the same name but only one is legendary, the legend rule doesnt apply. (2019-05-03)
it's applier copy check
*/
//
addCard(Zone.HAND, playerA, "Spark Double"); // {3}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
//
addCard(Zone.BATTLEFIELD, playerA, "Akroma, Angel of Wrath", 1); // legendary
//
// Create a 1/1 white Bird creature token with flying, then populate. (Create a token thats a copy of a creature token you control.)
addCard(Zone.HAND, playerA, "Eyes in the Skies"); // {3}{W}
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
//
// Create a token thats a copy of target creature you control.
addCard(Zone.HAND, playerA, "Quasiduplicate"); // {1}{U}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// make copy of legendary creature (it's not legendary now)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spark Double");
setChoice(playerA, "Yes");
setChoice(playerA, "Akroma, Angel of Wrath");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 2);
// make copy of copy by CreateTokenCopyTargetEffect
showBattlefield("before last copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Quasiduplicate");
addTarget(playerA, "Akroma, Angel of Wrath[only copy]");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 3);
showBattlefield("after all", 1, PhaseStep.BEGIN_COMBAT, playerA);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertAllCommandsUsed();
}
@Test
public void test_CopyOfSparksCopy_ByAbility() {
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(), new ManaCostsImpl(""));
ability.addTarget(new TargetPermanent());
addCustomCardWithAbility("copy", playerA, ability);
addCard(Zone.HAND, playerA, "Spark Double"); // {3}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
//
addCard(Zone.BATTLEFIELD, playerA, "Akroma, Angel of Wrath", 1); // legendary
//
// Create a 1/1 white Bird creature token with flying, then populate. (Create a token thats a copy of a creature token you control.)
addCard(Zone.HAND, playerA, "Eyes in the Skies"); // {3}{W}
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
// make copy of legendary creature (it's not legendary now)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spark Double");
setChoice(playerA, "Yes");
setChoice(playerA, "Akroma, Angel of Wrath");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 2);
// make copy of copy by CreateTokenCopyTargetEffect
showBattlefield("before last copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
showAvaileableAbilities("before last copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "create a token that");
addTarget(playerA, "Akroma, Angel of Wrath[only copy]");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("must have copy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Wrath", 3);
showBattlefield("after all", 1, PhaseStep.BEGIN_COMBAT, playerA);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertAllCommandsUsed();
}
}

View file

@ -41,6 +41,7 @@ import mage.game.draft.Draft;
import mage.game.match.Match;
import mage.game.match.MatchPlayer;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.stack.StackObject;
import mage.game.tournament.Tournament;
import mage.player.ai.ComputerPlayer;
@ -886,11 +887,14 @@ public class TestPlayer implements Player {
System.out.println("Total permanents: " + cards.size());
List<String> data = cards.stream()
.map(c -> (c.getIdName()
+ " - " + c.getPower().getValue() + "/" + c.getToughness().getValue()
+ (c.isPlaneswalker() ? " - L" + c.getCounters(game).getCount(CounterType.LOYALTY) : "")
+ ", " + (c.isTapped() ? "Tapped" : "Untapped")
+ (c.getAttachedTo() == null ? "" : ", attached to " + game.getPermanent(c.getAttachedTo()).getIdName())
.map(c -> (
((c instanceof PermanentToken) ? "[T] " : "[C] ")
+ c.getIdName()
+ (c.isCopy() ? " [copy of " + c.getCopyFrom().getId().toString().substring(0, 3) + "]" : "")
+ " - " + c.getPower().getValue() + "/" + c.getToughness().getValue()
+ (c.isPlaneswalker() ? " - L" + c.getCounters(game).getCount(CounterType.LOYALTY) : "")
+ ", " + (c.isTapped() ? "Tapped" : "Untapped")
+ (c.getAttachedTo() == null ? "" : ", attached to " + game.getPermanent(c.getAttachedTo()).getIdName())
))
.sorted()
.collect(Collectors.toList());