Search in sources :

Example 1 with ExileXFromYourGraveCost

use of mage.abilities.costs.common.ExileXFromYourGraveCost in project mage by magefree.

the class GorexTheTombshellReturnEffect method apply.

@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
    SpellAbility spellAbility = (SpellAbility) abilityToModify;
    for (Cost cost : spellAbility.getCosts()) {
        if (!(cost instanceof ExileXFromYourGraveCost)) {
            continue;
        }
        if (game.inCheckPlayableState()) {
            // allows to cast in getPlayable
            int reduction = ((ExileXFromYourGraveCost) cost).getMaxValue(spellAbility, game);
            CardUtil.adjustCost(spellAbility, reduction * 2);
        } else {
            // real cast
            int reduction = ((ExileXFromYourGraveCost) cost).getAmount();
            CardUtil.adjustCost(spellAbility, reduction * 2);
        }
        break;
    }
    return true;
}
Also used : ExileXFromYourGraveCost(mage.abilities.costs.common.ExileXFromYourGraveCost) SpellAbility(mage.abilities.SpellAbility) ExileXFromYourGraveCost(mage.abilities.costs.common.ExileXFromYourGraveCost) Cost(mage.abilities.costs.Cost)

Aggregations

SpellAbility (mage.abilities.SpellAbility)1 Cost (mage.abilities.costs.Cost)1 ExileXFromYourGraveCost (mage.abilities.costs.common.ExileXFromYourGraveCost)1