Advertisement
heroofhyla

skillsOnlyBattleWindow.js

Dec 27th, 2016
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * @plugindesc Shows only a listing of all an actor's skills in the
  3.  * actor command window
  4.  * @author Michael Stroud
  5.  * @param showAttackCommand
  6.  * @desc if "1" and if the attack skill is not sealed, show the "Attack" command.
  7.  * @default 0
  8.  * @param showItemCommand
  9.  * @desc if "1", show the "Item" command
  10.  * @default 0
  11.  * @param showGuardCommand
  12.  * @desc if "1" and if the guard skill is not sealed, show the "Guard" command
  13.  * @default 0
  14.  * No warranty, express or implied. I can't guarantee that it will
  15.  * work at all. If it's useful to you, credit is appreciated.
  16.  * You may redistribute, but do not remove any of the above.
  17.  *
  18.  */
  19.  
  20. (function(){
  21.     var parameters = PluginManager.parameters('skillsOnlyBattleWindow');
  22.     var showAttackCommand = Number(parameters['showAttackCommand'] || 0);
  23.     var showItemCommand = Number(parameters['showItemCommand'] || 0);
  24.     var showGuardCommand = Number(parameters['showGuardCommand'] || 0);
  25.     Window_ActorCommand.prototype.makeCommandList = function() {
  26.         if (this._actor) {
  27.             this.addEachSkillCommand();
  28.         }
  29.     };
  30.    
  31.     Window_ActorCommand.prototype.addEachSkillCommand = function() {
  32.         var skills = this._actor.usableSkills();
  33.         if (showAttackCommand && !this._actor.isSkillSealed(1)){
  34.             this.addAttackCommand();
  35.         }
  36.         skills.forEach(function(skill) {
  37.             var name = skill.name;
  38.             this.addCommand(name, 'singleSkill', true, skill);
  39.         }, this);
  40.         if (showGuardCommand && !this._actor.isSkillSealed(2)){
  41.             this.addGuardCommand();
  42.         }
  43.         if (showItemCommand){
  44.             this.addItemCommand();
  45.         }
  46.     };
  47.    
  48.     Scene_Battle.prototype.commandSingleSkill = function() {
  49.         var skill = this._actorCommandWindow.currentExt();
  50.         var action = BattleManager.inputtingAction();
  51.         action.setSkill(skill.id);
  52.         BattleManager.actor().setLastBattleSkill(skill);
  53.         this.onSelectAction();
  54.     };
  55.    
  56.     Scene_Battle.prototype.createActorCommandWindow = function() {
  57.         this._actorCommandWindow = new Window_ActorCommand();
  58.         this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
  59.         this._actorCommandWindow.setHandler('singleSkill', this.commandSingleSkill.bind(this));
  60.         this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
  61.         this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
  62.         this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
  63.         this.addWindow(this._actorCommandWindow);
  64.     };
  65. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement