Once, during an online multiplayer game, back when Moon Lord was just added (IIRC, it's been a while), I had pirates invade 3 times in a row before I could even start exploring hard mode and get some hard mode gear. The second I'd try, YARR!!! and they are back.
And of course this was when I was the only person online, so I was defending against them with online stats on (expert) hard mode with my normal mode gear. And I had nothing built up to prepare against an attack, so I basically died over and over as I slowly built a trench where I could fight them.
When the pirate NPC moved in, I made a very special room for him.
View attachment 297947
I mean I've probably had worse luck before... I've over a thousand hours in Terraria over the years and I've had all sorts of stuff happen to me, but this stuck out.