Questions on Basic Damage Formula

I made Aura skill.

Using the Aura skill adds state(98) to the user and state(99) to the alliance.(and user too)
ㄴThe plug-in automatically adds state(99) to the alliance when the user is state(98).

98 has Only Mana Decrease Penalty.
99 has only benefits.(No mana Penalty)

So i need a function that allows users to cancel State(98).
for save there own mana

I used the basic formula of MV.

제목 없음.png


a.isStateAffected(98) ? a.removeState (98); 0 : a.addState (98); 100

Of course it didn't work properly.
But, the formula works perfectly when only the damage is set.

I don't know what mistake there is.

Why is this happening?
If you need multiple statements (separated by ;) in each branch, use a full if statement instead of the conditional operator.

Try one of these instead:
  1. Result is 0 if the state was removed, or 100 if it was added:
    JavaScript:
    if (a.isStateAffected(98)) { a.removeState(98); 0 } else { a.addState(98); 100 }
  2. Result is always 0:
    JavaScript:
    a.isStateAffected(98) ? a.removeState(98) : a.addState(98); 0
If you need multiple statements (separated by ;) in each branch, use a full if statement instead of the conditional operator.

Try one of these instead:
  1. Result is 0 if the state was removed, or 100 if it was added:
    JavaScript:
    if (a.isStateAffected(98)) { a.removeState(98); 0 } else { a.addState(98); 100 }
  2. Result is always 0:
    JavaScript:
    a.isStateAffected(98) ? a.removeState(98) : a.addState(98); 0
This formula (the second one) works perfectly. Thank you very much!

Original thread: https://forums.rpgmakerweb.com/threads/questions-on-basic-damage-formula.130899/