Ducks break out of offensive slump with 5-2 win in Buffalo