use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class ContainmentConstructEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card discardedCard = game.getCard(targetPointer.getFirst(game, source));
Card containmentConstruct = game.getCard(source.getSourceId());
if (discardedCard != null && containmentConstruct != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller.chooseUse(Outcome.Benefit, "Do you want to exile the discarded card? You may play it this turn from exile.", source, game)) {
UUID exileId = CardUtil.getExileZoneId(game, source);
controller.moveCardsToExile(discardedCard, source, game, true, exileId, "Exiled by " + containmentConstruct.getIdName());
PlayFromNotOwnHandZoneTargetEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
game.addEffect(effect, source);
return true;
}
}
return false;
}
Aggregations