Can't make finishing attack deal extra damage to weak enemies

So I'm trying to make a Coup de Grace attack where the damage dealt is only 1.1*attack under normal circumstances, but it jumps up to 10*attack if the enemy is under 20% HP. However, all of the formulas I've tried so far just do not work at all.

Using
Code:
if b.state?(20% hp weakness state); (extra damage formula); else; (Normal formula); end;
doesn't work: It either defaults to the normal formula, crashes, or deals 0 damage depending on how I word it.

The same thing happens with
Code:
if b.hp <= b.mhp/5; (extra damage formula); else; (normal formula); end;
It always deals 0 damage.

Substituting the if function for the question mark and colon doesn't do anything either.

It doesn't seem to be detecting whether the if statement is true or not. I am doing the tests in-game, and it doesn't seem to make a difference. I've also been trying to use Lunatic Damage, but with no actual results. Oddly, using only the notetags and LD for the formula makes it deal no damage no matter what I put in. It's starting to get on my last nerves. Has anyone got a tested and working custom formula for this simple task?
Try this setup:
Code:
b.hp_rate < 0.2 ? a.atk * 10 : a.atk * 1.1
Try this setup:
Code:
b.hp_rate < 0.2 ? a.atk * 10 : a.atk * 1.1

That seemed to work for the most part. Unfortunately, it's about at the character limit. The full code ended up being:
Code:
b.hp_rate<=0.25?((1000-b.def)*a.atk*10/1000)-(b.def**0.9):((1000-b.def)*a.atk*1.1/1000)-(b.def**0.9)

I kind of feel stupid for not realizing hp_rate was a usable variable. Anyways, this is solved. Thanks for the solution!

Original thread: https://forums.rpgmakerweb.com/threads/cant-make-finishing-attack-deal-extra-damage-to-weak-enemies.85626/