MV (Yanfly MV) how to make a skill increase it's chance to inflict a base paramater debuff the lower their HP is ?

using my knowledge trough yanfly plugins i came up with this
<Pre-Damage Eval>const hpLossFactor = Math.min(0.5, 0.1 * Math.floor(4 / (1 - user.hpRate()))); if (Math.random() <= 0.10 + hpLossFactor) { target.addDebuff(3, 3);
}</Pre-Damage Eval>
the idea is for 25% HP loss they get the debuff chance infliction increases by 20% but for somereason this doesn't work
am i missing something?
When posting code, please use line breaks and put it inside CODE tags (the </> on the edit bar) - that's pretty illegible.

Code:
Math.floor(4 / (1 - user.hpRate()))
I don't think that does what you want it to do. For example, if the user happens to be at full health, you're going to get a non-numeric result (Infinity) which will make the entire variable assignment error out as undefined.

If they're missing 25% health, then you're saying "round down 4 / .75" which equals 5.

0.5 will always be less than that.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-mv-how-to-make-a-skill-increase-its-chance-to-inflict-a-base-paramater-debuff-the-lower-their-hp-is.173204/