@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getTargetId());
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
Target target = new TargetControlledCreaturePermanent(1, Integer.MAX_VALUE, filter, true);
target.setRequired(false);
if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
return false;
}
if (controller.chooseUse(Outcome.Detriment, "Devour creatures?", game)) {
controller.chooseTarget(Outcome.Detriment, target, source, game);
if (target.getTargets().size() > 0) {
List<ArrayList<String>> cardSubtypes = new ArrayList<>();
int devouredCreatures = target.getTargets().size();
game.informPlayers(new StringBuilder(creature.getName()).append(" devours ").append(devouredCreatures).append(" creatures").toString());
for (UUID targetId: target.getTargets()) {
Permanent targetCreature = game.getPermanent(targetId);
if (targetCreature != null) {
cardSubtypes.add((ArrayList<String>) targetCreature.getSubtype());
}
if (targetCreature == null || !targetCreature.sacrifice(source.getSourceId(), game)) {