Guest User

Untitled

a guest
May 26th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.98 KB | None | 0 0
  1. //=============================================================================
  2. /*:
  3. * @plugindesc v1.00 (Requires YEP_EquipBattleSkills.js and YEP_X_EquipSkillTiers ) An Extenstion to Yanfly Equip Battle Skills Plugin
  4. * @author Zarsla
  5. *
  6. * @param Minimum Tier 1
  7. * @type number
  8. * @min 0
  9. * @desc The number of skills that must be equipped for Tier 1
  10. * @default 0
  11. *
  12. * @param Minimum Tier 2
  13. * @type number
  14. * @min 0
  15. * @desc The number of skills that must be equipped for Tier 2
  16. * @default 0
  17. *
  18. * @param Minimum Tier 3
  19. * @type number
  20. * @min 0
  21. * @desc The number of skills that must be equipped for Tier 3
  22. * @default 0
  23. *
  24. * @param Minimum Tier 4
  25. * @type number
  26. * @min 0
  27. * @desc The number of skills that must be equipped for Tier 4
  28. * @default 0
  29. *
  30. * @param Minimum Tier 5
  31. * @type number
  32. * @min 0
  33. * @desc The number of skills that must be equipped for Tier 5
  34. * @default 0
  35. *
  36. * @param Minimum Tier 6
  37. * @type number
  38. * @min 0
  39. * @desc The number of skills that must be equipped for Tier 6
  40. * @default 0
  41. *
  42. *
  43. * @help
  44. * ============================================================================
  45. * Introduction
  46. * ============================================================================
  47. *
  48. * This plugin requires YEP_EquipBattleSkills. Make sure this plugin is located
  49. * under YEP_EquipBattleSkills in the plugin list.
  50. *
  51. * This plugin adds Optional Extenstions to Yanfly Equip Battle Skills &
  52. * Yanfly Equip Battle Skills Tiers
  53. *
  54. * Minimum Tier X:
  55. * Where Tier X has a minimum number of skills that must be equipped.
  56. * If it's set to 0, then there is no minimum requirement however if it is more
  57. * 0, that will be the number of skills that must be equipped
  58. * This Requires YEP_X_EquipSkillTiers
  59. *
  60. *
  61. *
  62. * Script Calls:
  63. * replace "actor" with:
  64. * $gameActors.actor(z) where z is the actor id.
  65. * $gameParty.members()[y-1] where y is the postion the member is.
  66. *
  67. *
  68. *
  69. * actor.isSkillEquipped(y)
  70. * Checks if actor has skill y equipped returns true or false
  71. *
  72. * actor.isNotSkillEquipped(y)
  73. * Checks if actor does not has skill y equipped returns true or false
  74. *
  75. *
  76. * $gameParty.alterMaxTier(x, y)
  77. * Increase or Decrease the maximum amount of skills that can be be equipped for each tier.
  78. * Where x is the tier id and y is the amount you want to add or subtract to
  79. * maximum amount
  80. * Note the maximum can't go over the maximum number of skills that can be equipped.
  81. * This Requires YEP_X_EquipSkillTiers
  82. * Examples:
  83. * $gameParty.alterMaxTier(1, 2) increases the maximum amount of tier 1 skills that can
  84. * be equipped by 2.
  85. * $gameParty.alterMaxTier(3, -2) decreases the maximum amount of tier 3 skills that can
  86. * be equipped by 2.
  87. *
  88. *
  89. *
  90. * $gameParty.setMaxTier(x, y)
  91. * Sets the maximum amount of Tier x slots.
  92. * For example if the hardcode limit is 10 for tier 1.
  93. * Use this to set it to 12 or 8.
  94. * This Requires YEP_X_EquipSkillTiers
  95. * Examples:
  96. * $gameParty.setMaxTier(3, 12) sets the maximum amount of skills that can be equipped for Tier 3 to 12.
  97. * $gameParty.setMaxTier(6, 8) sets the maximum amount of skills that can be equipped for Tier 6 to 8.
  98. *
  99. *
  100. * $gameParty.alterMinTier(x, y)
  101. * Increase or Decrease the minimum amount of skills that must be equipped for each tier.
  102. * Where x is the tier id and y is the amount you want to add or subtract to
  103. * minimum amount
  104. * Note the minimum can't go over the maximum number of skills that can be equipped.
  105. * This Requires YEP_X_EquipSkillTiers
  106. * Examples:
  107. * $gameParty.alterMinTier(1, 2) increases the minimum amount of tier 1 skills that must
  108. * be equipped by 2.
  109. * $gameParty.alterMinTier(3, -2) decreases the minimum amount of tier 3 skills that must
  110. * be equipped by 2.
  111. *
  112. * $gameParty.setMinTier(x, y)
  113. * Sets the minimum amount of Tier x slots.
  114. * For example if the hardcode minimum limit is 1 for tier 1.
  115. * Use this to set it to 0 or 2.
  116. * This Requires YEP_X_EquipSkillTiers
  117. * Examples:
  118. * $gameParty.setMinTier(3, 0) sets the minimum amount of skills that must be equipped for Tier 3 to 0.
  119. * $gameParty.setMinTier(6, 3) sets the minimum amount of skills that must be equipped for Tier 6 to 3.
  120. *
  121. *
  122. * $gameParty.alterMaxSlots(y)
  123. * Increase or Decrease the maximum amount of skill slots, of the hardcoded limit.
  124. * For example if the hardcode limit is 10. Use this to increase it to 12. Or decrease
  125. * it for 8. Note this is for the entire party not just a single actor.
  126. * Examples:
  127. * $gameParty.alterMaxSlots(2) increases the max amount of skills by 2.
  128. * $gameParty.alterMaxSlots(-2) decreases the max amount of skills by 2.
  129. *
  130. *
  131. * $gameParty.setMaxSlots(y)
  132. * Sets the maximum amount of skill slots, of the hardcoded limit.
  133. * For example if the hardcode limit is 10. Use this to set it to 12 or 8.
  134. * Examples:
  135. * $gameParty.setMaxSlots(12) sets the max amount of skills to 12.
  136. * $gameParty.setMaxSlots(8) sets the max amount of skills to 8
  137. *
  138. * ============================================================================
  139. * Changelog
  140. * ============================================================================
  141. *
  142. * Version 1.00:
  143. * - Finished Plugin!
  144. */
  145. //=============================================================================
  146.  
  147. var parametersPlugin = PluginManager.parameters('ZE_YEP_EBS');
  148.  
  149. Game_Actor.prototype.isSkillEquipped = function(skillId) {
  150. return this.battleSkills().contains($dataSkills[skillId]);
  151. };
  152.  
  153. Game_Actor.prototype.isNotSkillEquipped = function(skillId) {
  154. return !this.battleSkills().contains($dataSkills[skillId]);
  155. };
  156.  
  157. Game_Party.prototype.alterMaxSlots = function(amount) {
  158. var amount = Number(amount);
  159. amount = amount.clamp(1, amount);
  160. Yanfly.Param.EBSMaxSlots = Yanfly.Param.EBSMaxSlots.clamp(1, Yanfly.Param.EBSMaxSlots);
  161. Yanfly.Param.EBSMaxSlots += amount;
  162. Yanfly.Param.EBSMaxSlots = Yanfly.Param.EBSMaxSlots.clamp(1, Yanfly.Param.EBSMaxSlots);
  163. };
  164.  
  165. Game_Party.prototype.setMaxSlots = function(amount) {
  166. var amount = Number(amount);
  167. amount = amount.clamp(1, amount);
  168. if(Yanfly.Param.EBSMaxSlots > amount){
  169. var diff = Yanfly.Param.EBSMaxSlots - amount;
  170. $gameParty.alterMaxSlots(-diff);
  171. } else if(Yanfly.Param.EBSMaxSlots < amount){
  172. var diff = amount - Yanfly.Param.EBSMaxSlots;
  173. $gameParty.alterMaxSlots(diff);
  174. }
  175.  
  176. };
  177.  
  178.  
  179. if (Imported.YEP_X_EquipSkillTiers) {
  180. var TierMinimum = [];
  181. for (i = 1; i <= 6; ++i) {
  182. var line = "Number(parametersPlugin['Minimum Tier " + i + "'])";
  183. TierMinimum[i] = eval(line);
  184. TierMinimum[i] = TierMinimum[i].clamp(0, TierMinimum[i]);
  185. }
  186.  
  187. Game_Party.prototype.alterMinTier = function(tier, amount) {
  188. var tier = tier.clamp(1, tier);
  189. var amount = Number(amount);
  190. TierMinimum[tier] += amount;
  191. TierMinimum[tier] = TierMinimum[tier].clamp(0, TierMinimum[tier]);
  192. };
  193.  
  194. Game_Party.prototype.setMinTier = function(tier, amount) {
  195. var tier = tier.clamp(1, tier);
  196. var amount = Number(amount);
  197. if(TierMinimum[tier] > amount){
  198. var diffe = TierMinimum[tier];
  199. diffe -= amount;
  200. $gameParty.alterMinTier(tier, -diffe);
  201. } else if(TierMinimum[tier] < amount){
  202. var diffe = amount;
  203. diffe -= TierMinimum[tier];
  204. $gameParty.alterMinTier(tier, diffe);
  205. }
  206. };
  207.  
  208. Game_Party.prototype.alterMaxTier = function(tier, amount) {
  209. var tier = tier.clamp(1, tier);
  210. var amount = Number(amount);
  211. Yanfly.Param.ESTierMaximum[tier] += amount;
  212. Yanfly.Param.ESTierMaximum[tier] = Yanfly.Param.ESTierMaximum[tier].clamp(1, Yanfly.Param.ESTierMaximum[tier]);
  213. };
  214.  
  215. Game_Party.prototype.setMaxTier = function(tier, amount) {
  216. var tier = tier.clamp(1, tier);
  217. var amount = Number(amount);
  218. if(TierMinimum[tier] > amount){
  219. var differs = TierMinimum[tier];
  220. differs -= amount;
  221. $gameParty.alterMaxTier(tier, -diffe);
  222. } else if(TierMinimum[tier] < amount){
  223. var differs = amount;
  224. differs -= TierMinimum[tier];
  225. $gameParty.alterMaxTier(tier, differs);
  226. }
  227. };
  228.  
  229.  
  230. Window_SkillEquipStatus.prototype.drawTierInfo = function(tier, dx, dy, dw) {
  231. var icon = Yanfly.Icon.ESTier[tier];
  232. var name = Yanfly.Param.ESTierName[tier];
  233. var ibw = Window_Base._iconWidth + 4;
  234. this.resetTextColor();
  235. this.drawIcon(icon, dx + 2, dy + 2);
  236. this.drawText(name, dx + ibw, dy, dw - ibw);
  237. var cur = this._actor.getEquipSkillTierCount(tier);
  238. var max = this._actor.getEquipSkillTierMax(tier);
  239. var text = cur + '/' + max;
  240. if (cur > max) {
  241. this.changeTextColor(this.powerDownColor());
  242. } else if (cur < TierMinimum[tier] && TierMinimum[tier] > 0) {
  243. this.changeTextColor(this.powerDownColor());
  244. } else if (cur === max) {
  245. this.changeTextColor(this.crisisColor());
  246. } else {
  247. this.changeTextColor(this.normalColor());
  248. }
  249.  
  250. this.drawText(text, dx + ibw, dy, dw - ibw, 'right');
  251. };
  252.  
  253. Game_Actor.prototype.equipSkillTiersOk = function() {
  254. var tiers = $gameSystem.usedSkillTiers();
  255. for (var i = 0; i < tiers.length; ++i) {
  256. var tier = tiers[i];
  257. var cur = this.getEquipSkillTierCount(tier);
  258. var max = this.getEquipSkillTierMax(tier);
  259. if (cur > max) return false;
  260. if (cur < TierMinimum[tier] && TierMinimum[tier] > 0) return false;
  261. }
  262. return true;
  263. };
  264. }
Add Comment
Please, Sign In to add comment