Search in sources :

Example 1 with RemoveCounterCost

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

the class HungryHungryHeiferEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game);
    if (sourceObject != null && controller != null) {
        if (controller.chooseUse(outcome, "Remove a counter from a permanent you control?", source, game)) {
            TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
            RemoveCounterCost cost = new RemoveCounterCost(target);
            if (cost.pay(null, game, source, controller.getId(), true)) {
                return true;
            }
        }
        sourceObject.sacrifice(source, game);
        return true;
    }
    return false;
}
Also used : RemoveCounterCost(mage.abilities.costs.common.RemoveCounterCost) TargetControlledPermanent(mage.target.common.TargetControlledPermanent) Player(mage.players.Player) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetControlledPermanent(mage.target.common.TargetControlledPermanent)

Aggregations

RemoveCounterCost (mage.abilities.costs.common.RemoveCounterCost)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)1