diff --git a/.gitattributes b/.gitattributes index b47f12fb99c..798562a17fa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4134,6 +4134,7 @@ res/cardsfolder/thallid_germinator.txt -text svneol=native#text/plain res/cardsfolder/thallid_shell_dweller.txt -text svneol=native#text/plain res/cardsfolder/that_which_was_taken.txt -text svneol=native#text/plain res/cardsfolder/thaumatog.txt -text svneol=native#text/plain +res/cardsfolder/the_abyss.txt -text svneol=native#text/plain res/cardsfolder/the_hive.txt -text svneol=native#text/plain res/cardsfolder/the_lady_of_the_mountain.txt -text svneol=native#text/plain res/cardsfolder/the_rack.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/the_abyss.txt b/res/cardsfolder/the_abyss.txt new file mode 100644 index 00000000000..4780bb6b2a4 --- /dev/null +++ b/res/cardsfolder/the_abyss.txt @@ -0,0 +1,7 @@ +Name:The Abyss +ManaCost:3 B +Types:World Enchantment +Text:At the beginning of each player's upkeep, destroy target nonartifact creature that player controls of his or her choice. It can't be regenerated. +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/the_abyss.jpg +End diff --git a/src/forge/AllZoneUtil.java b/src/forge/AllZoneUtil.java index 5eaa8893760..c3cb02491d5 100644 --- a/src/forge/AllZoneUtil.java +++ b/src/forge/AllZoneUtil.java @@ -469,6 +469,12 @@ public class AllZoneUtil { } }; + public static CardListFilter nonartifacts = new CardListFilter() { + public boolean addCard(Card c) { + return !c.isArtifact(); + } + }; + public static CardListFilter lands = new CardListFilter() { public boolean addCard(Card c) { return c.isLand(); diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index e9129c264e3..bef698cd785 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -23,6 +23,7 @@ public class GameActionUtil { AllZone.GameAction.CheckWheneverKeyword(AllZone.CardFactory.HumanNullCard, "BeginningOfUpkeep", null); + upkeep_The_Abyss(); upkeep_Yawgmoth_Demon(); upkeep_Lord_of_the_Pit(); upkeep_Drop_of_Honey(); @@ -3384,6 +3385,66 @@ public class GameActionUtil { } } }//damageUpkeepCost + + private static void upkeep_The_Abyss() { + /* + * At the beginning of each player's upkeep, destroy target + * nonartifact creature that player controls of his or her + * choice. It can't be regenerated. + */ + final String player = AllZone.Phase.getActivePlayer(); + final CardList cards = AllZoneUtil.getCardsInPlay("The Abyss"); + + for(Card c:cards) { + final Card abyss = c; + + final Ability sacrificeCreature = new Ability(abyss, "") { + @Override + public void resolve() { + if(player.equals(Constant.Player.Human)) { + AllZone.InputControl.setInput( new Input() { + private static final long serialVersionUID = 4820011040853968644L; + public void showMessage() { + AllZone.Display.showMessage(abyss.getName()+" - Select one nonartifact creature to destroy"); + ButtonUtil.disableAll(); + } + public void selectCard(Card selected, PlayerZone zone) { + //probably need to restrict by controller also + if(selected.isCreature() && !selected.isArtifact() && zone.is(Constant.Zone.Play) + && zone.getPlayer().equals(Constant.Player.Human)) { + AllZone.GameAction.destroyNoRegeneration(selected); + stop(); + } + }//selectCard() + });//Input + } + else { //computer + CardList targets = abyss_getTargets(player); + CardList indestruct = targets.getKeyword("Indestructible"); + if(indestruct.size() > 0) { + AllZone.GameAction.destroyNoRegeneration(indestruct.get(0)); + } + else { + Card target = CardFactoryUtil.AI_getWorstCreature(targets); + if(null == target) { + //must be nothing valid to destroy + } + else AllZone.GameAction.destroyNoRegeneration(target); + } + } + }//resolve + };//sacrificeCreature + sacrificeCreature.setStackDescription(abyss.getName()+" - destroy a nonartifact creatur of your choice."); + if(abyss_getTargets(player).size() > 0) + AllZone.Stack.add(sacrificeCreature); + }//end for + }//The Abyss + + private static CardList abyss_getTargets(final String player) { + CardList creats = AllZoneUtil.getCreaturesInPlay(player); + creats = creats.filter(AllZoneUtil.nonartifacts); + return creats; + } private static void upkeep_Yawgmoth_Demon() { /*