From c6978d0774e0e96fbadab3c0e96adbad7e36fbe8 Mon Sep 17 00:00:00 2001 From: Sloth Date: Tue, 25 Oct 2011 09:26:56 +0000 Subject: [PATCH] - Added the keywords "If a card would be put into an opponent's graveyard from anywhere, exile it instead." and "If a card would be put into your graveyard from anywhere, exile it instead.". - Converted Leyline of the Void to script. --- res/cardsfolder/l/leyline_of_the_void.txt | 3 ++- src/main/java/forge/GameAction.java | 25 ++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/res/cardsfolder/l/leyline_of_the_void.txt b/res/cardsfolder/l/leyline_of_the_void.txt index e7fa87c16da..94c5b8b61f1 100644 --- a/res/cardsfolder/l/leyline_of_the_void.txt +++ b/res/cardsfolder/l/leyline_of_the_void.txt @@ -1,7 +1,8 @@ Name:Leyline of the Void ManaCost:2 B B Types:Enchantment -Text:If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield.\r\nIf a card would be put into an opponent's graveyard from anywhere, exile it instead. +Text:If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield. +K:If a card would be put into an opponent's graveyard from anywhere, exile it instead. SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_the_void.jpg diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java index c493754f216..a3edcba07b2 100644 --- a/src/main/java/forge/GameAction.java +++ b/src/main/java/forge/GameAction.java @@ -296,18 +296,29 @@ public class GameAction { */ public final Card moveToGraveyard(Card c) { final PlayerZone origZone = AllZone.getZoneOf(c); - final PlayerZone grave = c.getOwner().getZone(Constant.Zone.Graveyard); - - if (AllZoneUtil.isCardInPlay("Leyline of the Void", c.getOwner().getOpponent())) { - return moveTo(c.getOwner().getZone(Constant.Zone.Exile), c); - } + final Player owner = c.getOwner(); + final PlayerZone grave = owner.getZone(Constant.Zone.Graveyard); + final PlayerZone exile = owner.getZone(Constant.Zone.Exile); + final CardList ownerBoard = owner.getCardsIn(Constant.Zone.Battlefield); + final CardList opponentsBoard = owner.getOpponent().getCardsIn(Constant.Zone.Battlefield); + if (c.getName().equals("Nissa's Chosen") && origZone.is(Constant.Zone.Battlefield)) { return moveToLibrary(c, -1); } + + for(Card card : opponentsBoard) { + if(card.hasKeyword("If a card would be put into an opponent's graveyard from anywhere, exile it instead.")) + return moveTo(exile, c); + } + + for(Card card : ownerBoard) { + if(card.hasKeyword("If a card would be put into your graveyard from anywhere, exile it instead.")) + return moveTo(exile, c); + } if (c.hasKeyword("If CARDNAME would be put into a graveyard this turn, exile it instead.")) { - return moveTo(c.getOwner().getZone(Constant.Zone.Exile), c); + return moveTo(exile, c); } if (c.hasKeyword("If CARDNAME is put into a graveyard this turn, its controller gets a poison counter.")) { @@ -361,7 +372,7 @@ public class GameAction { boolean shouldRecoverForAI = false; boolean shouldRecoverForHuman = false; - if (c.getOwner().isHuman()) { + if (owner.isHuman()) { shouldRecoverForHuman = GameActionUtil.showYesNoDialog(recoverable, question.toString()); } else if (c.getOwner().isComputer()) { shouldRecoverForAI = ComputerUtil.canPayCost(abRecover);