diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/AftermathTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/AftermathTest.java new file mode 100644 index 00000000000..50d999743b6 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/AftermathTest.java @@ -0,0 +1,31 @@ +package org.mage.test.cards.abilities.keywords; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author jeffwadsworth + */ +public class AftermathTest extends CardTestPlayerBase { + + @Test + public void testCastFromGraveyard() { + addCard(Zone.GRAVEYARD, playerA, "Spring // Mind", 1); + /* + Aftermath (Cast this spell only from your graveyard. Then exile it.) + Draw two cards. + */ + addCard(Zone.BATTLEFIELD, playerA, "Island", 6); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mind"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertExileCount(playerA, "Spring // Mind", 1); // card is exiled after casting from graveyard + assertHandCount(playerA, 2); // two cards drawn + + } +} diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 977bb9dac93..a0723b0ba5f 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1342,11 +1342,7 @@ public abstract class PlayerImpl implements Player, Serializable { } } } - UUID sourceId = object.getId(); - if (object instanceof SplitCardHalf) { - sourceId = ((SplitCardHalf) object).getParentCard().getId(); - } - if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, playerId, game)) { + if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) { for (Ability ability : candidateAbilites) { if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) { ability.setControllerId(this.getId());