- Aftermath keyword works again. Added test for Aftermath keyword.

This commit is contained in:
Achilles 2018-01-12 23:58:38 -06:00
parent a0bd835e34
commit 7ade17595d
2 changed files with 32 additions and 5 deletions

View file

@ -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
}
}

View file

@ -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());