From b0d660a6bbfeae7b2d7c22ae2793e4f48e24d2db Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 02:50:05 +0000 Subject: [PATCH] - Added Vendillion Clique, Umezawa's Jitte. - Duress, Ostracize, Distress and Thoughtseize will now first reveal the entire hand, then reveal the narrowed down options to discard. --- res/cards.txt | 40 +++- res/main.properties | 2 +- src/forge/CardFactory.java | 8 +- src/forge/CardFactoryUtil.java | 20 ++ src/forge/CardFactory_Creatures.java | 262 +++++++++++++++++++++++- src/forge/CardFactory_Equipment.java | 266 ++++++++++++++++++++++++- src/forge/GameActionUtil.java | 10 +- src/forge/Input_CombatDamage.java | 9 + src/forge/Input_FirstStrikeDamage.java | 11 + 9 files changed, 619 insertions(+), 9 deletions(-) diff --git a/res/cards.txt b/res/cards.txt index 94c088d4a6f..50474eb72b0 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,40 @@ +Umezawa's Jitte +2 +Artifact Equipment +Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte. + +Vendillion Clique +1 U U +Legendary Creature Faerie Wizard +When Vendilion Clique enters the battlefield, look at target player's hand. You may choose a nonland card from it. If you do, that player reveals the chosen card, puts it on the bottom of his or her library, then draws a card. +3/1 +Flying +Flash + +Elvish Harbinger +2 G +Creature Elf Druid +When Elvish Harbinger enters the battlefield, you may search your library for an Elf card, reveal it, then shuffle your library and put that card on top of it. +1/2 +tap: add W +tap: add B +tap: add U +tap: add R +tap: add G + +Merrow Harbinger +3 U +Creature Merfolk Wizard +When Merrow Harbinger enters the battlefield, you may search your library for a Merfolk card, reveal it, then shuffle your library and put that card on top of it. +2/3 +Islandwalk + +Boggart Harbinger +2 B +Creature Goblin Shaman +When Boggart Harbinger enters the battlefield, you may search your library for a Goblin card, reveal it, then shuffle your library and put that card on top of it. +2/1 + Staff of Domination 3 Artifact @@ -101,8 +138,9 @@ This creature can't attack unless defending player controls an Island Goblin Chieftain 1 R R Creature Goblin -Haste Other Goblin creatures you control get +1/+1 and have haste. +Other Goblin creatures you control get +1/+1 and have haste. 2/2 +Haste Dwarven Pony R diff --git a/res/main.properties b/res/main.properties index 8c7fec9c591..0eef852e385 100644 --- a/res/main.properties +++ b/res/main.properties @@ -1,6 +1,6 @@ program/mail=mtgerror@yahoo.com program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 -program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 93 +program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 94 tokens--file=AllTokens.txt diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 9c5f2da255e..0b7621f5af7 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -7619,8 +7619,12 @@ public class CardFactory implements NewConstants { //check for no cards in hand on resolve PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetPlayer()); + CardList fullHand = new CardList(hand.getCards()); Card[] handChoices = removeLand(hand.getCards()); + if (fullHand.size() > 0 && card.getController().equals(Constant.Player.Human)) + AllZone.Display.getChoice("Revealing hand", fullHand.toArray()); + if(handChoices.length == 0) return; @@ -12951,6 +12955,7 @@ public class CardFactory implements NewConstants { //human chooses if(card.getController().equals(Constant.Player.Human)) { + AllZone.Display.getChoice("Revealing hand", cards.toArray()); choice = (Card) AllZone.Display.getChoice("Choose", nonCreatureCards.toArray()); } else//computer chooses @@ -13012,7 +13017,7 @@ public class CardFactory implements NewConstants { { if(cards.get(i).getType().contains("Creature")) { - System.out.println("ostracize: " + cards.get(i).getType()); + //System.out.println("ostracize: " + cards.get(i).getType()); creatureCards.add(cards.get(i)); } @@ -13024,6 +13029,7 @@ public class CardFactory implements NewConstants { //human chooses if(card.getController().equals(Constant.Player.Human)) { + AllZone.Display.getChoice("Revealing hand", cards.toArray()); choice = (Card) AllZone.Display.getChoice("Choose", creatureCards.toArray()); } else//computer chooses diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 3c45c440319..2d9ca69f2ae 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -1880,6 +1880,26 @@ public class CardFactoryUtil return list.size(); + } + + //returns the number of equipments named "e" card c is equipped by + public static int hasNumberEquipments(Card c, String e) + { + if (!c.isEquipped()) + return 0; + + final String equipmentName = e; + CardList list = new CardList(c.getEquippedBy().toArray()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.getName().equals(equipmentName); + } + + }); + + return list.size(); + } /*public static CardList getValuableCreatures() { diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 6f1217c3609..2ee146c4a6e 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -16075,9 +16075,267 @@ public class CardFactory_Creatures { }; card.addDestroyCommand(destroy); - } + }//*************** END ************ END ************************** - + //*************** START *********** START ************************** + else if(cardName.equals("Boggart Harbinger")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) + { + Card c = getTargetCard(); + AllZone.GameAction.shuffle(card.getController()); + lib.remove(c); + lib.add(c, 0); + + + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 4022442363194287539L; + + public void execute() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList cards = new CardList(lib.getCards()); + CardList goblins = new CardList(); + + for (int i=0;i 0) + { + if (card.getController().equals(Constant.Player.Human)) + { + AllZone.Display.getChoiceOptional("Revealing hand", list.toArray() ); + if (nonLandList.size() > 0) { + Object o = AllZone.Display.getChoiceOptional("Select target non-land card", nonLandList.toArray()); + if (o!=null) + { + Card c = (Card)o; + hand.remove(c); + lib.add(c); //put on bottom + + AllZone.GameAction.drawCard(player); + } + } + } + else //comp + { + if (AllZone.Phase.getTurn() > 12 && nonLandList.size() > 0) + { + Card c = CardFactoryUtil.AI_getMostExpensivePermanent(nonLandList, card, false); + hand.remove(c); + lib.add(c); + AllZone.GameAction.drawCard(Constant.Player.Human); + } + } + }//handsize > 0 + + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -5052568979553782714L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); + ButtonUtil.disableAll(); + } + else if (card.getController().equals(Constant.Player.Computer)) { + ability.setTargetPlayer(Constant.Player.Human); + AllZone.Stack.add(ability); + } + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + // Cards with Cycling abilities // -1 means keyword "Cycling" not found if (shouldCycle(card) != -1) diff --git a/src/forge/CardFactory_Equipment.java b/src/forge/CardFactory_Equipment.java index 659c80c52fd..34d2595b8cb 100644 --- a/src/forge/CardFactory_Equipment.java +++ b/src/forge/CardFactory_Equipment.java @@ -1347,14 +1347,15 @@ class CardFactory_Equipment { Command onEquip = new Command() { - private static final long serialVersionUID = 1L; - public void execute() + private static final long serialVersionUID = -4784079305541955698L; + + public void execute() { if (card.isEquipping()) { Card crd=card.getEquipping().get(0); - untapboost.setDescription("3, Untap:"+crd+" gets +2/+2 until end of turn"); + untapboost.setDescription("3, Untap: " +crd+" gets +2/+2 until end of turn"); untapboost.setStackDescription(crd+ " - +2/+2 until EOT"); crd.addSpellAbility(untapboost); @@ -1622,6 +1623,265 @@ class CardFactory_Equipment { card.addEquipCommand(onEquip); card.addUnEquipCommand(onUnEquip); + } //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if (cardName.equals("Umezawa's Jitte")) + { + final Ability equip = new Ability(card, "2") + { + public void resolve() + { + if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + if (card.isEquipping()) + { + Card crd = card.getEquipping().get(0); + if (crd.equals(getTargetCard()) ) + return; + + card.unEquipCard(crd); + } + card.equipCard(getTargetCard()); + } + } + + public boolean canPlay() + { + return AllZone.getZone(card).is(Constant.Zone.Play) && + AllZone.Phase.getActivePlayer().equals(card.getController()) && + (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2") ); + } + + public boolean canPlayAI() + { + return getCreature().size() != 0 && !card.isEquipping(); + } + + public void chooseTargetAI() + { + Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); + setTargetCard(target); + } + CardList getCreature() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && (!CardFactoryUtil.AI_doesCreatureAttack(c)) && CardFactoryUtil.canTarget(card, c) && + (! c.getKeyword().contains("Defender")); + } + }); + // list.remove(card); // if mana-only cost, allow self-target + return list; + }//getCreature() + + };//equip ability + + + Input runtime = new Input() + { + + private static final long serialVersionUID = 3087795844819115833L; + + public void showMessage() + { + //get all creatures you control + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list = list.getType("Creature"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(equip, list, "Select target creature to equip", true)); + } + };//Input + + + final Ability gainLife = new Ability(card, "0") + { + public void resolve() { + card.subtractCounter(Counters.CHARGE, 1); + String player = card.getController(); + PlayerLife life = AllZone.GameAction.getPlayerLife(player); + life.addLife(2); + } + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0; + } + + public boolean canPlayAI() + { + return AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife() <= 4; + } + + }; + + gainLife.setDescription("Remove a charge counter from Umezawa's Jitte: You gain 2 life."); + gainLife.setStackDescription(cardName + " - You gain 2 life."); + + final Ability negBoost = new Ability(card, "0") + { + public void resolve() { + + card.subtractCounter(Counters.CHARGE, 1); + final Card[] target = new Card[1]; + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -1615047325868708734L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(target[0]) ) + { + target[0].addTempAttackBoost(1); + target[0].addTempDefenseBoost(1); + } + } + }; + + target[0] = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0])) + { + target[0].addTempAttackBoost(-1); + target[0].addTempDefenseBoost(-1); + + AllZone.EndOfTurn.addUntil(untilEOT); + } + } + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0; + } + public boolean canPlayAI() + { + if (gainLife.canPlayAI()) + return false; + + CardList c = CardFactoryUtil.AI_getHumanCreature(1, card, true); + CardListUtil.sortAttack(c); + CardListUtil.sortFlying(c); + + if(c.isEmpty()) + return false; + else + { + setTargetCard(c.get(0)); + return true; + } + }//canPlayAI() + }; + Input target = new Input() + { + private static final long serialVersionUID = -5404464532726469761L; + public void showMessage() + { + AllZone.Display.showMessage("Select target creature for " +card.getName()); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(negBoost, card)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(card.isCreature() && zone.is(Constant.Zone.Play)) + { + negBoost.setTargetCard(card); + AllZone.Stack.add(negBoost); + stop(); + } + } + };//Input + negBoost.setDescription("Remove a charge counter from Umezawa's Jitte: Target creature gets -1/-1 until end of turn"); + negBoost.setBeforePayMana(target); + + + final Ability boost = new Ability(card, "0") + { + public void resolve() { + card.subtractCounter(Counters.CHARGE, 1); + final Card[] target = new Card[1]; + final Command untilEOT = new Command() + { + private static final long serialVersionUID = 2751279830522020186L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(target[0])) + { + target[0].addTempAttackBoost(-2); + target[0].addTempDefenseBoost(-2); + } + } + }; + + target[0] = card.getEquipping().get(0); + if(AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0])) + { + target[0].addTempAttackBoost(2); + target[0].addTempDefenseBoost(2); + + AllZone.EndOfTurn.addUntil(untilEOT); + } + } + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0; + } + + public boolean canPlayAI() + { + if (gainLife.canPlayAI() || negBoost.canPlayAI()) + return false; + + if (card.isEquipping()) { + Card c = card.getEquipping().get(0); + if (CardFactoryUtil.AI_doesCreatureAttack(c)) + return true; + + } + return false; + } + }; + + boost.setDescription("Remove a charge counter from Umezawa's Jitte: Equipped creature gets +2/+2 until end of turn."); + boost.setStackDescription(cardName + " - Equipped creature gets +2/+2 untin end of turn."); + + + equip.setBeforePayMana(runtime); + equip.setDescription("Equip: 2"); + card.addSpellAbility(equip); + card.addSpellAbility(boost); + card.addSpellAbility(negBoost); + card.addSpellAbility(gainLife); + + } //*************** END ************ END ************************** diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index a2c667c97d6..7ea0fb4c2fe 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -1799,7 +1799,15 @@ public class GameActionUtil playerCombatDamage_Rootwater_Thief(c); else if (c.getName().equals("Treva, the Renewer")) playerCombatDamage_Treva(c); - + /* + if(CardFactoryUtil.hasNumberEquipments(c, "Umezawa's Jitte") == 1) + { + PlayerZone play = AllZone.getZone(c); + CardList list = new CardList(play.getCards()); + list = list.getName("Umezawa's Jitte"); + Card jitte = list.get(0); + } + */ if (c.getNetAttack() > 0) c.setDealtCombatDmgToOppThisTurn(true); diff --git a/src/forge/Input_CombatDamage.java b/src/forge/Input_CombatDamage.java index a8a4ad0411b..861afbf9f5e 100644 --- a/src/forge/Input_CombatDamage.java +++ b/src/forge/Input_CombatDamage.java @@ -119,6 +119,15 @@ private void playerDamage(PlayerLife p) for(int j=0; j < CardFactoryUtil.hasNumberEnchantments(attackers.getCard(i), "Guilty Conscience"); j++) GameActionUtil.executeGuiltyConscienceEffects(attackers.getCard(i)); + + if(CardFactoryUtil.hasNumberEquipments(attackers.getCard(i), "Umezawa's Jitte") == 1 && attackers.get(i).getNetAttack() > 0) + { + PlayerZone play = AllZone.getZone(attackers.getCard(i)); + CardList clist = new CardList(play.getCards()); + clist = clist.getName("Umezawa's Jitte"); + Card jitte = clist.get(0); + jitte.addCounter(Counters.CHARGE, 2); + } } //not sure if this will work correctly with multiple blockers? diff --git a/src/forge/Input_FirstStrikeDamage.java b/src/forge/Input_FirstStrikeDamage.java index c0799142e04..468407aecd8 100644 --- a/src/forge/Input_FirstStrikeDamage.java +++ b/src/forge/Input_FirstStrikeDamage.java @@ -98,6 +98,17 @@ private void playerDamage(PlayerLife p) for(int j=0; j < CardFactoryUtil.hasNumberEnchantments(attackers.getCard(i), "Guilty Conscience"); j++) GameActionUtil.executeGuiltyConscienceEffects(attackers.getCard(i)); + + + if(CardFactoryUtil.hasNumberEquipments(attackers.getCard(i), "Umezawa's Jitte") == 1 && attackers.get(i).getNetAttack() > 0) + { + PlayerZone play = AllZone.getZone(attackers.getCard(i)); + CardList clist = new CardList(play.getCards()); + clist = clist.getName("Umezawa's Jitte"); + Card jitte = clist.get(0); + jitte.addCounter(Counters.CHARGE, 2); + } + /* //old stuff: gain life for each instance of lifelink