Looking js for "BIO IMMUNE" state

Hi, I am new one with less understanding in js...
I am try build a buff named "Bio immune" but my poor Js knowledge was defeat me...

My idea is "Bio immune" is a passive buff effect with will 50% prevent "Bio" category debuff applying (in my idea "poison", "burning", "hurt" are category as "Bio")
& each time " Bio immune" was effect trigger( mean success block "poison" being apply) user will heal 5% Hp.

I using Yanfly plugin in majority. I can create passive state, state category, and regen effect. But no idea resist rate in js .Thank for someone who will teach me the Js.
See, I don't understand much JS as I'm learning it myself.

But now, I don't mean to sound rude or come across as insensitive. But wouldn't it be better to ask someone in your native language to teach you JS? As a lot of communication is required between student and Teacher.

Now if I'm understanding this right, you may not need JS to do what you are after.

Do you want a state that will have a 50% chance of protecting your character against the debuff "Bio"?

If the effect fails then the character will heal 5% of there HP?

So enemy casts "Bio" on Character 1.

The "Bio" effect doesn't affect the character 1 and Character 1 heals 5% HP

is this what you are after?

Original thread: https://forums.rpgmakerweb.com/threads/looking-js-for-bio-immune-state.88651/