MV Lowering a State Turns, using Yanfly Buff & States Core

Hello everyone!

I have a question, that got me stumped, so basically I have the state Petrify in my game, which after an X amount of turns inflicts the one affected with the Stone state(which is basically a Death State).

That is working fine with no issue, however as an interaction I want to have a character being able to inflict the Petrify state, and then with another skill lower the turn count of the State, I know I can do that with the notetag.

<State X Turns: -y>

However if there's less turns left than what the State has and I use the skill to lower the turns, instead of triggering the Custom Leave Effect it reacts as if it was Removed instead. I could put the effect of inflicting Stone as a Remove effect but that would mean that healing the state will make the player character end up being affected by Stone.

So my question is, is there a way to check for a remaining amount of turns in the state and if there is is there a way to use Yanfly notetags to do the check so that there's always at least 1 turn left on the state so that it triggers on its own on the opponent next turn? Basically something like:

Inflict petrify for 3 turns > Use skill that lowers petrify turn count -4 > Check is made so that Petrify is left with only 1 turn > Foe next turn triggers Stone
<Custom State X Turns>

turn >= 5 ? turn -=4 : turn = 1;

</Custom State X Turns>


That skill notetag takes off 4 turns from state X (returns 1 if the duration was lower than 5, when it would drop to 0)
Thank you so much it seems to be working properly just to verify with you if I would like the skill to lower just 2 turns and if less than that left the state in 1 turn. It would be.

<Custom State X Turns>
turn >= 3 ? turn -= 2 : turn = 1;
</Custom State X Turn>

Correct?
Yes. (But you have a typo (missing 's' from the final Turn(s))
The other way to write it, in case it makes more sense to you, would be Math.max() - whichever number is higher.
Code:
turn = Math.max(turn-4, 1);

Original thread: https://forums.rpgmakerweb.com/threads/lowering-a-state-turns-using-yanfly-buff-states-core.160127/