Advertisement
Double_X

DoubleX RMVXA ECATB Compatibility v0.08g

May 11th, 2015 (edited)
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 44.51 KB | None | 0 0
  1. #==============================================================================|
  2. #  ** Script Info                                                              |
  3. #------------------------------------------------------------------------------|
  4. #  * Script Name                                                               |
  5. #    DoubleX RMVXA Enhanced YSA Battle System: Classical ATB Compatibility     |
  6. #------------------------------------------------------------------------------|
  7. #  * Functions                                                                 |
  8. #    Fixes compatibility issues in                                             |
  9. #    DoubleX RMVXA Enhanced YSA Battle System: Classical ATB                   |
  10. #    Scripts Addressed:                                                        |
  11. #    1. Yanfly Engine Ace - Party System Add-On: Command Party                 |
  12. #    2. (v0.06a+)Yanfly Engine Ace - Battle Command List                       |
  13. #       USE_CONFIRM_WINDOW as true won't be supported                          |
  14. #    3. Yanfly Engine Ace - Combat Log Display                                 |
  15. #    4. (v0.03a+)Yanfly Engine Ace - Command Equip                             |
  16. #    5. Yanfly Engine Ace - Lunatic States                                     |
  17. #    6. Yanfly Engine Ace - Victory Aftermath                                  |
  18. #       It must be placed above ECATB to be compatible with ECATB              |
  19. #    7. Yanfly Engine Ace - Ace Equip Engine                                   |
  20. #    8. Yanfly Engine Ace - Follow-Up Skill                                    |
  21. #       Unison skills/items aren't compatible with that script yet             |
  22. #    9. Yanfly Engine Ace - Passive States                                     |
  23. #    10. (v0.01a+)Yanfly Engine Ace - Skill Cost Manager                       |
  24. #        <custom cost: string> is changed to <custom cost: "string">           |
  25. #    11. Yanfly Engine Ace - Skill Restrictions                                |
  26. #    12. (v0.02a+)Yami Engine Symphony - Equipment Learning                    |
  27. #    13. (v0.08a+)Yami Engine Ace - Guardian Summon                            |
  28. #    14. DoubleX RMVXA Confusion Edit                                          |
  29. #    15. DoubleX RMVXA Constants Edit                                          |
  30. #    16. (v0.01a+)DoubleX RMVXA State Counters                                 |
  31. #    17. (v0.01a+)DoubleX RMVXA State Triggers                                 |
  32. #    18. (v0.05a+)Mr.Bubble's Tactics Ogre PSP Crafting System                 |
  33. #    19. Actor Personal Hotkeys by Riff                                        |
  34. #    20. (v0.04a+)Theolized Sideview Battle System                             |
  35. #    21. (v0.04a+)Tsukihime's Core - Inventory                                 |
  36. #    22. Tsukihime's Battle Reactions                                          |
  37. #    23. (v0.07a+)Victor Engine - Custom Slip Effect                           |
  38. #------------------------------------------------------------------------------|
  39. #  * Terms Of Use                                                              |
  40. #    You shall:                                                                |
  41. #    1. Follow the terms of use of YSA Battle System: Classical ATB            |
  42. #    2. Let your published edits of this script be integrated as parts of it   |
  43. #    3. Keep this script's Script Info part's contents intact                  |
  44. #    You shalln't:                                                             |
  45. #    1. Claim that this script is written by anyone other than DoubleX, his    |
  46. #       aliases, Yami, or his/her aliases                                      |
  47. #    2. Make an edit of this script while saying it isn't                      |
  48. #    3. Make a RMVXA project based on this script's demo while saying it isn't |
  49. #    None of the above applies to Yami or his/her alias                        |
  50. #------------------------------------------------------------------------------|
  51. #  * Prerequisites                                                             |
  52. #    Scripts:                                                                  |
  53. #    1. Yanfly Engine Ace - Ace Battle Engine                                  |
  54. #    2. DoubleX RMVXA Enhanced YSA Battle System: Classical ATB                |
  55. #------------------------------------------------------------------------------|
  56. #  * Instructions                                                              |
  57. #    1. Open the script editor and put this script into an open slot below     |
  58. #       DoubleX RMVXA Enhanced YSA Battle System: Classical ATB and the        |
  59. #       addressed scripts but above Main. Save to take effect.                 |
  60. #------------------------------------------------------------------------------|
  61. #  * Links                                                                     |
  62. #    Script Usage 101:                                                         |
  63. #    1. forums.rpgmakerweb.com/index.php?/topic/32752-rmvxa-script-usage-101/  |
  64. #    2. rpgmakervxace.net/topic/27475-rmvxa-script-usage-101/                  |
  65. #    DoubleX RMVXA Enhanced YSA Battle System: Classical ATB:                  |
  66. #    1. http://rpgmaker.net/scripts/549/                                       |
  67. #    This script:                                                              |
  68. #    1. http://rpgmaker.net/scripts/551/                                       |
  69. #    Video:                                                                    |
  70. #    - Coming Soon                                                             |
  71. #    Demo:                                                                     |
  72. #    - Coming Soon                                                             |
  73. #    Mentioned Patreon Supporters:                                             |
  74. #    https://www.patreon.com/posts/71738797                                    |
  75. #------------------------------------------------------------------------------|
  76. #  * Authors                                                                   |
  77. #    DoubleX:                                                                  |
  78. #    1. This script                                                            |
  79. #    Yami:                                                                     |
  80. #    1. YSA Battle System: Classical ATB                                       |
  81. #------------------------------------------------------------------------------|
  82. #  * Changelog                                                                 |
  83. #    v0.08g(GMT 0200 7-11-2015):                                               |
  84. #    1. Removed the below compatibility fixes:                                 |
  85. #       - DoubleX RMVXA Dynamic Data                                           |
  86. #       - Kread-EX's Grathnode Install                                         |
  87. #       - Tsukihime's Instance Items                                           |
  88. #       They're still compatible with ECATB                                    |
  89. #    2. In sync with the latest ECATB version                                  |
  90. #    v0.08f(GMT 0400 21-10-2015):                                              |
  91. #    1. Fixed more compatibility bugs with Yanfly Engine Ace - Follow-Up Skill |
  92. #    2. In sync with the latest ECATB version                                  |
  93. #    v0.08e(GMT 0400 12-9-2015):                                               |
  94. #    1. Fixed compatibility bugs with Theolized Sideview Battle System and     |
  95. #       Victor Engine - Custom Slip Effect                                     |
  96. #    v0.08d(GMT 0900 12-8-2015):                                               |
  97. #    1. Fixed compatibility bugs with Yanfly Engine Ace - Ace Equip Engine     |
  98. #    v0.08c(GMT 0900 1-8-2015):                                                |
  99. #    1. In sync with the latest ECATB version                                  |
  100. #    2. Increased this script's compactness, efficiency and readability        |
  101. #    v0.08b(GMT 1600 5-7-2015):                                                |
  102. #    1. Fixed compatibility bugs with Yanfly Engine Ace - Follow-Up Skill      |
  103. #    v0.08a(GMT 1600 29-6-2015):                                               |
  104. #    1. Addressed compatibility with Yami Engine Ace - Guardian Summon         |
  105. #    2. Removed some redundant compatibility socket methods                    |
  106. #    v0.07a(GMT 0800 24-6-2015):                                               |
  107. #    1. Addressed compatibility with                                           |
  108. #       - Kread-EX's Grathnode Install                                         |
  109. #       - Victor Engine - Custom Slip Effect                                   |
  110. #    2. Fixed compatibility bugs with Theolized Sideview Battle System         |
  111. #    v0.06b(GMT 0300 31-5-2015):                                               |
  112. #    1. USE_CONFIRM_WINDOW as true in Yanfly Engine Ace - Battle Command List  |
  113. #       won't be supported                                                     |
  114. #    2. Instance items created via Tsukihime's Instance Items now can use      |
  115. #       DoubleX RMVXA Enhanced YSA Battle System: Classical ATB notetags       |
  116. #    v0.06a(GMT 1500 30-5-2015):                                               |
  117. #    1. Addressed compatibility with Yanfly Engine Ace - Battle Command List   |
  118. #    2. Fixed compatibility bugs between the below compatibilities             |
  119. #       - DoubleX RMVXA Dynamic Data                                           |
  120. #       - Mr.Bubble's Tactics Ogre PSP Crafting System                         |
  121. #       - Theolized Sideview Battle System                                     |
  122. #       - Tsukihime's Instance Items                                           |
  123. #    3. Instance items created via Tsukihime's Instance Items now can't use    |
  124. #       DoubleX RMVXA Enhanced YSA Battle System: Classical ATB notetags       |
  125. #    v0.05a(GMT 1000 27-5-2015):                                               |
  126. #    1. Addressed compatibility with                                           |
  127. #       - Mr.Bubble's Tactics Ogre PSP Crafting System                         |
  128. #       - Tsukihime's Instance Items                                           |
  129. #    v0.04a(GMT 0700 23-5-2015):                                               |
  130. #    1. Fixed stack level too deep bug in Yanfly Engine Ace - Ace Equip Engine |
  131. #       compatibility fix                                                      |
  132. #    2. Addressed compatibility with                                           |
  133. #       - DoubleX RMVXA Dynamic Data                                           |
  134. #       - Theolized Sideview Battle System                                     |
  135. #       - Tsukihime's Core - Inventory                                         |
  136. #    v0.03c(GMT 1400 14-5-2015):                                               |
  137. #    1. Fixed not clearing battlers' lambdas before calling Marshal bug        |
  138. #    v0.03b(GMT 1400 12-5-2015):                                               |
  139. #    1. Updated the DoubleX RMVXA State Triggers compatibility fix             |
  140. #    v0.03a(GMT 0400 6-5-2015):                                                |
  141. #    1. Removed the Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars    |
  142. #       and DoubleX RMVXA Percentage Addon to Yanfly Engine Ace - Battle Engine|
  143. #       Add-On: Enemy HP Bars compatibility fixes                              |
  144. #       - They're still compatible with                                        |
  145. #         DoubleX RMVXA Enhanced YSA Battle System: Classical ATB              |
  146. #    2. Addressed compatibility with Yanfly Engine Ace - Command Equip         |
  147. #    v0.02a(GMT 0800 22-4-2015):                                               |
  148. #    1. Removed the Yanfly Engine Ace - Command Autobattle compatibility fix   |
  149. #       - It's still compatible with                                           |
  150. #         DoubleX RMVXA Enhanced YSA Battle System: Classical ATB              |
  151. #    2. Addressed compatibility with Yami Engine Symphony - Equipment Learning |
  152. #    3. Fixed no method error in DoubleX RMVXA Confusion Edit compatibility fix|
  153. #    4. Fixed not hiding hotkey bar in Actor Personal Hotkeys compatibility fix|
  154. #    v0.01a(GMT 1300 15-4-2015):                                               |
  155. #    1. Addressed compatibility with                                           |
  156. #       - Yanfly Engine Ace - Skill Cost Manager                               |
  157. #       - DoubleX RMVXA State Counters                                         |
  158. #       - DoubleX RMVXA State Triggers                                         |
  159. #    v0.01a(GMT 1400 8-4-2015):                                                |
  160. #    1. 1st testing version of this script finished                            |
  161. #==============================================================================|
  162.  
  163. ($doublex_rmvxa ||= {})[:ECATB_Compatibility] = "v0.08f"
  164.  
  165. #==============================================================================|
  166. #  ** Script Implementations                                                   |
  167. #     You need not edit this part as it's about how this script works          |
  168. #------------------------------------------------------------------------------|
  169. #  * Script Support Info:                                                      |
  170. #    1. Prerequisites                                                          |
  171. #       - Basic knowledge of how the addressed scripts work                    |
  172. #    2. Method documentation                                                   |
  173. #       - The 1st part describes why this method's rewritten/aliased for       |
  174. #         rewritten/aliased methods or what the method does for new methods    |
  175. #       - The 2nd part describes what the arguments of the method are          |
  176. #       - The 3rd part informs which version rewritten, aliased or created this|
  177. #         method                                                               |
  178. #       - The 4th part informs whether the method's rewritten or new           |
  179. #       - The 5th part informs whether the method's a real or potential hotspot|
  180. #       - The 6th part describes how this method works for new methods only,   |
  181. #         and describes the parts added, removed or rewritten for rewritten or |
  182. #         aliased methods only                                                 |
  183. #       Example:                                                               |
  184. # #--------------------------------------------------------------------------| |
  185. # #  Why rewrite/alias/What this method does                                 | |
  186. # #--------------------------------------------------------------------------| |
  187. # # *argv: What these variables are                                            |
  188. # # &argb: What this block is                                                  |
  189. # def def_name(*argv, &argb) # Version X+; Rewrite/New; Hotspot                |
  190. #   # Added/Removed/Rewritten to do something/How this method works            |
  191. #   def_name_code                                                              |
  192. #   #                                                                          |
  193. # end # def_name                                                               |
  194. #------------------------------------------------------------------------------|
  195.  
  196. if $imported["YEA-BattleEngine"] && !$imported["YSA-CATB"]
  197.  
  198. if $doublex_rmvxa[:ECATB]
  199.  
  200. if $imported["DoubleX RMVXA Confusion Edit"] || $imported[:TSBS]
  201.  
  202.   # (v0.07a+)Stores the added temporary cached block storages and copying method
  203.   ECATB_GAME_TEMP = %Q(
  204.   #{$imported[:TSBS] ? "attr_accessor :ecatb_item_in_use" : ""}
  205.   #{$imported[:ve_custom_slip_effect] ? "attr_accessor :ecatb_state_user" : ""}
  206.  
  207.   alias init_ecatb_vars_compatibility init_ecatb_vars
  208.   def init_ecatb_vars
  209.     init_ecatb_vars_compatibility
  210.     #{$imported[:TSBS] ? "@ecatb_item_in_use = {}" : ""}
  211.     #{$imported[:ve_custom_slip_effect] ? "@ecatb_state_user = {}" : ""}
  212.   end
  213.  
  214.   alias clear_ecatb_vars_compatibility clear_ecatb_vars
  215.   def clear_ecatb_vars
  216.     clear_ecatb_vars_compatibility
  217.     #{$imported[:TSBS] ? "@ecatb_item_in_use = nil" : ""}
  218.     #{$imported[:ve_custom_slip_effect] ? "@ecatb_state_user = nil" : ""}
  219.   end
  220.  
  221.   def ecatb_copy(battler, clone)
  222.     [@ecatb_unison_actors, @last_ecatb_item#{
  223.     ($imported[:TSBS] ? ", @ecatb_item_in_use" : "") +
  224.     ($imported[:ve_custom_slip_effect] ? ", @ecatb_state_user" : "")}].
  225.     each { |temp| temp[clone] = temp[battler] if temp[battler] }
  226.   end
  227.   )
  228.  
  229. #------------------------------------------------------------------------------|
  230. #  * Temporarily stores battler data for clearing and resetting the blocks     |
  231. #------------------------------------------------------------------------------|
  232. class Game_Temp # v0.07a+
  233.  
  234.   module_eval(ECATB_GAME_TEMP) # Alias; New
  235.  
  236. end # Game_Temp
  237.  
  238. end # $imported["DoubleX RMVXA Confusion Edit"] || if $imported[:TSBS]
  239.  
  240. if $imported[:TSBS]
  241.  
  242.   # Clears and resets the added temprary cached block storages as well
  243.   ECATB_GAME_BATTLER = %Q(
  244.   alias clear_ecatb_blocks_compatibility_2 clear_ecatb_blocks
  245.   def clear_ecatb_blocks
  246.     clear_ecatb_blocks_compatibility_2
  247.     $game_temp.ecatb_item_in_use[self] ||= @item_in_use
  248.     @item_in_use = nil
  249.     #{$imported[:ve_custom_slip_effect] ? "
  250.     $game_temp.ecatb_state_user[self] ||= @state_user
  251.     @state_user = {}" : ""}
  252.  end
  253.  
  254.  alias reset_ecatb_blocks_compatibility_2 reset_ecatb_blocks
  255.  def reset_ecatb_blocks
  256.    reset_ecatb_blocks_compatibility_2
  257.    if $game_temp.ecatb_item_in_use[self]
  258.      @item_in_use = $game_temp.ecatb_item_in_use.delete(self)
  259.    end
  260.    #{$imported[:ve_custom_slip_effect] ? "
  261.     if $game_temp.ecatb_state_user[self]
  262.       @state_user = $game_temp.ecatb_state_user.delete(self)
  263.     end" : ""}
  264.  end
  265.  )
  266.  
  267. #------------------------------------------------------------------------------|
  268. #  Clears and resets all object's blocks right before and after using marshal  |
  269. #------------------------------------------------------------------------------|
  270. alias copy_ecatb copy
  271. def copy(obj, &argb) # v0.04a+
  272.  obj.clear_ecatb_blocks if battler = obj.is_a?(Game_Battler) # Added
  273.  clone = copy_ecatb(obj, &argb) # Rewritten
  274.  # Added
  275.  if battler
  276.    $game_temp.ecatb_copy(obj, clone)
  277.    obj.reset_ecatb_blocks
  278.    clone.reset_ecatb_blocks
  279.  end
  280.  clone
  281.  #
  282. end # copy
  283.  
  284. class Game_Battler < Game_BattlerBase # v0.07a+
  285.  
  286.  #----------------------------------------------------------------------------|
  287.  #  Clears and resets the added temprary cached block storages as well        |
  288.  #----------------------------------------------------------------------------|
  289.  module_eval(ECATB_GAME_BATTLER) # Alias
  290.  
  291. end # Game_Battler
  292.  
  293. end # $imported[:TSBS]
  294.  
  295. class << BattleManager
  296.  
  297.  if $imported["DoubleX RMVXA Constants Edit"]
  298.  
  299.  #----------------------------------------------------------------------------|
  300.  #  Uses the escape ratio in DoubleX RMVXA Constants Edit                     |
  301.  #----------------------------------------------------------------------------|
  302.  def set_ecatb_esc_cost_compatibility # Rewrite
  303.    DoubleX_RMVXA::Constants_Edit::Escape_Ratio # Rewritten
  304.  end # set_ecatb_esc_cost_compatibility
  305.  
  306.  end # if $imported["DoubleX RMVXA Constants Edit"]
  307.  
  308.  if $imported["YEA-VictoryAftermath"] || $imported["YES-EquipmentLearning"]
  309.  
  310.  #----------------------------------------------------------------------------|
  311.  #  Clears all battlers' blocks right before using Marshal                    |
  312.  #----------------------------------------------------------------------------|
  313.  alias process_victory_ecatb_compatibility process_victory
  314.  def process_victory(*argv, &argb)
  315.    DataManager.clear_ecatb_blocks # Added
  316.    process_victory_ecatb_compatibility(*argv, &argb)
  317.  end # pprocess_victory
  318.  
  319.  end # if $imported["YEA-VictoryAftermath"] ||
  320.  # $imported["YES-EquipmentLearning"]
  321.  
  322. end # BattleManager
  323.  
  324. if $imported["DoubleX RMVXA Confusion Edit"]
  325.  
  326. class Game_Action
  327.  
  328.  #----------------------------------------------------------------------------|
  329.  #  Temporarily clear all blocks right before using Marshal as well           |
  330.  #----------------------------------------------------------------------------|
  331.  def evaluate_item_with_target(target) # Rewrite
  332.    target.result.clear
  333.    # Rewritten
  334.    target.clear_ecatb_blocks
  335.    subject.clear_ecatb_blocks
  336.    eval_target = Marshal.load( Marshal.dump(target) )
  337.    eval_subject = Marshal.load( Marshal.dump(subject) )
  338.    reset_ecatb_blocks(target, eval_target, eval_subject)
  339.    #
  340.    eval_target.make_damage_value(eval_subject, item)
  341.    if item.for_opponent?
  342.      eval_target.result.hp_damage.to_f / [eval_target.hp, 1].max
  343.    else
  344.      [-eval_target.result.hp_damage, eval_target.mhp - eval_target.hp].min /
  345.      eval_target.mhp.to_f
  346.    end
  347.  end # evaluate_item_with_target
  348.  
  349.  # eval_target: The temporary item target
  350.  # eval_subject: The temporary item subject
  351.  def reset_ecatb_blocks(target, eval_target, eval_subject) # v0.03c+; New
  352.    $game_temp.ecatb_copy(subject, eval_subject)
  353.    $game_temp.ecatb_copy(target, eval_target)
  354.    [target, subject, eval_target, eval_subject].each { |battler|
  355.      battler.reset_ecatb_blocks
  356.    }
  357.  end # reset_ecatb_blocks
  358.  
  359. end # Game_Action
  360.  
  361. end # $imported["DoubleX RMVXA Confusion Edit"]
  362.  
  363. if $imported["YEA-PassiveStates"]
  364.  
  365. class Game_BattlerBase
  366.  
  367.  #----------------------------------------------------------------------------|
  368.  #  Sets the countdown for all passive states as well                         |
  369.  #----------------------------------------------------------------------------|
  370.  alias create_passive_state_array_ecatb create_passive_state_array
  371.  def create_passive_state_array(array, &argb)
  372.    create_passive_state_array_ecatb(array, &argb)
  373.    # Added
  374.    @passive_states.each { |state_id|
  375.      @ecatb_countdown_clock[state_id] = 0
  376.      @ecatb_countdown_freeze[state_id] = false
  377.    }
  378.    #
  379.  end # create_passive_state_array
  380.  
  381. end # Game_BattlerBase
  382.  
  383. end # if $imported["YEA-PassiveStates"]
  384.  
  385. if $imported["YEA-FollowUpSkill"]
  386.  
  387. class Game_BattlerBase
  388.  
  389.  #----------------------------------------------------------------------------|
  390.  #  Checks if the current action's an usable follow up one                    |
  391.  #----------------------------------------------------------------------------|
  392.  def ecatb_reset_compatibility? # Rewrite
  393.    # Rewritten
  394.    current_action && current_action.follow_up && usable?(current_action.item)
  395.    #
  396.  end # ecatb_reset_compatibility?
  397.  
  398. end # Game_Battler
  399.  
  400. class Game_Battler < Game_BattlerBase
  401.  
  402.  #----------------------------------------------------------------------------|
  403.  #  Confirms the follow up action and executes it after finishing cooldown    |
  404.  #----------------------------------------------------------------------------|
  405.  def ecatb_val_reset_compatibility(reset) # Rewrite
  406.    # Added
  407.    @ecatb_val[:cooldown] = 0.0 if dead?
  408.    @ecatb_act_times_change = true
  409.    @ecatb_val[:cooldown] = 100.0 unless @ecatb_val[:charge] < 100.0 || reset
  410.    @ecatb_val[:charge] = 0.0
  411.    @ecatb_reset_val = 0.0 unless index && restriction <= 0
  412.    current_action.ecatb_confirm = current_action.last_ecatb_confirm = true
  413.    post_ecatb_reset
  414.    set_ecatb_battler_change
  415.    #
  416.  end # ecatb_val_reset_compatibility
  417.  
  418. end # Game_Battler
  419.  
  420. end # if $imported["YEA-FollowUpSkill"]
  421.  
  422. class Game_Battler < Game_BattlerBase
  423.  
  424.  if $doublex_rmvxa[:State_Counters]
  425.  
  426.  #----------------------------------------------------------------------------|
  427.  #  Returns the current battler sprite set                                    |
  428.  #----------------------------------------------------------------------------|
  429.  def ecatb_countdown_update_compatibility_1 # v0.01a+; Rewrite; Hotspot
  430.    state_counters_battler_sprite # Rewritten
  431.  end # ecatb_countdown_update_compatibility_1
  432.  
  433.  #----------------------------------------------------------------------------|
  434.  #  Updates the remaining turn of the state icon                              |
  435.  #----------------------------------------------------------------------------|
  436.  def ecatb_countdown_update_compatibility_2(battler_sprite, state_id) # v0.01a+
  437.  # Potential Hotspot
  438.    # Added
  439.    return unless counters = battler_sprite.state_counters
  440.    return unless counters[$data_states[state_id]]
  441.    counters[$data_states[state_id]].update_turn(@state_turns[state_id])
  442.    #
  443.  end # ecatb_countdown_update_compatibility_2
  444.  
  445.  end # if $doublex_rmvxa[:State_Counters]
  446.  
  447.  if $doublex_rmvxa[:State_Triggers]
  448.  
  449.  #----------------------------------------------------------------------------|
  450.  #  Triggers the turn actions when the turn conditions are met                |
  451.  #----------------------------------------------------------------------------|
  452.  def ecatb_countdown_update_compatibility_3(state_id) # v0.01a+; Rewrite;
  453.  # Potential Hotspot
  454.    exec_state_triggers(state_id, :turn) # Added
  455.  end # ecatb_countdown_update_compatibility_3
  456.  
  457.  end # if $doublex_rmvxa[:State_Triggers]
  458.  
  459. end # Game_Battler
  460.  
  461. if $imported["TH_CoreInventory"]
  462.  
  463. class Game_Party < Game_Unit # v0.04a+
  464.  
  465.  #----------------------------------------------------------------------------|
  466.  #  Initializes all new variables as well                                     |
  467.  #----------------------------------------------------------------------------|
  468.  alias init_all_items_ecatb_compatibility init_all_items
  469.  def init_all_items(*argv, &argb)
  470.    init_all_items_ecatb_compatibility(*argv, &argb)
  471.    @ecatb_dead_enemies = [] # Added
  472.  end # init_all_items
  473.  
  474. end # Game_Party
  475.  
  476. end # if $imported["TH_CoreInventory"]
  477.  
  478. if $imported["YEA-SkillCostManager"]
  479.  
  480. class Window_SkillList < Window_Selectable # v0.01a+
  481.  
  482.  #----------------------------------------------------------------------------|
  483.  #  Supports variable but not random action point requirements as well        |
  484.  #----------------------------------------------------------------------------|
  485.  def draw_custom_skill_cost(rect, skill)
  486.    return unless skill.use_custom_cost
  487.    change_color(text_color(skill.custom_cost_colour), enable?(skill))
  488.    icon = skill.custom_cost_icon
  489.    if icon > 0
  490.      draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  491.      rect.width -= 24
  492.    end
  493.    contents.font.size = skill.custom_cost_size
  494.    text = eval(skill.custom_cost_text).to_s # Rewritten
  495.    draw_text(rect, text, 2)
  496.    cx = text_size(text).width + 4
  497.    rect.width -= cx
  498.    reset_font_settings
  499.  end # draw_custom_skill_cost
  500.  
  501. end # Window_SkillList
  502.  
  503. end # if $imported["YEA-SkillCostManager"]
  504.  
  505. if $imported["YEA-AceEquipEngine"]
  506.  
  507. class Window_EquipItem < Window_ItemList # v0.04a+
  508.  
  509.  #----------------------------------------------------------------------------|
  510.  #  Clears and resets all blocks of the actor before and after serialization  |
  511.  #----------------------------------------------------------------------------|
  512.  alias update_help_ecatb_compatibility update_help
  513.  def update_help
  514.    @actor.clear_ecatb_blocks # Added
  515.    update_help_ecatb_compatibility
  516.    @actor.reset_ecatb_blocks if SceneManager.scene_is?(Scene_Battle) # Added
  517.  end # update_help
  518.  
  519. end # Window_EquipItem
  520.  
  521. end # if $imported["YEA-AceEquipEngine"]
  522.  
  523. class Scene_Battle < Scene_Base
  524.  
  525.  if $imported["YEA-BattleCommandList"]
  526.  
  527.  #----------------------------------------------------------------------------|
  528.  #  Refreshes all active command, item and target selection windows as well   |
  529.  #----------------------------------------------------------------------------|
  530.  alias status_redraw_target_ecatb_compatibility status_redraw_target
  531.  def status_redraw_target(target, &argb) # v0.06a+
  532.    # Added
  533.    return if $game_party.all_dead? || $game_troop.all_dead?
  534.    return unless BattleManager.phase
  535.    #
  536.    status_redraw_target_ecatb_compatibility(target, &argb)
  537.    # Added
  538.    return unless BattleManager.btype?(:ecatb) && target.actor?
  539.    refresh_ecatb_windows
  540.    #
  541.  end # status_redraw_target
  542.  
  543.  end # if $imported["YEA-BattleCommandList"]
  544.  
  545.  if $imported["YEA-CombatLogDisplay"]
  546.  
  547.  #----------------------------------------------------------------------------|
  548.  #  Checks if the combat log window exists and is visible                     |
  549.  #----------------------------------------------------------------------------|
  550.  def update_msg_open_ecatb_compatibility? # Rewrite; Hotspot
  551.    @combatlog_window && @combatlog_window.visible # Rewritten
  552.  end # update_msg_open_ecatb_compatibility?
  553.  
  554.  end # if $imported["YEA-CombatLogDisplay"]
  555.  
  556.  if $imported["YEA-CommandEquip"] && YEA::COMMAND_EQUIP::EQUIP_SKIPTURN
  557.  
  558.  #----------------------------------------------------------------------------|
  559.  #  Setups an inputable actor after processing the equip command as well      |
  560.  #----------------------------------------------------------------------------|
  561.  alias command_equip_ecatb command_equip # v0.03a+
  562.  def command_equip(*argv, &argb)
  563.    command_equip_ecatb(*argv, &argb)
  564.    start_actor_command_selection # Added
  565.  end # command_equip
  566.  
  567.  end # if $imported["YEA-CommandEquip"] && YEA::COMMAND_EQUIP::EQUIP_SKIPTURN
  568.  
  569.  if $imported["YEA-LunaticStates"]
  570.  
  571.  #----------------------------------------------------------------------------|
  572.  #  Triggers all battlers' states' begin effects                              |
  573.  #----------------------------------------------------------------------------|
  574.  def ecatb_turn_add_compatibility # Rewrite
  575.    # Added
  576.    $game_party.battle_members.each { |mem| mem.run_lunatic_states(:begin) }
  577.    $game_troop.members.each { |mem| mem.run_lunatic_states(:begin) }
  578.    #
  579.  end # ecatb_turn_add_compatibility
  580.  
  581.  end # if $imported["YEA-LunaticStates"]
  582.  
  583.  if $imported["YEA-FollowUpSkill"]
  584.  
  585.  #----------------------------------------------------------------------------|
  586.  #  Checks if there's usable follow up actions of the current one             |
  587.  #----------------------------------------------------------------------------|
  588.  def exec_ecatb_act_loop_compatibility?(forced) # Rewrite
  589.    # Rewritten
  590.    return true if forced
  591.    return true unless @subject.current_action
  592.    return false unless @subject.current_action.follow_up
  593.    @subject.usable?(@subject.current_action.item)
  594.    #
  595.  end # exec_ecatb_act_loop_compatibility?
  596.  
  597.  end # if $imported["YEA-FollowUpSkill"]
  598.  
  599.  if $imported["YEA-SkillRestrictions"]
  600.  
  601.  #----------------------------------------------------------------------------|
  602.  #  Updates all battlers' restrictions as well                                |
  603.  #----------------------------------------------------------------------------|
  604.  alias ecatb_turn_add_compatibility_2 ecatb_turn_add_compatibility
  605.  def ecatb_turn_add_compatibility # v0.04c+
  606.    ecatb_turn_add_compatibility_2
  607.    # Added
  608.    $game_party.update_restrictions
  609.    $game_troop.update_restrictions
  610.    #
  611.  end # ecatb_turn_add_compatibility
  612.  
  613.  end # if $imported["YEA-SkillRestrictions"]
  614.  
  615.  if $imported["YSE-GuardianSummon"]
  616.  
  617.  #----------------------------------------------------------------------------|
  618.  #  Checks if the actor's valid and confirm the inputted summon if so as well |
  619.  #----------------------------------------------------------------------------|
  620.  alias on_summon_ok_ecatb on_summon_ok
  621.  def on_summon_ok(*argv, &argb) # v0.08a+
  622.    # Added
  623.    return unless actor = BattleManager.actor
  624.    if BattleManager.btype?(:ecatb)
  625.      actors = actor.input.item.ecatb_unison_actor.call(
  626.      actor).collect!(&DoubleX_RMVXA::ECATB::BLOCKS[:usable?])
  627.      return confirm_ecatb_unison_item(actors) if actors.size > 1
  628.      actor.confirm_ecatb_item
  629.      @status_window.draw_item(actor.index)
  630.    end
  631.    #
  632.    on_summon_ok_ecatb(*argv, &argb)
  633.  end # on_summon_ok
  634.  
  635.  #----------------------------------------------------------------------------|
  636.  #  Hides, deactivates and closes the summon window upon battle end as well   |
  637.  #----------------------------------------------------------------------------|
  638.  alias close_ecatb_windows_compatibility_1 close_ecatb_windows
  639.  def close_ecatb_windows # v0.08a+
  640.    close_ecatb_windows_compatibility_1
  641.    @summon_window.hide.deactivate.close # Added
  642.  end # close_ecatb_windows
  643.  
  644.  end # $imported["YSE-GuardianSummon"]
  645.  
  646.  if $imported['RIFF_HOTKEYS']
  647.  
  648.  #----------------------------------------------------------------------------|
  649.  #  Fixes bugs and edge cases                                                 |
  650.  #----------------------------------------------------------------------------|
  651.  def on_actor_cancel_ecatb # Rewrite
  652.    BattleManager.actor.input.clear
  653.    @status_aid_window.refresh
  654.    $game_temp.battle_aid = nil
  655.    @actor_window.hide
  656.    ecatb_actor_cancel_windows # Rewritten
  657.    @hotkey_action = false # Added to mark that the hotkey action's cancelled
  658.  end # on_actor_cancel_ecatb
  659.  
  660.  #----------------------------------------------------------------------------|
  661.  #  Fixes bugs and edge cases                                                 |
  662.  #----------------------------------------------------------------------------|
  663.  def call_hotkeys(hotkey_index) # Rewrite
  664.    if @party_command_window.close? && @hotkeys_bar_window.visible
  665.      @actor_command_window.deactivate
  666.      # Rewritten to ensure both the actor and item are valid
  667.      if actor = BattleManager.actor
  668.        item = actor.hotkeys[hotkey_index]
  669.        if item && @hotkeys_bar_window.item_valid?(item)
  670.          return set_hotkey_action(item)
  671.        end
  672.      end
  673.      #
  674.      return @actor_command_window.activate
  675.    end
  676.    # Rewritten
  677.    @party_command_window.activate unless BattleManager.btype?(:ecatb)
  678.    #
  679.  end # call_hotkeys
  680.  
  681.  #----------------------------------------------------------------------------|
  682.  #  Supports calling unison skills/items via hotkeys as well                  |
  683.  #----------------------------------------------------------------------------|
  684.  def set_hotkey_action(item) # Rewrite
  685.    @hotkey_action = true # Added to mark that the action's called by a hotkey
  686.    # Rewritten
  687.    actors = DoubleX_RMVXA::ECATB.send(item.ecatb_unison_actor,
  688.    actor = BattleManager.actor).collect! { |actor_id| $game_actors[actor_id] }
  689.    act_actors = BattleManager.ecatb_actor_act_list.select { |actor|
  690.    actor.ecatb_inputable? }
  691.    if item.is_a?(RPG::Skill)
  692.      $game_temp.battle_aid = @skill = item
  693.      if actors.size > 1 && (actors - act_actors).empty?
  694.        actors.each { |actor|
  695.          actor.input.set_skill(@skill.id)
  696.          actor.last_skill.object = @skill
  697.          @status_window.draw_item(actor.index)
  698.        }
  699.      else
  700.        actor.input.set_skill(@skill.id)
  701.        actor.last_skill.object = @skill
  702.      end
  703.      if @skill.for_opponent?
  704.        select_enemy_selection
  705.      elsif @skill.for_friend?
  706.        select_actor_selection
  707.      else
  708.        next_command
  709.        $game_temp.battle_aid = nil
  710.      end
  711.      @status_window.draw_item(actor.index)
  712.    elsif item.is_a?(RPG::Item)
  713.      $game_party.last_item.object = $game_temp.battle_aid = @item = item
  714.      if actors.size > 1 && (actors - act_actors).empty?
  715.        @item.catb_unison_actor_id.each { |actor|
  716.          actor.input.set_item(@item.id)
  717.          @status_window.draw_item(actor.index)
  718.        }
  719.      else
  720.        actor.input.set_item(@item.id)
  721.      end
  722.      if @item.for_opponent?
  723.        select_enemy_selection
  724.      elsif @item.for_friend?
  725.        select_actor_selection
  726.      else
  727.        next_command
  728.        $game_temp.battle_aid = nil
  729.      end
  730.      @status_window.draw_item(actor.index)
  731.    end
  732.    #
  733.  end # set_hotkey_action
  734.  
  735.  #----------------------------------------------------------------------------|
  736.  #  Shows the last active window right after cancelling                       |
  737.  #----------------------------------------------------------------------------|
  738.  def scene_battle_on_enemy_cancel_abe # Rewrite
  739.    @enemy_window.hide
  740.    on_ecatb_unison_target_cancel_compatibility # Rewritten
  741.  end # scene_battle_on_enemy_cancel_abe
  742.  
  743.  #----------------------------------------------------------------------------|
  744.  #  Refreshs the hotkey window if it's visible as well                        |
  745.  #----------------------------------------------------------------------------|
  746.  def refresh_ecatb_windows_compatibility # Rewrite; Potential Hotspot
  747.    @hotkeys_bar_window.refresh if @hotkeys_bar_window.visible # Added
  748.  end # refresh_ecatb_windows_compatibility
  749.  
  750.  #----------------------------------------------------------------------------|
  751.  #  Goes back to the last active window                                       |
  752.  #----------------------------------------------------------------------------|
  753.  def on_ecatb_unison_target_cancel_compatibility # Rewrite
  754.    # Rewritten
  755.    if !@hotkey_action && @actor_command_window.current_symbol == :skill
  756.      @skill_window.activate.show
  757.    elsif !@hotkey_action && @actor_command_window.current_symbol == :item
  758.      @item_window.activate.show
  759.    else
  760.      @actor_command_window.activate.show
  761.    end
  762.    #
  763.    @hotkey_action = false # Added to mark that the hotkey action's cancelled
  764.  end # on_ecatb_unison_target_cancel_compatibility
  765.  
  766.  #----------------------------------------------------------------------------|
  767.  #  Hides the hotkey bar window if it's visible as well                       |
  768.  #----------------------------------------------------------------------------|
  769.  alias ecatb_turn_start_compatibility ecatb_turn_start
  770.  def ecatb_turn_start # v0.08a+
  771.    ecatb_turn_start_compatibility
  772.    @hotkeys_bar_window.hide if @hotkeys_bar_window.visible # Added
  773.  end # ecatb_turn_start
  774.  
  775.  #----------------------------------------------------------------------------|
  776.  #  Setups the hotkey bar window as well                                      |
  777.  #----------------------------------------------------------------------------|
  778.  alias start_actor_command_selection_ecatb_compatibility
  779.  start_actor_command_selection
  780.  def start_actor_command_selection # v0.08a+; Potential Hotspot
  781.    start_actor_command_selection_ecatb_compatibility
  782.    @hotkeys_bar_window.setup(BattleManager.actor) # Added
  783.  end # start_actor_command_selection
  784.  
  785.  #----------------------------------------------------------------------------|
  786.  #  Hides the hotkey bar window if it's visible as well                       |
  787.  #----------------------------------------------------------------------------|
  788.  alias ecatb_update_windows_compatibility ecatb_update_windows
  789.  def ecatb_update_windows # v0.08a+; Hotspot
  790.    ecatb_update_windows_compatibility
  791.    @hotkeys_bar_window.hide if @hotkeys_bar_window.visible # Added
  792.  end # ecatb_update_windows
  793.  
  794.  #----------------------------------------------------------------------------|
  795.  #  Hides, deactivate and closes the hotkey window as well                    |
  796.  #----------------------------------------------------------------------------|
  797.  alias close_ecatb_windows_compatibility_2 close_ecatb_windows
  798.  def close_ecatb_windows # v0.08a+
  799.    close_ecatb_windows_compatibility_2
  800.    @hotkeys_bar_window.hide.deactivate.close # Added
  801.  end # close_ecatb_windows
  802.  
  803.  #----------------------------------------------------------------------------|
  804.  #  Hides the hotkey bar when showing the party command window                |
  805.  #----------------------------------------------------------------------------|
  806.  alias start_party_command_selection_ecatb start_party_command_selection
  807.  def start_party_command_selection(*argv, &argb)
  808.    @hotkeys_bar_window.hide # Added
  809.    start_party_command_selection_ecatb(*argv, &argb)
  810.  end # start_party_command_selection
  811.  
  812.  #----------------------------------------------------------------------------|
  813.  #  Places the hotkey bar at the top of the screen as well                    |
  814.  #----------------------------------------------------------------------------|
  815.  alias create_hotkeys_bar_window_ecatb create_hotkeys_bar_window
  816.  def create_hotkeys_bar_window(*argv, &argb)
  817.    create_hotkeys_bar_window_ecatb(*argv, &argb)
  818.    @hotkeys_bar_window.z = 500 # Added
  819.  end # create_hotkeys_bar_window
  820.  
  821.  #----------------------------------------------------------------------------|
  822.  #  Shows the last active window right after cancelling target selections     |
  823.  #----------------------------------------------------------------------------|
  824.  def ecatb_actor_cancel_windows # New
  825.    unless @hotkey_action
  826.      if @actor_command_window.current_symbol == :skill
  827.        return @skill_window.activate.show
  828.      elsif @actor_command_window.current_symbol == :item
  829.        return @item_window.activate.show
  830.      end
  831.    end
  832.    @actor_command_window.activate.show
  833.    @status_window.show
  834.    @help_window.hide
  835.  end # ecatb_actor_cancel_windows
  836.  
  837.  end # if $imported['RIFF_HOTKEYS']
  838.  
  839.  if $imported["TH_BattleReactions"]
  840.  
  841.  #----------------------------------------------------------------------------|
  842.  #  Calls the aliased process_action method instead to prevent infinite loop  |
  843.  #----------------------------------------------------------------------------|
  844.  def perform_reactions(target, item) # Rewrite
  845.    @log_window.display_reaction(target, item)
  846.    BattleManager.reaction_processing = true
  847.    last_subject = @subject
  848.    @subject = target
  849.    process_action_ecatb while @subject.current_action # Rewritten
  850.    @subject = last_subject
  851.    BattleManager.clear_reaction_processing
  852.  end # perform_reactions
  853.  
  854.  end # if $imported["TH_BattleReactions"]
  855.  
  856.  if $imported["YEA-CommandParty"]
  857.  
  858.  #----------------------------------------------------------------------------|
  859.  #  Stops making actions after changing party members in ecatb battle system  |
  860.  #----------------------------------------------------------------------------|
  861.  def command_party # Rewrite
  862.    Graphics.freeze
  863.    @info_viewport.visible = false
  864.    hide_extra_gauges
  865.    SceneManager.snapshot_for_background
  866.    previous_party = $game_party.battle_members.clone
  867.    index = @party_command_window.index
  868.    oy = @party_command_window.oy
  869.    SceneManager.call(Scene_Party)
  870.    SceneManager.scene.main
  871.    SceneManager.force_recall(self)
  872.    show_extra_gauges
  873.    if previous_party != $game_party.battle_members
  874.      $game_party.make_actions unless BattleManager.btype?(:ecatb) # Rewritten
  875.      $game_party.set_party_cooldown
  876.    end
  877.    @info_viewport.visible = true
  878.    @status_window.refresh
  879.    @party_command_window.setup.select(index)
  880.    @party_command_window.oy = oy
  881.    perform_transition
  882.  end # command_party
  883.  
  884.  end # if $imported["YEA-CommandParty"]
  885.  
  886. end # Scene_Battle
  887.  
  888. if $imported['RIFF_HOTKEYS']
  889.  
  890. class Window_Hotkeys_Bar < Window_Selectable
  891.  
  892.  #----------------------------------------------------------------------------|
  893.  #  Fixes bugs and edge cases                                                 |
  894.  #----------------------------------------------------------------------------|
  895.  def item_valid?(item) # Rewrite
  896.    if item.is_a?(RPG::Item)
  897.      if item.ecatb_unison_actor.call(@actor).size > 1
  898.        return @actor.usable?(item)
  899.      end
  900.      return $game_party.usable?(item)
  901.    end
  902.    # Rewritten to let actors use usable skills that aren't learnt
  903.    return unless item.is_a?(RPG::Skill)
  904.    return @actor.usable?(item) unless SceneManager.scene_is?(Scene_Battle)
  905.    (actor = BattleManager.actor) && actor.usable?(item)
  906.    #
  907.  end # item_valid?
  908.  
  909. end # Window_Hotkeys_Bar
  910.  
  911. end # if $imported['RIFF_HOTKEYS']
  912.  
  913. else
  914.  
  915.  # Informs users that they didn't place ECATB above this script
  916.  msgbox("To use DoubleX RMVXA ECATB Compatibility, put it below:\n" +
  917.         "DoubleX RMVXA Enhanced YSA Battle System: Classical ATB\n" +
  918.         "but above Main") unless $doublex_rmvxa[:ECATB]
  919.  
  920. end # if $doublex_rmvxa[:ECATB]
  921.  
  922. #------------------------------------------------------------------------------|
  923.  
  924. else
  925.  
  926.  # Informs users that they didn't place YEA-BattleEngine above this script
  927.  msgbox("To use DoubleX RMVXA Enhanced YSA Battle System: Classical ATB, put it
  928.           below:\n" +
  929.         "Yanfly Engine Ace - Ace Battle Engine\n" +
  930.         "but above Main") unless $imported["YEA-BattleEngine"]
  931.  
  932.  # Informs users that they used YSA-CATB with this script
  933.  msgbox("DoubleX RMVXA Enhanced YSA Battle System: Classical ATB can't be used
  934.          with:\n" +
  935.         "YSA Battle System: Classical ATB") if $imported["YSA-CATB"]
  936.  
  937. end # if $imported["YEA-BattleEngine"] && !$imported["YSA-CATB"]
  938.  
  939. #==============================================================================|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement