use of mage.abilities.effects.common.SacrificeEffect in project mage by magefree.
the class TectonicHellionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Map<UUID, Integer> landMap = new HashMap<>();
game.getState().getPlayersInRange(source.getControllerId(), game).forEach(uuid -> landMap.put(uuid, game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, uuid, source.getSourceId(), game).size()));
int max = landMap.values().stream().max(Integer::compare).get();
Effect effect = new SacrificeEffect(StaticFilters.FILTER_LANDS, 2, "");
game.getState().getPlayersInRange(source.getControllerId(), game).stream().filter(uuid -> landMap.getOrDefault(uuid, 0) == max).forEachOrdered(uuid -> {
effect.setTargetPointer(new FixedTarget(uuid, game));
effect.apply(game, source);
});
return true;
}
Aggregations