diff --git a/res/cards.txt b/res/cards.txt index 0ab12a94c63..8296ba83ed1 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Riding the Dilu Horse +2 G +Sorcery +no text + Mogg Jailer 1 R Creature Goblin @@ -4406,12 +4411,6 @@ Creature Human Soldier Archer no text 1/1 -Riding the Dilu Horse -2 G -Sorcery -no text -spPumpTgt:+2/+2/Horsemanship - Magus of the Coffers 4 B Creature Human Wizard diff --git a/res/quest/questData b/res/quest/questData index a6011ff1813..c078514d47e 100644 Binary files a/res/quest/questData and b/res/quest/questData differ diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index ef0334c912d..3683113756d 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -17429,6 +17429,133 @@ public class CardFactory implements NewConstants { ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Creature")); }//Jandor's Saddlebags //****************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 0) { + Card c = CardFactoryUtil.AI_getBestCreature(list, card); + setTargetCard(c); + return true; + } + return false; + } + + public void resolve() + { + final Card[] target = new Card[1]; + + + target[0] = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0])) + { + target[0].addTempAttackBoost(2); + target[0].addTempDefenseBoost(2); + target[0].addExtrinsicKeyword("Horsemanship"); + + //String s = target[0].getText(); + target[0].setText("(+2/+2 and Horsemanship from " +card+")"); + } + }//resolve() + }; + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + // Cards with Cycling abilities diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index d96c8829fe3..a9cbf7fd085 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -447,81 +447,83 @@ public class GameAction { new Gui_WinLose(); return; } - - //card state effects like Glorious Anthem - for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) { - Command com = GameActionUtil.commands.get(effect); - com.execute(); - } - - GameActionUtil.executeCardStateEffects(); - - //System.out.println("checking state effects"); - ArrayList creature = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Creature"); - creature.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Creature")); - - Card c; - Iterator it = creature.iterator(); - - while(it.hasNext()) { - c = it.next(); - - if(c.isEquipped()) { - for(int i = 0; i < c.getEquippedBy().size(); i++) { - Card equipment = c.getEquippedBy().get(i); - if(!AllZone.GameAction.isCardInPlay(equipment)) { - equipment.unEquipCard(c); - } - } - }//if isEquipped() - - if(c.getNetDefense() <= c.getDamage() && !c.getKeyword().contains("Indestructible")) { - destroy(c); - AllZone.Combat.removeFromCombat(c); //this is untested with instants and abilities but required for First Strike combat phase - } - - else if(c.getNetDefense() <= 0) { - destroy(c); - AllZone.Combat.removeFromCombat(c); - } - - }//while it.hasNext() - - - ArrayList enchantments = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Enchantment"); - enchantments.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Enchantment")); - - Iterator iterate = enchantments.iterator(); - while(iterate.hasNext()) { - c = iterate.next(); - - if(c.isAura()) { - for(int i = 0; i < c.getEnchanting().size(); i++) { - Card perm = c.getEnchanting().get(i); - if(!AllZone.GameAction.isCardInPlay(perm) - || CardFactoryUtil.hasProtectionFrom(c, perm) - || (c.getKeyword().contains("Enchant creature") && !perm.getType().contains("Creature"))) { - c.unEnchantCard(perm); - destroy(c); - } - } - }//if isAura - - }//while iterate.hasNext() - - - //Make sure all equipment stops equipping previously equipped creatures that have left play. - ArrayList equip = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Equipment"); - equip.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Equipment")); - - Iterator iter = equip.iterator(); - while(iter.hasNext()) { - c = iter.next(); - if(c.isEquipping()) { - Card equippedCreature = c.getEquipping().get(0); - if(!AllZone.GameAction.isCardInPlay(equippedCreature)) c.unEquipCard(equippedCreature); - } - }//while iter.hasNext() + //do this twice, sometimes creatures/permanents will survive when they shouldn't + for (int q=0;q<2;q++) + { + //card state effects like Glorious Anthem + for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) { + Command com = GameActionUtil.commands.get(effect); + com.execute(); + } + + GameActionUtil.executeCardStateEffects(); + + //System.out.println("checking state effects"); + ArrayList creature = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Creature"); + creature.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Creature")); + + Card c; + Iterator it = creature.iterator(); + + while(it.hasNext()) { + c = it.next(); + + if(c.isEquipped()) { + for(int i = 0; i < c.getEquippedBy().size(); i++) { + Card equipment = c.getEquippedBy().get(i); + if(!AllZone.GameAction.isCardInPlay(equipment)) { + equipment.unEquipCard(c); + } + } + }//if isEquipped() + + if(c.getNetDefense() <= c.getDamage() && !c.getKeyword().contains("Indestructible")) { + destroy(c); + AllZone.Combat.removeFromCombat(c); //this is untested with instants and abilities but required for First Strike combat phase + } + + else if(c.getNetDefense() <= 0) { + destroy(c); + AllZone.Combat.removeFromCombat(c); + } + + }//while it.hasNext() + + + ArrayList enchantments = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Enchantment"); + enchantments.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Enchantment")); + + Iterator iterate = enchantments.iterator(); + while(iterate.hasNext()) { + c = iterate.next(); + + if(c.isAura()) { + for(int i = 0; i < c.getEnchanting().size(); i++) { + Card perm = c.getEnchanting().get(i); + if(!AllZone.GameAction.isCardInPlay(perm) + || CardFactoryUtil.hasProtectionFrom(c, perm) + || (c.getKeyword().contains("Enchant creature") && !perm.getType().contains("Creature"))) { + c.unEnchantCard(perm); + destroy(c); + } + } + }//if isAura + + }//while iterate.hasNext() + + //Make sure all equipment stops equipping previously equipped creatures that have left play. + ArrayList equip = PlayerZoneUtil.getCardType(AllZone.Computer_Play, "Equipment"); + equip.addAll(PlayerZoneUtil.getCardType(AllZone.Human_Play, "Equipment")); + + Iterator iter = equip.iterator(); + while(iter.hasNext()) { + c = iter.next(); + if(c.isEquipping()) { + Card equippedCreature = c.getEquipping().get(0); + if(!AllZone.GameAction.isCardInPlay(equippedCreature)) c.unEquipCard(equippedCreature); + } + }//while iter.hasNext() + }//for q=0;q<2 destroyLegendaryCreatures(); destroyPlaneswalkers(); @@ -896,9 +898,28 @@ public class GameAction { c[i].setDamage(0); } + //for Quest fantasy mode + public void newGame(Deck humanDeck, Deck computerDeck, CardList human, CardList computer, int humanLife, int computerLife) + { + this.newGame(humanDeck, computerDeck); + + AllZone.Computer_Life.setLife(computerLife); + AllZone.Human_Life.setLife(humanLife); + + for (Card c : human) + { + AllZone.Human_Play.add(c); + } + + for (Card c: computer) + { + AllZone.Computer_Play.add(c); + } + } + public void newGame(Deck humanDeck, Deck computerDeck) { // AllZone.Computer = new ComputerAI_Input(new ComputerAI_General()); - //System.gc(); //garbage collection... does it make a difference though? + lastPlayerToDraw = Constant.Player.Human; AllZone.GameInfo.setComputerCanPlayNumberOfLands(1); @@ -936,9 +957,6 @@ public class GameAction { AllZone.StaticEffects.reset(); - //clear Image caches, so the problem doesn't get slower and slower - //cached images are cleared in Gui_WinLose.quitButton_actionPerformed() - {//re-number cards just so their unique numbers are low, just for user friendliness CardFactory c = AllZone.CardFactory; @@ -956,8 +974,6 @@ public class GameAction { } AllZone.Human_Library.add(card); - //get card picture so that it is in the image cache -// ImageCache.getImage(card); } for(int i = 0; i < computerDeck.countMain(); i++) { @@ -992,14 +1008,6 @@ public class GameAction { this.drawCard(Constant.Player.Computer); this.drawCard(Constant.Player.Human); } - /* - Card mp = new Card(); - mp.setName("Mana Pool"); - //mp.addType("Land"); - mp.addIntrinsicKeyword("Indestructible"); - mp.addIntrinsicKeyword("Shroud"); - AllZone.Human_Play.add(mp); - */ ManaPool mp = AllZone.ManaPool; AllZone.Human_Play.add(mp.smp); diff --git a/src/forge/Input_StackNotEmpty.java b/src/forge/Input_StackNotEmpty.java index 0a9c693de40..2611bedcbb4 100644 --- a/src/forge/Input_StackNotEmpty.java +++ b/src/forge/Input_StackNotEmpty.java @@ -46,9 +46,6 @@ public class Input_StackNotEmpty extends Input implements java.io.Serializable { AllZone.GameAction.scry(sa.getSourceCard().getController(), Integer.parseInt(kk[1])); } } - - //check them twice, sometimes creatures will survive when they shouldn't - AllZone.GameAction.checkStateEffects(); AllZone.GameAction.checkStateEffects(); //special consideration for "Beacon of Unrest" and other "Beacon" cards