Skill that checks for State

I would like to have a skill check for the presence of a state on the targeted enemy, then this occurs:

Damage from skill formula

if State is present an effect(Extra Damage occurs)

State is removed




Thank you in advance,

GEA
I think you can do it with formulas using:

if (b.isStateAffected(n)) { damage_formula_1 } else { damage_formula_2 } b.removeState(n)

where n is the index of the State in your database. It's been a little while since I've written formulas in MV so my syntax could be wrong, but this general idea should be how you do it.

EDIT: See Silva's response below. He is right that the "remove state" phrase has to be moved.
@Wavelength has the right idea, but because damage is equal to the last line of the formula the example will evaluate "damage = b.removeState(n)", so damage will always be undefined. You can restructure it like so

Code:
if (b.isStateAffected(n)) { b.removeState(n); damage_formula_1 } else { damage_formula_2 }
will try these in the next few days. Thank both of you guys.
@Silva Right on. Thanks for that catch.
Worked perfectly. Thanks a lot.

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-checks-for-state.115616/