<Custom Apply Effect>
// The number of damage before the shield wears off.
user._Protect = Math.floor(target.luk * 2);
// Set the state counter to display damage shield amount left.
user.setStateCounter(stateId, user._Protect);
</Custom Apply Effect>
<Custom Remove Effect>
// Remove the damage needed to expire the shield.
user._Protect = undefined;
// Reset the state counter.
user.setStateCounter(stateId, 0);
</Custom Remove Effect>
<Custom React Effect>
// Check if the action deals HP damage.
if (this.isHpEffect() && value > 0) {
// Play an animation on the target.
target.startAnimation(53);
// Calculate the amount of HP to reduce.
var reduce = Math.min(value, target._Protect);
// Reduce that from the value.
value -= reduce;
// Reduce that value from the shield amount.
target._Protect -= reduce;
// Set the state counter to reflect the new damage shield amount left
target.setStateCounter(stateId, target._Protect);
// Create a text to display.
var text = "<CENTER>" + target.name() + "'s protection aura blocks " + reduce + " damage."
// Set the wait time.
var wait = 90;
// Display the text.
BattleManager.addText(text, wait);
}
// Check if the damage shield is exhausted
if (target._Protect <= 0) {
// Then remove the state.
target.removeState(stateId);
}
</Custom React Effect>