@result.critical not working?

Due to my damage formula being complicated and not fitting in the editor text box, I've created methods for the damage formulas in the script. They've worked exactly as intended.


I have decided that, rather than a critical hit being a multiplier on the final damage, I would have it multiply the damage inflicted before defensive stats are factored in. I knew that whether a critical was scored was determined before the damage formula was calculated from prior testing, so I thought using "@result.critical" as the base scripts do, as in the code that factors in the critical multiplier—


value = apply_critical(value) if @result.critical


—would work perfectly fine. So this is the script for the (physical) damage formula with the code for critical damage added:


def calc_phys(b)
a = self
damage = a.atk ** 0.500 * 2 / 3 * a.xstat.dam
damage *= (1.00 + a.luk * 0.01) if @result.critical
reduce = 1.000 - (b.def ** 0.900 * 0.01)
damage = damage * reduce - b.xstat.abs
return damage
end


However, "@result.critical" does not work here. The formula will only do standard damage when a critical hit is scored. The multiplier works if the "if @result.critical" is removed.


What is the issue here, and if I cannot use "@result.critical" here, how can I work around this?
I've moved this thread to Learning RGSS. Please be sure to post your threads in the correct forum next time. Thank you.
How did you know that you are indeed making a critical hit?


Right now what I'm sure of is that the code runs and doesn't encounter an error because if it does, your damage formula will return 0 (coz that's how it was designed, instead of showing the error it just makes the damage as 0). That means that it is indeed able to check @result.critical but seemingly it always returns false for your tests. 

Original thread: https://forums.rpgmakerweb.com/threads/result-critical-not-working.70450/