MZ VisuStella Skills & States Core - Passive States Cancelling Out

I'm using VisuStella Skills and States Core to apply a couple of different global passive states, but they seem to be conflicting with each other. The first passive state is for "hard mode" -- I have it set to be a global enemy passive, it applies only when a certain switch is on, and it boosts the enemy's parameters by 170%. This works fine on its own. The second passive state is one of several states that create a "terrain type" in the battle, which affects element rates and nothing else; these states are set as global passives, and only apply when a certain variable has a specific value. These also work fine on their own.

However, when I switch the variable that controls terrain type during a battle, my enemies temporarily lose the parameter boosts from the hard mode state, and then regain the bonuses at the end of the turn. This is reflected in their HP: since MHP is one of the parameters affected, when it's not being boosted the enemy's HP is cut, and then when it's boosted again they don't regain the HP they lost. See the below gif if that doesn't make sense.

mhpGif2.gif


So the enemy's HP loses that 70% boost -- an enemy with a base 100 HP should be boosted to 170, but because the state gets cancelled, it drops back down to 100. If I change the terrain type a second time, it looks like the enemy regains that lost HP, but I'm pretty sure what's happening is its MHP is dropping down to base level, making it appear to be gaining HP when it's really not. Then at the end of the turn it gets the boost back again and looks the way it did before. Again, see the gif below.

mhpGif3.gif


I recreated this issue in a demo project without any extraneous code or plugins (aside from the Core Engine and Battle Core). You can download it here if you want to take a look. The "terrain switch" item can be used to change the terrain variable during battle.

I've tried a couple of different things to solve this problem, and haven't had any success. I tried making separate versions of the terrain states for hard mode specifically, with the parameter boosts built in, but this didn't change anything. I also tried restoring enemy HP at the end of every turn, but this didn't work out -- partially because I'm making use of instant skills and those disrupt the turn order, and partially because I couldn't come up with a good way to avoid restoring HP lost from actual attacks. If anyone has any better suggestions for how to fix this, either through plugins/JS or just some workaround, I'd really appreciate it! Thanks!
Please post screenshots/notetags of the states.
Please post screenshots/notetags of the states.
The "hard mode" state:
Screenshot 2024-02-19 at 09.39.47.png


One of the "terrain type" states (the notetag is the same across all of them, just with a different value to check against):
Screenshot 2024-02-19 at 09.40.05.png
Just as an efficiency tip, any time you're doing just one thing from the result of a boolean (conditional), you can skip the braces and if/else and all that. e.g.
Code:
condition = $gameVariables.value(3) == 1;

But it looks like your stuff is set up correctly.

The obvious thing to check is that you aren't accidentally manipulating the hard mode switch.

So when you start a turn with the terrain and you see the hard mode stuff deactivate, press F8, go to the Console tab, and paste in
Code:
$gameSwitches.value(67)

That will tell you what the current value of the switch is. If you verify in the console that the switch is on, but the passive state is deactivated as if it were off, you should file a bug report with VisuStella.
Just as an efficiency tip, any time you're doing just one thing from the result of a boolean (conditional), you can skip the braces and if/else and all that. e.g.
Code:
condition = $gameVariables.value(3) == 1;

But it looks like your stuff is set up correctly.

The obvious thing to check is that you aren't accidentally manipulating the hard mode switch.

So when you start a turn with the terrain and you see the hard mode stuff deactivate, press F8, go to the Console tab, and paste in
Code:
$gameSwitches.value(67)

That will tell you what the current value of the switch is. If you verify in the console that the switch is on, but the passive state is deactivated as if it were off, you should file a bug report with VisuStella.
Thank you for the tip! I was going to submit a bug report, but I noticed I'd missed a couple plugin updates, and they added a feature that actually addresses this issue ("switch refresh" and "variable refresh" options). Now that I've updated and enabled those, everything is working correctly.

Original thread: https://forums.rpgmakerweb.com/threads/visustella-skills-states-core-passive-states-cancelling-out.165940/