Untitled
unknown
plain_text
a year ago
2.0 kB
9
Indexable
/*:
* @plugindesc Skill Priority Plugin
* @author Your Name
*
* @help This plugin allows you to set a priority for skills so that you can
* create a skill that always goes first or a skill that always goes last.
*
* Plugin Command:
* SkillPriority skillId priority
* - skillId: The ID of the skill.
* - priority: The priority of the skill. Higher priority goes first.
*
* Note:
* - The default priority of skills is 0.
* - If two skills have the same priority, the order is determined by
* their speed.
*/
(function() {
var _Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
_Game_Action_apply.call(this, target);
this.subject()._priority = this.item().priority || 0;
};
Game_Unit.prototype.agility = function() {
return this.members().reduce(function(r, member) {
return r + member.agi * (member._priority || 0);
}, 0);
};
var _Game_Party_setupStartingMembers = Game_Party.prototype.setupStartingMembers;
Game_Party.prototype.setupStartingMembers = function() {
_Game_Party_setupStartingMembers.call(this);
this.members().forEach(function(member) {
member._priority = 0;
});
};
var _Game_Troop_setup = Game_Troop.prototype.setup;
Game_Troop.prototype.setup = function(troopId) {
_Game_Troop_setup.call(this, troopId);
this.members().forEach(function(member) {
member._priority = 0;
});
};
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'SkillPriority') {
var skillId = Number(args[0]);
var priority = Number(args[1]);
$dataSkills[skillId].priority = priority;
}
};
})();Editor is loading...
Leave a Comment