diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 725963bed1f..a95970ef627 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +journey_to_nowhere.jpg http://www.wizards.com/global/images/magic/general/journey_to_nowhere.jpg dwarven_demolition_team.jpg http://www.wizards.com/global/images/magic/general/dwarven_demolition_team.jpg oracle_of_mul_daya.jpg http://www.wizards.com/global/images/magic/general/oracle_of_mul_daya.jpg roiling_terrain.jpg http://www.wizards.com/global/images/magic/general/roiling_terrain.jpg diff --git a/res/cards.txt b/res/cards.txt index e43a20469b7..06d45a9b697 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Journey To Nowhere +1 W +Enchantment +When Journey to Nowhere enters the battlefield, exile target creature. When Journey to Nowhere leaves the battlefield, return the exiled card to the battlefield under its owner's control. + Dwarven Demolition Team 2 R Creature Dwarf diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index da49131a88a..b7571308b43 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -22242,7 +22242,7 @@ public class CardFactory implements NewConstants { }//*************** END ************ END ************************** - //*************** START *********** START ************************** + //*************** START *********** START ************************** if(cardName.equals("Life from the Loam")) { final SpellAbility spell = new Spell(card) { @@ -22336,17 +22336,9 @@ public class CardFactory implements NewConstants { }; card.clearSpellAbility(); card.addSpellAbility(spell); - - }//*************** END ************ END ************************** - - - - - - - //*************** START *********** START ************************** + //*************** START *********** START ************************** else if (cardName.equals("Natural Order")){ final SpellAbility spell = new Spell(card) { @@ -22431,7 +22423,8 @@ public class CardFactory implements NewConstants { spell.setBeforePayMana(runtime); } //*************** END ************ END ************************** - //*************** START *********** START ************************** + + //*************** START *********** START ************************** else if(cardName.equals("Tormod's Crypt")) { /* * Tap, Sacrifice Tormod's Crypt: Exile all cards from target player's graveyard. @@ -22469,14 +22462,186 @@ public class CardFactory implements NewConstants { card.addSpellAbility(ability); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Journey To Nowhere")) { + + final CommandReturn getPerm = new CommandReturn() { + public Object execute() { + //get all creatures + CardList tempList = new CardList(); + tempList.addAll(AllZone.Human_Play.getCards()); + tempList.addAll(AllZone.Computer_Play.getCards()); + + CardList list = new CardList(); + + for(int i = 0; i < tempList.size(); i++) { + if(tempList.get(i).isPermanent() && tempList.get(i).isCreature() + && CardFactoryUtil.canTarget(card, tempList.get(i))) list.add(tempList.get(i)); + }//for + + //remove "this card" + list.remove(card); + + return list; + + }//execute + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") { + + @Override + public void resolve() { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) + && CardFactoryUtil.canTarget(card, getTargetCard())) { + AllZone.GameAction.removeFromGame(getTargetCard()); + }//if + }//resolve() + };//abilityComes + + final Input inputComes = new Input() { + private static final long serialVersionUID = -3613946694360326887L; + + @Override + public void showMessage() { + CardList choice = (CardList) getPerm.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, + "Select target creature to remove from the game", true, false)); + ButtonUtil.disableAll();//to disable the Cancel button + }//showMessage + };//inputComes + + Command commandComes = new Command() { + private static final long serialVersionUID = -6250376920501373535L; + + public void execute() { + CardList perm = (CardList) getPerm.execute(); + String s = card.getController(); + if(perm.size() == 0) return; + else if(s.equals(Constant.Player.Human)) AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + + //try to target human creature + CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); + target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty + + // try to target human permanent + if(target == null) { + int convertedCost = 0; + CardList tempList = new CardList(); + tempList.addAll(AllZone.Human_Play.getCards()); + + for(int i = 0; i < tempList.size(); i++) { + if(tempList.get(i).isPermanent() + && !tempList.get(i).isLand() + && CardFactoryUtil.canTarget(card, tempList.get(i)) + && (CardUtil.getConvertedManaCost(tempList.get(i).getManaCost()) > convertedCost)) { + target = tempList.get(i); + convertedCost = CardUtil.getConvertedManaCost(tempList.get(i).getManaCost()); + }//if + }//for + }//if + + //target something cheaper (manacost 0?) instead: + if(target == null) { + CardList humanPerms = new CardList(); + humanPerms.addAll(AllZone.Human_Play.getCards()); + humanPerms = humanPerms.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.isPermanent() && !c.isLand() && CardFactoryUtil.canTarget(card, c); + } + }); + + if(humanPerms.size() > 0) target = humanPerms.get(0); + }//if + + if(target == null) { + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.getType("Creature"); + computer.remove(card); + + computer.shuffle(); + if(computer.size() != 0) target = computer.get(0); + else target = card; + }//if + + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + }//else + }//execute() + };//CommandComes + + Command commandLeavesPlay = new Command() { + private static final long serialVersionUID = 6997038208952910355L; + + public void execute() { + Object o = abilityComes.getTargetCard(); + if(o == null || ((Card) o).isToken() || !AllZone.GameAction.isCardRemovedFromGame((Card) o)) return; + + SpellAbility ability = new Ability(card, "0") { + + @Override + public void resolve() { + //copy card to reset card attributes like attack and defense + Card c = abilityComes.getTargetCard(); + if(!c.isToken()) { + c = AllZone.CardFactory.dynamicCopyCard(c); + c.setController(c.getOwner()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); + removed.remove(c); + if (c.isTapped()) c.untap(); + + play.add(c); + + }//if + }//resolve() + };//SpellAbility + ability.setStackDescription("Journey To Nowhere - returning creature to play."); + AllZone.Stack.add(ability); + }//execute() + };//Command + + card.addComesIntoPlayCommand(commandComes); + card.addLeavesPlayCommand(commandLeavesPlay); + + card.setSVar("PlayMain1", "TRUE"); + + card.clearSpellAbility(); + + card.addSpellAbility(new Spell_Permanent(card) { + private static final long serialVersionUID = -3250095291930182087L; + + @Override + public boolean canPlayAI() { + Object o = getPerm.execute(); + if(o == null) return false; + + CardList cList = new CardList(AllZone.Human_Play.getCards()); + cList = cList.filter(new CardListFilter() { + public boolean addCard(Card crd) { + return CardFactoryUtil.canTarget(card, crd) && crd.isCreature(); + } + }); + + CardList cl = (CardList) getPerm.execute(); + return (o != null) && cList.size() > 0 && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + }//canPlayAI + });//addSpellAbility + }//*************** END ************ END ************************** - //*************** START ********** START ************************* + //*************** START ********** START ************************* if (cardName.equals("Finest Hour") || cardName.equals("Gaea's Anthem") || cardName.equals("Glorious Anthem")) // no card factory code, cards handled elsewhere, { card.setSVar("PlayMain1", "TRUE"); - }//*************** END ************ END ************************** + }//*************** END ************ END ************************** + // Cards with Cycling abilities // -1 means keyword "Cycling" not found