How to check what a punch has hit?

I have a character that throws punches.
I added a collision capsule attached to the character’s hand and, when he attacks, this capsule checks for overlaps and applies damage if it overlaps an enemy. I’m using Unreal’s “Apply damage” and “Apply point Dagame” prebuilt nodes.

It’s working as expected and the punches are doing damage to the enemies.

Now I would like to make so that if the character punches a wall or rock, or anything that isn’t an enemy or a destructible item, the punch animation stops and another animation plays (an animation of his hand bouncing back, making clear that whatever he has hit is too hard and didn’t take damage).
But I’m having trouble finding a way to do that. I don’t want to have to check against every type of ‘punchable’ actor in the game.
Also sometimes enemies are invincible and I would like the punch to stop when hitting an invincible enemy too, so even checking if the other actor is an enemy is not enough.
What I wanted is something that returns a bool that confirms that this punch was “successful” or not (in other words, that whatever was punched took damage or not), but I don’t know how to do that.

Have you considered using “Can be Damage” bool? Every actor has it:

You can just set it, manually or in the ctor or begin play for those actors that can suffer damage and then when you punch you just need to check the bool of the hitted actor:

That’s a way to do it, at least it differentiates between ‘punchable’ things and ‘unpunchable’ things. However it doesn’t really tell me things like “is the enemy temporarily invincible?”. I can try to cast to every type of enemy to check the “isInvincible” variable, but I would like a simpler/ more elegant solution.

temporarily invincible => set Can be damage to false.

or (if the enemies don’t inherited from the same parent):

temporary invincible => set tag “invincible” => if hitted and hasTag “invincible” then it’s invincible.

or (if the enemies inherited from the same parent):

set a bool isInvincible in the parent, and therefore, no need to cast to every type of enemy

or (if your enemies have an health component or any other common component):

same principle as above