Skill Element Resistance Query = Death

Hello,
I would like to make an element resistance query for the skill fomula, where the opponent dies immediately if he does not have this element resistance.

I've already cobbled one together, but it doesn't work.

As an example for Darkness (standard 9 in the element list):

b.elementRate(9) <- 0.5 ? b.hp - 0

What would be the correct code for this?

Edit: In my example, instant death should occur at equal to or below 50% Darkness ressistance.
Don't know the answer to your damage formula issue, but:

As an idea, you could set the Element Rate trait of a mob or character really high and accomplish the same effect. For example, Element Rate * 1000% against Dark will likely result in an instant death for a target when targeted by a Dark element attack.

Original thread: https://forums.rpgmakerweb.com/threads/skill-element-resistance-query-death.163271/