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