}
}
if (searchedLibrary == null) {
return false;
}
GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, targetPlayerId, playerId, playerId, Integer.MAX_VALUE);
if (!game.replaceEvent(event)) {
TargetCardInLibrary newTarget = target.copy();
int count;
int librarySearchLimit = event.getAmount();
if (librarySearchLimit == Integer.MAX_VALUE) {
count = searchedLibrary.count(target.getFilter(), game);
} else {
newTarget.setCardLimit(librarySearchLimit);
count = Math.min(searchedLibrary.count(target.getFilter(), game), librarySearchLimit);