Advertisement
Double_X

DoubleX RMMV Minimalized ATB Compact Edition v1.00a

Nov 18th, 2016 (edited)
290
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 Minimalized ATB                                          
  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.  *      Abilities:                                                            
  15.  *      1. Little Javascript coding proficiency to fully utilize this plugin  
  16.  *----------------------------------------------------------------------------
  17.  *    # Links                                                                
  18.  *      This plugin:                                                          
  19.  *      1. http://pastebin.com/znV2ZQmi                                      
  20.  *      Video:                                                                
  21.  *      1. https://www.youtube.com/watch?v=zkrXZTQnjFc                        
  22.  *      Mentioned Patreon Supporters:
  23.  *      https://www.patreon.com/posts/71738797
  24.  *----------------------------------------------------------------------------
  25.  *    # Author                                                                
  26.  *      DoubleX                                                              
  27.  *----------------------------------------------------------------------------
  28.  *    # Changelog                                                            
  29.  *      v1.00a(GMT 1400 22-1-2015):                                          
  30.  *      1. 1st completed version of this plugin finished                      
  31.  *      v0.00a(GMT 1200 9-12-2015):                                          
  32.  *      1. 1st testing version of this plugin finished                        
  33.  *============================================================================*/
  34. /*:
  35.  * @plugindesc To be the easiest, smallest and simplest atb system plugin ever
  36.  * @author DoubleX
  37.  *
  38.  * @param maxTurnUnit
  39.  * @desc Sets the maximum battle turn clock unit as maxTurnUnit
  40.  *       maxTurnUnit must return a Number and should return a positive one
  41.  * @default 5
  42.  *
  43.  * @param actorNameW
  44.  * @desc Sets the maximum width allocated for actor name display on the status
  45.  *       window as actorNameW
  46.  *       actorNameW must return a positive Number
  47.  * @default 123
  48.  *
  49.  * @param actorIconOx
  50.  * @desc Sets the actor icon display area x offset relative to the actor name
  51.  *       display area on the status window as actorIconOx
  52.  *       actorIconOx must return a positive Number
  53.  * @default 6
  54.  *
  55.  * @param hpBarOx
  56.  * @desc Sets the actor hp bar display area x offset relative to the actor icon
  57.  *       display area on the status window as hpBarOx
  58.  *       hpBarOx must return a positive Number
  59.  * @default 6
  60.  *
  61.  * @param hpBarW
  62.  * @desc Sets the maximum width allocated for actor hp bar display on the status
  63.  *       window as hpBarW
  64.  *       hpBarW must return a positive Number
  65.  * @default 87
  66.  *
  67.  * @param mpBarOx
  68.  * @desc Sets the actor mp bar display area x offset relative to the actor hp
  69.  *       bar display area on the status window as mpBarOx
  70.  *       mpBarOx must return a positive Number
  71.  * @default 6
  72.  *
  73.  * @param mpBarW
  74.  * @desc Sets the maximum width allocated for actor mp bar display on the status
  75.  *       window as mpBarW
  76.  *       mpBarW must return a positive Number
  77.  * @default 87
  78.  *
  79.  * @param tpBarOx
  80.  * @desc Sets the actor tp bar display area x offset relative to the actor mp
  81.  *       bar display area on the status window as tpBarOx
  82.  *       tpBarOx must return a positive Number
  83.  * @default 6
  84.  *
  85.  * @param tpBarW
  86.  * @desc Sets the maximum width allocated for actor tp bar display on the status
  87.  *       window as tpBarW
  88.  *       tpBarW must return a positive Number
  89.  * @default 87
  90.  *
  91.  * @param atbBarOx
  92.  * @desc Sets the actor atb bar display area x offset relative to the actor
  93.  *       mp/tp bar display area on the status window as atbBarOx
  94.  *       atbBarOx must return a positive Number
  95.  * @default 6
  96.  *
  97.  * @param atbBarW
  98.  * @desc Sets the maximum width allocated for actor atb bar display on the
  99.  *       status window as atbBarW
  100.  *       atbBarW must return a positive Number
  101.  * @default 87
  102.  *
  103.  * @param atbC1
  104.  * @desc Sets the 1st atb bar color as text color atbC1
  105.  *       atbC1 must return a valid text color code
  106.  *       atbC1 should return the same value during the same battle to ensure
  107.  *       proper atb bar color displays
  108.  * @default 7
  109.  *
  110.  * @param atbC2
  111.  * @desc Sets the 2nd atb bar color as text color atbC2
  112.  *       atbC2 must return a valid text color code
  113.  *       atbC2 should return the same value during the same battle to ensure
  114.  *       proper atb bar color displays
  115.  * @default 8
  116.  *
  117.  * @help
  118.  * The plugin file name must be the same as DoubleX_RMMV.MATB_File, which must
  119.  * be edited by editing this plugin js file directly
  120.  * The default value of DoubleX_RMMV.MATB_File is
  121.  * DoubleX RMMV Minimalized ATB v100a
  122.  *============================================================================
  123.  *    ## Plugin Call Info                                                    
  124.  *----------------------------------------------------------------------------
  125.  *    # Configuration manipulations                                          
  126.  *      1. $gameSystem._matb.param                                            
  127.  *         - Returns the value of param listed in the plugin manager          
  128.  *      2. $gameSystem._matb.param = val                                      
  129.  *         - Sets the value of param listed in the plugin manager as val      
  130.  *         - All $gameSystem._matb.param changes will be saved                
  131.  *    # Battle manipulations                                                  
  132.  *      1. _matbTurnClock                                                    
  133.  *         Returns the number of frames the turn clock has run in a turn      
  134.  *      2. _matbTurnClock = frame                                            
  135.  *         Sets the number of frames the turn clock has run in a turn as frame
  136.  *    # Battler manipulations                                                
  137.  *      1. _matbVal                                                          
  138.  *         - Returns the battler's atb value                                  
  139.  *      2. _matbVal = val                                                    
  140.  *         - Sets the battler's atb value as val which ranges from 0 to 100  
  141.  *      3. _matbValChange                                                    
  142.  *         - Returns whether the battler's atb value has just changed        
  143.  *      4. _matbValChange = true                                              
  144.  *         - Marks that the battler's atb value has just changed              
  145.  *           It must be used when any configuration other than maxTurnUnit  
  146.  *           changes during battles                                          
  147.  *      4. resetMatb()                                                        
  148.  *         - Clears all battler's actions and resets the battler's atb value  
  149.  *============================================================================
  150.  */
  151.  
  152. 'use strict';
  153. var DoubleX_RMMV = DoubleX_RMMV || {};
  154. DoubleX_RMMV['MATB'] = 'v0.00a';
  155.  
  156. // The plugin file name must be the same as DoubleX_RMMV.MATB_File
  157. DoubleX_RMMV.MATB_File = 'DoubleX RMMV Minimalized ATB v100a';
  158.  
  159. /*============================================================================
  160.  *    ## Plugin Implementations                                              
  161.  *       You need not edit this part as it's about how this plugin works      
  162.  *----------------------------------------------------------------------------
  163.  *    # Plugin Support Info:                                                  
  164.  *      1. Prerequisites                                                      
  165.  *         - Basic knowledge of this plugin on the user level, the default    
  166.  *           battle system implementations and the atb system concepts        
  167.  *         - Some Javascript coding proficiency to fully comprehend this      
  168.  *           plugin                                                          
  169.  *      2. Function documentation                                            
  170.  *         - The 1st part describes why this function's rewritten/extended for
  171.  *           rewritten/extended functions or what the function does for new  
  172.  *           functions                                                        
  173.  *         - The 2nd part describes what the arguments of the function are    
  174.  *         - The 3rd part informs which version rewritten, extended or created
  175.  *           this function                                                    
  176.  *         - The 4th part informs whether the function's rewritten or new    
  177.  *         - The 5th part informs whether the function's a real or potential  
  178.  *           hotspot                                                          
  179.  *         - The 6th part describes how this function works for new functions
  180.  *           only, and describes the parts added, removed or rewritten for    
  181.  *           rewritten or extended functions only                            
  182.  *         Example:                                                          
  183.  * /*----------------------------------------------------------------------
  184.  *  *    Why rewrite/extended/What this function does                      
  185.  *  *----------------------------------------------------------------------*/
  186. /* // arguments: What these arguments are                                    
  187.  * functionName = function(arguments) { // Version X+; Rewrite/New; Hotspot  
  188.  *     // Added/Removed/Rewritten to do something/How this function works    
  189.  *     functionNameCode;                                                      
  190.  *     //                                                                    
  191.  * } // functionName                                                          
  192.  *----------------------------------------------------------------------------*/
  193.  
  194. /*----------------------------------------------------------------------------
  195.  *    # Edit class: BattleManager                                            
  196.  *      - Reimplements the the whole battle flow to run the atb system        
  197.  *----------------------------------------------------------------------------*/
  198.  
  199. /*----------------------------------------------------------------------------
  200.  *    New private instance variable                                          
  201.  *----------------------------------------------------------------------------*/
  202. // _matbTurnClock: The battle turn atb clock
  203.  
  204. /*----------------------------------------------------------------------------
  205.  *    Keeps the appropriate input window opened if there are inputable actors
  206.  *----------------------------------------------------------------------------*/
  207. BattleManager.isInputting = function() { // Rewrite; Hotspot
  208.     return $gameParty.canInput(); // Rewritten
  209. }; // BattleManager.isInputting
  210.  
  211. BattleManager.startTurn = function() {}; // Rewrite
  212.  
  213. BattleManager.initMembersMatb = BattleManager.initMembers;
  214. BattleManager.initMembers = function() {
  215.     this.initMembersMatb();
  216.     this._matbTurnClock = 0; // Added
  217. }; // BattleManager.initMembers
  218.  
  219. BattleManager.startBattleMatb = BattleManager.startBattle;
  220. BattleManager.startBattle = function() {
  221.     this.startBattleMatb();
  222.     // Added
  223.     this._phase = 'turn';
  224.     var s = this._preemptive ? 'preempt' : this._surprise ? 'surprise' : 'norm';
  225.     this.allBattleMembers().forEach(function(mem) {
  226.         mem._matbVal = 0, mem._matbValChange = true;
  227.         if (!mem.canMove()) {
  228.             mem._matbVal = 0;
  229.         } else if (start === 'preempt' && mem.isActor()) {
  230.             mem._matbVal = 100;
  231.         } else if (start === 'surprise' && mem.isEnemy()) {
  232.             mem._matbVal = 100;
  233.         } else {
  234.             mem._matbVal = 0;
  235.         }
  236.         if (mem._matbVal >= 100) mem.makeActions();
  237.         if (mem.isActor()) mem._matbReserve = false;
  238.     });
  239.     //
  240. }; // BattleManager.startBattle
  241.  
  242. BattleManager.selectNextCommandMatb = BattleManager.selectNextCommand;
  243. BattleManager.selectNextCommand = function() {
  244.     // Added
  245.     var actor = this.actor();
  246.     if (actor._actionInputIndex >= actor.numActions() - 1) {
  247.         this.addMatbActionBattler(actor);
  248.     }
  249.     //
  250.     this.selectNextCommandMatb();
  251. }; // BattleManager.selectNextCommand
  252.  
  253. // battler: The battler to become eligible to be the action execution subject
  254. BattleManager.addMatbActionBattler = function(battler) { // New
  255.     if (this._actionBattlers.indexOf(battler) >= 0) return;
  256.     this._actionBattlers.push(battler);
  257. }; // BattleManager.addMatbActionBattler
  258.  
  259. /*----------------------------------------------------------------------------
  260.  *    # Edit class: Game_System                                              
  261.  *----------------------------------------------------------------------------*/
  262.  
  263. /*----------------------------------------------------------------------------
  264.  *    New private instance variable                                          
  265.  *----------------------------------------------------------------------------*/
  266. // _matb: The container of all configuration values
  267.  
  268. Game_System.prototype.initializeMatb = Game_System.prototype.initialize;
  269. Game_System.prototype.initialize = function() {
  270.     this.initializeMatb();
  271.     // Added
  272.     var val, params = PluginManager.parameters(DoubleX_RMMV.MATB_File);
  273.     this._matb = {};
  274.     Object.keys(params).forEach(function(param) {
  275.         val = +params[param];
  276.         this._matb[param] = isNaN(val) ? params[param] : val;
  277.     }, this);
  278.     //
  279. }; // Game_System.prototype.initialize
  280.  
  281. /*----------------------------------------------------------------------------
  282.  *    # Edit class: Game_BattlerBase                                          
  283.  *----------------------------------------------------------------------------*/
  284.  
  285. /*----------------------------------------------------------------------------
  286.  *    Updates state turns with different removal timings at different timings
  287.  *----------------------------------------------------------------------------*/
  288. Game_BattlerBase.prototype.updateStateTurns = function() { // Rewrite
  289.     this.updateMatbStateTurns(2); // Rewritten
  290. }; // Game_BattlerBase.prototype.updateStateTurns
  291.  
  292. Game_BattlerBase.prototype.hideMatb = Game_BattlerBase.prototype.hide;
  293. Game_BattlerBase.prototype.hide = function() {
  294.     this.hideMatb();
  295.     this.resetMatb(); // Added
  296. }; // Game_BattlerBase.prototype.hide
  297.  
  298. /*----------------------------------------------------------------------------
  299.  *    # Edit class: Game_Battler                                              
  300.  *      - Implements the battler's atb actions, clock, control flow and logics
  301.  *----------------------------------------------------------------------------*/
  302.  
  303. /*----------------------------------------------------------------------------
  304.  *    New private instance variables                                          
  305.  *----------------------------------------------------------------------------*/
  306. // _matbVal: The atb value
  307. // _matbValChange: The atb value change flag
  308.  
  309. Game_Battler.prototype.initMembersMatb = Game_Battler.prototype.initMembers;
  310. Game_Battler.prototype.initMembers = function() {
  311.     Game_Battler.prototype.initMembersMatb.call(this); // Prevents name clashes
  312.     this._matbVal = 0, this._matbValChange = true; // Added
  313. }; // Game_Battler.prototype.initMembers
  314.  
  315. Game_Battler.prototype.onRestrictMatb = Game_Battler.prototype.onRestrict;
  316. Game_Battler.prototype.onRestrict = function() {
  317.     this.onRestrictMatb();
  318.     // Added to fix nil action battlers bugs and edge cases as well
  319.     if (BattleManager._actionBattlers) this.resetMatb();
  320.     //
  321. }; // Game_Battler.prototype.onRestrict
  322.  
  323. Game_Battler.prototype.onAllActionsEndMatb =
  324. Game_Battler.prototype.onAllActionsEnd;
  325. Game_Battler.prototype.onAllActionsEnd = function() {
  326.     this.onAllActionsEndMatb();
  327.     // Added
  328.     this.updateMatbStateTurns(1);
  329.     this.resetMatb();
  330.     //
  331. }; // Game_Battler.prototype.onAllActionsEnd
  332.  
  333. Game_Battler.prototype.onTurnEndMatb = Game_Battler.prototype.onTurnEnd;
  334. Game_Battler.prototype.onTurnEnd = function() {
  335.     this.onTurnEndMatb();
  336.     this.removeBuffsAuto(); // Added
  337. }; // Game_Battler.prototype.onTurnEnd
  338.  
  339. /*----------------------------------------------------------------------------
  340.  *    Ensures battlers added after the battle starts won't carry statuses over
  341.  *----------------------------------------------------------------------------*/
  342. Game_Battler.prototype.onBattleEndMatb = Game_Battler.prototype.onBattleEnd;
  343. Game_Battler.prototype.onBattleEnd = function() {
  344.     this.onBattleEndMatb();
  345.     this.resetMatb(); // Added
  346. }; // Game_Battler.prototype.onBattleEnd
  347.  
  348. Game_Battler.prototype.resetMatb = function() { // New
  349.     this._matbVal = 0, this._matbValChange = true;
  350.     this.clearActions();
  351.     var index = BattleManager._actionBattlers.indexOf(this);
  352.     if (index >= 0) BattleManager._actionBattlers.splice(index, 1);
  353.     if (BattleManager.actor() === this) BattleManager.clearActor();
  354. }; // Game_Battler.prototype.resetMatb
  355.  
  356. // timing: The state auto removal timing
  357. Game_Battler.prototype.updateMatbStateTurns = function(timing) { // New
  358.     this.states().forEach(function(s) {
  359.         if (s.autoRemovalTiming === timing && this._stateTurns[s.id] > 0) {
  360.             this._stateTurns[s.id] -= 1;
  361.         }
  362.     }, this);
  363. }; // Game_Battler.prototype.updateMatbStateTurns
  364.  
  365. /*----------------------------------------------------------------------------
  366.  *    # Edit class: Game_Actor                                                
  367.  *----------------------------------------------------------------------------*/
  368.  
  369. /*----------------------------------------------------------------------------
  370.  *    New private instance variables                                          
  371.  *----------------------------------------------------------------------------*/
  372. // _matbReserve: The actor added during battles flag
  373.  
  374. /*----------------------------------------------------------------------------
  375.  *    Ensures actors added during battles are properly initialized as well    
  376.  *----------------------------------------------------------------------------*/
  377. Game_Actor.prototype.initMembersMatb = Game_Actor.prototype.initMembers;
  378. Game_Actor.prototype.initMembers = function() {
  379.     this.initMembersMatb();
  380.     this._matbReserve = true; // Added
  381. }; // Game_Actor.prototype.initMembers
  382.  
  383. Game_Actor.prototype.makeAutoBattleActionsMatb =
  384. Game_Actor.prototype.makeAutoBattleActions;
  385. Game_Actor.prototype.makeAutoBattleActions = function() {
  386.     this.makeAutoBattleActionsMatb();
  387.     BattleManager.addMatbActionBattler(this); // Added
  388. }; // Game_Actor.prototype.makeAutoBattleActions
  389.  
  390. Game_Actor.prototype.makeConfusionActionsMatb =
  391. Game_Actor.prototype.makeConfusionActions;
  392. Game_Actor.prototype.makeConfusionActions = function() {
  393.     this.makeConfusionActionsMatb();
  394.     BattleManager.addMatbActionBattler(this); // Added
  395. }; // Game_Actor.prototype.makeConfusionActions
  396.  
  397. Game_Actor.prototype.canInput = function() { // New; Hotspot
  398.     if (!Game_BattlerBase.prototype.canInput.call(this)) return false;
  399.     if (this.numActions() <= 0) return false;
  400.     if (this._actionInputIndex >= this.numActions() - 1) return false;
  401.     return BattleManager._actionBattlers.indexOf(this) < 0;
  402. }; // Game_Actor.prototype.canInput
  403.  
  404. /*----------------------------------------------------------------------------
  405.  *    Ensures actors added during battles are properly initialized as well    
  406.  *----------------------------------------------------------------------------*/
  407. Game_Actor.prototype.onBattleEnd = function() { // New
  408.     Game_Battler.prototype.onBattleEnd.call(this);
  409.     this._matbReserve = true; // Added
  410. }; // Game_Actor.prototype.onBattleEnd
  411.  
  412. /*----------------------------------------------------------------------------
  413.  *    # Edit class: Game_Enemy                                                
  414.  *----------------------------------------------------------------------------*/
  415.  
  416. Game_Enemy.prototype.makeActionsMatb = Game_Enemy.prototype.makeActions;
  417. Game_Enemy.prototype.makeActions = function() {
  418.     this.makeActionsMatb();
  419.     BattleManager.addMatbActionBattler(this); // Added
  420. }; // Game_Enemy.prototype.makeActions
  421.  
  422. /*----------------------------------------------------------------------------
  423.  *    # Edit class: Game_Party                                                
  424.  *----------------------------------------------------------------------------*/
  425.  
  426. Game_Party.prototype.clearActions = function() { // New
  427.     Game_Unit.prototype.clearActions.call(this);
  428.     // Added to reset all party members' atb values upon failed party escapes
  429.     this.aliveMembers().forEach(function(mem) { mem.resetMatb(); });
  430.     //
  431. }; // Game_Party.prototype.clearActions
  432.  
  433. /*----------------------------------------------------------------------------
  434.  *    # Edit class: Window_BattleStatus                                      
  435.  *----------------------------------------------------------------------------*/
  436.  
  437. Window_BattleStatus.prototype.basicAreaRect = function(index) { // Rewrite
  438.     // Rewritten to reallocate spaces to draw the atb bars
  439.     var rect = this.itemRectForText(index);
  440.     rect.width -= this.gaugeAreaWidth() + $gameSystem._matb.hpBarOx;
  441.     return rect;
  442.     //
  443. }; // Window_BattleStatus.prototype.basicAreaRect
  444.  
  445. Window_BattleStatus.prototype.gaugeAreaWidth = function() { // Rewrite; Hotspot
  446.     // Rewritten to reallocate spaces to draw the atb bars
  447.     var m = $gameSystem._matb, w = m.hpBarW + m.mpBarOx + m.mpBarW;
  448.     if ($dataSystem.optDisplayTp) w += m.tpBarOx + m.tpBarW;
  449.     return w + m.atbBarOx + m.atbBarW;
  450.     //
  451. }; // Window_BattleStatus.prototype.gaugeAreaWidth
  452.  
  453. Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) { // Rewrite
  454.     // Rewritten to reallocate spaces to draw the atb bars
  455.     var w = $gameSystem._matb.actorNameW;
  456.     this.drawActorName(actor, rect.x, rect.y, w);
  457.     var ox = w + $gameSystem._matb.actorIconOx;
  458.     this.drawActorIcons(actor, rect.x + ox, rect.y, rect.width - w);
  459.     //
  460. }; // Window_BattleStatus.prototype.drawBasicArea
  461.  
  462. Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
  463. // Rewrite
  464.     // Rewritten to reallocate spaces to draw the atb bars
  465.     var matb = $gameSystem._matb;
  466.     this.drawActorHp(actor, rect.x, rect.y, matb.hpBarW);
  467.     var ox = matb.hpBarW + matb.mpBarOx;
  468.     this.drawActorMp(actor, rect.x + ox, rect.y, matb.mpBarW);
  469.     ox += matb.mpBarW + matb.tpBarOx;
  470.     this.drawActorTp(actor, rect.x + ox, rect.y, matb.tpBarW);
  471.     ox += matb.tpBarW + matb.atbBarOx;
  472.     this.drawActorMatb(actor._matbVal / 100, rect.x + ox, rect.y);
  473.     //
  474. }; // Window_BattleStatus.prototype.drawGaugeAreaWithTp
  475.  
  476. Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
  477. // Rewrite
  478.     // Rewritten to reallocate spaces to draw the atb bars
  479.     var matb = $gameSystem._matb;
  480.     this.drawActorHp(actor, rect.x, rect.y, matb.hpBarW);
  481.     var ox = matb.hpBarW + matb.mpBarOx;
  482.     this.drawActorMp(actor, rect.x + ox, rect.y, matb.mpBarW);
  483.     ox += matb.mpBarW + matb.atbBarOx;
  484.     this.drawActorMatb(actor._matbVal / 100, rect.x + ox, rect.y);
  485.     //
  486. }; // Window_BattleStatus.prototype.drawGaugeAreaWithoutTp
  487.  
  488. Window_BattleStatus.prototype.refreshMatbBars = function() { // New; Hotspot
  489.     var matb = $gameSystem._matb, actor, rect;
  490.     var ox = matb.hpBarW + matb.mpBarOx + matb.mpBarW + matb.atbBarOx;
  491.     if ($dataSystem.optDisplayTp) ox += matb.tpBarOx + matb.tpBarW;
  492.     for (var index = 0, max = this.maxItems(); index < max; index++) {
  493.         actor = $gameParty.battleMembers()[index];
  494.         if (!actor || !actor._matbValChange) continue;
  495.         rect = this.gaugeAreaRect(index);
  496.         this.drawActorMatb(actor._matbVal / 100, rect.x + ox, rect.y);
  497.         actor._matbValChange = false;
  498.     }
  499. }; // Window_BattleStatus.prototype.refreshMatbBars
  500.  
  501. /* actor: The actor using the atb bar
  502.  * x: The atb bar x position
  503.  * y: The atb bar y position
  504.  */
  505. Window_BattleStatus.prototype.drawActorMatb = function(matbRate, x, y) {
  506. // New; Hotspot
  507.     var matb = $gameSystem._matb, w = matb.atbBarW;
  508.     var c0 = this.textColor(matb.atbC1), c1 = this.textColor(matb.atbC2);
  509.     this.drawGauge(x, y, w, matbRate, c0, c1);
  510.     this.changeTextColor(this.systemColor());
  511.     this.drawText('AP', x, y, this.textWidth('AP'));
  512. }; // Window_BattleStatus.prototype.drawActorMatb
  513.  
  514. /*----------------------------------------------------------------------------
  515.  *    # Edit class: Scene_Battle                                              
  516.  *----------------------------------------------------------------------------*/
  517.  
  518. Scene_Battle.prototype.updateBattleProcess = function() { // Rewrite; Hotspot
  519.     // Rewritten to reconstruct the action input and execution flows for atb
  520.     var BM = BattleManager;
  521.     if (BM.isAborting() || BM.isBattleEnd()) return BattleManager.update();
  522.     if (BM.isBusy() || BM.updateEvent()) return;
  523.     if (BM._phase === 'action') return BM.updateAction();
  524.     if (BM._phase && BM._phase !== 'init' && !this.isAnyInputWindowActive()) {
  525.         var movableActors = $gameParty.movableMembers();
  526.         var movableEnemies = $gameTroop.movableMembers();
  527.         movableActors.concat(movableEnemies).forEach(function(mem) {
  528.             if (mem.isActor() && mem._matbReserve) {
  529.                 mem._matbVal = 0, mem._matbValChange = true;
  530.                 mem._matbReserve = false;
  531.             }
  532.             if (mem._matbVal >= 100) return;
  533.             mem._matbVal += mem.agi / 100;
  534.             mem._matbValChange = mem.agi / 100 !== 0;
  535.             if (mem._matbVal < 100) return;
  536.             mem._matbVal = 100;
  537.             mem.makeActions();
  538.         });
  539.         BM._subject = BM._subject || BM._actionBattlers[0];
  540.         if (BM._subject) BM.processTurn();
  541.         if ((BM._matbTurnClock += 1) >= $gameSystem._matb.maxTurnUnit * 60) {
  542.             BM._matbTurnClock = 0;
  543.             BM.allBattleMembers().forEach(function(mem) {
  544.                 mem.onTurnEnd();
  545.                 BM.refreshStatus();
  546.                 BM._logWindow.displayAutoAffectedStatus(mem);
  547.                 BM._logWindow.displayRegeneration(mem);
  548.             });
  549.             $gameTroop.increaseTurn();
  550.             var actor_indices = $gameParty.members().filter(function(mem) {
  551.                 return mem.canInput();
  552.             }).map(function(mem) { return mem.index(); });
  553.             if (actor_indices.indexOf(this._statusWindow.index()) < 0) {
  554.                 if (this._statusWindow.index() > 0) {
  555.                     this._statusWindow.deselect();
  556.                 }
  557.                 if (actor_indices.length > 0) {
  558.                     BM._actorIndex = actor_indices[0];
  559.                     this.startActorCommandSelection();
  560.                 }
  561.             }
  562.             this._statusWindow.refreshMatbBars();
  563.         }
  564.     }
  565.     //
  566. }; // Scene_Battle.prototype.updateBattleProcess
  567.  
  568. Scene_Battle.prototype.updateWindowPositionsMatb =
  569. Scene_Battle.prototype.updateWindowPositions;
  570. Scene_Battle.prototype.updateWindowPositions = function() { // Hotspot
  571.     this.updateWindowPositionsMatb();
  572.     // Added to ensure the actor window will complete cover the status window
  573.     if (this._actorWindow.active) this._actorWindow.x = this._statusWindow.x;
  574.     //
  575. }; // Scene_Battle.prototype.updateWindowPositions
  576.  
  577. Scene_Battle.prototype.commandEscapeMatb = Scene_Battle.prototype.commandEscape;
  578. Scene_Battle.prototype.commandEscape = function() { // v1.00a+
  579.     // Rewritten to ensure party escape attempt won't trigger when battle's busy
  580.     if (BattleManager._phase !== 'action') return this.commandEscapeMatb();
  581.     this.startPartyCommandSelection();
  582.     //
  583. }; // Scene_Battle.prototype.commandEscape
  584.  
  585. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement