diff --git a/res/cards.txt b/res/cards.txt index 50474eb72b0..74f4b7b08ff 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,23 @@ +Sword of the Meek +2 +Artifact Equipment +Equipped creature gets +1/+2. Whenever a 1/1 creature enters the battlefield under your control, you may return Sword of the Meek from your graveyard to the battlefield, then attach it to that creature. + +Thopter Foundry +WB U +Artifact +no text + +Tinker +2 U +Sorcery +As an additional cost to cast Tinker, sacrifice an artifact. Search your library for an artifact card and put that card onto the battlefield. Then shuffle your library. + +Goblin Charbelcher +4 +Artifact +no text + Umezawa's Jitte 2 Artifact Equipment diff --git a/res/main.properties b/res/main.properties index 0eef852e385..dac3377f142 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: 94 +program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 95 tokens--file=AllTokens.txt diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 0b7621f5af7..6785bd4cda1 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -17138,6 +17138,303 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + if (cardName.equals("Goblin Charbelcher")) + { + final Ability_Tap ability = new Ability_Tap(card, "3") + { + private static final long serialVersionUID = -840041589720758423L; + + public void resolve() { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList topOfLibrary = new CardList(lib.getCards()); + CardList revealed = new CardList(); + + if (topOfLibrary.size() == 0) + return; + + int damage = 0; + int count = 0; + Card c = null; + Card crd; + while (c == null) + { + revealed.add(topOfLibrary.get(count)); + crd = topOfLibrary.get(count++); + if (crd.isLand() || count == topOfLibrary.size() ) { + c = crd; + damage = count; + if (crd.getName().equals("Mountain")) + damage = damage * 2; + } + }//while + AllZone.Display.getChoiceOptional("Revealed cards:", revealed.toArray()); + } + }; + ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); + card.addSpellAbility(ability); + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Tinker")) + { + final SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = -5878957726445248334L; + + public boolean canPlay() { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList list = new CardList(play.getCards()); + list = list.getType("Artifact"); + + return list.size() > 0; + } + + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer); + + CardList playList = new CardList(play.getCards()); + playList = playList.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) <= 2; + } + }); + + CardList libList = new CardList(lib.getCards()); + libList = libList.filter(new CardListFilter() + { + public boolean addCard(Card c){ + return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) > 5; + } + }); + + if (libList.size() > 0 && playList.size() > 0) + { + playList.shuffle(); + setTargetCard(playList.get(0)); + return true; + } + return false; + + } + + public void resolve() { + Card c = getTargetCard(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + + if (AllZone.GameAction.isCardInPlay(c)) + { + + AllZone.GameAction.sacrifice(c); + + if (card.getController().equals(Constant.Player.Computer)) { + + CardList list = new CardList(lib.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) > 5; + } + }); + + if (list.size() > 0) + { + Card crd = CardFactoryUtil.AI_getBestArtifact(list); + lib.remove(crd); + play.add(crd); + AllZone.GameAction.shuffle(Constant.Player.Computer); + } + } + else //human + { + CardList list = new CardList(lib.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isArtifact(); + } + }); + if (list.size() > 0) { + Object o = AllZone.Display.getChoiceOptional("Select artifact", list.toArray()); + + if (o != null) + { + Card crd = (Card)o; + lib.remove(crd); + play.add(crd); + + } + AllZone.GameAction.shuffle(Constant.Player.Human); + } + } + }//if isCardInPlay + } + }; + /* + final Command sac = new Command() + { + private static final long serialVersionUID = -8925816099640324876L; + + public void execute() { + AllZone.GameAction.sacrifice(spell.getTargetCard()); + } + }; + */ + + Input runtime = new Input() + { + private static final long serialVersionUID = -4653972223582155502L; + + public void showMessage() + { + CardList choice = new CardList(); + choice.addAll(AllZone.Human_Play.getCards()); + choice = choice.getType("Artifact"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, choice, "Select artifact to sacrifice.", false)); + } + }; + spell.setBeforePayMana(runtime); + + + card.clearSpellAbility(); + card.addSpellAbility(spell); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if (cardName.equals("Thopter Foundry")) + { + final String player = card.getController(); + + final SpellAbility ability = new Ability(card, "1") + { + public void chooseTargetAI() + { + Card c; + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList meek = new CardList(); + meek.addAll(play.getCards()); + meek = meek.getName("Sword of the Meek"); + + if (meek.size() >= 1) + c = meek.get(0); + else + c = getArtifact(); + setTargetCard(c); + + } + public Card getArtifact() + { + //target creature that is going to attack + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList arts = new CardList(); + arts.addAll(play.getCards()); + arts = arts.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isArtifact() && !c.isToken() && (CardUtil.getConvertedManaCost(c.getManaCost()) <= 1 || c.getName().equals("Sword of the Meek")); + } + }); + + if (arts.size() > 0) { + arts.shuffle(); + return arts.get(0); + } + else + return null; + }//getAttacker() + + + public boolean canPlayAI() + { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + + public void resolve() + { + Card c = getTargetCard(); + if (AllZone.GameAction.isCardInPlay(c)){ + AllZone.GameAction.sacrifice(c); + makeToken(); + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.addLife(1); + } + + + }//resolve + + public void makeToken() + { + Card c = new Card(); + + c.setName("Thopter"); + c.setImageName("U 1 1 Thopter"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("U"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Thopter"); + c.setBaseAttack(1); + c.setBaseDefense(1); + c.addIntrinsicKeyword("Flying"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + + } + }; + + Input runtime = new Input() + { + + private static final long serialVersionUID = 3557158378851031238L; + + public void showMessage() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList arts = new CardList(); + arts.addAll(play.getCards()); + arts = arts.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isArtifact() && !c.isToken(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, arts, "Select a non-token Artifact to sacrifice", false)); + + }//showMessage() + };//Input + + card.addSpellAbility(ability); + ability.setDescription("1, Sacrifice a nontoken artifact: Put a 1/1 blue Thopter artifact creature token with flying onto the battlefield. You gain 1 life."); + ability.setStackDescription(card.getName() + " - Put a 1/1 blue Thopter artifact creature token with flying onto the battlefield. You gain 1 life."); + ability.setBeforePayMana(runtime); + + }//*************** END ************ END ************************** + + // Cards with Cycling abilities // -1 means keyword "Cycling" not found diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 2ee146c4a6e..f6264da535e 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -16154,8 +16154,6 @@ public class CardFactory_Creatures { AllZone.GameAction.shuffle(card.getController()); lib.remove(c); lib.add(c, 0); - - } }//resolve() }; @@ -16304,7 +16302,7 @@ public class CardFactory_Creatures { } else //comp { - if (AllZone.Phase.getTurn() > 12 && nonLandList.size() > 0) + if (AllZone.Phase.getTurn() >= 12 && nonLandList.size() > 0) { Card c = CardFactoryUtil.AI_getMostExpensivePermanent(nonLandList, card, false); hand.remove(c); diff --git a/src/forge/CardFactory_Equipment.java b/src/forge/CardFactory_Equipment.java index 34d2595b8cb..368ff6b1054 100644 --- a/src/forge/CardFactory_Equipment.java +++ b/src/forge/CardFactory_Equipment.java @@ -1883,6 +1883,126 @@ class CardFactory_Equipment { } //*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if (cardName.equals("Sword of the Meek")) + { + 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 + + + Command onEquip = new Command() + { + private static final long serialVersionUID = -1783065127683640831L; + + public void execute() + { + if (card.isEquipping()) + { + Card crd = card.getEquipping().get(0); + crd.addSemiPermanentAttackBoost(1); + crd.addSemiPermanentDefenseBoost(2); + } + }//execute() + };//Command + + + Command onUnEquip = new Command() + { + + private static final long serialVersionUID = -754739553859502626L; + + public void execute() + { + if (card.isEquipping()) + { + Card crd = card.getEquipping().get(0); + crd.addSemiPermanentAttackBoost(-1); + crd.addSemiPermanentDefenseBoost(-2); + + } + + }//execute() + };//Command + + + Input runtime = new Input() + { + + private static final long serialVersionUID = 6238211194632758032L; + + 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 + + equip.setBeforePayMana(runtime); + + equip.setDescription("Equip: 2"); + card.addSpellAbility(equip); + + card.addEquipCommand(onEquip); + card.addUnEquipCommand(onUnEquip); + + } //*************** END ************ END ************************** + return card; diff --git a/src/forge/PlayerZone_ComesIntoPlay.java b/src/forge/PlayerZone_ComesIntoPlay.java index 67f2ec580bd..09e46cafa4e 100644 --- a/src/forge/PlayerZone_ComesIntoPlay.java +++ b/src/forge/PlayerZone_ComesIntoPlay.java @@ -108,6 +108,58 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone } } + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); + CardList meek = new CardList(grave.getCards()); + + if (meek.size() > 0 && c.isCreature() && c.getNetAttack() == 1 && c.getNetDefense() == 1) + { + for (int i=0;i