heroofhyla

StateUnsealsSkillType.js

Jan 5th, 2017
1,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * @plugindesc Provides a tag that allows you to unseal particular skill types with a state
  3.  * Also grays out the skill type in the command window when the skill type is unavailable
  4.  *
  5.  * @help
  6.  * Use the tag <unsealskilltype:3> for example, to unseal skilltype #3
  7.  *
  8.  * No warranty, express or implied. I can't guarantee that it will
  9.  * work at all. If it's useful to you, credit is appreciated.
  10.  * You may redistribute, but do not remove any of the above.
  11.  */
  12.  
  13. (function(){
  14.  
  15. Game_BattlerBase.prototype.isSkillTypeSealed = function(stypeId) {
  16.     var unseals = [];
  17.     this._states.forEach(function(state) {
  18.         meta = $dataStates[state].meta.unsealskilltype;
  19.         if (meta){
  20.             unseals.push(Number(meta));
  21.         }
  22.     });
  23.    
  24.     if (unseals.contains(stypeId)){
  25.         return false;
  26.     }
  27.     return this.traitsSet(Game_BattlerBase.TRAIT_STYPE_SEAL).contains(stypeId);
  28. };
  29.  
  30. Window_ActorCommand.prototype.addSkillCommands = function() {
  31.     var skillTypes = this._actor.addedSkillTypes();
  32.     skillTypes.sort(function(a, b) {
  33.         return a - b;
  34.     });
  35.     skillTypes.forEach(function(stypeId) {
  36.         var name = $dataSystem.skillTypes[stypeId];
  37.         this.addCommand(name, 'skill', !this._actor.isSkillTypeSealed(stypeId), stypeId);
  38.     }, this);
  39. };
  40.  
  41. })();
Advertisement
Add Comment
Please, Sign In to add comment