Skill that deals damage based on # of statuses?

I had gotten an idea for a skill that I think makes sense to put on a class that inflicts, and takes advantage of, various states and debuffs. As the thread title says, I would like to see if it's possible to make a skill that does more damage based on the number of states that the target has. However, looking around the forums for a topic where this was already asked turned up nothing and I don't even know where to begin for experimenting in RMVXA.

So I guess the core question is can the game track the number of states that an actor or enemy has, or do I need to make/add a script to do this?

...Now that I think about it, I guess it'd also make sense to limit the damage increase to only certain states, but I just need to see if it's possible to do what I'm thinking of in the first place.
I don't believe the engine tracks the total number of states inflicted to an actor/enemy (to be held in a variable), but instead just checks for each one and processes them when needed to. Therefore you might need to look for a scripted solution if your game uses many states. There may be some cases where the custom damage formula won't have enough room to handle each check. (it has a character limit)

Once again, it depends on how many possible states your game has that the skills are affected by.

Edit: I ninja'd shaz but his answer is better and mine was wrong.
In the damage formula, you could use a.states.size to get the number of states on the user of the skill, or b.states.size to get the number of states on the target.


Note this would include ALL states. If you only wanted to search for specific states, it'd be a bit more complex (you'd have to do a selection) and it might not fit into the damage formula, so you might end up needing a script.
@Shaz: I will be honest, I wasn't expecting such a simple solution to my question! O:

Just for the sake of knowing, how would i go about a selection? Would I still need states.size?
b.states.select {|state| [1,3,5,6,7,8].include?(state.id)}.sizewould tell you how many states in that list are applied to the target. But as I said, once you get to listing individual states, it starts chewing up your real estate, and you run out of room for the actual damage formula.In that case, add the following script to a new slot:

class Game_BattlerBase def damage_states_size @states.select{|id| [1,3,5,6,7,8].include?(id)}.size endendand then in your damage formula you can just do b.damage_states_size - and modify the array in the script to include the state ids you're wanting to include.Note - I haven't tested that. Let me know if it gives you any errors (and the exact text).
I love how every new thing I learn blows my mind. Thank you for your help Shaz, you are a wonderful presence on these forums.

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-deals-damage-based-on-of-statuses.37964/