diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 31e43e4dd41..81929a79e76 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 +zuran_orb.jpg http://www.wizards.com/global/images/magic/general/zuran_orb.jpg storm_seeker.jpg http://www.wizards.com/global/images/magic/general/storm_seeker.jpg twiddle.jpg http://www.wizards.com/global/images/magic/general/twiddle.jpg kor_duelist.jpg http://www.wizards.com/global/images/magic/general/kor_duelist.jpg diff --git a/res/cards.txt b/res/cards.txt index 7568be71875..e400d022279 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Zuran Orb +0 +Artifact +0: Sacrifice a land to gain 2 life. + Storm Seeker 3 G Instant diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 623e708a535..42e54b723a5 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -18142,6 +18142,51 @@ public class CardFactory implements NewConstants { card.clearSpellAbility(); card.addSpellAbility(spell); }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + if(cardName.equals("Zuran Orb")) { + final SpellAbility ability = new Ability_Activated(card,"0") { + private static final long serialVersionUID = 6349074098650435648L; + public boolean canPlayAI() { + if( CardFactoryUtil.getLandsInPlay(Constant.Player.Computer).size() > 0 ) { + if( AllZone.GameAction.getPlayerLife(Constant.Player.Computer).getLife() < 5 ) { + return true; + } + else { + return false; + } + } + else return false; + } + public void chooseTargetAI() { + Card target = null; + target = CardFactoryUtil.getWorstLand(Constant.Player.Computer); + setTargetCard(target); + }//chooseTargetAI() + public void resolve() { + AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); + AllZone.GameAction.sacrifice(getTargetCard()); + } + };//SpellAbility + + Input runtime = new Input() { + private static final long serialVersionUID = -64941510699003443L; + + public void showMessage() { + ability.setStackDescription(card +" - Sacrifice a land to gain 2 life."); + PlayerZone play = AllZone.getZone(Constant.Zone.Play,card.getController()); + CardList choice = new CardList(play.getCards()); + choice = choice.getType("Land"); + stopSetNext(CardFactoryUtil.input_sacrifice(ability,choice,"Select a land to sacrifice.")); + } + }; + + ability.setStackDescription("Zuran Orb - Gain 2 life."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + // Cards with Cycling abilities diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 6f33c73f876..a1daca2d02e 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -3539,6 +3539,84 @@ public class CardFactoryUtil { */ + /** + * getWorstLand(String) + * + * This function finds the worst land a player has in play based on: + * worst + * 1. tapped, basic land + * 2. tapped, non-basic land + * 3. untapped, basic land + * 4. untapped, non-basic land + * best + * + * This is useful when the AI needs to find one of its lands to sacrifice + * + * @param player - Constant.Player.Human or Constant.Player.Computer + * @return the worst land found based on the description above + */ + public static Card getWorstLand(String player) { + Card worstLand = null; + CardList lands = CardFactoryUtil.getLandsInPlay(player); + //first, check for tapped, basic lands + for( int i = 0; i < lands.size(); i++ ) { + Card tmp = lands.get(i); + if(tmp.isTapped() && tmp.isBasicLand()) { + worstLand = tmp; + } + } + //next, check for tapped, non-basic lands + if(worstLand == null) { + for( int i = 0; i < lands.size(); i++ ) { + Card tmp = lands.get(i); + if(tmp.isTapped()) { + worstLand = tmp; + } + } + } + //next, untapped, basic lands + if(worstLand == null) { + for( int i = 0; i < lands.size(); i++ ) { + Card tmp = lands.get(i); + if(tmp.isUntapped() && tmp.isBasicLand()) { + worstLand = tmp; + } + } + } + //next, untapped, non-basic lands + if(worstLand == null) { + for( int i = 0; i < lands.size(); i++ ) { + Card tmp = lands.get(i); + if(tmp.isUntapped()) { + worstLand = tmp; + } + } + } + return worstLand; + }//end getWorstLand + + /** + * getLandsInPlay(String) + * + * This function returns a CardList of all lands that the given + * player has in Constant.Zone.Play + * + * @param player - Constant.Player.Human or Constant.Player.Computer + * @return a CardList of that players lands + */ + public static CardList getLandsInPlay(String player) { + PlayerZone compBattlezone = AllZone.getZone(Constant.Zone.Play, player); + CardList list = new CardList(compBattlezone.getCards()); + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + if(c.isLand()) return true; + else return false; + } + }); + return list; + } + + //may return null static public Card getRandomCard(CardList list) { if(list.size() == 0) return null;