Well, I have issues to make this script work and now I dont have any ideas how to fix it.
I'm using in this script Yanfly Buffs StatesCore and Skill Core.
What I'm trying to do is an "dice system", where 1 attack yourself, 2 and 3 miss, 4~9 deal just part of the damage, 10~15 deal the normal damage, 16~19 deal a second hit that do just deal part of the original damage and 20 that deal two hits with normal damage.
Just ignore the "state system" that I'm working with and the Post-Damage Eval.
OBS: The action 10 is a miss action.
I'm using in this script Yanfly Buffs StatesCore and Skill Core.
What I'm trying to do is an "dice system", where 1 attack yourself, 2 and 3 miss, 4~9 deal just part of the damage, 10~15 deal the normal damage, 16~19 deal a second hit that do just deal part of the original damage and 20 that deal two hits with normal damage.
Just ignore the "state system" that I'm working with and the Post-Damage Eval.
JavaScript:
<Before Eval>
user._d = Math.randomInt(19) + 1;
if (user._d > 20) {
user._d = 20;
}
if (user._d < 1) {
user._d = 1;
}
user._c = Math.randomInt(99) + 1;
var damage = user.mat / 3 + 2;
if (user._c <= user.luk) {
var damage = damage * 2;
}
if (user._d === 1) {
user.gainHp(damage - target.mdf);
user.startAnimation(122);
user.startDamagePopup();
user.clearResult();
if (user.isStateAffected(16) === true) {
user.removeState(16);
user.addState(13);
}
if (user.isStateAffected(12) === true) {
user.addStateCounter(12, 1);
} else {
user.addState(12);
user.setStateCounter(12, 1);
}
if (user.getStateCounter(12) >= 4) {
user.removeState(12);
user.addState(13);
}
if (user.isStateAffected(14) === true) {
user.addStateCounter(12, -1);
}
if (user.getStateCounter(14) <= 0) {
user.removeState(14);
}
}
if (d > 1 && d <4) {
user.forceAction(10, -2);
}
if (user._d > 3 && user._d <6) {
target.gainHp(damage * 0.25 - target.mdf);
} else if (user._d > 5 && user._d < 8) {
target.gainHp(damage * 0.5 - target.mdf);
} else if (user._d > 7 && user._d <10) {
target.gainHp(damage * 0.75 - target.mdf);
} else if (user._d > 10 && user._d <21) {
target.gainHp(damage - target.mdf);
}
target.startAnimation(122);
target.startDamagePopup();
target.clearResult();
}
if (user._d > 15 && user._d <18) {
target.gainHp(damage * 0.25 - target.mdf);
} else if (user._d > 17 && user._d <20) {
target.gainHp(damage * 0.5 - target.mdf);
} else if (user._d === 20) {
target.gainHp(damage - target.mdf);
}
user.startAnimation(122);
user.startDamagePopup();
user.clearResult();
}
</Before Eval>
<Post-Damage Eval>
if (user._d >= 4) {
if (target.isStateAffected(16) === true) {
target.removeState(16);
target.addState(13);
}
if (target.isStateAffected(12) === true) {
target.addStateCounter(12, 1);
} else {
target.addState(12);
target.setStateCounter(12, 1);
}
if (target.getStateCounter(12) >= 4) {
target.removeState(12);
target.addState(13);
}
if (target.isStateAffected(14) === true) {
target.addStateCounter(12, -1);
}
if (target.getStateCounter(14) <= 0) {
target.removeState(14);
}}
</Post-Damage Eval>
OBS: The action 10 is a miss action.