Attack it immediately after it enters a door - such attacks count as a surprise hit and always hit the target. The giant crab was added to the game for this very reason - to teach new players about surprise hits. You know the attack was a surprise hit when there is a flash of a yellow exclamation mark over the target.
Also, if you're posting about something from the mods, and not the original game, you'd better mention it. Just a simple courtesy.