Ok, I've been messing around with this to increase the chance that the state lands depending on the state the actor has.
This is what I got:
Code:
<Pre-Damage Eval>
if (user.isStateAffected(x) && Math.random() < 0.05) {
target.addState(n);
} else {
if (user.isStateAffected(y) && Math.random() < 0.1) {
target.addState(n);
} else {
if (user.isStateAffected(z) && Math.random() < 0.2) {
target.addState(n);
} else {
if (Math.random() < 0) {
target.addState(n);
}}
</Pre-Damage Eval>
I don't know if it's correct or if I'm just unlucky enough that I keep getting bad rolls when testing.
And before anyone asks I've figured out how to remove state x if y is in place and both x & y if z is in place.
I also tried with a skill that does it with multiple states:
Code:
<Pre-Damage Eval>
if (user.isStateAffected(x) && Math.random() < 0.05) {
target.addState(n);
} else {
if (user.isStateAffected(y) && Math.random() < 0.1) {
target.addState(n);
} else {
if (user.isStateAffected(z) && Math.random() < 0.2) {
target.addState(n);
} else {
if (Math.random() < 0) {
target.addState(n);
}}
if (user.isStateAffected(a) && Math.random() < 0.03) {
target.addState(o);
} else {
if (user.isStateAffected(b) && Math.random() < 0.05) {
target.addState(o);
} else {
if (user.isStateAffected(c) && Math.random() < 0.09) {
target.addState(o);
} else {
if (Math.random() < 0.01) {
target.addState(o);
}}
</Pre-Damage Eval>
Is my math correct?