mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Add test for flickering Animate Dead
This commit is contained in:
parent
01ee54d416
commit
5b2e848065
4 changed files with 78 additions and 2 deletions
|
@ -31,6 +31,10 @@ public final class AnimateDead extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.PutCreatureInPlay));
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// When Animate Dead enters the battlefield, if it's on the battlefield, it loses "enchant creature
|
||||
// card in a graveyard" and gains "enchant creature put onto the battlefield with Animate Dead."
|
||||
// Return enchanted creature card to the battlefield under your control and attach Animate Dead
|
||||
// to it. When Animate Dead leaves the battlefield, that creature's controller sacrifices it.
|
||||
this.addAbility(new AnimateDeadTriggeredAbility());
|
||||
|
||||
// Enchanted creature gets -1/-0.
|
||||
|
|
|
@ -44,6 +44,10 @@ public final class DanceOfTheDead extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.PutCreatureInPlay));
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// When Dance of the Dead enters the battlefield, if it's on the battlefield, it loses "enchant creature
|
||||
// card in a graveyard" and gains "enchant creature put onto the battlefield with Dance of the Dead."
|
||||
// Put enchanted creature card onto the battlefield tapped under your control and attach Dance of the Dead
|
||||
// to it. When Dance of the Dead leaves the battlefield, that creature's controller sacrifices it.
|
||||
this.addAbility(new AnimateDeadTriggeredAbility(false, true));
|
||||
|
||||
// Enchanted creature gets +1/+1 and doesn't untap during its controller's untap step.
|
||||
|
|
|
@ -20,15 +20,20 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class Necromancy extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card in a graveyard");
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from a graveyard");
|
||||
|
||||
public Necromancy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
|
||||
|
||||
// You may cast Necromancy as though it had flash. If you cast it any time a sorcery couldn't have been cast, the controller of the permanent it becomes sacrifices it at the beginning of the next cleanup step.
|
||||
// You may cast Necromancy as though it had flash. If you cast it any time a sorcery couldn't have been cast,
|
||||
// the controller of the permanent it becomes sacrifices it at the beginning of the next cleanup step.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastAsThoughItHadFlashSourceEffect(Duration.EndOfGame)));
|
||||
this.addAbility(new SacrificeIfCastAtInstantTimeTriggeredAbility());
|
||||
|
||||
// When Necromancy enters the battlefield, if it's on the battlefield, it becomes an Aura with
|
||||
// "enchant creature put onto the battlefield with Necromancy." Put target creature card from
|
||||
// a graveyard onto the battlefield under your control and attach Necromancy to it. When Necromancy
|
||||
// leaves the battlefield, that creature's controller sacrifices it.
|
||||
Ability ability = new AnimateDeadTriggeredAbility(true);
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -217,4 +217,67 @@ public class AnimateDeadTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Blackbloom Rogue", 1, 3);
|
||||
assertPermanentCount(playerA, "Animate Dead", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flickering Animate Dead, resolving enters trigger first
|
||||
* https://github.com/magefree/mage/issues/5250
|
||||
*/
|
||||
@Test
|
||||
public void testFlickerAnimateDeadEnterTriggerFirst() {
|
||||
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.GRAVEYARD, playerA, "Walking Corpse");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.HAND, playerA, "Animate Dead");
|
||||
addCard(Zone.HAND, playerA, "Flicker of Fate");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Flicker of Fate", "Animate Dead");
|
||||
setChoice(playerA, "Walking Corpse"); // card to attach reentering aura to
|
||||
setChoice(playerA, "When {this} leaves"); // resolve leaves trigger last
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Animate Dead", 1);
|
||||
assertPermanentCount(playerA, "Walking Corpse", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||
assertGraveyardCount(playerA, "Walking Corpse", 0);
|
||||
assertGraveyardCount(playerA, "Flicker of Fate", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flickering Animate Dead, resolving leaves trigger first
|
||||
*/
|
||||
@Test
|
||||
public void testFlickerAnimateDeadLeaveTriggerFirst() {
|
||||
addCard(Zone.GRAVEYARD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.GRAVEYARD, playerA, "Walking Corpse");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.HAND, playerA, "Animate Dead");
|
||||
addCard(Zone.HAND, playerA, "Flicker of Fate");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Silvercoat Lion");
|
||||
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Flicker of Fate", "Animate Dead");
|
||||
setChoice(playerA, "Walking Corpse"); // card to attach reentering aura to
|
||||
setChoice(playerA, "When {this} enters"); // resolve enters trigger last
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Animate Dead", 1);
|
||||
assertPermanentCount(playerA, "Walking Corpse", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||
assertGraveyardCount(playerA, "Walking Corpse", 0);
|
||||
assertGraveyardCount(playerA, "Flicker of Fate", 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue