if (player != null) {
int lands = game.getState().getBattlefield().countAll(filter, playerId, game);
if (amount >= lands) {
permanentsToSacrifice.addAll(game.getState().getBattlefield().getAllActivePermanents(filter, playerId, game));
} else {
FilterLandPermanent playerFilter = filter.copy();
playerFilter.add(new ControllerIdPredicate(playerId));
Target target = new TargetLandPermanent(amount, amount, playerFilter, true);
player.choose(outcome, target, source.getSourceId(), game);
for (UUID landId : target.getTargets()) {
Permanent permanent = game.getPermanent(landId);
if (permanent != null) {