mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[USG] Planar Void no longer triggers on tokens entering the graveyard. Closes #9071.
This commit is contained in:
parent
a2bcf7074e
commit
0a62d96238
2 changed files with 63 additions and 44 deletions
|
@ -1,15 +1,14 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -18,11 +17,16 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class PlanarVoid extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public PlanarVoid(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
|
||||
|
||||
// Whenever another card is put into a graveyard from anywhere, exile that card.
|
||||
this.addAbility(new PlanarVoidTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(new ExileTargetEffect(), false, filter, TargetController.ANY, SetTargetPointer.CARD));
|
||||
}
|
||||
|
||||
private PlanarVoid(final PlanarVoid card) {
|
||||
|
@ -34,40 +38,3 @@ public final class PlanarVoid extends CardImpl {
|
|||
return new PlanarVoid(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PlanarVoidTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
PlanarVoidTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ExileTargetEffect(), false);
|
||||
}
|
||||
|
||||
private PlanarVoidTriggeredAbility(final PlanarVoidTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanarVoidTriggeredAbility copy() {
|
||||
return new PlanarVoidTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() != Zone.GRAVEYARD
|
||||
|| event.getTargetId().equals(getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever another card is put into a graveyard from anywhere, exile that card.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package org.mage.test.cards.single.usg;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* {@link mage.cards.p.PlanarVoid Planar Void}
|
||||
* {B}
|
||||
* Enchantment
|
||||
* Whenever another card is put into a graveyard from anywhere, exile that card.
|
||||
*
|
||||
* @author Alex-Vasile
|
||||
*/
|
||||
public class PlanarVoidTest extends CardTestPlayerBase {
|
||||
private static final String planarVoid = "Planar Void";
|
||||
|
||||
/**
|
||||
* Test that it triggers for another card going to the graveyard.
|
||||
*/
|
||||
@Test
|
||||
public void triggersForOthers() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, planarVoid);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Silvercoat Lion");
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
assertExileCount(playerA, "Lightning Bolt", 1);
|
||||
assertExileCount(playerA, "Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that it doesn't trigger for itself
|
||||
*/
|
||||
@Test
|
||||
public void doesntTriggerForItself() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, planarVoid);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.HAND, playerA, "Allay"); // {1}{W}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Allay");
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
assertGraveyardCount(playerA, planarVoid, 1);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue