some work at otional cost. not finished. Desolation agel broken for testing

This commit is contained in:
Loki 2011-09-11 23:34:29 +03:00
parent f1bf37bbd0
commit 58fd018db2
3 changed files with 21 additions and 7 deletions

View file

@ -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<DesolationAngel> {
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<DesolationAng
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
boolean kicked = false;
for (KickerAbility kicker: p.getAbilities().getKickerAbilities()) {
kicked |= kicker.isKicked();
for (Object cost: p.getSpellAbility().getOptionalCosts()) {
if (cost instanceof ManaCost) {
if (((ManaCost)cost).isPaid()) {
kicked = true;
}
}
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
if (permanent.getCardType().contains(CardType.LAND)) {

View file

@ -164,7 +164,7 @@ public abstract class MageObjectImpl<T extends MageObjectImpl<T>> 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

View file

@ -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<T extends AbilityImpl<T>> implements Ability {
logger.debug("activate failed - target");
return false;
}
ArrayList<Cost> addedOptionalCosts = new ArrayList<Cost>();
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);