Localized energy for wave equations with degenerate trapping