// cards in Hand
cardsCount = targetPlayer.getHand().count(filter, game);
if (cardsCount > 0) {
filter.setMessage("card named " + card.getName() + " in the hand of " + targetPlayer.getName());
TargetCardInHand target = new TargetCardInHand(0, cardsCount, filter);
if (player.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card targetCard = targetPlayer.getHand().get(targetId, game);
if (targetCard != null) {
player.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.HAND);
}
}
}
} else {
player.lookAtCards(targetPlayer.getName() + " hand", targetPlayer.getHand(), game);
}
// cards in Library
cardsCount = cardsInLibrary.count(filter, game);
if (cardsCount > 0) {
filter.setMessage("card named " + card.getName() + " in the library of " + targetPlayer.getName());
TargetCardInLibrary target = new TargetCardInLibrary(0, cardsCount, filter);
if (player.searchLibrary(target, game, targetPlayer.getId())) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card targetCard = targetPlayer.getLibrary().getCard(targetId, game);
if (targetCard != null) {
player.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.LIBRARY);
}