Rewriting this in the damage formula, so always crit when state applied

The below formula can be changed to give a flat N% crit chance, but i was wondering if there was a way to alter this so that if the user, or maybe the target has a state, the attack results in a critical hit

b.result.critical = false; b.result.critical = true if rand(100) < 100;

Edit: This is for a basic attack that does 1 damage without the state per hit, and would do 2 with the state per hit. So if there is some way i could write that in the formula. That would be good as well
Code:
  def apply_critical(damage)
    damage * 3
  end

That's the corresponding algorithm for critical damage so... 1 * 3... Well, you've gotta have deduced the rest by now.

Original thread: https://forums.rpgmakerweb.com/threads/rewriting-this-in-the-damage-formula-so-always-crit-when-state-applied.125871/