use of mage.filter.common.FilterControlledArtifactPermanent in project mage by magefree.
the class DarettiSacrificeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Target target = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
if (!target.canChoose(source.getSourceId(), controller.getId(), game) || !controller.chooseTarget(outcome, target, source, game)) {
return true;
}
Permanent artifact = game.getPermanent(target.getFirstTarget());
if (artifact == null || !artifact.sacrifice(source, game)) {
return true;
}
Card card = game.getCard(getTargetPointer().getFirst(game, source));
return card == null || controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
Aggregations