Something similar happened to me when first played FireRed and my pokemon can't beat Misty in the Cerulean City Gym :V
Said the exact same thing when I was paired up with only use struggle and they had an x defend on. 4 hp left. Champion Iris used Hyper Potion. Bruh.
I also know this feeling. One time I was close to beating someone and then they used a full restore and it took me a while to get their Pokemon on low health. It's so painful to watch all of your work go to waste ;-;