Hi, so I'm currently trying to make a Frost effect for my game, and what I want it to do is reduce agility and the overall damage dealt with each stack. I'm currently testing it by having it apply to the current actor I'm using and replacing Agility with Defense so that I can visibly see if the change in damage. The damage-reducing effect works fine, but the lowering Defense part is not working and will prevent the state from stacking occasionally. Here's the code any help?
Code:
<Custom Apply Effect>
// Default the stockpile stacks to 0.
user._frost = user._frost || 0;
// Increase the stockpile stack by 1
user._frost += 1;
user.addDef(-0.15 * user._frost);
// Cap the stockpile stack at 4
user._frost = Math.min(user._frost, 4);
// Update the state counter for the stockpile stack
user.setStateCounter(stateId, user._frost);
</Custom Apply Effect>
<Custom Remove Effect>
// Set the user's stockpile stack to 0
user._frost = 0;
// Update the state counter for the stockpile stack
user.setStateCounter(stateId, user._frost);
</Custom Remove Effect>
<Custom Confirm Effect>
// Check if the user is delivering physical damage.
if (this.isPhysical() && value > 0 ) {
// Get the current number of stacks. Min 0, Max 4.
var stacks = user._frost;
// Calculate the extra damage rate from stacks.
var rate = 1.00 + stacks * -0.10;
// Round the damage upward.
value = Math.ceil(value * rate);
}
</Custom Confirm Effect>