From 1505b6ac78b7231d2a1c6543af6359aa01a4fd24 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 10:20:28 +0000 Subject: [PATCH] add Candelabra of Tawnos (from Antiquities) --- .gitattributes | 1 + res/cardsfolder/candelabra_of_tawnos.txt | 8 ++ src/forge/CardFactory.java | 110 +++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 res/cardsfolder/candelabra_of_tawnos.txt diff --git a/.gitattributes b/.gitattributes index e49bfdb9994..604cfa440d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -649,6 +649,7 @@ res/cardsfolder/caller_of_gales.txt -text svneol=native#text/plain res/cardsfolder/caller_of_the_claw.txt -text svneol=native#text/plain res/cardsfolder/callous_giant.txt -text svneol=native#text/plain res/cardsfolder/cancel.txt -text svneol=native#text/plain +res/cardsfolder/candelabra_of_tawnos.txt -text svneol=native#text/plain res/cardsfolder/canopy_spider.txt -text svneol=native#text/plain res/cardsfolder/cantivore.txt -text svneol=native#text/plain res/cardsfolder/canyon_minotaur.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/candelabra_of_tawnos.txt b/res/cardsfolder/candelabra_of_tawnos.txt new file mode 100644 index 00000000000..a79c45a67c0 --- /dev/null +++ b/res/cardsfolder/candelabra_of_tawnos.txt @@ -0,0 +1,8 @@ +Name:Candelabra of Tawnos +ManaCost:1 +Types:Artifact +Text:no text +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/candelabra_of_tawnos.jpg +End diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index a54c62e9819..5f9b84cbec0 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -12192,6 +12192,116 @@ public class CardFactory implements NewConstants { card.addSpellAbility(counter); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Candelabra of Tawnos")) { + /* + * X, Tap: Untap X target lands. + */ + + //no reason this should never be enough targets + final Card[] target = new Card[100]; + final int[] index = new int[1]; + + final Ability_Tap ability = new Ability_Tap(card, "X 0") { + private static final long serialVersionUID = -4615638742299513654L; + + @Override + public void resolve() { + System.out.println("Candelabra of Tawnos - card targets: "); + printCardTargets(); + for(int i = 0; i < target.length; i++) { + if(AllZone.GameAction.isCardInPlay(target[i]) + && CardFactoryUtil.canTarget(card, target[i]) + && null != target[i]) { + //DEBUG + System.out.println("Candelabra of Tawnos - untapping: "+target[i]); + target[i].untap(); + } + } + }//resolve() + + //DEBUG + private void printCardTargets() { + StringBuilder sb = new StringBuilder("["); + for(int i = 0; i < target.length; i++) { + sb.append(target[i]).append(","); + } + sb.append("]"); + System.out.println("Candelabra of Tawnos: "+sb.toString()); + } + + };//SpellAbility + + final Input input = new Input() { + private static final long serialVersionUID = 9040108401780787183L; + + @Override + public void showMessage() { + AllZone.Display.showMessage("Select target lands to untap. Currently, "+getNumTargets()+" targets. Click OK when done."); + } + + private int getNumTargets() { + int numTargets = 0; + for( int j = 0; j < target.length; j++ ) { + if( null != target[j] ) { + numTargets++; + } + } + return numTargets; + } + + @Override + public void selectButtonCancel() { stop(); } + + @Override + public void selectButtonOK() { + ability.setManaCost(Integer.toString(getNumTargets())); + if(this.isFree()) { + this.setFree(false); + AllZone.Stack.add(ability); + stop(); + } else stopSetNext(new Input_PayManaCost(ability)); + } + + @Override + public void selectCard(Card c, PlayerZone zone) { + if( !CardFactoryUtil.canTarget(card, c)) { + AllZone.Display.showMessage("Cannot target this card."); + return; //cannot target + } + for(int i = 0; i < index[0]; i++) { + if(c.equals(target[i])) { + AllZone.Display.showMessage("You have already selected this target."); + return; //cannot target the same land twice. + } + } + + if(c.isLand() && zone.is(Constant.Zone.Play)) { + target[index[0]] = c; + index[0]++; + showMessage(); + } + }//selectCard() + };//Input + + Input runtime = new Input() { + private static final long serialVersionUID = 6968433293909855375L; + + @Override + public void showMessage() { + index[0] = 0; + stopSetNext(input); + } + };//Input + /////////////////////////////////////// + ///////////////////////////////////// + + ability.setDescription("X, tap: "+"Untap X target lands."); + ability.setStackDescription(card.getName()+" - Untap X target lands."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + return postFactoryKeywords(card);