@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null) {
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND);
if (controller.searchLibrary(target, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
Cards cards = new CardsImpl(card);
if (MorbidCondition.instance.apply(game, source)
&& controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to put the card onto the battlefield instead?", source, game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
controller.moveCards(card, Zone.HAND, source, game);
}
controller.revealCards(sourceObject.getIdName(), cards, game);
}
}
controller.shuffleLibrary(source, game);
return true;
}
return false;
}
}