SHARE
TWEET

DoubleX RMVXA ECATB Compatibility v0.08g

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