State-dependant additional effects in skills

I have a skill called "Bash" that deals moderate damage normally, but I would like it to deal much more if the target is stunned. I'm planning several other skills with effects based on things like target HP% and states also, but am pretty new to this side of RPG Maker-ing.

So what i need to know is: how do i set a skill to have additional effects based on the target (or user's) state and/or stats? If anyone can point me to a thread (I'm sure one exists, but my Google-fu is weak) I would appreciate it.

I'm currently using Yanfly scripts to avoid compatibility issues. I'm sure there's a way to do this within these scripts, but I is a dummy.

I've moved this thread to Plugin Support. Thank you.

To help with your Bash skill doing more damage, you can achieve this through the damage formula:
b.isStateAffected(12) ? a.atk * 10 - b.def * 2 : a.atk * 4 - b.def
Change 12 to whatever StateID your Stun state is in the database.

As for user's state, just replace the beginning 'b' with 'a'.

Mr. Trivel has a great post for damage formulas here that might be able to help with what you are wanting to accomplish:
https://www.rpgmakercentral.com/topic/36290-damage-formulas-101-mv-edition/
Thank you so much! I appreciate your help and the link!

Original thread: https://forums.rpgmakerweb.com/threads/state-dependant-additional-effects-in-skills.100269/