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;
}
Aggregations