Advertisement
Guest User

RD_Moogle_X_EquipSkillSystem_Options

a guest
Dec 11th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //RD_Moogle_X_EquipSkillSystem_Options.js
  2. //16_0724
  3. //v1.0
  4. //Last: 16_1207
  5.  
  6. var RD = RD || {};
  7. RD.MoogleX_EQS_Ops = RD.MoogleX_EQS_Ops || {};
  8. var Imported = Imported || {};
  9. Imported.RD_MoogleX_EQS_Ops = true;
  10.  
  11. /*
  12.  Instructions:
  13.  - Place this plugin directly underneath Moogle_X_EquipSkillSystem plugin.
  14.  
  15.  
  16. */
  17.  
  18. /*:
  19.  * @plugindesc v1.0 (Requires Moogle_X_EquipSkillSystem)
  20.  * @author RogueDeus
  21.  *
  22.  * @param Include Trait Skills
  23.  * @desc Will include skills gained through trait objects (like Equips & States) in Equip Pool. Still supports <EQS Ignore>
  24.  * @default true
  25.  *
  26.  * @param Enforce Skill Type Req
  27.  * @desc Disables equip skills when actor does not meet Skill Type access requirements.
  28.  * @default true
  29.  
  30.  
  31.  
  32.   DESCRIPTION:
  33.  
  34.   - Adds the option of enabling the need for actor available sTypes in order
  35.     to equip skills.
  36.  
  37.   - Adds the option of including trait gained skills in equip skills pool.
  38.  
  39.  
  40.   CREDITS:
  41.     Moogle_X for the great Skills Equip Plugin!
  42.  
  43.  
  44. */
  45.  
  46. (function($) {
  47. //==============================================================================
  48.  
  49.   $.Parameters = PluginManager.parameters('RD_Moogle_X_EquipSkillSystem_Options');
  50.   $.IncludeTraitSkills = eval($.Parameters['Include Trait Skills']);
  51.   $.EnforceSTypeReq = eval($.Parameters['Enforce Skill Type Req']);
  52.  
  53. //==============================================================================
  54. //Adding Skill Type Required filter to skill pool.
  55. //Adding 'trait' gained skills to skill pool.
  56. //Both, unless skill is listed as always available. <EQS Ignore>
  57.  
  58.  
  59. //Overwrite
  60. Game_Actor.prototype.skills = function() {
  61.   var list = this.getEqsArray();
  62.   list = list.filter(function(id) {
  63.     return id !== 0;
  64.   });
  65.  
  66.   if(!$.IncludeTraitSkills){
  67.     list = list.concat(this.addedSkills());
  68.   }
  69.  
  70.   var list2 = [];
  71.   list.forEach(function(id) {
  72.     if (!list2.contains($dataSkills[id])) {
  73.       list2.push($dataSkills[id]);
  74.     }
  75.   });
  76.  
  77.   this._skills.concat(this.addedSkills()).forEach(function(id) {
  78.     if (!list2.contains($dataSkills[id]) && $dataSkills[id].isEqsIgnore) {
  79.       list2.push($dataSkills[id]);
  80.     }
  81.   });
  82.   return list2;
  83. };
  84.  
  85. //Overwrite
  86. Game_Actor.prototype.getSkillPool = function(typeId) {
  87.   var array = this._skills;
  88.  
  89.   if($.IncludeTraitSkills){
  90.     array = array.concat(this.addedSkills());
  91.   }
  92.  
  93.   array = array.map(function(skillId) {
  94.       return $dataSkills[skillId];
  95.   });
  96.  
  97.   // Slot Type check addition.
  98.   array = array.filter(function(skill) {
  99.       return skill.eqsType === typeId);
  100.   });
  101.  
  102.   array = array.filter(function(skill) {
  103.       return skill.isEqsIgnore === false;
  104.   });
  105.  
  106.   if (Moogle_X.EQS.classRestrict) {
  107.       var legalSkills = this.eqsGetLegalSkills();
  108.       array = array.filter(function(skill) {
  109.           return legalSkills.contains(skill.id);
  110.       });
  111.   }
  112.  
  113.   return array;
  114. };
  115.  
  116.  
  117. //Overwrite
  118. Game_Actor.prototype.eqsIsLearnedSkill = function(skillId) {
  119.   // Party based skill pool.
  120.   if (Moogle_X.EQS.partySkillPool) {
  121.     var list = [];
  122.     for (var i = 0; i < $gameParty.allMembers().length; i++) {
  123.       var skillPool = $gameParty.allMembers()[i]._skills;
  124.       list = list.concat(skillPool);
  125.     }
  126.     return list.contains(skillId);
  127.  
  128.   } else if ($.EnforceSTypeReq) {
  129.     //Included check for skill type availability...
  130.     if(this._skills.concat(this.addedSkills()).contains(skillId)) {
  131.       return this.addedSkillTypes().contains($dataSkills[skillId].stypeId);
  132.     }
  133.  
  134.   } else {
  135.     return this._skills.contains(skillId);
  136.   }
  137. };
  138.  
  139. //==============================================================================
  140. })(RD.MoogleX_EQS_Ops);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement