Function to determine the effect of a lightning bolt on a game character using "abilities"
I have asked that you provide more code, and I hope that you do.

Until then, I suggest you have a look at the Visitor Pattern and its implementation using multiple dispatch.

You have a lightning attack. You are applying certain effects, including some effects that are common to all attacks. 

You have not yet reached the point where some defenders will be immune to lightning, or take reduced damage, or immune to stun, but you will.

It makes more sense to Tell, don't Ask in thise situation. You tell the defender that they were attacked by lightning, and let the defender handle things. 

The default behavior would be substantially what you have shown. But you could then create a defender subclass that was immune to lightning, or suffered reduced damage, and the logic would be located with that particular defender, which improves your code organization and maintainability.

Beyond that, since your defender seems to be a class already (based on the code you have shown), it should be easy to encode the "standard attack checks" into the base class in a single method. You can then raise an exception or return a sentinel value to indicate that the attack is blocked due to stun or confusion, or just print out the results (not recommended).