How to make a skill do more damage according to target's stack counter?

I'm completely unfamiliar with javascript, so I've been playing by ear, altering some examples by yanfly.

I'm trying to get a skill to do more damage when the target has higher stacks of a state.
I'm unsure if the solution would be to change the state's script or to change the skill's script so I'm adding both here:

State

<Custom Apply Effect>
target._explosiveStacks = target._explosiveStacks || 0;
target._explosiveStacks += 1;
var stacks = target._explosiveStacks.clamp(0, 2);
target.setStateCounter(102, 'x' + stacks);
</Custom Apply Effect>

<Custom Remove Effect>
target._explosiveStacks = 0;
var stacks = target._explosiveStacks.clamp(0, 2);
target.setStateCounter(102, 'x' + stacks);
</Custom Remove Effect>

Skill

<Custom Execution>
if target.isStateAffected(102) {
var rate = 1.00 + stacks * 0.50;
value = Math.ceil(value * rate);
}
</Custom Execution>
👋 Your state notetags look like they should be OK, maybe try this for your skill notetag:
Code:
<Pre-Damage Eval>
if (target.isStateAffected(102)) {
  var stacks = target.getStateCounter(102);
  var rate = 1 + stacks * 0.5;
  value = Math.ceil(value * rate);
}
</Pre-Damage Eval>
Relevant plugin links: http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP) http://www.yanfly.moe/wiki/Skill_Core_(YEP)
Thanks for the response!
The code didn't work at first, but I edited a line to reference the stacks and it works fine 🙂

This is what it is now:

<Pre-Damage Eval>
if (target.isStateAffected(102)) {
var stacks = target._explosiveStacks.clamp(0, 2);
var rate = 1 + stacks * 0.5;
value = Math.ceil(value * rate);
}
</Pre-Damage Eval>

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-skill-do-more-damage-according-to-targets-stack-counter.112236/