From aa4e39d8a6153f101fe619f522f85255ed89184b Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:12:43 +0000 Subject: [PATCH] added Acidic Soil from Urza's Saga --- res/card-pictures.txt | 1 + res/cards.txt | 5 +++++ src/forge/AllZoneUtil.java | 20 +++++++++++++++++++ src/forge/CardFactory.java | 39 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 4d70deb3e10..a4e8e63d08c 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 +acidic_soil.jpg http://www.wizards.com/global/images/magic/general/acidic_soil.jpg dissipate.jpg http://www.wizards.com/global/images/magic/general/dissipate.jpg all_is_dust.jpg http://www.wizards.com/global/images/magic/general/all_is_dust.jpg tranquil_path.jpg http://www.wizards.com/global/images/magic/general/tranquil_path.jpg diff --git a/res/cards.txt b/res/cards.txt index d35af29f920..0bcbaec7ce0 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Acidic Soil +2 R +Sorcery +Acidic Soil deals damage to each player equal to the number of lands he or she controls. + Dissipate 1 U U Instant diff --git a/src/forge/AllZoneUtil.java b/src/forge/AllZoneUtil.java index bf8ff10f177..049d1fc3920 100644 --- a/src/forge/AllZoneUtil.java +++ b/src/forge/AllZoneUtil.java @@ -10,6 +10,7 @@ package forge; */ public class AllZoneUtil { + //////////// Creatures /** * use to get a list of creatures in play for a given player * @@ -37,6 +38,25 @@ public class AllZoneUtil { } }; + ///////////////// Lands + + /** + * use to get a list of all lands a given player has in play + * + * @param player the player whose lands we want to get + * @return a CardList containing all lands the given player has in play + */ + public static CardList getPlayerLandsInPlay(final String player) { + CardList cards = getPlayerCardsInPlay(player); + return cards.filter(lands); + } + + private static CardListFilter lands = new CardListFilter() { + public boolean addCard(Card c) { + return c.isLand(); + } + }; + //============================================================================= // // These functions handle getting all cards for a given player diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 6c96cd5b743..acc29cb7a3a 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -18935,6 +18935,45 @@ public class CardFactory implements NewConstants { card.addSpellAbility(spell); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Acidic Soil")) { + /* + * Acidic Soil deals damage to each player equal to the number of + * lands he or she controls. + */ + SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = 8555498267738686288L; + + @Override + public void resolve() { + CardList humanLands = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Human); + CardList compLands = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Computer); + + AllZone.GameAction.addDamage(Constant.Player.Computer, compLands.size(), card); + AllZone.GameAction.addDamage(Constant.Player.Human, humanLands.size(), card); + }// resolve() + + @Override + public boolean canPlayAI() { + PlayerLife compLife = AllZone.GameAction.getPlayerLife(Constant.Player.Computer); + PlayerLife humanLife = AllZone.GameAction.getPlayerLife(Constant.Player.Human); + CardList human = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Human); + CardList comp = AllZoneUtil.getPlayerLandsInPlay(Constant.Player.Computer); + + if(humanLife.getLife() <= human.size() ) { + return true; + } + + if( compLife.getLife() >= comp.size() && human.size() > comp.size()+2 ) { + return true; + } + return false; + } + };// SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + }// *************** END ************ END ************************** + // Cards with Cycling abilities // -1 means keyword "Cycling" not found if(hasKeyword(card, "Cycling") != -1) {