Creating skills that affect actors/enemies with State X

I'm sorry in advance if this is the wrong place to post this kind of thread or if this has been asked before as I couldn't find a similar thread.

I'm using the YEP_AutoPassiveStates to essentially create traits that I can classify both actors and enemies.

For example: An enemy Wolf and an actor Dog would have the passive State called Canine

What I'm trying to create are skills that either work on only those that have a specific trait or that do extra for those with a specific trait.

At the moment I'm just trying to create a party buff skill that affects only actors on your team with the Canine trait.

So let's say a team of Human, Canine, Human, Canine. One of the humans uses a skill and only those two canines become affected. Is there a specific command for this or plugin for this?
Hunter's Strike
Deals slightly more damage than normal attack, if targeting a canine does 50% more damage and applies a bleed. If target is Human applies stun and base damage.

Code:
Game_Battler.prototype.Hunterstrike= function(a, b) {
if (a.isActor()) {                                     // if you want actors to use a different formula than enemies.
        damage = 50 + a.atk * 4 - b.def * 2             // base formula.
      if (b.isStateAffected(X)) {                     // if Canine State
            damage *= 1.5
            b.addStateCounts(Y)                        // adds Bleed State
    }
      else if (b.isStateAffected(Z)) {                // if Human State
            damage *= 1                               
             b.addState(S)                                // adds Stun
   }
else {                                                 // enemy formula section.
        damage = 50 + a.atk * 4 - b.def * 2
        damage = parseInt(damage)
        return damage
  }
    }



I suggest using complex damage formulas making a script, its easier than it sounds. You just write the code as above save as .js and add as plugin to the very top of the list. Then in your skills where it says Formula: a.Hunterstrike(a,b)
this calls the formula from your plugin.

If you want it simplier just make a formula Here is a good resource
a = user
b = target
isStateAffected(X) = a if you want to check user, b if you to check target, most skills with have b.

Keeping it simple: Does 50% more bonus damage, can plug right into formula.
if (b.isStateAffected(X)) 50 + a.atk*4 - b.def*2; else 1.5 * (50 + a.atk*4 - b.def*2);

For more complex I dont know how but check this skill out, you can try to rework it so that it targets all on screen and checks if its an enemy or actor, then checks if they are human or canine.
Thank you, I'll give the formula a shot, although I assume that if I decide to use that method that I would need a .js for each skill, right?
Hunter's Strike
Deals slightly more damage than normal attack, if targeting a canine does 50% more damage and applies a bleed. If target is Human applies stun and base damage.

Code:
Game_Battler.prototype.Hunterstrike= function(a, b) {
if (a.isActor()) {                                     // if you want actors to use a different formula than enemies.
        damage = 50 + a.atk * 4 - b.def * 2             // base formula.
      if (b.isStateAffected(X)) {                     // if Canine State
            damage *= 1.5
            b.addStateCounts(Y)                        // adds Bleed State
    }
      else if (b.isStateAffected(Z)) {                // if Human State
            damage *= 1                              
             b.addState(S)                                // adds Stun
   }
else {                                                 // enemy formula section.
        damage = 50 + a.atk * 4 - b.def * 2
        damage = parseInt(damage)
        return damage
  }
    }



I suggest using complex damage formulas making a script, its easier than it sounds. You just write the code as above save as .js and add as plugin to the very top of the list. Then in your skills where it says Formula: a.Hunterstrike(a,b)
this calls the formula from your plugin.

If you want it simplier just make a formula Here is a good resource
a = user
b = target
isStateAffected(X) = a if you want to check user, b if you to check target, most skills with have b.

Keeping it simple: Does 50% more bonus damage, can plug right into formula.
if (b.isStateAffected(X)) 50 + a.atk*4 - b.def*2; else 1.5 * (50 + a.atk*4 - b.def*2);

For more complex I dont know how but check this skill out, you can try to rework it so that it targets all on screen and checks if its an enemy or actor, then checks if they are human or canine.

So I ended up with this formula, I'm sorry it's the first time working with formulas so I'm not sure what might exactly be wrong.

Code:
Game_Battler.prototype.Kingofwolves= function(a, b) {
if (a.isActor()) {                                     
      if (b.isStateAffected(19)) {                     
            a.addBuff(2, 2); b.atk*90
            a.addBuff(6, 2); b.agi*90                        
    }
    }

This is supposed to be a skill that increases the atk and agi of all actors Canine for 2 turns by 90%. But when I test the skill, nothing changes. I'm assuming I either removed something I shouldn't have, or what I used is just outright wrong.
So I ended up with this formula, I'm sorry it's the first time working with formulas so I'm not sure what might exactly be wrong.

Code:
Game_Battler.prototype.Kingofwolves= function(a, b) {
if (a.isActor()) {                                   
      if (b.isStateAffected(19)) {                   
            a.addBuff(2, 2); b.atk*90
            a.addBuff(6, 2); b.agi*90                      
    }
    }

This is supposed to be a skill that increases the atk and agi of all actors Canine for 2 turns by 90%. But when I test the skill, nothing changes. I'm assuming I either removed something I shouldn't have, or what I used is just outright wrong.

Forgive me im rusty and relearning what I knew which wasnt all that much to begin.
What I suggested was for damage formulas, and no you dont need to create a plugin for each, you can just line them one after another, I believe when you put a.hunterstrike(a,b) in the formula box for skills it gets the value from plugin.

What you need to do to make this skill work since its a buff and not damage, is instead add this in the notetag and you'll need Yanfly Skill Core

Code:
<Before Eval>
if (b.isStateAffected(19)) {                   
            b.addBuff(2, 2); b.atk*90
            b.addBuff(6, 2); b.agi*90
         }
</Before Eval>

remember a.addBuff(2,2) will buff the caster not the target, use b. to affect everyone targeted.


BTW its optional to use "if (a.isActor()) { " I use this in my game so I can give my actors different skill and I dont need to make Ice skill for actors and remake Ice skill for enemies.
Forgive me im rusty and relearning what I knew which wasnt all that much to begin.
What I suggested was for damage formulas, and no you dont need to create a plugin for each, you can just line them one after another, I believe when you put a.hunterstrike(a,b) in the formula box for skills it gets the value from plugin.

What you need to do to make this skill work since its a buff and not damage, is instead add this in the notetag and you'll need Yanfly Skill Core

Code:
<Before Eval>
if (b.isStateAffected(19)) {                  
            b.addBuff(2, 2); b.atk*90
            b.addBuff(6, 2); b.agi*90
         }
</Before Eval>

remember a.addBuff(2,2) will buff the caster not the target, use b. to affect everyone targeted.


BTW its optional to use "if (a.isActor()) { " I use this in my game so I can give my actors different skill and I dont need to make Ice skill for actors and remake Ice skill for enemies.


Thanks! That worked! I think I can figure things out from here with this example. Thank for your help!

Original thread: https://forums.rpgmakerweb.com/threads/creating-skills-that-affect-actors-enemies-with-state-x.120577/