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:
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>