My first thought is to find a way to check if there are multiple targets and if so, divide the final exp by the number of targets...I'll dig around and see if there's a way to do this. Since you can choose multiple targets directly from the editor, I believe this is possible.
-UPDATE-
I've turned my focus to Yanfly's Target Core plugin, this code specifically:
Code:
<Custom Target Eval>
for (var i = 0; i < foes.aliveMembers().length; ++i) {
var member = foes.aliveMembers()[i];
if (member.level % 3 === 0) targets.push(member);
}
</Custom Target Eval>
The help file reads:
"The 'targets' variable is an array that determines which are the targets
to be used during the selection process. Push the desired targets into
the 'targets' array."
Try this:
Code:
<Post-Damage Eval>
$gameVariables.setValue(1, $gameVariables.value(1) + (36 / BattleManager._targets.length));
</Post-Damage Eval>
-UPDATE- 9:45pm
I just tried the code above with a skill that targets all enemies and while it didn't just crash the game, it didn't have the intended effect either,
and the reason is that the post damage eval runs every time the skill does damage...
try the after eval notetag:
<After Eval>
$gameVariables.setValue(1, $gameVariables.value(1) + 36);
</After Eval>
Gonna test this myself and see what I come up with.
-UPDATE- 10:45pm
I believe I have the solution:
Code:
<Custom Target Eval>
for (var i = 0; i < foes.aliveMembers().length; ++i) {
var member = foes.aliveMembers()[i];
if (member.name) targets.push(member);
$gameVariables.setValue(98, targets.length);
}
</Custom Target Eval>
<After Eval>
$gameVariables.setValue(99, $gameVariables.value(99) + (36 / $gameVariables.value(98)));
</After Eval>
These two evals should create the desired effect.
First, the custom eval returns the number of enemies targeted by the skill and stores it into variable 98.
Next, the after eval uses var 98 to divide the exp output by the number of targeted enemies.
One thing to note, the math behind this is not completely consistent. When tested against 1 and 4 enemies, both returned 36,
since 36 is a multiple of 4. When tested against 5 enemies, it returned 35. I'll work on this for a little bit longer tonight, and see what I can figure out with javascript's Math function by tomorrow evening. Maybe by then someone will have come along and finished the solution for us!