Game_Action.prototype.numRepeats = function() {
var repeats = this.item().repeats;
if (this.isAttack() || this.isPhysical()) {
repeats += this.subject().attackTimesAdd();
}
return Math.floor(repeats);
};
Game_Action.prototype.repeatTargets = function(targets) {
var repeatedTargets = [];
var repeats = this.numRepeats();
for (var i = 0; i < targets.length; i++) {
var target = targets[i];
if (target) {
for (var j = 0; j < repeats; j++) {
repeatedTargets.push(target);
}
}
}
return repeatedTargets;
};
Game_Action.prototype.evaluate = function() {
var value = 0;
this.itemTargetCandidates().forEach(function(target) {
var targetValue = this.evaluateWithTarget(target);
if (this.isForAll()) {
value += targetValue;
} else if (targetValue > value) {
value = targetValue;
this._targetIndex = target.index();
}
}, this);
value *= this.numRepeats();
if (value > 0) {
value += Math.random();
}
return value;
};