State that spreads to target's allies

In my game I have a state, Blight, that does a small amount of damage over time and reduces the target's stats. I'd like to make a stronger variant of this called Plague that also has a chance to spread to the target's allies at the end of turn (before it is potentially removed).

The only idea I had was using this.members() to generate an array and then using a foreach condition, but the script I had doesn't work and I don't know enough about JavaScript to know why it doesn't.

Code:
<Custom Apply Effect>
var enemies = this.members();
enemies.foreach(isAlive() {
var spread = Math.floor(Math.random());
if (spread<0.1) { enemies.members().addState(13) }
})
</Custom Apply Effect>


I did find one forum post a while back where someone had made a plugin that produces this effect, but that link is now broken.
.

From Yami's signature. Signatures are hidden by default.
Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/state-that-spreads-to-targets-allies.150042/