use of mage.target.common.TargetPermanentOrSuspendedCard in project mage by magefree.
the class RiftElementalCost method pay.
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
paid = false;
Player controller = game.getPlayer(controllerId);
if (controller != null) {
Target target = new TargetPermanentOrSuspendedCard(filter, true);
if (target.choose(Outcome.Neutral, controllerId, source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
permanent.removeCounters(CounterType.TIME.createInstance(), source, game);
this.paid = true;
} else {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.removeCounters(CounterType.TIME.createInstance(), source, game);
this.paid = true;
}
}
}
}
return paid;
}
Aggregations