Add a condition to a state (Resolved)

Hello,
I have a little problem which I think the solution is very simple, but I can't solve it alone. I apologize in advance for opening a topic for this.

I use a state that causes the target affected by this state to always suffer a critical hit (we'll call it state A for the example).
Here is the script for this state:

Code:
<Custom Select Effect>
// Get the current skill
var skill = this.item();
// Check if the skill exists and can deal critical damage
if (skill && skill.damage.critical) {
  // Get the previous Critical Hit settings
  this._prevForcedCriticalHit = $gameSystem._forceCritical;
  this._prevForcedNoCriticalHit = $gameSystem._forceNoCritical;
  // Force the hit to be a critical hit
  BattleManager.actionForceCritical();
}
</Custom Select Effect>

<Custom Deselect Effect>
// Check if the previous settings exist
if (this._prevForcedCriticalHit !== undefined) {
  // Revert the Critical Hit settings to what they were before
  $gameSystem._forceCritical = this._prevForcedCriticalHit;
  $gameSystem._forceNoCritical = this._prevForcedNoCriticalHit;
}
</Custom Deselect Effect>

My problem is that in my game there is also a state that prevents the player from inflicting a critical hit (state B ).
For this one, I just changed the critical hit rate to -1000%.

As you will have understood, these two states come into conflict.
I would like to prioritize state B, but state A currently wins.
I think there is only one line to add, like "if the attacker is not affected by state B" but I really don't know javascript. I tried to get by with similar effects found on the internet, but it doesn't work.
Can somebody help me please ?
Nobody ?
However, I had the impression that the solution was easy for someone who knows JavaScript.
Did I explain my problem incorrectly?

@Jay19, please do not bump your topic unless it has been 24 hours later since your last post. You can review our forum rules here. Thank you.

Please have patience, it's likely that members who could help you just haven't been online since you posted.
Code:
<Custom Select Effect>
// Get the current skill
var skill = this.item();
// Check if the skill exists and can deal critical damage
if (skill && skill.damage.critical && !target.isStateAffected(n)) {
  // Get the previous Critical Hit settings
  this._prevForcedCriticalHit = $gameSystem._forceCritical;
  this._prevForcedNoCriticalHit = $gameSystem._forceNoCritical;
  // Force the hit to be a critical hit
  BattleManager.actionForceCritical();
}
</Custom Select Effect>

<Custom Deselect Effect>
// Check if the previous settings exist
if (this._prevForcedCriticalHit !== undefined) {
  // Revert the Critical Hit settings to what they were before
  $gameSystem._forceCritical = this._prevForcedCriticalHit;
  $gameSystem._forceNoCritical = this._prevForcedNoCriticalHit;
}
</Custom Deselect Effect>
Replace n with the id of "state B".
Hiddenone I'm really sorry. I will avoid doing this in the future.

Frostorm thank you very much for your reply. It works correctly, I just had to replace "target" with "user" (I never know which way to understand it but I know at least that when it's not one, it's the other ^^")
Thanks again =)
Ah sorry, I did it in a hurry. I had a hunch it was "user" but I posted that while driving.
No worries, you helped me a lot. And I now know that "!" means negation
Ah sorry, I did it in a hurry. I had a hunch it was "user" but I posted that while driving.
while driving?!

Original thread: https://forums.rpgmakerweb.com/threads/add-a-condition-to-a-state-resolved.149215/