Advertisement
Double_X

DoubleX RMMV Popularized ATB Turn v100a

Nov 28th, 2015 (edited)
565
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 Turn                                    
  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/d9dWkYZE                                      
  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. Increased this plugin's compactness                                
  31.  *      2. 1st completed version of this plugin finished                      
  32.  *      v0.00b(GMT 0700 29-11-2015):                                          
  33.  *      1. Increased this plugin's compactness                                
  34.  *      v0.00a(GMT 0600 28-11-2015):                                          
  35.  *      1. 1st testing version of this plugin finished                        
  36.  *============================================================================*/
  37. /*:
  38.  * @plugindesc Lets users multiply the max turn unit by the number of battlers
  39.  * @author DoubleX
  40.  *
  41.  * @param max_turn_unit_battler_code
  42.  * @desc Sets the code indicating which battlers will be counted for
  43.  *       multiplying with max_turn_unit as max_turn_unit_battler_code
  44.  *       The number of counted battlers will be multiplied to max_turn_unit
  45.  *       Available codes for max_turn_unit_battler_code:
  46.  *       alive_battler - All alive battlers will be counted
  47.  *       alive_actor - All alive actors will be counted
  48.  *       alive_enemy - All alive enemies will be counted
  49.  *       all_battler - All battlers will be counted
  50.  *       all_actor - All actors will be counted
  51.  *       all_enemy - All enemies will be counted
  52.  *       max_turn_unit_battler_code won't be used if it doesn't return any
  53.  *       available code
  54.  * @default alive_battler
  55.  *
  56.  * @help
  57.  * The plugin file name must be the same as DoubleX_RMMV.PATB_Turn_File, which
  58.  * must be edited by editing the plugin js file directly
  59.  * The default value of DoubleX_RMMV.PATB_Turn_File is
  60.  * DoubleX RMMV Popularized ATB Turn v100a
  61.  *============================================================================
  62.  *    ## Plugin Call Info                                                    
  63.  *----------------------------------------------------------------------------
  64.  *    # Configuration manipulations                                          
  65.  *      1. $gameSystem.patb.param                                            
  66.  *         - Returns the value of param listed in the plugin manager          
  67.  *      2. $gameSystem.patb.param = val                                      
  68.  *         - Sets the value of param listed in the plugin manager as val      
  69.  *         - All $gameSystem.patb.param changes will be saved                
  70.  *============================================================================
  71.  */
  72.  
  73. "use strict";
  74. var DoubleX_RMMV = DoubleX_RMMV || {};
  75. DoubleX_RMMV["PATB Turn"] = "v1.00a";
  76.  
  77. // The plugin file name must be the same as DoubleX_RMMV.PATB_Turn_File
  78. DoubleX_RMMV.PATB_Turn_File = "DoubleX RMMV Popularized ATB Turn v100a";
  79.  
  80. /*============================================================================
  81.  *    ## Plugin Implementations                                              
  82.  *       You need not edit this part as it's about how this plugin works      
  83.  *----------------------------------------------------------------------------
  84.  *    # Plugin Support Info:                                                  
  85.  *      1. Prerequisites                                                      
  86.  *         - Basic knowledge of this plugin on the user level, the default    
  87.  *           battle system implementations and the atb system concepts        
  88.  *         - Some Javascript coding proficiency to fully comprehend this      
  89.  *           plugin                                                          
  90.  *      2. Function documentation                                            
  91.  *         - The 1st part describes why this function's rewritten/extended for
  92.  *           rewritten/extended functions or what the function does for new  
  93.  *           functions                                                        
  94.  *         - The 2nd part describes what the arguments of the function are    
  95.  *         - The 3rd part informs which version rewritten, extended or created
  96.  *           this function                                                    
  97.  *         - The 4th part informs whether the function's rewritten or new    
  98.  *         - The 5th part informs whether the function's a real or potential  
  99.  *           hotspot                                                          
  100.  *         - The 6th part describes how this function works for new functions
  101.  *           only, and describes the parts added, removed or rewritten for    
  102.  *           rewritten or extended functions only                            
  103.  *         Example:                                                          
  104.  * /*----------------------------------------------------------------------
  105.  *  *    Why rewrite/extended/What this function does                      
  106.  *  *----------------------------------------------------------------------*/
  107. /* // arguments: What these arguments are                                    
  108.  * function_name = function(arguments) { // Version X+; Rewrite/New; Hotspot  
  109.  *     // Added/Removed/Rewritten to do something/How this function works    
  110.  *     function_name_code;                                                    
  111.  *     //                                                                    
  112.  * } // function_name                                                        
  113.  *----------------------------------------------------------------------------*/
  114.  
  115. if (DoubleX_RMMV["PATB Core"]) {
  116.  
  117. /*----------------------------------------------------------------------------*/
  118.  
  119. /*----------------------------------------------------------------------------
  120.  *    # Edit class: Game_System                                              
  121.  *      - Stores the values of all configurations listed in the plugin manager
  122.  *----------------------------------------------------------------------------*/
  123.  
  124. Game_System.prototype.init_patb_turn_params =
  125. Game_System.prototype.init_patb_params;
  126. Game_System.prototype.init_patb_params = function() {
  127.     this.init_patb_turn_params();
  128.     // Added
  129.     var ps = PluginManager.parameters(DoubleX_RMMV.PATB_Turn_File);
  130.     Object.keys(ps).forEach(function(p) { this._patb[p] = ps[p]; }, this);
  131.     //
  132. }; // Game_System.prototype.init_patb_params
  133.  
  134. // unit: The battle turn counter unit
  135. Game_System.prototype.max_patb_turn_unit_count =
  136. Game_System.prototype.max_patb_turn_unit;
  137. Game_System.prototype.max_patb_turn_unit = function(unit) { // Hotspot
  138.     // Rewritten
  139.     var max = this.max_patb_turn_unit_count(unit);
  140.     return max * this.max_patb_turn_unit_multiplier();
  141.     //
  142. }; // Game_System.prototype.max_patb_turn_unit
  143.  
  144. Game_System.prototype.max_patb_turn_unit_multiplier = function() {
  145. // New; Hotspot
  146.     switch (this._patb.max_turn_unit_battler_code) {
  147.         case "alive_battler":
  148.             var count = $gameParty.aliveMembers().length;
  149.             return (count + $gameTroop.aliveMembers().length);
  150.         case "alive_actor": return $gameParty.aliveMembers().length;
  151.         case "alive_enemy": return $gameTroop.aliveMembers().length;
  152.         case "all_battler":
  153.             var count = $gameParty.battleMembers().length;
  154.             return (count + $gameTroop.members().length);
  155.         case "all_actor": return $gameParty.battleMembers().length;
  156.         case "all_enemy": return $gameTroop.members().length;
  157.         default: return 1;
  158.     }
  159. }; // Game_System.prototype.max_patb_turn_unit_multiplier
  160.  
  161. /*----------------------------------------------------------------------------*/
  162.  
  163. } else {
  164.     alert("To use PATB Turn, place it below PATB Core.");
  165. }
  166.  
  167. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement