From 6b189dea3adaa4a44f4a1fdb071fbc5ee50c0f4f Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 09:18:44 +0000 Subject: [PATCH] - Converted Life from the Loam and Reinforcements to keyword. --- res/cardsfolder/life_from_the_loam.txt | 3 +- res/cardsfolder/reinforcements.txt | 4 +- src/forge/CardFactory.java | 25 +++-- src/forge/CardFactory_Instants.java | 144 +------------------------ src/forge/CardFactory_Sorceries.java | 97 ----------------- 5 files changed, 23 insertions(+), 250 deletions(-) diff --git a/res/cardsfolder/life_from_the_loam.txt b/res/cardsfolder/life_from_the_loam.txt index d5deb689954..d2c4e5ab50b 100644 --- a/res/cardsfolder/life_from_the_loam.txt +++ b/res/cardsfolder/life_from_the_loam.txt @@ -1,7 +1,8 @@ Name:Life from the Loam ManaCost:1 G Types:Sorcery -Text:Return up to three target land cards from your graveyard to your hand. +Text:Return up to three target land cards from your graveyard to your hand. +K:spReturnTgt:3/UpTo:Land:Hand K:Dredge 3 SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/life_from_the_loam.jpg diff --git a/res/cardsfolder/reinforcements.txt b/res/cardsfolder/reinforcements.txt index 494246ce5e5..16bbbb15b29 100644 --- a/res/cardsfolder/reinforcements.txt +++ b/res/cardsfolder/reinforcements.txt @@ -1,7 +1,9 @@ Name:Reinforcements ManaCost:W Types:Instant -Text:Put up to three target creature cards from your graveyard on top of your library. +Text:Put up to three target creature cards from your graveyard on top of your library. +K:spReturnTgt:3/UpTo:Creature:TopofLibrary +SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/reinforcements.jpg End diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 960a0719746..dca0f3d10ef 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -3787,15 +3787,24 @@ public class CardFactory implements NewConstants { }// for nctr }// if choices - if (!anyNumber[0] - && results.size() >= numCardsToReturn) { - results.shuffle(); + if (!anyNumber[0]) { CardList targets = new CardList(); - for (int i = 0; i < numCardsToReturn; i++) { - targets.add(results.get(i)); + + if (results.size() >= numCardsToReturn) { + results.shuffle(); + for (int i = 0; i < numCardsToReturn; i++) { + targets.add(results.get(i)); + } + + } else if (results.size() >= 1 + && returnUpTo[0]) { + targets = results; + } + + if (targets.size() > 0) { + setTargetList(targets); + return true; } - setTargetList(targets); - return true; } return false; }// canPlayAI() @@ -3871,7 +3880,7 @@ public class CardFactory implements NewConstants { };// spRtrnTgt spRtrnTgt.setBeforePayMana(CardFactoryUtil.spReturnTgt_input_targetCards_InGraveyard( - card, spRtrnTgt, returnUpTo[0], numCardsToReturn, Tgts, anyNumber[0])); + card, spRtrnTgt, returnUpTo[0], numCardsToReturn, Tgts, anyNumber[0])); if (desc.length() > 0) { spRtrnTgt.setDescription(desc); diff --git a/src/forge/CardFactory_Instants.java b/src/forge/CardFactory_Instants.java index 57b0e27804f..02c79b1ddd9 100644 --- a/src/forge/CardFactory_Instants.java +++ b/src/forge/CardFactory_Instants.java @@ -4197,149 +4197,7 @@ public class CardFactory_Instants { } //*************** END ************ END ************************** -/* - //*************** START *********** START ************************** - else if (cardName.equals("Reprisal")) { - final SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = 8653455310355884536L; - - public boolean canPlayAI() { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.filter(new CardListFilter() { - public boolean addCard(Card c) { - return c.isCreature() - && c.getNetAttack() > 3 - && CardFactoryUtil.canTarget(card, c) - && !c.getKeyword().contains("Indestructible"); - } - }); - - if (list.isEmpty()) return false; - - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - - public void resolve() { - if (AllZone.GameAction.isCardInPlay(getTargetCard())) { - AllZone.GameAction.destroyNoRegeneration(getTargetCard()); - } - }//resolve - };//SpellAbility - - card.clearSpellAbility(); - card.addSpellAbility(spell); - - Input target = new Input() { - private static final long serialVersionUID = 4794354831721082791L; - public void showMessage() { - AllZone.Display.showMessage("Select target Creature to destroy"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() { - stop(); - } - public void selectCard(Card c, PlayerZone zone) { - if (zone.is(Constant.Zone.Play) - && c.isCreature() - && (c.getNetAttack() > 3) - && CardFactoryUtil.canTarget(card, c)) { - spell.setTargetCard(c); - if (this.isFree()) - { - this.setFree(false); - AllZone.Stack.add(spell); - stop(); - } - else - stopSetNext(new Input_PayManaCost(spell)); - } - } - };//input - - card.setSVar("PlayMain1", "TRUE"); - - spell.setBeforePayMana(target); - }//*************** END ************ END ************************** -*/ - - //*************** START *********** START ************************** - else if(cardName.equals("Reinforcements")) { - /* Put up to three target creature cards from your - * graveyard on top of your library. - */ - final SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = 4075591356690396548L; - - CardList getComputerCreatures() - { - CardList list = new CardList(AllZone.Computer_Graveyard.getCards()); - list = list.getType("Creature"); - - //put biggest attack creats first - if (list.size()>0) - CardListUtil.sortAttack(list); - - return list; - } - - @Override - public boolean canPlayAI() { - return getComputerCreatures().size() >= 3; - } - @Override - public void resolve() { - String player = card.getController(); - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); - - CardList creatures = new CardList(grave.getCards()); - creatures = creatures.filter(new CardListFilter() { - public boolean addCard(Card c) { - return c.isCreature(); - } - }); - if (player.equals(Constant.Player.Human)) - { - //now, select three creatures - int end = -1; - end = Math.min(creatures.size(), 3); - for(int i = 1; i <= end; i++) { - String Title = "Put on top of library: "; - if(i == 2) Title = "Put second from top of library: "; - if(i == 3) Title = "Put third from top of library: "; - Object o = AllZone.Display.getChoiceOptional(Title, creatures.toArray()); - if(o == null) break; - Card c_1 = (Card) o; - creatures.remove(c_1); //remove from the display list - grave.remove(c_1); //remove from graveyard - lib.add(c_1, i - 1); - } - } - else //Computer - { - CardList list = getComputerCreatures(); - int max = list.size(); - - if (max > 3) - max = 3; - - for (int i=0;i= 1) { - Card c1 = lands.getCard(0); - grave.remove(c1); - hand.add(c1); - lands.remove(c1); - - if(lands.size() >= 1) { - Card c2 = lands.getCard(0); - grave.remove(c2); - hand.add(c2); - lands.remove(c2); - - if(lands.size() >= 1) { - Card c3 = lands.getCard(0); - grave.remove(c3); - hand.add(c3); - lands.remove(c3); - - } - } - - } - //ability.setTargetCard(powerTwoCreatures.get(0)); - //AllZone.Stack.add(ability); - AllZone.GameAction.shuffle(controller); - } - - - //... - - }//resolve() - }; - card.clearSpellAbility(); - card.addSpellAbility(spell); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if (cardName.equals("Natural Order")){ final SpellAbility spell = new Spell(card) {