From 2c1c455f1526cc9d8ed3e94f7cdf843793c504ea Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 14:42:13 +0000 Subject: [PATCH] add Doomsday Specter (from Planeshift) --- .gitattributes | 1 + res/cardsfolder/doomsday_specter.txt | 11 +++++++ src/forge/CardFactory_Creatures.java | 43 ++++++++++++++++++++++++- src/forge/GameActionUtil.java | 47 ++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 res/cardsfolder/doomsday_specter.txt diff --git a/.gitattributes b/.gitattributes index 486936fb1f5..5c17ea2397e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1337,6 +1337,7 @@ res/cardsfolder/donate.txt -text svneol=native#text/plain res/cardsfolder/doom_blade.txt -text svneol=native#text/plain res/cardsfolder/doomed_necromancer.txt -text svneol=native#text/plain res/cardsfolder/doomsday.txt -text svneol=native#text/plain +res/cardsfolder/doomsday_specter.txt -text svneol=native#text/plain res/cardsfolder/door_to_nothingness.txt -text svneol=native#text/plain res/cardsfolder/doran_the_siege_tower.txt -text svneol=native#text/plain res/cardsfolder/dosans_oldest_chant.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/doomsday_specter.txt b/res/cardsfolder/doomsday_specter.txt new file mode 100644 index 00000000000..dafb31ee3f6 --- /dev/null +++ b/res/cardsfolder/doomsday_specter.txt @@ -0,0 +1,11 @@ +Name:Doomsday Specter +ManaCost:2 U B +Types:Creature Specter +Text:When CARDNAME enters the battlefield, return a blue or black creature you control to its owner's hand.\r\n\r\nWhenever CARDNAME deals combat damage to a player, look at that player's hand and choose a card from it. The player discards that card. +PT:2/3 +K:Flying +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/doomsday_specter.jpg +SetInfo:PLS|Rare|http://magiccards.info/scans/en/ps/103.jpg +End \ No newline at end of file diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 649f5aea855..8cb9357eab1 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -7738,7 +7738,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** else if(cardName.equals("Cavern Harpy")) { final SpellAbility a1 = new Ability(card, "0") { @@ -7826,6 +7825,48 @@ public class CardFactory_Creatures { a1.setStackDescription(sb.toString()); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Doomsday Specter")) { + final SpellAbility ability = new Ability(card, "0") { + @Override + public void resolve() { + Card c = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c)) { + AllZone.GameAction.moveToHand(c); + } + } + }; + Command intoPlay = new Command() { + private static final long serialVersionUID = -1944407110865125254L; + + public void execute() { + CardList creatures = AllZoneUtil.getCreaturesInPlay(card.getController()); + creatures = creatures.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.isBlue() || c.isBlack(); + } + }); + + AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, creatures, + "Select blue or black creature you control.", false, false)); + ButtonUtil.disableAll(); + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) { + private static final long serialVersionUID = -1885027663323697759L; + + @Override + public boolean canPlayAI() { + return false; + } + }); + }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if(cardName.equals("Nemata, Grove Guardian")) { diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 914a60faa0e..6c968c1cbc1 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -6064,6 +6064,7 @@ public class GameActionUtil { else if(c.getName().equals("Treva, the Renewer")) playerCombatDamage_Treva(c); else if(c.getName().equals("Rith, the Awakener")) playerCombatDamage_Rith(c); else if(c.getName().equals("Vorosh, the Hunter")) playerCombatDamage_Vorosh(c); + else if(c.getName().equals("Doomsday Specter")) opponent_Discard_Card_You_Choose(c); //Unused variable //c.setDealtCombatDmgToOppThisTurn(true); @@ -6772,6 +6773,52 @@ public class GameActionUtil { } } + private static void opponent_Discard_Card_You_Choose(final Card source) { + final Player player = source.getController().getOpponent(); + + if(source.getNetAttack() > 0) { + SpellAbility ability = new Ability(source, "0") { + @Override + public void resolve() { + PlayerZone pzH = AllZone.getZone(Constant.Zone.Hand, player); + if(pzH.size() != 0) { + CardList dPHand = new CardList(pzH.getCards()); + CardList dPChHand = new CardList(dPHand.toArray()); + + if(source.getController().isComputer()){ + //hardcoded to 1, but if it needs to be changed... + for(int i = 0; i < 1; i++) { + if (dPChHand.size() > 0){ + Card c = CardFactoryUtil.AI_getMostExpensivePermanent(dPChHand, source, false); + AllZone.Display.getChoiceOptional("Computer has chosen", new Card[] {c}); + AllZone.HumanPlayer.discard(c, this); + } + } + } + else { + //human + AllZone.Display.getChoiceOptional("Revealed computer hand", dPHand.toArray()); + + //hardcode for 1, but if it needs to be expanded, it's here + for(int i = 0; i < 1; i++) { + if (dPChHand.size() > 0) { + Card dC = AllZone.Display.getChoice("Choose a card to be discarded", dPChHand.toArray()); + AllZone.ComputerPlayer.discard(dC, this); + } + } + } + } + } + };// ability + + StringBuilder sb = new StringBuilder(); + sb.append(source.getName()).append(" - ").append(player).append(" discards a card of opponent's choice."); + ability.setStackDescription(sb.toString()); + + AllZone.Stack.add(ability); + } + } + @SuppressWarnings("unused") // upkeep_CheckEmptyDeck_Lose private static void upkeep_CheckEmptyDeck_Lose() {