Advertisement
Double_X

DoubleX RMMV Unison Item Compatibility v100a

Sep 9th, 2019 (edited)
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*============================================================================
  2.  *    ## Plugin Info
  3.  *----------------------------------------------------------------------------
  4.  *    # Plugin Name
  5.  *      DoubleX RMMV Unison Item Compatibility
  6.  *----------------------------------------------------------------------------
  7.  *    # Terms Of Use
  8.  *      1. Commercial use's always allowed and crediting me's always optional.
  9.  *      2. You shall keep this plugin's Plugin Info part's contents intact.
  10.  *      3. You shalln't claim that this plugin's written by anyone other than
  11.  *         DoubleX or my aliases. I always reserve the right to deny you from
  12.  *         using any of my plugins anymore if you've violated this.
  13.  *      4. CC BY 4.0, except those conflicting with any of the above, applies
  14.  *         to this plugin, unless you've my permissions not needing follow so.
  15.  *      5. I always reserve the right to deny you from using this plugin
  16.  *         anymore if you've violated any of the above.
  17.  *----------------------------------------------------------------------------
  18.  *    # Prerequisites
  19.  *      Plugins:
  20.  *      1. DoubleX RMMV Unison Item Config
  21.  *      Abilities:
  22.  *      1. Nothing special
  23.  *----------------------------------------------------------------------------
  24.  *    # Links
  25.  *      This plugin:
  26.  *      1. https://pastebin.com/DN5fRYnF
  27.  *      Mentioned Patreon Supporters:
  28.  *      https://www.patreon.com/posts/71738797
  29.  *----------------------------------------------------------------------------
  30.  *    # Instructions
  31.  *      1. Place this plugin below all DoubleX RMMV Unison Item plugins
  32.  *----------------------------------------------------------------------------
  33.  *    # Author
  34.  *      DoubleX
  35.  *----------------------------------------------------------------------------
  36.  *    # Changelog
  37.  *      v1.00a(GMT 1000 9-9-2019):
  38.  *      1. 1st version of this plugin finished
  39.  *============================================================================*/
  40. /*:
  41.  * @plugindesc Fixes DoubleX RMMV Unison Item compatibility issues
  42.  * @author DoubleX
  43.  *
  44.  * @help
  45.  *============================================================================
  46.  *    ## Addressed Plugins
  47.  *----------------------------------------------------------------------------
  48.  *    # Yanfly Engine Plugins - Skill Core Extension - Party Limit Gauge:
  49.  *      1. The party limit gauge requirement isn't the same with the payment
  50.  *         - Reference tag: YEP_X_PartyLimitGauge_MultiplyPartyLimitCost
  51.  *         - Multiplied partyLimitCost in canPayPartyLimitCost and
  52.  *           drawPartyLimitCost by Math.max(meta.unisonItemActors.length, 1)
  53.  *============================================================================
  54.  */
  55.  
  56. var DoubleX_RMMV = DoubleX_RMMV || {};
  57. DoubleX_RMMV['Unison Item Compatibility'] = 'v1.00a';
  58.  
  59. /*============================================================================
  60.  *    ## Plugin Implementations
  61.  *       You need not edit this part as it's about how this plugin works
  62.  *----------------------------------------------------------------------------
  63.  *    # Plugin Support Info:
  64.  *      1. Prerequisites
  65.  *         - Basic knowledge of what DoubleX RMMV Unison Item Config and each
  66.  *           addressed plugin does
  67.  *         - Some plugin development proficiency to fully comprehend this
  68.  *           plugin
  69.  *      2. Function documentation
  70.  *         - The 1st part describes why this function's rewritten/extended for
  71.  *           rewritten/extended functions or what the function does for new
  72.  *           functions
  73.  *         - The 2nd part describes what the arguments of the function are
  74.  *         - The 3rd part informs which version rewritten, extended or created
  75.  *           this function
  76.  *         - The 4th part informs whether the function's rewritten or new
  77.  *         - The 5th part informs whether the function's a real or potential
  78.  *           hotspot
  79.  *         - The 6th part describes how this function works for new functions
  80.  *           only, and describes the parts added, removed or rewritten for
  81.  *           rewritten or extended functions only
  82.  *         Example:
  83.  * /*----------------------------------------------------------------------
  84.  *  *    Why rewrite/extended/What this function does
  85.  *  *----------------------------------------------------------------------*/
  86. /* // arguments: What these arguments are
  87.  * functionName = function(arguments) { // Version X+; Hotspot
  88.  *     // Added/Removed/Rewritten to do something/How this function works
  89.  *     functionContents
  90.  *     //
  91.  * } // functionName
  92.  *----------------------------------------------------------------------------*/
  93.  
  94. if (DoubleX_RMMV["Unison Item Config"]) {
  95.  
  96. DoubleX_RMMV.Unison_Item_Compatibility = {};
  97.  
  98. /*----------------------------------------------------------------------------*/
  99.  
  100. if (Imported.YEP_X_PartyLimitGauge) {
  101.  
  102. DoubleX_RMMV.Unison_Item_Compatibility["YEP_X_PartyLimitGauge"] = {};
  103.  
  104. (function(UI, UIC) {
  105.  
  106.     'use strict';
  107.  
  108.     UIC.Game_BattlerBase = {};
  109.     var GB = UIC.Game_BattlerBase;
  110.  
  111.     GB.canPayPartyLimitCost = Game_BattlerBase.prototype.canPayPartyLimitCost;
  112.     Game_BattlerBase.prototype.canPayPartyLimitCost = function(skill) {
  113.         var unit = this.friendsUnit();
  114.         // Edited to multiply the requirement by the number of unison actors
  115.         var n = Math.max(skill.meta.unisonItemActors.length, 1);
  116.         return unit.partyLimitGaugeCurrent() >= this.partyLimitCost(skill) * n;
  117.         // YEP_X_PartyLimitGauge_MultiplyPartyLimitCost
  118.     }; // Game_BattlerBase.prototype.canPayPartyLimitCost
  119.  
  120.     UIC.Window_SkillList = {};
  121.     var WSL = UIC.Window_SkillList;
  122.  
  123.     WSL.drawPartyLimitCost = Window_SkillList.prototype.drawPartyLimitCost;
  124.     Window_SkillList.prototype.drawPartyLimitCost = function(skill, wx, wy, dw) {
  125.         if (this._actor.partyLimitCost(skill) <= 0) return dw;
  126.         var unit = this._actor.friendsUnit();
  127.         if (Yanfly.Param.PLGDrawIcon && unit.partyLimitGaugeIcon() > 0) {
  128.           var iw = wx + dw - Window_Base._iconWidth;
  129.           var icon = unit.partyLimitGaugeIcon();
  130.           this.drawIcon(icon, iw, wy + 2);
  131.           dw -= Window_Base._iconWidth + 2;
  132.         }
  133.         this.changeTextColor(this.textColor(Yanfly.Param.PLGCostColor));
  134.         var fmt = Yanfly.Param.PLGCostFmt;
  135.         // Edited to multiply the requirement by the number of unison actors
  136.         var n = Math.max(skill.meta.unisonItemActors.length, 1);
  137.         var cost = this._actor.partyLimitCost(skill) * n;
  138.         console.info(skill.name, cost);
  139.         // YEP_X_PartyLimitGauge_MultiplyPartyLimitCost
  140.         var text = fmt.format(Yanfly.Util.toGroup(cost),
  141.           unit.partyLimitGaugeCurrent(), unit.partyLimitGaugeIncrements());
  142.         this.contents.fontSize = Yanfly.Param.PLGCostSize;
  143.         this.drawText(text, wx, wy, dw, 'right');
  144.         var returnWidth = dw - this.textWidth(text) - Yanfly.Param.SCCCostPadding;
  145.         this.resetFontSettings();
  146.         return returnWidth;
  147.     }; // Window_SkillList.prototype.drawPartyLimitCost
  148.  
  149. })(DoubleX_RMMV.Unison_Item, DoubleX_RMMV.Unison_Item_Compatibility["YEP_X_PartyLimitGauge"]);
  150.  
  151. } // if (Imported.YEP_X_PartyLimitGauge)
  152.  
  153. /*----------------------------------------------------------------------------*/
  154.  
  155. } else {
  156.     alert('Place Unison Item Compatibility below Unison Item Config.');
  157. } // if (DoubleX_RMMV["Unison Item Config"])
  158.  
  159. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement