How to check if enemy is electrocutable?

If an enemy is not electrocutable the hero’s wizardry does not continue.
So you might have to check the enemy’s type.

Is there any item that does something like “isElectrocutable(enemy)” or something like “enemy.isElectrocutable” or do I really need to check types?

When exactly is an enemy not electrocutable?
Do you observe a special condition under which enemies are not electrocutable (like enemy-type, -position or -health)?

You are of course checking to make sure the power is on first, right?

.isReady(“electrocute”)

Not doing so is how I usually get my hero to stand there like a fool. :wink:
(with me bad mouthing her for just standing there)

A “palisade” is also an enemy (returned by using findNearestEnemy()).
I tried it in keeping-time. At some point i got the error message “Target must be an electrocutable unit.”.
Now i’m checking enemy types, but I’m still curious about if there’s an item or some other function for checking this.

1 Like

:wink: been there … now I’m checking

I’m baffled. It never occurred to me that there might be any non-living enemy. By this logic doors also shouldn’t be electrocutable.
Can you open a new issue on GitHub about it? This way the developers of CC can see it and try to find a solution. Just send me a PM if you can’t, I’m currently on my mobile and GitHub and my mobile don’t like each other, so I can do it when I’m back home.

Done that. See github issue