So I have a system where you can use a skill to apply a state to yourself we’ll call it light 4. Then there are certain attacks that use this as a cost to activate. For example let’s say a skill costs 1 light it would remove light 4 and add light 3 in its place. The problem is sometimes the skills are removing the state entirely and not adding the new ones. Below is the code I’m using for these skills any help would be appreciated. Also the problem seems to mostly pop up on skills that hit more than one enemy.
State 15 is light 4
State 16 is light 3
State 17 is light 2
State 18 is light 1
<Custom Requirement>
if (user.isStateAffected(15) || user.isStateAffected(16) || user.isStateAffected(17) || user.isStateAffected(18)) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Before Eval>
if (user.isStateAffected(15)) {
user.addState(16);
user.removeState(15);
} else if (user.isStateAffected(16)) {
user.addState(17);
user.removeState(16);
} else if (user.isStateAffected(17)) {
user.addState(18);
user.removeState(17);
} else if (user.isStateAffected(18)) {
user.removeState(18);
}
</Before Eval>
State 15 is light 4
State 16 is light 3
State 17 is light 2
State 18 is light 1
<Custom Requirement>
if (user.isStateAffected(15) || user.isStateAffected(16) || user.isStateAffected(17) || user.isStateAffected(18)) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Before Eval>
if (user.isStateAffected(15)) {
user.addState(16);
user.removeState(15);
} else if (user.isStateAffected(16)) {
user.addState(17);
user.removeState(16);
} else if (user.isStateAffected(17)) {
user.addState(18);
user.removeState(17);
} else if (user.isStateAffected(18)) {
user.removeState(18);
}
</Before Eval>