From fe2eec6553a7862094efcda9d7968129cc0d94cf Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 17 Feb 2018 11:54:57 +0100 Subject: [PATCH] * Fixed a problem with Animate Dead and bringing creatures with triggered abilities into play that had no targets. It was related to manipulating spellAbility and not copying spellAbility correctly during states copies. (related to #4428). --- Mage.Sets/src/mage/cards/a/AnimateDead.java | 2 +- .../org/mage/test/cards/copy/IsochronScepterTest.java | 10 +++++----- Mage/src/main/java/mage/cards/CardImpl.java | 10 +++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AnimateDead.java b/Mage.Sets/src/mage/cards/a/AnimateDead.java index 4c57bb51d26..a6e9ad0b75d 100644 --- a/Mage.Sets/src/mage/cards/a/AnimateDead.java +++ b/Mage.Sets/src/mage/cards/a/AnimateDead.java @@ -100,7 +100,7 @@ class AnimateDeadReAttachEffect extends OneShotEffect { public AnimateDeadReAttachEffect() { super(Outcome.Benefit); - this.staticText = "Return enchanted creature card to the battlefield under your control and attach {this} to it"; + this.staticText = "return enchanted creature card to the battlefield under your control and attach {this} to it"; } public AnimateDeadReAttachEffect(final AnimateDeadReAttachEffect effect) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/IsochronScepterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/IsochronScepterTest.java index 83697190404..b695a681ac4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/IsochronScepterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/IsochronScepterTest.java @@ -118,11 +118,11 @@ public class IsochronScepterTest extends CardTestPlayerBase { public void testAngelsGrace() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); addCard(Zone.HAND, playerA, "Isochron Scepter"); + // Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.) // You can't lose the game this turn and your opponents can't win the game this turn. // Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead. - - addCard(Zone.HAND, playerA, "Angel's Grace"); + addCard(Zone.HAND, playerA, "Angel's Grace"); // Instant {W} addCard(Zone.BATTLEFIELD, playerB, "Dross Crocodile", 4);// 5/1 addCard(Zone.HAND, playerB, "Lightning Bolt", 2); @@ -149,9 +149,6 @@ public class IsochronScepterTest extends CardTestPlayerBase { setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); - assertExileCount("Angel's Grace", 1); - assertGraveyardCount(playerA, "Angel's Grace", 0); - assertLife(playerA, 1); assertLife(playerB, 20); @@ -160,6 +157,9 @@ public class IsochronScepterTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Dross Crocodile", 3); assertPermanentCount(playerA, "Isochron Scepter", 1); + assertExileCount("Angel's Grace", 1); + assertGraveyardCount(playerA, "Angel's Grace", 0); + } /** diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index d73dd8e6bba..f82868e628b 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -29,7 +29,6 @@ package mage.cards; import java.lang.reflect.Constructor; import java.util.*; - import mage.MageObject; import mage.MageObjectImpl; import mage.Mana; @@ -165,6 +164,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card { secondSideCardClazz = card.secondSideCardClazz; nightCard = card.nightCard; } + if (card.spellAbility != null) { + spellAbility = card.getSpellAbility().copy(); + } else { + spellAbility = null; + } + flipCard = card.flipCard; flipCardName = card.flipCardName; splitCard = card.splitCard; @@ -177,6 +182,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card { this.objectId = UUID.randomUUID(); this.abilities.newOriginalId(); this.abilities.setSourceId(objectId); + if (this.spellAbility != null) { + this.spellAbility.setSourceId(objectId); + } } public static Card createCard(String name, CardSetInfo setInfo) {