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 TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterPermanent(), true);
if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
return false;
}
controller.chooseTarget(Outcome.Detriment, target, source, game);
if (target.getTargets().size() > 0) {
int sacrificedCreatures = target.getTargets().size();