Code:
<Custom Apply Effect>
if (target._stateTurns[13] >= 25) {
target._stateTurns[13] = 25;
}
</Custom Apply Effect>
<Custom Apply Effect>
target._mercuryPoison = Math.ceil(origin.atk * 0.5 * target.elementRate(13));
crit = origin.luk / 5
</Custom Apply Effect>
<Custom Remove Effect>
target._mercuryPoison = undefined;
</Custom Remove Effect>
<Custom Regenerate Effect>
target._mercuryPoison = target._mercuryPoison || Math.ceil(origin.atk * 0.5);
// target.startAnimation(12);
v = Math.floor(Math.random()*100)+1
if (v >= crit)
{
target.gainHp(-target._mercuryPoison);
}
else
{
target.gainHp(-target._mercuryPoison * 2);
}
target.startDamagePopup();
if (target.isDead()) {
target.performCollapse();
}
target.clearResult();
</Custom Regenerate Effect>
This is a piece of code I use. This piece of code is on a state designated to a Bleeding effect, which deals damage based on the user's Attack stat. Within this code, you will notice the following line:
v = Math.floor(Math.random()*100)+1
This line is used to run a check, out of 100, to see if the damage dealt by the bleed effect will be critical or not. I believe you could modify this code (not just this 1 line) to do what you want to do.
Code:
v = Math.floor(Math.random()*100)+1
if (v >= crit)
{
target.gainHp(-target._mercuryPoison);
}
else
{
target.gainHp(-target._mercuryPoison * 2);
}
In this section here, it runs a check out of 100, and it checks the value of variable "crit" (which is set earlier to be equal to the user's luck divided by 5, but you would define it as whatever you want the chance to be for the freeze effect to break), then, there is the if statement, which determines what will happen. It states that if V is greater than or equal to Crit, damage will be dealt normally (in your case, the freeze effect would remain), Else, the damage will be critical, and therefore multiplied by 2 (or in your case, the freeze effect would end.
I have not tested it myself, but I've tinkered with lunatic mode codes within states, this should be able to do what you want it to.
If you can't get it figured out, add me on discord and I'll give you a hand tomorrow. This is definitely something I can figure out for you.
Zerothedarklord#8459