State that does different things based on having another state?

Can I have an ability that casts a state on the entirety of both teams

that let's say if the afflicted is Water Type (Has Water State)
every turn the initial state lasts, they regen 5% HP

If the afflicted is not Water Type (No Water State)
it does nothing?
With Yanfly's Buffs and States Core you can do it like this. The state will be applied to every combatant (however you have it set up) then when they would regenerate HP, if they have the water type state, they will receive the hp regeneration.
Code:
<Custom Regenerate Effect>
if (user.isStateAffected(WATER_STATE_ID)) {
  user.gainHp(user.mhp * 0.05)
}
</Custom Regenerate Effect>
With Yanfly's Buffs and States Core you can do it like this. The state will be applied to every combatant (however you have it set up) then when they would regenerate HP, if they have the water type state, they will receive the hp regeneration.
Code:
<Custom Regenerate Effect>
if (user.isStateAffected(WATER_STATE_ID)) {
  user.gainHp(user.mhp * 0.05)
}
</Custom Regenerate Effect>
Thank you so much I wasn't sure if it would work the same as target.isStateAffected 😅
Thank you so much I wasn't sure if it would work the same as target.isStateAffected 😅
user as a term refers to the actor or troop enemy in which the state is applied. So if everyone has the state, they're all users in this instance since it refers to themself.
user as a term refers to the actor or troop enemy in which the state is applied. So if everyone has the state, they're all users in this instance since it refers to themself.
Ah okay, thank you I understand now 🙂

Can I make it work as

<Custom Regenerate Effect> if (user.isStateAffected(WATER_STATE_ID)) { user.gainHp(user.mhp * 0.05) } else (user.isStateAffected(FIRE_STATE_ID)) { user.gainHp(user.mhp * -0.05) } </Custom Regenerate Effect>

So that fire types lose 5% per turn under this effect?
You'll need to use 'else if' to run a block of code based on a second condition.
'Else' is used to run a code block if the first condition is false.

Spoiler: Else if
JavaScript:
<Custom Regenerate Effect>
if (user.isStateAffected(WATER_STATE_ID)) {
  user.gainHp(user.mhp * 0.05);
} else if (user.isStateAffected(FIRE_STATE_ID)) {
  user.gainHp(user.mhp * -0.05);
}
</Custom Regenerate Effect>
you can probably dispense with the whole plugin and configurations by sorting out the synergy of vulnerability/resistance within the states themselves.

have your battlers be 100% resistant to the HP regen state or element, and 100% vulnerable to the water state.
then, have the water state make them 0% resistant to the HP regen state.
when HPR state drops on a 100% resistant battler, it'll bounce off, unless they're previously affected by the water state.
if you want to drop the water state, have another state *make* the user 100% resistant to both the water state and itself.
when that state drops on a battler, it'll pop the water state out, and then itself, making the battler again 100% resistant to HPR.

no conditionals, no plugins, no nothing... the game engine proper is already doing the validation FOR you! no need to put another validation on top!
Thank you guys, I used @ThreeSixNine's method and than added in Math.floor to round the numbers to non repeating decimal numbers, so my code looks like this for reference:

<Custom Regenerate Effect> user.startAnimation(330); if (user.isStateAffected(230)) { user.gainHp(Math.floor(user.mhp * 0.05)) } if (user.isStateAffected(232)) { user.gainHp(Math.floor(user.mhp * -0.05)) } </Custom Regenerate Effect>
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/state-that-does-different-things-based-on-having-another-state.156359/