How to make a skill that attacks enemies also apply a state to all allies?

Right now I'm making a skill that's supposed to cast instant death on all foes, but inflicts the entire battle party with a state that causes them to gain no EXP to balance it out. I already have the formula in the damage formula in order to apply the state to the user (a.) or the target(s), (b.) but don't know how to apply the state to all battle party members. I think it's something with javascript and $Battle_Party something-or-other but since I don't know Javascript I will need someone to help me with the formula so I don't mess anything up while trying to guess what the formula actually is. Any help would be appreciated. Thanks.
There's not a single statement to apply something to the entire party, so the usual code looks something like this:
JavaScript:
$Game_Party.members().forEach(function(a) {a.addState(yourStateIdHere)})
This is a bit cumbersome, but it should do the trick.

Another option that's mechanically similar is to change your skill so instead of causing instant death, it applies "Special Effect: Escape", which causes the enemies to disappear without giving XP or items. While the effect isn't the same, it's easier to create.
Thanks for the help! Appreciate it!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-skill-that-attacks-enemies-also-apply-a-state-to-all-allies.124987/