From 58fd018db26a46a9c794c2e3e6cdd6af5a38110d Mon Sep 17 00:00:00 2001 From: Loki Date: Sun, 11 Sep 2011 23:34:29 +0300 Subject: [PATCH] some work at otional cost. not finished. Desolation agel broken for testing --- .../src/mage/sets/apocalypse/DesolationAngel.java | 15 +++++++++------ Mage/src/mage/MageObjectImpl.java | 2 +- Mage/src/mage/abilities/AbilityImpl.java | 11 +++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java index 0354f698300..edc751ce056 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java @@ -37,6 +37,8 @@ import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.KickerAbility; @@ -55,12 +57,9 @@ public class DesolationAngel extends CardImpl { this.expansionSetCode = "APC"; this.subtype.add("Angel"); this.color.setBlack(true); - this.color.setBlack(true); this.power = new MageInt(5); this.toughness = new MageInt(4); - Ability ability = new KickerAbility(new DesolationAngelDummyEffect(), false); - ability.addManaCost(new ManaCostsImpl("{W}{W}")); - this.addAbility(ability); + this.getSpellAbility().addOptionalCost(new ManaCostsImpl("{W}{W}")); this.addAbility(new EntersBattlefieldTriggeredAbility(new DesolationAngelEntersBattlefieldEffect())); } @@ -109,8 +108,12 @@ class DesolationAngelEntersBattlefieldEffect extends OneShotEffect> implements Mag // if so, then ChangelingAbility doesn't matter if (value.equals("Mountain") || value.equals("Island") || value.equals("Plains") || value.equals("Forest") || value.equals("Swamp") || value.equals("Aura") - || value.equals("Equipment") || value.equals("Fortification")) { + || value.equals("Equipment") || value.equals("Fortification") || value.equals("Shrine")) { return false; } // as it is creature subtype, then check the existence of Changeling diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index 099a9c5c67f..431dbfef652 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -56,6 +56,8 @@ import mage.target.Targets; import org.apache.log4j.Logger; +import javax.management.openmbean.ArrayType; + /** * * @author BetaSteward_at_googlemail.com @@ -162,6 +164,15 @@ public abstract class AbilityImpl> implements Ability { logger.debug("activate failed - target"); return false; } + ArrayList addedOptionalCosts = new ArrayList(); + for (Cost cost : optionalCosts) { + if (game.getPlayer(this.controllerId).chooseUse(Outcome.Benefit, "Pay optional cost " + cost.getText() + "?", game)) { + if (cost instanceof ManaCost) { + manaCostsToPay.add((ManaCost) cost); + addedOptionalCosts.add(cost); + } + } + } //20100716 - 601.2e if (game.getObject(sourceId) != null) { //game.getObject(sourceId).adjustCosts(this, game);