How to create a condition to check states in battle

I am using MV and I was wondering how would I check if an actor in battle has two specific states. What I want to trying to do is if you have two required states the game erases those two states if you have them and you get a new state. I believe it could be done with Yanfly's Action Sequence (http://yanfly.moe/2015/10/11/yep-4-action-sequence-pack-1/) I think.

Here's an example of what I want: for example your actor gets the state "Sleep" and "Poisoned" the game would cure these two states and give the actor a new state, for the sake of example we will call it the "Sick" state.
You could try something like this with the damage formula:

Code:
if (b.isStateAffected(sleepId)) {b.removeState(sleepId); b.addState(sickId)} else {b.addState(poisonId)}; damage formula

Alternatively, you should be able to use Yanfly's Buffs States and use the 'custom apply effect' notetags to check for states and act accordingly. I Don't know the right code for that top off my head, though.

http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)
You could try something like this with the damage formula:

Code:
if (b.isStateAffected(sleepId)) {b.removeState(sleepId); b.addState(sickId)} else {b.addState(poisonId)}; damage formula

Alternatively, you should be able to use Yanfly's Buffs States and use the 'custom apply effect' notetags to check for states and act accordingly. I Don't know the right code for that top off my head, though.

http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)

I did try to input the damage formula in the editor but it didn't work. I am supposed to put in it in the notetag as a action sequence?

I looked in my game and I already have the Buff and States Core. I want to possible at these to attacks and buff skills. If you figure the code for the Buffs and States Core could you let me know.
bump
bump

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-a-condition-to-check-states-in-battle.111352/