if (controller != null) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
// only creatures of controller & target opponent
if (permanent.getControllerId().equals(source.getControllerId()) || permanent.getControllerId().equals(targetOpponent.getId())) {
UUID newController = permanent.getControllerId().equals(source.getControllerId()) ? targetOpponent.getId() : source.getControllerId();
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, true, newController);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
permanent.untap(game);
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
}
}
return true;
}