Created
December 21, 2015 01:33
-
-
Save hajimehoshi/3317ee9e1d52ef5b996b to your computer and use it in GitHub Desktop.
RPG Maker MV: Bug fix in Game_Action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Game_Action.prototype.decideRandomTarget = function() { | |
var target; | |
if (this.isForDeadFriend()) { | |
target = this.friendsUnit().randomDeadTarget(); | |
} else if (this.isForFriend()) { | |
target = this.friendsUnit().randomTarget(); | |
} else { | |
target = this.opponentsUnit().randomTarget(); | |
} | |
if (target) { | |
this._targetIndex = target.index(); | |
} else { | |
this.clear(); | |
} | |
}; | |
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; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment