if (player != null) {
if (player.getLibrary().size() > 0) {
Card card = player.getLibrary().getFromTop(game);
player.revealCards("DescendantsPath", new CardsImpl(card), game);
if (card.getCardType().contains(CardType.CREATURE)) {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
for (String subtype: card.getSubtype()) {
subtypes.add(new SubtypePredicate(subtype));
}
filter.add(Predicates.or(subtypes));
int count = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game).size();
if (count > 0) {
game.informPlayers("DescendantsPath: Found a creature that shares a creature type with the revealed card.");
if (player.chooseUse(Outcome.Benefit, "Cast the card?", game)) {