std::visit([id](auto &&stack) {
    std::function<void(decltype(stack.getType()), decltype(stack.getType()))> f;
    int i = 0;
    std::apply([id, &f, &i](auto &&... args) mutable {
        ((f = (i++ == id) ?
              args.template buildDefaultEffect<decltype(stack.getType())>() : f), ...);
    }, EffectsTuple);
    stack.addEffect(std::move(f));
}, enginePtr->functionList);
std::visit applies the lambda to the vector functionList. The lambda, applies the lambda inside of it to the EffectsTuple.
However, I'm having a hard time understanding
((f = (i++ == id) ?
              args.template buildDefaultEffect<decltype(stack.getType())>() : f), ...);
What does the outer most () does? what is the second argument ...? What does args.template mean?