From 286c9650c6b4f52fac89625e504dcf9717d71a69 Mon Sep 17 00:00:00 2001 From: Sloth Date: Tue, 20 Sep 2011 09:05:27 +0000 Subject: [PATCH] - Cleanup in two CardFactories. --- .../card/cardFactory/CardFactory_Lands.java | 211 ------------------ .../cardFactory/CardFactory_Sorceries.java | 209 ----------------- 2 files changed, 420 deletions(-) diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Lands.java b/src/main/java/forge/card/cardFactory/CardFactory_Lands.java index 8671ac66ddb..78ea0910d43 100644 --- a/src/main/java/forge/card/cardFactory/CardFactory_Lands.java +++ b/src/main/java/forge/card/cardFactory/CardFactory_Lands.java @@ -94,120 +94,6 @@ class CardFactory_Lands { }//*************** END ************ END ************************** - /* - //*************** START *********** START ************************** - else if (cardName.equals("Sejiri Steppe")) { - final HashMap creatureMap = new HashMap(); - final SpellAbility[] a = new SpellAbility[1]; - final Command eot1 = new Command() { - private static final long serialVersionUID = 5106629534549783845L; - - public void execute() { - Card c = a[0].getTargetCard(); - if (AllZoneUtil.isCardInPlay(c)) { - String[] colors = creatureMap.get(c); - for (String col : colors) { - c.removeExtrinsicKeyword("Protection from " + col); - } - } - } - - ; - }; - - a[0] = new Ability(card, "0") { - @Override - public void resolve() { - String Color = ""; - - if (card.getController().isHuman()) { - if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) { - Object o = GuiUtils.getChoice("Choose mana color", Constant.Color.onlyColors); - Color = (String) o; - } - - } else { - CardList creature = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - creature = creature.filter(new CardListFilter() { - public boolean addCard(Card c) { - return CardFactoryUtil.canTarget(a[0], c) && !c.hasKeyword("Defender"); - } - }); - Card biggest = null; - if (creature.size() > 0) { - biggest = creature.get(0); - - for (int i = 0; i < creature.size(); i++) { - if (biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); - } - setTargetCard(biggest); - - } - CardList creature2 = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - creature2 = creature2.filter(new CardListFilter() { - public boolean addCard(Card c) { - return (!c.isTapped() && !CardUtil.getColors(c).contains(Constant.Color.Colorless)); - } - }); - Card biggest2 = null; - if (creature2.size() > 0) { - biggest2 = creature2.get(0); - for (int i = 0; i < creature2.size(); i++) { - if (biggest2.getNetAttack() < creature2.get(i).getNetAttack()) - biggest2 = creature2.get(i); - } - if (biggest2 != null) { - if (biggest2.isGreen()) Color = "green"; - if (biggest2.isBlue()) Color = "blue"; - if (biggest2.isWhite()) Color = "white"; - if (biggest2.isRed()) Color = "red"; - if (biggest2.isBlack()) Color = "black"; - } else { - Color = "black"; - } - - } else { - Color = "black"; - } - } - Card Target = getTargetCard(); - if (Color != "" && Target != null) Target.addExtrinsicKeyword("Protection from " + Color); - ; - if (creatureMap.containsKey(Target)) { - int size = creatureMap.get(Target).length; - String[] newString = new String[size + 1]; - - for (int i = 0; i < size; i++) { - newString[i] = creatureMap.get(Target)[i]; - } - newString[size] = Color; - creatureMap.put(Target, newString); - } else creatureMap.put(Target, new String[]{Color}); - AllZone.getEndOfTurn().addUntil(eot1); - } - }; - - Command intoPlay = new Command() { - private static final long serialVersionUID = 5055232386220487221L; - - public void execute() { - CardList creats = AllZoneUtil.getCreaturesInPlay(card.getController()); - StringBuilder sb = new StringBuilder(); - sb.append(card.getName()).append(" - target creature you control gains protection from the color of your choice until end of turn"); - a[0].setStackDescription(sb.toString()); - if (card.getController().isHuman()) { - AllZone.getInputControl().setInput(CardFactoryUtil.input_targetSpecific(a[0], creats, "Select target creature you control", false, false)); - } else { - AllZone.getStack().addSimultaneousStackEntry(a[0]); - - } - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - */ - - //*************** START *********** START ************************** else if (cardName.equals("Dark Depths")) { @@ -546,103 +432,6 @@ class CardFactory_Lands { card.addComesIntoPlayCommand(comesIntoPlay); }//*************** END ************ END ************************** -/* - //*************** START ************ START ************************** - else if (cardName.equals("Bottomless Vault") || cardName.equals("Dwarven Hold") - || cardName.equals("Hollow Trees") || cardName.equals("Icatian Store") - || cardName.equals("Sand Silos")) { - final int[] num = new int[1]; - String shortTemp = ""; - if (cardName.equals("Bottomless Vault")) { - shortTemp = "B"; - } - if (cardName.equals("Dwarven Hold")) { - shortTemp = "R"; - } - if (cardName.equals("Hollow Trees")) { - shortTemp = "G"; - } - if (cardName.equals("Icatian Store")) { - shortTemp = "W"; - } - if (cardName.equals("Sand Silos")) { - shortTemp = "U"; - } - - final String shortString = shortTemp; - StringBuilder desc = new StringBuilder(); - desc.append("tap, Remove any number of storage counters from ").append(cardName); - desc.append(": Add ").append(shortString); - desc.append(" to your mana pool for each charge counter removed this way."); - - final Ability_Mana abMana = new Ability_Mana(card, "0", shortString) { - private static final long serialVersionUID = -4506828762302357781L; - - @Override - public boolean canPlay() { - return false; - } - }; - abMana.setUndoable(false); - - final Ability addMana = new Ability(card, "0", desc.toString()) { - @SuppressWarnings("unused") - private static final long serialVersionUID = -7805885635696245285L; - - //@Override - public String mana() { - StringBuilder mana = new StringBuilder(); - if (num[0] == 0) { - mana.append("0"); - } - else { - for (int i = 0; i < num[0]; i++) { - mana.append(shortString).append(" "); - } - } - return mana.toString().trim(); - } - - @Override - public boolean canPlayAI() { - return false; - } - - @Override - public void resolve() { - abMana.produceMana(mana(), card.getController()); - } - }; - - Input runtime = new Input() { - private static final long serialVersionUID = -4990369861806627183L; - - @Override - public void showMessage() { - num[0] = card.getCounters(Counters.STORAGE); - String[] choices = new String[num[0] + 1]; - for (int j = 0; j <= num[0]; j++) { - choices[j] = "" + j; - } - String answer = (String) (GuiUtils.getChoiceOptional("Storage counters to remove", choices)); - if (null != answer && !answer.equals("")) { - num[0] = Integer.parseInt(answer); - card.tap(); - card.subtractCounter(Counters.STORAGE, num[0]); - stop(); - AllZone.getStack().add(addMana); - return; - } - stop(); - } - }; - - addMana.setDescription(desc.toString()); - addMana.setBeforePayMana(runtime); - card.addSpellAbility(addMana); - card.addSpellAbility(abMana); - }//*************** END ************ END ************************** -*/ //*************** START *********** START ************************** //Lorwyn Dual Lands, and a couple Morningtide... diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java b/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java index 24bf81efd6e..980959b4c79 100644 --- a/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java +++ b/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java @@ -222,9 +222,6 @@ public class CardFactory_Sorceries { }//canPlayAI() };//SpellAbility - - - card.addSpellAbility(spell); card.setSVar("PlayMain1", "TRUE"); }//*************** END ************ END ************************** @@ -255,8 +252,6 @@ public class CardFactory_Sorceries { }//resolve() }; spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -416,8 +411,6 @@ public class CardFactory_Sorceries { card.addComesIntoPlayCommand(intoPlay); - - card.addSpellAbility(spell); card.addSpellAbility(freeCast); spell.setDescription(""); @@ -573,9 +566,6 @@ public class CardFactory_Sorceries { return cards.size() >= 8; } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -642,11 +632,8 @@ public class CardFactory_Sorceries { return c.size() > 0; } };//SpellAbility spell - spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -706,8 +693,6 @@ public class CardFactory_Sorceries { }//resolve() };//SpellAbility - - card.addSpellAbility(spell); Input target = new Input() { @@ -814,10 +799,6 @@ public class CardFactory_Sorceries { return CardUtil.getConvertedManaCost(card.getSpellAbility()[0]); } };//SpellAbility - - - - card.addSpellAbility(spell); card.setSVar("PlayMain1", "TRUE"); @@ -859,8 +840,6 @@ public class CardFactory_Sorceries { } };// SpellAbility - - card.addSpellAbility(spell); }// *************** END ************ END ************************** @@ -1099,9 +1078,6 @@ public class CardFactory_Sorceries { return out; }//chooseTwo() };//Input chooseTwoInput - - - card.addSpellAbility(spell); card.setSpellWithChoices(true); @@ -1139,9 +1115,6 @@ public class CardFactory_Sorceries { spell.setStackDescription("Parallel Evolution - For each creature token on the battlefield, its controller puts a token that's a copy of that creature onto the battlefield."); card.setFlashback(true); - - - card.addSpellAbility(spell); card.addSpellAbility(CardFactoryUtil.ability_Flashback(card, "4 G G G")); }//*************** END ************ END ************************** @@ -1310,9 +1283,6 @@ public class CardFactory_Sorceries { } } };//Input - - - card.addSpellAbility(spell); spell.setBeforePayMana(runtime); }//*************** END ************ END ************************** @@ -1397,9 +1367,6 @@ public class CardFactory_Sorceries { } } }; - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -1444,9 +1411,6 @@ public class CardFactory_Sorceries { player.mill(total); } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -1494,9 +1458,6 @@ public class CardFactory_Sorceries { } } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -1560,74 +1521,9 @@ public class CardFactory_Sorceries { };//Input spell.setBeforePayMana(runtime); - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** - /* - //********************Start********Start*********************** - else if(cardName.equals("Living Death")) - { - final SpellAbility spell = new Spell(card) - { - private static final long serialVersionUID = -7657135492744579098L; - - public void resolve() - { //grab make 4 creature lists: human_play, human_graveyard, computer_play, computer_graveyard - CardList human_play = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - - CardList human_graveyard = AllZoneUtil.getPlayerGraveyard(AllZone.getHumanPlayer()); - human_graveyard = human_graveyard.filter(AllZoneUtil.creatures); - - CardList computer_play = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - - CardList computer_graveyard = AllZoneUtil.getPlayerGraveyard(AllZone.getComputerPlayer()); - computer_graveyard = computer_graveyard.filter(AllZoneUtil.creatures); - - //TODO - the following code doesn't look like it's doing what it should to me... - Card c = new Card(); - Iterator it = human_play.iterator(); - while(it.hasNext()) - { - c = it.next(); - AllZone.getGameAction().moveTo(AllZone.getHumanBattlefield(),c); - AllZone.getGameAction().moveTo(AllZone.getHumanGraveyard(),c); - } - - it = human_graveyard.iterator(); - while(it.hasNext()) - { - c = it.next(); - AllZone.getGameAction().moveTo(AllZone.getHumanGraveyard(),c); - AllZone.getGameAction().moveTo(AllZone.getHumanBattlefield(),c); - } - - it = computer_play.iterator(); - while(it.hasNext()) - { - c = it.next(); - AllZone.getGameAction().moveTo(AllZone.getComputerBattlefield(),c); - AllZone.getGameAction().moveTo(AllZone.getComputerGraveyard(),c); - } - - it = computer_graveyard.iterator(); - while(it.hasNext()) - { - c = it.next(); - AllZone.getGameAction().moveTo(AllZone.getComputerGraveyard(),c); - AllZone.getGameAction().moveTo(AllZone.getComputerBattlefield(),c); - } - - }//resolve - };//spellability - - - - card.addSpellAbility(spell); - }//*********************END**********END*********************** - */ //*************** START *********** START ************************** else if (cardName.equals("Balance")) { @@ -1693,9 +1589,6 @@ public class CardFactory_Sorceries { return diff > 2; } }; - - - card.addSpellAbility(spell); } //*************** END ************ END ************************** @@ -1730,9 +1623,6 @@ public class CardFactory_Sorceries { AllZone.getEndOfTurn().addUntil(untilEOT); } }; - - - card.addSpellAbility(spell); card.setSVar("PlayMain1", "TRUE"); @@ -1773,68 +1663,11 @@ public class CardFactory_Sorceries { thePlayer.drawCard(); } }; - - - card.addSpellAbility(spell); card.setSVar("PlayMain1", "TRUE"); } //*************** END ************ END ************************** -/* - //*************** START *********** START ************************** - else if (cardName.equals("Haunting Misery")) { - Cost cost = new Cost("1 B B", cardName, false); - Target tgt = new Target(card, "Select a Player", "Player"); - final SpellAbility spell = new Spell(card, cost, tgt) { - private static final long serialVersionUID = 6867051257656060195L; - - @Override - public void resolve() { - Player player = card.getController(); - Player tPlayer = getTargetPlayer(); - CardList graveList = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature"); - - int size = graveList.size(); - int damage = 0; - - if (player.isHuman()) { - for (int i = 0; i < size; i++) { - Object o = GuiUtils.getChoice("Exile from graveyard", graveList.toArray()); - if (o == null) break; - damage++; // tally up how many cards removed - Card c_1 = (Card) o; - graveList.remove(c_1); //remove from the display list - AllZone.getGameAction().exile(c_1); - } - } else { //Computer - // it would be nice if the computer chose vanilla creatures over - for (int j = 0; j < size; j++) { - AllZone.getGameAction().exile(graveList.get(j)); - } - } - tPlayer.addDamage(damage, card); - } - - @Override - public void chooseTargetAI() { - setTargetPlayer(AllZone.getHumanPlayer()); - }//chooseTargetAI() - - @Override - public boolean canPlayAI() { - CardList graveList = AllZoneUtil.getPlayerTypeInGraveyard(AllZone.getHumanPlayer(), "Creature"); - int humanLife = AllZone.getHumanPlayer().getLife(); - - return (graveList.size() > 5 || graveList.size() > humanLife); - } - }; - - - - card.addSpellAbility(spell); - }//*************** END ************ END ************************** -*/ //*************** START *********** START ************************** else if (cardName.equals("Brood Birthing")) { @@ -1859,8 +1692,6 @@ public class CardFactory_Sorceries { sb.append(" puts one or three 0/1 Eldrazi Spawn creature tokens onto the battlefield."); spell.setStackDescription(sb.toString()); - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -1968,9 +1799,6 @@ public class CardFactory_Sorceries { return 0; } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -2188,8 +2016,6 @@ public class CardFactory_Sorceries { sb.append(card.getName()).append(" - discard X cards and return X cards to your hand."); spell.setStackDescription(sb.toString()); - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -2225,9 +2051,6 @@ public class CardFactory_Sorceries { player.drawCards(num); } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -2290,9 +2113,6 @@ public class CardFactory_Sorceries { setTargetCard(biggest); } };//SpellAbility - - - card.addSpellAbility(spell); Input target = new Input() { @@ -2368,9 +2188,6 @@ public class CardFactory_Sorceries { } }//resolve() };//SpellAbility - - - card.addSpellAbility(spell); StringBuilder sb = new StringBuilder(); @@ -2416,9 +2233,6 @@ public class CardFactory_Sorceries { return false; } };// SpellAbility - - - card.addSpellAbility(spell); }// *************** END ************ END ************************** @@ -2473,9 +2287,6 @@ public class CardFactory_Sorceries { } };// SpellAbility - - - card.addSpellAbility(spell); }// *************** END ************ END ************************** @@ -2523,9 +2334,6 @@ public class CardFactory_Sorceries { } };// SpellAbility - - - card.addSpellAbility(spell); }// *************** END ************ END ************************** @@ -2566,9 +2374,6 @@ public class CardFactory_Sorceries { } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -2623,9 +2428,6 @@ public class CardFactory_Sorceries { } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -2746,9 +2548,6 @@ public class CardFactory_Sorceries { return out; }//chooseTwo() };//Input chooseTwoInput - - - card.addSpellAbility(spell); spell.setBeforePayMana(chooseTwoInput); }//*************** END ************ END ************************** @@ -2775,9 +2574,6 @@ public class CardFactory_Sorceries { player.addHandSizeOperation(new HandSizeOp("=", -1, Integer.parseInt(card.getSVar("HSStamp")))); } };//SpellAbility - - - card.addSpellAbility(spell); }//*************** END ************ END ************************** @@ -3163,9 +2959,6 @@ public class CardFactory_Sorceries { return out; }//chooseTwo() };//Input chooseTwoInput - - - card.addSpellAbility(spell); card.setSpellWithChoices(true); @@ -3198,8 +2991,6 @@ public class CardFactory_Sorceries { spell.setDescription(cardName + " deals 5 damage to target creature. Destroy all Equipment attached to that creature."); - - card.addSpellAbility(spell); }//*************** END ************ END **************************