Advertisement
Double_X

DoubleX RMMV Popularized ATB Start v100a

Dec 1st, 2015 (edited)
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*============================================================================
  2.  *    ## Plugin Info                                                          
  3.  *----------------------------------------------------------------------------
  4.  *    # Plugin Name                                                          
  5.  *      DoubleX RMMV Popularized ATB Start                                    
  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/Qeii9CLm                                      
  22.  *      Mentioned Patreon Supporters:
  23.  *      https://www.patreon.com/posts/71738797
  24.  *----------------------------------------------------------------------------
  25.  *    # Author                                                                
  26.  *      DoubleX                                                              
  27.  *----------------------------------------------------------------------------
  28.  *    # Changelog                                                            
  29.  *      v1.00a(GMT 0500 23-1-2016):                                          
  30.  *      1. Fixed undefined DataManager.this bug                              
  31.  *      2. Fixed not loading this plugin's notetag bug                        
  32.  *      3. Fixed starting atb value possible to be under min or over max bug  
  33.  *      4. Fixed not passing arguments in set_start_patb_val bug              
  34.  *      5. Deleted some meaningless, pointless and useless documentations    
  35.  *      6. 1st completed version of this plugin finished                      
  36.  *      v0.00a(GMT 1400 29-11-2015):                                          
  37.  *      1. 1st testing version of this plugin finished                        
  38.  *============================================================================*/
  39. /*:
  40.  * @plugindesc Lets users alter individual battlers' atb value on battle start
  41.  * @author DoubleX
  42.  *
  43.  * @help
  44.  *============================================================================
  45.  *    ## Notetag Info                                                        
  46.  *----------------------------------------------------------------------------
  47.  *    # Actor/Class/Weapon/Armor/Enemy/State Notetags:                        
  48.  *      State notetags take the highest priority, followed by enemy, weapon,  
  49.  *      armor, class and actor                                                
  50.  *      1. <operator patb start: val>                                        
  51.  *         - Assigns val to the battler's atb value on battle start via      
  52.  *           operator                                                        
  53.  *         - operator can be either =, +, -, *, / or %, meaning set to, add  
  54.  *           by, subtract by, multiply by, divide by or modulo by respectively
  55.  *         - All instances of this notetag will be used sequentially          
  56.  *         - The final atb value on battle start will become                  
  57.  *           max_atb_val - atb value on battle start for atb fill code delay  
  58.  *============================================================================
  59.  *    ## Plugin Call Info                                                    
  60.  *----------------------------------------------------------------------------
  61.  *    # Data Actor/Class/Weapon/Armor/Enemy/State manipulations              
  62.  *      1. meta.patb_start                                                    
  63.  *         - Returns the atb value on battle start with the operator stored in
  64.  *           <operator patb start: val> in the form of [opeartor, val]        
  65.  *      2. meta.patb_start = [opeartor, val]                                  
  66.  *         - Sets the atb value on battle start with the operator stored in  
  67.  *           <operator patb start: val> as string operator and Number val    
  68.  *         - All meta.patb_start changes can be saved if                      
  69.  *           DoubleX RMMV Dynamic Data is used                                
  70.  *============================================================================
  71.  */
  72.  
  73. "use strict";
  74. var DoubleX_RMMV = DoubleX_RMMV || {};
  75. DoubleX_RMMV["PATB Start"] = "v1.00a";
  76.  
  77. /*============================================================================
  78.  *    ## Plugin Implementations                                              
  79.  *       You need not edit this part as it's about how this plugin works      
  80.  *----------------------------------------------------------------------------
  81.  *    # Plugin Support Info:                                                  
  82.  *      1. Prerequisites                                                      
  83.  *         - Basic knowledge of this plugin on the user level, the default    
  84.  *           battle system implementations and the atb system concepts        
  85.  *         - Some Javascript coding proficiency to fully comprehend this      
  86.  *           plugin                                                          
  87.  *      2. Function documentation                                            
  88.  *         - The 1st part describes why this function's rewritten/extended for
  89.  *           rewritten/extended functions or what the function does for new  
  90.  *           functions                                                        
  91.  *         - The 2nd part describes what the arguments of the function are    
  92.  *         - The 3rd part informs which version rewritten, extended or created
  93.  *           this function                                                    
  94.  *         - The 4th part informs whether the function's rewritten or new    
  95.  *         - The 5th part informs whether the function's a real or potential  
  96.  *           hotspot                                                          
  97.  *         - The 6th part describes how this function works for new functions
  98.  *           only, and describes the parts added, removed or rewritten for    
  99.  *           rewritten or extended functions only                            
  100.  *         Example:                                                          
  101.  * /*----------------------------------------------------------------------
  102.  *  *    Why rewrite/extended/What this function does                      
  103.  *  *----------------------------------------------------------------------*/
  104. /* // arguments: What these arguments are                                    
  105.  * function_name = function(arguments) { // Version X+; Rewrite/New; Hotspot  
  106.  *     // Added/Removed/Rewritten to do something/How this function works    
  107.  *     function_name_code;                                                    
  108.  *     //                                                                    
  109.  * } // function_name                                                        
  110.  *----------------------------------------------------------------------------*/
  111.  
  112. if (DoubleX_RMMV["PATB Core"]) {
  113.  
  114. /*----------------------------------------------------------------------------*/
  115.  
  116. /*----------------------------------------------------------------------------
  117.  *    # Edit class: DataManager                                              
  118.  *----------------------------------------------------------------------------*/
  119.  
  120. // data: The data to have its notetags read
  121. DataManager.load_patb_start_data_notes = DataManager.load_patb_data_notes;
  122. DataManager.load_patb_data_notes = function(data) {
  123.     this.load_patb_start_data_notes(data);
  124.     this.load_patb_start_notes(data); // Added
  125. }; // DataManager.load_patb_data_notes
  126.  
  127. // data: The data to have its notetags read
  128. DataManager.load_patb_start_notes = function(data) { // New
  129.     var s = /< *(.+) +patb +start *: *(\d+) *>/i, meta = data.meta;
  130.     meta.patb_start = [];
  131.     data.note.split(/[\r\n]+/).forEach(function(line) {
  132.         if (line.match(s)) { meta.patb_start.push([RegExp.$1, +RegExp.$2]); }
  133.     });
  134. }; // DataManager.load_patb_start_notes
  135.  
  136. /*----------------------------------------------------------------------------
  137.  *    # Edit class: Game_BattlerBase                                          
  138.  *----------------------------------------------------------------------------*/
  139.  
  140. // start: The battle start type
  141. Game_BattlerBase.prototype.set_base_start_patb_val =
  142. Game_BattlerBase.prototype.set_start_patb_val;
  143. Game_BattlerBase.prototype.set_start_patb_val = function(start) { // New
  144.     // Rewritten
  145.     this.set_base_start_patb_val(start);
  146.     var val = this._patb_val.atb;
  147.     this._patb_val.atb = this.set_multi_patb_notes(val, "patb_start");
  148.     if (this._patb_val.atb < 0) { return this._patb_val.atb = 0; }
  149.     if (this._patb_val.atb <= this._max_patb_val) { return; }
  150.     this._patb_val.atb = this._max_patb_val;
  151.     //
  152. }; // Game_BattlerBase.prototype.set_start_patb_val
  153.  
  154. /*----------------------------------------------------------------------------*/
  155.  
  156. } else {
  157.     alert("To use PATB Start, place it below PATB Core.");
  158. }
  159.  
  160. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement