Custom Skill Effects

Hi everyone! 😀


How would I go about setting a skill to behave differently according to the enemy's state?


For example, 


Poison Slash: If the enemy is affected by poison, this attack does 200% bonus dmg. If not, this attack does nothing.


Thank you for taking time to check this post out! ^__^


I am using Yanfly Engine so if there isn't a way to do this in the formula box, a yanfly lunatic mode effect would be great! I don't know enough js to utilize lunatic mode on my own T__T
I'm not certain of the exact code, but I think it goes something like this in the Skill Notes:


<damage formula>


value = user.atk * 4 - target.def * 2


if (target.isStateAffected(StateID)) {


value *= 2}


else {


value *= 0};


</damage formula>


You'll need the Yanfly DamageCore to use this code.  Basically, what it does is set the value first (based on whatever parameters you set, what I used is an example).  Then the if statement checks if the target has the poison state, then adjusts the formula accordingly.
You can do it in a normal damage formula if you'd prefer using this


b.isStateAffected(StateID)?(a.atk*4-b.def*2)*2:0


Explanation


b.isStateAffected(StateID)? = is the enemy effected by StateID


(a.atk*4-b.def*2)*2 = if effected, take damage formula and multiply it by 2


:0 = else do 0 (the : means else)      
thank you both for taking the time to help me! This answers the question completely I used both of your responses to get it done, thanks!! 😀
Hey yall! New question, is there anyway to alter a skills hit rate in the formula box? So for example:


attack: if user is affected by blind, hit rate = 0, else = (normal dmg rate here)


Edit:


I found the answer to this question digging around the forum! Thank you all for your help once again!

Original thread: https://forums.rpgmakerweb.com/threads/custom-skill-effects.60605/