From e9e56da03621f430d74ee293152c726e350bb6db Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:27:26 +0000 Subject: [PATCH] added a new Keyword: You may choose not to untap CARDNAME during your untap step. Human is asked, computer will not untap when it has the choice. (The assumption being cards with this kind of ability don't want to untap.) using this, added Rubinia Soulsinger (from Legends) --- res/card-pictures.txt | 1 + res/cards.txt | 19 ++---- src/forge/Card.java | 17 +++++ src/forge/CardFactory_Creatures.java | 95 ++++++++++++++++++++++++++++ src/forge/Input_Untap.java | 21 +++++- 5 files changed, 139 insertions(+), 14 deletions(-) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 084dbe6a29b..9ccfc836861 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +rubinia_soulsinger.jpg http://www.wizards.com/global/images/magic/general/rubinia_soulsinger.jpg festering_wound.jpg http://www.wizards.com/global/images/magic/general/festering_wound.jpg spirit_shackle.jpg http://www.wizards.com/global/images/magic/general/spirit_shackle.jpg curse_of_chains.jpg http://www.wizards.com/global/images/magic/general/curse_of_chains.jpg diff --git a/res/cards.txt b/res/cards.txt index 9b5f184e97a..8346c8333e6 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,10 @@ +Rubinia Soulsinger +2 G W U +Legendary Creature Faerie +tap: Gain control of target creature for as long as you control Rubinia and Rubinia remains tapped. +2/3 +You may choose not to untap CARDNAME during your untap step. + Cemetery Reaper 1 B B Creature Zombie @@ -63,18 +70,6 @@ Protection from colored spells Annihilator 6 When this card is put into a graveyard from anywhere, reveal this card and shuffle it into its owner's library instead. -Warp Artifact -B B -Enchantment Aura -At the beginning of the upkeep of enchanted artifact's controller, Warp Artifact deals 1 damage to that player. -Enchant Artifact Curse - -Feedback -2 U -Enchantment Aura -At the beginning of the upkeep of enchanted enchantment's controller, Feedback deals 1 damage to that player. -Enchant Enchantment Curse - Blight B B Enchantment Aura diff --git a/src/forge/Card.java b/src/forge/Card.java index 61765710e24..2ba98e78306 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -117,6 +117,8 @@ public class Card extends MyObservable { private ArrayList unEquipCommandList = new ArrayList(); private ArrayList enchantCommandList = new ArrayList(); private ArrayList unEnchantCommandList = new ArrayList(); + private ArrayList untapCommandList = new ArrayList(); + private ArrayList changeControllerCommandList = new ArrayList(); private ArrayList replaceMoveToGraveyardCommandList = new ArrayList(); private ArrayList cycleCommandList = new ArrayList(); @@ -817,6 +819,14 @@ public class Card extends MyObservable { var.execute(); } + public void addUntapCommand(Command c) { + untapCommandList.add(c); + } + + public void addChangeControllerCommand(Command c) { + changeControllerCommandList.add(c); + } + public ArrayList getReplaceMoveToGraveyard() { return replaceMoveToGraveyardCommandList; } @@ -966,6 +976,10 @@ public class Card extends MyObservable { } public void setController(String player) { + if( "" != controller && !controller.equals(player)) { + for(Command var:changeControllerCommandList) + var.execute(); + } controller = player; this.updateObservers(); } @@ -1349,6 +1363,9 @@ public class Card extends MyObservable { Ability_Reflected_Mana am = (Ability_Reflected_Mana) getManaAbility().get(0); am.reset(); } + for(Command var:untapCommandList) { + var.execute(); + } setTapped(false); } diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index e272246572d..972f637a5ed 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -18071,6 +18071,101 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Rubinia Soulsinger")) { + /* + * Tap: Gain control of target creature for as long as you + * control Rubinia and Rubinia remains tapped. + */ + final Card movedCreature[] = new Card[1]; + final Ability_Tap ability = new Ability_Tap(card, "0") { + private static final long serialVersionUID = 7018915669688488647L; + @Override + public boolean canPlay() { + //need to check if there are other creatures in play + return true; + } + @Override + public boolean canPlayAI() { + CardList human = AllZoneUtil.getCreaturesInPlay(Constant.Player.Human); + human = human.filter(new CardListFilter() { + public boolean addCard(Card c) { + return CardFactoryUtil.canTarget(card, getTargetCard()); + } + }); + return human.size() > 0; + } + @Override + public void resolve() { + Card c = getTargetCard(); + movedCreature[0] = c; + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) { + //set summoning sickness + if(c.getKeyword().contains("Haste")) { + c.setSickness(false); + } else { + c.setSickness(true); + } + + ((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(false); + + c.setSickness(true); + c.setController(card.getController()); + + PlayerZone from = AllZone.getZone(c); + from.remove(c); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); + to.add(c); + + ((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(true); + } + }//resolve() + };//SpellAbility + + final Command untapLeavesPlay = new Command() { + private static final long serialVersionUID = 2783051953965817611L; + + public void execute() { + Card c = movedCreature[0]; + + if(AllZone.GameAction.isCardInPlay(c)) { + ((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(false); + + c.setSickness(true); + c.setController(AllZone.GameAction.getOpponent(c.getController())); + + PlayerZone from = AllZone.getZone(c); + from.remove(c); + + //make sure the creature is removed from combat: + CardList list = new CardList(AllZone.Combat.getAttackers()); + if(list.contains(c)) AllZone.Combat.removeFromCombat(c); + + CardList pwlist = new CardList(AllZone.pwCombat.getAttackers()); + if(pwlist.contains(c)) AllZone.pwCombat.removeFromCombat(c); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + to.add(c); + + ((PlayerZone_ComesIntoPlay) AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay) AllZone.Computer_Play).setTriggers(true); + }//if + }//execute() + };//Command + card.addUntapCommand(untapLeavesPlay); + card.addLeavesPlayCommand(untapLeavesPlay); + card.addChangeControllerCommand(untapLeavesPlay); + + card.addSpellAbility(ability); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + // Cards with Cycling abilities // -1 means keyword "Cycling" not found if(shouldCycle(card) != -1) { diff --git a/src/forge/Input_Untap.java b/src/forge/Input_Untap.java index 2372c040ddc..86962600073 100644 --- a/src/forge/Input_Untap.java +++ b/src/forge/Input_Untap.java @@ -92,8 +92,25 @@ public class Input_Untap extends Input { }); for(Card c : list) { - if(!c.getKeyword().contains("CARDNAME doesn't untap during your untap step.") - && !c.getKeyword().contains("This card doesn't untap during your next untap step.")) c.untap(); + if(c.getKeyword().contains("You may choose not to untap CARDNAME during your untap step.")) { + if(c.isUntapped()) { + if(c.getController().equals(Constant.Player.Human)) { + String[] choices = {"Yes", "No"}; + Object o = AllZone.Display.getChoice("Untap "+c.getName()+"?", choices); + String answer = (String) o; + if(null != answer && answer.equals("Yes")) { + c.untap(); + } + } + else { //computer + //computer probably doesn't want to untap based on this ability... + } + } + } + else if(!c.getKeyword().contains("CARDNAME doesn't untap during your untap step.") + && !c.getKeyword().contains("This card doesn't untap during your next untap step.")) { + c.untap(); + } else c.removeExtrinsicKeyword("This card doesn't untap during your next untap step."); }