By the way, it's worth mentioning that even if the resistance works, the spell was still cast.
as an alternative:
5.2. Hit-and-run is prohibited: the attacking hero is not allowed to retreat in the first round of battle if they cast an offensive spell. This prohibition does not apply to the hero who is defending.