Advertisement
Double_X

DoubleX RMMV Popularized ATB Compatibility v105a

Apr 12th, 2016 (edited)
1,432
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 Compatibility
  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. Nothing special
  18.  *----------------------------------------------------------------------------
  19.  *    # Links
  20.  *      This plugin:
  21.  *      1. http://pastebin.com/SXpV9Zwt
  22.  *      Video:
  23.  *      1. https://www.youtube.com/watch?v=aoBI3DaE3g8
  24.  *      Mentioned Patreon Supporters:
  25.  *      https://www.patreon.com/posts/71738797
  26.  *----------------------------------------------------------------------------
  27.  *    # Instructions
  28.  *      1. Place this plugin below all DoubleX RMMV Popularized ATB addons
  29.  *----------------------------------------------------------------------------
  30.  *    # Author
  31.  *      DoubleX
  32.  *----------------------------------------------------------------------------
  33.  *    # Changelog
  34.  *      v1.05a(GMT 0600 26-12-2022):
  35.  *      1. Compatible With Yanfly Engine Plugins - Battle Artificial
  36.  *         Intelligence Core
  37.  *      v1.04a(GMT 0500 1-1-2022):
  38.  *      1. Compatible With Yanfly Engine Plugins - Battle Engine Extension -
  39.  *         Animated Sideview Enemies
  40.  *      v1.03f(GMT 0700 23-6-2021):
  41.  *      1. Fixed the visuals of the action sequences of actor sprites being
  42.  *         reset when other actors are inputable bug
  43.  *      v1.03e(GMT 0700 19-6-2020):
  44.  *      1. Fixed the <= patb reset: val> notetag always resetting the ATB to 0
  45.  *         with Yanfly Engine Plugins - Battle Engine Core bug
  46.  *      v1.03d(GMT 0300 14-5-2020):
  47.  *      1. Fixed target cursor disappearing when the windows' refreshed
  48.  *      2. Fixed skill/item/target help window not showing after it's closed
  49.  *      v1.03c(GMT 0400 28-4-2020):
  50.  *      1. Fixed not closing the target help window when the actor's dead with
  51.  *         Yanfly Engine Plugins - Battle Engine Core enabled
  52.  *      v1.03b(GMT 0200 7-9-2017):
  53.  *      1. Fixed returning the sprite of the currently inputable actor to its
  54.  *         home position when an action performs its finish sequence
  55.  *         compatiblity issue
  56.  *      v1.03a(GMT 0400 27-8-2017):
  57.  *      1. Supports Action Sequences in
  58.  *         Yanfly Engine Plugins - Battle Engine Core
  59.  *      2. Fixed more changing currently inputable actor with
  60.  *         Yanfly Engine Plugins - Target Extension - Selection Control
  61.  *         compatibility issues
  62.  *      v1.02b(GMT 1400 26-8-2017):
  63.  *      1. Fixed showing status window with MOG_BattleHud compatility issue
  64.  *      2. Fixed changing currently inputable actor with
  65.  *         Yanfly Engine Plugins - Target Extension - Selection Control
  66.  *         compatibility issue
  67.  *      v1.02a(GMT 1400 13-8-2017):
  68.  *      1. Compatible with
  69.  *         Yanfly Engine Plugins - Target Extension - Selection Control
  70.  *      v1.01b(GMT 0400 11-8-2017):
  71.  *      1. Fixed the wrong actor window position bug when using skills/items
  72.  *         on party members
  73.  *      v1.01a(GMT 0500 10-8-2017):
  74.  *      1. Compatible with MOG_BattleHud
  75.  *      v1.00e(GMT 1200 5-8-2017):
  76.  *      1. Fixed the next action incorrectly highlighting all members in the
  77.  *         same party/troop after using an party/troop targeting skill/item
  78.  *      v1.00d(GMT 1500 11-8-2016):
  79.  *      1. In sync with the latest DoubleX RMMV Popularized ATB Core version
  80.  *      v1.00c(GMT 1400 9-8-2016):
  81.  *      1. Fixed skills/items not needing selections not working when
  82.  *         Select Help Window in Yanfly Engine Plugins - Battle Engine Core is
  83.  *         set as false
  84.  *      v1.00b(GMT 0400 16-7-2016):
  85.  *      1. PATB Hotkey supports selecting inputable actors via touch input
  86.  *         when Yanfly Engine Plugins - Battle Engine Core is used with
  87.  *         Visual Actor Select being set as true as well
  88.  *         Mouse Over applies to PATB Hotkey as well
  89.  *      v1.00a(GMT 1600 12-4-2016):
  90.  *      1. 1st version of this plugin finished
  91.  *============================================================================*/
  92. /*:
  93.  * @plugindesc Fixes DoubleX RMMV Popularized ATB compatibility issues
  94.  * @author DoubleX
  95.  *
  96.  * @help
  97.  *============================================================================
  98.  *    ## (v1.03a+)Action Sequences(Yanfly Engine Plugins - Battle Engine Core)
  99.  *       Reference tag: YEP_BattleEngineCore_ActionSequences
  100.  *----------------------------------------------------------------------------
  101.  *    # DoubleX RMMV Popularized ATB Core
  102.  *      1. atb val: Target Typing, Operator Value
  103.  *         - Use Operator to assign Value to the atb value of targets included
  104.  *           by Target Typing, which can be any Target Typing supported by
  105.  *           Action Sequences that targets battlers not cooling down
  106.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  107.  *           by, subtract by, multiply by, divide by or modulo by respectively
  108.  *      2. atb val %: Target Typing, Operator Value
  109.  *         - Use Operator to assign Value% of the maximum atb value to the atb
  110.  *           value of targets included by Target Typing, which can be any
  111.  *           Target Typing supported by Action Sequences that targets battlers
  112.  *           not cooling down
  113.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  114.  *           by, subtract by, multiply by, divide by or modulo by respectively
  115.  *      3. reset atb val: Target Typing
  116.  *         - Resets the atb value of targets included by Target Typing, which
  117.  *           can be any Target Typing supported by Action Sequences, to the
  118.  *           maximum atb value in delay fill mode and 0 if otherwise
  119.  *      4. reset atb: Target Typing
  120.  *         - Clears all actions of targets included by Target Typing, which
  121.  *           can be any Target Typing supported by Action Sequences
  122.  *    # DoubleX RMMV Popularized ATB Charge
  123.  *      1. charge val: Target Typing, Operator Value
  124.  *         - Use Operator to assign Value to the charge value of targets
  125.  *           included by Target Typing, which can be any Target Typing
  126.  *           supported by Action Sequences that targets battlers charging
  127.  *           actions
  128.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  129.  *           by, subtract by, multiply by, divide by or modulo by respectively
  130.  *      2. charge val %: Target Typing, Operator Value
  131.  *         - Use Operator to assign Value% of the maximum atb value to the
  132.  *           charge value of targets included by Target Typing, which can be
  133.  *           any Target Typing supported by Action Sequences that targets
  134.  *           battlers charging actions
  135.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  136.  *           by, subtract by, multiply by, divide by or modulo by respectively
  137.  *    # DoubleX RMMV Popularized ATB Cooldown
  138.  *      1. cooldown val: Target Typing, Operator Value
  139.  *         - Use Operator to assign Value to the cooldown value of targets
  140.  *           included by Target Typing, which can be any Target Typing
  141.  *           supported by Action Sequences that targets battlers cooling down
  142.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  143.  *           by, subtract by, multiply by, divide by or modulo by respectively
  144.  *      2. cooldown val %: Target Typing, Operator Value
  145.  *         - Use Operator to assign Value% of the maximum atb value to the
  146.  *           cooldown value of targets included by Target Typing, which can be
  147.  *           any Target Typing supported by Action Sequences that targets
  148.  *           battlers cooling down
  149.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  150.  *           by, subtract by, multiply by, divide by or modulo by respectively
  151.  *    # DoubleX RMMV Popularized ATB Countdown
  152.  *      1. countdown clock: Target Typing, Operator Value State
  153.  *         - Use operator to assign Value to the number of frames as the
  154.  *           countdown clock of state with id State for targets included by
  155.  *           Target Typing, which can be any any Target Typing supported by
  156.  *           Action Sequences that targets battlers having said state
  157.  *         - The fps is assumed to be always 60
  158.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  159.  *           by, subtract by, multiply by, divide by or modulo by respectively
  160.  *      2. countdown freeze: Target Typing, Flag State
  161.  *         - Assign Flag, which is either true or false, to set whether the
  162.  *           countdown clock of state with id State is frozen for targets
  163.  *           included by Target Typing, which can be any any Target Typing
  164.  *           supported by Action Sequences that targets battlers having said
  165.  *           state
  166.  *    # DoubleX RMMV Popularized ATB Delay
  167.  *      1. delay frame: Target Typing, Operator Value
  168.  *         - Use Operator to assign Value to the number of frames as delay for
  169.  *           targets included by Target Typing, which can be any Target Typing
  170.  *           supported by Action Sequences
  171.  *         - The fps is assumed to be always 60
  172.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  173.  *           by, subtract by, multiply by, divide by or modulo by respectively
  174.  *    # DoubleX RMMV Popularized ATB Reset
  175.  *      1. reset val: Target Typing, Operator Value
  176.  *         - Use Operator to assign Value to the atb reset value for targets
  177.  *           included by Target Typing, which can be any Target Typing
  178.  *           supported by Action Sequences
  179.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  180.  *           by, subtract by, multiply by, divide by or modulo by respectively
  181.  *      2. reset val %: Target Typing, Operator Value
  182.  *         - Use Operator to assign Value% of the maximum atb value to the atb
  183.  *           reset value for targets included by Target Typing, which can be
  184.  *           any Target Typing supported by Action Sequences
  185.  *         - Operator can be either =, +, -, *, / or %, meaning set to, add
  186.  *           by, subtract by, multiply by, divide by or modulo by respectively
  187.  *============================================================================
  188.  *    ## Addressed Plugins
  189.  *----------------------------------------------------------------------------
  190.  *    # (v1.05a+)Yanfly Engine Plugins - Battle Artificial Intelligence Core
  191.  *      1. The last action in the enemy AI priority list will still be
  192.  *         executed even when no actions in the list fulfill their conditions
  193.  *         - Reference tag: YEP_BattleAICore_ClearInvalidAIActions
  194.  *         - Extended BattleManager.add_patb_action_battler and
  195.  *           Game_Enemy.prototype.setAIPattern to clear all those invalid
  196.  *           actions
  197.  *         - This fix might cause some other compatibility issues with some
  198.  *           other plugins extending or rewriting makeActions
  199.  *    # (v1.04a+)Yanfly Engine Plugins - Battle Engine Extension -
  200.  *      Animated Sideview Enemies
  201.  *      1. The ATB bars in DoubleX RMMV Popularized ATB Bar are needlessly
  202.  *         mirrored as well when mirroring animated sideview enemies
  203.  *         - Reference tag: YEP_X_AnimatedSVEnemies_UnmirrorMirroredATBBars
  204.  *         - Extended Window_Patb_Bar.prototype.updateBar to mirror the ATB
  205.  *           bars again if their parents are mirrored
  206.  *         - This fix might cause minor performance issues on low-end mobiles
  207.  *    # (v1.02a+)Yanfly Engine Plugins - Target Extension - Selection Control
  208.  *      1. The enemy window freezes when the current inputable actor becomes
  209.  *         not inputable
  210.  *         - Reference tag: YEP_X_SelectionControl_StopUnlockingEnemyWindow
  211.  *         - Extended Scene_Battle.prototype.close_patb_selection_windows to
  212.  *           stop closing the enemy window upon the aforementioned event
  213.  *      2. (v1.02b+)The currently inputable actor changes when picking targets
  214.  *         - Reference tag: YEP_X_SelectionControl_NewStatusWindowIndex
  215.  *         - Added get property patb_index in Window_BattleStatus
  216.  *         - Extended Window_BattleStatus.prototype.select to use a new
  217.  *           variable to store the index that are not affected by selecting
  218.  *           targets
  219.  *         - Extended Window_BattleEnemy.prototype.hide and
  220.  *           Window_BattleEnemy.prototype.select to select targets without
  221.  *           changing the new index
  222.  *    # (v1.01a+)MOG_BattleHud:
  223.  *      1. The ATB bar doesn't gather any DoubleX RMMV Popularized ATB data
  224.  *         - Reference tag: MOG_BattleHud_PATB_Data
  225.  *         - Rewritten Battle_Hud.prototype.update_at to support cooldown too
  226.  *         - Extended Battle_Hud.prototype.at, Battle_Hud.prototype.max_at,
  227.  *           Battle_Hud.prototype.cast_at, Battle_Hud.prototype.cast_max_at
  228.  *           and Battle_Hud.prototype.is_casting to support atb and charge
  229.  *         - Added Battle_Hud.prototype.cooldown_at,
  230.  *           Battle_Hud.prototype.cooldown_max_at,
  231.  *           Battle_Hud.prototype.is_cooling_down and
  232.  *           Battle_Hud.prototype.is_max_cooldown to support cooldown
  233.  *      2. (v1.01b+) The actor window isn't fully shown
  234.  *         - Reference tag: MOG_BattleHud_Actor_Window
  235.  *         - Removed Scene_Battle.prototype.update_patb_window_positions to
  236.  *           let MOG_BattleHud handle the actor window position
  237.  *      3. (v1.02b+)The original status window will be shown when the current
  238.  *         inputable actor becomes not inputable
  239.  *         - Reference tag: MOG_BattleHud_StopShowingStatusWindow
  240.  *         - Extended Scene_Battle.prototype.close_patb_selection_windows to
  241.  *           stop showing the status window upon the aforementioned event
  242.  *    # Yanfly Engine Plugins - Battle Engine Core:
  243.  *      1. All battler actions are recreated upon starting actor inputs
  244.  *         - Reference tag: YEP_BattleEngineCore_StopRecreateAction
  245.  *         - Stopped calling BattleManager.createActions when patb's effective
  246.  *      2. Valid actions don't execute at all
  247.  *         - Reference tag: YEP_BattleEngineCore_HandleNewPhases
  248.  *         - Extended BattleManager.can_update_patb_process to handle new
  249.  *           phases added by Yanfly Engine Plugins - Battle Engine Core
  250.  *      3. The battler's atb's reset right after executing 1 action already
  251.  *         - Reference tag: YEP_BattleEngineCore_StopAllActsEnd
  252.  *         - Stopped calling Game_Battler.prototype.on_all_patb_acts_end when
  253.  *           the battler still has actions
  254.  *      4. Skills/Items targeting all/random allies/enemies are confirmed
  255.  *         before the target selection's complete
  256.  *         - Reference tag: YEP_BattleEngineCore_StopConfirmAllRandomSelection
  257.  *         - Removed all Game_Action.prototype.confirm_patb_item contents
  258.  *         - (v1.00c+) Stopped this fix when Select Help Window is false
  259.  *      5. Right now wait_cond_code full and force run atb are still
  260.  *         functioning as act
  261.  *         - Due to BattleManager.can_update_patb_process to handle new phases
  262.  *           added by Yanfly Engine Plugins - Battle Engine Core
  263.  *      6. (v1.00e+) Subsequent actions of an all-selection one all wrongly
  264.  *         mark all party/troop members
  265.  *         - Reference tag: YEP_BattleEngineCore_StopWrongAllSelections
  266.  *         - Extended Scene_Battle.prototype.select_next_patb_command to stop
  267.  *           marking actions as all selections
  268.  *      7. (v1.03b+) The sprite of the currently inputable actor will return
  269.  *         to its home position when any action performs its finish sequence
  270.  *         - Reference tag: YEP_BattleEngineCore_StopInputableActorReturnHome
  271.  *         - Extended Game_Battler.prototype.spriteReturnHome to disable this
  272.  *           function for the currently inputable actor
  273.  *      8. (v1.03c+) The target help window remains when the actor's dead
  274.  *         - Reference tag: YEP_BattleEngineCore_CloseInvalidTargetHelpWindow
  275.  *         - Added Window_Help.prototype.deselect and extended
  276.  *           Scene_Battle.prototype.patb_selection_windows to close the stale
  277.  *           help window
  278.  *      9. (v1.03d+) The skill/item target help window doesn't show
  279.  *         - Reference tag: YEP_BattleEngineCore_ShowHelpWindow
  280.  *         - Extended commandSkill, commandItem, selectActorSelection and
  281.  *           selectActorSelection to explicitly open the help window
  282.  *      10. (v1.03d+) The selection and help window lost info after refresh
  283.  *         - Reference tag: YEP_BattleEngineCore_UpdateSelectionHelpWindow
  284.  *         - Extended refresh_patb_windows to reselect the selection windows
  285.  *           and update their respective help windows
  286.  *      11. (v1.03e+) The <= patb reset: val> notetag always reset the ATB
  287.  *          value to 0
  288.  *          - Reference tag: YEP_BattleEngineCore_StopSubjectOnAllActsEnd
  289.  *          - Extended BattleManager.endAction to stop calling onAllActionsEnd
  290.  *            twice for the action execution subject
  291.  *      12. (v1.03f+) The visuals of action sequences of actor sprites will be
  292.  *          reset when there are other inputable actors
  293.  *          - Reference tag: YEP_BattleEngineCore_StopRefreshBattlerMotion
  294.  *          - Rewritten Game_Battler.prototype.requestMotionRefresh to stop
  295.  *            refreshing the motions of battler sprites when executing the
  296.  *            action sequences
  297.  *============================================================================
  298.  */
  299.  
  300. "use strict";
  301. var DoubleX_RMMV = DoubleX_RMMV || {};
  302. DoubleX_RMMV["PATB Compatibility"] = "v1.05a";
  303.  
  304. /*============================================================================
  305.  *    ## Plugin Implementations
  306.  *       You need not edit this part as it's about how this plugin works
  307.  *----------------------------------------------------------------------------
  308.  *    # Plugin Support Info:
  309.  *      1. Prerequisites
  310.  *         - Basic knowledge of how DoubleX RMMV Popularized ATB and each
  311.  *           addressed plugin works
  312.  *         - Some Javascript coding proficiency to fully comprehend this
  313.  *           plugin
  314.  *      2. Function documentation
  315.  *         - The 1st part describes why this function's rewritten/extended for
  316.  *           rewritten/extended functions or what the function does for new
  317.  *           functions
  318.  *         - The 2nd part describes what the arguments of the function are
  319.  *         - The 3rd part informs which version rewritten, extended or created
  320.  *           this function
  321.  *         - The 4th part informs whether the function's rewritten or new
  322.  *         - The 5th part informs whether the function's a real or potential
  323.  *           hotspot
  324.  *         - The 6th part describes how this function works for new functions
  325.  *           only, and describes the parts added, removed or rewritten for
  326.  *           rewritten or extended functions only
  327.  *         Example:
  328.  * /*----------------------------------------------------------------------
  329.  *  *    Why rewrite/extended/What this function does
  330.  *  *----------------------------------------------------------------------*/
  331. /* // arguments: What these arguments are
  332.  * function_name = function(arguments) { // Version X+; Rewrite/New; Hotspot
  333.  *     // Added/Removed/Rewritten to do something/How this function works
  334.  *     function_name_code;
  335.  *     //
  336.  * } // function_name
  337.  *----------------------------------------------------------------------------*/
  338.  
  339. if (DoubleX_RMMV["PATB Core"]) {
  340.  
  341. /*----------------------------------------------------------------------------*/
  342.  
  343. if (Imported.YEP_BattleEngineCore) {
  344.  
  345. /*----------------------------------------------------------------------------
  346.  *    # Edit class: BattleManager
  347.  *----------------------------------------------------------------------------*/
  348.  
  349.  /*----------------------------------------------------------------------------
  350.   *    (v1.03e+)New public instance variables
  351.   *----------------------------------------------------------------------------*/
  352.  Object.defineProperties(BattleManager, {
  353.      // Whether onAllActionsEnd is called by BattleManager.endAction
  354.      "is_end_patb_act": { get: function() {
  355.          return this._is_end_patb_act;
  356.      }, configurable: true }
  357.  });
  358.  
  359. BattleManager.initMembersPatbCompatibility = BattleManager.initMembers;
  360. BattleManager.initMembers = function() { // v1.03a+
  361.     this.initMembersPatbCompatibility();
  362.     // Added to setup the mapping from the action sequence tag to their handlers
  363.     this.init_patb_act_sequences();
  364.     // YEP_BattleEngineCore_ActionSequences
  365. }; // BattleManager.initMembers
  366.  
  367. BattleManager.endActionPatbCompatibility = BattleManager.endAction;
  368. BattleManager.endAction = function() { // v1.03e+
  369.     // Added to stop calling onAllActionsEnd for the action execution subject
  370.     if ($gameSystem.is_patb()) { this._is_end_patb_act = true; }
  371.     // YEP_BattleEngineCore_StopSubjectOnAllActsEnd
  372.     BattleManager.endActionPatbCompatibility();
  373.     this._is_end_patb_act = false;
  374. }; // BattleManager.endAction
  375.  
  376. BattleManager.processActionSequencePatbCompatibility =
  377. BattleManager.processActionSequence;
  378. BattleManager.processActionSequence = function(actionName, actionArgs) {
  379. // v1.03a+
  380.     // Added to process new action sequences mimicking patb plugin calls
  381.     if (this.is_patb_act_sequence(actionName)) {
  382.         return this.process_patb_act_sequence(actionName, actionArgs);
  383.     }
  384.     // YEP_BattleEngineCore_ActionSequences
  385.     return this.processActionSequencePatbCompatibility(actionName, actionArgs);
  386. }; // BattleManager.processActionSequence
  387.  
  388. BattleManager.createActionsPatbCompatibility = BattleManager.createActions;
  389. BattleManager.createActions = function() {
  390.     // Rewritten to stop recreating battler actions when starting actor inputs
  391.     if (!$gameSystem.is_patb()) { this.createActionsPatbCompatibility(); }
  392.     // YEP_BattleEngineCore_StopRecreateAction
  393. }; // BattleManager.createActions
  394.  
  395. BattleManager.can_update_patb_process_compatibility =
  396. BattleManager.can_update_patb_process;
  397. BattleManager.can_update_patb_process = function() { // Hotspot
  398.     // Added to let BattleManager.update handle all phases when executing action
  399.     if (this._phase === 'actionList' || this._phase === 'actionTargetList') {
  400.         this.update();
  401.         return false;
  402.     } else if (this._phase === 'phaseChange') {
  403.         this.update();
  404.         return false;
  405.     }
  406.     // YEP_BattleEngineCore_HandleNewPhases
  407.     return this.can_update_patb_process_compatibility();
  408. }; // BattleManager.can_update_patb_process
  409.  
  410. BattleManager.init_patb_act_sequences = function() { // v1.03a+; New
  411.     this._patb_act_sequences = {
  412.         // DoubleX RMMV Popularized ATB Core
  413.         'ATB VAL': 'process_patb_val_act_sequence',
  414.         'ATB VAL %': 'process_patb_val_percent_act_sequence',
  415.         'RESET ATB VAL': 'process_reset_patb_val_act_sequence',
  416.         'RESET ATB': 'process_reset_patb_act_sequence',
  417.         //
  418.         // DoubleX RMMV Popularized ATB Charge
  419.         'CHARGE VAL': 'process_patb_charge_val_act_sequence',
  420.         'CHARGE VAL %': 'process_patb_charge_val_percent_act_sequence',
  421.         //
  422.         // DoubleX RMMV Popularized ATB Cooldown
  423.         'COOLDOWN VAL': 'process_patb_cooldown_val_act_sequence',
  424.         'COOLDOWN VAL %': 'process_patb_cooldown_val_percent_act_sequence',
  425.         //
  426.         // DoubleX RMMV Popularized ATB Countdown
  427.         'COUNTDOWN CLOCK': 'process_patb_countdown_clock_act_sequence',
  428.         'COUNTDOWN FREEZE': 'process_patb_countdown_freeze_act_sequence',
  429.         //
  430.         // DoubleX RMMV Popularized ATB Delay
  431.         'DELAY FRAME': 'process_patb_delay_frame_act_sequence',
  432.         //
  433.         // DoubleX RMMV Popularized ATB Reset
  434.         'RESET VAL': 'process_patb_reset_val_act_sequence',
  435.         'RESET VAL %': 'process_patb_reset_val_percent_act_sequence'
  436.         //
  437.     };
  438.     this._patb_act_sequence_regex = {
  439.         // DoubleX RMMV Popularized ATB Core
  440.         'ATB VAL': / *(.+) +(\d+) */i,
  441.         'ATB VAL %': / *(.+) +(\d+) */i,
  442.         'RESET ATB VAL': /.*/i,
  443.         'RESET ATB': /.*/i,
  444.         //
  445.         // DoubleX RMMV Popularized ATB Charge
  446.         'CHARGE VAL': / *(.+) +(\d+) */i,
  447.         'CHARGE VAL %': / *(.+) +(\d+) */i,
  448.         //
  449.         // DoubleX RMMV Popularized ATB Cooldown
  450.         'COOLDOWN VAL': / *(.+) +(\d+) */i,
  451.         'COOLDOWN VAL %': / *(.+) +(\d+) */i,
  452.         //
  453.         // DoubleX RMMV Popularized ATB Countdown
  454.         'COUNTDOWN CLOCK': / *(.+) +(\d+) +(\d+) */i,
  455.         'COUNTDOWN FREEZE': / *(\w+) +(\d+) */i,
  456.         //
  457.         // DoubleX RMMV Popularized ATB Delay
  458.         'DELAY FRAME': / *(.+) +(\d+) */i,
  459.         //
  460.         // DoubleX RMMV Popularized ATB Reset
  461.         'RESET VAL': / *(.+) +(\d+) */i,
  462.         'RESET VAL %': / *(.+) +(\d+) */i
  463.         //
  464.     };
  465. }; // BattleManager.init_patb_act_sequences
  466.  
  467. BattleManager.is_patb_act_sequence = function(actionName) { // v1.03a+; New
  468.     return Object.keys(this._patb_act_sequences).indexOf(actionName) >= 0;
  469. }; // BattleManager.processActionSequence
  470.  
  471. BattleManager.process_patb_act_sequence = function(actionName, actionArgs) {
  472. // v1.03a+; New
  473.     if (!$gameSystem.is_patb()) { return true; }
  474.     var targets = this.makeActionTargets(actionArgs[0]);
  475.     if (targets.length <= 0) { return true; };
  476.     var cmd = actionArgs[1];
  477.     if (cmd && !cmd.match(this._patb_act_sequence_regex[actionName])) {
  478.         return true;
  479.     }
  480.     return this[this._patb_act_sequences[actionName]](targets, cmd);
  481. }; // BattleManager.process_patb_act_sequence
  482.  
  483. BattleManager.process_patb_val_act_sequence = function(targets) {
  484. // v1.03a+; New
  485.     var operator = RegExp.$1, val = +RegExp.$2 * 1.0;
  486.     targets.forEach(function(target) {
  487.         if (this.is_patb_charge(target)) { target.reset_patb(); }
  488.         var atb = target.patb_val.atb;
  489.         target.patb_val.atb = target.operate_patb_notes(atb, operator, val);
  490.     }, this);
  491.     return true;
  492. }; // BattleManager.process_patb_val_act_sequence
  493.  
  494. BattleManager.process_patb_val_percent_act_sequence = function(targets) {
  495. // v1.03a+; New
  496.     var operator = RegExp.$1, temp = +RegExp.$2;
  497.     targets.forEach(function(target) {
  498.         if (this.is_patb_charge(target)) { target.reset_patb(); }
  499.         var val = temp * target.max_patb_val / 100.0, atb = target.patb_val.atb;
  500.         target.patb_val.atb = target.operate_patb_notes(atb, operator, val);
  501.     }, this);
  502.     return true;
  503. }; // BattleManager.process_patb_val_percent_act_sequence
  504.  
  505. BattleManager.process_reset_patb_val_act_sequence = function(targets) {
  506. // v1.03a+; New
  507.     targets.forEach(function(target) { target.reset_patb_val(); }, this);
  508.     return true;
  509. }; // BattleManager.process_reset_patb_val_act_sequence
  510.  
  511. BattleManager.process_reset_patb_act_sequence = function(targets) {
  512. // v1.03a+; New
  513.     targets.forEach(function(target) { target.reset_patb(); }, this);
  514.     return true;
  515. }; // BattleManager.process_reset_patb_act_sequence
  516.  
  517. BattleManager.process_patb_charge_val_act_sequence = function(targets) {
  518. // v1.03a+; New
  519.     if (!DoubleX_RMMV["PATB Charge"]) { return true; }
  520.     var operator = RegExp.$1, val = +RegExp.$2 * 1.0;
  521.     targets.filter(this.is_patb_charge, this).forEach(function(target) {
  522.         var charge = target.patb_val.charge;
  523.         target.patb_val.charge =
  524.                 target.operate_patb_notes(charge, operator, val);
  525.     }, this);
  526.     return true;
  527. }; // BattleManager.process_patb_charge_val_act_sequence
  528.  
  529. BattleManager.process_patb_charge_val_percent_act_sequence = function(targets) {
  530. // v1.03a+; New
  531.     if (!DoubleX_RMMV["PATB Charge"]) { return true; }
  532.     var operator = RegExp.$1, temp = +RegExp.$2;
  533.     targets.filter(this.is_patb_charge, this).forEach(function(target) {
  534.         var val = temp * target.max_patb_val / 100.0;
  535.         var charge = target.patb_val.charge;
  536.         target.patb_val.charge =
  537.                 target.operate_patb_notes(charge, operator, val);
  538.     }, this);
  539.     return true;
  540. }; // BattleManager.process_patb_charge_val_percent_act_sequence
  541.  
  542. BattleManager.is_patb_charge = function(target) { // v1.03a+; New
  543.     if (this.is_patb_cooldown(target)) { return false; }
  544.     return DoubleX_RMMV["PATB Charge"] && target.is_patb_charge();
  545. }; // BattleManager.is_patb_charge
  546.  
  547. BattleManager.process_patb_cooldown_val_act_sequence = function(targets) {
  548. // v1.03a+; New
  549.     if (!DoubleX_RMMV["PATB Cooldown"]) { return true; }
  550.     var operator = RegExp.$1, val = +RegExp.$2 * 1.0;
  551.     targets.filter(this.is_patb_cooldown, this).forEach(function(target) {
  552.         var cooldown = target.patb_val.cooldown;
  553.         target.patb_val.cooldown =
  554.                 target.operate_patb_notes(cooldown, operator, val);
  555.     }, this);
  556.     return true;
  557. }; // BattleManager.process_patb_cooldown_val_act_sequence
  558.  
  559. BattleManager.process_patb_cooldown_val_percent_act_sequence = function(targets) {
  560. // v1.03a+; New
  561.     if (!DoubleX_RMMV["PATB Cooldown"]) { return true; }
  562.     var operator = RegExp.$1, temp = +RegExp.$2;
  563.     targets.filter(this.is_patb_cooldown, this).forEach(function(target) {
  564.         var val = temp * target.max_patb_val / 100.0;
  565.         var cooldown = target.patb_val.cooldown;
  566.         target.patb_val.cooldown =
  567.                 target.operate_patb_notes(cooldown, operator, val);
  568.     }, this);
  569.     return true;
  570. }; // BattleManager.process_patb_cooldown_val_percent_act_sequence
  571.  
  572. BattleManager.is_patb_cooldown = function(target) { // v1.03a+; New
  573.     return target.is_patb_cooldown();
  574. }; // BattleManager.is_patb_cooldown
  575.  
  576. BattleManager.process_patb_countdown_clock_act_sequence = function(targets) {
  577. // v1.03a+; New
  578.     if (!DoubleX_RMMV["PATB Countdown"]) { return true; }
  579.     var operator = RegExp.$1, val = +RegExp.$2, state_id = +RegExp.$3;
  580.     // Separating the filter function would cause make it too hard for learners
  581.     targets.filter(function(target) {
  582.         return target.isStateAdded(state_id);
  583.     }, this).forEach(function(target) {
  584.         var clock = target.patb_countdown_clock[state_id];
  585.         var new_clock = target.operate_patb_notes(clock, operator, val);;
  586.         target.patb_countdown_clock[state_id] = new_clock;
  587.     }, this);
  588.     //
  589.     return true;
  590. }; // BattleManager.process_patb_countdown_clock_act_sequence
  591.  
  592. BattleManager.process_patb_countdown_freeze_act_sequence = function(targets) {
  593. // v1.03a+; New
  594.     if (!DoubleX_RMMV["PATB Countdown"]) { return true; }
  595.     var is_freeze = RegExp.$1 === "true", state_id = +RegExp.$2;
  596.     // Separating the filter function would cause make it too hard for learners
  597.     targets.filter(function(target) {
  598.         return target.isStateAdded(state_id);
  599.     }, this).forEach(function(target) {
  600.         target.patb_countdown_freeze[state_id] = is_freeze;
  601.     }, this);
  602.     //
  603.     return true;
  604. }; // BattleManager.process_patb_countdown_freeze_act_sequence
  605.  
  606. BattleManager.process_patb_delay_frame_act_sequence = function(targets) {
  607. // v1.03a+; New
  608.     if (!DoubleX_RMMV["PATB Delay"]) { return true; }
  609.     var operator = RegExp.$1, val = +RegExp.$2;
  610.     // Restricting delay to its intended scope would make this sequence useless
  611.     targets.forEach(function(target) {
  612.         var delay = target.patb_delay;
  613.         target.patb_delay = target.operate_patb_notes(delay, operator, val);
  614.     }, this);
  615.     //
  616.     return true;
  617. }; // BattleManager.process_patb_delay_frame_act_sequence
  618.  
  619. BattleManager.process_patb_reset_val_act_sequence = function(targets) {
  620. // v1.03a+; New
  621.     if (!DoubleX_RMMV["PATB Reset"]) { return true; }
  622.     var operator = RegExp.$1, val = +RegExp.$2 * 1.0;
  623.     targets.forEach(function(target) {
  624.         var reset = target.patb_reset_val;
  625.         target.patb_reset_val = target.operate_patb_notes(reset, operator, val);
  626.     }, this);
  627.     return true;
  628. }; // BattleManager.process_patb_reset_val_act_sequence
  629.  
  630. BattleManager.process_patb_reset_val_percent_act_sequence = function(targets) {
  631. // v1.03a+; New
  632.     if (!DoubleX_RMMV["PATB Reset"]) { return true; }
  633.     var operator = RegExp.$1, temp = +RegExp.$2;
  634.     targets.forEach(function(target) {
  635.         var val = temp * target.max_patb_val / 100.0;
  636.         var reset = target.patb_reset_val;
  637.         target.patb_reset_val = target.operate_patb_notes(reset, operator, val);
  638.     }, this);
  639.     return true;
  640. }; // BattleManager.process_patb_reset_val_percent_act_sequence
  641.  
  642. /*----------------------------------------------------------------------------
  643.  *    # Edit class: Game_Battler
  644.  *----------------------------------------------------------------------------*/
  645.  
  646. Game_Battler.prototype.requestMotionRefresh = function() { // v1.03f+; Rewrite
  647.     var deadMotion = this.deadMotion();
  648.     if (this.isDead() && this._motionType !== deadMotion) {
  649.       this.requestMotion(deadMotion);
  650.     }
  651.     if (this.isDead() && this._motionType === deadMotion) { return; }
  652.     if (this._motionType === 'victory') { return; }
  653.     if (this._motionType === 'escape' && !BattleManager.isInputting()) {
  654.         return;
  655.     } else if (this._motionType === 'guard' && !BattleManager.isInputting()) {
  656.         return;
  657.     }
  658.     this.clearMotion();
  659.     // Rewritten to stop refreshing motion when executing action sequences
  660.     if (this.battler() && BattleManager.isInputting() && (!$gameSystem.is_patb() || BattleManager._phase !== "actionList" && BattleManager._phase !== "actionTargetList")) {
  661.       this.battler().refreshMotion();
  662.     }
  663.     // YEP_BattleEngineCore_StopRefreshBattlerMotion
  664. }; // Game_Battler.prototype.requestMotionRefresh
  665.  
  666. Game_Battler.prototype.spriteReturnHomePatbCompatibility =
  667. Game_Battler.prototype.spriteReturnHome;
  668. Game_Battler.prototype.spriteReturnHome = function() { // v1.03b+
  669.     // Added to stop returning home for the sprite of the currently inpuable one
  670.     if ($gameSystem.is_patb() && BattleManager.actor() === this) { return; }
  671.     // YEP_BattleEngineCore_StopInputableActorReturnHome
  672.     this.spriteReturnHomePatbCompatibility();
  673. }; // Game_Battler.prototype.spriteReturnHome
  674.  
  675. Game_Battler.prototype.on_all_patb_acts_end_comnpatibility =
  676. Game_Battler.prototype.on_all_patb_acts_end;
  677. Game_Battler.prototype.on_all_patb_acts_end = function() {
  678.     // Added to stop resetting the battler's atb when there's still actions
  679.     if (this.currentAction() || BattleManager.is_end_patb_act) { return; }
  680.     // YEP_BattleEngineCore_StopAllActsEnd
  681.     this.on_all_patb_acts_end_comnpatibility();
  682. }; // Game_Battler.prototype.on_all_patb_acts_end
  683.  
  684. /*----------------------------------------------------------------------------
  685.  *    # (v1.03c+)Edit class: Window_Help
  686.  *----------------------------------------------------------------------------*/
  687.  
  688. // Added to let the help window call the deselect method
  689. Window_Help.prototype.deselect = Window_Help.prototype.deselect || function() {};
  690. // YEP_BattleEngineCore_CloseInvalidTargetHelpWindow
  691.  
  692. /*----------------------------------------------------------------------------
  693.  *    # (v1.04a)Edit class: Window_Patb_Bar
  694.  *----------------------------------------------------------------------------*/
  695.  
  696. // Don't check if animated sideview enemies are on as it's a general problem
  697. Window_Patb_Bar.prototype.updateBarCompatibility =
  698. Window_Patb_Bar.prototype.updateBar;
  699. Window_Patb_Bar.prototype.updateBar = function() { // Hotspot
  700.     this.updateBarCompatibility();
  701.     // Added to mirror the ATB bar again if its parent's mirrored
  702.     if (this.visible) { Sprite_StateIcon.prototype.updateMirror.call(this); }
  703.     // YEP_X_AnimatedSVEnemies_UnmirrorMirroredATBBars
  704. }; // Window_Patb_Bar.prototype.updateBar
  705. // Fixes like this might cause minor performance issues on low-end mobiles
  706.  
  707. /*----------------------------------------------------------------------------
  708.  *    # (v1.03c+)Edit class: Scene_Battle
  709.  *----------------------------------------------------------------------------*/
  710.  
  711.  [
  712.      "commandSkill",
  713.      "commandItem",
  714.      "selectActorSelection",
  715.      "selectEnemySelection"
  716.  ].forEach(function(func) {
  717.      Scene_Battle.prototype[func + "PatbCompatibility"] =
  718.      Scene_Battle.prototype[func];
  719.      Scene_Battle.prototype[func] = function() {
  720.          this[func + "PatbCompatibility"]();
  721.          // Added to ensure that the target help window will be shown and active
  722.          this._helpWindow.open();
  723.          // YEP_BattleEngineCore_ShowHelpWindow
  724.      }; // Scene_Battle.prototype[func]
  725.  });
  726.  
  727.  Scene_Battle.prototype.refresh_patb_windows_comnpatibility =
  728.  Scene_Battle.prototype.refresh_patb_windows;
  729.  Scene_Battle.prototype.refresh_patb_windows = function() { // New
  730.      this.refresh_patb_windows_comnpatibility();
  731.      // Added to refresh the target help window as well
  732.      [this._actorWindow, this._enemyWindow].forEach(function(window) {
  733.        if (!window.visible) { return; }
  734.        window.reselect();
  735.        window.updateHelp();
  736.      }, this);
  737.      // YEP_BattleEngineCore_UpdateSelectionHelpWindow
  738.  }; // Scene_Battle.prototype.refresh_patb_windows
  739.  
  740. Scene_Battle.prototype.patb_selection_windows_comnpatibility =
  741. Scene_Battle.prototype.patb_selection_windows;
  742. Scene_Battle.prototype.patb_selection_windows = function() { // v1.03c+
  743.     // Edited to close the target help window as well
  744.     return this.patb_selection_windows_comnpatibility().concat(
  745.             [this._helpWindow]);
  746.     // YEP_BattleEngineCore_CloseInvalidTargetHelpWindow
  747. }; // Scene_Battle.prototype.patb_selection_windows
  748.  
  749. if (Imported.YEP_X_SelectionControl) {
  750.  
  751. /*----------------------------------------------------------------------------
  752.  *    # (v1.02b+)Edit class: Window_BattleStatus
  753.  *----------------------------------------------------------------------------*/
  754.  
  755. /*----------------------------------------------------------------------------
  756.  *    New public instance variable
  757.  *----------------------------------------------------------------------------*/
  758. // The index without being influenced by YEP_X_SelectionControl
  759. Object.defineProperty(Window_BattleStatus.prototype, "patb_index", {
  760.     get: function() { /* Hotspot */ return this._patb_index; },
  761.     configurable: true
  762. });
  763.  
  764. /*----------------------------------------------------------------------------
  765.  *    Uses a new variable to store the index that are not from target windows
  766.  *----------------------------------------------------------------------------*/
  767. Window_BattleStatus.prototype.select = function(index) { // New
  768.     Window_Selectable.prototype.select.call(this, index);
  769.     if (!$gameTemp.is_patb_selecting_targets) { this._patb_index = index; }
  770. }; // Window_BattleStatus.prototype.select
  771.  
  772. /*----------------------------------------------------------------------------
  773.  *    # (v1.02b+)Edit class: Window_BattleEnemy
  774.  *----------------------------------------------------------------------------*/
  775.  
  776. Window_BattleEnemy.prototype.hidePatbCompatibility =
  777. Window_BattleEnemy.prototype.hide;
  778. Window_BattleEnemy.prototype.hide = function() {
  779.     // Added to ensure the new index won't be influenced by selecting targets
  780.     $gameTemp.is_patb_selecting_targets = true;
  781.     // YEP_X_SelectionControl_NewStatusWindowIndex
  782.     Window_BattleEnemy.prototype.hidePatbCompatibility.call(this);
  783.     // Added to ensure the new index will be influenced by everything else
  784.     $gameTemp.is_patb_selecting_targets = false;
  785.     // YEP_X_SelectionControl_NewStatusWindowIndex
  786. }; // Window_BattleEnemy.prototype.hide
  787.  
  788. Window_BattleEnemy.prototype.selectPatbCompatibility =
  789. Window_BattleEnemy.prototype.select;
  790. Window_BattleEnemy.prototype.select = function(index) {
  791.     // Added to ensure the new index won't be influenced by selecting targets
  792.     $gameTemp.is_patb_selecting_targets = true;
  793.     // YEP_X_SelectionControl_NewStatusWindowIndex
  794.     Window_BattleEnemy.prototype.selectPatbCompatibility.call(this, index);
  795.     // Added to ensure the new index will be influenced by everything else
  796.     $gameTemp.is_patb_selecting_targets = false;
  797.     // YEP_X_SelectionControl_NewStatusWindowIndex
  798. }; // Window_BattleEnemy.prototype.select
  799.  
  800. /*----------------------------------------------------------------------------
  801.  *    # (v1.00e+)Edit class: Scene_Battle
  802.  *----------------------------------------------------------------------------*/
  803.  
  804. // actor_indices: The indices of all currently inputable actors
  805. Scene_Battle.prototype.update_patb_actor_selection = function() {
  806. // v1.02b+; Rewrite; Hotspot
  807.     var actor_indices = BattleManager.inputable_patb_actor_indices();
  808.     // Rewritten to use the index that are not changed by YEP_X_SelectionControl
  809.     var index = this._statusWindow.patb_index;
  810.     // YEP_X_SelectionControl_NewStatusWindowIndex
  811.     if (actor_indices.indexOf(index) >= 0) { return; }
  812.     // Deactivates the active input windows that should be no longer active
  813.     if (index >= 0) { return this.close_patb_selection_windows(); }
  814.     if (this._partyCommandWindow.active) {
  815.         if (actor_indices.length <= 0) {
  816.             this.close_patb_window(this._partyCommandWindow);
  817.         }
  818.         return;
  819.     }
  820.     //
  821.     if (actor_indices.length <= 0) { return; }
  822.     BattleManager.changeActor(actor_indices[0], 'waiting');
  823.     this.startActorCommandSelection();
  824. }; // Scene_Battle.prototype.update_patb_actor_selection
  825.  
  826. Scene_Battle.prototype.select_next_patb_command_comnpatibility =
  827. Scene_Battle.prototype.select_next_patb_command;
  828. Scene_Battle.prototype.select_next_patb_command = function() { // v1.00b+
  829.     this.select_next_patb_command_comnpatibility();
  830.     // Added to ensure that subsequent actions won't be marked as all selections
  831.     BattleManager.stopAllSelection();
  832.     // YEP_BattleEngineCore_StopWrongAllSelections
  833. }; // Scene_Battle.prototype.select_next_patb_command
  834.  
  835. Scene_Battle.prototype.close_patb_selection_windows_comnpatibility =
  836. Scene_Battle.prototype.close_patb_selection_windows;
  837. Scene_Battle.prototype.close_patb_selection_windows = function() { // v1.02a+
  838.     // Added to save the last active status before stopping it from being closed
  839.     var is_enemy_window_active = this._enemyWindow.active;
  840.     // YEP_X_SelectionControl_StopUnlockingEnemyWindow
  841.     this.close_patb_selection_windows_comnpatibility();
  842.     // Added to load the last active status after stopping it from being closed
  843.     if (is_enemy_window_active) this._enemyWindow.activate();
  844.     // YEP_X_SelectionControl_StopUnlockingEnemyWindow
  845. }; // Scene_Battle.prototype.close_patb_selection_windows
  846.  
  847. } // if (Imported.YEP_X_SelectionControl)
  848.  
  849. if (DoubleX_RMMV["PATB Hotkey"]) {
  850.  
  851. /*----------------------------------------------------------------------------
  852.  *    # (v1.00b+)Edit class: Window_ActorCommand.
  853.  *----------------------------------------------------------------------------*/
  854.  
  855. Window_ActorCommand.prototype.processTouch = function() { // New; Hotspot
  856.     this.process_patb_hotkey_touch();
  857.     Window_Selectable.prototype.processTouch.call(this);
  858. }; // Window_ActorCommand.prototype.processTouch
  859.  
  860. Window_ActorCommand.prototype.process_patb_hotkey_touch = function() {
  861. // New; Hotspot
  862.     if (!this.isOpenAndActive() || !$gameSystem.is_patb()) { return; }
  863.     this.process_patb_hotkey_touch_select();
  864.     this.process_patb_hotkey_touch_trigger();
  865. }; // Window_ActorCommand.prototype.process_patb_hotkey_touch
  866.  
  867. Window_ActorCommand.prototype.process_patb_hotkey_touch_select = function() {
  868. // New; Hotspot
  869.     if (!Yanfly.Param.BECSelectMouseOver) { return; }
  870.     var index = this.getMouseOverActor();
  871.     if (index < 0) { return; }
  872.     var mem = $gameParty.battleMembers()[index];
  873.     if (mem.isSelected()) { return; }
  874.     SoundManager.playCursor();
  875.     $gameParty.select(mem);
  876. }; // Window_ActorCommand.prototype.process_patb_hotkey_touch_select
  877.  
  878. Window_ActorCommand.prototype.process_patb_hotkey_touch_trigger = function() {
  879. // New; Hotspot
  880.     if (!eval(Yanfly.Param.BECActorSelect)) { return; }
  881.     if (!TouchInput.isTriggered() || this.isTouchedInsideFrame()) { return; }
  882.     var i = this.getClickedActor();
  883.     if (i < 0) { return; }
  884.     return this.callHandler($gameSystem.patb["hotkey_actor_" + i.toString()]);
  885. }; // Window_ActorCommand.prototype.process_patb_hotkey_touch_trigger
  886.  
  887. Window_ActorCommand.prototype.getClickedActor =
  888. Window_BattleActor.prototype.getClickedActor;
  889.  
  890. Window_ActorCommand.prototype.isClickedActor =
  891. Window_BattleActor.prototype.isClickedActor;
  892.  
  893. Window_ActorCommand.prototype.getMouseOverActor =
  894. Window_BattleActor.prototype.getMouseOverActor;
  895.  
  896. Window_ActorCommand.prototype.isMouseOverActor =
  897. Window_BattleActor.prototype.isMouseOverActor;
  898.  
  899. } // if (DoubleX_RMMV["PATB Hotkey"])
  900.  
  901. } // if (Imported.YEP_BattleEngineCore)
  902.  
  903. if (Imported.YEP_BattleAICore) {
  904.  
  905. /*----------------------------------------------------------------------------
  906.  *    # (v1.05a+)Edit class: BattleManager
  907.  *----------------------------------------------------------------------------*/
  908.  
  909. BattleManager.add_patb_action_battler_compatibility =
  910. BattleManager.add_patb_action_battler;
  911. BattleManager.add_patb_action_battler = function(battler) { // v1.05a+
  912.     // Added to clear invalid actions upon calling setAIPattern
  913.     var is_added = this._actionBattlers.indexOf(battler) >= 0;
  914.     if (is_added && $gameTemp.is_patb_set_ai_pattern) {
  915.         battler.makeActionsPatb();
  916.     }
  917.     // YEP_BattleAICore_ClearInvalidAIActions
  918.     BattleManager.add_patb_action_battler_compatibility(battler);
  919. }; // BattleManager.add_patb_action_battler
  920.  
  921. /*----------------------------------------------------------------------------
  922.  *    # (v1.05a+)Edit class: Game_Enemy
  923.  *----------------------------------------------------------------------------*/
  924.  
  925. Game_Enemy.prototype.setAIPatternPatbCompatibility =
  926. Game_Enemy.prototype.setAIPattern;
  927. Game_Enemy.prototype.setAIPattern = function() {
  928.     // Added to notify add_patb_action_battler to call makeActionsPatb
  929.     $gameTemp.is_patb_set_ai_pattern = true;
  930.     // YEP_BattleAICore_ClearInvalidAIActions
  931.     this.setAIPatternPatbCompatibility();
  932.     // Added to notify add_patb_action_battler to not call makeActionsPatb
  933.     $gameTemp.is_patb_set_ai_pattern = false;
  934.     // YEP_BattleAICore_ClearInvalidAIActions
  935. }; // Game_Enemy.prototype.setAIPattern
  936.  
  937. } // if (Imported.YEP_BattleAICore)
  938.  
  939. if (Imported.MOG_BattleHud) {
  940.  
  941. /*----------------------------------------------------------------------------
  942.  *    # (v1.01a+)Edit class: Battle_Hud
  943.  *----------------------------------------------------------------------------*/
  944.  
  945. Battle_Hud.prototype.update_at = function() {
  946.     if (this._at_meter) {
  947.         if (!this.at === -1) { return this._at_meter.visible = false; }
  948.         this._at_meter.visible = true;
  949.         if(!this._at_flow[0]) {
  950.             // Rewritten to update the cooldown atb bars as well
  951.             if (this.is_casting()) {
  952.                 if (this.is_max_cast()) {
  953.                     return this.refresh_at_meter(this._at_meter, this.cast_at(), this.cast_max_at(), 3);
  954.                 }
  955.                 return this.refresh_at_meter(this._at_meter, this.cast_at(), this.cast_max_at(), 2);
  956.             } else if (this.is_cooling_down()) {
  957.                 if (this.is_max_cooldown()) {
  958.                     return this.refresh_at_meter(this._at_meter, this.cooldown_at(), this.cooldown_max_at(), 3);
  959.                 }
  960.                 return this.refresh_at_meter(this._at_meter, this.cooldown_at(), this.cooldown_max_at(), 2);
  961.             } else if (this.is_max_at()) {
  962.                 return this.refresh_at_meter(this._at_meter, this.at(), this.max_at(), 1);
  963.             }
  964.             // MOG_BattleHud_PATB_Data
  965.             return this.refresh_at_meter(this._at_meter, this.at(), this.max_at(), 0);
  966.         }
  967.         // Rewritten to update the cooldown atb bars as well
  968.         if (this.is_casting()) {
  969.             if (this.is_max_cast()) {
  970.                 this.refresh_at_meter_flow(this._at_meter, this.cast_at(), this.cast_max_at(), 3, this._at_flow[1]);
  971.             } else {
  972.                 this.refresh_at_meter_flow(this._at_meter, this.cast_at(), this.cast_max_at(), 2, this._at_flow[1]);
  973.             }
  974.         } else if (this.is_cooling_down()) {
  975.             if (this.is_max_cooldown()) {
  976.                 this.refresh_at_meter_flow(this._at_meter, this.cooldown_at(), this.cooldown_max_at(), 3, this._at_flow[1]);
  977.             } else {
  978.                 this.refresh_at_meter_flow(this._at_meter, this.cooldown_at(), this.cooldown_max_at(), 2, this._at_flow[1]);
  979.             }
  980.         } else if (this.is_max_at()) {
  981.             this.refresh_at_meter_flow(this._at_meter, this.at(), this.max_at(), 1, this._at_flow[1]);
  982.         } else {
  983.             this.refresh_at_meter_flow(this._at_meter, this.at(), this.max_at(), 0, this._at_flow[1]);
  984.         }
  985.         // MOG_BattleHud_PATB_Data
  986.         this._at_flow[1] += 1.5;
  987.         if (this._at_flow[1] > this._at_flow[3]) { this._at_flow[1] = 0; }
  988.     }
  989. }; // Battle_Hud.prototype.update_at
  990.  
  991. Battle_Hud.prototype.at_patb_compatibility = Battle_Hud.prototype.at;
  992. Battle_Hud.prototype.at = function() {
  993.     // Added to use the ATB value from PATB only if it's active
  994.     if ($gameSystem.is_patb()) { return this._battler.patb_val.atb; }
  995.     // MOG_BattleHud_PATB_Data
  996.     return this.at_patb_compatibility();
  997. }; // Battle_Hud.prototype.at
  998.  
  999. Battle_Hud.prototype.max_at_patb_compatibility = Battle_Hud.prototype.max_at;
  1000. Battle_Hud.prototype.max_at = function() {
  1001.     // Added to use the ATB value from PATB only if it's active
  1002.     if ($gameSystem.is_patb()) { return this._battler._max_patb_val; }
  1003.     // MOG_BattleHud_PATB_Data
  1004.     return this.max_at_patb_compatibility();
  1005. }; // Battle_Hud.prototype.max_at
  1006.  
  1007. Battle_Hud.prototype.cast_at_patb_compatibility = Battle_Hud.prototype.cast_at;
  1008. Battle_Hud.prototype.cast_at = function() {
  1009.     // Added to use the ATB value from PATB only if it's active
  1010.     if ($gameSystem.is_patb()) {
  1011.         if (!DoubleX_RMMV["PATB Charge"]) { return 0; }
  1012.         return this._battler.patb_val.charge;
  1013.     }
  1014.     // MOG_BattleHud_PATB_Data
  1015.     return this.cast_at_patb_compatibility();
  1016. }; // Battle_Hud.prototype.cast_at
  1017.  
  1018. Battle_Hud.prototype.cast_max_at_patb_compatibility =
  1019.         Battle_Hud.prototype.cast_max_at;
  1020. Battle_Hud.prototype.cast_max_at = function() {
  1021.     // Added to use the ATB value from PATB only if it's active
  1022.     if ($gameSystem.is_patb()) { return this._battler._max_patb_val; }
  1023.     // MOG_BattleHud_PATB_Data
  1024.     return this.cast_max_at_patb_compatibility();
  1025. }; // Battle_Hud.prototype.cast_max_at
  1026.  
  1027. Battle_Hud.prototype.is_casting_patb_compatibility =
  1028.         Battle_Hud.prototype.is_casting;
  1029. Battle_Hud.prototype.is_casting = function() {
  1030.     // Added to use the ATB value from PATB only if it's active
  1031.     if ($gameSystem.is_patb()) {
  1032.         if (!DoubleX_RMMV["PATB Charge"]) { return false; }
  1033.         return this._battler.is_patb_charge();
  1034.     }
  1035.     // MOG_BattleHud_PATB_Data
  1036.     return this.is_casting_patb_compatibility();
  1037. }; // Battle_Hud.prototype.is_casting
  1038.  
  1039. Battle_Hud.prototype.cooldown_at = function() { // New; Hotspot
  1040.     if (!$gameSystem.is_patb() || !DoubleX_RMMV["PATB Cooldown"]) { return 0; }
  1041.     return this._battler.patb_val.cooldown;
  1042. }; // Battle_Hud.prototype.cooldown_at
  1043.  
  1044. Battle_Hud.prototype.cooldown_max_at = function() { // New; Hotspot
  1045.     return $gameSystem.is_patb() ? this._battler._max_patb_val : 1;
  1046. }; // Battle_Hud.prototype.cooldown_max_at
  1047.  
  1048. Battle_Hud.prototype.is_cooling_down = function() { // New; Hotspot
  1049.     if ($gameSystem.is_patb() && DoubleX_RMMV["PATB Cooldown"]) {
  1050.         return this._battler.is_patb_cooldown();
  1051.     }
  1052.     return false;
  1053. }; // Battle_Hud.prototype.is_cooling_down
  1054.  
  1055. Battle_Hud.prototype.is_max_cooldown = function() { // New; Hotspot
  1056.     return this.cooldown_at() >= this.cooldown_max_at();
  1057. }; // Battle_Hud.prototype.is_max_cooldown
  1058.  
  1059. /*----------------------------------------------------------------------------
  1060.  *    # (v1.01b+)Edit class: Scene_Battle
  1061.  *----------------------------------------------------------------------------*/
  1062.  
  1063. Scene_Battle.prototype.update_patb_window_positions = function() { // Rewrite
  1064.     // Removed to let MOG_BattleHud handle the actor window positions
  1065.     // MOG_BattleHud_Actor_Window
  1066. }; // Scene_Battle.prototype.update_patb_window_positions
  1067.  
  1068. Scene_Battle.prototype.close_patb_selection_windows_comnpatibility2 =
  1069. Scene_Battle.prototype.close_patb_selection_windows;
  1070. Scene_Battle.prototype.close_patb_selection_windows = function() { // v1.02b+
  1071.     this.close_patb_selection_windows_comnpatibility2();
  1072.     // Added to stop showing the status window
  1073.     this._statusWindow.close();
  1074.     this._statusWindow.hide();
  1075.     // MOG_BattleHud_StopShowingStatusWindow
  1076. }; // Scene_Battle.prototype.close_patb_selection_windows
  1077.  
  1078. } // if (Imported.MOG_BattleHud)
  1079.  
  1080. /*----------------------------------------------------------------------------*/
  1081.  
  1082. } else {
  1083.     alert("To use PATB Compatibility, place it below all other PATB plugins.");
  1084. }
  1085.  
  1086. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement