Damage Formula Help

Is there a way to check if the target and/or user has a particular state applied in the damage formula? I'm trying to create a few different states that increase damage delt/taken or skill cost by a specific integer.

For example, the formula would need to check if the target has state 14, if so then the target will take damage equal to the formula output +3. If they don't have state 14 then they would just take normal damage.

Likewise, if the user has state 15 then they would deal damage equal to the formula output +3. Or, if the user has state 16 then the mp cost of the skill is +2. It is possible that a target could have two different states that increase damage by a set integer. For example, state 15 will increase damage taken by 3 and state 18 will increase damage taken by 2.

The entire damage calculation should happen first, so any stat buff/debuffs or critical multipliers should all be settled, then additional points of damage would be applied.

For reference, here is my current damage formula. D = a damage rating from 1-10 that I assign to any given skill.

(((a.atk / b.def.to_f) * (D * 5)) * ((rand(36) + 60) / 100.to_f) + 1).to_i

Thanks for your help!
It'd be a.state?(1) or b.state?(10) or any other number IIRC.
How or where would I fit that in to the current formula?

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-help.163643/