* Fixed some problems with creation of tokens of target permanents (fixes #1244).

This commit is contained in:
LevelX2 2015-09-08 18:13:32 +02:00
parent 39cfbec82f
commit e37c9a6472
24 changed files with 383 additions and 130 deletions

View file

@ -38,28 +38,28 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class ArtisanOfFormsTest extends CardTestPlayerBase {
/**
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a target creature.
* If Cackling Counterpart later resolves, it should copy the creature that Artisan of Forms copies, not
* the Artisan itself.
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a
* target creature. If Cackling Counterpart later resolves, it should copy
* the creature that Artisan of Forms copies, not the Artisan itself.
*/
@Test
public void testCopyTriggeredByCracklingCounterpart() {
// Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability.
addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms");
addCard(Zone.HAND, playerA, "Artisan of Forms"); // {1}{U}
// {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control.
addCard(Zone.HAND, playerA, "Cackling Counterpart");
addCard(Zone.BATTLEFIELD, playerA, "Island",3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Artisan of Forms");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
@ -70,18 +70,18 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Silvercoat Lion", 1);
// 1 + 2 Silvercoat Lion at the end
assertPermanentCount(playerA, "Silvercoat Lion", 2);
for (Permanent permanent :currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
if (permanent.getName().equals("Silvercoat Lion")) {
Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size());
}
}
}
/**
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a target creature.
* If populate spell later resolves, it should copy the creature that Artisan of Forms copies, not
* the Artisan itself.
/**
* Targeting a Artisan of Forms triggers it Heroic ability. So it can copy a
* target creature. If populate spell later resolves, it should copy the
* creature that Artisan of Forms copies, not the Artisan itself.
*/
@Test
public void testCopyTriggeredByPopulate() {
@ -90,17 +90,17 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms");
// {1}{U}{U} Put a token onto the battlefield that's a copy of target creature you control.
addCard(Zone.HAND, playerA, "Cackling Counterpart");
addCard(Zone.BATTLEFIELD, playerA, "Island",3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Eyes in the Skies");
addCard(Zone.BATTLEFIELD, playerA, "Plains",4);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
addTarget(playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Eyes in the Skies");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Eyes in the Skies");
addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -113,12 +113,12 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Bird", 1);
// 3 Silvercoat Lion at the end
assertPermanentCount(playerA, "Silvercoat Lion", 3);
for (Permanent permanent :currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(playerA.getId())) {
if (permanent.getName().equals("Silvercoat Lion")) {
Assert.assertEquals("Creature has to have Cast + Heroic ability", 2, permanent.getAbilities().size());
}
}
}
}
}

View file

@ -94,4 +94,35 @@ public class FelhideSpiritbinderTest extends CardTestPlayerBase {
assertLife(playerB, 20);
}
@Test
public void testCopyATokenCreature() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.HAND, playerA, "Call of the Herd", 1);
// Inspired - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}.
// If you do, put a token onto the battlefield that's a copy of another target creature
// except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
addCard(Zone.BATTLEFIELD, playerB, "Felhide Spiritbinder", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Call of the Herd");
attack(2, playerB, "Felhide Spiritbinder");
setStopAt(4, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Elephant", 1);
assertPermanentCount(playerB, "Elephant", 1);
assertAbility(playerB, "Elephant", HasteAbility.getInstance(), true);
Permanent copiedTokenElephant = getPermanent("Elephant", playerB);
Assert.assertEquals("Elephant has Enchantment card type", true, copiedTokenElephant.getCardType().contains(CardType.ENCHANTMENT));
assertLife(playerA, 17);
assertLife(playerB, 20);
}
}

View file

@ -82,28 +82,27 @@ public class FlameshadowConjuringTest extends CardTestPlayerBase {
// Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, put a token onto the battlefield that's a copy of that creature.
// That token gains haste. Exile it at the beginning of the next end step.
addCard(Zone.BATTLEFIELD, playerA, "Flameshadow Conjuring", 1);
// Sacrifice a creature: Nantuko Husk gets +2/+2 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Nantuko Husk", 1);
// Deathtouch, lifelink
// When Wurmcoil Engine dies, put a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink onto the battlefield.
addCard(Zone.HAND, playerA, "Wurmcoil Engine", 1); // 6/6 - {6}
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
// Destroy target attacking creature.
addCard(Zone.HAND, playerB, "Kill Shot", 1); // {2}{U}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wurmcoil Engine");
setChoice(playerA, "Yes");
attack(1, playerA, "Wurmcoil Engine");
attack(1, playerA, "Nantuko Husk");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice a creature");
// addTarget(playerA, "Wurmcoil Engine[only copy]");
setChoice(playerA, "Wurmcoil Engine[only copy]");
castSpell(1, PhaseStep.END_COMBAT, playerB, "Kill Shot", "Wurmcoil Engine");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerB, "Kill Shot", 1);
assertPermanentCount(playerA, "Wurmcoil Engine", 1);
assertPowerToughness(playerA, "Nantuko Husk", 4, 4);
assertLife(playerB, 12);
assertLife(playerB, 14);
assertLife(playerA, 26);
assertPermanentCount(playerA, "Wurm", 2);