Making skill effects contingent on state.

The basic idea is this: Several skills are marked as Breakable; they're rather powerful skills, but the risk of getting Broken balances them out. There is also a state called Broken.

If you try and use a Breakable skill while Broken, the skill does nothing and you are Stunned (which forces you to skip your next turn completely).

The idea being that the Skill that inflicts Broken is faster than all Breakable skills, but only inflicts it until the end of the turn. So, if you predict a Breakable skill, you inflict Broken to Stun them; if you guessed wrong, you wasted the turn.
Let's assume your Broken state's ID is 11 and stun's ID is 4:

Spoiler: Formula
a.isStateAffected(11) ? a.addState(4) : (formula)
Perfect. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/making-skill-effects-contingent-on-state.134479/