Currently I am using this code from one of Yanfly's tips and tricks videos. (Joint Penalty)
<Custom React Effect>
<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;
// 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;
// Ignore the effect if the member is the target of attack.
if (member !== target) {
// 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>
</Custom React Effect>
What this does is make it so that everyone with the affected state disperses their damage they take between each other based on how many characters have that status.
What I want to do is add some extra effects to this, namely:
1. The damage taken by the characters who have the state take element rates into consideration. (for instance, a character with 200% physical element rate would take double damage from the damage-dispersed attack but everyone else with the state who have 100% physical rate would take normal damage from it.)
2. The damage taken by the characters who have the state take defense into consideration.
3. The characters sharing damage also get any states that were inflicted on the target from the attack.
4. The damage taken by the characters who have the state take Yanfly's absorption barriers into consideration.
I've spent a few hours trying to figure this out myself with no luck. I've found a workaround for the second effect but it is a hassle.
I hope this made sense and if you need any clarifications I'd be happy to elaborate. Thanks in advance.
Edit: added a 4th thing I'd like it to do.