Double_X

DoubleX RMMV Popularized ATB Bar v100d

Feb 19th, 2016 (edited)
663
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 Popularized ATB Bar                                      
  6.  *----------------------------------------------------------------------------
  7.  *    # Terms Of Use                                                          
  8.  *      You shall keep this plugin's Plugin Info part's contents intact      
  9.  *      You shalln't claim that this plugin's written by anyone other than    
  10.  *      DoubleX or his aliases                                                
  11.  *      None of the above applies to DoubleX or his aliases                  
  12.  *----------------------------------------------------------------------------
  13.  *    # Prerequisites                                                        
  14.  *      Plugins:                                                              
  15.  *      1. DoubleX RMMV Popularized ATB Core                                  
  16.  *      Abilities:                                                            
  17.  *      1. Little Javascript coding proficiency to fully utilize this plugin  
  18.  *----------------------------------------------------------------------------
  19.  *    # Links                                                                
  20.  *      This plugin:                                                          
  21.  *      1. http://pastebin.com/fVNeBpks                                      
  22.  *      Video:                                                                
  23.  *      1. https://www.youtube.com/watch?v=xY_HrHi0e5M                        
  24.  *----------------------------------------------------------------------------
  25.  *    # Author                                                                
  26.  *      DoubleX                                                              
  27.  *----------------------------------------------------------------------------
  28.  *    # Changelog                                                            
  29.  *      v1.00d(GMT 0600 19-5-2021):                                          
  30.  *      1. Fixed all notetags not working bug
  31.  *      v1.00c(GMT 1700 16-9-2016):                                          
  32.  *      1. Improved this plugin's effectiveness, efficiency and robustness    
  33.  *      v1.00b(GMT 1400 31-5-2016):                                          
  34.  *      1. Improved this plugin's effectiveness, efficiency and readibility  
  35.  *      v1.00a(GMT 1500 19-2-2016):                                          
  36.  *      1. 1st completed version of this plugin finished                      
  37.  *============================================================================*/
  38. /*:
  39.  * @plugindesc Lets users set when/how ATB bars are shown on battler sprites
  40.  * @author DoubleX
  41.  *
  42.  * @param bar_show
  43.  * @desc Sets the code as bar_show determining when the battler ATB bars will be
  44.  *       shown on the battler sprites
  45.  *       It'll only be used by battlers not using <patb bar show: code> notetags
  46.  *       Available bar_show codes:
  47.  *       always - The battler ATB bars will always be shown on the enemy sprites
  48.  *       defeat - The actor ATB bars will always be shown on the actor sprites
  49.  *                while the enemy ATB bars will only be shown on the enemy
  50.  *                sprites for those being defeated before
  51.  *                This code will only be available if DoubleX RMMV Death Records
  52.  *                is used
  53.  *       Setting bar_show as an unavailable code means the battler ATB bars will
  54.  *       never be shown on the battler sprites
  55.  * @default always
  56.  *
  57.  * @param bar_w
  58.  * @desc Sets the width of the ATB bars shown on the battler sprites as bar_w
  59.  *       It'll only be used by battlers not using any <patb bar w: w> notetag
  60.  * @default 87
  61.  *
  62.  * @param bar_h
  63.  * @desc Sets the height of the ATB bars shown on the battler sprites as bar_h
  64.  *       It'll only be used by battlers not using any <patb bar h: h> notetag
  65.  * @default 16
  66.  *
  67.  * @param bar_x
  68.  * @desc Sets the x offset of the ATB bars shown on the battler sprites as bar_x
  69.  *       It'll only be used by battlers not using any <patb bar x: x> notetag
  70.  * @default 0
  71.  *
  72.  * @param bar_y
  73.  * @desc Sets the y offset of the ATB bars shown on the battler sprites as bar_y
  74.  *       It'll only be used by battlers not using any <patb bar y: y> notetag
  75.  * @default 0
  76.  *
  77.  * @param bar_opacity
  78.  * @desc Sets the opacity of the ATB bars shown on the battler sprites as
  79.  *       bar_opacity
  80.  *       It'll only be used by battlers not using any
  81.  *       <patb bar opacity: opacity> notetag
  82.  * @default 255
  83.  *
  84.  * @param bar_text_size
  85.  * @desc Sets the size of the description text of the ATB bars shown on the
  86.  *       battler sprites as bar_text_size
  87.  *       It'll only be used by battlers not using any <patb bar text size: size>
  88.  *       notetag
  89.  * @default 13
  90.  *
  91.  * @help
  92.  * The default plugin file name is DoubleX RMMV Popularized ATB Bar v100d
  93.  * If you want to change that, you must edit the value of
  94.  * DoubleX_RMMV.PATB_Bar_File, which must be done via opening this plugin js
  95.  * file directly
  96.  *============================================================================
  97.  *    ## Notetag Info                                                        
  98.  *----------------------------------------------------------------------------
  99.  *    # Actor/Class/Weapon/Armor/Enemy/State Notetags:                        
  100.  *      State notetags take the highest priority, followed by enemy, weapon,  
  101.  *      armor, class and actor                                                
  102.  *      The 1st notetag that's being read by the battler will be used        
  103.  *      1. <patb bar show: code>                                              
  104.  *         - Sets the code determining when the battler ATB bars will be shown
  105.  *           on the battler sprites as code                                  
  106.  *           Available codes are those of bar_show                            
  107.  *         - Setting code as an unavailable code means the battler ATB bars  
  108.  *           will never be shown on the battler sprites                      
  109.  *      2. <patb bar w: w>                                                    
  110.  *         - Sets the width of the ATB bars shown on the battler sprites as w
  111.  *      3. <patb bar h: h>                                                    
  112.  *         - Sets the height of the ATB bars shown on the battler sprites as h
  113.  *      4. <patb bar x: x>                                                    
  114.  *         - Sets the x offset of the ATB bars shown on the battler sprites as
  115.  *           x                                                                
  116.  *      5. <patb bar y: y>                                                    
  117.  *         - Sets the y offset of the ATB bars shown on the battler sprites as
  118.  *           y                                                                
  119.  *      6. <patb bar opacity: opacity>                                        
  120.  *         - Sets the opacity of the ATB bars shown on the battler sprites as
  121.  *           opacity                                                          
  122.  *      7. <patb bar text size: size>                                        
  123.  *         - Sets the size of the description text of the ATB bars shown on  
  124.  *           the battler sprites as size                                      
  125.  *============================================================================
  126.  *    ## Plugin Call Info                                                    
  127.  *----------------------------------------------------------------------------
  128.  *    # Configuration manipulations                                          
  129.  *      1. $gameSystem.patb.param                                            
  130.  *         - Returns the value of param listed in the plugin manager          
  131.  *      2. $gameSystem.patb.param = val                                      
  132.  *         - Sets the value of param listed in the plugin manager as val      
  133.  *         - All $gameSystem.patb.param changes will be saved                
  134.  *    # Actor/Class/Weapon/Armor/Enemy/State manipulations                    
  135.  *      1. meta.patb_bar_show                                                
  136.  *         - Returns the code determining when the battler ATB bars will be  
  137.  *           shown on the battler sprites                                    
  138.  *      2. meta.patb_bar_show = code                                          
  139.  *         - Sets the code determining when the battler ATB bars will be shown
  140.  *           on the battler sprites as code                                  
  141.  *         - All meta.patb_bar_show changes can be saved if                  
  142.  *           DoubleX RMMV Dynamic Data is used                                
  143.  *      3. meta.patb_bar_w                                                    
  144.  *         - Returns the width of the ATB bars shown on the battler sprites  
  145.  *      4. meta.patb_bar_w = w                                                
  146.  *         - Sets the width of the ATB bars shown on the battler sprites as w
  147.  *         - All meta.patb_bar_w changes can be saved if                      
  148.  *           DoubleX RMMV Dynamic Data is used                                
  149.  *      5. meta.patb_bar_h                                                    
  150.  *         - Returns the height of the ATB bars shown on the battler sprites  
  151.  *      6. meta.patb_bar_w = h                                                
  152.  *         - Sets the height of the ATB bars shown on the battler sprites as h
  153.  *         - All meta.patb_bar_h changes can be saved if                      
  154.  *           DoubleX RMMV Dynamic Data is used                                
  155.  *      7. meta.patb_bar_x                                                    
  156.  *         - Returns the x offset of the ATB bars shown on the battler sprites
  157.  *      8. meta.patb_bar_y = x                                                
  158.  *         - Sets the x offset of the ATB bars shown on the battler sprites as
  159.  *           x                                                                
  160.  *         - All meta.patb_bar_x changes can be saved if                      
  161.  *           DoubleX RMMV Dynamic Data is used                                
  162.  *      9. meta.patb_bar_y                                                    
  163.  *         - Returns the y offset of the ATB bars shown on the battler sprites
  164.  *      10. meta.patb_bar_y = y                                              
  165.  *          - Sets the y offset of the ATB bars shown on the battler sprites  
  166.  *            as y                                                            
  167.  *          - All meta.patb_bar_y changes can be saved if                    
  168.  *            DoubleX RMMV Dynamic Data is used                              
  169.  *      11. meta.patb_bar_opacity                                            
  170.  *          - Returns the opacity of the ATB bars shown on the battler sprites
  171.  *      12. meta.patb_bar_opacity = opacity                                  
  172.  *          - Sets the opacity of the ATB bars shown on the battler sprites  
  173.  *            as opacity                                                      
  174.  *          - All meta.patb_bar_opacity changes can be saved if              
  175.  *            DoubleX RMMV Dynamic Data is used                              
  176.  *      13. meta.patb_bar_text_size                                          
  177.  *          - Returns the size of the description text of the ATB bars shown  
  178.  *            on the battler sprites                                          
  179.  *      14. meta.patb_bar_text_size = size                                    
  180.  *          - Sets the size of the description text of the ATB bars shown on  
  181.  *            the battler sprites as size                                    
  182.  *          - All meta.patb_bar_size changes can be saved if                  
  183.  *            DoubleX RMMV Dynamic Data is used                              
  184.  *============================================================================
  185.  */
  186.  
  187. "use strict";
  188. var DoubleX_RMMV = DoubleX_RMMV || {};
  189. DoubleX_RMMV["PATB Bar"] = "v1.00d";
  190.  
  191. // The plugin file name must be the same as DoubleX_RMMV.PATB_Bar_File
  192. DoubleX_RMMV.PATB_Bar_File = "DoubleX RMMV Popularized ATB Bar v100d";
  193.  
  194. /*============================================================================
  195.  *    ## Plugin Implementations                                              
  196.  *       You need not edit this part as it's about how this plugin works      
  197.  *----------------------------------------------------------------------------
  198.  *    # Plugin Support Info:                                                  
  199.  *      1. Prerequisites                                                      
  200.  *         - Basic knowledge of this plugin on the user level, the default    
  201.  *           battle system implementations and the atb system concepts        
  202.  *         - Some Javascript coding proficiency to fully comprehend this      
  203.  *           plugin                                                          
  204.  *      2. Function documentation                                            
  205.  *         - The 1st part describes why this function's rewritten/extended for
  206.  *           rewritten/extended functions or what the function does for new  
  207.  *           functions                                                        
  208.  *         - The 2nd part describes what the arguments of the function are    
  209.  *         - The 3rd part informs which version rewritten, extended or created
  210.  *           this function                                                    
  211.  *         - The 4th part informs whether the function's rewritten or new    
  212.  *         - The 5th part informs whether the function's a real or potential  
  213.  *           hotspot                                                          
  214.  *         - The 6th part describes how this function works for new functions
  215.  *           only, and describes the parts added, removed or rewritten for    
  216.  *           rewritten or extended functions only                            
  217.  *         Example:                                                          
  218.  * /*----------------------------------------------------------------------
  219.  *  *    Why rewrite/extended/What this function does                      
  220.  *  *----------------------------------------------------------------------*/
  221. /* // arguments: What these arguments are                                    
  222.  * function_name = function(arguments) { // Version X+; Rewrite/New; Hotspot  
  223.  *     // Added/Removed/Rewritten to do something/How this function works    
  224.  *     function_name_code;                                                    
  225.  *     //                                                                    
  226.  * } // function_name                                                        
  227.  *----------------------------------------------------------------------------*/
  228.  
  229. function Window_Patb_Bar() { this.initialize.apply(this, arguments); }
  230.  
  231. if (DoubleX_RMMV["PATB Core"]) {
  232.  
  233. /*----------------------------------------------------------------------------*/
  234.  
  235. /*----------------------------------------------------------------------------
  236.  *    # Edit class: DataManager                                              
  237.  *----------------------------------------------------------------------------*/
  238.  
  239. // data: The data to have its notetags read
  240. DataManager.load_patb_bar_data_notes = DataManager.load_patb_data_notes;
  241. DataManager.load_patb_data_notes = function(data) {
  242.     this.load_patb_bar_data_notes(data);
  243.     this.load_patb_bar_notes(data); // Added
  244. }; // DataManager.load_patb_data_notes
  245.  
  246. // data: The data to have its notetags read
  247. DataManager.load_patb_bar_notes = function(data) { // New
  248.     var meta = data.meta;
  249.     var show = /< *patb +bar +show *: *(\w+)*>/i;
  250.     var w = /< *patb +bar +w *: *(\d+)*>/i;
  251.     var h = /< *patb +bar +h *: *(\d+)*>/i;
  252.     var x = /< *patb +bar +x *: *(\d+)*>/i;
  253.     var y = /< *patb +bar +y *: *(\d+)*>/i;
  254.     var opacity = /< *patb +bar +opacity *: *(\d+)*>/i;
  255.     var size = /< *patb +bar +text +size *: *(\d+)*>/i;
  256.     data.note.split(/[\r\n]+/).forEach(function(line) {
  257.         if (line.match(show)) { return meta.patb_bar_show = RegExp.$1; }
  258.         if (line.match(w)) { return meta.patb_bar_w = +RegExp.$1; }
  259.         if (line.match(h)) { return meta.patb_bar_h = +RegExp.$1; }
  260.         if (line.match(x)) { return meta.patb_bar_x = +RegExp.$1; }
  261.         if (line.match(y)) { return meta.patb_bar_y = +RegExp.$1; }
  262.         if (line.match(opacity)) { return meta.patb_bar_opacity = +RegExp.$1; }
  263.         if (line.match(size)) { return meta.patb_bar_text_size = +RegExp.$1; }
  264.     });
  265. }; // DataManager.load_patb_bar_notes
  266.  
  267. /*----------------------------------------------------------------------------
  268.  *    # Edit class: Game_System                                              
  269.  *      - Stores the values of all configurations listed in the plugin manager
  270.  *----------------------------------------------------------------------------*/
  271.  
  272. Game_System.prototype.init_patb_bar_params =
  273. Game_System.prototype.init_patb_params;
  274. Game_System.prototype.init_patb_params = function() {
  275.     this.init_patb_bar_params();
  276.     // Added
  277.     var val, params;
  278.     params = PluginManager.parameters(DoubleX_RMMV.PATB_Bar_File);
  279.     Object.keys(params).forEach(function(param) {
  280.         val = +params[param];
  281.         this._patb[param] = isNaN(val) ? params[param] : val;
  282.     }, this);
  283.     //
  284. }; // Game_System.prototype.init_patb_params
  285.  
  286. /*----------------------------------------------------------------------------
  287.  *    # Edit class: Game_Battler                                              
  288.  *----------------------------------------------------------------------------*/
  289.  
  290. /*----------------------------------------------------------------------------
  291.  *    New private instance variables                                          
  292.  *----------------------------------------------------------------------------*/
  293. /* _patb_bar_show: The battler sprite ATB bar visibility flag
  294.  * _patb_bar_w: The battler sprite ATB bar width
  295.  * _patb_bar_h: The battler sprite ATB bar height
  296.  * _patb_bar_x: The battler sprite ATB bar x offset
  297.  * _patb_bar_y: The battler sprite ATB bar y offset
  298.  * _patb_bar_opacity: The battler sprite ATB bar opacity
  299.  * _patb_bar_text_size: The battler sprite ATB bar description text size
  300.  */
  301.  
  302. Game_Battler.prototype.init_patb_bar = Game_Battler.prototype.init_patb;
  303. Game_Battler.prototype.init_patb = function() {
  304.     this.init_patb_bar();
  305.     // Added
  306.     this._patb_battler_change.patb_bar_show = true;
  307.     this._patb_note_change.patb_bar_show = true;
  308.     this._patb_battler_change.patb_bar_w = true;
  309.     this._patb_note_change.patb_bar_w = true;
  310.     this._patb_battler_change.patb_bar_h = true;
  311.     this._patb_note_change.patb_bar_h = true;
  312.     this._patb_battler_change.patb_bar_x = true;
  313.     this._patb_note_change.patb_bar_x = true;
  314.     this._patb_battler_change.patb_bar_y = true;
  315.     this._patb_note_change.patb_bar_y = true;
  316.     this._patb_battler_change.patb_bar_opacity = true;
  317.     this._patb_note_change.patb_bar_opacity = true;
  318.     this._patb_battler_change.patb_bar_text_size = true;
  319.     this._patb_note_change.patb_bar_text_size = true;
  320.     //
  321. }; // Game_Battler.prototype.init_patb
  322.  
  323. // note: The battler sprite ATB bar notetag
  324. Game_Battler.prototype.patb_bar_note = function(note) { // New; Hotspot
  325.     if (this.are_patb_battler_changed("patb_" + note)) {
  326.         this.set_patb_bar_note(note);
  327.     }
  328.     return this["_patb_" + note];
  329. }; // Game_Battler.prototype.patb_bar_note
  330.  
  331. // note: The battler sprite ATB bar notetag
  332. Game_Battler.prototype.set_patb_bar_note = function(note) {
  333. // New; Potential Hotspot
  334.     var patb_note = "_patb_" + note;
  335.     this[patb_note] = this.set_patb_notes("patb_" + note);
  336.     if (!this[patb_note]) { this[patb_note] = $gameSystem.patb[note]; }
  337.     if (note !== "bar_show") { return; }
  338.     if (!this.isAlive()) { return this._patb_bar_show = false; }
  339.     if (this._patb_bar_show === "always") { return this._patb_bar_show = true; }
  340.     if (this._patb_bar_show === "defeat") {
  341.         return this._patb_bar_show = this.is_patb_defeated();
  342.     }
  343.     this._patb_bar_show = false;
  344. }; // Game_Battler.prototype.set_patb_bar_note
  345.  
  346. Game_Battler.prototype.is_patb_defeated = function() { // New; Potential Hotspot
  347.     return true; // This doesn't mean the battler's defeated before by default
  348. }; // Game_Battler.prototype.is_patb_defeated
  349.  
  350. /*----------------------------------------------------------------------------
  351.  *    # Edit class: Game_Enemy                                                
  352.  *----------------------------------------------------------------------------*/
  353.  
  354. Game_Enemy.prototype.is_patb_defeated = function() { // New; Potential Hotspot
  355.     if (!DoubleX_RMMV["Death Records"]) { return true; }
  356.     var death_record = this._enemyDeathRecords[enemyId];
  357.     return death_record && death_record > 0;
  358. }; // Game_Enemy.prototype.is_patb_defeated
  359.  
  360. /*----------------------------------------------------------------------------
  361.  *    # Edit class: Sprite_Battler                                            
  362.  *----------------------------------------------------------------------------*/
  363.  
  364. /*----------------------------------------------------------------------------
  365.  *    New private instance variable                                          
  366.  *----------------------------------------------------------------------------*/
  367. // _patb_bar: The battler sprite ATB bar
  368.  
  369. Sprite_Battler.prototype.initMembersPatbBar =
  370. Sprite_Battler.prototype.initMembers;
  371. Sprite_Battler.prototype.initMembers = function() {
  372.     this.initMembersPatbBar();
  373.     this.set_patb_bar(); // Added
  374. }; // Sprite_Battler.prototype.initMembers
  375.  
  376. /*----------------------------------------------------------------------------
  377.  *    Reconfigures the battler sprite ATB bar upon battler change            
  378.  *----------------------------------------------------------------------------*/
  379. Sprite_Battler.prototype.setBattlerPatbBar =
  380. Sprite_Battler.prototype.setBattler;
  381. Sprite_Battler.prototype.setBattler = function(battler) { // Hotspot
  382.     var change = battler !== this._battler; // Added
  383.     this.setBattlerPatbBar(battler);
  384.     if (battler && change) { this._patb_bar.battler = battler; } // Added
  385. }; // Sprite_Battler.prototype.setBattler
  386.  
  387. Sprite_Battler.prototype.updatePatbBar = Sprite_Battler.prototype.update;
  388. Sprite_Battler.prototype.update = function() { // Hotspot
  389.     this.updatePatbBar();
  390.     this._patb_bar.updateBar(); // Added
  391. }; // Sprite_Battler.prototype.update
  392.  
  393. Sprite_Battler.prototype.set_patb_bar = function() { // New
  394.     this._patb_bar = new Window_Patb_Bar();
  395.     this.addChild(this._patb_bar);
  396. }; // Sprite_Battler.prototype.set_patb_bar
  397.  
  398. /*----------------------------------------------------------------------------
  399.  *    # New class: Window_Patb_Bar                                            
  400.  *----------------------------------------------------------------------------*/
  401.  
  402. Window_Patb_Bar.prototype = Object.create(Window_Base.prototype);
  403. Window_Patb_Bar.prototype.constructor = Window_Patb_Bar;
  404.  
  405. /*----------------------------------------------------------------------------
  406.  *    New public instance variable                                            
  407.  *----------------------------------------------------------------------------*/
  408. Object.defineProperty(Window_Patb_Bar.prototype, 'battler', {
  409.     // The battler owning the battler sprite ATB bar
  410.     set: function(battler) { this._battler = battler; },
  411.     configurable: true
  412. });
  413.  
  414. /*----------------------------------------------------------------------------
  415.  *    New private instance variables                                          
  416.  *----------------------------------------------------------------------------*/
  417. /* _fillWidth: The battler sprite ATB bar fill width
  418.  * _redraw: The battler sprite ATB bar redraw flag
  419.  */
  420.  
  421. Window_Patb_Bar.prototype.initialize = function() {
  422.     var patb = $gameSystem.patb, x = patb.bar_x, y = patb.bar_y;
  423.     var w = patb.bar_w, h = patb.bar_h;
  424.     Window_Base.prototype.initialize.call(this, x, y, w, h);
  425.     this.opacity = 0; // Only the battler sprite ATB bar needs to be shown
  426. }; // Window_Patb_Bar.prototype.initialize
  427.  
  428. Window_Patb_Bar.prototype.standardFontSize = function() { // Hotspot
  429.     if (this._battler) {
  430.         return this._battler.patb_bar_note("bar_text_size");
  431.     }
  432.     return Window_Base.prototype.standardFontSize.call(this);
  433. }; // Window_Patb_Bar.prototype.standardFontSize
  434.  
  435. Window_Patb_Bar.prototype.standardPadding = function() { // Hotspot
  436.     return 0; // The whole window is just the battler sprite ATB bar
  437. }; // Window_Patb_Bar.prototype.standardPadding
  438.  
  439. Window_Patb_Bar.prototype.resetFontSettings = function() { // Hotspot
  440.     if (this.contents.fontSize === this.standardFontSize()) { return; }
  441.     Window_Base.prototype.resetFontSettings.call(this);
  442.     this._redraw = true;
  443. }; // Window_Patb_Bar.prototype.resetFontSettings
  444.  
  445. Window_Patb_Bar.prototype.updateBar = function() { // Hotspot
  446.     this.updateVisible();
  447.     if (!this.visible) { return; }
  448.     this.resetFontSettings();
  449.     this.updateNotes();
  450.     this.updateFillWidth();
  451.     if (this.needRedraw()) { this.redraw(); }
  452. }; // Window_Patb_Bar.prototype.updateBar
  453.  
  454. Window_Patb_Bar.prototype.updateVisible = function() { // Hotspot
  455.     if (!$gameSystem.is_patb()) { return this.visible = false; }
  456.     if (!BattleManager.can_update_patb()) { return this.visible = false; }
  457.     if (!this._battler) { return this.visible = false; } // It's to play safe
  458.     this.visible = this._battler.patb_bar_note("bar_show");
  459. }; // Window_Patb_Bar.prototype.updateVisible
  460.  
  461. Window_Patb_Bar.prototype.updateNotes = function() { // Hotspot
  462.     this.updateX();
  463.     this.updateY();
  464.     this.updateW();
  465.     this.updateH();
  466.     this.contentsOpacity = this._battler.patb_bar_note("bar_opacity");
  467. }; // Window_Patb_Bar.prototype.updateNotes
  468.  
  469. Window_Patb_Bar.prototype.updateX = function() { // v1.00b+; Hotspot
  470.     var newX = this._battler.patb_bar_note("bar_x");
  471.     if (this.x !== newX) { this.x = newX; }
  472. }; // Window_Patb_Bar.prototype.updateX
  473.  
  474. Window_Patb_Bar.prototype.updateY = function() { // v1.00b+; Hotspot
  475.     var newY = this._battler.patb_bar_note("bar_y");
  476.     if (this.y !== newY) { this.y = newY; }
  477. }; // Window_Patb_Bar.prototype.updateY
  478.  
  479. Window_Patb_Bar.prototype.updateW = function() { // Hotspot
  480.     var newW = this._battler.patb_bar_note("bar_w");
  481.     if (this.width === newW) return;
  482.     this.width = newW;
  483.     this._redraw = true;
  484. }; // Window_Patb_Bar.prototype.updateW
  485.  
  486. Window_Patb_Bar.prototype.updateH = function() { // Hotspot
  487.     var newH = this._battler.patb_bar_note("bar_h");
  488.     if (this.height === newH) return;
  489.     this.height = newH;
  490.     this._redraw = true;
  491. }; // Window_Patb_Bar.prototype.updateH
  492.  
  493. Window_Patb_Bar.prototype.updateFillWidth = function() { // Hotspot
  494.     var lastFillWidth = this._fillWidth, type = this._battler.patb_type();
  495.     this._fillWidth = this.width * this._battler.patb_fill_rate(type);
  496.     this._redraw = this._redraw || lastFillWidth !== this._fillWidth;
  497. }; // Window_Patb_Bar.prototype.updateFillWidth
  498.  
  499. /*----------------------------------------------------------------------------
  500.  *    Only redraws the ATB bar when it can change to boost performance        
  501.  *----------------------------------------------------------------------------*/
  502. Window_Patb_Bar.prototype.needRedraw = function() { // Hotspot
  503.     if (this._redraw) {
  504.         this._redraw = false;
  505.         return true;
  506.     }
  507.     return BattleManager.need_patb_refresh;
  508. }; // Window_Patb_Bar.prototype.needRedraw
  509.  
  510. Window_Patb_Bar.prototype.redraw = function() { // Potential Hotspot
  511.     var color = this.gaugeBackColor(), width = this._fillWidth;
  512.     this.contents.fillRect(0, 0, this.width, this.height, color);
  513.     var colors = this._battler.patb_colors(this._battler.patb_type());
  514.     var color1 = this.textColor(colors[0]), color2 = this.textColor(colors[1]);
  515.     this.contents.gradientFillRect(0, 0, width, this.height, color1, color2);
  516.     this.changeTextColor(this.systemColor());
  517.     var text = this._battler.patb_bar_text();
  518.     this.contents.drawText(text, 0, 0, this.textWidth(text), this.height);
  519. }; // Window_Patb_Bar.prototype.redraw
  520.  
  521. /*----------------------------------------------------------------------------*/
  522.  
  523. } else {
  524.     alert("To use PATB Bar, place it below PATB Core.");
  525. }
  526.  
  527. /*============================================================================*/
RAW Paste Data