Hi everybody, I'm stumped with trying to find a formula I need for a skill. It's supposed to deal damage to an unpredictable number of enemies that can be not all of them, and the damage is split between the targets affected.
The problem is that I can't find anything to put in the damage formula that would return the number of units affected so I can make the division.
The problem is that I can't find anything to put in the damage formula that would return the number of units affected so I can make the division.
What are you using to determine the number of targets? I'm guessing the Target Control plugin?
Edit: Assuming you are, this will work.
Code:
<Custom Target Eval>
targets = [];
for (var i = 0; i < foes.aliveMembers().length; ++i) {
var member = foes.aliveMembers()[i];
if (Math.random() < 0.3 && targets.length < foes.aliveMembers().length) { targets.push(member); }
}
this._targetCount = targets.length;
</Custom Target Eval>
<Damage Formula>
value = (a.atk / 2 - b.def / 4);
value /= this._targetCount;
</Damage Formula>