SHARE
TWEET

DoubleX RMMV Status Bars v101a

Double_X Sep 16th, 2016 (edited) 241 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 Status Bars                                              
  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.  *      Abilities:                                                            
  20.  *      1. Nothing special for most rudimetary use cases                      
  21.  *      2. Little RMMV plugin development proficiency for most ordinary uses  
  22.  *      3. Some RMMV plugin development proficiency to fully utilize this    
  23.  *----------------------------------------------------------------------------
  24.  *    # Links                                                                
  25.  *      This plugin:                                                          
  26.  *      1. http://pastebin.com/5BMvWPbu                                      
  27.  *      Video:                                                                
  28.  *      1. https://www.youtube.com/watch?v=kaGhzueQwUs                        
  29.  *----------------------------------------------------------------------------
  30.  *    # Author                                                                
  31.  *      DoubleX                                                              
  32.  *----------------------------------------------------------------------------
  33.  *    # Changelog                                                            
  34.  *      v1.01a(GMT 1400 12-8-2017):                                          
  35.  *      1. Lets you set the status bars to show the stat change processes via
  36.  *         showProc, procUpdateRate, procColor1 and procColor2 in SBX        
  37.  *      2. Fixed crashes for status bars having the same minimum and maximum  
  38.  *      v1.00a(GMT 1700 16-9-2016):                                          
  39.  *      1. 1st version of this plugin finished                                
  40.  *============================================================================*/
  41. /*:
  42.  * @plugindesc Lets you use bars to show battler statuses on their sprites
  43.  * @author DoubleX
  44.  *
  45.  * @param isEnabled
  46.  * @desc Sets whether this plugin will be enabled
  47.  *       It'll be stored as a boolean, and will be regarded as true if and only
  48.  *       if it's true
  49.  *       Don't change this during the same battle unless you really know what
  50.  *       you're truly foing
  51.  *       E.g.: Setting isEnabled as false will disable this plugin
  52.  * @default true
  53.  *
  54.  * @help
  55.  * You're supposed to open this plugin js file to edit its configurations
  56.  * The default plugin file name is DoubleX RMMV Status Bars v101a
  57.  * If you want to change that, you must edit the value of
  58.  * DoubleX_RMMV.Status_Bars_File, which must be done via opening this plugin
  59.  * js file directly
  60.  *============================================================================
  61.  *    ## Notetag Info                                                        
  62.  *----------------------------------------------------------------------------
  63.  *    # Actor/Class/Weapon/Armor/Enemy/State Notetags:                        
  64.  *      State notetags take the highest priority, followed by enemy, weapon,  
  65.  *      armor, class and actor                                                
  66.  *      1. <status status bar: SBX>                                            
  67.  *         - Sets the battler to setup a status bar of status using          
  68.  *           configurations set in function name SBX, which can only be edited
  69.  *           in this plugin js file directly                                  
  70.  *         - status must be included in STATUSES, which can only be edited in
  71.  *           this plugin js file directly                                    
  72.  *         - E.g.:                                                            
  73.  *           <hp status bar: HP> will set the battler to setup a hp status bar
  74.  *           using configurations set in HP, which can only be edited in this
  75.  *           plugin js file directly                                          
  76.  *         - Only the 1st effective notetag among all having the same status  
  77.  *           will be used(Reference tag: NOTETAG_MONO)                        
  78.  *============================================================================
  79.  *    ## Plugin Call Info                                                    
  80.  *----------------------------------------------------------------------------
  81.  *    # Configuration manipulations                                          
  82.  *      1. $gameSystem.statusBars.param                                      
  83.  *         - Returns the stored value of param listed in the plugin manager  
  84.  *         - E.g.:                                                            
  85.  *           $gameSystem.statusBars.isEnabled will return a Boolean indicating
  86.  *           whether this plugin's enabled                                    
  87.  *      2. $gameSystem.statusBars.param = val                                
  88.  *         - Sets the stored value of param listed in plugin manager as val  
  89.  *         - E.g.:                                                            
  90.  *           $gameSystem.statusBars.isEnabled = false will set the stored    
  91.  *           value of parameter isEnabled shown on the plugin manager as false
  92.  *         - All $gameSystem.statusBars.param changes will be saved          
  93.  *    # Actor/Class/Weapon/Armor/Enemy/State notetag manipulations            
  94.  *      1. meta.statusBars[status]                                            
  95.  *         - Returns the function name SBX for String status specified in    
  96.  *           <status status bar: SBX> if there's any                          
  97.  *         - E.g.:                                                            
  98.  *           $dataStates[1].meta.statusBars[hp] will return the function SBX  
  99.  *           specified in <hp status bar: SBX> notetag of state with id 1    
  100.  *      2. meta.statusBars[status] = SBX                                      
  101.  *         - Sets the String status in <status status bar: SBX> notetag to use
  102.  *           the function with name SBX which is a String                    
  103.  *         - E.g.:                                                            
  104.  *           $dataEnemies[2].meta.statusBars['mp'] = 'MP' will set the SBX    
  105.  *           specified in <mp status bar: SBX> notetag of enemy with id 2 as  
  106.  *           MP                                                              
  107.  *         - All meta.statusBars changes can be saved if                      
  108.  *           DoubleX RMMV Dynamic Data is used                                
  109.  *    # Battler manipulations                                                
  110.  *      1. isStatusBarChanged[status] = true                                  
  111.  *         - Notifys the status status bar of the battler to use a new        
  112.  *           configuration object                                            
  113.  *         - It'll be reset as false once a new configuration object's used  
  114.  *         - E.g.:                                                            
  115.  *           $gameParty.aliveMembers()[0].isStatusBarChanged['tp'] = true will
  116.  *           notify the tp status bar of the battler to use a new            
  117.  *           configuration object                                            
  118.  *    # Status bar manipulations                                              
  119.  *      1. new Window_Status_Bar(battler, status)                            
  120.  *         - Creates a new status bar showing the status status of battler    
  121.  *           battler                                                          
  122.  *         - E.g.:                                                            
  123.  *           new Window_Status_Bar($gameTroop.aliveMembers()[0], 'hp') will  
  124.  *           create a new status bar showing the hp status of the 1st troop  
  125.  *           member                                                          
  126.  *============================================================================
  127.  */
  128.  
  129. var DoubleX_RMMV = DoubleX_RMMV || {};
  130. DoubleX_RMMV['Status Bars'] = 'v1.01a';
  131.  
  132. // The plugin file name must be the same as DoubleX_RMMV.Status_Bars_File
  133. DoubleX_RMMV.Status_Bars_File = 'DoubleX RMMV Status Bars v101a';
  134.  
  135. /*============================================================================
  136.  *    ## Plugin Configurations                                                
  137.  *       You only need to edit this part as it's about what this plugin does  
  138.  *----------------------------------------------------------------------------*/
  139.  
  140. DoubleX_RMMV.Status_Bars = {
  141.  
  142.     /* Setups the list of statuses that can have their status bars drawn
  143.      * Each status must be represented by the name of its battler getter
  144.      */
  145.     STATUSES: [
  146.         'hp',
  147.         'mp',
  148.         'tp'
  149.     ],
  150.  
  151.     /*------------------------------------------------------------------------
  152.      *    Status Bar Functions                                                
  153.      *    - Setups SBX used by <status bar: SBX>                              
  154.      *------------------------------------------------------------------------*/
  155.     /* SBX are used by Window_Status_Bar at this._cfg = SB[this._cfgName](); in
  156.      * _updateCfg
  157.      * SBX are Javascript functions which must return an Object having at least
  158.      * the following:
  159.      * {
  160.      *     visible: function(battler), // Hotspot
  161.      *     opacity: function(battler), // Hotspot
  162.      *     backColor: function(battler), // Hotspot
  163.      *     color1: function(battler), // Hotspot
  164.      *     color2: function(battler), // Hotspot
  165.      *     x: function(battler), // Hotspot
  166.      *     y: function(battler), // Hotspot
  167.      *     w: function(battler), // Hotspot
  168.      *     h, function(battler), // Hotspot
  169.      *     text, function(battler), // Hotspot
  170.      *     textX: function(battler), // Hotspot
  171.      *     textY: function(battler), // Hotspot
  172.      *     textSize: function(battler), // Hotspot
  173.      *     textColor: function(battler), // Hotspot
  174.      *     min: function(battler), // Hotspot
  175.      *     max: function(battler), // Hotspot
  176.      *     (v1.01a+)showProc: function(battler), // Hotspot
  177.      *     (v1.01a+)procUpdateRate: function(battler) // Hotspot
  178.      * }
  179.      * All functions will be bound to the Window_Status_Bar upon its creation
  180.      * and must take the battler and database item using the SBX as their
  181.      * arguments
  182.      *
  183.      * Status bar configuration functions:
  184.      * The function result of visible, which is the status bar visibility, will
  185.      * be interpreted as truthy or falsy only
  186.      * The function of opacity, which is the status bar opacity, must return a
  187.      * Number between 0 and 255
  188.      * The functions of backColor, color1 and color2, which are the status bar
  189.      * back, 1st and 2nd colors respectively, must return a Number between
  190.      * #00000000 and #FFFFFFFF
  191.      * The functions of x and y, which are the status bar x and y offsets from
  192.      * the battler sprites respectively, must return a Number
  193.      * The functions of w and h, which are the status bar width and height
  194.      * respectively, must return a positive Number
  195.      * The function of text, which is the status bar description text, must
  196.      * return a String
  197.      * The functions of textX, textY and textSize, which are the status bar
  198.      * description text x and y offset from the status bar, and size
  199.      * respectively, must return a positive Number
  200.      * The functions of min and max, which are the minimum and maximum value of
  201.      * the status respiectively, must return a Number that must be not greater
  202.      * than and not less than all the possible values of the current value
  203.      * respectively
  204.      * (v1.01a+)The functions of showProc, which is whether the stat change
  205.      * processes will be shown on the status bars, will be interpreted as truthy
  206.      * or falsy only
  207.      * (v1.01a+)The functions of procUpdateRate, which is the rate relative to
  208.      * the max length of the stat bar per second, must return a Number between 0
  209.      * and 1
  210.      * (v1.01a+)The functions of procColor1 and procColor2, which are the status
  211.      * bar 1st and 2nd stat change colors respectively, must return a Number
  212.      * between #00000000 and #FFFFFFFF
  213.      *
  214.      * SBX names can only use alphanumeric characters
  215.      * The below SBX are examples added to help you set your SBX
  216.      * You can freely use, rewrite and/or delete these examples
  217.      *
  218.      * Advanced:
  219.      * The status bar prototype's inherited from Window_Base.prototype
  220.      * All status bar configuration functions are used by Window_Status_Bar
  221.      * visible and opacity are used in _updateBarVisibility
  222.      * backColor, color1, color2, textColor, text, textX and textY are used in
  223.      * _updateSetting
  224.      * x, y, w and h are used in initialize
  225.      * x is also used in _updateX
  226.      * y is also used in _updateY
  227.      * w is also used in _updateW
  228.      * h is also used in _updateH
  229.      * min and max are used in _updateFillW
  230.      * (v1.01a+)showProc
  231.      */
  232.  
  233.     // Sets the status bar to display the battler's hp statuses
  234.     HP: function() { // v1.00a - v1.01a; Potential Hotspot
  235.         return {
  236.             // Sets the hp bar to be always visible only for alive battlers
  237.             visible: function(battler) { return battler.isAlive(); }, // Hotspot
  238.             // Sets the hp bar opacity to be always 255
  239.             opacity: function(battler) { return 255; }, // Hotspot
  240.             // Sets the hp bar color 1 to be always text color 15
  241.             backColor: function(battler) { // Hotspot
  242.                 return this.textColor(15);
  243.             },
  244.             // Sets the hp bar color 1 to be always text color 20
  245.             color1: function(battler) { return this.textColor(20); }, // Hotspot
  246.             // Sets the hp bar color 2 to be always text color 21
  247.             color2: function(battler) { return this.textColor(21); }, // Hotspot
  248.             // Sets the hp bar x offset from battler sprite to be always 0
  249.             x: function(battler) { return 0; }, // Hotspot
  250.             // Sets the hp bar y offset from battler sprite to be always 16
  251.             y: function(battler) { return 16; }, // Hotspot
  252.             // Sets the hp bar width to be always 87
  253.             w: function(battler) { return 87; }, // Hotspot
  254.             // Sets the hp bar height to be always 16
  255.             h: function(battler) { return 16; }, // Hotspot
  256.             // Sets the hp bar description text to be always hp/mhp
  257.             text: function(battler) { // Hotspot
  258.                 return battler.hp.toString() + '/' + battler.mhp.toString();
  259.             },
  260.             // Sets the hp bar description text size to be always 0
  261.             textX: function(battler) { return 0; }, // Hotspot
  262.             // Sets the hp bar description text size to be always 0
  263.             textY: function(battler) { return 0; }, // Hotspot
  264.             // Sets the hp bar description text size to be always 13
  265.             textSize: function(battler) { return 13; }, // Hotspot
  266.             // Sets hp bar description text color to be always text color 0
  267.             textColor: function(battler) { // Hotspot
  268.                 return this.textColor(0);
  269.             },
  270.             // Sets the minimum hp to be shown on the hp bar to be always 0
  271.             min: function(battler) { return 0; }, // Hotspot
  272.             // Sets the maximum hp to be shown on the hp bar to be always mhp
  273.             max: function(battler) { return battler.mhp; }, // Hotspot
  274.             // (v1.01a+)Sets the hp change processes to be always shown
  275.             showProc: function(battler) { return true; }, // Hotspot
  276.             // (v1.01a+)Sets the hp change processes rate to be 100% of the
  277.             // max length of the hp bar per second
  278.             procUpdateRate: function(battler) { return 0.2; }, // Hotspot
  279.             // Sets the hp change process color 1 to be always text color 6
  280.             procColor1: function(battler) { return this.textColor(6); },
  281.             // Hotspot
  282.             // Sets the hp change process color 2 to be always text color 17
  283.             procColor2: function(battler) { return this.textColor(17); }
  284.             // Hotspot
  285.         };
  286.     },
  287.  
  288.     // Sets the status bar to display the battler's mp statuses
  289.     MP: function() { // v1.00a - v1.01a; Potential Hotspot
  290.         return {
  291.             // Sets the mp bar to be always visible only for alive battlers
  292.             visible: function(battler) { return battler.isAlive(); }, // Hotspot
  293.             // Sets the mp bar opacity to be always 255
  294.             opacity: function(battler) { return 255; }, // Hotspot
  295.             // Sets the mp bar color 1 to be always text color 15
  296.             backColor: function(battler) { // Hotspot
  297.                 return this.textColor(15);
  298.             },
  299.             // Sets the mp bar color 1 to be always text color 22
  300.             color1: function(battler) { return this.textColor(22); }, // Hotspot
  301.             // Sets the mp bar color 2 to be always text color 23
  302.             color2: function(battler) { return this.textColor(23); }, // Hotspot
  303.             // Sets the mp bar x offset from battler sprite to be always 0
  304.             x: function(battler) { return 0; }, // Hotspot
  305.             // Sets the mp bar y offset from battler sprite to be always 32
  306.             y: function(battler) { return 32; }, // Hotspot
  307.             // Sets the mp bar width to be always 87
  308.             w: function(battler) { return 87; }, // Hotspot
  309.             // Sets the mp bar height to be always 16
  310.             h: function(battler) { return 16; }, // Hotspot
  311.             // Sets the mp bar description text to be always mp/mmp
  312.             text: function(battler) { // Hotspot
  313.                 return battler.mp.toString() + '/' + battler.mmp.toString();
  314.             },
  315.             // Sets the mp bar description text size to be always 0
  316.             textX: function(battler) { return 0; }, // Hotspot
  317.             // Sets the mp bar description text size to be always 0
  318.             textY: function(battler) { return 0; }, // Hotspot
  319.             // Sets the mp bar description text size to be always 13
  320.             textSize: function(battler) { return 13; }, // Hotspot
  321.             // Sets mp bar description text color to be always text color 0
  322.             textColor: function(battler) { // Hotspot
  323.                 return this.textColor(0);
  324.             },
  325.             // Sets the minimum mp to be shown on the hp bar to be always 0
  326.             min: function(battler) { return 0; }, // Hotspot
  327.             // Sets the maximum mp to be shown on the hp bar to be always mmp
  328.             max: function(battler) { return battler.mmp; }, // Hotspot
  329.             // (v1.01a+)Sets the mp change processes to be always shown
  330.             showProc: function(battler) { return true; }, // Hotspot
  331.             // (v1.01a+)Sets the mp change processes rate to be 100% of the
  332.             // max length of the mp bar per second
  333.             procUpdateRate: function(battler) { return 0.2; }, // Hotspot
  334.             // Sets the mp change process color 1 to be always text color 1
  335.             procColor1: function(battler) { return this.textColor(1); },
  336.             // Hotspot
  337.             // Sets the mp change process color 2 to be always text color 4
  338.             procColor2: function(battler) { return this.textColor(4); }
  339.             // Hotspot
  340.         };
  341.     },
  342.  
  343.     // Sets the status bar to display the battler's tp statuses
  344.     TP: function() { // v1.00a - v1.01a; Potential Hotspot
  345.         return {
  346.             // Sets the tp bar to be always visible
  347.             visible: function(battler) { return battler.isAlive(); }, // Hotspot
  348.             // Sets the tp bar opacity to be always 255
  349.             opacity: function(battler) { return 255; }, // Hotspot
  350.             // Sets the tp bar color 1 to be always text color 15
  351.             backColor: function(battler) { // Hotspot
  352.                 return this.textColor(15);
  353.             },
  354.             // Sets the tp bar color 1 to be always text color 28
  355.             color1: function(battler) { return this.textColor(28); }, // Hotspot
  356.             // Sets the tp bar color 2 to be always text color 29
  357.             color2: function(battler) { return this.textColor(29); }, // Hotspot
  358.             // Sets the tp bar x offset from battler sprite to be always 0
  359.             x: function(battler) { return 0; }, // Hotspot
  360.             // Sets the tp bar y offset from battler sprite to be always 48
  361.             y: function(battler) { return 48; }, // Hotspot
  362.             // Sets the tp bar width to be always 87
  363.             w: function(battler) { return 87; }, // Hotspot
  364.             // Sets the tp bar height to be always 16
  365.             h: function(battler) { return 16; }, // Hotspot
  366.             // Sets the tp bar description text to be always tp/maxTp()
  367.             text: function(battler) { // Hotspot
  368.                 return battler.tp.toString() + '/' + battler.maxTp().toString();
  369.             },
  370.             // Sets the tp bar description text size to be always 0
  371.             textX: function(battler) { return 0; }, // Hotspot
  372.             // Sets the tp bar description text size to be always 0
  373.             textY: function(battler) { return 0; }, // Hotspot
  374.             // Sets the tp bar description text size to be always 13
  375.             textSize: function(battler) { return 13; }, // Hotspot
  376.             // Sets tp bar description text color to be always text color 0
  377.             textColor: function(battler) { // Hotspot
  378.                 return this.textColor(0);
  379.             },
  380.             // Sets the minimum tp to be shown on the hp bar to be always 0
  381.             min: function(battler) { return 0; }, // Hotspot
  382.             // Sets maximum tp to be shown on the hp bar to be always maxTp()
  383.             max: function(battler) { return battler.maxTp(); }, // Hotspot
  384.             // (v1.01a+)Sets the tp change processes to be always shown
  385.             showProc: function(battler) { return true; }, // Hotspot
  386.             // (v1.01a+)Sets the mp change processes rate to be 100% of the
  387.             // max length of the mp bar per second
  388.             procUpdateRate: function(battler) { return 0.2; }, // Hotspot
  389.             // Sets the tp change process color 1 to be always text color 3
  390.             procColor1: function(battler) { return this.textColor(3); },
  391.             // Hotspot
  392.             // Sets the tp change process color 2 to be always text color 24
  393.             procColor2: function(battler) { return this.textColor(24); }
  394.             // Hotspot
  395.         };
  396.     },
  397.  
  398.     // Adds new SBX here
  399.    
  400.  
  401. }; // DoubleX_RMMV.Status_Bars
  402.  
  403. /*============================================================================
  404.  *    ## Plugin Implementations                                              
  405.  *       You need not edit this part as it's about how this plugin works      
  406.  *----------------------------------------------------------------------------
  407.  *    # Plugin Support Info:                                                  
  408.  *      1. Prerequisites                                                      
  409.  *         - Decent RMMV plugin development proficiency to fully comprehend  
  410.  *           this                                                            
  411.  *----------------------------------------------------------------------------*/
  412.  
  413. DoubleX_RMMV.Is_Status_Bar_Notes_Loaded = false; // v1.00a - v1.00a
  414.  
  415. DoubleX_RMMV.Status_Bars_Params = { // v1.00a - v1.00a
  416.  
  417.     isEnabled: 'Boolean', // Marks that isEnabled is a Boolean
  418.  
  419.     /* Checks whether the passed configuration value's truthy or falsy
  420.      * Functional cohesion/Data coupling/Referentially transperant
  421.      * (String)param: The param to have its boolean value checked
  422.      * Return: The boolean value of the param
  423.      */
  424.     Boolean: function(param) { return param === 'true'; }
  425.  
  426. }; // DoubleX_RMMV.Status_Bars_Params
  427.  
  428. function Window_Status_Bar() { this.initialize.apply(this, arguments); }
  429.  
  430. (function(SB) {
  431.  
  432.     'use strict';
  433.  
  434.     SB.DataManager = {};
  435.     var DM = SB.DataManager;
  436.  
  437.     DM.isDatabaseLoaded = DataManager.isDatabaseLoaded;
  438.     DataManager.isDatabaseLoaded = function() { // v1.00a - v1.00a; Extended
  439.         // Rewritten to read all notetags of this plugin as well
  440.         return DM.isDatabaseLoaded.apply(this, arguments) && DM._loadAllNotes();
  441.         //
  442.     }; // DataManager.isDatabaseLoaded
  443.  
  444.     /* Reads all notetags of this plugin from the database
  445.      * Return: True
  446.      * Functional cohesion/Message coupling/Idempotent
  447.      */
  448.     DM._loadAllNotes = function() { // v1.00a - v1.00a; New
  449.         // Ensures the notetags will only be read exactly once upon game start
  450.         if (DoubleX_RMMV.Is_Status_Bar_Notes_Loaded) return true;
  451.         var types = [$dataActors, $dataClasses, $dataWeapons, $dataArmors];
  452.         types.concat([$dataEnemies, $dataStates]).forEach(function(type) {
  453.             type.forEach(function(data) { if (data) DM._loadNotes(data); });
  454.         });
  455.         DoubleX_RMMV.Is_Status_Bar_Notes_Loaded = true;
  456.         //
  457.         return true;
  458.     }; // DM._loadAllNotes
  459.  
  460.     /* Reads all notetags of this plugin from a dataum of the database
  461.      * (Object)datum: The datum to have its notetags of this plugin read
  462.      * Functional cohesion/Data coupling/Idempotent
  463.      */
  464.     DM._loadNotes = function(datum) { // v1.00a - v1.00a; New
  465.         var statusBars = datum.meta.statusBars = {}; // Plugin call
  466.         var regExp = /< *(\w+) +status +bar *: *(\w+) *>/i, status;
  467.         // Refer to reference tag NOTETAG_MONO
  468.         datum.note.split(/[\r\n]+/).forEach(function(line) {
  469.             if (!line.match(regExp)) return;
  470.             status = RegExp.$1;
  471.             statusBars[status] = statusBars[status] || RegExp.$2;
  472.         });
  473.         //
  474.     }; // DM._loadNotes
  475.  
  476.     SB.Game_System = {};
  477.     var GS = SB.Game_System;
  478.  
  479.     /*------------------------------------------------------------------------
  480.      *    New public instance variable                                        
  481.      *------------------------------------------------------------------------*/
  482.     // (Plugin call)The container of all parameters shown on the plugin manger
  483.     Object.defineProperty(Game_System.prototype, "statusBars", {
  484.         get: function() { /* Hotspot */ return this._statusBars; },
  485.         configurable: true
  486.     });
  487.  
  488.     GS.initialize = Game_System.prototype.initialize;
  489.     Game_System.prototype.initialize = function() { // v1.00a - v1.00a; Extended
  490.         GS.initialize.apply(this, arguments);
  491.         GS._initializeStatusBars.call(this); // Added to setup configurations
  492.     }; // Game_System.prototype.initialize
  493.  
  494.     /* Initializes all parameters of this plugin shown on the plugin manager
  495.      * Functional cohesion/Message coupling/Idempotent
  496.      */
  497.     GS._initializeStatusBars = function() { // v1.00a - v1.00a; New
  498.         this._statusBars = {};
  499.         var params = PluginManager.parameters(DoubleX_RMMV.Status_Bars_File);
  500.         var SBP = DoubleX_RMMV.Status_Bars_Params;
  501.         // Lets parameters to use their strategies to have their desired formats
  502.         Object.keys(params).forEach(function(param) {
  503.             this._statusBars[param] = SBP[SBP[param]](params[param]);
  504.         }, this);
  505.         //
  506.     }; // GS._initializeStatusBars
  507.  
  508.     SB.Game_BattlerBase = {};
  509.     var GBB = SB.Game_BattlerBase;
  510.  
  511.     /*------------------------------------------------------------------------
  512.      *    New public instance variable                                        
  513.      *------------------------------------------------------------------------*/
  514.     // (Plugin call only)Container of all status bar change notification flags
  515.     Object.defineProperty(Game_BattlerBase.prototype, "isStatusBarChanged", {
  516.         get: function() { /* Hotspot */ return this._isStatusBarChanged; },
  517.         configurable: true
  518.     });
  519.  
  520.     /*------------------------------------------------------------------------
  521.      *    New private instance variable                                        
  522.      *------------------------------------------------------------------------*/
  523.     // _statusBars: The container of all status bar configurations
  524.  
  525.     GBB.initMembers = Game_BattlerBase.prototype.initMembers;
  526.     Game_BattlerBase.prototype.initMembers = function() {
  527.     // v1.00a - v1.00a; Extended
  528.         GBB._initStatusBarChanges.call(this); // Added
  529.         GBB.initMembers.apply(this, arguments);
  530.     }; // Game_BattlerBase.prototype.initMembers
  531.  
  532.     GBB.refresh = Game_BattlerBase.prototype.refresh;
  533.     Game_BattlerBase.prototype.refresh = function() {
  534.     // v1.00a - v1.00a; Extended
  535.         GBB.refresh.apply(this, arguments);
  536.         // Added to notify that the status bar configurations might be changed
  537.         if (!$gameSystem.statusBars.isEnabled) return;
  538.         GBB._notifyStatusBarChanges.call(this);
  539.         //
  540.     }; // Game_BattlerBase.prototype.refresh
  541.  
  542.     /* Setups the change notification flags of all statuses for this battler
  543.      * Functional cohesion/Message coupling/Idempotent
  544.      */
  545.     GBB._initStatusBarChanges = function() { // v1.00a - v1.00a; New
  546.         this._statusBars = {};
  547.         this._isStatusBarChanged = {};
  548.         SB.STATUSES.forEach(function(status) {
  549.             this._isStatusBarChanged[status] = true;
  550.         }, this);
  551.     }; // GBB._initStatusBarChanges
  552.  
  553.     /* Marks that a new status bar configuration might need to be used
  554.      * Functional cohesion/Message coupling/Idempotent
  555.      */
  556.     GBB._notifyStatusBarChanges = function() { // v1.00a - v1.00a; New
  557.         // Raises the change notification flags of all statuses for this battler
  558.         Object.keys(this._isStatusBarChanged).forEach(function(status) {
  559.             this._isStatusBarChanged[status] = true;
  560.         }, this);
  561.         //
  562.     }; // GBB._notifyStatusBarChanges
  563.  
  564.     /* Returns the latest status bar configuration object for the given status
  565.      * Sequential cohesion/Data coupling/Idempotent
  566.      * (String)status: The battler status shown by the status bar
  567.      * Return(Object): The status bar configuration object for the given status
  568.      */
  569.     GBB.statusBarCfg = function(status) { // v1.00a - v1.00a; New; Hotspot
  570.         // Setups a new status bar configuration only when it might be needed
  571.         if (!this._statusBars[status] || this._isStatusBarChanged[status]) {
  572.             this._isStatusBarChanged[status] = false;
  573.             this._statusBars[status] = GBB._newStatusBarCfg.call(this, status);
  574.         }
  575.         //
  576.         return this._statusBars[status];
  577.     }; // GBB.statusBarCfg
  578.  
  579.     /* Returns a new status bar configuration object for the given status
  580.      * Functional cohesion/Data coupling/Referentially transperant
  581.      * (String)status: The battler status shown by the status bar
  582.      * Return(Object): A new status bar configuration object for the status
  583.      */
  584.     GBB._newStatusBarCfg = function(status) {
  585.     // v1.00a - v1.00a; New; Potential Hotspot
  586.         // Refer to reference tag NOTETAG_MONO
  587.         var datum = this._statusBarData().filter(function(data) {
  588.             return data.meta.statusBars[status];
  589.         })[0];
  590.         return datum ? datum.meta.statusBars[status] : '';
  591.         //
  592.     }; // GBB._newStatusBarCfg
  593.  
  594.     /* Returns all database items that might have status bar configuration notes
  595.      * Functional cohesion/Message coupling/Referentially transperant
  596.      * Return(Array): An array of database item used by this battler
  597.      */
  598.     GBB._statusBarData = function() { // v1.00a - v1.00a; New; Potential Hotspot
  599.         return this.states(); // Game_BattlerBase is abstract so GBB can be used
  600.     }; // GBB._statusBarData
  601.  
  602.     /* Returns all database items that might have status bar configuration notes
  603.      * Functional cohesion/Message coupling/Referentially transperant
  604.      * Return(Array): An array of database item used by this actor
  605.      */
  606.     Game_Actor.prototype._statusBarData = function() {
  607.     // v1.00a - v1.00a; New; Potential Hotspot
  608.         // Use polymorphism at the cost of not using GA
  609.         var data = GBB._statusBarData.call(this);
  610.         data.concat(this.equips().filter(function(equip) { return equip; }));
  611.         data.push(this.currentClass());
  612.         data.push(this.actor());
  613.         return data;
  614.         //
  615.     }; // Game_Actor.prototype._statusBarData
  616.  
  617.     /* Returns all database items that might have status bar configuration notes
  618.      * Functional cohesion/Message coupling/Referentially transperant
  619.      * Return(Array): An array of database item used by this enemy
  620.      */
  621.     Game_Enemy.prototype._statusBarData = function() {
  622.     // v1.00a - v1.00a; New; Potential Hotspot
  623.         // Use polymorphism at the cost of not using GE
  624.         var data = GBB._statusBarData.call(this);
  625.         data.push(this.enemy());
  626.         return data;
  627.         //
  628.     }; // Game_Enemy.prototype._statusBarData
  629.  
  630.     SB.Sprite_Battler = {};
  631.     var SBSB = SB.Sprite_Battler;
  632.  
  633.     /*------------------------------------------------------------------------
  634.      *    New private instance variable                                      
  635.      *------------------------------------------------------------------------*/
  636.     // _statusBars: The container of all status bars for the battler
  637.  
  638.     SBSB.setBattler = Sprite_Battler.prototype.setBattler;
  639.     Sprite_Battler.prototype.setBattler = function(battler) {
  640.     // 1.00a - v1.00a; Extended; Hotspot
  641.         // Added to reconfigure the status bars upon battler change
  642.         var change = battler !== this._battler;
  643.         //
  644.         SBSB.setBattler.apply(this, arguments);
  645.         // Added
  646.         if (!$gameSystem.statusBars.isEnabled || !battler || !change) return;
  647.         if (!this._statusBars) return SBSB._initStatusBars.call(this);
  648.         SBSB._setStatusBarBattlers.call(this);
  649.         //
  650.     }; // Sprite_Battler.prototype.setBattler
  651.  
  652.     /* Setups all status bars for this battler
  653.      * Functional cohesion/Message coupling/Idempotent
  654.      */
  655.     SBSB._initStatusBars = function() { // v1.00a - v1.00a; New
  656.         this._statusBars = {};
  657.         SB.STATUSES.forEach(function(status) {
  658.             this._statusBars[status] =
  659.             new Window_Status_Bar(this._battler, status);
  660.             this.addChild(this._statusBars[status]);
  661.         }, this);
  662.     }; // SBSB._initStatusBars
  663.  
  664.     /* Updates the owner info stored in all status bars
  665.      * Functional cohesion/Message coupling/Idempotent
  666.      */
  667.     SBSB._setStatusBarBattlers = function() { // v1.00a - v1.00a; New
  668.         SB.STATUSES.forEach(function(status) {
  669.             this._statusBars[status].battler = this._battler;
  670.         }, this);
  671.     }; // SBSB._setStatusBarBattlers
  672.  
  673.     /*------------------------------------------------------------------------
  674.      *    # New class: Window_Status_Bar                                      
  675.      *------------------------------------------------------------------------*/
  676.  
  677.     Window_Status_Bar.prototype = Object.create(Window_Base.prototype);
  678.     Window_Status_Bar.prototype.constructor = Window_Status_Bar;
  679.  
  680.     /*------------------------------------------------------------------------
  681.      *    New public instance variable                                        
  682.      *------------------------------------------------------------------------*/
  683.     // battler: The battler owning this status bar
  684.     Object.defineProperty(Window_Status_Bar.prototype, "battler", {
  685.         set: function() { /* Hotspot */ return this._battler; },
  686.         configurable: true
  687.     });
  688.  
  689.     /*------------------------------------------------------------------------
  690.      *    New private instance variables                                      
  691.      *------------------------------------------------------------------------*/
  692.     /* _backColor: The back color of this status bar
  693.      * _cfgName: The name of the configuration object used by this status bar
  694.      * _cfg: The configuration object used by this status bar
  695.      * _color1: The 1st color of this status bar
  696.      * _color2: The 2nd color of this status bar
  697.      * _fillW: The width of the filled portion of the status bar
  698.      * _isRedraw: The flag indicating whether the status bar needs to be redrawn
  699.      * (v1.01a+)_procFillW: The width of the stat change process bar
  700.      * _status: The battler status shown by this status bar
  701.      * _text: The status bar description text
  702.      * _textColor: The color of the status bar description text
  703.      * _textX: The x offset of the status bar description text from this bar
  704.      * _textY: The y offset of the status bar description text from this bar
  705.      */
  706.  
  707.     Window_Status_Bar.prototype.initialize = function(battler, status) {
  708.     // v1.00a - v1.00a
  709.         this._battler = battler;
  710.         this._status = status;
  711.         this._updateCfg(battler, status);
  712.         if (this._cfg) {
  713.             Window_Base.prototype.initialize.call(this, this._cfg.x(battler),
  714.             this._cfg.y(battler), this._cfg.w(battler), this._cfg.h(battler));
  715.         } else {
  716.             Window_Base.prototype.initialize.call(this, 0, 0, 0, 0);
  717.         }
  718.         this.opacity = 0; // Only the status bar needs to be shown
  719.     }; // Window_Status_Bar.prototype.initialize
  720.  
  721.     Window_Status_Bar.prototype.standardFontSize = function() {
  722.     // v1.00a - v1.00a; Hotspot
  723.         if (this._cfg) return this._cfg.textSize(this._battler);
  724.         return Window_Base.prototype.standardFontSize.call(this);
  725.     }; // Window_Status_Bar.prototype.standardFontSize
  726.  
  727.     Window_Status_Bar.prototype.standardPadding = function() {
  728.     // v1.00a - v1.00a; Hotspot
  729.         // The whole window is just the statu bar
  730.         return this._cfg ? 0 : Window_Base.prototype.standardPadding.call(this);
  731.         //
  732.     }; // Window_Status_Bar.prototype.standardPadding
  733.  
  734.     Window_Status_Bar.prototype.resetFontSettings = function() {
  735.     // v1.00a - v1.00a; Hotspot
  736.         if (this.contents.fontSize === this.standardFontSize()) return;
  737.         Window_Base.prototype.resetFontSettings.call(this);
  738.         this._isRedraw = true;
  739.     }; // Window_Status_Bar.prototype.resetFontSettings
  740.  
  741.     Window_Status_Bar.prototype.update = function() {
  742.     // v1.00a - v1.00a; Hotspot
  743.         Window_Base.prototype.update.call(this);
  744.         this._updateBarStatuses(this._battler);
  745.     }; // Window_Status_Bar.prototype.update
  746.  
  747.     /* Updates all statuses of this status bar
  748.      * Sequential cohesion/Data coupling
  749.      * (Game_Battler)battler: The battler owning this bar
  750.      */
  751.     Window_Status_Bar.prototype._updateBarStatuses = function(battler) {
  752.     // v1.00a - v1.00a; Hotspot
  753.         if (!battler) return this.visible = false;
  754.         this._updateCfg(battler, this._status);
  755.         this._updateBarVisibility(battler, this._cfg);
  756.         if (!this.visible || this.contentsOpacity <= 0) return;
  757.         this._updateDimensions(battler, this._cfg, this._status);
  758.         if (!this.visible) return;
  759.         this._updateColorText(battler, this._cfg);
  760.         if (!this.visible || !this._isRedraw) return;
  761.         this._isRedraw = false;
  762.         this._redraw(battler, this._cfg);
  763.     }; // Window_Status_Bar.prototype._updateBarStatuses
  764.  
  765.     /* Updates all configurations used by this status bar
  766.      * Functional cohesion/Data coupling
  767.      * (Game_Battler)battler: The battler owning this bar
  768.      * (String)status: The battler status shown by this status bar
  769.      */
  770.     Window_Status_Bar.prototype._updateCfg = function(battler, status) {
  771.     // v1.00a - v1.00a; Hotspot
  772.         if (!battler) return;
  773.         var lastCfgName = this._cfgName;
  774.         this._cfgName = GBB.statusBarCfg.call(battler, status);
  775.         if (lastCfgName === this._cfgName) return;
  776.         if (this._cfgName.length <= 0) return this._cfg = null;
  777.         this._cfg = SB[this._cfgName]();
  778.         Object.keys(this._cfg).forEach(function(cfg) {
  779.             this._cfg[cfg] = this._cfg[cfg].bind(this);
  780.         }, this);
  781.     }; // Window_Status_Bar.prototype._updateCfg
  782.  
  783.     /* Updates all visibility settings used by this status bar
  784.      * Functional cohesion/Data coupling
  785.      * (Game_Battler)battler: The battler owning this bar
  786.      * (Object)cfg: The configuration object used by this status bar
  787.      */
  788.     Window_Status_Bar.prototype._updateBarVisibility = function(battler, cfg) {
  789.     // v1.00a - v1.00a; Hotspot
  790.         this.visible = this.visible && battler && cfg && cfg.visible(battler);
  791.         if (this.visible) this.contentsOpacity = cfg.opacity(battler);
  792.     }; // Window_Status_Bar.prototype._updateBarVisibility
  793.  
  794.     /* Updates all dimensional settings of this status bar
  795.      * Sequential cohesion/Data coupling
  796.      * (Game_Battler)battler: The battler owning this bar
  797.      * (Object)cfg: The configuration object used by this status bar
  798.      * (String)status: The battler status shown by this status bar
  799.      */
  800.     Window_Status_Bar.prototype._updateDimensions =
  801.     function(battler, cfg, status) {
  802.     // v1.00a - v1.00a; Hotspot
  803.         this._updateW(battler, cfg);
  804.         this.visible = this.visible && this.width > 0;
  805.         if (!this.visible) return;
  806.         this._updateH(battler, cfg);
  807.         this.visible = this.visible && this.height > 0;
  808.         if (!this.visible) return;
  809.         this._updateX(battler, cfg);
  810.         this._updateY(battler, cfg);
  811.         this._updateFillW(battler, cfg, status);
  812.     }; // Window_Status_Bar.prototype.updateDimensions
  813.  
  814.     /* Updates the width of this status bar and the redraw flag
  815.      * Sequential cohesion/Data coupling
  816.      * (Game_Battler)battler: The battler owning this bar
  817.      * (Object)cfg: The configuration object used by this status bar
  818.      */
  819.     Window_Status_Bar.prototype._updateW = function(battler, cfg) {
  820.     // v1.00a - v1.00a; Hotspot
  821.         var newW = battler && cfg ? cfg.w(battler) : 0;
  822.         if (this.width === newW) return;
  823.         this.width = newW;
  824.         this._isRedraw = true;
  825.     }; // Window_Status_Bar.prototype._updateW
  826.  
  827.     /* Updates the height of this status bar and the redraw flag
  828.      * Sequential cohesion/Data coupling
  829.      * (Game_Battler)battler: The battler owning this bar
  830.      * (Object)cfg: The configuration object used by this status bar
  831.      */
  832.     Window_Status_Bar.prototype._updateH = function(battler, cfg) {
  833.     // v1.00a - v1.00a; Hotspot
  834.         var newH = battler && cfg ? cfg.h(battler) : 0;
  835.         if (this.height === newH) return;
  836.         this.height = newH;
  837.         this._isRedraw = true;
  838.     }; // Window_Status_Bar.prototype._updateH
  839.  
  840.     /* Updates the x offset of this status bar from the battler sprite
  841.      * Functional cohesion/Data coupling
  842.      * (Game_Battler)battler: The battler owning this bar
  843.      * (Object)cfg: The configuration object used by this status bar
  844.      */
  845.     Window_Status_Bar.prototype._updateX = function(battler, cfg) {
  846.     // v1.00a - v1.00a; Hotspot
  847.         if (!battler || !cfg) return;
  848.         var newX = cfg.x(battler);
  849.         if (this.x !== newX) this.x = newX;
  850.     }; // Window_Status_Bar.prototype._updateX
  851.  
  852.     /* Updates the y offset of this status bar from the battler sprite
  853.      * Functional cohesion/Data coupling
  854.      * (Game_Battler)battler: The battler owning this bar
  855.      * (Object)cfg: The configuration object used by this status bar
  856.      */
  857.     Window_Status_Bar.prototype._updateY = function(battler, cfg) {
  858.     // v1.00a - v1.00a; Hotspot
  859.         if (!battler || !cfg) return;
  860.         var newY = cfg.y(battler);
  861.         if (this.y !== newY) this.y = newY;
  862.     }; // Window_Status_Bar.prototype._updateY
  863.  
  864.     /* Updates the fill width of this status bar and the redraw flag
  865.      * Sequential cohesion/Data coupling
  866.      * (Game_Battler)battler: The battler owning this bar
  867.      * (Object)cfg: The configuration object used by this status bar
  868.      * (String)status: The battler status shown by this status bar
  869.      */
  870.     Window_Status_Bar.prototype._updateFillW = function(battler, cfg, status) {
  871.     // v1.00a - v1.01a; Hotspot
  872.         var lastFillW = this._fillW;
  873.         var statusRange = cfg.max(battler) - cfg.min(battler);
  874.         this._fillW = battler && cfg && statusRange > 0 ?
  875.                 this.width * battler[status] / statusRange : 0;
  876.         this._procFillW = this._procFillW || this._fillW;
  877.         this._isRedraw = this._isRedraw || lastFillW !== this._fillW ||
  878.                 this._procFillW !== this._fillW;
  879.     }; // Window_Status_Bar.prototype._updateFillW
  880.  
  881.     /* Updates all color and text settings of this status bar
  882.      * Sequential cohesion/Data coupling
  883.      * (Game_Battler)battler: The battler owning this bar
  884.      * (Object)cfg: The configuration object used by this status bar
  885.      */
  886.     Window_Status_Bar.prototype._updateColorText = function(battler, cfg) {
  887.     // v1.00a - v1.01a; Hotspot
  888.         this._updateSetting(battler, cfg, 'backColor');
  889.         this._updateSetting(battler, cfg, 'color1');
  890.         this._updateSetting(battler, cfg, 'color2');
  891.         this._updateSetting(battler, cfg, 'textColor');
  892.         this._updateSetting(battler, cfg, 'text');
  893.         this.visible = this.visible && !this._isTransperant();
  894.         if (!this.visible) return;
  895.         this._updateSetting(battler, cfg, 'textX');
  896.         this._updateSetting(battler, cfg, 'textY');
  897.         this._updateSetting(battler, cfg, 'procColor1');
  898.         this._updateSetting(battler, cfg, 'procColor2');
  899.     }; // Window_Status_Bar.prototype.updateDimensions
  900.  
  901.     /* Updates specified setting of this status bar that can change redraw flag
  902.      * Sequential cohesion/Data coupling
  903.      * (Game_Battler)battler: The battler owning this bar
  904.      * (Object)cfg: The configuration object used by this status bar
  905.      * (String)name: The setting name
  906.      */
  907.     Window_Status_Bar.prototype._updateSetting = function(battler, cfg, name) {
  908.     // v1.00a - v1.00a; Hotspot
  909.         if (!battler || !cfg) return;
  910.         var _name = '_' + name, last = this[_name];
  911.         this[_name] = cfg[name](battler);
  912.         this._isRedraw = this._isRedraw || last !== this[_name];
  913.     }; // Window_Status_Bar.prototype._updateSetting
  914.  
  915.     /* Checks if the whole status bar's transperant
  916.      * Functional cohesion/Message coupling/Referentially transperant
  917.      * Return(Boolean): Whether the whole status bar's transperant
  918.      */
  919.     Window_Status_Bar.prototype._isTransperant = function() {
  920.     // v1.00a - v1.01a; Hotspot
  921.         var opagueColor = 0x01000000;
  922.         if (this._backColor >= opagueColor) return false;
  923.         if (this._color1 >= opagueColor) return false;
  924.         if (this._color2 >= opagueColor) return false;
  925.         if (this._procColor1 >= opagueColor) return false;
  926.         if (this._procColor2 >= opagueColor) return false;
  927.         return this._textColor < opagueColor || this._text.length <= 0;
  928.     }; // Window_Status_Bar.prototype._isTransperant
  929.  
  930.     /* Redraws the whole status bar
  931.      * Functional cohesion/Message coupling
  932.      */
  933.     Window_Status_Bar.prototype._redraw = function() {
  934.     // v1.00a - v1.01a; Hotspot
  935.         if (this._cfg.showProc(this._battler)) return this._redrawWithProc();
  936.         this._redrawWithoutProc();
  937.     }; // Window_Status_Bar.prototype._redraw
  938.  
  939.     /* (v1.01a+)Redraws the whole status bar with the stat change process shown
  940.      * Functional cohesion/Message coupling
  941.      */
  942.     Window_Status_Bar.prototype._redrawWithProc = function() {
  943.     // v1.01a - v1.01a; Hotspot
  944.         if (this._procFillW < this._fillW) return this._redrawWithProcAbove();
  945.         if (this._procFillW > this._fillW) return this._redrawWithProcBelow();
  946.         this._redrawWithoutProc();
  947.     }; // Window_Status_Bar.prototype._redrawWithProc
  948.  
  949.     /* (v1.01a+)Redraws the whole status bar with the stat change process shown
  950.      * Sequential cohesion/Message coupling
  951.      */
  952.     Window_Status_Bar.prototype._redrawWithProcAbove = function() {
  953.     // v1.01a - v1.01a; Hotspot
  954.         this._redrawBack();
  955.         this.contents.gradientFillRect(0, 0, this._fillW, this.height,
  956.                 this._color1, this._color2);
  957.         this.contents.gradientFillRect(0, 0, this._procFillW, this.height,
  958.                 this._procColor1, this._procColor2);
  959.         this._redrawText();
  960.         this._addProcFillW();
  961.         // Otherwise the stat change process bar would show after it's done
  962.         if (this._procFillW >= this._fillW) this._redrawWithoutProc();
  963.         //
  964.     }; // Window_Status_Bar.prototype._redrawWithProcAbove
  965.  
  966.     /* (v1.01a+)Increases the stat change process fill width in the stat bar
  967.      * Functional cohesion/Message coupling
  968.      */
  969.     Window_Status_Bar.prototype._addProcFillW = function() {
  970.     // v1.01a - v1.01a; Hotspot
  971.         // Fps's assumed to be always 60
  972.         this._procFillW = Math.min(this._procFillW + this._cfg.procUpdateRate(
  973.                 this._battler) * this.width / 60, this._fillW);
  974.         //
  975.     }; // Window_Status_Bar.prototype._addProcFillW
  976.  
  977.     /* (v1.01a+)Redraws the whole status bar with the stat change process shown
  978.      * Sequential cohesion/Message coupling
  979.      */
  980.     Window_Status_Bar.prototype._redrawWithProcBelow = function() {
  981.     // v1.01a - v1.01a; Hotspot
  982.         this._redrawBack();
  983.         this.contents.gradientFillRect(0, 0, this._procFillW, this.height,
  984.                 this._procColor1, this._procColor2);
  985.         this.contents.gradientFillRect(0, 0, this._fillW, this.height,
  986.                 this._color1, this._color2);
  987.         this._redrawText();
  988.         this._minusProcFillW();
  989.         // Otherwise the stat change process bar would show after it's done
  990.         if (this._procFillW <= this._fillW) this._redrawWithoutProc();
  991.         //
  992.     }; // Window_Status_Bar.prototype._redrawWithProcBelow
  993.  
  994.     /* (v1.01a+)Decreases the stat change process fill width in the stat bar
  995.      * Functional cohesion/Message coupling
  996.      */
  997.     Window_Status_Bar.prototype._minusProcFillW = function() {
  998.     // v1.01a - v1.01a; Hotspot
  999.         // Fps's assumed to be always 60
  1000.         this._procFillW = Math.max(this._procFillW - this._cfg.procUpdateRate(
  1001.                 this._battler) * this.width / 60, this._fillW);
  1002.         //
  1003.     }; // Window_Status_Bar.prototype._addProcFillW
  1004.  
  1005.     /* Redraws the whole status bar without showing the stat change processes
  1006.      * Functional cohesion/Message coupling/Idempotent
  1007.      */
  1008.     Window_Status_Bar.prototype._redrawWithoutProc = function() {
  1009.     // v1.01a - v1.01a; Potential Hotspot
  1010.         this._redrawBack();
  1011.         this.contents.gradientFillRect(0, 0, this._fillW, this.height,
  1012.                 this._color1, this._color2);
  1013.         this._redrawText();
  1014.     }; // Window_Status_Bar.prototype._redrawWithoutProc
  1015.  
  1016.     /* Redraws the whole status bar without showing the stat change processes
  1017.      * Functional cohesion/Message coupling/Idempotent
  1018.      */
  1019.     Window_Status_Bar.prototype._redrawBack = function() {
  1020.         this.contents.clear();
  1021.         this.contents.fillRect(0, 0, this.width, this.height, this._backColor);
  1022.     }; // Window_Status_Bar.prototype._redrawBack
  1023.  
  1024.     /* Redraws the whole status bar without showing the stat change processes
  1025.      * Functional cohesion/Message coupling/Idempotent
  1026.      */
  1027.     Window_Status_Bar.prototype._redrawText = function() {
  1028.     // v1.01a - v1.01a; Potential Hotspot
  1029.         this.changeTextColor(this._textColor);
  1030.         var text = this._text;
  1031.         this.contents.drawText(text, this._textX, this._textY,
  1032.             this.textWidth(text), this.height);
  1033.     }; // Window_Status_Bar.prototype._redrawText
  1034.  
  1035. })(DoubleX_RMMV.Status_Bars);
  1036.  
  1037. /*============================================================================*/
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top