I've tried them a few times with different set-ups and couldn't quite get them, Spazmatism's cursed flame breath always gets me. I've managed to beat the other two mechanical bosses though.
The tactic I've tried so far was: frost armour, nimbus rod, megashark (sometimes onyx blaster if they get close) with explosive bullets, leaf wings, ranger emblem, philosopher's stone, moon charm, worm scarf, lightning boots, and the usual buff potions.
The screenshot also shows my main equipment and some my arena.
Any help? Should I change my accessories, weapons, or entire strat?