From 87d56c67674db7b9bc7e8e0e790a712b65edd6d5 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:20:36 +0000 Subject: [PATCH] 1) fix Crumble to be destroyNoRegeneration 2) add Divine Offering via the same code block --- res/card-pictures.txt | 1 + res/cards.txt | 5 ++ src/forge/CardFactory.java | 98 ++++++++++++++++++++++---------------- 3 files changed, 62 insertions(+), 42 deletions(-) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 05062696dd4..a0b06581d4d 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 +divine_offering.jpg http://www.wizards.com/global/images/magic/general/divine_offering.jpg argothian_pixies.jpg http://www.wizards.com/global/images/magic/general/argothian_pixies.jpg arc_slogger.jpg http://www.wizards.com/global/images/magic/general/arc_slogger.jpg fireball.jpg http://www.wizards.com/global/images/magic/general/fireball.jpg diff --git a/res/cards.txt b/res/cards.txt index 642f780ecc2..476ca015579 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Divine Offering +1 W +Instant +Destroy target artifact. You gain life equal to its converted mana cost. + Argothian Pixies 1 G Creature Faerie diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index f8a8f61294e..8bcb3f1eba3 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -17404,48 +17404,62 @@ public class CardFactory implements NewConstants { card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Crumble")) { - SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = 4752943254606319269L; - - @Override - public void resolve() { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) { - //add life - String player = getTargetCard().getController(); - PlayerLife life = AllZone.GameAction.getPlayerLife(player); - life.addLife(CardUtil.getConvertedManaCost(getTargetCard())); - - //remove card from play - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - - @Override - public boolean canPlayAI() { - CardList artifacts = new CardList(AllZone.Human_Play.getCards()); - artifacts = artifacts.getType("Artifact"); - artifacts = artifacts.filter(new CardListFilter() { - public boolean addCard(Card c) { - return CardFactoryUtil.canTarget(card, c); - } - }); - return artifacts.size() != 0 && (AllZone.Phase.getTurn() > 4); - } - - @Override - public void chooseTargetAI() { - CardList play = new CardList(AllZone.Human_Play.getCards()); - Card target = CardFactoryUtil.AI_getBestArtifact(play); - if(target != null) setTargetCard(target); - } - }; - spell.setBeforePayMana(CardFactoryUtil.input_targetType(spell, "Artifact")); - - card.clearSpellAbility(); - card.addSpellAbility(spell); + //*************** START *********** START ************************** + else if(cardName.equals("Crumble") || cardName.equals("Divine Offering")) { + /* + * Destroy target artifact. It can't be regenerated. That artifact's controller + * gains life equal to its converted mana cost. + */ + SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = 4752943254606319269L; + + @Override + public void resolve() { + Card target = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(target) + && CardFactoryUtil.canTarget(card, target)) { + //add life + String player; + if(cardName.equals("Crumble")) { + player = target.getController(); + } + else { + player = card.getController(); + } + PlayerLife life = AllZone.GameAction.getPlayerLife(player); + life.addLife(CardUtil.getConvertedManaCost(target)); + + if(cardName.equals("Crumble")) { + AllZone.GameAction.destroyNoRegeneration(target); + } + else { //Divine Offering + AllZone.GameAction.destroy(target); + } + } + }//resolve() + + @Override + public boolean canPlayAI() { + CardList artifacts = new CardList(AllZone.Human_Play.getCards()); + artifacts = artifacts.getType("Artifact"); + artifacts = artifacts.filter(new CardListFilter() { + public boolean addCard(Card c) { + return CardFactoryUtil.canTarget(card, c); + } + }); + return artifacts.size() != 0 && (AllZone.Phase.getTurn() > 4); + } + + @Override + public void chooseTargetAI() { + CardList play = new CardList(AllZone.Human_Play.getCards()); + Card target = CardFactoryUtil.AI_getBestArtifact(play); + if(target != null) setTargetCard(target); + } + }; + spell.setBeforePayMana(CardFactoryUtil.input_targetType(spell, "Artifact")); + card.clearSpellAbility(); + card.addSpellAbility(spell); }//*************** END ************ END **************************