Double_X

DoubleX RMMV Popularized ATB Cooldown v101c

Feb 9th, 2016
302
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 Cooldown                                
  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/USwE5Au0                                      
  22.  *      Video:                                                                
  23.  *      1. https://www.youtube.com/watch?v=tjR2RdGZ5Uw                        
  24.  *----------------------------------------------------------------------------
  25.  *    # Author                                                                
  26.  *      DoubleX                                                              
  27.  *----------------------------------------------------------------------------
  28.  *    # Changelog                                                            
  29.  *      v1.01b(GMT 1500 11-8-2016):                                          
  30.  *      1. In sync with the latest DoubleX RMMV Popularized ATB Core version  
  31.  *      v1.01a(GMT 0200 20-2-2016):                                          
  32.  *      1. Lets users set the cooldown bar description text via notetags      
  33.  *      2. Lets users trigger a common event upon battler cooldown finish    
  34.  *      3. Fixed not refreshing the battler upon finishing cooldown bug      
  35.  *      4. Fixed a compatibility issue with charge addon upon cooldown finish
  36.  *      v1.00a(GMT 1100 9-2-2016):                                            
  37.  *      1. 1st testing version of this plugin finished                        
  38.  *============================================================================*/
  39. /*:
  40.  * @plugindesc Lets users set skills/items causing user to cooldown after user
  41.  * @author DoubleX
  42.  *
  43.  * @param cooldown_c1
  44.  * @desc Sets the 1st atb cooldown bar color as text color cooldown_c1
  45.  *       cooldown_c1 must return a valid text color code
  46.  *       cooldown_c1 should return the same value during the same battle to
  47.  *       ensure proper atb cooldown bar color displays
  48.  * @default 19
  49.  *
  50.  * @param cooldown_c2
  51.  * @desc Sets the 2nd atb cooldown bar color as text color cooldown_c2
  52.  *       cooldown_c2 must return a valid text color code
  53.  *       cooldown_c2 should return the same value during the same battle to
  54.  *       ensure proper atb cooldown bar color displays
  55.  * @default 26
  56.  *
  57.  * @param cooldown_bar_text
  58.  * @desc Sets the code of the cooldown bar description text as cooldown_bar_text
  59.  *       It'll only be used if no <patb cooldown text: text> notetag's used
  60.  *       Available cooldown_bar_text code:
  61.  *       item - The skill/item name causing the cooldown will be the cooldown
  62.  *              bar description text
  63.  *       Setting cooldown_bar_text as an unavailable code means atb_bar_text
  64.  *       will be the cooldown bar description text
  65.  *       cooldown_bar_text should return the same code during the same battle to
  66.  *       ensure proper cooldown bar text displays
  67.  * @default item
  68.  *
  69.  * @param post_cooldown_common_event_id
  70.  * @desc Sets the common event with id post_cooldown_common_event_id to be
  71.  *       called right after a battler has finished cooling down
  72.  *       post_cooldown_common_event_id must return a Number
  73.  *       If post_cooldown_common_event_id doesn't return the id of an existing
  74.  *       common event, no common event will be called with this timing
  75.  * @default 0
  76.  *
  77.  * @help
  78.  * Battlers using skills/items without the <patb cooldown: scale, code>
  79.  * notetag will be fully cooled down in 1 frame
  80.  * The default plugin file name is DoubleX RMMV Popularized ATB Cooldown v101b
  81.  * If you want to change that, you must edit the value of
  82.  * DoubleX_RMMV.PATB_Cooldown_File, which must be done via opening this plugin
  83.  * js file directly
  84.  *============================================================================
  85.  *    ## Notetag Info                                                        
  86.  *----------------------------------------------------------------------------
  87.  *    # Skill/Item Notetags:                                                  
  88.  *      1. <patb cooldown: scale, code>                                      
  89.  *         - Sets the cooldown rate to use the skill/item's invocation speed,
  90.  *           which will be multiplied by scale                                
  91.  *         - code can be either of the below:                                
  92.  *           set - The cooldown value per frame will be the skill/item's      
  93.  *                 invocation speed * scale, which should be nonnegative      
  94.  *           add - The cooldown value per frame will be the absolute value of
  95.  *                 the battler atb gain value per frame + the skill/item's    
  96.  *                 invocation speed * scale                                  
  97.  *           multiply - If the skill/item's invocation speed * scale is      
  98.  *                      positive, the cooldown value per frame will be the    
  99.  *                      battler atb gain value per frame * the skill/item's  
  100.  *                      invocation speed * scale                              
  101.  *                      If the skill/item's invocation speed * scale is      
  102.  *                      negative, the cooldown value per frame will be the    
  103.  *                      battler atb gain value per frame / (the skill/item's  
  104.  *                      invocation speed * scale)                            
  105.  *                      If the skill/item's invocation speed * scale is 0, the
  106.  *                      battler using the skill/item will be fully cooled down
  107.  *                      in 1 frame                                            
  108.  *      2. <patb cooldown colors: text color 1, text color 2>                
  109.  *         - Changes the atb cooldown bar color 1 and 2 to text color 1 and 2
  110.  *           respectively when this notetag's used                            
  111.  *      3. <patb cooldown text: text>                                        
  112.  *         - Changes the atb cooldown bar description text as text when this  
  113.  *           notetag's used                                                  
  114.  *============================================================================
  115.  *    ## Plugin Call Info                                                    
  116.  *----------------------------------------------------------------------------
  117.  *    # Data Skill/Item manipulations                                        
  118.  *      1. meta.patb_cooldown                                                
  119.  *         - Returns the skill/item invocation speed scale and cooldown rate  
  120.  *           code in the form of { scale: scale, code: code }                
  121.  *      2. meta.patb_cooldown = { scale: scale, code: code }                  
  122.  *         - Sets the skill/item invocation speed scale and cooldown rate code
  123.  *           in the form of { scale: scale, code: code }                      
  124.  *         - All meta.patb_cooldown changes can be saved if                  
  125.  *           DoubleX RMMV Dynamic Data is used                                
  126.  *      3. meta.patb_cooldown_colors                                          
  127.  *         - Returns the text colors stored in                                
  128.  *           <patb cooldown colors: text color 1, text color 2> in the form of
  129.  *           [text color 1, text color 2]                                    
  130.  *      4. meta.patb_cooldown_colors = [text color 1, text color 2]          
  131.  *         - Sets the text colors stored in                                  
  132.  *           <patb cooldown colors: text color 1, text color 2> as text color
  133.  *           1 and 2                                                          
  134.  *         - All meta.patb_cooldown_colors changes can be saved if            
  135.  *           DoubleX RMMV Dynamic Data is used                                
  136.  *      5. meta.patb_cooldown_text                                            
  137.  *         - Returns the text stored in <patb cooldown text: text>            
  138.  *      6. meta.patb_cooldown_text = text                                    
  139.  *         - Sets the text stored in <patb cooldown text: text> as text      
  140.  *         - All meta.patb_cooldown_text changes can be saved if              
  141.  *           DoubleX RMMV Dynamic Data is used                                
  142.  *    # Battler manipulations                                                
  143.  *      1. patb_val.cooldown                                                  
  144.  *         - Returns the battler's cooldown value                            
  145.  *      2. patb_val.cooldown = val                                            
  146.  *         - Set the battler's cooldown value as val                          
  147.  *      3. patb_rate.cooldown                                                
  148.  *         - Returns the battler's cooldown rate                              
  149.  *      4. patb_rate.cooldown = rate                                          
  150.  *         - Set the battler's cooldown rate as rate                          
  151.  *         - It'll be reevaluated if it can be changed without plugin calls  
  152.  *      5. patb_val_change.cooldown = true                                    
  153.  *         - Notifies that the cooldown value's changed                      
  154.  *         - It must be used right after the atb bar length changed          
  155.  *============================================================================
  156.  */
  157.  
  158. "use strict";
  159. var DoubleX_RMMV = DoubleX_RMMV || {};
  160. DoubleX_RMMV["PATB Cooldown"] = "v1.01b";
  161.  
  162. // The plugin file name must be the same as DoubleX_RMMV.PATB_Cooldown_File
  163. DoubleX_RMMV.PATB_Cooldown_File = "DoubleX RMMV Popularized ATB Cooldown v101b";
  164.  
  165. /*============================================================================
  166.  *    ## Plugin Implementations                                              
  167.  *       You need not edit this part as it's about how this plugin works      
  168.  *----------------------------------------------------------------------------
  169.  *    # Plugin Support Info:                                                  
  170.  *      1. Prerequisites                                                      
  171.  *         - Basic knowledge of this plugin on the user level, the default    
  172.  *           battle system implementations and the atb system concepts        
  173.  *         - Some Javascript coding proficiency to fully comprehend this      
  174.  *           plugin                                                          
  175.  *      2. Function documentation                                            
  176.  *         - The 1st part describes why this function's rewritten/extended for
  177.  *           rewritten/extended functions or what the function does for new  
  178.  *           functions                                                        
  179.  *         - The 2nd part describes what the arguments of the function are    
  180.  *         - The 3rd part informs which version rewritten, extended or created
  181.  *           this function                                                    
  182.  *         - The 4th part informs whether the function's rewritten or new    
  183.  *         - The 5th part informs whether the function's a real or potential  
  184.  *           hotspot                                                          
  185.  *         - The 6th part describes how this function works for new functions
  186.  *           only, and describes the parts added, removed or rewritten for    
  187.  *           rewritten or extended functions only                            
  188.  *         Example:                                                          
  189.  * /*----------------------------------------------------------------------
  190.  *  *    Why rewrite/extended/What this function does                      
  191.  *  *----------------------------------------------------------------------*/
  192. /* // arguments: What these arguments are                                    
  193.  * function_name = function(arguments) { // Version X+; Rewrite/New; Hotspot  
  194.  *     // Added/Removed/Rewritten to do something/How this function works    
  195.  *     function_name_code;                                                    
  196.  *     //                                                                    
  197.  * } // function_name                                                        
  198.  *----------------------------------------------------------------------------*/
  199.  
  200. if (DoubleX_RMMV["PATB Core"]) {
  201.  
  202. /*----------------------------------------------------------------------------*/
  203.  
  204. /*----------------------------------------------------------------------------
  205.  *    # Edit class: DataManager                                              
  206.  *----------------------------------------------------------------------------*/
  207.  
  208. // data: The data to have its notetags read
  209. DataManager.load_all_patb_cooldown_notes = DataManager.load_all_patb_notes;
  210. DataManager.load_all_patb_notes = function() {
  211.     // Added
  212.     [$dataSkills, $dataItems].forEach(function(type) {
  213.         type.forEach(function(data) {
  214.             if (data) { this.load_patb_cooldown_notes(data); }
  215.         }, this);
  216.     }, this);
  217.     //
  218.     return this.load_all_patb_cooldown_notes();
  219. }; // DataManager.load_all_patb_notes
  220.  
  221. // data: The data to have its notetags read
  222. DataManager.load_patb_cooldown_notes = function(data) { // New
  223.     var cooldown = /< *patb +cooldown *: *(\d+) *, *(\w+) *>/i;
  224.     var color = /< *patb +cooldown +colors *: *(\d+) *, *(\d+) *>/i;
  225.     var text = /< *patb +cooldown +text *: *(\w+) *>/i, meta = data.meta;
  226.     data.note.split(/[\r\n]+/).forEach(function(line) {
  227.         if (line.match(cooldown)) {
  228.             return meta.patb_cooldown = { scale: +RegExp.$1, code: RegExp.$2 };
  229.         } else if (line.match(color)) {
  230.             return meta.patb_cooldown_colors = [+RegExp.$1, +RegExp.$2];
  231.         }
  232.         if (line.match(text)) { meta.patb_cooldown_text = RegExp.$1; }
  233.     });
  234.     // Sets the default to be fully cooled down in 1 frame
  235.     meta.patb_cooldown = meta.patb_cooldown || { scale: 0, code: "multiply" };
  236.     //
  237. }; // DataManager.load_patb_cooldown_notes
  238.  
  239. /*----------------------------------------------------------------------------
  240.  *    # Edit class: BattleManager                                            
  241.  *----------------------------------------------------------------------------*/
  242.  
  243. BattleManager.endActionPatbCooldown = BattleManager.endAction;
  244. BattleManager.endAction = function() {
  245.     // Added to initialize the cooldown right after using the skill/item
  246.     if ($gameSystem.is_patb()) { this._subject.set_patb_cooldown(); }
  247.     //
  248.     this.endActionPatbCooldown();
  249.     // Added to ensure the action execution subject won't be cooling down
  250.     if ($gameSystem.is_patb()) { this._subject = null; }
  251.     //
  252. }; // BattleManager.endAction
  253.  
  254. /*----------------------------------------------------------------------------
  255.  *    # (v1.01a+)Edit class: Game_Temp                                        
  256.  *----------------------------------------------------------------------------*/
  257.  
  258. // timing: The common event trigger timing
  259. Game_Temp.prototype.call_patb_event = function(timing) { // New
  260.     var id = $gameSystem.patb[timing + "_common_event_id"];
  261.     if ($dataCommonEvents[id]) { this.reserveCommonEvent(id); }
  262. }; // Game_Temp.prototype.call_patb_event
  263.  
  264. /*----------------------------------------------------------------------------
  265.  *    # Edit class: Game_System                                              
  266.  *      - Stores the values of all configurations listed in the plugin manager
  267.  *----------------------------------------------------------------------------*/
  268.  
  269. Game_System.prototype.init_patb_cooldown_params =
  270. Game_System.prototype.init_patb_params;
  271. Game_System.prototype.init_patb_params = function() {
  272.     this.init_patb_cooldown_params();
  273.     // Added
  274.     var params = PluginManager.parameters(DoubleX_RMMV.PATB_Cooldown_File), val;
  275.     Object.keys(params).forEach(function(param) {
  276.         val = +params[param];
  277.         this._patb[param] = isNaN(val) ? params[param] : val;
  278.     }, this);
  279.     //
  280. }; // Game_System.prototype.init_patb_params
  281.  
  282. /*----------------------------------------------------------------------------
  283.  *    # Edit class: Game_Battler                                              
  284.  *----------------------------------------------------------------------------*/
  285.  
  286. /*----------------------------------------------------------------------------
  287.  *    New private instance variables                                          
  288.  *----------------------------------------------------------------------------*/
  289. /* _patb_cooldown_item: The cached skill/item to read its name and notetags
  290.  * _patb_cooldown_text: The cached cooldown bar description text
  291.  */
  292.  
  293. Game_Battler.prototype.init_patb_cooldown = Game_Battler.prototype.init_patb;
  294. Game_Battler.prototype.init_patb = function() {
  295.     this.init_patb_cooldown();
  296.     // Added
  297.     this._patb_colors.cooldown = [];
  298.     this._patb_rate.cooldown = 0;
  299.     this.mark_patb_cooldown_change();
  300.     if ($gameSystem.patb.atb_fill_code === "delay") {
  301.         return this._patb_val.cooldown = this._max_patb_val;
  302.     }
  303.     this._patb_val.cooldown = 0;
  304.     //
  305. }; // Game_Battler.prototype.init_patb
  306.  
  307. Game_Battler.prototype.update_patb_cooldown_val =
  308. Game_Battler.prototype.update_patb_val;
  309. Game_Battler.prototype.update_patb_val = function(cap, sign) { // Hotspot
  310.     // Added
  311.     if (this.is_patb_cooldown()) {
  312.         return this.update_patb_cooldown(cap, sign);
  313.     }
  314.     //
  315.     this.update_patb_cooldown_val(cap, sign);
  316. }; // Game_Battler.prototype.update_patb_val
  317.  
  318. Game_Battler.prototype.set_patb_colors_cooldown =
  319. Game_Battler.prototype.set_patb_colors;
  320. Game_Battler.prototype.set_patb_colors = function(type) { // Potential Hotspot
  321.     // Added
  322.     if (type === "cooldown") {
  323.         return this.set_patb_cooldown_colors();
  324.     }
  325.     //
  326.     this.set_patb_colors_cooldown(type);
  327. }; // Game_Battler.prototype.set_patb_colors
  328.  
  329. Game_Battler.prototype.reset_patb_cooldown = Game_Battler.prototype.reset_patb;
  330. Game_Battler.prototype.reset_patb = function() { // New
  331.     this.reset_patb_cooldown_val(); // Added
  332.     this.reset_patb_cooldown();
  333. }; // Game_Battler.prototype.reset_patb
  334.  
  335. Game_Battler.prototype.can_patb_act_cooldown =
  336. Game_Battler.prototype.can_patb_act;
  337. Game_Battler.prototype.can_patb_act = function() { // Hotspot
  338.     // Rewritten
  339.     return this.can_patb_act_cooldown() && this.has_empty_patb_cooldown();
  340.     //
  341. }; // Game_Battler.prototype.can_patb_act
  342.  
  343. Game_Battler.prototype.patb_type_cooldown = Game_Battler.prototype.patb_type;
  344. Game_Battler.prototype.patb_type = function() { // Hotspot
  345.     // Rewritten
  346.     return this.is_patb_cooldown() ? "cooldown" : this.patb_type_cooldown();
  347.     //
  348. }; // Game_Battler.prototype.patb_type_cooldown
  349.  
  350. Game_Battler.prototype.patb_bar_text_cooldown =
  351. Game_Battler.prototype.patb_bar_text;
  352. Game_Battler.prototype.patb_bar_text = function() { // v1.01a+; Hotspot
  353.     // Added
  354.     if (this.is_patb_cooldown()) { return this.patb_cooldown_bar_text(); }
  355.     //
  356.     return this.patb_bar_text_cooldown();
  357. }; // Game_Battler.prototype.patb_bar_text
  358.  
  359. /* cap: The atb value cap stopping further atb value updates
  360.  * sign: The atb value update direction sign
  361.  */
  362. Game_Battler.prototype.update_patb_cooldown = function(cap, sign) {
  363. // New; Hotspot
  364.     var last_val = this._patb_val.cooldown;
  365.     this._patb_val.cooldown -= this.get_patb_cooldown_rate() * sign;
  366.     this._patb_val_change.cooldown = last_val !== this._patb_val.cooldown;
  367.     if (this._patb_val.cooldown * sign <= (this._max_patb_val - cap) * sign) {
  368.         this.process_post_patb_cooldown(cap, sign);
  369.     }
  370. }; // Game_Battler.prototype.update_patb_cooldown
  371.  
  372. Game_Battler.prototype.get_patb_cooldown_rate = function() {
  373. // New; Hotspot
  374.     if (this.can_patb_cooldown_rate_change()) {
  375.         this._patb_rate.cooldown = this.set_patb_cooldown_rate();
  376.     }
  377.     return this._patb_rate.cooldown;
  378. }; // Game_Battler.prototype.get_patb_cooldown_rate
  379.  
  380. Game_Battler.prototype.can_patb_cooldown_rate_change = function() {
  381. // New; Hotspot
  382.     if (this._patb_rate.atb !== this.get_patb_rate()) { return true; }
  383.     return this.are_patb_battler_changed("cooldown_rate");
  384. }; // Game_Battler.prototype.can_patb_cooldown_rate_change
  385.  
  386. Game_Battler.prototype.set_patb_cooldown_rate = function() {
  387. // New; Potential Hotspot
  388.     var c = this._patb_cooldown_item.meta.patb_cooldown;
  389.     var r = this._patb_rate.atb, s = this._patb_cooldown_item.speed * c.scale;
  390.     switch (c.code) {
  391.         case "set": return s;
  392.         case "add": return Math.abs(r + s);
  393.         case "multiply":
  394.             return s > 0 ? r * s : s < 0 ? r / -s : this._max_patb_val;
  395.         default:
  396.             console.log("Invalid code " + c.code + " as notetag values");
  397.             return this._max_patb_val;
  398.     }
  399. }; // Game_Battler.prototype.set_patb_cooldown_rate
  400.  
  401. /* cap: The atb value cap stopping further atb value updates
  402.  * sign: The atb value update direction sign
  403.  */
  404. Game_Battler.prototype.process_post_patb_cooldown = function(cap, sign) {
  405. // v1.01a+; New
  406.     this._patb_val.cooldown = this._max_patb_val - cap;
  407.     $gameTemp.call_patb_event("post_cooldown");
  408.     this.set_patb_refresh();
  409.     // Caches the next action if there's any or process all actions end
  410.     if (!this._actions[0]) { return this.onAllActionsEnd(); }
  411.     this._patb_cooldown_item = this._actions[0].item();
  412.     //
  413. }; // Game_Battler.prototype.process_post_patb_cooldown
  414.  
  415. Game_Battler.prototype.reset_patb_cooldown_val = function() { // New
  416.     this._patb_cooldown_item = null;
  417.     this._patb_val_change.cooldown = true;
  418.     if ($gameSystem.patb.atb_fill_code === "delay") {
  419.         return this._patb_val.cooldown = this._max_patb_val;
  420.     }
  421.     this._patb_val.cooldown = 0;
  422. }; // Game_Battler.prototype.reset_patb_cooldown_val
  423.  
  424. Game_Battler.prototype.has_empty_patb_cooldown = function() { // New; Hotspot
  425.     if ($gameSystem.patb.atb_fill_code === "delay") {
  426.         return this._patb_val.cooldown >= this._max_patb_val;
  427.     }
  428.     return this._patb_val.cooldown <= 0;
  429. }; // Game_Battler.prototype.has_empty_patb_cooldown
  430.  
  431. Game_Battler.prototype.is_patb_cooldown = function() { // New; Hotspot
  432.     if ($gameSystem.patb.atb_fill_code === "delay") {
  433.         return this._patb_val.cooldown < this._max_patb_val;
  434.     }
  435.     return this._patb_val.cooldown > 0;
  436. }; // Game_Battler.prototype.is_patb_cooldown
  437.  
  438. Game_Battler.prototype.set_patb_cooldown_colors = function() {
  439. // New; Potential Hotspot
  440.     if (this._patb_cooldown_item) {
  441.         var colors = this._patb_cooldown_item.meta.patb_cooldown_colors;
  442.         this._patb_colors.cooldown = colors;
  443.     }
  444.     if (this._patb_colors.cooldown) { return; }
  445.     var patb = $gameSystem.patb;
  446.     this._patb_colors.cooldown = [patb.cooldown_c1, patb.cooldown_c2];
  447. }; // Game_Battler.prototype.set_patb_cooldown_colors
  448.  
  449. Game_Battler.prototype.set_patb_cooldown = function() { // New
  450.     this.set_patb_refresh();
  451.     this.mark_patb_cooldown_change();
  452.     if ($gameSystem.patb.atb_fill_code === "delay") {
  453.         return this._patb_val.cooldown = 0;
  454.     }
  455.     this._patb_val.cooldown = this._max_patb_val;
  456. }; // Game_Battler.prototype.set_patb_cooldown
  457.  
  458. Game_Battler.prototype.set_patb_cooldown_meta = function() { // New
  459.     this.mark_patb_cooldown_change();
  460.     this._patb_cooldown_item = this._actions[0].item();
  461. }; // Game_Battler.prototype.set_patb_cooldown_meta
  462.  
  463. Game_Battler.prototype.mark_patb_cooldown_change = function() { // v1.01a+; New
  464.     this._patb_note_change.cooldown_color = true;
  465.     this._patb_note_change.cooldown_rate = true;
  466.     this._patb_note_change.cooldown_text = true;
  467.     this._patb_val_change.cooldown = true;
  468. }; // Game_Battler.prototype.mark_patb_cooldown_change
  469.  
  470. Game_Battler.prototype.patb_cooldown_bar_text = function() {
  471. // v1.01a+; New; Hotspot
  472.     if (this.are_patb_battler_changed("cooldown_text")) {
  473.         this.set_patb_cooldown_bar_text();
  474.     }
  475.     return this._patb_cooldown_text;
  476. }; // Game_Battler.prototype.patb_cooldown_bar_text
  477.  
  478. Game_Battler.prototype.set_patb_cooldown_bar_text = function() {
  479. // v1.01a+; New; Potential Hotspot
  480.     if (this._patb_cooldown_item) {
  481.         var text = this._patb_cooldown_item.meta.patb_cooldown_text;
  482.         if (text) { return this._patb_cooldown_text = text; }
  483.         if ($gameSystem.patb.cooldown_bar_text === "item") {
  484.             return this._patb_cooldown_text = this._patb_cooldown_item.name;
  485.         }
  486.     }
  487.     this._patb_cooldown_text = $gameSystem.patb.atb_bar_text;
  488. }; // Game_Battler.prototype.set_patb_cooldown_bar_text
  489.  
  490. /*----------------------------------------------------------------------------
  491.  *    # Edit class: Game_Actor                                                
  492.  *----------------------------------------------------------------------------*/
  493.  
  494. Game_Actor.prototype.confirm_patb_cooldown_act =
  495. Game_Actor.prototype.confirm_patb_act;
  496. Game_Actor.prototype.confirm_patb_act = function() { // v1.01b+
  497.     this.confirm_patb_cooldown_act();
  498.     this.set_patb_cooldown_meta(); // Added
  499. }; // Game_Actor.prototype.confirm_patb_act
  500.  
  501. Game_Actor.prototype.confirm_patb_cooldown_acts =
  502. Game_Actor.prototype.confirm_patb_acts;
  503. Game_Actor.prototype.confirm_patb_acts = function() {
  504.     this.confirm_patb_cooldown_acts();
  505.     this.set_patb_cooldown_meta(); // Added
  506. }; // Game_Actor.prototype.confirm_patb_acts
  507.  
  508. /*----------------------------------------------------------------------------
  509.  *    # Edit class: Game_Enemy                                                
  510.  *----------------------------------------------------------------------------*/
  511.  
  512. Game_Enemy.prototype.makeActionsPatbCooldown = Game_Enemy.prototype.makeActions;
  513. Game_Enemy.prototype.makeActions = function() {
  514.     this.makeActionsPatbCooldown();
  515.     if ($gameSystem.is_patb()) { this.set_patb_cooldown_meta(); } // Added
  516. }; // Game_Enemy.prototype.makeActions
  517.  
  518. /*----------------------------------------------------------------------------*/
  519.  
  520. } else {
  521.     alert("To use PATB Cooldown, place it below PATB Core.");
  522. }
  523.  
  524. /*============================================================================*/
RAW Paste Data