MV Joint Penalty doesn't work for me...

Hi!! I'm following Yanfly's tutorial to add Joint Penalty feature to my game. The thing is, when I try it, damage does not divide among the state holders and the state makes the attack deal MAX damage. Can someone help me and figure out why this happens? Take a look to my state and skill notebox:
Spoiler: Skill
1665637404335.png
Spoiler: State and full notebox code
1665637454774.png


JavaScript:
<Category: Bypass Death Removal>

<Custom React Effect>
// Check if the damage is positive.
if (value > 0) {
  // Get the living members of the same party.
  var members = target.friendsUnit().aliveMembers();
  // Make an empty group to list affected members.
  var affected = [];
  // We'll go through each member to check them.
  for (var i = 0; i < members.length; ++i) {
    // Getting the individual member.
    var member = members[i];
    // Does the member exist and is the member affected by state 91 (the Joint Penalty state)?
    if (member && member.isStateAffected(91)) {
      // If the member is affected, add it to the affected group.
      affected.push(member);
    }
  }
  // Divide up the damage by how many members are affected.
  value = Math.ceil(value / affected.length);
  // We'll go through each of the affected members now.
  for (var i = 0; i < affected.length; ++i) {
    // Getting the individual affected member.
    var member = affected[i];
    // Ignore the effect if the member is the target of attack.
    if (member !== target) {
      // Let's play animation 12 on the affected member.
      member.startAnimation(12);
      // The affected member takes damage.
      member.gainHp(-value);
      // We'll have the affected member reveal a damage popup.
      member.startDamagePopup();
      // Clear the results of the effect.
      member.clearResult();
      // Next, check to see if the member is dead.
      if (member.isDead()) {
        // If the member is dead, we'll make it collapse.
        member.performCollapse();
      }
    }
  }
}
</Custom React Effect>
is 91 also the state you used? if not, change that to 132 you want.
if you use magic attack on it, it doesn't work (as in the tutorial video),
only physical attacks.
if you use magic attack on it, it doesn't work...only physical attacks.
That doesn't appear to be correct - I don't see anything in his code that would do that.

is 91 also the state you used? if not, change that to 132 you want.
This is the answer to the problem.

damage does not divide among the state holders and the state makes the attack deal MAX damage.
I don't see anything here that could cause it to do maximum damage. See if it still looks off after you apply ShadowDragon's fix.
This is the answer to the problem.
It truly was. Thank you both 🙂

Original thread: https://forums.rpgmakerweb.com/threads/joint-penalty-doesnt-work-for-me.151939/