Advertisement
Double_X

DoubleX RMVXA Enhanced YSA Battle System: Classical ATB

May 11th, 2015 (edited)
2,441
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 396.28 KB | None | 1 0
  1. #==============================================================================|
  2. #  ** Script Info                                                              |
  3. #------------------------------------------------------------------------------|
  4. #  * Script Name                                                               |
  5. #    DoubleX RMVXA Enhanced YSA Battle System: Classical ATB                   |
  6. #------------------------------------------------------------------------------|
  7. #  * Functions                                                                 |
  8. #    Be an enhanced version of YSA-CATB with bug fixes and addons integrated   |
  9. #    Features:                                                                 |
  10. #    1. Action Input Events(Core)                                              |
  11. #        You can set something to occur right before/after inputting actions   |
  12. #    2. Action Input Speed(Speed)                                              |
  13. #       You can set some enemys and/or actors with autobattle and/or confusion |
  14. #       to have action input speeds set by you                                 |
  15. #    3. ATB Bar Colors(Core)                                                   |
  16. #       You can set some actors, classes, weapons, armors, enemies and/or      |
  17. #       states to alter their owner's atb bar colors by ways set by you        |
  18. #    4. ATB Clock Window(Clock)                                                |
  19. #       You can set if and how the atb clock info will be shown in battle      |
  20. #    5. ATB Fill Rate(Core)                                                    |
  21. #       You can set some actors, classes, weapons, armors, enemies and/or      |
  22. #       states to alter their owner's atb fill rate by ways set by you         |
  23. #    6. ATB Force Run/Stop(Force)                                              |
  24. #       You can set keys to force the atb clock to run or stop when pressed    |
  25. #       You can also set if and how the atb force status will be shown         |
  26. #    7. ATB Pool(Pool)                                                         |
  27. #       You can set the atb and action points to be shared among the party or  |
  28. #       troop                                                                  |
  29. #       Right now it doesn't support toogling this feature in battles          |
  30. #       (v0.05a+)Right now it doesn't work well with the Gradual Action Points |
  31. #       Gain feature                                                           |
  32. #    8. ATB Reset Events(Core)                                                 |
  33. #       You can set something to occur right before and/or after an atb reset  |
  34. #    9. ATB Reset Value(Core)                                                  |
  35. #       You can set some skill or items to reset their users' atb value by     |
  36. #       values set by You                                                      |
  37. #    10. ATB Turn Type(Core)                                                   |
  38. #        You can set if the turn is based on time, number of actions/battlers  |
  39. #    11. ATB Update Events(Core)                                               |
  40. #        You can set something to occur right before and/or after an atb update|
  41. #    12. Battler Charging Cancellation/Setup/Target Selection Hotkeys(Hotkey)  |
  42. #        You can set hotkeys to call actors/enemies that can input actions, be |
  43. #        targeted or are charging skills/items                                 |
  44. #    13. Battler Cool Down(Cooldown)                                           |
  45. #        You can set some skills or items to cause their users to have to cool |
  46. #        down for a while before their atb bar will be filled again            |
  47. #    14. Battler Order Window(Order)                                           |
  48. #        You can set if and how the battler orders will be shown in battle     |
  49. #    15. Battler Ready SE(SE)                                                  |
  50. #        You can set some battlers to play a se set by users when the battlers |
  51. #        become able to act                                                    |
  52. #    16. Battler Sprite ATB Bars(Bar)                                          |
  53. #        You can set the contents and layouts of the battler sprite atb bars   |
  54. #        and the conditions for them to be shown                               |
  55. #    17. Changing battle systems(Core)                                         |
  56. #        You can change the battle system to any of those supported by         |
  57. #        Yanfly Engine Ace - Ace Battle Engine outside battles                 |
  58. #    18. Cooldown Finish Events(Cooldown)                                      |
  59. #        You can set something to occur right after finishing cooldown normally|
  60. #    19. Countdown States(Countdown)                                           |
  61. #        You can set some states having duration in seconds and conditions     |
  62. #        that trigger actions when they're met                                 |
  63. #    20. (v0.04a+)CTB Replication(Core)                                        |
  64. #        You can set this script to replicate a CTB system by skipping the atb,|
  65. #        charge and cooldown filling times, and the global atb tick clock      |
  66. #    21. Dynamic configuration values(Core)                                    |
  67. #        Almost all user configuration values can be changed by you on the fly |
  68. #    22. Escape/ATB Wait Conditions(Core)                                      |
  69. #        You can set the conditions for party escape and/or the atb clock to   |
  70. #        stop running                                                          |
  71. #    23. Failed Escape Attempt Action Cost(Core)                               |
  72. #        You can set the action costed paid by all party members right after   |
  73. #        a failed escape attempt                                               |
  74. #    24. (v0.05a+)Gradual Action Points Gain(Action)                           |
  75. #        You can set some battlers' action points to be gained 1 by 1 instead  |
  76. #        of gaining all action points at once                                  |
  77. #        Right now it doesn't work well with the ATB Pool feature              |
  78. #    25. Skill/Item Action Cost(Core)                                          |
  79. #        You can set some skills or items to have their own action point       |
  80. #        demands                                                               |
  81. #    26. Skill/Item Cancel(Cancel)                                             |
  82. #        You can cancel party members' charging skill/items                    |
  83. #    27. Skill/Item Charging(Charge)                                           |
  84. #        You can set party escape, some skills or items to demand users to     |
  85. #        charge for a while before executing them                              |
  86. #        You can also set some skills or items requiring charging to demands   |
  87. #        their users to pay the costs after started or finished charging       |
  88. #    28. Start ATB Value(Core)                                                 |
  89. #        You can set some battlers to have their own initial atb values at     |
  90. #        the beginning of a battle under conditions set by you                 |
  91. #    29. Unison Skills(Unison)                                                 |
  92. #        You can set some skills/items to need more than 1 battler to use      |
  93. #        Right now it only supports actor unison skills/items                  |
  94. #    Possibly upcoming features:                                               |
  95. #    1. Action Batch Execution                                                 |
  96. #       You can set some battlers to input and execute more than 1 actions in a|
  97. #       single action input and execution phase respectively                   |
  98. #    2. Multiple ATB Types                                                     |
  99. #       You can set some skills/items to use some ATB types and some other     |
  100. #       skills/items to use some other ATB types                               |
  101. #    3. Premature Discharge                                                    |
  102. #       You can set some skills/items to be able to be prematurely executed    |
  103. #       before it finishes charging under some conditions and trade offs       |
  104. #------------------------------------------------------------------------------|
  105. #  * Terms Of Use                                                              |
  106. #    You shall:                                                                |
  107. #    1. Follow the terms of use of YSA Battle System: Classical ATB            |
  108. #    2. Let your published edits of this script be integrated as parts of it   |
  109. #    3. Keep this script's Script Info part's contents intact                  |
  110. #    You shalln't:                                                             |
  111. #    1. Claim that this script's written by anyone other than DoubleX, his     |
  112. #       aliases, Yami, or his/her aliases                                      |
  113. #    2. Make an edit of this script while saying it isn't                      |
  114. #    3. Make a RMVXA project based on this script's demo while saying it isn't |
  115. #    None of the above applies to Yami or his/her aliases                      |
  116. #------------------------------------------------------------------------------|
  117. #  * Prerequisites                                                             |
  118. #    Scripts:                                                                  |
  119. #    1. Yanfly Engine Ace - Ace Battle Engine                                  |
  120. #    Abilities:                                                                |
  121. #    1. Solid understanding of the active time battle system concepts          |
  122. #    2. Solid understanding of the RMVXA notetag and script call usages        |
  123. #    3. Decent RGSS3 scripting proficiency to fully utilize this script        |
  124. #------------------------------------------------------------------------------|
  125. #  * Instructions                                                              |
  126. #    1. Open the script editor and put this script into an open slot between   |
  127. #       Yanfly Engine Ace - Ace Battle Engine and Main. Save to take effect.   |
  128. #    2. This script can't be used with YSA Battle System: Classical ATB.       |
  129. #    3. Set DEFAULT_BATTLE_SYSTEM in Yanfly Engine Ace - Ace Battle Engine as  |
  130. #       :ecatb to set the default battle system as that of this script.        |
  131. #------------------------------------------------------------------------------|
  132. #  * Author's Notes                                                            |
  133. #    1. Using Yanfly Engine Ace - Ace Core Engine is highly recommended as it  |
  134. #       fixes the force action bug of this script and improve the atb percent  |
  135. #       and action points display in the actor atb bars.                       |
  136. #    2. Using Yanfly Engine Ace - Buff & State Manager is highly recommended as|
  137. #       it displays the states' remaining turns.                               |
  138. #    3. Using Yanfly Engine Ace - Skill Cost Manager is highly recommended as  |
  139. #       it can display the skills/items' action point requirements by using    |
  140. #       <custom cost: skill.ecatb_act_cost[@actor]>.                           |
  141. #    4. Using Cidiomar's Input as well is highly recommended as it lets users  |
  142. #       set custom keymaps, which is useful for features using keyboard inputs.|
  143. #    5. Using DoubleX RMVXA Dynamic Data is highly recommemded as it lets you  |
  144. #       change the notetag values on the fly.                                  |
  145. #       - ecatb_note_strings[note] is an accessor letting you store your new   |
  146. #         notetag values of notetag note.                                      |
  147. #       - reset_ecatb_notes(note) applies the above changes.                   |
  148. #    6. Using DoubleX RMVXA State Counters is highly recommended as it displays|
  149. #       the enemy countdown states.                                            |
  150. #    7. Using DoubleX RMVXA State Triggers is highly recommended as the CATB   |
  151. #       Clear Addon and some features of the CATB Countdown Addon are          |
  152. #       outsourced to that script.                                             |
  153. #    8. This is an advanced complicated script, meaning testings are likely    |
  154. #       needed to comprehend the use of every configuration of this script.    |
  155. #    9. This script can run using the default settings, but you're still highly|
  156. #       recommended to comprehend all user settings of this script.            |
  157. #    10. This script checks and corrects most configuration(but not notetag)   |
  158. #        values, but you're still highly recommended to validate every         |
  159. #        configuration(and notetag) values themselves.                         |
  160. #    11. Using too many and/or complicated notetags and/or configuration values|
  161. #        can cause severe performance issues, especailly on less able machines.|
  162. #------------------------------------------------------------------------------|
  163. #  * FAQ                                                                       |
  164. #    Q1. What's the main difference between ECATB and CATB?                    |
  165. #    A1. 1. The former integrates everything except compatibility fix into 1   |
  166. #           script while the addons and bug fix of the latter are all separate |
  167. #           scripts.                                                           |
  168. #        2. Almost all user settings of the former can be changed on the fly   |
  169. #           easily while lots of the latter are always fixed once set by users |
  170. #           or even just hardcoded.                                            |
  171. #        3. Some notetags of the former lets users do more stuffs than some of |
  172. #           those of the latter.                                               |
  173. #        4. The code structures and documentations of the former are generally |
  174. #           clearer, neater and more logical than those of the latter.         |
  175. #        5. The codes of the former are generally more effective, efficient,   |
  176. #           flexible, maintainable, reliable and robust than the latter.       |
  177. #        6. The former does a more thorough user error checking and corrections|
  178. #           than the latter for most user settings in most cases.              |
  179. #        7. The former generally demands much more from both the users and     |
  180. #           scripters than the latter.                                         |
  181. #        8. Users can't disable addons in the former while they can add and/or |
  182. #           remove the addon of the latter effortlessly.                       |
  183. #        9. The latter outsources little features to other scripts while the   |
  184. #           former does this significantly more heavily.                       |
  185. #    Q2. Some settings need scripting knowledge to use. May you please teach me|
  186. #        scripting?                                                            |
  187. #    A2. You can ask me how to set specific settings to meet your specific     |
  188. #        needs, but it seems to me that there are many good scripting teachers |
  189. #        so you may want to ask them instead of me for learning scripting.     |
  190. #    Q3. Why don't you implement the reverse atb bar feature in this script    |
  191. #        like what Victor Sant did in his atb script?                          |
  192. #    A3. It's implicitly implemented but the feature is still in this script:  |
  193. #        1. Set :ecatb_bar_colors as %Q(Color.new(0, 0, 0, 0),                 |
  194. #           Color.new(0, 0, 0, 0)).                                            |
  195. #           It makes the atb bar invisible.                                    |
  196. #        2. Set :ecatb_base_fill_t as %Q(1 / Graphics.frame_rate).             |
  197. #           It sets the base atb fill rate to be 100% per frame.               |
  198. #        3. Set the charge rate of each skill or item as "x".                  |
  199. #           It makes the skill or item to charge x% atb per frame.             |
  200. #    Q4. Why I'll have to credit Yami but not you when it's your work?         |
  201. #    A4. It's because this script's an edit of CATB and is heavily based on it.|
  202. #        Without Yami's CATB, this script won't exist; Without his term of use |
  203. #        permitting editing his CATB, this script won't exist as well.         |
  204. #    Q5. What's the point of making ECATB when we've CATB?                     |
  205. #    A5. 1. Some users may prefer having everything bundled into a single      |
  206. #           script and that's the main reason for me to make ECATB.            |
  207. #        2. Lets advanced users have much more control and freedom over the    |
  208. #           script settings. ECATB does that at the cost of significantly      |
  209. #           raising the demand of user proficiency, while CATB keeps the       |
  210. #           settings simple at the cost of obviously reducing the settting     |
  211. #           flexibilities.                                                     |
  212. #    Q6. Can you make this script easier for non-scripters to use?             |
  213. #    A6. I tried to make it as easy as I can but right now that's my limit.    |
  214. #    Q7. Why some settings aren't hardcoded when no users would change them?   |
  215. #    A7. If that's really the case, I'll consider making them hardcoded.       |
  216. #    Q8. Why the script configuration part needs to have 2400+ lines?          |
  217. #    A8. That's because this script does need that many lines to let users set |
  218. #        the configurations of this script. You may want to use CATB instead if|
  219. #        you don't need most of this script's configurations.                  |
  220. #    Q9. Why 'Let your published edits of this script be integrated as parts of|
  221. #        it' is included in the terms of use?                                  |
  222. #    A9. 1. It means I want to reserve that right but that doesn't mean I'll   |
  223. #           always do so. I'll never do so without discussing that with you.   |
  224. #           I'll even try to have your permissions beforehand.                 |
  225. #        2. Integrating the edits into this script may perform better in some  |
  226. #           cases. A case-by-case approach will be used for discussing that.   |
  227. #        3. If I didn't reserve that right, things could be chaotic when some  |
  228. #           edits done by some people did conflict with some of the others by  |
  229. #           some other people. Reserving this right can indeed be an insurance.|
  230. #        4. I'll credit you and clearly stating which parts are your work.     |
  231. #------------------------------------------------------------------------------|
  232. #  * Links                                                                     |
  233. #    Script Usage 101:                                                         |
  234. #    1. forums.rpgmakerweb.com/index.php?/topic/32752-rmvxa-script-usage-101/  |
  235. #    2. rpgmakervxace.net/topic/27475-rmvxa-script-usage-101/                  |
  236. #    This script:                                                              |
  237. #    1. http://rpgmaker.net/scripts/549/                                       |
  238. #    (DoubleX)ECATB Base Formula:                                              |
  239. #    1. http://pastebin.com/PRwkrQKb                                           |
  240. #    Compatibility Fix:                                                        |
  241. #    1. http://rpgmaker.net/scripts/551/                                       |
  242. #    Video:                                                                    |
  243. #    1. https://www.youtube.com/watch?v=E692R6s8F0I                            |
  244. #    2. https://www.youtube.com/watch?v=6E0-X0wbLAM                            |
  245. #    Demo:                                                                     |
  246. #    - Coming Soon                                                             |
  247. #    Tutorial:                                                                 |
  248. #    - Link included in http://rpgmaker.net/scripts/549/                       |
  249. #    Mentioned Patreon Supporters:                                             |
  250. #    https://www.patreon.com/posts/71738797                                    |
  251. #------------------------------------------------------------------------------|
  252. #  * Authors                                                                   |
  253. #    DoubleX:                                                                  |
  254. #    1. This script                                                            |
  255. #    Yami:                                                                     |
  256. #    1. YSA Battle System: Classical ATB                                       |
  257. #------------------------------------------------------------------------------|
  258. #  * Changelog                                                                 |
  259. #    v0.05c(GMT 0600 28-11-2021):                                              |
  260. #    1. Fixed wrong eval of ecatb_battler_scale and uninitialized battler turn |
  261. #       bugs                                                                   |
  262. #    v0.05b(GMT 0200 7-11-2015):                                               |
  263. #    1. Updated (DoubleX)ECATB Base Formula                                    |
  264. #    2. Notetag values are now symbols of methods in the configuration regions |
  265. #    3. Fixed battler order icon not placed correctly when atb >= 100.0 bug    |
  266. #    4. Simplified the party/troop atb pool reset implementations              |
  267. #    5. Updated some outdated documentations                                   |
  268. #    6. Further improved this script's compatibility, efficiency and simplicity|
  269. #    v0.05a(GMT 0400 21-10-2015):                                              |
  270. #    1. Implemented the Gradual Action Points Gain feature                     |
  271. #       - Right now it doesn't work well with the ATB Pool feature             |
  272. #    2. Updated (DoubleX)ECATB Base Formula                                    |
  273. #    3. Added configuration :ecatb_countdown_mib in the added feature COUNTDOWN|
  274. #    4. ecatb_se_ready_act changed to take SE or nil instead of an array       |
  275. #    5. Fixed battler order and se notetags falsely returning nil bug          |
  276. #    6. Fixed undisposed battler atb order icons upon battle end bug           |
  277. #    7. Fixed repeated actor sprite creation bug                               |
  278. #    8. Fixed battler atb order icons not keeping updated upon icon change bug |
  279. #    9. Fixed pre ecatb input act only triggering upon becoming able to act bug|
  280. #    10. Fixed split second countdown interval never updating turns bug        |
  281. #    11. Fixed active actor command window not showing in atb pool mode bug    |
  282. #    12. Fixed enemy atb bar not showing for those having at least 1 state bug |
  283. #    13. Fixed nil cooldown rate when the atb gain rate remain unchanged bug   |
  284. #    14. Fixed false unison charging for non unison skills/items after using   |
  285. #        unison ones bug                                                       |
  286. #    15. Fixed corrupted battler's last skill/item cache bug                   |
  287. #    16. Fixed running the atb frame update upon battle end bug                |
  288. #    17. Fixed non-sync unison cooldown with party/troop atb pool mode bug     |
  289. #    18. Fixed troop atb pool reset not resetting all enemies' atb values bug  |
  290. #    19. Fixed party/troop atb pool reset falsely resetting other members'     |
  291. #        actions bug                                                           |
  292. #        Right now all members' actions will still be reset when the action    |
  293. #        point pool's depleted                                                 |
  294. #    21. Fixed battler ready se not playing when the battler's become able to  |
  295. #        act bug                                                               |
  296. #    22. Debugging this script becomes easier and simpler with the console open|
  297. #    23. Removed some more redundant variables and methods                     |
  298. #    24. Further boosted this script's compactness, correctness, effectiveness,|
  299. #        efficiency, maintainability, readability, robustness and simplicity   |
  300. #    v0.04f(GMT 0400 12-9-2015):                                               |
  301. #    1. Added 3 script calls for notifying changes of new status window methods|
  302. #    2. The battler sprite atb bar methods are now under ECATB_Bar             |
  303. #    3. Fixed issues with clearing/resetting battler blocks twice consecutively|
  304. #    4. Further improved this script's effectiveness, efficiency and robustness|
  305. #    v0.04e(GMT 1500 11-8-2015):                                               |
  306. #    1. Fixed crash upon changing equips outside battles bug                   |
  307. #    2. Fixed triggering pre and post atb reset effects upon battle end bug    |
  308. #    3. Fixed enemy ecatb bar show not working properly bug                    |
  309. #    4. Fixed actors added during battles not properly initialized bug         |
  310. #    5. Fixed disabling party escape if not all party members are movable bug  |
  311. #    6. Fixed failed party escape attempts not cooling down properly bug       |
  312. #    7. Updated the outdated configuration documentations                      |
  313. #    8. Further improved this script's compactness, memory usage and robustness|
  314. #    v0.04d(GMT 1400 1-8-2015):                                                |
  315. #    1. Updated (DoubleX)ECATB Base Formula                                    |
  316. #    2. Changed :color to :atb and %Q(%Q()) to %Q()                            |
  317. #    3. Added configuration :ecatb_bar_multilayer in feature BAR               |
  318. #    4. Changed configuration :ecatb_actor_hotkeys to :ecatb_battler_hotkeys   |
  319. #    5. UNISON_DEFS doesn't have to include method arguments now               |
  320. #    6. Battler bars displayed on their sprites can overlap with status window |
  321. #    7. Added video https://www.youtube.com/watch?v=6E0-X0wbLAM                |
  322. #    8. Fixed complete freeze upon battle end in the ctb replication mode bug  |
  323. #    9. Fixed actors being inputable without action points in the atb pool mode|
  324. #    10. Fixed uncleared blocks for actors not in the party when saving bug    |
  325. #    11. Fixed unison rules not being properly applied to user's methods bug   |
  326. #    12. Fixed countdown freeze not freezing the countdown clock entirely bug  |
  327. #    13. Fixed notetag value reevaluation not always correctly triggered bug   |
  328. #    14. Further increased this script's compactness, compatibility,           |
  329. #        correctness, effectiveness, efficiency, flexibility, maintainability, |
  330. #        modularity, readability, robustness, simplicity and user-friendliness |
  331. #    v0.04c(GMT 1600 5-7-2015):                                                |
  332. #    1. Fixed duplicate actor sprite creations from other scripts doing so     |
  333. #    2. Fixed executing and/or inputting actions from/to hidden battlers bug   |
  334. #    3. Further increased this script's compactness and efficiency             |
  335. #    4. Removed some more redundant variables and compatibility socket methods |
  336. #    v0.04b(GMT 1600 29-6-2015):                                               |
  337. #    1. Reduced lag right after executing actions with ctb replication         |
  338. #    2. Fixed nil atb bar color bug upon party member change at battle end     |
  339. #    3. Removed some redundant variables and compatibility socket methods      |
  340. #    v0.04a(GMT 0300 27-6-2015):                                               |
  341. #    1. Implemented the CTB Replication feature                                |
  342. #    2. Lets users set if problematic configuration values will be reset       |
  343. #    3. Fixed retrieving nil battler name bug in the help window               |
  344. #    4. Increased this script's compactness and memory performance             |
  345. #    v0.03a(GMT 0900 27-5-2015):                                               |
  346. #    1. Implemented these features:                                            |
  347. #       -  Action Input Events                                                 |
  348. #       -  ATB Reset Events                                                    |
  349. #       -  Cooldown Finish Events                                              |
  350. #    2. Improved this script's efficiency and robustness                       |
  351. #    v0.02d(GMT 0400 25-5-2015):                                               |
  352. #    1. Fixed starting atb value not working bug                               |
  353. #    2. Fixed some typos and outdated stuffs                                   |
  354. #    v0.02c(GMT 1300 15-5-2015):                                               |
  355. #    1. Fixed default atb starting value not working bug                       |
  356. #    2. Fixed nil color upon victory and unexpected change equip results bug   |
  357. #    3. Fixed not clearing battlers' lambdas before calling Marshal bug        |
  358. #    4. Fixed failing to load saved games upon restarting the game bug         |
  359. #    5. Fixed unison method rules not working bug                              |
  360. #    6. Improved the battler cooldown and party escape implementations         |
  361. #    7. Further improved this script's efficiency                              |
  362. #    v0.02b(GMT 1500 12-5-2015):                                               |
  363. #    1. Fixed some typos and outdated stuffs                                   |
  364. #    2. Fixed order battler icon bugs upon adding/removing party members       |
  365. #    v0.02a(GMT 0700 9-5-2015):                                                |
  366. #    1. Implemented the Action Input Speed feature                             |
  367. #    2. Further improved this script's efficiency                              |
  368. #    v0.01b(GMT 1600 4-5-2015):                                                |
  369. #    1. Improved this script's efficiency                                      |
  370. #    v0.01a(GMT 1300 2-5-2015):                                                |
  371. #    1. Implemented the Battler Order Window feature                           |
  372. #    v0.00d(GMT 0800 22-4-2015):                                               |
  373. #    1. Fixed actor auto battle and confusion action not executing properly bug|
  374. #    2. Fixed compatibility methods not being called bug                       |
  375. #    3. Fixed unison charging value reset bug(the charging finishes upon reset)|
  376. #    v0.00c(GMT 1200 18-4-2015):                                               |
  377. #    1. Fixed the atb bar y offset not working bug                             |
  378. #    2. Fixed the faulty example notetag values of <ecatb color: type, num, CX>|
  379. #    3. Found unison charging value reset bug(the charging finishes upon reset)|
  380. #    v0.00b(GMT 0900 15-4-2015):                                               |
  381. #    1. Outsourced the countdown state sprite display to                       |
  382. #       DoubleX RMVXA State Counters                                           |
  383. #    2. Actor atb bars can be displayed on their sprites                       |
  384. #    v0.00a(GMT 1200 9-4-2015):                                                |
  385. #    1. 1st testing version of this script finished                            |
  386. #==============================================================================|
  387.  
  388. #==============================================================================|
  389. #  ** Notetag Info                                                             |
  390. #     Notetag settings override their corresponding configuration settings     |
  391. #     Search the notetags themselves to navigate between their info and values |
  392. #------------------------------------------------------------------------------|
  393. #  * Actors/Classes/Weapons/Armors/Enemies/States Notetags(in their noteboxes):|
  394. #    1. <ecatb color: type, num, cx>                                           |
  395. #       Sets the color num of atb bar with type being atb, charge or cooldown, |
  396. #       and num being 1or 2 as cx, which can be set in Color Notetag Values    |
  397. #    2. (v0.05a+)<ecatb gradual action gain: gagx>                             |
  398. #       Sets the battler to gradually gain action points instead of gaining its|
  399. #       maximum instantly if gagx, which can be set in Gradual Action Gain     |
  400. #       Notetag Values, returns true                                           |
  401. #    3. <ecatb order battler icon: obix>                                       |
  402. #       Sets the icon representing its battler's order as obix, which can be   |
  403. #       set in Order Battler Icon Notetag Values                               |
  404. #    4. <ecatb order battler opacity: obox>                                    |
  405. #       Sets the opacity of the icon representing its battler's order as obox, |
  406. #       which can be set in Order Battler Opacity Notetag Values               |
  407. #    5. <ecatb order battler scale: obsx>                                      |
  408. #       Sets the scale of the icon representing its battler's order as obsx,   |
  409. #       which can be set in Order Battler Scale Notetag Values                 |
  410. #    6. <ecatb order battler z: obzx>                                          |
  411. #       Sets the z position of the icon representing its battler's order as    |
  412. #       obzx, which can be awr in Order Battler Z Notetag Values               |
  413. #    7. <ecatb rate: rx>                                                       |
  414. #       Sets the atb fill rate of the battler as rx, which can be set in Rate  |
  415. #       Notetag Values                                                         |
  416. #       All rx of all data currently applied to the battler will be used, with |
  417. #       the output of the ith rx being the input of the (i + 1)th rx           |
  418. #    8. <ecatb se ready act: serax>                                            |
  419. #       Sets the se to be played when a battler becomes able to act as serax,  |
  420. #       which can be set in SE Ready Act Notetag Values                        |
  421. #    9. <ecatb speed reduce: srx>                                              |
  422. #       Sets the number of frames an enemy or actor with autobattle and/or     |
  423. #       confusion needs when inputting actions as srx, which can be set in     |
  424. #       Speed Reduce Notetag Values                                            |
  425. #       All srx of all data currently applied to the battler will be used      |
  426. #    10. <ecatb start val: start, svx>                                         |
  427. #        Sets the atb value at the start of the battle as svx, which can be set|
  428. #        in Start Value Notetag Values                                         |
  429. #        start can be either 0, 1 or 2, meaning the notetag will be used in    |
  430. #        normal, preemptive or surprise starts respectively                    |
  431. #        All svx of all data currently applied to the battler will be used     |
  432. #------------------------------------------------------------------------------|
  433. #  * Skill/Item Notetags(in their noteboxes):                                  |
  434. #    1. <ecatb act cost: acx>                                                  |
  435. #       Sets the number of actions needed for the skill/item as acx, which can |
  436. #       be set in Action Cost Notetag Values                                   |
  437. #       Users can't use it if they don't have enough actions                   |
  438. #       Setting acx as 0 means no action point is needed nor will be used      |
  439. #       Setting acx as negative means users will have more actions afterwards  |
  440. #    2. <ecatb charge prior act cost: cpacx>                                   |
  441. #       The skill/item action cost will be paid before and after finished      |
  442. #       charging if cpacx, which can be set in Charge Prior Act Cost Notetag   |
  443. #       Values, returns false and true respectively                            |
  444. #    3. <ecatb charge prior item cost: cpicx>                                  |
  445. #       The skill/item non-action cost will be paid before and after finished  |
  446. #       charging if cpicx, which can be set in Charge Prior Item Cost Notetag  |
  447. #       Values, returns false and true respectively                            |
  448. #    4. <ecatb charge rate: crx>                                               |
  449. #       The skill/item will have to charge with atb fill rate being crx, which |
  450. #       can be set in Charge Rate Notetag Values, before releasing if this     |
  451. #       notetag's used                                                         |
  452. #    5. <ecatb cooldown rate: cdrx>                                            |
  453. #       The battler will have to cool down with atb fill rate being cdrx, which|
  454. #       can be set in Cooldown Rate Notetag Values, after using the skill/item |
  455. #       before the battler's atb will be filled again if this notetag's used   |
  456. #    6. <ecatb force act cost: facx>                                           |
  457. #       The battler will and won't pay the action cost after using the forced  |
  458. #       action if facx, which can be set in Force Action Cost Notetag Values,  |
  459. #       returns false and true respectively                                    |
  460. #    7. <ecatb reset val: rvx>                                                 |
  461. #       Sets the atb value after using the skill/item as rvx, which can be set |
  462. #       in Reset Value Notetag Values                                          |
  463. #       The atb value right after users have no more actions will be the sum of|
  464. #       rvx of all skills/items used before users have no more actions if the  |
  465. #       battler doesn't gain action points gradually                           |
  466. #    8. <ecatb unison actor: uax>                                              |
  467. #       Sets the ids of actors needed to use the skill/item as uax, which can  |
  468. #       be set in Unison Actor Notetag Values                                  |
  469. #       All those actors must be able to use the skill/item                    |
  470. #       They'll charge it with the same charge rate, use it together and have  |
  471. #       a cooldown with the same cooldown rate                                 |
  472. #    9. <ecatb unison actor def: uadx>                                         |
  473. #       Sets the ids of actors used to calculate the result of def as uadx,    |
  474. #       which can be set in Unison Actor Method Notetag Values                 |
  475. #       def must be the symbol of a battler method returning real numbers and  |
  476. #       should be those used in the skill/item's damage formula                |
  477. #       If a method's used in the skill/item's damage formula but doesn't use  |
  478. #       this notetag, its value will be that of the battler inputting the      |
  479. #       skill/item                                                             |
  480. #       Only 1 uadx will be used per def                                       |
  481. #    10. <ecatb unison def rule: udrx>                                         |
  482. #        Sets the calculation rule of def as udrx, which can be set in Unison  |
  483. #        Method Rule Notetag Values                                            |
  484. #        def must be the symbol of a battler method returning real numbers and |
  485. #        should be those used in the skill/item's damage formula               |
  486. #        The rules are used when the skill/item's executing damage             |
  487. #        Only 1 udrx will be used per def                                      |
  488. #    11. <ecatb unison charge rule: ucrx>                                      |
  489. #        Sets the charge rate calculation rule as ucrx, which can be set in    |
  490. #        Unison Charge Rule Notetag Values                                     |
  491. #        The rules are used when the skill/item's charging                     |
  492. #    12. <ecatb unison cooldown rule: ucdrx>                                   |
  493. #        Sets the calculation rule of def as ucdrx, which can be set in Unison |
  494. #        Cooldown Rule Notetag Values                                          |
  495. #        The rules are used when the skill/item's users are cooling down       |
  496. #------------------------------------------------------------------------------|
  497. #  * Enemy/State Notetags(in their noteboxes):                                 |
  498. #    1. <enemy ecatb bar show: kill, bar, percent, act>                        |
  499. #       Sets if the enemy atb bar should be shown with fill percent and action |
  500. #       points                                                                 |
  501. #       The bar won't be shown if kill is true and the enemy isn't killed first|
  502. #       bar, act and percent will be ignored will be above condition is met    |
  503. #       The bar will be shown if bar is true                                   |
  504. #       act and percent will be ignored if bar is false                        |
  505. #       Action points and fill percent will be shown if act and percent are    |
  506. #       true respectively                                                      |
  507. #       Setting the value of an entry as nil means that entry will be ignored  |
  508. #       t, f and n represents true, false and nil values respectively          |
  509. #       The entry with the highest priority will be used if it's not nil       |
  510. #       Enemy's notetags are of the lowest priorities and will never be ignored|
  511. #------------------------------------------------------------------------------|
  512. #  * State Notetags(in their noteboxes):                                       |
  513. #    1. <ecatb countdown interval: cix>                                        |
  514. #       Sets the duration of the state as cix seconds, which  can be set in    |
  515. #       Coundown Interval Notetag Values                                       |
  516. #        All cix of all states currently applied to the battler will be used   |
  517. #==============================================================================|
  518.  
  519. #==============================================================================|
  520. #  ** Script Call Info                                                         |
  521. #------------------------------------------------------------------------------|
  522. #  * Configuration Settings                                                    |
  523. #    1. $game_system.set_battle_system(system)                                 |
  524. #       - Changes the battle system as system, which is one of those supported |
  525. #         by Yanfly Engine Ace - Ace Battle Engine                             |
  526. #       - It can only be used outside battles                                  |
  527. #    2. $game_system.ecatb_config = val                                        |
  528. #       - Sets the value of :ecatb_config as val                               |
  529. #         Example: $game_system.ecatb_base_fill_t = "$game_variables[x]" sets  |
  530. #                  the value of :ecatb_base_fill_t as that of variable with id |
  531. #                  x                                                           |
  532. #    3. create_ecatb_def(config, validate)                                     |
  533. #       - Updates the corresponding method of configuration config             |
  534. #         That method will be validated if validate is true                    |
  535. #         Example: BattleManager.create_ecatb_def(:ecatb_base_fill_t, true)    |
  536. #                  updates and validates the corresponding method of           |
  537. #                  :ecatb_base_fill_t                                          |
  538. #  * Battler manipulations                                                     |
  539. #    1. ecatb_act_times                                                        |
  540. #       - Returns the number of the current action points                      |
  541. #    2. ecatb_act_times = val                                                  |
  542. #       - Sets the number of the current action points as val                  |
  543. #    3. ecatb_countdown_freeze[state_id]                                       |
  544. #       - Returns if the countdown of state with id state_id is frozen         |
  545. #    4. ecatb_countdown_freeze[state_id] = val                                 |
  546. #       - Sets if the duration in turns of a countdown state with id state_id  |
  547. #         will be frozen                                                       |
  548. #    5. ecatb_note_change[note] = true                                         |
  549. #       - Notifies at least a value of a notetag with type note of a data used |
  550. #         by the battler has changed                                           |
  551. #       - note can be :act, :atb, :charge, :cooldown, :order_icon,             |
  552. #         :order_opacity,:order_scale, :order_z, :rate, :se, :speed, :start_0, |
  553. #         :start_1, :start_2, meaning gradual action gain, charge rate,        |
  554. #         bar color, cooldown rate, order icon, order opacity, order scale,    |
  555. #         order z, atb gain rate, speed reduce, battler ready se and start     |
  556. #         value notetags with normal, preemptive and surprise start types      |
  557. #         respectively                                                         |
  558. #       - This script call can also be used to change the charge, cooldown, atb|
  559. #         gain rate and bar colors per frame when it's called per frame        |
  560. #    6. ecatb_reset(reset)                                                     |
  561. #       - Cancels the battler's charging actions                               |
  562. #       - The battler's atb and action points will be reset as well if reset   |
  563. #         is true                                                              |
  564. #    7. ecatb_rate[type]                                                       |
  565. #       Returns the atb gain rate with type type                               |
  566. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  567. #         charge and cooldown atb types respectively                           |
  568. #    8. ecatb_val[type]                                                        |
  569. #       Returns the atb value with type type                                   |
  570. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  571. #         charge and cooldown atb types respectively                           |
  572. #    9. ecatb_val[type] = val                                                  |
  573. #       - Sets the atb value with type type as val                             |
  574. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  575. #         charge and cooldown atb types respectively                           |
  576. #  * Party/Troop manipulations                                                 |
  577. #    1. ecatb_pool = enable                                                    |
  578. #       - Converts all actors/enemies' atb into a party/troop atb if enable is |
  579. #         true and vice versa if enable is false                               |
  580. #       - It can't be used in battles                                          |
  581. #  * Hotkey manipulations                                                      |
  582. #    1. SceneManager.scene.set_ecatb_battler_window_handlers                   |
  583. #       - Creates all battler target selection hotkey handlers                 |
  584. #       - It can only be used in battles                                       |
  585. #    2. SceneManager.scene.set_ecatb_actor_command_window_handlers             |
  586. #       - Creates all inputable actor setup hotkey handlers                    |
  587. #       - It can only be used in battles                                       |
  588. #    3. SceneManager.scene.create_ecatb_cancel_window                          |
  589. #       - Creates all charging actor cancellation hotkey handlers              |
  590. #       - It can only be used in battles                                       |
  591. #  * Window manipulations                                                      |
  592. #    1. SceneManager.scene.create_ecatb_clock_window                           |
  593. #       - Creates the atb clock window if :show_ecatb_clock_window returns     |
  594. #         true                                                                 |
  595. #       - It can only be used in battles                                       |
  596. #    2. SceneManager.scene_close_ecatb_clock_window                            |
  597. #       - Closes the atb clock window                                          |
  598. #       - It can only be used in battles with an atb clock window              |
  599. #    3. SceneManager.scene.ecatb_clock_window.update_text_xy                   |
  600. #       - Updates the atb clock window text x and y positions                  |
  601. #       - It can only be used in battles having an atb clock window            |
  602. #    4. SceneManager.scene.ecatb_clock_window.update_pos                       |
  603. #       - Updates the atb clock window x, y and z positions                    |
  604. #       - It can only be used in battles having an atb clock window            |
  605. #    5. SceneManager.scene.ecatb_clock_window.update_wh                        |
  606. #       - Updates the atb clock window width and height                        |
  607. #       - It can only be used in battles having an atb clock window            |
  608. #    6. SceneManager.scene.ecatb_clock_window.update_text_font                 |
  609. #       - Updates the atb clock window text color and size                     |
  610. #       - It can only be used in battles having an atb clock window            |
  611. #    7. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_colors      |
  612. #       - Updates the atb clock window bar colors                              |
  613. #       - It can only be used in battles having an atb clock window            |
  614. #    8. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_wh          |
  615. #       - Updates the atb clock window bar width and height                    |
  616. #       - It can only be used in battles having an atb clock window            |
  617. #    9. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_xy          |
  618. #       - Updates the atb clock window bar x and y positions                   |
  619. #       - It can only be used in battles having an atb clock window            |
  620. #    10. SceneManager.scene.ecatb_clock_window.refresh                         |
  621. #        - Refreshes the atb clock window bar and text                         |
  622. #        - It can only be used in battles having an atb clock window           |
  623. #    11. SceneManager.scene.create_ecatb_force_window                          |
  624. #        - Creates the atb force window if :show_ecatb_force_window returns    |
  625. #          true                                                                |
  626. #        - It can only be used in battles                                      |
  627. #    12. SceneManager.scene.close_ecatb_force_window                           |
  628. #        - Closes the atb force window                                         |
  629. #        - It can only be used in battles with an atb force window             |
  630. #    13. SceneManager.scene.ecatb_force_window.update_pos                      |
  631. #        - Updates the atb force window x, y and z positions                   |
  632. #        - It can only be used in battles having an atb force window           |
  633. #    14. SceneManager.scene.ecatb_force_window.update_wh                       |
  634. #        - Updates the atb force window width and height                       |
  635. #        - It can only be used in battles having an atb force window           |
  636. #    15. SceneManager.scene.ecatb_force_window.update_text_font                |
  637. #        - Updates the atb force window text color and size                    |
  638. #        - It can only be used in battles having an atb force window           |
  639. #    16. SceneManager.scene.ecatb_force_window.update_text                     |
  640. #        - Updates the atb force window text                                   |
  641. #        - It can only be used in battles having an atb force window           |
  642. #    17. SceneManager.scene.ecatb_force_window.update_text_xy                  |
  643. #        - Updates the atb force window text x and y positions                 |
  644. #        - It can only be used in battles having an atb force window           |
  645. #    18. SceneManager.scene.ecatb_force_window.draw_text                       |
  646. #        - Draws the atb force window text                                     |
  647. #        - It can only be used in battles having an atb force window           |
  648. #    19. SceneManager.scene.create_ecatb_order_window                          |
  649. #        - Creates the atb pool window if :show_ecatb_order_window returns true|
  650. #        - It can only be used in battles                                      |
  651. #    20. SceneManager.scene.close_ecatb_order_window                           |
  652. #        - Closes the atb order window                                         |
  653. #        - It can only be used in battles with an atb order window             |
  654. #    21. SceneManager.scene.ecatb_order_window.draw_bars                       |
  655. #        - Draws the atb order bars and text                                   |
  656. #        - It can only be used in battles with an atb order window             |
  657. #    22. SceneManager.scene.ecatb_pool_window.update_pos                       |
  658. #        - Updates the atb pool window x, y and z positions                    |
  659. #        - It can only be used in battles having an atb pool window            |
  660. #    23. SceneManager.scene.ecatb_pool_window.update_wh                        |
  661. #        - Updates the atb pool window width and height                        |
  662. #        - It can only be used in battles having an atb pool window            |
  663. #    24. SceneManager.scene.ecatb_pool_window.update_text_font                 |
  664. #        - Updates the atb pool window text color and size                     |
  665. #        - It can only be used in battles having an atb pool window            |
  666. #    25. SceneManager.scene.create_ecatb_pool_window                           |
  667. #        - Creates the atb pool window if :show_ecatb_pool_window returns true |
  668. #        - It can only be used in battles                                      |
  669. #    26. SceneManager.scene.close_ecatb_pool_window                            |
  670. #        - Closes the atb pool window                                          |
  671. #        - It can only be used in battles with an atb pool window              |
  672. #    27. SceneManager.scene.ecatb_pool_window.update_pos                       |
  673. #        - Updates the atb pool window x, y and z positions                    |
  674. #        - It can only be used in battles having an atb pool window            |
  675. #    28. SceneManager.scene.ecatb_pool_window.update_wh                        |
  676. #        - Updates the atb pool window width and height                        |
  677. #        - It can only be used in battles having an atb pool window            |
  678. #    29. SceneManager.scene.ecatb_pool_window.update_text_font                 |
  679. #        - Updates the atb pool window text color and size                     |
  680. #        - It can only be used in battles having an atb pool window            |
  681. #    30. SceneManager.scene.ecatb_pool_window.update_text_xy                   |
  682. #        - Updates the atb pool window text x and y positions                  |
  683. #        - It can only be used in battles having an atb pool window            |
  684. #    31. SceneManager.scene.ecatb_pool_window.draw_text                        |
  685. #        - Draws the atb pool window text                                      |
  686. #        - It can only be used in battles having an atb pool window            |
  687. #    32. (v0.04f+)SceneManager.scene.status_window.ecatb_text_change = true    |
  688. #        - Notifies that the atb bar text format's changed                     |
  689. #        - It can only be used in battles                                      |
  690. #    33. (v0.04f+)SceneManager.scene.status_window.ecatb_word_change = true    |
  691. #        - Notifies that the atb bar description word's changed                |
  692. #        - It can only be used in battles                                      |
  693. #    34. (v0.04f+)SceneManager.scene.status_window.ecatb_y_add_change = true   |
  694. #        - Notifies that the atb bar y offset's changed                        |
  695. #        - It can only be used in battles                                      |
  696. #==============================================================================|
  697.  
  698. ($doublex_rmvxa ||= {})[:ECATB] = "v0.05c"
  699.  
  700. #==============================================================================|
  701. #  ** Script Configurations                                                    |
  702. #     You only need to edit this part as it's about what this script does      |
  703. #------------------------------------------------------------------------------|
  704.  
  705. module DoubleX_RMVXA
  706.  
  707.   module ECATB
  708.  
  709.     # Sets if configuration values that can crash the game will be rescued
  710.     # If it's set as true, players will be informed that the values of those
  711.     # configurations are invalid and will be reset to their default ones
  712.     # If it's set as false, the game will crash and the error log will be shown
  713.     # It can't be changed once set
  714.     # Example: To let invalid configuration values crash the game to have the
  715.     #          error log, set this as false
  716.     RESCUE_CONFIG_VAL = true
  717.  
  718.     # (v0.04a+)Sets if configuration values that are invalid or can crash the
  719.     # game will be reset to their defaults
  720.     # It can't be changed once set
  721.     # Example: To reset invalid or faulty configuration values to their
  722.     #          defaults, set this as true
  723.     RESET_CONFIG_VAL = true
  724.  
  725.     # Sets if the text showing an invalid or faulty configuration value will be
  726.     # displayed right after checking them
  727.     # It can't be changed once set
  728.     # Example: To silently reset invalid or faulty configuration values, set
  729.     #          this as true
  730.     SUPPRESS_RESET_CONFIG_VAL_TEXT = false
  731.  
  732.   #----------------------------------------------------------------------------|
  733.   #  * Core                                                                    |
  734.   #    Setups configurations and notetag values of the core features           |
  735.   #----------------------------------------------------------------------------|
  736.  
  737.     #--------------------------------------------------------------------------|
  738.     #  Color Notetag Values                                                    |
  739.     #  - Setups cx used by <ecatb color: type, num, cx> notetags               |
  740.     #--------------------------------------------------------------------------|
  741.     # cx are read at:
  742.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  743.     #    - next @ecatb_notes[$1.downcase.to_sym][$2.to_i] ||= $3.downcase.to_sym
  744.     #      in load_ecatb_notes
  745.     # cx are used at:
  746.     # 1. Game_BattlerBase
  747.     #    - @ecatb_notes[note][0] ||= ecatb.send(n, self) if n and
  748.     #    - @ecatb_notes[note][1] ||= ecatb.send(n, self) in
  749.     #      set_ecatb_bar_color_notes
  750.     # cx are strings of names of methods under DoubleX_RMVXA::ECATB
  751.     # cx must return an array of colors
  752.     # cx names can only use alphanumeric characters and can't use uppercase
  753.     # letters
  754.     # battler is the battler calling the cx
  755.     # The below cx are examples added to help you set your cx
  756.     # You can freely use, rewrite and/or delete these examples
  757.  
  758.     # Sets the atb bar colors as text color c and r, g, b, a rgba values
  759.     def self.c1(battler)
  760.       Colour.text_colour(c)
  761.     end
  762.  
  763.     # Sets the atb bar colors as r, g, b, a rgba values
  764.     def self.c2(battler)
  765.       Color.new(r, g, b, a)
  766.     end
  767.  
  768.     # Adds new cx here
  769.    
  770.  
  771.     #--------------------------------------------------------------------------|
  772.     #  Rate Notetag Values                                                     |
  773.     #  - Setups rx used by <ecatb rate: rx> notetags                           |
  774.     #--------------------------------------------------------------------------|
  775.     # rx are read at:
  776.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  777.     #    - next @ecatb_notes[:rate] << $1.downcase.to_sym in load_ecatb_notes
  778.     # rx are used at:
  779.     # 1. Game_BattlerBase
  780.     #    - base[:val] = ecatb.send(note, self, base) in set_ecatb_gain_rate
  781.     # rx are strings of names of methods under DoubleX_RMVXA::ECATB
  782.     # rx must return a real number and should return a floating-point number
  783.     # rx names can only use alphanumeric characters and can't use uppercase
  784.     # letters
  785.     # battler is the battler calling the rx
  786.     # The base atb rate can be referenced by base[:val]
  787.     # The number of battlers counted for method sums can be referenced by
  788.     # base[:size]
  789.     # The method sum of all battlers counted can be referneced by
  790.     # base[:sum][method_name]
  791.     # method_name must be included in :ecatb_battlers_def_sum
  792.     # The below rx are examples to help you set your rx
  793.     # You can freely use, rewrite and/or delete these examples
  794.  
  795.     # Mutliplies the atb fill rate by the battler's agi / all battlers'
  796.     # average agi
  797.     # all battlers is the value of :def_sum_battlers
  798.     def self.r1(battler, base)
  799.       base[:val] * battler.agi * base[:size] / base[:sum][:agi]
  800.     end
  801.  
  802.     # Sets the atb fill rate as x% per frame
  803.     def self.r2(battler, base)
  804.       x
  805.     end
  806.  
  807.     # Sets the atb fill rate as the value of variable with id x * 100% per frame
  808.     def self.r3(battler, base)
  809.       $game_variables[x]
  810.     end
  811.  
  812.     # Adds new rx here
  813.    
  814.  
  815.     #--------------------------------------------------------------------------|
  816.     #  Start Value Notetag Values                                              |
  817.     #  - Setups svx used by <ecatb start val: start, svx> notetags             |
  818.     #--------------------------------------------------------------------------|
  819.     # svx are read at:
  820.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  821.     #    - next @ecatb_notes[("start_" + $1).to_sym] << $2.downcase.to_sym in
  822.     #      load_ecatb_notes
  823.     # svx are used at:
  824.     # 1. Game_BattlerBase
  825.     #    - ecatb.send(note, self) in set_ecatb_start_val
  826.     # svx are strings of names of methods under DoubleX_RMVXA::ECATB
  827.     # svx must return a non-negative real number and should return a
  828.     # non-negative floating-point number
  829.     # svx names can only use alphanumeric characters and can't use uppercase
  830.     # letters
  831.     # battler is the battler calling the svx
  832.     # The below svx are examples added to help you set your svx
  833.     # You can freely use, rewrite and/or delete these examples
  834.  
  835.     # Sets the starting atb value as x%
  836.     def self.sv1(battler)
  837.       battler.ecatb_val[:atb] = x
  838.     end
  839.  
  840.     # Sets the atb value as that of variable with id x * 100%
  841.     def self.sv2(battler)
  842.       battler.ecatb_val[:atb] = $game_variables[x]
  843.     end
  844.  
  845.     # Adds the atb starting value by x%
  846.     def self.sv3(battler)
  847.       battler.ecatb_val[:atb] += x
  848.     end
  849.  
  850.     # Adds new svx here
  851.    
  852.  
  853.     #--------------------------------------------------------------------------|
  854.     #  Action Cost Notetag Values                                              |
  855.     #  - Setups acx used by <ecatb act cost: acx> notetags                     |
  856.     #--------------------------------------------------------------------------|
  857.     # acx are read at:
  858.     # 1. RPG::UsableItem
  859.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  860.     # acx are used at:
  861.     # 1. Game_BattlerBase
  862.     #    - return false if @ecatb_val[:charge] <= 0.0 && @ecatb_act_times <
  863.     #      ecatb.send(item.ecatb_act_cost, self) in usable?
  864.     # 2. Game_Battler
  865.     #    - cost = DoubleX_RMVXA::ECATB.send(item.ecatb_act_cost, self) in
  866.     #      pay_ecatb_act_cost
  867.     #    - cost = (ecatb = DoubleX_RMVXA::ECATB).send(item.ecatb_act_cost, self)
  868.     #      in ecatb_unison_actor?
  869.     # 3. Window_ItemList
  870.     #    - return battler.usable?(item) if (ecatb = DoubleX_RMVXA::ECATB).send(
  871.     #      item.ecatb_act_cost, battler) > 1 || ecatb.send(
  872.     #      item.ecatb_unison_actor, battler).size > 1 in enable?
  873.     # acx are strings of names of methods under DoubleX_RMVXA::ECATB
  874.     # acx must return a real number and should return a non-random integer
  875.     # acx names can only use alphanumeric characters and can't use uppercase
  876.     # letters
  877.     # battler is the battler calling the acx
  878.     # The below acx are examples added to help you set your acx
  879.     # You can freely use, rewrite and/or delete these examples
  880.  
  881.     # Sets the action cost as x
  882.     def self.ac1(battler)
  883.       x
  884.     end
  885.  
  886.     # Sets the action cost as the value of variable with id x
  887.     def self.ac2(battler)
  888.       $game_variables[x]
  889.     end
  890.  
  891.     # Adds new acx here
  892.    
  893.  
  894.     # Sets the number of action points needed to execute actions
  895.     # It'll be used only if no acx are used
  896.     # It must return a real number and should return a non-random integer
  897.     # battler is the battler calling ecatb_act_cost
  898.     # Example: To set the number of action points needed to execute actions as
  899.     #          the value of variable with id x, set this as
  900.     #          %Q($game_variables[x])
  901.     def self.ecatb_act_cost(battler)
  902.       1
  903.     end
  904.  
  905.     #--------------------------------------------------------------------------|
  906.     #  Force Action Cost Notetags Values                                       |
  907.     #  - Setups facx used by <ecatb force act cost: facx> notetags             |
  908.     #--------------------------------------------------------------------------|
  909.     # facx are read at:
  910.     # 1. RPG::UsableItem
  911.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  912.     # facx are used at:
  913.     # 1. Game_BattlerBase
  914.     #    - if (force_act_cost = ecatb.send(item.ecatb_force_act_cost, self)) ||
  915.     #      !forced in exec_ecatb_act_cost
  916.     # facx are strings of names of methods under DoubleX_RMVXA::ECATB
  917.     # facx names can only use alphanumeric characters and can't use uppercase
  918.     # letters
  919.     # battler is the battler calling the facx
  920.     # The below facx are examples added to help you set your facx
  921.     # You can freely use, rewrite and/or delete these examples
  922.  
  923.     # Sets the force action cost as true
  924.     def self.fac1(battler)
  925.       true
  926.     end
  927.  
  928.     # Sets the force action cost as false
  929.     def self.fac2(battler)
  930.       false
  931.     end
  932.  
  933.     # Sets the force action cost as the state of switch with id x
  934.     def self.fac3(battler)
  935.       $game_switches[x]
  936.     end
  937.  
  938.     # Adds new facx here
  939.    
  940.  
  941.     # Sets if force actions cost action points
  942.     # It'll be used only if no facx are used
  943.     # battler is the battler calling ecatb_force_act_cost
  944.     # Example: To set force actions to cost action points if switch with id x is
  945.     #          on, set this as %Q($game_switches[x])
  946.     def self.ecatb_force_act_cost(battler)
  947.       false
  948.     end
  949.  
  950.     #--------------------------------------------------------------------------|
  951.     #  Reset Value Notetags Values                                             |
  952.     #  - Setups rvx used by <ecatb reset val: rvx> notetags                    |
  953.     #--------------------------------------------------------------------------|
  954.     # rvx are read at:
  955.     # 1. RPG::UsableItem
  956.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  957.     # rvx are used at:
  958.     # 1. Game_BattlerBase
  959.     #    - @ecatb_reset_val = (ecatb = DoubleX_RMVXA::ECATB).send(val, self) in
  960.     #      set_ecatb_reset_val
  961.     # rvx are strings of names of methods under DoubleX_RMVXA::ECATB
  962.     # rvx must return a real number and should return a floating-point number
  963.     # rvx names can only use alphanumeric characters and can't use uppercase
  964.     # letters
  965.     # battler is the battler calling the rvx
  966.     # The below rvx are examples added to help you set your rvx
  967.     # You can freely use, rewrite and/or delete these examples
  968.  
  969.     # Sets the atb reset value as x%
  970.     def self.rv1(battler)
  971.       x
  972.     end
  973.  
  974.     # Sets the atb reset value as the value of variable with id x * 100%
  975.     def self.rv2(battler)
  976.       $game_variables[x]
  977.     end
  978.  
  979.     # Adds the atb reset value by x%
  980.     def self.rv3(battler)
  981.       battler.ecatb_reset_val + x
  982.     end
  983.  
  984.     # Adds new rvx here
  985.    
  986.  
  987.     # Sets the atb reset value after using a skill/item
  988.     # It'll be used only if no rvx are used
  989.     # It must return a real number and should return a floating-point number
  990.     # battler is the battler calling ecatb_reset_val
  991.     # Example: To set the atb reset value as x%, set this as %Q(x)
  992.     def self.ecatb_reset_val(battler)
  993.       battler.set_gradual_ecatb_act_gain ? battler.ecatb_val[:atb] : 0.0
  994.     end
  995.  
  996.     #--------------------------------------------------------------------------|
  997.     #  Escape Initialization Condition Configurations                          |
  998.     #  - Setups EICX used by :ecatb_esc_init_cond                              |
  999.     #--------------------------------------------------------------------------|
  1000.     # EICX are used at:
  1001.     # 1. BattleManager
  1002.     #    - init_ecatb_escape if @ecatb_can_esc && ecatb_esc_init_cond in
  1003.     #      process_escape
  1004.     # EICX are strings of RGSS3 codes
  1005.     # EICX names can only use alphanumeric characters
  1006.     # The below EICX are examples added to help you set your EICX
  1007.     # You can freely use, rewrite and/or delete these examples
  1008.  
  1009.     # Checks if the member can pay the escape action cost
  1010.     EIC1 = -> mem { mem.ecatb_act_times >= mem.ecatb_esc_act_cost }
  1011.  
  1012.     # Adds new EICX here
  1013.    
  1014.  
  1015.     #--------------------------------------------------------------------------|
  1016.     #  Escape Charge Condition Configurations                                  |
  1017.     #  - Setups ECCX used by :ecatb_esc_charge_cond                            |
  1018.     #--------------------------------------------------------------------------|
  1019.     # ECCX are used at:
  1020.     # 1. BattleManager
  1021.     #    - return pay_ecatb_esc_cost unless ecatb_esc_charge_cond in
  1022.     #      ecatb_update
  1023.     # ECCX are strings of RGSS3 codes
  1024.     # ECCX names can only use alphanumeric characters
  1025.     # The below ECCX are examples added to help you set your ECCX
  1026.     # You can freely use, rewrite and/or delete these examples
  1027.  
  1028.     # Checks if the member is charging the party escape
  1029.     ECC1 = -> mem { mem.ecatb_esc }
  1030.  
  1031.     # Adds new ECCX here
  1032.    
  1033.  
  1034.     #--------------------------------------------------------------------------|
  1035.     #  Escape Execution Condition Configurations                               |
  1036.     #  - Setups EECX used by :ecatb_esc_exec_cond                              |
  1037.     #--------------------------------------------------------------------------|
  1038.     # EECX are used at:
  1039.     # 1. BattleManager
  1040.     #    - ecatb_esc_suc if ecatb_esc_exec_cond in ecatb_update
  1041.     # EECX are strings of RGSS3 codes
  1042.     # EECX names can only use alphanumeric characters
  1043.     # The below EECX are examples added to help you set your EECX
  1044.     # You can freely use, rewrite and/or delete these examples
  1045.  
  1046.     # Checks if the member has fully charged a skill/item
  1047.     EEC1 = -> mem { mem.ecatb_val[:charge] >= 100.0 }
  1048.  
  1049.     # Adds new EECX here
  1050.    
  1051.  
  1052.     #--------------------------------------------------------------------------|
  1053.     #  Wait Condition Configurations                                           |
  1054.     #  - Setups WCX used by :ecatb_wait_cond                                   |
  1055.     #--------------------------------------------------------------------------|
  1056.     # WCX are used at:
  1057.     # 1. Scene_Battle
  1058.     #    - BattleManager.phase && !ecatb_wait_cond in ecatb_update?
  1059.     # WCX are strings of RGSS3 codes
  1060.     # WCX names can only use alphanumeric characters
  1061.     # The below WCX are examples added to help you set your WCX
  1062.     # Your can freely use, rewrite and/or delete these examples
  1063.  
  1064.     # Checks if the atb clock is forced to stop
  1065.     WC1 = %Q(@ecatb_force_clock == :stop)
  1066.  
  1067.     # Checks if the atb clock isn't forced to run
  1068.     WC2 = %Q(@ecatb_force_clock != :run)
  1069.  
  1070.     # Checks if an action's executing
  1071.     WC3 = %Q(!BattleManager.ecatb_can_esc)
  1072.  
  1073.     # Checks if the cancel window's active
  1074.     WC4 = %Q(@ecatb_cancel_window && @ecatb_cancel_window.active)
  1075.  
  1076.     # Checks if the party command window's active
  1077.     WC5 = %Q(@party_command_window.active)
  1078.  
  1079.     # Checks if the actor target window's active
  1080.     WC6 = %Q(@actor_window.active)
  1081.  
  1082.     # Checks if the enemy target window's active
  1083.     WC7 = %Q(@enemy_window.active)
  1084.  
  1085.     # Checks if the skill window's active
  1086.     WC8 = %Q(@skill_window.active)
  1087.  
  1088.     # Checks if the item window's active
  1089.     WC9 = %Q(@item_window.active)
  1090.  
  1091.     # Checks if the actor command window's active
  1092.     WC10 = %Q(@actor_command_window.active)
  1093.  
  1094.     # Checks if the combat log window's visible
  1095.     WCC1 = %Q(update_msg_open_ecatb_compatibility?)
  1096.  
  1097.     # Adds new WCX here
  1098.    
  1099.  
  1100.     #--------------------------------------------------------------------------|
  1101.     #  Core Configurations                                                     |
  1102.     #  - Setups the configurations of the core features                        |
  1103.     #  - The value of each configuration is the string of the content of its   |
  1104.     #    corresponding method                                                  |
  1105.     #--------------------------------------------------------------------------|
  1106.  
  1107.     CORE = {
  1108.  
  1109.       # Sets the conditions for initializing party escape
  1110.       # A party escape is first initialized, then charged, and finally executed
  1111.       # An executed party escape can either success or fail
  1112.       # Its corresponding method's created under BattleManager
  1113.       # Party Escape can't be initialized nor executed while executing an action
  1114.       # Example: To demand at least 1 inputable party member that can pay the
  1115.       #          party escape cost, set this as
  1116.       #          %Q(ecatb_input_list.any?(&DoubleX_RMVXA::ECATB::EIC1))
  1117.       :ecatb_esc_init_cond => %Q((list = ecatb_input_list).size >= $game_party.
  1118.                  battle_members.size && list.all?(&DoubleX_RMVXA::ECATB::EIC1)),
  1119.  
  1120.       # Sets the conditions for continuing to charge the party escape
  1121.       # A party escape is first initialized, then charged, and finally executed
  1122.       # An executed party escape can either success or fail
  1123.       # Its corresponding method's created under BattleManager
  1124.       # Example: To demand a key with mapping :KEY to be pressed and at least 1
  1125.       #          party member to continue charging the party escape, set this as
  1126.       #          %Q(Input.press?(:KEY) &&
  1127.       #             $game_party.members.any?(&DoubleX_RMVXA::ECATB::ECC1))
  1128.       :ecatb_esc_charge_cond => %Q($game_party.battle_members.all?(
  1129.                                    &DoubleX_RMVXA::ECATB::ECC1)),
  1130.  
  1131.       # Sets the conditions for executing party escape
  1132.       # A party escape is first initialized, then charged, and finally executed
  1133.       # An executed party escape can either success or fail
  1134.       # Its corresponding method's created under BattleManager
  1135.       # Example: To demand at least 1 party member to finish charging the party
  1136.       #          escape before executing it, set this as
  1137.       #          %Q($game_party.members.any?(&DoubleX_RMVXA::ECATB::EEC1))
  1138.       :ecatb_esc_exec_cond => %Q($game_party.alive_members.all?(
  1139.                                  &DoubleX_RMVXA::ECATB::EEC1)),
  1140.  
  1141.       # Sets the conditions for successful party escape
  1142.       # A party escape is first initialized, then charged, and finally executed
  1143.       # An executed party escape can either success or fail
  1144.       # Its corresponding method's created under BattleManager
  1145.       # Example: To check the preemptive status or use escape ratio as the
  1146.       #          success probability and have at least 1 party member being able
  1147.       #          to pay the party escape cost, set this as
  1148.       #          %Q((@preemptive || rand < @escape_ratio) &&
  1149.       #             $game_party.alive_members.any?(&DoubleX_RMVXA::ECATB::EIC1))
  1150.       :ecatb_esc_suc_cond => %Q((@preemptive || rand < @escape_ratio) &&
  1151.                    $game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EIC1)),
  1152.  
  1153.       # Sets the atb clock wait condition
  1154.       # Its corresponding method's created under Scene_Battle
  1155.       # The atb clock will always wait if the game message is visible
  1156.       # Only 1 action can be executed at a time
  1157.       # Example: To run the atb clock if switch with id x is on, set this as
  1158.       #          %Q($game_switches[x])
  1159.       :ecatb_wait_cond => %Q(#{WC1} || #{WC2} && (#{WC3} || #{WC4} || #{WC5} ||
  1160.                              #{WC6} || #{WC7} || #{WC8} || #{WC9} || #{WC10} ||
  1161.                              #{WCC1})),
  1162.  
  1163.       # Sets the base atb fill time in seconds
  1164.       # Its corresponding method's created under BattleManager
  1165.       # It must return a positive real number
  1166.       # Example: To set the base atb fill time as 1 frame, set this as
  1167.       #          %Q(1 / Graphics.frame_rate)
  1168.       :ecatb_base_fill_t => %Q(10),
  1169.  
  1170.       # Sets the turn type
  1171.       # Its corresponding method's created under Scene_Battle
  1172.       # It must return either :tick, :battler or :act
  1173.       # :tick means turn length's controlled by the number of ticks
  1174.       # :battler means turn length is controlled by the number of battlers
  1175.       # :act means turn length's controlled by the number of actions executed
  1176.       # Example: To set the atb turn type as :act, set this as %Q(:act)
  1177.       :ecatb_turn_type => %Q(:tick),
  1178.  
  1179.       # Needs :ecatb_turn to be :tick to be used
  1180.       # Sets the turn length in seconds
  1181.       # Its corresponding method's created under Scene_Battle
  1182.       # It must return a positive real number
  1183.       # Example: To set the turn length as the base atb fill time, set this as
  1184.       #          %Q(BattleManager.ecatb_base_fill_t)
  1185.       :ecatb_tick_count => %Q(10),
  1186.  
  1187.       # Needs :ecatb_turn to be :act to be used
  1188.       # Sets the turn length in the number of actions counted
  1189.       # Its corresponding method's created under Scene_Battle
  1190.       # It must return a positive real number and should return a natural number
  1191.       # Example: To set the turn length as x actions, set this as %Q(x)
  1192.       :ecatb_after_act => %Q(10),
  1193.  
  1194.       # Needs :ecatb_turn to be :battler to be used
  1195.       # Sets the number of units per battler counted added to the turn length
  1196.       # The unit can either be :tick or :act
  1197.       # :tick means the unit is second
  1198.       # :act means the unit is the number of actions
  1199.       # Its corresponding method's created under Scene_Battle
  1200.       # It must return an array
  1201.       # Its 1st element must return a positive real number and should return a
  1202.       # natural number
  1203.       # Its 2nd element must return either :tick or :act
  1204.       # Example: To set the battler scale as x actions, set this as
  1205.       #          %Q([x, :act])
  1206.       :ecatb_battler_scale => %Q([1, :tick]),
  1207.  
  1208.       # Needs :ecatb_turn to be :battler to be used
  1209.       # Sets the battlers to be counted in the battler scale
  1210.       # Its corresponding method's created under Scene_Battle
  1211.       # It must return a positive real number and should return the size of
  1212.       # an array of battlers
  1213.       # Example: To include all battlers, set this as
  1214.       #          Q($game_party.members.size + $game_troop.members.size)
  1215.       :ecatb_battler_count => %Q($game_party.alive_members.size +
  1216.                                  $game_troop.alive_members.size),
  1217.  
  1218.       # Needs :ecatb_turn to be :act or :battler to be used
  1219.       # Sets if force actions are counted as well
  1220.       # Its corresponding method's created under Scene_Battle
  1221.       # Example: To count the force actions as well if switch with id x is on,
  1222.       #          set this as %Q($game_switches[x])
  1223.       :ecatb_force_act_count => %Q(false),
  1224.  
  1225.       # (v0.04a+)Sets if battles will behave like a CTB by skipping the atb,
  1226.       # charge and cooldown filling times, and the global atb tick clock
  1227.       # Its corresponding method's created under BattleManager
  1228.       # Example: To replicate a CTB system if switch with id x is on, set this
  1229.       #          as %Q($game_switches[x])
  1230.       :ecatb_ctb => %Q(false),
  1231.  
  1232.       # Sets the priority of the ecatb rate notetags to be used
  1233.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1234.       # It must return an array with elements being either :states, :enemies,
  1235.       # :armors, :weapons, :classes or :actors
  1236.       # Example: To set actors to have a higher priority than that of states,
  1237.       #          set this as %Q([:actors, :states])
  1238.       :ecatb_rate_ord => %Q([:actors, :classes, :weapons, :armors, :enemies,
  1239.                              :states]),
  1240.  
  1241.       # Sets the 1st atb value of actors when battles start normally
  1242.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1243.       # It must return a non-negative real number and should return a
  1244.       # non-negative floating-point number
  1245.       # Example: To set the 1st atb value of actors when battler start normally
  1246.       #          as x%, set this as %Q(@ecatb_val[:atb] = x)
  1247.       :normal_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1248.  
  1249.       # Sets the 1st atb value of enemies when battles start normally
  1250.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1251.       # It must return a non-negative real number and should return a
  1252.       # non-negative floating-point number
  1253.       # Example: To set the 1st atb value of enemies when battler start normally
  1254.       #          as x%, set this as %Q(@ecatb_val[:atb] = x)
  1255.       :normal_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1256.  
  1257.       # Sets the 1st atb value of actors when battles start with preemptive
  1258.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1259.       # It must return a non-negative real number and should return a
  1260.       # non-negative floating-point number
  1261.       # Example: To set the 1st atb value of actors when battler start with
  1262.       #          preemptive as x%, set this as %Q(@ecatb_val[:atb] = x)
  1263.       :preemptive_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 100.0),
  1264.  
  1265.       # Sets the 1st atb value of enemies when battles start with preemptive
  1266.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1267.       # It must return a non-negative real number and should return a
  1268.       # non-negative floating-point number
  1269.       # Example: To set the 1st atb value of enemies when battler start with
  1270.       #          preemptive as x%, set this as %Q(@ecatb_val[:atb] = x)
  1271.       :preemptive_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1272.  
  1273.       # Sets the 1st atb value of actors when battles start with surprise
  1274.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1275.       # It must return a non-negative real number and should return a
  1276.       # non-negative floating-point number
  1277.       # Example: To set the 1st atb value of actors when battler start with
  1278.       #          surprise as x%, set this as %Q(@ecatb_val[:atb] = x)
  1279.       :surprise_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1280.  
  1281.       # Sets the 1st atb value of enemies when battles start with surprise
  1282.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1283.       # It must return a non-negative real number and should return a
  1284.       # non-negative floating-point number
  1285.       # Example: To set the 1st atb value of enemies when battler start with
  1286.       #          surprise as x%, set this as %Q(@ecatb_val[:atb] = x)
  1287.       :surprise_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 100.0),
  1288.  
  1289.       # Sets the priority of the ecatb start value notetags to be used
  1290.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1291.       # It must return an array with elements being either :states, :enemies,
  1292.       # :armors, :weapons, :classes or :actors
  1293.       # Example: To set actors to have a higher priority than that of states,
  1294.       #          set this as %Q([:actors, :states])
  1295.       :ecatb_start_val_ord => %Q([:actors, :classes, :weapons, :armors,
  1296.                                   :enemies, :states]),
  1297.  
  1298.       # Sets the battler methods included to calculate the sum of each of those
  1299.       # methods of battlers in :ecatb_def_sum_battlers
  1300.       # Its corresponding method's created under BattleManager
  1301.       # It must return an array of symbols being defined battler methods
  1302.       # Example: To calculate the sum of luk of all battlers in
  1303.       #          :ecatb_def_sum_battlers, set this as %Q([:luk])
  1304.       :ecatb_battlers_def_sum => %Q([:agi]),
  1305.  
  1306.       # Sets the battlers to be included to calculate each of their method sums
  1307.       # Its corresponding method's created under BattleManager
  1308.       # It must return an array of battlers
  1309.       # Example: To set all battlers to be included to calculate each of their
  1310.       #          method sums, set this as
  1311.       #          %Q($game_party.battle_members + $game_troop.members)
  1312.       :ecatb_def_sum_battlers => %Q($game_party.alive_members +
  1313.                                     $game_troop.alive_members),
  1314.  
  1315.       # Sets if the sum of each battler method in :ecatb_battlers_def_sum of all
  1316.       # battlers in :ecatb_def_sum_battlers will be updated
  1317.       # Its corresponding method's created under BattleManager
  1318.       # Example: To update the sum of each battler method in
  1319.       #          :ecatb_battlers_def_sum of all battlers in
  1320.       #          :ecatb_def_sum_battlers if switch with id x is on, set this as
  1321.       #          %Q($game_switches[x])
  1322.       :update_ecatb_battlers_def_sums => %Q(ecatb_def_sum_battlers.any?(
  1323.                                             &DoubleX_RMVXA::ECATB::BLOCKS[
  1324.                                             :ecatb_refresh])),
  1325.  
  1326.       # Sets the action points reduced for all party members upon failed escapes
  1327.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1328.       # It must return a real number and should return an integer
  1329.       # Example: To set the escape action cost as x, set this as %Q(x)
  1330.       :ecatb_esc_act_cost => %Q(1),
  1331.  
  1332.       # Sets the atb reset value upon each failed escape
  1333.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1334.       # It must return a real number and should return a floating-point number
  1335.       # Example: To add the atb reset value upon a failed escape by x%, set this
  1336.       #          as %Q(@ecatb_reset_val + x)
  1337.       :ecatb_esc_reset_val => %Q(0.0),
  1338.  
  1339.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1340.       # Sets the text to be displayed on actor atb bars showing its details
  1341.       # The atb bar fill rate and action points can be referneced by percent and
  1342.       # action respectively
  1343.       # Its corresponding method's created under Window_BattleStatus
  1344.       # It must return a string
  1345.       # Example: To set the text to be displayed on actor atb bars showing the
  1346.       #          actors' action points, set this as %Q(act)
  1347.       :actor_ecatb_bar_text => %Q(percent + "% " + act),
  1348.  
  1349.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1350.       # Sets the word describing and displayed on actor atb bars
  1351.       # Its corresponding method's created under Window_BattleStatus
  1352.       # It must return a string
  1353.       # Example: To use the word "ATB" to describe and be displayed on actor atb
  1354.       #          bars, set this as %Q("ATB")
  1355.       :actor_ecatb_bar_word => %Q("AP"),
  1356.  
  1357.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1358.       # Sets the actor atb bar y offset
  1359.       # Its corresponding method's created under Window_BattleStatus
  1360.       # It must return a real number and should return an integer
  1361.       # Example: To set the actor atb bar y offset as x, set this as %Q(x)
  1362.       :actor_ecatb_bar_y_add => %Q(12),
  1363.  
  1364.       # Sets the atb bar colors
  1365.       # It'll be used only if no corresponding color notetags are used
  1366.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1367.       # It must return an array of colors
  1368.       # Example: To set the atb bar colors as text color c and r, g, b, a rgba
  1369.       #          values, set this as
  1370.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1371.       :ecatb_bar_colors => %Q([Colour.text_colour(7), Colour.text_colour(8)]),
  1372.  
  1373.       # Sets the priority of the ecatb bar color notetags to be used
  1374.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1375.       # It must return an array with elements being either :states, :enemies,
  1376.       # :armors, :weapons, :classes or :actors
  1377.       # Example: To set states to have a higher priority than that of actors,
  1378.       #          set this as %Q([:states, :actors])
  1379.       :ecatb_bar_color_ord => %Q([:states, :enemies, :armors, :weapons,
  1380.                                   :classes, :actors]),
  1381.  
  1382.       # (v0.03a+)Sets something to happen right before inputting actions by a
  1383.       # battler
  1384.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1385.       # Example: To call a common event with id x right before inputting actions
  1386.       #          by a battler, set this as
  1387.       #          %Q($game_temp.reserve_common_event(x))
  1388.       :pre_ecatb_input_act => %Q(),
  1389.  
  1390.       # (v0.03a+)Sets something to happen right after inputting actions by a
  1391.       # battler
  1392.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1393.       # Example: To call a common event with id x right after inputting actions
  1394.       #          by a battler, set this as
  1395.       #          %Q($game_temp.reserve_common_event(x))
  1396.       :post_ecatb_input_act => %Q(),
  1397.  
  1398.       # (v0.03a+)Sets something to happen right before resetting a battler's
  1399.       # atb
  1400.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1401.       # Example: To call a common event with id x right before resetting a
  1402.       #          battler's atb, set this as
  1403.       #          %Q($game_temp.reserve_common_event(x))
  1404.       :pre_ecatb_reset => %Q(),
  1405.  
  1406.       # (v0.03a+)Sets something to happen right after resetting a battler's
  1407.       # atb
  1408.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1409.       # Example: To call a common event with id x right after resetting a
  1410.       #          battler's atb, set this as
  1411.       #          %Q($game_temp.reserve_common_event(x))
  1412.       :post_ecatb_reset => %Q(),
  1413.  
  1414.       # Sets something to happen right before updating the atb clock
  1415.       # Its corresponding method's created under Scene_Battle
  1416.       # Example: To support changing atb, charge and cooldown bar colors of all
  1417.       #          battlers per frame, set this as
  1418.       #          %Q(all_battle_members.each { |mem|
  1419.       #               mem.ecatb_note_change[:atb] =
  1420.       #               mem.ecatb_note_change[:charge] =
  1421.       #               mem.ecatb_note_change[:cooldown] = true
  1422.       #             })
  1423.       :pre_ecatb_update => %Q(),
  1424.  
  1425.       # Sets something to happen right after updating the atb clock
  1426.       # Its corresponding method's created under Scene_Battle
  1427.       # Example: To call a common event with id x right after updating the atb
  1428.       #          clock, set this as %Q($game_temp.reserve_common_event(x))
  1429.       :post_ecatb_update => %Q()
  1430.  
  1431.     }
  1432.  
  1433.   #----------------------------------------------------------------------------|
  1434.   #  * (v0.05a+)Action                                                         |
  1435.   #    Setups configurations of the action features                            |
  1436.   #----------------------------------------------------------------------------|
  1437.  
  1438.     #--------------------------------------------------------------------------|
  1439.     #  Gradual Action Gain Notetag Values                                      |
  1440.     #  - Setups gagx used by <ecatb gradual action gain: gagx> notetags        |
  1441.     #--------------------------------------------------------------------------|
  1442.     # gagx are read at:
  1443.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  1444.     #    - next @ecatb_notes[:act] = $1.downcase.to_sym in load_ecatb_notes
  1445.     # gagx are used at:
  1446.     # 1. Game_BattlerBase
  1447.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  1448.     # gagx are strings of names of methods under DoubleX_RMVXA::ECATB
  1449.     # gagx names can only use alphanumeric characters and can't use uppercase
  1450.     # letters
  1451.     # battler is the battler calling the gagx
  1452.     # The below gagx are examples added to help you set your gagx
  1453.     # You can freely use, rewrite and/or delete these examples
  1454.  
  1455.     # Sets gradual action gain as true
  1456.     def self.gag1(battler)
  1457.       true
  1458.     end
  1459.  
  1460.     # Sets gradual action gain as false
  1461.     def self.gag2(battler)
  1462.       false
  1463.     end
  1464.  
  1465.     # Sets gradual action gain as the state of switch with id x
  1466.     def self.gag3(battler)
  1467.       $game_switches[x]
  1468.     end
  1469.  
  1470.     # Adds new gagx here
  1471.    
  1472.  
  1473.     #--------------------------------------------------------------------------|
  1474.     #  Action Configurations                                                   |
  1475.     #  - Setups configurations of the action features                          |
  1476.     #  - The value of each configuration is the string of the content of its   |
  1477.     #    corresponding method                                                  |
  1478.     #--------------------------------------------------------------------------|
  1479.  
  1480.     ACTION = {
  1481.  
  1482.       # Sets whether a battler gains action points gradually instead of gaining
  1483.       # its maximum instantly
  1484.       # It'll be used only if no corresponding color notetags are used
  1485.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1486.       # Example: To set a battler to gain the maximum action points instantly if
  1487.       #          switch with id x is on, set this as %Q($game_switches[x])
  1488.       :gradual_ecatb_action_gain => %Q(true),
  1489.  
  1490.       # Sets the priority of the ecatb gradual action gain notetags to be used
  1491.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1492.       # It must return an array with elements being either :states, :enemies,
  1493.       # :armors, :weapons, :classes or :actors
  1494.       # Example: To set states to have a higher priority than that of actors,
  1495.       #          set this as %Q([:states, :actors])
  1496.       :gradual_ecatb_action_gain_ord => %Q([:states, :enemies, :armors,
  1497.                                             :weapons, :classes, :actors])
  1498.  
  1499.     }
  1500.  
  1501.   #----------------------------------------------------------------------------|
  1502.   #  * Bar                                                                     |
  1503.   #    Setups configurations and default notetag values of the bar features    |
  1504.   #----------------------------------------------------------------------------|
  1505.  
  1506.     #--------------------------------------------------------------------------|
  1507.     #  Bar Configurations                                                      |
  1508.     #  - Setups configurations and default notetag values of the bar features  |
  1509.     #  - The value of each configuration is the string of the content of its   |
  1510.     #    corresponding method                                                  |
  1511.     #--------------------------------------------------------------------------|
  1512.  
  1513.     # Sets if only enemies being dead before are shown with the atb bar
  1514.     # It'll only be used if it's not set by
  1515.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1516.     # It must be either true or false
  1517.     # Example: To sets only enemies being dead before to be shown with the atb
  1518.     # bar, set this as %Q(true)
  1519.     BAR_KILL_ENEMY_1ST = %Q(false)
  1520.  
  1521.     # Sets if enemy atb bars are shown
  1522.     # It'll only be used if it's not set by
  1523.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1524.     # It must be either true or false
  1525.     # Example: To hide enemy atb bars, set this as %Q(false)
  1526.     ENEMY_BAR_SHOW = %Q(true)
  1527.  
  1528.     # Sets if enemy action point is shown on enemy atb bars
  1529.     # It'll only be used if it's not set by
  1530.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1531.     # It must be either true or false
  1532.     # Example: To hide the enemy action points from the enemy atb bar, set this
  1533.     # as %Q(false)
  1534.     ENEMY_BAR_SHOW_ACT = %Q(true)
  1535.  
  1536.     # Sets if atb fill percent is shown on enemy atb bars
  1537.     # It'll only be used if it's not set by
  1538.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1539.     # It must be either true or false
  1540.     # Example: To hide the enemy atb fill percent from the enemy atb bar, set
  1541.     # this as %Q(false)
  1542.     ENEMY_BAR_SHOW_PERCENT = %Q(true)
  1543.  
  1544.     BAR = {
  1545.  
  1546.       # Sets if the actor atb bars are displayed on their sprites instead
  1547.       # Its corresponding method's created under BattleManager
  1548.       # It must always return the same result during the same battle
  1549.       # Example: To display the actor atb bars on their sprites as well if
  1550.       #          switch with id x is on, set this as %Q($game_switches[x])
  1551.       :actor_sprite_ecatb_bar => %Q(false),
  1552.  
  1553.       # (v0.04d+)Sets if the atb and charge/cooldown bars are displayed
  1554.       # simultaneously
  1555.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1556.       # It must return the same value during the same battle
  1557.       # Example: To stop displaying atb and charge/cooldown bars simultaneously,
  1558.       #          set this as %Q(false)
  1559.       :ecatb_bar_multilayer => %Q(true),
  1560.  
  1561.       # Sets if battler sprite atb bars are animated
  1562.       # Its corresponding method's created under ECATB_Bar
  1563.       # Example: To animate the battler sprite atb bars if switch with id x is
  1564.       #          on, set this as %Q($game_switches[x])
  1565.       :ecatb_bar_ani => %Q(true),
  1566.  
  1567.       # Sets the battler sprite atb bar to animate horizontally per frame
  1568.       # Its corresponding method's created under ECATB_Bar
  1569.       # It must return a real number and should return an integer
  1570.       # Example: To set the battler sprite atb bar to animate horizontally by
  1571.       #          number of pixels being the value of variable with id x per
  1572.       #          frame, set this as %Q($game_variables[x])
  1573.       :ecatb_bar_ani_ox => %Q(2),
  1574.  
  1575.       # Sets the battler sprite atb bar width and height
  1576.       # Its corresponding method's created under ECATB_Bar
  1577.       # It must return an array of positive real numbers and should return an
  1578.       # array of natural numbers
  1579.       # Example: To set the battler sprite atb bar width and height to be the
  1580.       #          values of variables with id x and y respectively, set this as
  1581.       #          %Q([$game_variables[x], $game_variables[y]])
  1582.       :ecatb_bar_wh => %Q([48, 12]),
  1583.  
  1584.       # Sets the battler sprite atb bar xy offsets from the host battler sprite
  1585.       # Its corresponding method's created under ECATB_Bar
  1586.       # It must return an array of real numbers and should return an array of
  1587.       # integers
  1588.       # Example: To set the battler sprite atb bar x and y offsets as the value
  1589.       #          of variables with id a and b respectively, set this as
  1590.       #          %Q([$game_variables[a], $game_variables[b]])
  1591.       :ecatb_bar_xy_offset => %Q([0, 0]),
  1592.  
  1593.       # Sets the battler sprite atb bar z position
  1594.       # Its corresponding method's created under ECATB_Bar
  1595.       # It must return a non-negative real number and should return a
  1596.       # non-negative integer
  1597.       # Example: To set the battler sprite atb bar z position as the value of
  1598.       #          variable with id x, set this as %Q($game_variables[x])
  1599.       :ecatb_bar_z => %Q(0),
  1600.  
  1601.       # Sets the text to be displayed on battler sprite atb bars showing its
  1602.       # details
  1603.       # The atb bar fill rate and action points can be referneced by percent and
  1604.       # action respectively
  1605.       # Its corresponding method's created under ECATB_Bar
  1606.       # It must return a string
  1607.       # Example: To set the text to be displayed on battler sprite atb bars
  1608.       #          showing the battlers' action points, set this as %Q(act)
  1609.       :ecatb_bar_text => %Q(percent + "% " + act),
  1610.  
  1611.       # Sets the battler sprite atb bar text color
  1612.       # Its corresponding method's created under ECATB_Bar
  1613.       # It must return a color
  1614.       # Example: To set the battler sprite atb bar text color as r, g, b, a rgba
  1615.       #          values, set this as %Q(Color.new(r, g ,b ,a))
  1616.       :ecatb_bar_text_color => %Q(Colour.text_colour(0)),
  1617.  
  1618.       # Sets the battler sprite atb bar text size
  1619.       # Its corresponding method's created under ECATB_Bar
  1620.       # It must return a positive real number and should return an integer
  1621.       # Example: To set the battler sprite atb bar text saize as the value of
  1622.       #          variable with id x, set this as %Q($game_variables[x])
  1623.       :ecatb_bar_text_size => %Q(16),
  1624.  
  1625.       # Sets the battler sprite atb bar text x and y offsets from the atb bars
  1626.       # Its corresponding method's created under ECATB_Bar
  1627.       # It must return an array of real numbers and should return an array of
  1628.       # integers
  1629.       # Example: To set the battler sprite atb bar text x and y offsets from the
  1630.       #          atb bars as the values of variables with id a and b
  1631.       #          respectively, set this as
  1632.       #          %Q([$game_variables[a], $game_variables[b]])
  1633.       :ecatb_bar_text_xy_offset => %Q([-1, -1]),
  1634.  
  1635.       # Sets the battler sprite atb bar back colors
  1636.       # Its corresponding method's created under ECATB_Bar
  1637.       # It must return an array of colors
  1638.       # Example: To set the battler sprite atb back bar colors as text color c
  1639.       #          and r, g, b, a rgba values, set this as
  1640.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1641.       :ecatb_bar_back_colors => %Q([Colour.text_colour(15),
  1642.                                     Colour.text_colour(15)])
  1643.  
  1644.     }
  1645.  
  1646.   #----------------------------------------------------------------------------|
  1647.   #  * Cancel                                                                  |
  1648.   #    Setups configurations of the cancel features                            |
  1649.   #----------------------------------------------------------------------------|
  1650.  
  1651.     #--------------------------------------------------------------------------|
  1652.     #  Cancel Configurations                                                   |
  1653.     #  - Setups configurations of the cancel features                          |
  1654.     #  - The value of each configuration is the string of the content of its   |
  1655.     #    corresponding method                                                  |
  1656.     #--------------------------------------------------------------------------|
  1657.  
  1658.     CANCEL = {
  1659.  
  1660.       # Sets the key opening the cancel window
  1661.       # Its corresponding method's created under Scene_Battle
  1662.       # It must return a symbol and should return an Input constant
  1663.       # Example: To set the cancel window opening key as X, set this as %Q(:X)
  1664.       :ecatb_cancel_key => %Q(:SHIFT),
  1665.  
  1666.       # Sets the description text of the cancel window
  1667.       # Its corresponding method's created under Scene_Battle
  1668.       # It must return a string
  1669.       # Example: To set the description text of the cancel window as
  1670.       #          "Actor name", set this as
  1671.       #          %Q($game_party.members[@ecatb_cancel_window.index].name)
  1672.  
  1673.       :ecatb_cancel_text => %Q("Select an actor without autobattle nor " +
  1674.                                "confusion to\ncancel his/her/its partially " +
  1675.                                "charging skill/item.")
  1676.  
  1677.     }
  1678.  
  1679.   #----------------------------------------------------------------------------|
  1680.   #  * Charge                                                                  |
  1681.   #    Setups configurations and notetag values of the charge features         |
  1682.   #----------------------------------------------------------------------------|
  1683.  
  1684.     #--------------------------------------------------------------------------|
  1685.     #  Charge Prior Action Cost Notetag Values                                 |
  1686.     #  - Setups cpacx used by <ecatb charge prior act cost: cpacx> notetags    |
  1687.     #--------------------------------------------------------------------------|
  1688.     # cpacx are read at:
  1689.     # 1. RPG::UsableItem
  1690.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1691.     # cpacx are used at:
  1692.     # 1. Game_Battler
  1693.     #    - unless ecatb.send(@last_ecatb_item.ecatb_charge_prior_act_cost, self)
  1694.     #      in pay_prior_ecatb_charge
  1695.     #    - if ecatb.send(item.ecatb_charge_prior_act_cost, self) in
  1696.     #      exec_ecatb_act_cost
  1697.     #    - !ecatb.send(item.ecatb_charge_prior_act_cost, self) in
  1698.     #      ecatb_unison_actor?
  1699.     # cpacx shouldn't return random values
  1700.     # cpacx are strings of names of methods under DoubleX_RMVXA::ECATB
  1701.     # cpacx names can only use alphanumeric characters and can't use uppercase
  1702.     # letters
  1703.     # battler is the battler calling the cpacx
  1704.     # The below cpacx are examples to help you set your cpacx
  1705.     # You can freely use, rewrite and/or delete these examples
  1706.  
  1707.     # Sets charge prior action cost as true
  1708.     def self.cpac1(battler)
  1709.       true
  1710.     end
  1711.  
  1712.     # Sets charge prior action cost as false
  1713.     def self.cpac2(battler)
  1714.       false
  1715.     end
  1716.  
  1717.     # Sets charge prior action cost as the state of switch with id x
  1718.     def self.cpac3(battler)
  1719.       $game_switches[x]
  1720.     end
  1721.  
  1722.     # Adds new cpacx here
  1723.    
  1724.  
  1725.     # Sets if action cost is paid after finished charging
  1726.     # It'll be used only if no cpacx are used
  1727.     # battler is the battler calling the ecatb_charge_prior_act_cost
  1728.     # Example: To set the default action costs to be paid after charging if
  1729.     #          switch with id x is on, set this as %Q($game_switches[x])
  1730.     def self.ecatb_charge_prior_act_cost(battler)
  1731.       true
  1732.     end
  1733.  
  1734.     #--------------------------------------------------------------------------|
  1735.     #  Charge Prior Item Cost Notetag Values                                   |
  1736.     #  - Setups cpicx used by <ecatb charge prior item cost: cpicx> notetags   |
  1737.     #--------------------------------------------------------------------------|
  1738.     # cpicx are read at:
  1739.     # 1. RPG::UsableItem
  1740.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1741.     # cpicx are used at:
  1742.     # 1. Game_Battler
  1743.     #    - !DoubleX_RMVXA::ECATB.send(skill.ecatb_charge_prior_item_cost, self)
  1744.     #      in skill_cost_payable?
  1745.     #    - unless DoubleX_RMVXA::ECATB.send(item.ecatb_charge_prior_item_cost,
  1746.     #      self)in use_item
  1747.     #    - return if ecatb.send(@last_ecatb_item.ecatb_charge_prior_item_cost,
  1748.     #      self) in pay_prior_ecatb_charge
  1749.     # cpicx shouldn't return random values
  1750.     # cpicx are strings of names of methods under DoubleX_RMVXA::ECATB
  1751.     # cpicx names can only use alphanumeric characters and can't use uppercase
  1752.     # letters
  1753.     # battler is the battler calling the cpicx
  1754.     # The below cpicx are examples to help you set your cpicx
  1755.     # You can freely use, rewrite and/or delete these examples
  1756.  
  1757.     # Sets charge prior item cost as true
  1758.     def self.cpic1(battler)
  1759.       true
  1760.     end
  1761.  
  1762.     # Sets charge prior item cost as false
  1763.     def self.cpic2(battler)
  1764.       false
  1765.     end
  1766.  
  1767.     # Sets charge prior item cost as the state of switch with id x
  1768.     def self.cpic3(battler)
  1769.       $game_switches[x]
  1770.     end
  1771.  
  1772.     # Adds new cpicx here
  1773.    
  1774.  
  1775.     # Sets if item costs are paid after finished charging
  1776.     # It'll be used only if no cpicx are used
  1777.     # battler is the battler calling ecatb_charge_prior_item_cost
  1778.     # Example: To set the default item costs to be paid after charging if switch
  1779.     #          with id x is on, set this as %Q($game_switches[x])
  1780.     def self.ecatb_charge_prior_item_cost(battler)
  1781.       true
  1782.     end
  1783.  
  1784.     #--------------------------------------------------------------------------|
  1785.     #  Charge Rate Notetag Values                                              |
  1786.     #  - Setups crx used by <ecatb charge rate: crx> notetags                  |
  1787.     #--------------------------------------------------------------------------|
  1788.     # crx are read at:
  1789.     # 1. RPG::UsableItem
  1790.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1791.     # crx are used at:
  1792.     # 1. Game_BattlerBase
  1793.     #    - DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_charge_rate, self,
  1794.     #      @last_ecatb_rate[:charge]) in ecatb_charge_gain_rate
  1795.     # crx are strings of names of methods under DoubleX_RMVXA::ECATB
  1796.     # crx must return a real number and should return a floating-point number
  1797.     # crx names can only use alphanumeric characters and can't use uppercase
  1798.     # letters
  1799.     # battler is the battler calling the crx
  1800.     # rate is the atb gain rate of battler
  1801.     # The below crx are examples to help you set your crx
  1802.     # You can freely use, rewrite and/or delete these examples
  1803.  
  1804.     # Sets the charge rate as x% per frame
  1805.     def self.cr1(battler, rate)
  1806.       x
  1807.     end
  1808.  
  1809.     # Sets the charge rate as the value of variable with id x * 100% per frame
  1810.     def self.cr2(battler, rate)
  1811.       $game_variables[x]
  1812.     end
  1813.  
  1814.     # Sets the charge rate as x times the atb gain rate
  1815.     def self.cr3(battler, rate)
  1816.       rate * x
  1817.     end
  1818.  
  1819.     # Adds new crx here
  1820.    
  1821.  
  1822.     # Sets the default charge rate
  1823.     # It'll be used only if no crx are used
  1824.     # battler is the battler calling ecatb_charge_rate
  1825.     # rate is the atb gain rate of battler
  1826.     # Example: To disable charging, set this as %Q(100.0)
  1827.     def self.ecatb_charge_rate(battler, rate)
  1828.       100.0
  1829.     end
  1830.  
  1831.     #--------------------------------------------------------------------------|
  1832.     #  Charge Configurations                                                   |
  1833.     #  - Setups configurations of the charge features                          |
  1834.     #  - The value of each configuration is the string of the content of its   |
  1835.     #    corresponding method                                                  |
  1836.     #--------------------------------------------------------------------------|
  1837.  
  1838.     CHARGE = {
  1839.  
  1840.       # Sets the charge bar colors
  1841.       # It'll be used only if no corresponding color notetags are used
  1842.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1843.       # It must return an array of colors
  1844.       # Example: To set the charge bar colors as text color c and r, g, b, a
  1845.       #          rgba values, set this as
  1846.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1847.       :ecatb_charge_bar_colors => %Q([Colour.text_colour(30),
  1848.                                       Colour.text_colour(31)]),
  1849.  
  1850.       # Sets the priority of the ecatb charge bar color notetags to be used
  1851.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1852.       # It must return an array with elements being either :states, :enemies,
  1853.       # :armors, :weapons, :classes or :actors
  1854.       # Example: To set states to have a higher priority than that of actors,
  1855.       #          set this as %Q([:states, :actors])
  1856.       :ecatb_charge_bar_color_ord => %Q([:states, :enemies, :armors, :weapons,
  1857.                                          :classes, :actors]),
  1858.  
  1859.       # Sets the party escape charge rate
  1860.       # The atb rate can be referneced by charge
  1861.       # Its corresponding method's created under Game_Actor
  1862.       # It must return a real number and should return a floating-point number
  1863.       # Example: To disable party escape charging, set this as %Q(100.0)
  1864.       :esc_ecatb_charge_rate => %Q(100.0)
  1865.  
  1866.     }
  1867.  
  1868.   #----------------------------------------------------------------------------|
  1869.   #  * Clock                                                                   |
  1870.   #    Setups configurations of the clock features                             |
  1871.   #----------------------------------------------------------------------------|
  1872.  
  1873.     #--------------------------------------------------------------------------|
  1874.     #  Clock Configurations                                                    |
  1875.     #--------------------------------------------------------------------------|
  1876.  
  1877.     CLOCK = {
  1878.  
  1879.       # Shows the atb clock window
  1880.       # It's used under Scene_Battle but it doesn't have any associated method
  1881.       # Example: To show the atb clock window if switch with id x is on, set
  1882.       #          this as %Q($game_switches[x])
  1883.       :show_ecatb_clock_window => %Q(true),
  1884.  
  1885.       # Sets the atb clock window width and height
  1886.       # Its corresponding method's created under ECATB_Clock_Window
  1887.       # It must return an array of positive real numbers and should return an
  1888.       # array of natural numbers
  1889.       # Example: To set the atb clock window width and height as the value of
  1890.       #          variables with id x and y respectively, set this as
  1891.       #          %Q([$game_variables[x], $game_variables[y]])
  1892.       :ecatb_clock_window_wh => %Q([128, 48]),
  1893.  
  1894.       # Sets the atb clock window x, y and z positions
  1895.       # Its corresponding method's created under ECATB_Clock_Window
  1896.       # It must return an array of real numbers and should return an array of
  1897.       # integers
  1898.       # Example: To set the atb clock window x, y and z positions as the value
  1899.       #          of variables with id a, b and c respectively, set this as
  1900.       #         %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  1901.       :ecatb_clock_window_xyz => %Q([0, 0, 0]),
  1902.  
  1903.       # Sets the turn portion bar colors
  1904.       # Its corresponding method's created under ECATB_Clock_Bar
  1905.       # It must return an array of colors
  1906.       # Example: To set the turn portion bar colors as text color c and r, g, b,
  1907.       #          a rgba values, set this as
  1908.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1909.       :ecatb_clock_bar_colors => %Q([Colour.text_colour(7),
  1910.                                      Colour.text_colour(8)]),
  1911.  
  1912.       # Sets the turn portion bar width and height
  1913.       # Its corresponding method's created under ECATB_Clock_Bar
  1914.       # It must return an array of positive real numbers and should return an
  1915.       # array of natural numbers
  1916.       # Example: To set the turn portion bar width and height as the value of
  1917.       #          variables with id x and y respectively, set this as
  1918.       #          %Q([$game_variables[x], $game_variables[y]])
  1919.       :ecatb_clock_bar_wh => %Q([104, 12]),
  1920.  
  1921.       # Sets the turn portion bar x and y positions
  1922.       # Its corresponding method's created under ECATB_Clock_Bar
  1923.       # It must return an array of real numbers and should return an array of
  1924.       # integers
  1925.       # Example: To set the turn portion bar x and y positions as the value of
  1926.       #          variables with id x and y respectively, set this as
  1927.       #          %Q([$game_variables[x], $game_variables[y]])
  1928.       :ecatb_clock_bar_xy => %Q([8, 8]),
  1929.  
  1930.       # Sets the way the turn portion and count text are shown
  1931.       # The current atb clcok can be referneced by cur_clock
  1932.       # The maximum atb clock can be referneced by max_clock
  1933.       # The turn count can be referenced by turn_count
  1934.       # Its corresponding method's created under ECATB_Clock_Window
  1935.       # It must return a string
  1936.       # Example: To set the way the turn portion and count text are shown as
  1937.       #          "cur_clock/max_clock", set this as
  1938.       #          %Q(cur_clock.to_s + "/" + max_clock.to_s)
  1939.       :ecatb_clock_text => %Q(cur_clock.to_s + "/" + max_clock.to_s + " " +
  1940.                               turn_count.to_s),
  1941.  
  1942.       # Sets the turn portion and count text color
  1943.       # Its corresponding method's created under ECATB_Clock_Window
  1944.       # It must return a color
  1945.       # Example: To set the turn portion and count text color's rgba values as
  1946.       #          r, g, b and a, set this as %Q(Color.new(r, g, b, a))
  1947.       :ecatb_clock_text_color => %Q(Colour.text_colour(0)),
  1948.  
  1949.       # Sets the turn portion and count text size
  1950.       # Its corresponding method's created under ECATB_Clock_Window
  1951.       # It must return a positive real number and should return a natural number
  1952.       # Example: To set the turn portion and count text size as the value of
  1953.       #          variable with id x, set this as %Q($game_variables[x])
  1954.       :ecatb_clock_text_size => %Q(16),
  1955.  
  1956.       # Sets the turn portion and count text x and y positions
  1957.       # Its corresponding method's created under ECATB_Clock_Window
  1958.       # It must return an array of real numbers and should return an array of
  1959.       # integers
  1960.       # Example: To set the turn portion and count text x and y positions as the
  1961.       #          value of variables with id a and b respectively, set this as
  1962.       #          %Q([$game_variables[a], $game_variables[b]])
  1963.       :ecatb_clock_text_xy => %Q([0, 4])
  1964.  
  1965.     }
  1966.  
  1967.   #----------------------------------------------------------------------------|
  1968.   #  * Cooldown                                                                |
  1969.   #    Setups configurations and notetag values of the cooldown features       |
  1970.   #----------------------------------------------------------------------------|
  1971.  
  1972.     #--------------------------------------------------------------------------|
  1973.     #  Cooldown Rate Notetag Values                                            |
  1974.     #  - Setups cdrx used by <ecatb cooldown rate: cdrx> notetags              |
  1975.     #--------------------------------------------------------------------------|
  1976.     # cdrx are read at:
  1977.     # 1. RPG::UsableItem
  1978.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1979.     # cdrx are used at:
  1980.     # 1. Game_BattlerBase
  1981.     #    - DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_cooldown_rate, self,
  1982.     #      @last_ecatb_rate[:cooldown]) in ecatb_cooldown_loss_rate
  1983.     # The atb rate can be referenced by val
  1984.     # cdrx are strings of names of methods under DoubleX_RMVXA::ECATB
  1985.     # cdrx must return a real number and should return a floating-point number
  1986.     # cdrx names can only use alphanumeric characters and can't use uppercase
  1987.     # letters
  1988.     # battler is the battler calling the cdrx
  1989.     # rate is the atb gain rate of battler
  1990.     # The below cdrx are examples to help you set your cdrx
  1991.     # You can freely use, rewrite and/or delete these examples
  1992.  
  1993.     # Sets the cooldown rate as x% per frame
  1994.     def self.cdr1(battler, rate)
  1995.       x
  1996.     end
  1997.  
  1998.     # Sets the cooldown rate as the value of variable with id x* 100% per frame
  1999.     def self.cdr2(battler, rate)
  2000.       $game_variables[x]
  2001.     end
  2002.  
  2003.     # Sets the cooldown rate as x times the atb gain rate
  2004.     def self.cdr3(battler, rate)
  2005.       rate * x
  2006.     end
  2007.  
  2008.     # Adds new cdrx here
  2009.    
  2010.  
  2011.     # Sets the default cooldown rate
  2012.     # It'll be used only if no cdrx are used
  2013.     # battler is the battler calling ecatb_cooldown_rate
  2014.     # rate is the atb gain rate of battler
  2015.     # Example: To disable cooldown, set this as %Q(100.0)
  2016.     def self.ecatb_cooldown_rate(battler, rate)
  2017.       100.0
  2018.     end
  2019.  
  2020.     #--------------------------------------------------------------------------|
  2021.     #  Cooldown Configurations                                                 |
  2022.     #  - Setups configurations of the cooldown features                        |
  2023.     #  - The value of each configuration is the string of the content of its   |
  2024.     #    corresponding method                                                  |
  2025.     #--------------------------------------------------------------------------|
  2026.  
  2027.     COOLDOWN = {
  2028.  
  2029.       # Sets the cooldown bar colors
  2030.       # It'll be used only if no corresponding color notetags are used
  2031.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2032.       # It must return an array of colors
  2033.       # Example: To set the cooldown bar colors as text color c and r, g, b, a
  2034.       #          rgba values, set this as
  2035.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2036.       :ecatb_cooldown_bar_colors => %Q([Colour.text_colour(19),
  2037.                                         Colour.text_colour(26)]),
  2038.  
  2039.       # Sets the priority of the ecatb cooldown bar color notetags to be used
  2040.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2041.       # It must return an array with elements being either :states, :enemies,
  2042.       # :armors, :weapons, :classes or :actors
  2043.       # Example: To set states to have a higher priority than that of actors,
  2044.       #          set this as %Q([:states, :actors])
  2045.       :ecatb_cooldown_bar_color_ord => %Q([:states, :enemies, :armors,
  2046.                                            :weapons, :classes, :actors]),
  2047.  
  2048.       # (v0.03a+)Sets something to happen right after finishing cooling down
  2049.       # normally
  2050.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2051.       # Example: To call a common event with id x right after finishing cooling
  2052.       #          down normally, set this as
  2053.       #          %Q($game_temp.reserve_common_event(x))
  2054.       :ecatb_cooldown_finish => %Q(),
  2055.  
  2056.       # Sets the failed party escape cooldown rate
  2057.       # The atb rate can be referneced by cooldown
  2058.       # Its corresponding method's created under Game_Actor
  2059.       # It must return a real number and should return a floating-point number
  2060.       # Example: To disable failed party escape cooldown, set this as %Q(100.0)
  2061.       :esc_ecatb_cooldown_rate => %Q(100.0)
  2062.  
  2063.     }
  2064.  
  2065.   #----------------------------------------------------------------------------|
  2066.   #  * Countdown                                                               |
  2067.   #    Setups configurations and notetag values of the countdown features      |
  2068.   #----------------------------------------------------------------------------|
  2069.  
  2070.     #--------------------------------------------------------------------------|
  2071.     #  Countdown Interval Notetag Values                                       |
  2072.     #  - Setups cix used by <ecatb countdown interval: cix> notetags           |
  2073.     #--------------------------------------------------------------------------|
  2074.     # cix are read at:
  2075.     # 1. RPG::State
  2076.     #    - next @ecatb_countdown_interval = $1.downcase.to_sym in
  2077.     #      load_ecatb_notes
  2078.     # cix are used at:
  2079.     # 1. Game_Battler
  2080.     #    - return unless $data_states[state_id].ecatb_countdown_interval in
  2081.     #      reset_state_counts
  2082.     #    - @ecatb_countdown_clock.each_key(&@ecatb_countdown_updates) in
  2083.     #      ecatb_countdown_update
  2084.     # cix are strings of names of methods under DoubleX_RMVXA::ECATB
  2085.     # cix must return a positive real number and should return a natural number
  2086.     # cix names can only use alphanumeric characters and can't use uppercase
  2087.     # letters
  2088.     # battler is the battler calling the cix
  2089.     # The below cix are examples to help you set your cix
  2090.     # You can freely use, rewrite and/or delete these examples
  2091.  
  2092.     # Sets the countdown interval as x seconds
  2093.     def self.ci1(battler)
  2094.       x
  2095.     end
  2096.  
  2097.     # Sets the countdown interval as the number of seconds equal to the value of
  2098.     # variable with id x
  2099.     def self.ci2(battler)
  2100.       $game_variables[x]
  2101.     end
  2102.  
  2103.     # Adds new cix here
  2104.    
  2105.  
  2106.     #--------------------------------------------------------------------------|
  2107.     #  (v0.05a+)Countdown Configurations                                       |
  2108.     #  - Setups configurations of the countdown features                       |
  2109.     #  - The value of each configuration is the string of the content of its   |
  2110.     #    corresponding method                                                  |
  2111.     #--------------------------------------------------------------------------|
  2112.  
  2113.     COUNTDOWN = {
  2114.  
  2115.       # Sets the minimum countdown interval for all states in frames
  2116.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2117.       # It must return a natural number
  2118.       # Example: To minimum countdown interval for all states in frames as the
  2119.       #          half of the number of frames per second, set this as
  2120.       #          %Q(Graphics.frame_rate / 2)
  2121.       :ecatb_countdown_min => %Q(Graphics.frame_rate)
  2122.  
  2123.     }
  2124.  
  2125.   #----------------------------------------------------------------------------|
  2126.   #  * Force                                                                   |
  2127.   #    Setups configurations of the force features                             |
  2128.   #----------------------------------------------------------------------------|
  2129.  
  2130.     #--------------------------------------------------------------------------|
  2131.     #  Force Configurations                                                    |
  2132.     #  - Setups configurations of the force features                           |
  2133.     #  - The value of each configuration is the string of the content of its   |
  2134.     #    corresponding method                                                  |
  2135.     #--------------------------------------------------------------------------|
  2136.  
  2137.     FORCE = {
  2138.  
  2139.       # Sets the key forcing the atb clock to run
  2140.       # Its corresponding method's created under Scene_Battle
  2141.       # It must return a symbol and should return an Input constant
  2142.       # If :ecatb_force_stop_key is pressed before pressing
  2143.       # :ecatb_force_run_key, the latter will cancel the former instead of
  2144.       # forcing the atb clock to run
  2145.       # Pressing :ecatb_force_run_key again will force the atb clock to run
  2146.       # Example: To disable this feature, set this as %Q(:unused), where :unused
  2147.       #          is an unused keymap
  2148.       :ecatb_force_run_key => %Q(:CTRL),
  2149.  
  2150.       # Sets the key forcing the atb clock to stop
  2151.       # Its corresponding method's created under Scene_Battle
  2152.       # It must return a symbol and should return an Input constant
  2153.       # If :ecatb_force_run_key is pressed before pressing
  2154.       # :ecatb_force_stop_key, the latter will cancel the former instead of
  2155.       # forcing the atb clock to stop
  2156.       # Example: To disable this feature, set this as %Q(:unused), where :unused
  2157.       #          is an unused keymap
  2158.       :ecatb_force_stop_key => %Q(:ALT),
  2159.  
  2160.       # Shows the atb force window displaying the atb force status
  2161.       # It's used under Scene_Battle but it doesn't have any associated method
  2162.       # Example: To show the atb force window if switch with id x is on, set
  2163.       #          this as %Q($game_switches[x])
  2164.       :show_ecatb_force_window => %Q(true),
  2165.  
  2166.       # Sets the atb force window width and height
  2167.       # Its corresponding method's created under ECATB_Force_Window
  2168.       # It must return an array of positive real numbers and should return an
  2169.       # array of natural numbers
  2170.       # Example: To set the atb force window width and height as the value of
  2171.       #          variables with id x and y respectively, set this as
  2172.       #          %Q([$game_variables[x], $game_variables[y]])
  2173.       :ecatb_force_window_wh => %Q([128, 40]),
  2174.  
  2175.       # Sets the atb force widnow x, y and z positions
  2176.       # Its corresponding method's created under ECATB_Force_Window
  2177.       # It must return an array of real numbers and should return an array of
  2178.       # integers
  2179.       # Example: To set the atb force window x, y and z positions as the value
  2180.       #          of variables with id a, b and c respectively, set this as
  2181.       #         %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2182.       :ecatb_force_window_xyz => %Q([0, 48, 0]),
  2183.  
  2184.       # Sets the atb force window text to be displayed when the atb clock isn't
  2185.       # forced
  2186.       # Its corresponding method's created under ECATB_Force_Window
  2187.       # It must return a string
  2188.       # Example: To set the atb force window text to be displayed when the atb
  2189.       #          clock isn't forced as "nil", set this as %Q("nil")
  2190.       :ecatb_force_nil_text => %Q("No Force ATB"),
  2191.  
  2192.       # Sets the atb force window text to be displayed when the atb clock's
  2193.       # forced to run
  2194.       # Its corresponding method's created under ECATB_Force_Window
  2195.       # It must return a string
  2196.       # Example: To set the atb force window text to be displayed when the atb
  2197.       #          clock's force to run as "run", set this as %Q("run")
  2198.       :ecatb_force_run_text => %Q("ATB Force Run"),
  2199.  
  2200.       # Sets the atb force window text to be displayed when the atb clock's
  2201.       # forced to stop
  2202.       # Its corresponding method's created under ECATB_Force_Window
  2203.       # It must return a string
  2204.       # Example: To set the atb force window text to be displayed when the atb
  2205.       #          clock's force to run as "stop", set this as %Q("stop")
  2206.       :ecatb_force_stop_text => %Q("ATB Force Stop"),
  2207.  
  2208.       # Sets the atb force window text color
  2209.       # Its corresponding method's created under ECATB_Force_Window
  2210.       # It must return a color
  2211.       # Example: To set the atb force window text color's rgba values as r, g, b
  2212.       #          and a, set this as %Q(Color.new(r, g, b, a))
  2213.       :ecatb_force_text_color => %Q(Colour.text_colour(0)),
  2214.  
  2215.       # Sets the atb force window text size
  2216.       # Its corresponding method's created under ECATB_Force_Window
  2217.       # It must return a positive real number and should return a natural number
  2218.       # Example: To set the atb force window text size as the value of variable
  2219.       #          with id x, set this as %Q($game_variables[x])
  2220.       :ecatb_force_text_size => %Q(16),
  2221.  
  2222.       # Sets the atb force window text x and y positions
  2223.       # Its corresponding method's created under ECATB_Force_Window
  2224.       # It must return an array of real numbers and should return an array of
  2225.       # integers
  2226.       # Example: To set the atb force window text x and y positions as the value
  2227.       #          of variables with id a and b respectively, set this as
  2228.       #          %Q([$game_variables[a], $game_variables[b]])
  2229.       :ecatb_force_text_xy => %Q([0, 0])
  2230.  
  2231.     }
  2232.  
  2233.   #----------------------------------------------------------------------------|
  2234.   #  * Hotkey                                                                  |
  2235.   #    Setups configurations of the hotkey features                            |
  2236.   #----------------------------------------------------------------------------|
  2237.  
  2238.     #--------------------------------------------------------------------------|
  2239.     #  Hotkey Configurations                                                   |
  2240.     #  - Setups configurations of the hotkey features                          |
  2241.     #  - The value of each configuration is the string of the content of its   |
  2242.     #    corresponding method                                                  |
  2243.     #--------------------------------------------------------------------------|
  2244.  
  2245.     HOTKEY = {
  2246.  
  2247.       # Sets the hotkeys calling an actor in the status window that can input
  2248.       # actions or in the cancel window, or a battler in the target window
  2249.       # Its corresponding method's created under Scene_Battle
  2250.       # It must return an array of symbols and should return an array of
  2251.       # Input constants
  2252.       # The ith hotkey calls the actor with index i
  2253.       # Nothing will happen if the actor in the status window can't input
  2254.       # actions
  2255.       # Example: To disable this feature, set this as %Q([])
  2256.       :ecatb_battler_hotkeys => %Q([
  2257.         :NUMPAD1,
  2258.         :NUMPAD2,
  2259.         :NUMPAD3,
  2260.         :NUMPAD4,
  2261.         :NUMPAD5,
  2262.         :NUMPAD6,
  2263.         :NUMPAD7,
  2264.         :NUMPAD8,
  2265.         :NUMPAD9,
  2266.         :NUMPAD0
  2267.       ])
  2268.  
  2269.     }
  2270.  
  2271.   #----------------------------------------------------------------------------|
  2272.   #  * (v0.01a+)Order                                                          |
  2273.   #    Setups configurations of the order features                             |
  2274.   #----------------------------------------------------------------------------|
  2275.  
  2276.     #--------------------------------------------------------------------------|
  2277.     #  Order Battler Icon Notetag Values                                       |
  2278.     #  - Setups obix used by <ecatb order battler icon: obix> notetags         |
  2279.     #--------------------------------------------------------------------------|
  2280.     # obix are read at:
  2281.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2282.     #    - next @ecatb_notes[:order_icon] = $1.downcase.to_sym in
  2283.     #      load_ecatb_notes
  2284.     # obix are used at:
  2285.     # 1. Game_BattlerBase
  2286.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2287.     # obix are strings of names of methods under DoubleX_RMVXA::ECATB
  2288.     # obix must return an array with its 1st and 2nd element being a bitmap and
  2289.     # a rect respectively
  2290.     # obix names can only use alphanumeric characters and can't use uppercase
  2291.     # letters
  2292.     # battler is the battler calling the obix
  2293.     # The below obix are examples added to help you set your obix
  2294.     # You can freely use, rewrite and/or delete these examples
  2295.  
  2296.     # Uses the actor character graphic with frame at 1st row and 2nd column
  2297.     def self.obi1(battler)
  2298.       bitmap = Cache.character(battler.actor.character_name)
  2299.       w = bitmap.width / 12
  2300.       h = bitmap.height / 8
  2301.       index = battler.actor.character_index
  2302.       [bitmap, Rect.new((index % 4 * 3 + 1) * w, (index / 4 * 4) * h, w, h)]
  2303.     end
  2304.  
  2305.     # Uses bitmap "Monsters2" in "Characters" with part at 1st row and 3rd
  2306.     # column and frame in that part at 1st row and 2nd column
  2307.     def self.obi2(battler)
  2308.       bitmap = Cache.character("Monster2")
  2309.       w = bitmap.width / 12
  2310.       h = bitmap.height / 8
  2311.       [bitmap, Rect.new((2 % 4 * 3 + 1) * w, (2 / 4 * 4) * h, w, h)]
  2312.     end
  2313.  
  2314.     # Adds new obix here
  2315.    
  2316.  
  2317.     #--------------------------------------------------------------------------|
  2318.     #  Order Battler Opacity Notetag Values                                    |
  2319.     #  - Setups obox used by <ecatb order battler opacity: obox> notetags      |
  2320.     #--------------------------------------------------------------------------|
  2321.     # obox are read at:
  2322.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2323.     #    - next @ecatb_notes[:order_opacity] = $1.downcase.to_sym in
  2324.     #      load_ecatb_notes
  2325.     # obox are used at:
  2326.     # 1. Game_BattlerBase
  2327.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2328.     # obox are strings of names of methods under DoubleX_RMVXA::ECATB
  2329.     # obox must return a non-negative real number and should return a
  2330.     # non-negatve integer
  2331.     # obox names can only use alphanumeric characters and can't use uppercase
  2332.     # letters
  2333.     # battler is the battler calling the obox
  2334.     # The below obox are examples added to help you set your obox
  2335.     # You can freely use, rewrite and/or delete these examples
  2336.  
  2337.     # Sets the opacity of the icon representing its battler order as x
  2338.     def self.obo1(battler)
  2339.       x
  2340.     end
  2341.  
  2342.     # Sets the opacity of the icon representing its battler order as the value
  2343.     # of variable with id x
  2344.     def self.obo2(battler)
  2345.       $game_variables[x]
  2346.     end
  2347.  
  2348.     # Adds new obox here
  2349.    
  2350.  
  2351.     #--------------------------------------------------------------------------|
  2352.     #  Order Battler Scale Notetag Values                                      |
  2353.     #  - Setups obsx used by <ecatb order battler scale: obsx> notetags        |
  2354.     #--------------------------------------------------------------------------|
  2355.     # obsx are read at:
  2356.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2357.     #    - next @ecatb_notes[:order_scale] = $1.downcase.to_sym in
  2358.     #      load_ecatb_notes
  2359.     # obsx are used at:
  2360.     # 1. Game_BattlerBase
  2361.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2362.     # obsx are strings of names of methods under DoubleX_RMVXA::ECATB
  2363.     # obsx must return a positive real number
  2364.     # obsx names can only use alphanumeric characters and can't use uppercase
  2365.     # letters
  2366.     # battler is the battler calling the obsx
  2367.     # The below obsx are examples added to help you set your obsx
  2368.     # You can freely use, rewrite and/or delete these examples
  2369.  
  2370.     # Sets the opacity of the icon representing its battler order as x
  2371.     def self.obs1(battler)
  2372.       x
  2373.     end
  2374.  
  2375.     # Sets the opacity of the icon representing its battler order as the value
  2376.     # of variable with id x
  2377.     def self.obs2(battler)
  2378.       $game_variables[x]
  2379.     end
  2380.  
  2381.     # Adds new obsx here
  2382.    
  2383.  
  2384.     #--------------------------------------------------------------------------|
  2385.     #  Order Battler Z Notetag Values                                          |
  2386.     #  - Setups obzx used by <ecatb order battler z: obzx> notetags            |
  2387.     #--------------------------------------------------------------------------|
  2388.     # obzx are read at:
  2389.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2390.     #    - next @ecatb_notes[:order_z] = $1.downcase.to_sym in load_ecatb_notes
  2391.     # obzx are used at:
  2392.     # 1. Game_BattlerBase
  2393.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2394.     # obzx are strings of names of methods under DoubleX_RMVXA::ECATB
  2395.     # obzx must return a non-negative real number and should return a
  2396.     # non-negatve integer
  2397.     # obzx names can only use alphanumeric characters and can't use uppercase
  2398.     # letters
  2399.     # battler is the battler calling the obzx
  2400.     # The below obzx are examples added to help you set your obzx
  2401.     # You can freely use, rewrite and/or delete these examples
  2402.  
  2403.     # Sets the z position of the icon representing its battler order as x
  2404.     def self.obz1(battler)
  2405.       x
  2406.     end
  2407.  
  2408.     # Sets the z position of the icon representing its battler order as the
  2409.     # value of variable with id x
  2410.     def self.obz2(battler)
  2411.       $game_variables[x]
  2412.     end
  2413.  
  2414.     # Adds new obzx here
  2415.    
  2416.  
  2417.     #--------------------------------------------------------------------------|
  2418.     #  Order Configurations                                                    |
  2419.     #  - Setups configurations of the order features                           |
  2420.     #  - The value of each configuration is the string of the content of its   |
  2421.     #    corresponding method                                                  |
  2422.     #--------------------------------------------------------------------------|
  2423.  
  2424.     ORDER = {
  2425.  
  2426.       # Shows the battler order window
  2427.       # It's used under Scene_Battle but it doesn't have any associated method
  2428.       # Example: To show the battler atb window if switch with id x is on, set
  2429.       #          this as %Q($game_switches[x])
  2430.       :show_ecatb_order_window => %Q(true),
  2431.  
  2432.       # Sets the battler order window width and height
  2433.       # Its corresponding method's created under ECATB_Order_Window
  2434.       # It must return an array of positive real numbers and should return an
  2435.       # array of natural numbers
  2436.       # Example: To set the battler order window width and height as the value
  2437.       #          of variables with id x and y respectively, set this as
  2438.       #          %Q([$game_variables[x], $game_variables[y]])
  2439.       :ecatb_order_window_wh => %Q([128, 60]),
  2440.  
  2441.       # Sets the battler order window x, y and z positions
  2442.       # Its corresponding method's created under ECATB_Order_Window
  2443.       # It must return an array of real numbers and should return an array of
  2444.       # integers
  2445.       # Example: To set the battler order window x, y and z positions as the
  2446.       #          value of variables with id a, b and c respectively, set this as
  2447.       #     %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2448.       :ecatb_order_window_xyz => %Q([0, 88, 0]),
  2449.  
  2450.       # Sets the battler order atb bar colors
  2451.       # Its corresponding method's created under ECATB_Order_Window
  2452.       # It must return an array of colors
  2453.       # Example: To set the battler order atb bar colors as text color c and r,
  2454.       #          g, b, a rgba values, set this as
  2455.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2456.       :ecatb_order_bar_colors => %Q([Colour.text_colour(7),
  2457.                                      Colour.text_colour(8)]),
  2458.  
  2459.       # Sets the battler order atb charge bar colors
  2460.       # Its corresponding method's created under ECATB_Order_Window
  2461.       # It must return an array of colors
  2462.       # Example: To set the battler order atb charge bar colors as text color c
  2463.       #          and r, g, b, a rgba values, set this as
  2464.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2465.       :ecatb_order_charge_bar_colors => %Q([Colour.text_colour(30),
  2466.                                             Colour.text_colour(31)]),
  2467.  
  2468.       # Sets the battler order atb cooldown bar colors
  2469.       # Its corresponding method's created under ECATB_Order_Window
  2470.       # It must return an array of colors
  2471.       # Example: To set the battler order atb cooldown bar colors as text color
  2472.       #          c and r, g, b, a rgba values, set this as
  2473.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2474.       :ecatb_order_cooldown_bar_colors => %Q([Colour.text_colour(19),
  2475.                                               Colour.text_colour(26)]),
  2476.  
  2477.       # Sets the battler order bars width and height
  2478.       # Its corresponding method's created under ECATB_Order_Window
  2479.       # It must return an array of positive real numbers and should return an
  2480.       # array of natural numbers
  2481.       # Example: To set the battler order bars width and height as the value of
  2482.       #          variables with id x and y respectively, set this as
  2483.       #          %Q([$game_variables[x], $game_variables[y]])
  2484.       :ecatb_order_bar_wh => %Q([108, 12]),
  2485.  
  2486.       # Sets the battler order bars x and y positions
  2487.       # Its corresponding method's created under ECATB_Order_Window
  2488.       # It must return an array of real numbers and should return an array of
  2489.       # integers
  2490.       # Example: To set the battler order bars x and y positions as the value of
  2491.       #          variables with id x and y respectively, set this as
  2492.       #          %Q([$game_variables[x], $game_variables[y]])
  2493.       :ecatb_order_bar_xy => %Q([0, 12]),
  2494.  
  2495.       # Sets the battler order atb bar text
  2496.       # Its corresponding method's created under ECATB_Order_Window
  2497.       # It must return a string
  2498.       # Example: To set the battler order atb bar text as "Norm", set this as
  2499.       #          %Q("Norm")
  2500.       :ecatb_order_bar_text => %Q("ATB"),
  2501.  
  2502.       # Sets the battler order atb charge bar text
  2503.       # Its corresponding method's created under ECATB_Order_Window
  2504.       # It must return a string
  2505.       # Example: To set the battler order atb charge bar text as "Charging", set
  2506.       #          this as %Q("Charging")
  2507.       :ecatb_order_charge_bar_text => %Q("Charge"),
  2508.  
  2509.       # Sets the battler order atb cooldown bar text
  2510.       # Its corresponding method's created under ECATB_Order_Window
  2511.       # It must return a string
  2512.       # Example: To set the battler order atb cooldown bar text as "Cooldown",
  2513.       #          set this as %Q("Cooldown")
  2514.       :ecatb_order_cooldown_bar_text => %Q("Cool"),
  2515.  
  2516.       # Sets the battler order bars text color
  2517.       # Its corresponding method's created under ECATB_Order_Window
  2518.       # It must return a color
  2519.       # Example: To set the battler order bars text color's rgba values as
  2520.       #          r, g, b and a, set this as %Q(Color.new(r, g, b, a))
  2521.       :ecatb_order_text_color => %Q(Colour.text_colour(0)),
  2522.  
  2523.       # Sets the battler order bars text size
  2524.       # Its corresponding method's created under ECATB_Order_Window
  2525.       # It must return a positive real number and should return a natural number
  2526.       # Example: To set the battler order bars text size as the value of
  2527.       #          variable with id x, set this as %Q($game_variables[x])
  2528.       :ecatb_order_text_size => %Q(12),
  2529.  
  2530.       # Sets the battler order bars text x and y positions
  2531.       # Its corresponding method's created under ECATB_Order_Window
  2532.       # It must return an array of real numbers and should return an array of
  2533.       # integers
  2534.       # Example: To set the battler order bars text x and y positions as the
  2535.       #          value of variables with id a and b respectively, set this as
  2536.       #          %Q([$game_variables[a], $game_variables[b]])
  2537.       :ecatb_order_text_xy => %Q([2, 14]),
  2538.  
  2539.       # Sets the icon representing the battlers in the battler order window
  2540.       # It'll be used only if no corresponding order battler icon notetags are
  2541.       # used
  2542.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2543.       # It must return an array with its 1st and 2nd element being a bitmap and
  2544.       # a rect respectively
  2545.       # Example: To use the icon with index x in the iconset, set this as
  2546.       #          %Q(
  2547.       #    [Cache.system("Iconset"), Rect.new(x % 16 * 24, x / 16 * 24, 24, 24)]
  2548.       #    ),
  2549.       :ecatb_order_battler_icon => %Q(
  2550.        [Cache.system("Iconset"), Rect.new(121 % 16 * 24, 121 / 16 * 24, 24, 24)]
  2551.       ),
  2552.  
  2553.       # Sets the priority of the ecatb order battler icon notetags to be used
  2554.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2555.       # It must return an array with elements being either :states, :enemies,
  2556.       # :armors, :weapons, :classes or :actors
  2557.       # Example: To set states to have a higher priority than that of actors,
  2558.       #          set this as %Q([:states, :actors])
  2559.       :ecatb_order_battler_icon_ord => %Q([:states, :enemies, :armors,
  2560.                                            :weapons, :classes, :actors]),
  2561.  
  2562.       # Sets the opacity of icons representing the battlers in the battler order
  2563.       # window
  2564.       # It'll be used only if no corresponding order battler icon notetags are
  2565.       # used
  2566.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2567.       # It must return a non-negative real number and should return an integer
  2568.       # between 0 and 255
  2569.       # Example: To set the opacity of icons representing the actors as the
  2570.       #          value of variable with id x, set this as %Q($game_variables[x])
  2571.       :ecatb_order_battler_opacity => %Q(255),
  2572.  
  2573.       # Sets the priority of the ecatb order battler opacity notetags to be used
  2574.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2575.       # It must return an array with elements being either :states, :enemies,
  2576.       # :armors, :weapons, :classes or :actors
  2577.       # Example: To set states to have a higher priority than that of actors,
  2578.       #          set this as %Q([:states, :actors])
  2579.       :ecatb_order_battler_opacity_ord => %Q([:states, :enemies, :armors,
  2580.                                               :weapons, :classes, :actors]),
  2581.  
  2582.       # Sets the scale of icons representing the battlers in the battler order
  2583.       # window
  2584.       # It'll be used only if no corresponding order battler icon notetags are
  2585.       # used
  2586.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2587.       # It must return a positive real number
  2588.       # Example: To set the scale of icons representing the actors as the
  2589.       #          value of variable with id x, set this as %Q($game_variables[x])
  2590.       :ecatb_order_battler_scale => %Q(0.5),
  2591.  
  2592.       # Sets the priority of the ecatb order battler scale notetags to be used
  2593.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2594.       # It must return an array with elements being either :states, :enemies,
  2595.       # :armors, :weapons, :classes or :actors
  2596.       # Example: To set states to have a higher priority than that of actors,
  2597.       #          set this as %Q([:states, :actors])
  2598.       :ecatb_order_battler_scale_ord => %Q([:states, :enemies, :armors,
  2599.                                             :weapons, :classes, :actors]),
  2600.  
  2601.       # Sets the z position of icons representing the battlers in the battler
  2602.       # order window
  2603.       # It'll be used only if no corresponding order battler icon notetags are
  2604.       # used
  2605.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2606.       # It must return a non-negative real number and should return a
  2607.       # non-negatve integer
  2608.       # Example: To set the z position of icons representing the actors as the
  2609.       #          value of variable with id x, set this as %Q($game_variables[x])
  2610.       :ecatb_order_battler_z => %Q(500),
  2611.  
  2612.       # Sets the priority of the ecatb order battler z notetags to be used
  2613.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2614.       # It must return an array with elements being either :states, :enemies,
  2615.       # :armors, :weapons, :classes or :actors
  2616.       # Example: To set states to have a higher priority than that of actors,
  2617.       #          set this as %Q([:states, :actors])
  2618.       :ecatb_order_battler_z_ord => %Q([:states, :enemies, :armors, :weapons,
  2619.                                         :classes, :actors]),
  2620.  
  2621.       # Sets the x position of icons representing the battlers in the battler
  2622.       # order window
  2623.       # It must return a real number and should return an integer
  2624.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2625.       # Example: To set the x position of icons representing the battlers as the
  2626.       #          value of variable with id x, set this as %Q($game_variables[x])
  2627.       :ecatb_order_battler_icon_x => %Q(4),
  2628.  
  2629.       # Sets the y position of icons representing the actors in the battler
  2630.       # order window
  2631.       # It must return a real number and should return an integer
  2632.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2633.       # Example: To set the y position of icons representing the actors as the
  2634.       #          value of variable with id x, set this as %Q($game_variables[x])
  2635.       :ecatb_order_actor_icon_y => %Q(36),
  2636.  
  2637.       # Sets the y position of icons representing the enemies in the battler
  2638.       # order window
  2639.       # It must return a real number and should return an integer
  2640.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2641.       # Example: To set the y position of icons representing the enemies as the
  2642.       #          value of variable with id x, set this as %Q($game_variables[x])
  2643.       :ecatb_order_enemy_icon_y => %Q(8)
  2644.  
  2645.     }
  2646.  
  2647.   #----------------------------------------------------------------------------|
  2648.   #  * Pool                                                                    |
  2649.   #    Setups configurations of the pool features                              |
  2650.   #----------------------------------------------------------------------------|
  2651.  
  2652.     #--------------------------------------------------------------------------|
  2653.     #  Pool Configurations                                                     |
  2654.     #  - Setups configurations of the pool features                            |
  2655.     #  - The value of each configuration is the string of the content of its   |
  2656.     #    corresponding method                                                  |
  2657.     #--------------------------------------------------------------------------|
  2658.  
  2659.     POOL = {
  2660.  
  2661.       # Evaluates the party/troop pool atb value from all actors/enemies' ones
  2662.       # The actors/enemies' atb values can be referenced by vals
  2663.       # Its corresponding method's created under Game_Party and Game_Troop
  2664.       # It must return a non-negative real number and should return a
  2665.       # non-negative integer
  2666.       # Example: To use the minimum atb value of all actors/enemies, set this as
  2667.       #          %Q(vals.empty? ? 0 : vals.min)
  2668.       :ecatb_pool_val => %Q(vals.empty? ? 0 : vals.inject(:+) / vals.size),
  2669.  
  2670.       # Shows the atb pool window displaying the atb mode
  2671.       # It's used under Scene_Battle but it doesn't have any associated method
  2672.       # Example: To show the atb pool window if switch with id x is on, set
  2673.       #          this as %Q($game_switches[x])
  2674.       :show_ecatb_pool_window => %Q(true),
  2675.  
  2676.       # Sets the atb pool window width and height
  2677.       # Its corresponding method's created under ECATB_Pool_Window
  2678.       # It must return an array of positive real numbers and should return an
  2679.       # array of natural numbers
  2680.       # Example: To set the atb pool window width and height as the value of
  2681.       #          variables with id x and y respectively, set this as
  2682.       # %Q([$game_variables[x], $game_variables[y]])
  2683.       :ecatb_pool_window_wh => %Q([128, 56]),
  2684.  
  2685.       # Sets the atb pool widnow x, y and z positions
  2686.       # Its corresponding method's created under ECATB_Pool_Window
  2687.       # It must return an array of real numbers and should return an array of
  2688.       # integers
  2689.       # Example: To set the atb pool window x, y and z positions as the value
  2690.       #          of variables with id a, b and c respectively, set this as
  2691.       # %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2692.       :ecatb_pool_window_xyz => %Q([0, 148, 0]),
  2693.  
  2694.       # Sets the party atb pool window text to be displayed
  2695.       # Its corresponding method's created under ECATB_Pool_Window
  2696.       # It must return an array of strings
  2697.       # The 1st and 2nd element of the array is displayed when the atb pool
  2698.       # mode's on and off respectively
  2699.       # Example: To set the party atb pool window text to be displayed when the
  2700.       #          atb pool mode's on and off as "Party ATB Pool Mode On" and
  2701.       #          "Party ATB Pool Mode Off" respectively, set this as
  2702.       #          %Q(["Party ATB Pool Mode On", "Party ATB Pool Mode Off"])
  2703.       :ecatb_pool_party_actor_text => %Q(["Party ATB", "Actor ATB"]),
  2704.  
  2705.       # Sets the troop atb pool window text to be displayed
  2706.       # Its corresponding method's created under ECATB_Pool_Window
  2707.       # It must return an array of strings
  2708.       # The 1st and 2nd element of the array is displayed when the atb pool
  2709.       # mode's on and off respectively
  2710.       # Example: To set the troop atb pool window text to be displayed when the
  2711.       #          atb pool mode's on and off as "Troop ATB Pool Mode On" and
  2712.       #          "Troop ATB Pool Mode Off" respectively, set this as
  2713.       #          %Q(["Troop ATB Pool Mode On", "Troop ATB Pool Mode Off"])
  2714.       :ecatb_pool_troop_enemy_text => %Q(["Troop ATB", "Enemy ATB"]),
  2715.  
  2716.       # Sets the atb pool window text color
  2717.       # Its corresponding method's created under ECATB_Pool_Window
  2718.       # It must return a color
  2719.       # Example: To set the atb pool window text color's rgba values as r, g, b
  2720.       #          and a, set this as %Q(Color.new(r, g, b, a))
  2721.       :ecatb_pool_text_color => %Q(Colour.text_colour(0)),
  2722.  
  2723.       # Sets the atb pool window text size
  2724.       # Its corresponding method's created under ECATB_Pool_Window
  2725.       # It must return a positive real number and should return a natural number
  2726.       # Example: To set the atb pool window text size as the value of variable
  2727.       #          with id x, set this as %Q($game_variables[x])
  2728.       :ecatb_pool_text_size => %Q(16),
  2729.  
  2730.       # Sets the atb party pool window text x and y positions
  2731.       # Its corresponding method's created under ECATB_Pool_Window
  2732.       # It must return an array of real numbers and should return an array of
  2733.       # integers
  2734.       # Example: To set the atb party pool window text x and y positions as the
  2735.       #          value of variables with id a and b respectively, set this as
  2736.       #          %Q([$game_variables[a], $game_variables[b]])
  2737.       :ecatb_pool_party_text_xy => %Q([0, 8]),
  2738.  
  2739.       # Sets the atb troop pool window text x and y positions
  2740.       # Its corresponding method's created under ECATB_Pool_Window
  2741.       # It must return an array of real numbers and should return an array of
  2742.       # integers
  2743.       # Example: To set the atb troop pool window text x and y positions as the
  2744.       #          value of variables with id a and b respectively, set this as
  2745.       #          %Q([$game_variables[a], $game_variables[b]])
  2746.       :ecatb_pool_troop_text_xy => %Q([0, -8])
  2747.  
  2748.     }
  2749.  
  2750.   #----------------------------------------------------------------------------|
  2751.   #  * SE                                                                      |
  2752.   #    Setups configurations of the se features                                |
  2753.   #----------------------------------------------------------------------------|
  2754.  
  2755.     #--------------------------------------------------------------------------|
  2756.     #  SE Ready Act Notetag Values                                             |
  2757.     #  - Setups serax used by <ecatb se ready act: serax> notetags             |
  2758.     #--------------------------------------------------------------------------|
  2759.     # serax are read at:
  2760.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2761.     #    - next @ecatb_notes[:se] = $1.downcase.to_sym in load_ecatb_notes
  2762.     # serax are used at:
  2763.     # 1. Game_BattlerBase
  2764.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2765.     # serax are strings of names of methods under DoubleX_RMVXA::ECATB
  2766.     # serax names can only use alphanumeric characters and can't use uppercase
  2767.     # letters
  2768.     # battler is the battler calling the serax
  2769.     # The below serax are examples added to help you set your serax
  2770.     # You can freely use, rewrite and/or delete these examples
  2771.  
  2772.     # Sets the battler ready se as se with name "name", volume volume and pitch
  2773.     # pitch
  2774.     def self.sera1(battler)
  2775.       RPG::SE.new("file", volume, pitch)
  2776.     end
  2777.  
  2778.     # Disables the use of the battler ready se
  2779.     def self.sera2(battler)
  2780.       nil
  2781.     end
  2782.  
  2783.     # Adds new serax here
  2784.    
  2785.  
  2786.     #--------------------------------------------------------------------------|
  2787.     #  SE Configurations                                                       |
  2788.     #  - Setups configurations of the se features                              |
  2789.     #  - The value of each configuration is the string of the content of its   |
  2790.     #    corresponding method                                                  |
  2791.     #--------------------------------------------------------------------------|
  2792.  
  2793.     SE = {
  2794.  
  2795.       # Sets the se to be played when a battler becomes able to act
  2796.       # It'll be used only if no corresponding color notetags are used
  2797.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2798.       # Example: To set the se to be played when a battler becomes able to act
  2799.       #          as se with name "name", volume volume and pitch pitch, set this
  2800.       #          as %Q(RPG::SE.new("name", volume, pitch))
  2801.       :ecatb_se_ready_act => %Q(nil),
  2802.  
  2803.       # Sets the priority of the ecatb se ready act notetags to be used
  2804.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2805.       # It must return an array with elements being either :states, :enemies,
  2806.       # :armors, :weapons, :classes or :actors
  2807.       # Example: To set states to have a higher priority than that of actors,
  2808.       #          set this as %Q([:states, :actors])
  2809.       :ecatb_se_ready_act_ord => %Q([:states, :enemies, :armors, :weapons,
  2810.                                      :classes, :actors])
  2811.  
  2812.     }
  2813.  
  2814.   #----------------------------------------------------------------------------|
  2815.   #  * (v0.02a+)Speed                                                          |
  2816.   #    Setups configurations and notetag values of the speed features          |
  2817.   #----------------------------------------------------------------------------|
  2818.  
  2819.     #--------------------------------------------------------------------------|
  2820.     #  Speed Reduce Notetag Values                                             |
  2821.     #  - Setups srx used by <ecatb speed reduce: srx> notetags                 |
  2822.     #--------------------------------------------------------------------------|
  2823.     # srx are read at:
  2824.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2825.     #    - next @ecatb_notes[:speed] << $1.downcase.to_sym in load_ecatb_notes
  2826.     # srx are used at:
  2827.     # 1. Game_BattlerBase
  2828.     #    - ecatb.send(note, self) in set_ecatb_speed_reduce
  2829.     # srx are strings of names of methods under DoubleX_RMVXA::ECATB
  2830.     # srx must return a non-negative integer
  2831.     # srx names can only use alphanumeric characters and can't use uppercase
  2832.     # letters
  2833.     # battler is the battler calling the srx
  2834.     # The below srx are examples to help you set your srx
  2835.     # You can freely use, rewrite and/or delete these examples
  2836.  
  2837.     # Sets the action input speed reduction as x frames
  2838.     def self.sr1(battler)
  2839.       battler.instance_exec { @last_ecatb_speed_reduce = x }
  2840.     end
  2841.  
  2842.     # Sets the action input speed reduction as the number of frames being the
  2843.     # value of variable with id x
  2844.     def self.sr2(battler)
  2845.       battler.instance_exec { @last_ecatb_speed_reduce = $game_variables[x] }
  2846.     end
  2847.  
  2848.     # Adds the action input speed reduction by x frames
  2849.     def self.sr3(battler)
  2850.       battler.instance_exec { @last_ecatb_speed_reduce += x }
  2851.     end
  2852.  
  2853.     # Adds new srx here
  2854.    
  2855.  
  2856.     #--------------------------------------------------------------------------|
  2857.     #  Speed Configurations                                                    |
  2858.     #  - Setups configurations of the speed features                           |
  2859.     #  - The value of each configuration is the string of the content of its   |
  2860.     #    corresponding method                                                  |
  2861.     #--------------------------------------------------------------------------|
  2862.  
  2863.     SPEED = {
  2864.  
  2865.       # Sets the action input speed reduction for enemies and/or actors with
  2866.       # autobattle and/or confusion
  2867.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2868.       # It must return a non-negative integer
  2869.       # Example: To set the action input speed reduction for enemies and/or
  2870.       #          actors with autobattle and/or confusion as the value of
  2871.       #          variable with id x, set this as
  2872.       #          %Q(@last_ecatb_speed_reduce = $game_variables[x])
  2873.       :ecatb_speed_reduce => %Q(@last_ecatb_speed_reduce = 0),
  2874.  
  2875.       # Sets the priority of the ecatb speed reduce notetags to be used
  2876.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2877.       # It must return an array with elements being either :states, :enemies,
  2878.       # :armors, :weapons, :classes or :actors
  2879.       # Example: To set actors to have a higher priority than that of states,
  2880.       #          set this as %Q([:actors, :states])
  2881.       :ecatb_speed_reduce_ord => %Q([:actors, :classes, :weapons, :armors,
  2882.                                      :enemies, :states])
  2883.  
  2884.     }
  2885.  
  2886.   #----------------------------------------------------------------------------|
  2887.   #  * Unison                                                                  |
  2888.   #    Setups configurations of the unison features                            |
  2889.   #----------------------------------------------------------------------------|
  2890.  
  2891.     #--------------------------------------------------------------------------|
  2892.     #  Unison Actor Notetag Values                                             |
  2893.     #  - Setups uax used by <ecatb unison actor: uax> notetags                 |
  2894.     #--------------------------------------------------------------------------|
  2895.     # uax are read at:
  2896.     # 1. RPG::UsableItem
  2897.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2898.     # uax are used at:
  2899.     # 1. Game_BattlerBase
  2900.     #    - actors = ecatb.send(item.ecatb_unison_actor, self).collect!(
  2901.     #      &ecatb::BLOCKS[:usable?]) in usable?
  2902.     # 2. Game_Actor
  2903.     #    - @ecatb_unison_actors = ecatb.send(
  2904.     #      @last_ecatb_item.ecatb_unison_actor, self) in confirm_ecatb_item
  2905.     # 3. Window_ItemList
  2906.     #    - return battler.usable?(item) if (ecatb = DoubleX_RMVXA::ECATB).send(
  2907.     #      item.ecatb_act_cost, battler) > 1 || ecatb.send(
  2908.     #      item.ecatb_unison_actor, battler).size > 1 in enable?
  2909.     # 4. Scene_Battle
  2910.     #    - actors = ecatb.send($data_skills[actor.attack_skill_id].
  2911.     #      ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?]) in
  2912.     #      command_attack
  2913.     #    - actors = ecatb.send($data_skills[actor.guard_skill_id].
  2914.     #      ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?]) in
  2915.     #      command_guard
  2916.     #    - actors = ecatb.send(window.item.ecatb_unison_actor,
  2917.     #      BattleManager.actor) in on_ecatb_unison_item_ok?
  2918.     #    - actors = ecatb.send(actor.input.item.ecatb_unison_actor, actor) in
  2919.     #      on_ecatb_unison?
  2920.     # uax are strings of names of methods under DoubleX_RMVXA::ECATB
  2921.     # uax shouldn't return random values
  2922.     # uax must return an array of actor ids and the array must have more
  2923.     # than 1 actor ids
  2924.     # uax names can only use alphanumeric characters and can't use uppercase
  2925.     # letters
  2926.     # battler is the battler calling the uax
  2927.     # The below uax are examples added to help you set your uax
  2928.     # You can freely use, rewrite and/or delete these examples
  2929.  
  2930.     # Sets the unison actors as those with id x, y and z respectively
  2931.     def self.ua1(battler)
  2932.       [x, y, z]
  2933.     end
  2934.  
  2935.     # Adds new uax here
  2936.    
  2937.  
  2938.     # Don't edit this unless you understand what it does and how it works
  2939.     def self.ecatb_unison_actor(battler)
  2940.       []
  2941.     end
  2942.  
  2943.     #--------------------------------------------------------------------------|
  2944.     #  Unison Charge Rule Notetag Values                                       |
  2945.     #  - Setups ucrx used by <ecatb unison charge rule: ucrx> notetags         |
  2946.     #--------------------------------------------------------------------------|
  2947.     # ucrx are read at:
  2948.     # 1. RPG::UsableItem
  2949.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2950.     # ucrx are used at:
  2951.     # 1. Game_Actor
  2952.     #    - @ecatb_unison_rule[:charge] = ecatb.send(
  2953.     #      @last_ecatb_item.ecatb_unison_charge_rule, self) in
  2954.     #      confirm_ecatb_item
  2955.     # ucrx are strings of names of methods under DoubleX_RMVXA::ECATB
  2956.     # ucrx must return a symbol
  2957.     # You must implement the rule in ecatb_unison_rules
  2958.     # ucrx names can only use alphanumeric characters and can't use uppercase
  2959.     # letters
  2960.     # battler is the battler calling the ucrx
  2961.     # The below ucrx are examples added to help you set your ucrx
  2962.     # You can freely use, rewrite and/or delete these examples
  2963.  
  2964.     # Sets the unison charge rule as returning the maximum
  2965.     def self.ucr1(battler)
  2966.       :max
  2967.     end
  2968.  
  2969.     # Adds new ucrx here
  2970.    
  2971.  
  2972.     # Sets the default unison charge rule
  2973.     # It'll be used for def only if it's no ucrx to use
  2974.     # battler is the battler calling ecatb_unison_charge_rule
  2975.     # Example: To set the default unison charge rule as returning the minimum,
  2976.     # set this as %Q(:min)
  2977.     def self.ecatb_unison_charge_rule(battler)
  2978.       :avg
  2979.     end
  2980.  
  2981.     #--------------------------------------------------------------------------|
  2982.     #  Unison Cooldown Rule Notetag Values                                     |
  2983.     #  - Setups ucdrx used by <ecatb unison cooldown rule: ucdrx> notetags     |
  2984.     #--------------------------------------------------------------------------|
  2985.     # ucdrx are read at:
  2986.     # 1. RPG::UsableItem
  2987.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2988.     # ucdrx are used at:
  2989.     # 1. Game_Actor
  2990.     #    - @ecatb_unison_rule[:cooldown] = ecatb.send(
  2991.     #      @last_ecatb_item.ecatb_unison_cooldown_rule, self) in
  2992.     #      confirm_ecatb_item
  2993.     # ucdrx are strings of names of methods under DoubleX_RMVXA::ECATB
  2994.     # ucdrx must return a symbol
  2995.     # You must implement the rule in ecatb_unison_rules
  2996.     # ucdrx names can only use alphanumeric characters and can't use uppercase
  2997.     # letters
  2998.     # battler is the battler calling the ucdrx
  2999.     # The below UCDRX are examples added to help you set your ucdrx
  3000.     # You can freely use, rewrite and/or delete these examples
  3001.  
  3002.     # Sets the unison cooldown rule as returning the maximum
  3003.     def self.ucdr1(battler)
  3004.       :max
  3005.     end
  3006.  
  3007.     # Adds new ucdrx here
  3008.    
  3009.  
  3010.     # Sets the default unison charge rule
  3011.     # It'll be used for def only if it's no ucdrx to use
  3012.     # battler is the battler calling ecatb_unison_cooldown_rule
  3013.     # Example: To set the default unison cooldown rule as returning the minimum,
  3014.     # set this as %Q(:min)
  3015.     def self.ecatb_unison_cooldown_rule(battler)
  3016.       :avg
  3017.     end
  3018.  
  3019.     #--------------------------------------------------------------------------|
  3020.     #  Unison Actor Method Notetag Values                                      |
  3021.     #  - Setups uadx used by <ecatb unison actor def: uadx> notetags           |
  3022.     #--------------------------------------------------------------------------|
  3023.     # uadx are read at:
  3024.     # 1. RPG::UsableItem
  3025.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  3026.     # uadx are used at methods included in UNISON_DEFS
  3027.     # uadx are strings of names of methods under DoubleX_RMVXA::ECATB
  3028.     # uadx must return an array of actor ids
  3029.     # uadx names can only use alphanumeric characters and can't use uppercase
  3030.     # letters
  3031.     # battler is the battler calling the uadx
  3032.     # The below uadx are examples added to help you set your uadx
  3033.     # You can freely use, rewrite and/or delete these examples
  3034.  
  3035.     # Sets the def used to be those of actors with id x, y and z respectively
  3036.     def self.uad1(battler)
  3037.       [x, y, z]
  3038.     end
  3039.  
  3040.     # Adds new uadx here
  3041.    
  3042.  
  3043.     # Don't edit this unless you understand what it does and how it works
  3044.     def self.ecatb_unison_actor_def(battler)
  3045.       []
  3046.     end
  3047.  
  3048.     #--------------------------------------------------------------------------|
  3049.     #  Unison Method Rule Notetag Values                                       |
  3050.     #  - Setups udrx used by <ecatb unison def rule: udrx> notetags            |
  3051.     #--------------------------------------------------------------------------|
  3052.     # udrx are read at:
  3053.     # 1. RPG::UsableItem
  3054.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  3055.     # udrx are used at methods included in UNISON_DEFS
  3056.     # udrx are strings of names of methods under DoubleX_RMVXA::ECATB
  3057.     # udrx must return a symbol
  3058.     # You must implement the rule in ecatb_unison_rules
  3059.     # udrx names can only use alphanumeric characters and can't use uppercase
  3060.     # letters
  3061.     # battler is the battler calling the udrx
  3062.     # The below udrx are examples added to help you set your udrx
  3063.     # You can freely use, rewrite and/or delete these examples
  3064.  
  3065.     # Sets the unison method rule as returning the maximum
  3066.     UDR1 = %Q(:max)
  3067.     def self.udr1(battler)
  3068.       :max
  3069.     end
  3070.  
  3071.     # Adds new udrx here
  3072.    
  3073.  
  3074.     # Sets the default unison method rule
  3075.     # It'll be used for def only if it's no udrx to use
  3076.     # battler is the battler calling ecatb_unison_def_rule
  3077.     # Example: To set the default unison mthod rule as returning the minimum,
  3078.     # set this as %Q(:min)
  3079.     def self.ecatb_unison_def_rule(battler)
  3080.       :avg
  3081.     end
  3082.  
  3083.     #--------------------------------------------------------------------------|
  3084.     #  Unison Configurations                                                   |
  3085.     #  - Setups configurations of the unison features                          |
  3086.     #  - The value of each configuration is the string of the content of its   |
  3087.     #    corresponding method                                                  |
  3088.     #--------------------------------------------------------------------------|
  3089.  
  3090.     # Sets the battler methods to use the unison method rules
  3091.     # It can't be chnaged once set
  3092.     # Its keys must be the battler method name symbols
  3093.     # Methods with name method_name will be aliased to method_name_ecatb
  3094.     UNISON_DEFS = {
  3095.  
  3096.       # General Form:
  3097.       # [:method_class, :super_class] => [
  3098.       #   :method_name
  3099.       # ]
  3100.  
  3101.       [:Game_BattlerBase] => [
  3102.         :hp,
  3103.         :mp,
  3104.         :tp,
  3105.         :mhp,
  3106.         :mmp,
  3107.         :atk,
  3108.         :def,
  3109.         :mat,
  3110.         :mdf,
  3111.         :agi
  3112.         # Adds new methods here
  3113.        
  3114.       ],
  3115.  
  3116.       [:Game_Actor, :Game_Battler] => [
  3117.         :level
  3118.         # Adds new methods here
  3119.        
  3120.       ]
  3121.  
  3122.       # Adds new classes here
  3123.      
  3124.  
  3125.     }
  3126.  
  3127.     UNISON = {
  3128.  
  3129.       # Sets if all battlers using the unison skill/item are shown in the
  3130.       # battle log window
  3131.       # Its corresponding method's created under Game_Actor and Game_Enemy
  3132.       # Example: To show all battlers using the unison skill/item if switch with
  3133.       #          id x is on, set this as %Q($game_switches[x])
  3134.       :show_ecatb_unison_battlers => %Q(true),
  3135.  
  3136.       # Implements the unison method rules
  3137.       # The unison method of all unison battlers can be referneced by vals
  3138.       # The unison method rule can be referenced by rule
  3139.       # Its corresponding method's created under Game_Actor and Game_Enemy
  3140.       # It must return a real number
  3141.       :ecatb_unison_rules => %Q(
  3142.         if rule == :min
  3143.           vals.min
  3144.         elsif rule == :avg
  3145.           vals.inject(:+) / vals.size
  3146.         elsif rule == :max
  3147.           vals.max
  3148.         else
  3149.           0
  3150.         end
  3151.       )
  3152.  
  3153.     }
  3154.  
  3155. #==============================================================================|
  3156.  
  3157. #==============================================================================|
  3158. #  ** Script Implementations                                                   |
  3159. #     You need not edit this part as it's about how this script works          |
  3160. #     You need to understand the related parts of a configuration/notetag value|
  3161. #     locally to fully utilize that configuration/notetag value                |
  3162. #------------------------------------------------------------------------------|
  3163. #  * Script Support Info:                                                      |
  3164. #    1. Prerequisites                                                          |
  3165. #       - Thorough comprehension of how this script works on the user level    |
  3166. #       - Thorough comprehension of how Yanfly Engine Ace - Ace Battle Engine  |
  3167. #         works                                                                |
  3168. #       - Advanced RGSS3 scripting proficiency to fully comprehend this script |
  3169. #    2. Method documentation                                                   |
  3170. #       - The 1st part describes why this method's rewritten/aliased for       |
  3171. #         rewritten/aliased methods or what the method does for new methods    |
  3172. #       - The 2nd part describes what the arguments of the method are          |
  3173. #       - The 3rd part informs which version rewritten, aliased or created this|
  3174. #         method                                                               |
  3175. #       - The 4th part informs whether the method's rewritten or new           |
  3176. #       - The 5th part informs whether the method's a real or potential hotspot|
  3177. #       - The 6th part describes how this method works for new methods only,   |
  3178. #         and describes the parts added, removed or rewritten for rewritten or |
  3179. #         aliased methods only                                                 |
  3180. #       Example:                                                               |
  3181. # #--------------------------------------------------------------------------| |
  3182. # #  Why rewrite/alias/What this method does                                 | |
  3183. # #--------------------------------------------------------------------------| |
  3184. # # *argv: What these variables are                                            |
  3185. # # &argb: What this block is                                                  |
  3186. # def def_name(*argv, &argb) # Version X+; Rewrite/New; Hotspot                |
  3187. #   # Added/Removed/Rewritten to do something/How this method works            |
  3188. #   def_name_code                                                              |
  3189. #   #                                                                          |
  3190. # end # def_name                                                               |
  3191. #------------------------------------------------------------------------------|
  3192.  
  3193.     # Stores all types of configurations
  3194.     CONFIG = [CORE, ACTION, BAR, CANCEL, CHARGE, CLOCK, COOLDOWN, COUNTDOWN,
  3195.               FORCE, HOTKEY, ORDER, POOL, SE, SPEED, UNISON]
  3196.  
  3197.     # Stores all configurations having methods in BattleManager
  3198.     # General form: :config => [
  3199.     #                 %Q(arguments),
  3200.     #                 %Q(validation check),
  3201.     #                 %Q(default value)
  3202.     #               ]
  3203.     BATTLEMANAGER = {
  3204.       :ecatb_esc_init_cond => [
  3205.         %Q(),
  3206.         %Q(true),
  3207.         %Q((list = ecatb_input_list).size >= $game_party.battle_members.size &&
  3208.            list.all?(&DoubleX_RMVXA::ECATB::EIC1))
  3209.       ],
  3210.       :ecatb_esc_charge_cond => [
  3211.         %Q(),
  3212.         %Q(true),
  3213.         %Q($game_party.battle_members.all?(&DoubleX_RMVXA::ECATB::ECC1))
  3214.       ],
  3215.       :ecatb_esc_exec_cond => [
  3216.         %Q(),
  3217.         %Q(true),
  3218.         %Q($game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EEC1))
  3219.       ],
  3220.       :ecatb_esc_suc_cond => [
  3221.         %Q(),
  3222.         %Q(true),
  3223.         %Q((@preemptive || rand < @escape_ratio) &&
  3224.            $game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EIC1))
  3225.       ],
  3226.       :ecatb_base_fill_t => [
  3227.         %Q(),
  3228.         %Q(val.is_a?(Numeric) && val >= 0),
  3229.         %Q(10)
  3230.       ],
  3231.       :ecatb_ctb => [
  3232.         %Q(),
  3233.         %Q(true),
  3234.         %Q(false),
  3235.       ],
  3236.       :ecatb_battlers_def_sum => [
  3237.         %Q(),
  3238.         %Q(val.is_a?(Array) &&
  3239.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_sym])),
  3240.         %Q([:agi])
  3241.       ],
  3242.       :ecatb_def_sum_battlers => [
  3243.         %Q(),
  3244.         %Q(val.is_a?(Array) &&
  3245.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_game_battler])),
  3246.         %Q($game_party.alive_members + $game_troop.alive_members)
  3247.       ],
  3248.       :update_ecatb_battlers_def_sums => [
  3249.         %Q(),
  3250.         %Q(true),
  3251.         %Q(ecatb_def_sum_battlers.any?(
  3252.            &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_refresh]))
  3253.       ],
  3254.       :actor_sprite_ecatb_bar => [
  3255.         %Q(),
  3256.         %Q(true),
  3257.         %Q(false)
  3258.       ],
  3259.     }
  3260.  
  3261.     # Stores all configurations having methods in Game_Battler
  3262.     # General form: :config => [
  3263.     #                 %Q(arguments),
  3264.     #                 %Q(validation check),
  3265.     #                 %Q(default value)
  3266.     #               ]
  3267.     GAME_BATTLER = {
  3268.       :ecatb_rate_ord => [
  3269.         %Q(),
  3270.         %Q(val.is_a?(Array) &&
  3271.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3272.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3273.       ],
  3274.       :normal_actor_1st_ecatb_val => [
  3275.         %Q(),
  3276.         %Q(val.is_a?(Numeric) && val >= 0),
  3277.         %Q(0.0)
  3278.       ],
  3279.       :normal_enemy_1st_ecatb_val => [
  3280.         %Q(),
  3281.         %Q(val.is_a?(Numeric) && val >= 0),
  3282.         %Q(0.0)
  3283.       ],
  3284.       :preemptive_actor_1st_ecatb_val => [
  3285.         %Q(),
  3286.         %Q(val.is_a?(Numeric) && val >= 0),
  3287.         %Q(100.0)
  3288.       ],
  3289.       :preemptive_enemy_1st_ecatb_val => [
  3290.         %Q(),
  3291.         %Q(val.is_a?(Numeric) && val >= 0),
  3292.         %Q(0.0)
  3293.       ],
  3294.       :surprise_actor_1st_ecatb_val => [
  3295.         %Q(),
  3296.         %Q(val.is_a?(Numeric) && val >= 0),
  3297.         %Q(0.0)
  3298.       ],
  3299.       :surprise_enemy_1st_ecatb_val => [
  3300.         %Q(),
  3301.         %Q(val.is_a?(Numeric) && val >= 0),
  3302.         %Q(100.0)
  3303.       ],
  3304.       :ecatb_start_val_ord => [
  3305.         %Q(),
  3306.         %Q(val.is_a?(Array) &&
  3307.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3308.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3309.       ],
  3310.       :pre_ecatb_input_act => [
  3311.         %Q(),
  3312.         %Q(true),
  3313.         %Q()
  3314.       ],
  3315.       :post_ecatb_input_act => [
  3316.         %Q(),
  3317.         %Q(true),
  3318.         %Q()
  3319.       ],
  3320.       :pre_ecatb_reset => [
  3321.         %Q(),
  3322.         %Q(true),
  3323.         %Q()
  3324.       ],
  3325.       :post_ecatb_reset => [
  3326.         %Q(),
  3327.         %Q(true),
  3328.         %Q()
  3329.       ],
  3330.       :ecatb_bar_colors => [
  3331.         %Q(),
  3332.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3333.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3334.       ],
  3335.       :ecatb_bar_color_ord => [
  3336.         %Q(),
  3337.         %Q(val.is_a?(Array) &&
  3338.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3339.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3340.       ],
  3341.       :gradual_ecatb_action_gain => [
  3342.         %Q(),
  3343.         %Q(true),
  3344.         %Q(false),
  3345.       ],
  3346.       :gradual_ecatb_action_gain_ord => [
  3347.         %Q(),
  3348.         %Q(val.is_a?(Array) &&
  3349.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3350.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3351.       ],
  3352.       :ecatb_bar_multilayer => [
  3353.         %Q(),
  3354.         %Q(true),
  3355.         %Q(true)
  3356.       ],
  3357.       :ecatb_charge_bar_colors => [
  3358.         %Q(),
  3359.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3360.         %Q([Colour.text_colour(30), Colour.text_colour(31)])
  3361.       ],
  3362.       :ecatb_charge_bar_color_ord => [
  3363.         %Q(),
  3364.         %Q(val.is_a?(Array) &&
  3365.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3366.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3367.       ],
  3368.       :ecatb_cooldown_bar_colors => [
  3369.         %Q(),
  3370.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3371.         %Q([Colour.text_colour(19), Colour.text_colour(26)])
  3372.       ],
  3373.       :ecatb_cooldown_bar_color_ord => [
  3374.         %Q(),
  3375.         %Q(val.is_a?(Array) &&
  3376.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3377.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3378.       ],
  3379.       :ecatb_cooldown_finish => [
  3380.         %Q(),
  3381.         %Q(true),
  3382.         %Q()
  3383.       ],
  3384.       :ecatb_countdown_min => [
  3385.         %Q(),
  3386.         %Q(val.is_a?(Integer) && val >= 0),
  3387.         %Q(Graphics.frame_rate)
  3388.       ],
  3389.       :ecatb_order_battler_icon => [
  3390.         %Q(),
  3391.         %Q(val.is_a?(Array) && val[0].is_a?(Bitmap) && val[1].is_a?(Rect)),
  3392.         %Q(
  3393.        [Cache.system("Iconset"), Rect.new(121 % 16 * 24, 121 / 16 * 24, 24, 24)]
  3394.         )
  3395.       ],
  3396.       :ecatb_order_battler_icon_ord => [
  3397.         %Q(),
  3398.         %Q(val.is_a?(Array) &&
  3399.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3400.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3401.       ],
  3402.       :ecatb_order_battler_opacity => [
  3403.         %Q(),
  3404.         %Q(val.is_a?(Numeric) && val >= 0),
  3405.         %Q(255)
  3406.       ],
  3407.       :ecatb_order_battler_opacity_ord => [
  3408.         %Q(),
  3409.         %Q(val.is_a?(Array) &&
  3410.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3411.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3412.       ],
  3413.       :ecatb_order_battler_scale => [
  3414.         %Q(),
  3415.         %Q(val.is_a?(Numeric) && val >= 0),
  3416.         %Q(0.5)
  3417.       ],
  3418.       :ecatb_order_battler_scale_ord => [
  3419.         %Q(),
  3420.         %Q(val.is_a?(Array) &&
  3421.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3422.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3423.       ],
  3424.       :ecatb_order_battler_z => [
  3425.         %Q(),
  3426.         %Q(val.is_a?(Numeric) && val >= 0),
  3427.         %Q(500)
  3428.       ],
  3429.       :ecatb_order_battler_z_ord => [
  3430.         %Q(),
  3431.         %Q(val.is_a?(Array) &&
  3432.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3433.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3434.       ],
  3435.       :ecatb_order_battler_icon_x => [
  3436.         %Q(),
  3437.         %Q(val.is_a?(Numeric)),
  3438.         %Q(4)
  3439.       ],
  3440.       :ecatb_se_ready_act => [
  3441.         %Q(),
  3442.         %Q(true),
  3443.         %Q(nil)
  3444.       ],
  3445.       :ecatb_se_ready_act_ord => [
  3446.         %Q(),
  3447.         %Q(val.is_a?(Array) &&
  3448.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3449.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3450.       ],
  3451.       :ecatb_speed_reduce => [
  3452.         %Q(),
  3453.         %Q(val.is_a?(Numeric) && val >= 0),
  3454.         %Q(0)
  3455.       ],
  3456.       :ecatb_speed_reduce_ord => [
  3457.         %Q(),
  3458.         %Q(val.is_a?(Array) &&
  3459.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3460.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3461.       ],
  3462.       :show_ecatb_unison_battlers => [
  3463.         %Q(),
  3464.         %Q(true),
  3465.         %Q(true)
  3466.       ],
  3467.       :ecatb_unison_rules => [
  3468.         %Q((vals, rule)),
  3469.         %Q(val.is_a?(Numeric)),
  3470.         %Q(
  3471.     if rule == :min
  3472.       vals.min
  3473.     elsif rule == :avg
  3474.       vals.inject(:+) / vals.size
  3475.     elsif rule == :max
  3476.       vals.max
  3477.     end
  3478.         )
  3479.       ]
  3480.     }
  3481.  
  3482.     # Stores all configurations having methods in Game_Actor
  3483.     # General form: :config => [
  3484.     #                 %Q(arguments),
  3485.     #                 %Q(validation check),
  3486.     #                 %Q(default value)
  3487.     #               ]
  3488.     GAME_ACTOR = GAME_BATTLER.merge({
  3489.       :ecatb_esc_act_cost => [
  3490.         %Q(),
  3491.         %Q(val.is_a?(Numeric)),
  3492.         %Q(1)
  3493.       ],
  3494.       :ecatb_esc_reset_val => [
  3495.         %Q(),
  3496.         %Q(val.is_a?(Numeric)),
  3497.         %Q(0.0)
  3498.       ],
  3499.       :esc_ecatb_charge_rate => [
  3500.         %Q((charge)),
  3501.         %Q(val.is_a?(Numeric) && val >= 0),
  3502.         %Q(100.0)
  3503.       ],
  3504.       :esc_ecatb_cooldown_rate => [
  3505.         %Q((cooldown)),
  3506.         %Q(val.is_a?(Numeric) && val >= 0),
  3507.         %Q(100.0)
  3508.       ],
  3509.       :ecatb_order_actor_icon_y => [
  3510.         %Q(),
  3511.         %Q(val.is_a?(Numeric)),
  3512.         %Q(36)
  3513.       ]
  3514.     })
  3515.  
  3516.     # (v0.01a+)Stores all configurations having methods in Game_Enemy
  3517.     # General form: :config => [
  3518.     #                 %Q(arguments),
  3519.     #                 %Q(validation check),
  3520.     #                 %Q(default value)
  3521.     #               ]
  3522.     GAME_ENEMY = GAME_BATTLER.merge({
  3523.       :ecatb_order_enemy_icon_y => [
  3524.         %Q(),
  3525.         %Q(val.is_a?(Numeric)),
  3526.         %Q(8)
  3527.       ]
  3528.     })
  3529.  
  3530.     # Stores all configurations having methods in Game_Party and Game_Troop
  3531.     # General form: :config => [
  3532.     #                 %Q(arguments),
  3533.     #                 %Q(validation check),
  3534.     #                 %Q(default value)
  3535.     #               ]
  3536.     GAME_PARTY_TROOP = {
  3537.       :ecatb_pool_val => [
  3538.         %Q((vals)),
  3539.         %Q(val.is_a?(Numeric) && val >= 0),
  3540.         %Q(vals.empty? ? 0 : vals.inject(:+) / vals.size)
  3541.       ]
  3542.     }
  3543.  
  3544.     # Stores all configurations having methods in ECATB_Bar
  3545.     # General form: :config => [
  3546.     #                 %Q(arguments),
  3547.     #                 %Q(validation check),
  3548.     #                 %Q(default value)
  3549.     #               ]
  3550.     ECATB_BAR = {
  3551.       :ecatb_bar_ani => [
  3552.         %Q(),
  3553.         %Q(true),
  3554.         %Q(true)
  3555.       ],
  3556.       :ecatb_bar_ani_ox => [
  3557.         %Q(),
  3558.         %Q(val.is_a?(Numeric)),
  3559.         %Q(2)
  3560.       ],
  3561.       :ecatb_bar_wh => [
  3562.         %Q(),
  3563.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3564.            val[1].is_a?(Numeric) && val[1] >= 0),
  3565.         %Q([48, 12])
  3566.       ],
  3567.       :ecatb_bar_xy_offset => [
  3568.         %Q(),
  3569.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) &&val[1].is_a?(Numeric)),
  3570.         %Q([0, 0])
  3571.       ],
  3572.       :ecatb_bar_z => [
  3573.         %Q(),
  3574.         %Q(val.is_a?(Numeric) && val >= 0),
  3575.         %Q(0)
  3576.       ],
  3577.       :ecatb_bar_text => [
  3578.         %Q((percent, act)),
  3579.         %Q("val.is_a?(String)"),
  3580.         %Q(percent + "% " + act)
  3581.       ],
  3582.       :ecatb_bar_text_color => [
  3583.         %Q(),
  3584.         %Q(val.is_a?(Color)),
  3585.         %Q(Colour.text_colour(0))
  3586.       ],
  3587.       :ecatb_bar_text_size => [
  3588.         %Q(),
  3589.         %Q(val.is_a?(Numeric) && val >= 0),
  3590.         %Q(16)
  3591.       ],
  3592.       :ecatb_bar_text_xy_offset => [
  3593.         %Q(),
  3594.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3595.         %Q([-1, -1])
  3596.       ],
  3597.       :ecatb_bar_back_colors => [
  3598.         %Q(),
  3599.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3600.         %Q([Colour.text_colour(15), Colour.text_colour(15)])
  3601.       ]
  3602.     }
  3603.  
  3604.     # Stores all configurations having methods in ECATB_Clock_Bar
  3605.     # General form: :config => [
  3606.     #                 %Q(arguments),
  3607.     #                 %Q(validation check),
  3608.     #                 %Q(default value)
  3609.     #               ]
  3610.     ECATB_CLOCK_BAR = {
  3611.       :ecatb_clock_bar_colors => [
  3612.         %Q(),
  3613.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3614.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3615.       ],
  3616.       :ecatb_clock_bar_wh => [
  3617.         %Q(),
  3618.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3619.            val[1].is_a?(Numeric) && val[1] >= 0),
  3620.         %Q([112, 12])
  3621.       ],
  3622.       :ecatb_clock_bar_xy => [
  3623.         %Q(),
  3624.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3625.         %Q([8, 8])
  3626.       ]
  3627.     }
  3628.  
  3629.     # Stores all configurations having methods in Window_BattleStatus
  3630.     # General form: :config => [
  3631.     #                 %Q(arguments),
  3632.     #                 %Q(validation check),
  3633.     #                 %Q(default value)
  3634.     #               ]
  3635.     WINDOW_BATTLESTATUS = {
  3636.       :actor_ecatb_bar_text => [
  3637.         %Q((percent, act)),
  3638.         %Q(val.is_a?(String)),
  3639.         %Q(percent + "% " + act)
  3640.       ],
  3641.       :actor_ecatb_bar_word => [
  3642.         %Q(),
  3643.         %Q(val.is_a?(String)),
  3644.         %Q("AP")
  3645.       ],
  3646.       :actor_ecatb_bar_y_add => [
  3647.         %Q(),
  3648.         %Q(val.is_a?(Numeric)),
  3649.         %Q(12)
  3650.       ]
  3651.     }
  3652.  
  3653.     # Stores all configurations having methods in ECATB_Clock_Window
  3654.     # General form: :config => [
  3655.     #                 %Q(arguments),
  3656.     #                 %Q(validation check),
  3657.     #                 %Q(default value)
  3658.     #               ]
  3659.     ECATB_CLOCK_WINDOW = {
  3660.       :ecatb_clock_window_wh => [
  3661.         %Q(),
  3662.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3663.            val[1].is_a?(Numeric) && val[1] >= 0),
  3664.         %Q([128, 48])
  3665.       ],
  3666.       :ecatb_clock_window_xyz => [
  3667.         %Q(),
  3668.         %Q(val.is_a?(Array) &&
  3669.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3670.         %Q([0, 0, 0])
  3671.       ],
  3672.       :ecatb_clock_text => [
  3673.         %Q((cur_clock, max_clock, turn_count)),
  3674.         %Q(val.is_a?(String)),
  3675.         %Q(cur_clock.to_s + "/" + max_clock.to_s + " " + turn_count.to_s)
  3676.       ],
  3677.       :ecatb_clock_text_color => [
  3678.         %Q(),
  3679.         %Q(val.is_a?(Color)),
  3680.         %Q(Colour.text_colour(0))
  3681.       ],
  3682.       :ecatb_clock_text_size => [
  3683.         %Q(),
  3684.         %Q(val.is_a?(Numeric) && val >= 0),
  3685.         %Q(16)
  3686.       ],
  3687.       :ecatb_clock_text_xy => [
  3688.         %Q(),
  3689.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3690.         %Q([0, 4])
  3691.       ]
  3692.     }
  3693.  
  3694.     # Stores all configurations having methods in ECATB_Force_Window
  3695.     # General form: :config => [
  3696.     #                 %Q(arguments),
  3697.     #                 %Q(validation check),
  3698.     #                 %Q(default value)
  3699.     #               ]
  3700.     ECATB_FORCE_WINDOW = {
  3701.       :ecatb_force_window_wh => [
  3702.         %Q(),
  3703.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3704.            val[1].is_a?(Numeric) && val[1] >= 0),
  3705.         %Q([128, 40])
  3706.       ],
  3707.       :ecatb_force_window_xyz => [
  3708.         %Q(),
  3709.         %Q(val.is_a?(Array) &&
  3710.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3711.         %Q([0, 48, 0])
  3712.       ],
  3713.       :ecatb_force_nil_text => [
  3714.         %Q(),
  3715.         %Q(val.is_a?(String)),
  3716.         %Q("No Force ATB")
  3717.       ],
  3718.       :ecatb_force_run_text => [
  3719.         %Q(),
  3720.         %Q(val.is_a?(String)),
  3721.         %Q("ATB Force Run")
  3722.       ],
  3723.       :ecatb_force_stop_text => [
  3724.         %Q(),
  3725.         %Q(val.is_a?(String)),
  3726.         %Q("ATB Force Stop")
  3727.       ],
  3728.       :ecatb_force_text_color => [
  3729.         %Q(),
  3730.         %Q(val.is_a?(Color)),
  3731.         %Q(Colour.text_colour(0))
  3732.       ],
  3733.       :ecatb_force_text_size => [
  3734.         %Q(),
  3735.         %Q(val.is_a?(Numeric) && val >= 0),
  3736.         %Q(16)
  3737.       ],
  3738.       :ecatb_force_text_xy => [
  3739.         %Q(),
  3740.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3741.         %Q([0, 0])
  3742.       ]
  3743.     }
  3744.  
  3745.     # (v0.01a+)Stores all configurations having methods in ECATB_Order_Window
  3746.     # General form: :config => [
  3747.     #                 %Q(arguments),
  3748.     #                 %Q(validation check),
  3749.     #                 %Q(default value)
  3750.     #               ]
  3751.     ECATB_ORDER_WINDOW = {
  3752.       :ecatb_order_window_wh => [
  3753.         %Q(),
  3754.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3755.            val[1].is_a?(Numeric) && val[1] >= 0),
  3756.         %Q([128, 60])
  3757.       ],
  3758.       :ecatb_order_window_xyz => [
  3759.         %Q(),
  3760.         %Q(val.is_a?(Array) &&
  3761.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3762.         %Q([0, 88, 0])
  3763.       ],
  3764.       :ecatb_order_bar_colors => [
  3765.         %Q(),
  3766.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3767.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3768.       ],
  3769.       :ecatb_order_charge_bar_colors => [
  3770.         %Q(),
  3771.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3772.         %Q([Colour.text_colour(30), Colour.text_colour(31)])
  3773.       ],
  3774.       :ecatb_order_cooldown_bar_colors => [
  3775.         %Q(),
  3776.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3777.         %Q([Colour.text_colour(19), Colour.text_colour(26)])
  3778.       ],
  3779.       :ecatb_order_bar_wh => [
  3780.         %Q(),
  3781.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3782.            val[1].is_a?(Numeric) && val[1] >= 0),
  3783.         %Q([108, 12])
  3784.       ],
  3785.       :ecatb_order_bar_xy => [
  3786.         %Q(),
  3787.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3788.         %Q([0, 12])
  3789.       ],
  3790.       :ecatb_order_bar_text => [
  3791.         %Q(),
  3792.         %Q(val.is_a?(String)),
  3793.         %Q("ATB")
  3794.       ],
  3795.       :ecatb_order_charge_bar_text => [
  3796.         %Q(),
  3797.         %Q(val.is_a?(String)),
  3798.         %Q("Charge")
  3799.       ],
  3800.       :ecatb_order_cooldown_bar_text => [
  3801.         %Q(),
  3802.         %Q(val.is_a?(String)),
  3803.         %Q("Cool")
  3804.       ],
  3805.       :ecatb_order_text_color => [
  3806.         %Q(),
  3807.         %Q(val.is_a?(Color) || val.is_a?(Color)),
  3808.         %Q(Colour.text_colour(0))
  3809.       ],
  3810.       :ecatb_order_text_size => [
  3811.         %Q(),
  3812.         %Q(val.is_a?(Numeric) && val >= 0),
  3813.         %Q(12)
  3814.       ],
  3815.       :ecatb_order_text_xy => [
  3816.         %Q(),
  3817.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3818.         %Q([2, 14])
  3819.       ]
  3820.     }
  3821.  
  3822.     # Stores all configurations having methods in ECATB_Pool_Window
  3823.     # General form: :config => [
  3824.     #                 %Q(arguments),
  3825.     #                 %Q(validation check),
  3826.     #                 %Q(default value)
  3827.     #               ]
  3828.     ECATB_POOL_WINDOW = {
  3829.       :ecatb_pool_window_wh => [
  3830.         %Q(),
  3831.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3832.            val[1].is_a?(Numeric) && val[1] >= 0),
  3833.         %Q([128, 56])
  3834.       ],
  3835.       :ecatb_pool_window_xyz => [
  3836.         %Q(),
  3837.         %Q(val.is_a?(Array) &&
  3838.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3839.         %Q([0, 148, 0])
  3840.       ],
  3841.       :ecatb_pool_party_actor_text => [
  3842.         %Q(),
  3843.         %Q(val.is_a?(Array) && val[0].is_a?(String) && val[1].is_a?(String)),
  3844.         %Q(["Party ATB", "Actor ATB"])
  3845.       ],
  3846.       :ecatb_pool_troop_enemy_text => [
  3847.         %Q(),
  3848.         %Q(val.is_a?(Array) && val[0].is_a?(String) && val[1].is_a?(String)),
  3849.         %Q(["Troop ATB", "Enemy ATB"])
  3850.       ],
  3851.       :ecatb_pool_text_color => [
  3852.         %Q(),
  3853.         %Q(val.is_a?(Color)),
  3854.         %Q(Colour.text_colour(0))
  3855.       ],
  3856.       :ecatb_pool_text_size => [
  3857.         %Q(),
  3858.         %Q(val.is_a?(Numeric) && val >= 0),
  3859.         %Q(16)
  3860.       ],
  3861.       :ecatb_pool_party_text_xy => [
  3862.         %Q(),
  3863.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3864.         %Q([0, 8])
  3865.       ],
  3866.       :ecatb_pool_troop_text_xy => [
  3867.         %Q(),
  3868.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3869.         %Q([0, -8])
  3870.       ]
  3871.     }
  3872.  
  3873.     # Stores all configurations having methods in Scene_Battle
  3874.     # General form: :config => [
  3875.     #                 %Q(arguments),
  3876.     #                 %Q(validation check),
  3877.     #                 %Q(default value)
  3878.     #               ]
  3879.     SCENE_BATTLE = {
  3880.       :ecatb_wait_cond => [
  3881.         %Q(),
  3882.         %Q(true),
  3883.         %Q(#{WC1} || #{WC2} && (#{WC3} || #{WC4} || #{WC5} || #{WC6} ||
  3884.            #{WC7} || #{WC8} || #{WC9} || #{WC10} || #{WCC1}))
  3885.       ],
  3886.       :ecatb_turn_type => [
  3887.         %Q(),
  3888.         %Q(val == :tick || val == :act || val == :battler),
  3889.         %Q(:tick)
  3890.       ],
  3891.       :ecatb_tick_count => [
  3892.         %Q(),
  3893.         %Q(val.is_a?(Numeric) && val >= 0),
  3894.         %Q(10)
  3895.       ],
  3896.       :ecatb_after_act => [
  3897.         %Q(),
  3898.         %Q(val.is_a?(Numeric) && val >= 0),
  3899.         %Q(10)
  3900.       ],
  3901.       :ecatb_battler_scale => [
  3902.         %Q(),
  3903.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3904.            (val[1] == :tick || val[1] == :act)),
  3905.         %Q([1, :tick])
  3906.       ],
  3907.       :ecatb_battler_count => [
  3908.         %Q(),
  3909.         %Q(val.is_a?(Numeric) && val >= 0),
  3910.         %Q($game_party.alive_members.size + $game_troop.alive_members.size)
  3911.       ],
  3912.       :ecatb_force_act_count => [
  3913.         %Q(),
  3914.         %Q(true),
  3915.         %Q(false)
  3916.       ],
  3917.       :pre_ecatb_update => [
  3918.         %Q(),
  3919.         %Q(true),
  3920.         %Q()
  3921.       ],
  3922.       :post_ecatb_update => [
  3923.         %Q(),
  3924.         %Q(true),
  3925.         %Q()
  3926.       ],
  3927.       :ecatb_cancel_key => [
  3928.         %Q(),
  3929.         %Q(val.is_a?(Symbol)),
  3930.         %Q(:SHIFT)
  3931.       ],
  3932.       :ecatb_cancel_text=> [
  3933.         %Q(),
  3934.         %Q(val.is_a?(String)),
  3935.         %Q("Select an actor without autobattle norconfusion to\ncancel " +
  3936.            "his/her/its partially charging skill/item.")
  3937.       ],
  3938.       :ecatb_force_run_key => [
  3939.         %Q(),
  3940.         %Q(val.is_a?(Symbol)),
  3941.         %Q(:CTRL)
  3942.       ],
  3943.       :ecatb_force_stop_key => [
  3944.         %Q(),
  3945.         %Q(val.is_a?(Symbol)),
  3946.         %Q(:ALT)
  3947.       ],
  3948.       :ecatb_battler_hotkeys => [
  3949.         %Q(),
  3950.         %Q(val.is_a?(Array) &&
  3951.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_sym])),
  3952.         %Q([:NUMPAD1, :NUMPAD2, :NUMPAD3, :NUMPAD4, :NUMPAD5, :NUMPAD6,
  3953.             :NUMPAD7, :NUMPAD8, :NUMPAD9, :NUMPAD0])
  3954.       ]
  3955.     }
  3956.  
  3957.     # Stores all iterator blocks
  3958.     # General form: :def_name => iterator_block
  3959.     BLOCKS = {
  3960.       :check_game_battler => -> v { v.is_a?(Game_Battler) },
  3961.       :check_ord => -> v { v == :states || v == :enemies || v == :armors ||
  3962.                            v == :weapons || v == :classes || v == :actors },
  3963.       :check_sym => -> v { v.is_a?(Symbol) },
  3964.       :check_us_num => -> v { v.is_a?(Numeric) && v >= 0 },
  3965.       :close_ecatb_windows => -> window { window.hide.deactivate.close },
  3966.       :clear_ecatb_blocks => -> mem { mem.clear_ecatb_blocks },
  3967.       :create_ecatb_defs => -> mem { mem.create_ecatb_defs },
  3968.       :dispose => -> obj { obj.dispose if obj && !obj.disposed? },
  3969.       :ecatb_ctb_break? => -> b { b.actor? && b.ecatb_inputable? ||
  3970.                                   b.exec_ecatb_act? },
  3971.       :ecatb_reset => -> mem { mem.ecatb_reset },
  3972.       :ecatb_input_list_1 => -> actor { actor.ecatb_inputable? },
  3973.       :ecatb_input_list_2 => -> actor { actor.index },
  3974.       :ecatb_on_turn_end => -> mem { mem.on_turn_end },
  3975.       :ecatb_refresh => -> battler { battler.ecatb_refresh },
  3976.       :ecatb_update_windows => -> w { w.hide.deactivate.close if w.active },
  3977.       :ecatb_updates => -> mem { mem.ecatb_updates },
  3978.       :init_ecatb_escape => -> mem { mem.init_ecatb_escape },
  3979.       :load_ecatb_notes => -> d { d.each(&BLOCKS[:load_ecatb_notes_each]) },
  3980.       :load_ecatb_notes_each => -> obj { obj.load_ecatb_notes if obj },
  3981.       :pay_ecatb_act_cost => -> actor { actor.pay_ecatb_act_cost },
  3982.       :pay_ecatb_esc_cost => -> mem { mem.pay_ecatb_esc_cost if mem.ecatb_esc },
  3983.       :refresh_ecatb_windows => ->  window { window.refresh if window.active },
  3984.       :reset_ecatb_blocks => -> mem { mem.reset_ecatb_blocks },
  3985.       :reset_ecatb_refresh => -> battler { battler.ecatb_refresh = false },
  3986.       :sort_screen_x => -> a, b { a.screen_x - b.screen_x },
  3987.       :update => -> obj { obj.update },
  3988.       :update_ecatb_pool => -> unit {
  3989.         next unless unit.ecatb_pool
  3990.         if (members = unit.alive_members).any?(&BLOCKS[:update_ecatb_pool_any])
  3991.           val = members.collect(&BLOCKS[:update_ecatb_pool_collect])
  3992.           max = val.max
  3993.           size = val.size
  3994.           val = unit.ecatb_pool_val(val)
  3995.           val = max if max - val <= Float::EPSILON * size * max
  3996.           members.each { |mem|
  3997.             mem.ecatb_val[:atb] = val
  3998.             mem.ecatb_val_change = false
  3999.           }
  4000.         end
  4001.         next unless members.all?(&BLOCKS[:update_ecatb_pool_all])
  4002.         act = 0
  4003.         members.each { |mem|
  4004.           next if mem.ecatb_act_times_cap
  4005.           mem.ecatb_act_times_cap = false
  4006.           act += mem.ecatb_act_times_add
  4007.           mem.ecatb_act_times -= mem.ecatb_act_times_add
  4008.           mem.ecatb_act_times_add = 0
  4009.         }
  4010.         members.each { |mem| mem.ecatb_act_times += act } if act > 0
  4011.       },
  4012.       :update_ecatb_pool_any => -> mem { mem.ecatb_val_change },
  4013.       :update_ecatb_pool_collect => -> mem { mem.ecatb_val[:atb] },
  4014.       :update_ecatb_pool_all => -> mem { mem.ecatb_act_times_add > 0 },
  4015.       :update_ecatb_unison => -> mem {
  4016.         next unless mem.ecatb_unison_invoker
  4017.         actors = mem.ecatb_unison_actors
  4018.         if actors.any?(&BLOCKS[:update_ecatb_unison_any_1])
  4019.           type = :charge
  4020.         elsif actors.any?(&BLOCKS[:update_ecatb_unison_any_2])
  4021.           actors &= $game_party.alive_members
  4022.           type = :cooldown
  4023.         else
  4024.           next
  4025.         end
  4026.         val = actors.collect { |actor| actor.ecatb_val[type] }
  4027.         val = mem.ecatb_unison_rules(val, mem.ecatb_unison_rule[type])
  4028.         actors.each { |actor| actor.ecatb_val[type] = val }
  4029.       },
  4030.       :update_ecatb_unison_any_1 => -> actor { actor.ecatb_val[:charge] > 0.0 },
  4031.       :update_ecatb_unison_any_2 => -> a { a.ecatb_val[:cooldown] > 0.0 },
  4032.       :usable? => -> actor_id { $game_actors[actor_id] },
  4033.       :window_battleenemy_update => -> m { m.sprite_effect_type = :whiten }
  4034.     }
  4035.  
  4036.     # Stores all regular expressions of the non-usableitem notetags
  4037.     REGEX = [
  4038.       /< *ecatb +color *: *(\w+) *, *(\d+) *, *(\w+) *>/i,
  4039.       /< *ecatb +gradual +action +gain *: *(\w+) *>/i,
  4040.       /< *ecatb +order +battler +icon *: *(\w+) *>/i,
  4041.       /< *ecatb +order +battler +opacity *: *(\w+) *>/i,
  4042.       /< *ecatb +order +battler +scale *: *(\w+) *>/i,
  4043.       /< *ecatb +order +battler +z *: *(\w+) *>/i,
  4044.       /< *ecatb +rate *: *(\w+) *>/i,
  4045.       /< *ecatb +se +ready +act *: *(\w+) *>/i,
  4046.       /< *ecatb +speed +reduce *: *(\w+) *>/i,
  4047.       /< *ecatb +start +val *: *(\d+) *, *(\w+) *>/i,
  4048.       /< *enemy +ecatb +bar +show *: *(\w+) *, *(\w+) *, *(\w+) *, *(\w+) *>/i,
  4049.       /< *ecatb +countdown +interval *: *(\w+) *>/i,
  4050.       /< *ecatb +act +cost *: *(\w+) *>/i,
  4051.       /< *ecatb +charge +prior +act +cost *: *(\w+) *>/i,
  4052.       /< *ecatb +charge +prior +item +cost *: *(\w+) *>/i,
  4053.       /< *ecatb +charge +rate *: *(\w+) *>/i,
  4054.       /< *ecatb +cooldown +rate *: *(\w+) *>/i,
  4055.       /< *ecatb +force +act +cost *: *(\w+) *>/i,
  4056.       /< *ecatb +reset +val *: *(\w+) *>/i,
  4057.       /< *ecatb +unison +actor *: *(\w+) *>/i,
  4058.       /< *ecatb +unison +charge +rule *: *(\w+) *>/i,
  4059.       /< *ecatb +unison +cooldown +rule *: *(\w+) *>/i,
  4060.       /< *ecatb +unison +actor +(\w+) *: *(\w+) *>/i,
  4061.       /< *ecatb +unison +(\w+) +rule *: *(\w+) *>/
  4062.     ]
  4063.  
  4064.     # Stores all regular expressions of the usableitem notetags
  4065.     USABLEITEM_NOTES = [
  4066.       "ecatb_act_cost",
  4067.       "ecatb_charge_prior_act_cost",
  4068.       "ecatb_charge_prior_item_cost",
  4069.       "ecatb_charge_rate",
  4070.       "ecatb_cooldown_rate",
  4071.       "ecatb_force_act_cost",
  4072.       "ecatb_reset_val",
  4073.       "ecatb_unison_actor",
  4074.       "ecatb_unison_charge_rule",
  4075.       "ecatb_unison_cooldown_rule",
  4076.       "ecatb_unison_actor_def",
  4077.       "ecatb_unison_def_rule"
  4078.     ]
  4079.  
  4080.     #Stores all pieces of codes used for reading notetags in all database parts
  4081.     NOTE_START = %Q(
  4082.   attr_reader :ecatb_notes
  4083.   def load_ecatb_notes
  4084.     @ecatb_notes = {}
  4085.     ecatb = DoubleX_RMVXA::ECATB
  4086.     )
  4087.     NOTE_MID = %Q(
  4088.     [:atb, :charge, :cooldown, :rate, :speed, :start_0, :start_1, :start_2].
  4089.     each { |note| @ecatb_notes[note] = [] }
  4090.     @note.split(/[\r\n]+/).each { |line|
  4091.       if line =~ ecatb::REGEX[0]
  4092.         next @ecatb_notes[$1.downcase.to_sym][$2.to_i] ||= $3.downcase.to_sym
  4093.       elsif line =~ ecatb::REGEX[1]
  4094.         next @ecatb_notes[:act] = $1.downcase.to_sym
  4095.       elsif line =~ ecatb::REGEX[2]
  4096.         next @ecatb_notes[:order_icon] = $1.downcase.to_sym
  4097.       elsif line =~ ecatb::REGEX[3]
  4098.         next @ecatb_notes[:order_opacity] = $1.downcase.to_sym
  4099.       elsif line =~ ecatb::REGEX[4]
  4100.         next @ecatb_notes[:order_scale] = $1.downcase.to_sym
  4101.       elsif line =~ ecatb::REGEX[5]
  4102.         next @ecatb_notes[:order_z] = $1.downcase.to_sym
  4103.       elsif line =~ ecatb::REGEX[6]
  4104.         next @ecatb_notes[:rate] << $1.downcase.to_sym
  4105.       elsif line =~ ecatb::REGEX[7]
  4106.         next @ecatb_notes[:se] = $1.downcase.to_sym
  4107.       elsif line =~ ecatb::REGEX[8]
  4108.         next @ecatb_notes[:speed] << $1.downcase.to_sym
  4109.       elsif line =~ ecatb::REGEX[9]
  4110.         next @ecatb_notes[("start_" + $1).to_sym] << $2.downcase.to_sym
  4111.     )
  4112.     NOTE_QUARTER = %Q(
  4113.       end
  4114.     }
  4115.     )
  4116.     NOTE_END = %Q(
  4117.   end
  4118.     )
  4119.     BAR_NOTE_START = %Q(
  4120.   attr_accessor :enemy_ecatb_bar_show
  4121.     )
  4122.     BAR_NOTE_MID = %Q(
  4123.     @enemy_ecatb_bar_show = [
  4124.       eval(ecatb::BAR_KILL_ENEMY_1ST),
  4125.       eval(ecatb::ENEMY_BAR_SHOW),
  4126.       eval(ecatb::ENEMY_BAR_SHOW_PERCENT),
  4127.       eval(ecatb::ENEMY_BAR_SHOW_ACT),
  4128.     ]
  4129.     )
  4130.     BAR_NOTE_END = %Q(
  4131.       elsif line =~ ecatb::REGEX[10]
  4132.         next @enemy_ecatb_bar_show = [eval($1.downcase), eval($2.downcase),
  4133.         eval($3.downcase), eval($4.downcase)]
  4134.     )
  4135.     COUNTDOWN_NOTE_START = %Q(
  4136.   attr_accessor :ecatb_countdown_interval
  4137.     )
  4138.     COUNTDOWN_NOTE_MID = %Q(
  4139.       elsif line =~ ecatb::REGEX[11]
  4140.         next @ecatb_countdown_interval = $1.downcase.to_sym
  4141.     )
  4142.     COUNTDOWN_NOTE_END = %Q(
  4143.     @auto_removal_timing = 3 if @ecatb_countdown_interval
  4144.     )
  4145.  
  4146.     # Stores the method load_ecatb_notes in actors, classes and equips
  4147.     CLASS_NOTES = EQUIP_NOTES = ACTOR_NOTES = NOTE_START + NOTE_MID +
  4148.     NOTE_QUARTER + NOTE_END
  4149.  
  4150.     # Stores the method load_ecatb_notes in enemies
  4151.     ENEMY_NOTES = BAR_NOTE_START + NOTE_START + %Q(
  4152.     t, f, n = true, false, nil
  4153.     ) + BAR_NOTE_MID + NOTE_MID + BAR_NOTE_END + NOTE_QUARTER + NOTE_END
  4154.  
  4155.     # Stores the method load_ecatb_notes in states
  4156.     STATE_NOTES = BAR_NOTE_START + COUNTDOWN_NOTE_START + NOTE_START +
  4157.                   BAR_NOTE_MID + NOTE_MID + COUNTDOWN_NOTE_MID + BAR_NOTE_END +
  4158.                   NOTE_QUARTER + COUNTDOWN_NOTE_END + NOTE_END
  4159.  
  4160.     # Stores the abstract method creator and validator for all configurations
  4161.     CHECK_RESET_DEF = {}
  4162.     [:BATTLEMANAGER, :GAME_ACTOR, :GAME_ENEMY, :GAME_PARTY_TROOP,
  4163.      :WINDOW_BATTLESTATUS, :ECATB_CLOCK_WINDOW, :ECATB_BAR, :ECATB_CLOCK_BAR,
  4164.      :ECATB_FORCE_WINDOW, :ECATB_ORDER_WINDOW, :ECATB_POOL_WINDOW,
  4165.      :SCENE_BATTLE].each { |key|
  4166.       CHECK_RESET_DEF[key] = %Q(
  4167.   def create_ecatb_defs
  4168.     DoubleX_RMVXA::ECATB::#{key.id2name}.each_key { |config|
  4169.       create_ecatb_def(config) unless respond_to?(config)
  4170.     }
  4171.   end
  4172.  
  4173.   def check_ecatb_def(config, check)
  4174.     percent = act = ""
  4175.     charge = cooldown = cur_clock = max_clock = turn_count = rule = -1
  4176.     vals = []
  4177.     #{RESCUE_CONFIG_VAL ? "begin" : ""}
  4178.     val = eval(config + check[0])
  4179.     reset_ecatb_def(config, check, "is invalid.") unless eval(check[1])
  4180.     #{RESCUE_CONFIG_VAL ? %Q(rescue Exception => error
  4181.     msgbox("This error message's raised:\n" + error.message)
  4182.     reset_ecatb_def(config, check, "could crash the game.")
  4183.     end) : ""}
  4184.   end
  4185.  
  4186.   def reset_ecatb_def(config, check, type)
  4187.     #{RESET_CONFIG_VAL ? "" : "return"}
  4188.     #{SUPPRESS_RESET_CONFIG_VAL_TEXT ? "" : %Q(msgbox("The validation code " +
  4189.     "of " + config + " is\n" + check[1])
  4190.     msgbox("The value of " +
  4191.     config + " is\n" + $game_system.send(config.to_sym) + "\nwhich " + type))}
  4192.     $game_system.send((config + "=").to_sym, check[2])
  4193.     create_ecatb_def(config.to_sym, false)
  4194.     #{SUPPRESS_RESET_CONFIG_VAL_TEXT ? "" : %Q(msgbox(
  4195.     "Its value is reset to its default:\n" + check[2]))}
  4196.   end
  4197.       )
  4198.     }
  4199.  
  4200.     # (v0.02c+)Returns the atb charge gain and cooldown loss rate
  4201.     CHARGE_COOLDOWN_RATE = {}
  4202.     [:charge, :cooldown].each { |key|
  4203.       CHARGE_COOLDOWN_RATE[key] = %Q(
  4204.   def ecatb_#{type = key.id2name}_#{key == :charge ? "gain" : "loss"}_rate
  4205.     return @ecatb_rate[:#{type}] unless (@last_ecatb_rate[:#{type}] !=
  4206.     @last_ecatb_rate[:#{type}] = ecatb_gain_rate) ||
  4207.     @ecatb_item_change[:#{type}]
  4208.     @ecatb_item_change[:#{type}] = false
  4209.     @ecatb_rate[:#{type}] = if @#{key == :charge ? "" : "fail_"}ecatb_esc
  4210.       esc_ecatb_#{type}_rate(@last_ecatb_rate[:#{type}])
  4211.     else
  4212.       DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_#{type}_rate, self,
  4213.       @last_ecatb_rate[:#{type}])
  4214.     end
  4215.   end
  4216.       )
  4217.     }
  4218.  
  4219.     # (v0.01a+)Reads all atb order battler icon, opacity, scale and z notetags
  4220.     ORDER = {}
  4221.     [:icon, :opacity, :scale, :z].each { |key|
  4222.       type = key.id2name
  4223.       ORDER[key] = %Q(
  4224.   def set_ecatb_order_battler_#{type}
  4225.     unless ecatb_battler_change?(:order_#{type})
  4226.       return @ecatb_notes[:order_#{type}]
  4227.     end
  4228.     @ecatb_notes[:order_#{type}] = nil
  4229.     ecatb_order_battler_#{type}_ord.each { |data|
  4230.       if send(@ecatb_item[data][0])
  4231.         set_ecatb_notes(send(@ecatb_item[data][1]), :order_#{type})
  4232.       end
  4233.       return @ecatb_notes[:order_#{type}] if @ecatb_notes[:order_#{type}]
  4234.     }
  4235.     @ecatb_notes[:order_#{type}] = ecatb_order_battler_#{type}
  4236.   end
  4237.       )
  4238.     }
  4239.  
  4240.     # Processes actor hotkeys used by Window_ActorCommand and Window_BattleActor
  4241.     ACTOR_HOTKEY = %Q(
  4242.   alias process_handling_ecatb process_handling
  4243.   def process_handling
  4244.     if BattleManager.btype?(:ecatb) && open? && active
  4245.       SceneManager.scene.ecatb_battler_hotkeys.each(&@ecatb_hotkey_block)
  4246.     end
  4247.     process_handling_ecatb
  4248.   end # process_handling
  4249.     )
  4250.  
  4251.     # Updates the positions, width and height and text font update methods
  4252.     WINDOW_DEFS = {}
  4253.     [:clock, :force, :order, :pool].each { |key|
  4254.       klass = key.id2name
  4255.       WINDOW_DEFS[key] = %Q(
  4256.   def update_pos
  4257.     xyz = ecatb_#{klass}_window_xyz
  4258.     self.x = xyz[0] if x != xyz[0]
  4259.     self.y = xyz[1] if y != xyz[1]
  4260.     self.z = xyz[2] if z != xyz[2]
  4261.   end
  4262.  
  4263.   def update_wh
  4264.     wh = ecatb_#{klass}_window_wh
  4265.     self.width = wh[0] if width != wh[0]
  4266.     self.height = wh[1] if height != wh[1]
  4267.   end
  4268.  
  4269.   def update_text_font
  4270.     if (font = contents.font).color != color = ecatb_#{klass}_text_color
  4271.       font.color = color
  4272.     end
  4273.     return if font.size == size = ecatb_#{klass}_text_size
  4274.     font.size = size
  4275.   end
  4276.       )
  4277.     }
  4278.  
  4279.     # (v0.04d+)Processes the skill/item target cancellation command
  4280.     ON_TARGET_CANCEL = {}
  4281.     [:actor, :enemy].each { |key|
  4282.       ON_TARGET_CANCEL[key] = %Q(
  4283.   alias on_#{key = key.id2name}_cancel_ecatb on_#{key}_cancel
  4284.   def on_#{key}_cancel(*argv, &argb)
  4285.     return unless actor = BattleManager.actor
  4286.     if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:cancel, @#{key}_window)
  4287.       return
  4288.     end
  4289.     on_#{key}_cancel_ecatb(*argv, &argb)
  4290.     @status_window.draw_item(actor.index)
  4291.   end
  4292.       )
  4293.     }
  4294.  
  4295.     # (v0.04d+)Processes the skill/item selection confirmation command
  4296.     ON_SKILL_ITEM_OK = {}
  4297.     [:skill, :item].each { |key|
  4298.       ON_SKILL_ITEM_OK[key] = %Q(
  4299.   alias on_#{key = key.id2name}_ok_ecatb on_#{key}_ok
  4300.   def on_#{key}_ok(*argv, &argb)
  4301.     return unless actor = BattleManager.actor
  4302.     return if on_ecatb_unison_item_ok?(@#{key}_window)
  4303.     on_#{key}_ok_ecatb(*argv, &argb)
  4304.     @status_window.draw_item(actor.index)
  4305.   end
  4306.       )
  4307.     }
  4308.  
  4309.     # (v0.01b+)Creates the atb force, order and pool windows
  4310.     CREATE_WINDOW = {}
  4311.     [:Force, :Order, :Pool].each { |key|
  4312.       name1 = key.id2name
  4313.       CREATE_WINDOW[key] = %Q(
  4314.   def create_ecatb_#{name2 = name1.downcase}_window
  4315.     return if @ecatb_#{name2}_window
  4316.     return unless eval($game_system.show_ecatb_#{name2}_window)
  4317.     @ecatb_#{name2}_window =
  4318.     ECATB_#{name1}_Window.new#{key == :Force ? "(@ecatb_force_clock)" : ""}
  4319.   end
  4320.       )
  4321.     }
  4322.  
  4323.     # (v0.01b+)Closes the atb clock, force, order and pool windows
  4324.     CLOSE_WINDOW = {}
  4325.     [:clock, :force, :order, :pool].each { |key|
  4326.       CLOSE_WINDOW[key] = %Q(
  4327.   def close_ecatb_#{name = key.id2name}_window
  4328.     @ecatb_#{name}_window.hide.deactivate.close
  4329.     @ecatb_#{name}_window.dispose unless @ecatb_#{name}_window.disposed?
  4330.     @ecatb_#{name}_window = nil
  4331.   end
  4332.       )
  4333.     }
  4334.  
  4335.   end # ECATB
  4336.  
  4337. end # DoubleX_RMVXA
  4338.  
  4339. if $imported["YEA-BattleEngine"] && !$imported["YSA-CATB"]
  4340.  
  4341. #------------------------------------------------------------------------------|
  4342.  
  4343. #------------------------------------------------------------------------------|
  4344. #  * Load all data's notetags and fixes bugs and edge cases                    |
  4345. #------------------------------------------------------------------------------|
  4346. class << DataManager # Edit
  4347.  
  4348.   #----------------------------------------------------------------------------|
  4349.   #  Loads all this script's notetags from the database as well                |
  4350.   #----------------------------------------------------------------------------|
  4351.   alias load_database_ecatb load_database
  4352.   def load_database(*argv, &argb)
  4353.     load_database_ecatb(*argv, &argb)
  4354.     load_ecatb_notes # Added
  4355.   end # load_database
  4356.  
  4357.   #----------------------------------------------------------------------------|
  4358.   #  Clears and resets all battlers' blocks before and after saving also       |
  4359.   #----------------------------------------------------------------------------|
  4360.   alias save_game_without_rescue_ecatb save_game_without_rescue
  4361.   def save_game_without_rescue(index, &argb)
  4362.     clear_ecatb_blocks # Added
  4363.     save_game_without_rescue_ecatb(index, &argb)
  4364.     init_ecatb_def_blocks # Added
  4365.   end # save_game_without_rescue
  4366.  
  4367.   #----------------------------------------------------------------------------|
  4368.   #  Resets all battlers' blocks and methods after loading as well             |
  4369.   #----------------------------------------------------------------------------|
  4370.   alias extract_save_contents_ecatb extract_save_contents
  4371.   def extract_save_contents(contents, &argb)
  4372.     extract_save_contents_ecatb(contents, &argb)
  4373.     init_ecatb_def_blocks(true) # Added
  4374.   end # extract_save_contents
  4375.  
  4376.   def load_ecatb_notes # New
  4377.     [$data_actors, $data_classes, $data_skills, $data_items, $data_weapons,
  4378.      $data_armors, $data_enemies, $data_states].each(
  4379.      &DoubleX_RMVXA::ECATB::BLOCKS[:load_ecatb_notes])
  4380.   end # load_ecatb_notes
  4381.  
  4382.   #----------------------------------------------------------------------------|
  4383.   #  Clears all blocks before serializations and after being unneeded          |
  4384.   #----------------------------------------------------------------------------|
  4385.   def clear_ecatb_blocks # New
  4386.     block = DoubleX_RMVXA::ECATB::BLOCKS[:clear_ecatb_blocks]
  4387.     $game_actors.instance_exec { @data.compact.each(&block) }
  4388.     $game_troop.members.each(&block)
  4389.   end # clear_ecatb_blocks
  4390.  
  4391.   #----------------------------------------------------------------------------|
  4392.   #  Resets all blocks after serializations and being needed                   |
  4393.   #----------------------------------------------------------------------------|
  4394.   def init_ecatb_def_blocks(create_def = false) # New
  4395.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4396.     $game_party.all_members.each(&block[:create_ecatb_defs]) if create_def
  4397.     $game_party.all_members.each(&block[:reset_ecatb_blocks])
  4398.     $game_troop.members.each(&block[:reset_ecatb_blocks])
  4399.   end # init_ecatb_def_blocks
  4400.  
  4401. end # DataManager
  4402.  
  4403. #------------------------------------------------------------------------------|
  4404. #  * Loads all the actor's notetags                                            |
  4405. #------------------------------------------------------------------------------|
  4406. class RPG::Actor < RPG::BaseItem # Edit
  4407.  
  4408.   module_eval(DoubleX_RMVXA::ECATB::ACTOR_NOTES) # New
  4409.  
  4410. end # RPG::Actor
  4411.  
  4412. #------------------------------------------------------------------------------|
  4413. #  * Loads all the class's notetags                                            |
  4414. #------------------------------------------------------------------------------|
  4415. class RPG::Class < RPG::BaseItem # Edit
  4416.  
  4417.   module_eval(DoubleX_RMVXA::ECATB::CLASS_NOTES) # New
  4418.  
  4419. end # RPG::Class
  4420.  
  4421. #------------------------------------------------------------------------------|
  4422. #  * Loads all the enemy's notetags                                            |
  4423. #------------------------------------------------------------------------------|
  4424. class RPG::Enemy < RPG::BaseItem # Edit
  4425.  
  4426.   module_eval(DoubleX_RMVXA::ECATB::ENEMY_NOTES) # New
  4427.  
  4428. end # RPG::Enemy
  4429.  
  4430. #------------------------------------------------------------------------------|
  4431. #  * Loads all the equip's notetags                                            |
  4432. #------------------------------------------------------------------------------|
  4433. class RPG::EquipItem < RPG::BaseItem # Edit
  4434.  
  4435.   module_eval(DoubleX_RMVXA::ECATB::EQUIP_NOTES) # New
  4436.  
  4437. end # RPG::EquipItem
  4438.  
  4439. #------------------------------------------------------------------------------|
  4440. #  * Loads all the state's notetags                                            |
  4441. #------------------------------------------------------------------------------|
  4442. class RPG::State < RPG::BaseItem # Edit
  4443.  
  4444.   module_eval(DoubleX_RMVXA::ECATB::STATE_NOTES) # New
  4445.  
  4446. end # RPG::State
  4447.  
  4448. class RPG::UsableItem < RPG::BaseItem # Edit
  4449.  
  4450.   #----------------------------------------------------------------------------|
  4451.   #  New public instance variables                                             |
  4452.   #----------------------------------------------------------------------------|
  4453.   # The values of all the skill/item's notetags
  4454.   DoubleX_RMVXA::ECATB::USABLEITEM_NOTES.each { |note|
  4455.     attr_accessor eval(":#{note}")
  4456.   }
  4457.   #
  4458.  
  4459.   def load_ecatb_notes # New
  4460.     @ecatb_unison_actor_def = {}
  4461.     @ecatb_unison_def_rule = {}
  4462.     ecatb = DoubleX_RMVXA::ECATB
  4463.     @note.split(/[\r\n]+/).each { |line|
  4464.       ecatb::USABLEITEM_NOTES.each_with_index { |note, index|
  4465.         next unless line =~ ecatb::REGEX[index + 12]
  4466.         if index > 9
  4467.           note += "[:#{$1}]"
  4468.           val = $2.downcase.to_sym
  4469.         else
  4470.           val = $1.downcase.to_sym
  4471.         end
  4472.         send(:"#{note}=", send(:"#{note}") || val)
  4473.       }
  4474.     }
  4475.     ecatb::USABLEITEM_NOTES.each_with_index { |note, index|
  4476.       send(:"#{note}=", send(:"#{note}") || note.to_sym) if index < 10
  4477.     }
  4478.   end # load_ecatb_notes
  4479.  
  4480. end # RPG::UsableItem
  4481.  
  4482. #------------------------------------------------------------------------------|
  4483. #  * Reimplements the the whole battle flow to run the atb system              |
  4484. #------------------------------------------------------------------------------|
  4485. class << BattleManager # Edit
  4486.  
  4487.   #----------------------------------------------------------------------------|
  4488.   #  New public instance variables                                             |
  4489.   #----------------------------------------------------------------------------|
  4490.   attr_accessor :actor_index # Accessed by Scene_Battle to setup actors
  4491.   attr_accessor :ecatb_can_esc # The party escape permission flag
  4492.   attr_reader :ecatb_actor_act_list # The list of actors that can act
  4493.   attr_reader :ecatb_base # The base atb rate determinators
  4494.   attr_reader :ecatb_base_change # The base atb rate determinators change flag
  4495.   attr_reader :action_battlers # Read by Scene_Battle to execute actions
  4496.   attr_reader :phase # Read by Scene_Battle to get the battle phase
  4497.  
  4498.   #----------------------------------------------------------------------------|
  4499.   #  New private instance variables                                            |
  4500.   #----------------------------------------------------------------------------|
  4501.   # @ecatb_battlers_def_sums: All method sums of all battlers
  4502.   # @ecatb_def_sums: The iteraotr block running all method sums of all battlers
  4503.   # @ecatb_esc: The party escape attempt flag
  4504.   # @ecatb_pool_reset_lock: The party/troop atb pool reset lock
  4505.  
  4506.   alias setup_ecatb setup
  4507.   def setup(troop_id, can_escape = true, can_lose = false, &argb)
  4508.     setup_ecatb(troop_id, can_escape, can_lose, &argb)
  4509.     # Added
  4510.     init_ecatb_vars
  4511.     create_ecatb_defs
  4512.     #
  4513.   end # setup
  4514.  
  4515.   #----------------------------------------------------------------------------|
  4516.   #  Always let actions to be executed at any frame for ecatb battle system    |
  4517.   #----------------------------------------------------------------------------|
  4518.   alias in_turn_ecatb? in_turn?
  4519.   def in_turn? # Hotspot
  4520.     btype?(:ecatb) || in_turn_ecatb? # Rewritten
  4521.   end # in_turn?
  4522.  
  4523.   #----------------------------------------------------------------------------|
  4524.   #  Disables the next command for ecatb battle system                         |
  4525.   #----------------------------------------------------------------------------|
  4526.   alias next_command_ecatb next_command
  4527.   def next_command(*argv, &argb)
  4528.     # Rewritten
  4529.     return false if btype?(:ecatb)
  4530.     next_command_ecatb(*argv, &argb)
  4531.     #
  4532.   end # next_command
  4533.  
  4534.   #----------------------------------------------------------------------------|
  4535.   #  Disables the prior command for ecatb battle system                        |
  4536.   #----------------------------------------------------------------------------|
  4537.   alias prior_command_ecatb prior_command
  4538.   def prior_command(*argv, &argb)
  4539.     # Rewritten
  4540.     return false if btype?(:ecatb)
  4541.     prior_command_ecatb(*argv, &argb)
  4542.     #
  4543.   end # prior_command
  4544.  
  4545.   #----------------------------------------------------------------------------|
  4546.   #  Initializes all battlers' starting atb values and their method sums also  |
  4547.   #----------------------------------------------------------------------------|
  4548.   alias battle_start_ecatb battle_start
  4549.   def battle_start(*argv, &argb)
  4550.     battle_start_ecatb(*argv, &argb)
  4551.     ecatb_battle_start if btype?(:ecatb) # Added
  4552.   end # battle_start
  4553.  
  4554.   #----------------------------------------------------------------------------|
  4555.   #  Closes all windows that should be closed before ending the battle as well |
  4556.   #----------------------------------------------------------------------------|
  4557.   alias process_victory_ecatb process_victory
  4558.   def process_victory(*argv, &argb)
  4559.     # Added
  4560.     if btype?(:ecatb) && SceneManager.scene_is?(Scene_Battle)
  4561.       SceneManager.scene.close_ecatb_windows
  4562.     end
  4563.     #
  4564.     process_victory_ecatb(*argv, &argb)
  4565.   end # process_victory
  4566.  
  4567.   #----------------------------------------------------------------------------|
  4568.   #  Checks if escape's allowed, no such attempt exists and the conditions' met|
  4569.   #----------------------------------------------------------------------------|
  4570.   alias process_escape_ecatb process_escape
  4571.   def process_escape(*argv, &argb)
  4572.     return process_escape_ecatb(*argv, &argb) unless btype?(:ecatb) # Rewritten
  4573.     # Added to initializes the escape attempt if all the requirements are met
  4574.     return false if @ecatb_esc
  4575.     init_ecatb_escape if @ecatb_can_esc && ecatb_esc_init_cond
  4576.     false
  4577.     #
  4578.   end # process_escape
  4579.  
  4580.   #----------------------------------------------------------------------------|
  4581.   #  Closes all windows that should be closed before ending the battle as well |
  4582.   #----------------------------------------------------------------------------|
  4583.   alias process_defeat_ecatb process_defeat
  4584.   def process_defeat(*argv, &argb)
  4585.     # Added
  4586.     if btype?(:ecatb) && SceneManager.scene_is?(Scene_Battle)
  4587.       SceneManager.scene.close_ecatb_windows
  4588.     end
  4589.     #
  4590.     process_defeat_ecatb(*argv, &argb)
  4591.   end # process_defeat
  4592.  
  4593.   #----------------------------------------------------------------------------|
  4594.   #  Stops making actions for any battler and unselecting any inputable actor  |
  4595.   #----------------------------------------------------------------------------|
  4596.   alias input_start_ecatb input_start
  4597.   def input_start(*argv, &argb)
  4598.     # Added
  4599.     if btype?(:ecatb)
  4600.       @phase = :input
  4601.       @surprise = false
  4602.     end
  4603.     #
  4604.     input_start_ecatb(*argv, &argb)
  4605.   end # input_start
  4606.  
  4607.   #----------------------------------------------------------------------------|
  4608.   #  Clears all temporarily stored battlers' blocks as well                    |
  4609.   #----------------------------------------------------------------------------|
  4610.   alias battle_end_ecatb battle_end # v0.03b+
  4611.   def battle_end(result, &argb)
  4612.     battle_end_ecatb(result, &argb)
  4613.     clear_ecatb_blocks # Added
  4614.   end # battle_end
  4615.  
  4616.   def init_ecatb_vars # New
  4617.     $game_temp.init_ecatb_vars
  4618.     @ecatb_actor_act_list = []
  4619.     @ecatb_base = { size: -1, sum: -1, val: -1 }
  4620.     @ecatb_battlers_def_sums = {}
  4621.     @ecatb_can_esc = true
  4622.     @ecatb_pool_reset_lock = []
  4623.     init_ecatb_block
  4624.   end # init_ecatb_vars
  4625.  
  4626.   #----------------------------------------------------------------------------|
  4627.   #  Initializes the new block to trade memory usage for time performance      |
  4628.   #----------------------------------------------------------------------------|
  4629.   def init_ecatb_block # New
  4630.     # Calls this block instead of an anonymous function per enumerable iteration
  4631.     @ecatb_def_sums = -> method {
  4632.       @ecatb_battlers_def_sums[method] = ecatb_def_sum_battlers.inject(0) {
  4633.       |sum, battler| sum + battler.send(method) }
  4634.     }
  4635.     #
  4636.   end # init_ecatb_block
  4637.  
  4638.   #----------------------------------------------------------------------------|
  4639.   #  Clears all temporarily stored battlers' blocks and frees memory as well   |
  4640.   #----------------------------------------------------------------------------|
  4641.   def clear_ecatb_blocks # v0.05a+; New
  4642.     $game_temp.clear_ecatb_vars
  4643.     @action_battlers = @ecatb_actor_act_list = @ecatb_base = nil
  4644.     @ecatb_battlers_def_sums = @ecatb_def_sums = @ecatb_pool_reset_lock = nil
  4645.   end # clear_ecatb_blocks
  4646.  
  4647.   #----------------------------------------------------------------------------|
  4648.   #  Creates and checks the associated method for each configuration used here |
  4649.   #----------------------------------------------------------------------------|
  4650.   # config: The configuration requesting its associated method
  4651.   # validate: The configuration value validation flag
  4652.   def create_ecatb_def(config, validate = true) # New
  4653.     # Uses the name and value of configuration as its method's name and contents
  4654.     method = config.id2name
  4655.     eval(%Q(
  4656.   def #{method}#{DoubleX_RMVXA::ECATB::BATTLEMANAGER[config][0]}
  4657.     #{$game_system.send(config)}
  4658.   end
  4659.     ))
  4660.     #
  4661.     return unless validate
  4662.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::BATTLEMANAGER[config])
  4663.   end # create_ecatb_def
  4664.  
  4665.   #----------------------------------------------------------------------------|
  4666.   #  Checks all new methods and resets them to the defaults if they're invalid |
  4667.   #----------------------------------------------------------------------------|
  4668.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:BATTLEMANAGER]) # New
  4669.  
  4670.   #----------------------------------------------------------------------------|
  4671.   #  Initializes all battlers' starting atb values and their method sums       |
  4672.   #----------------------------------------------------------------------------|
  4673.   def ecatb_battle_start # New
  4674.     type = @preemptive ? :start_1 : @surprise ? :start_2 : :start_0
  4675.     $game_party.battle_members.each { |mem| mem.set_ecatb_start_val(type) }
  4676.     $game_troop.members.each { |mem| mem.set_ecatb_start_val(type) }
  4677.     ecatb_battlers_def_sum.each(&@ecatb_def_sums)
  4678.   end # ecatb_battle_start
  4679.  
  4680.   #----------------------------------------------------------------------------|
  4681.   #  Updates all battlers' atb values and the party escape attempt status      |
  4682.   #----------------------------------------------------------------------------|
  4683.   def ecatb_update # New; Hotspot
  4684.     update_ecatb_base
  4685.     ecatb_block_update
  4686.     if update_ecatb_battlers_def_sums
  4687.       ecatb_battlers_def_sum.each(&@ecatb_def_sums)
  4688.     end
  4689.     return unless @ecatb_esc
  4690.     return pay_ecatb_esc_cost unless ecatb_esc_charge_cond
  4691.     ecatb_esc_suc if ecatb_esc_exec_cond
  4692.   end # ecatb_update
  4693.  
  4694.   def ecatb_block_update # v0.05a+; New; Hotspot
  4695.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4696.     $game_party.battle_members.each(&block[:ecatb_updates])
  4697.     $game_troop.alive_members.each(&block[:ecatb_updates])
  4698.     [$game_party, $game_troop].each(&block[:update_ecatb_pool])
  4699.     $game_party.alive_members.each(&block[:update_ecatb_unison])
  4700.     $game_troop.alive_members.each(&block[:reset_ecatb_refresh])
  4701.   end # ecatb_block_update
  4702.  
  4703.   #----------------------------------------------------------------------------|
  4704.   #  Checks if the atb rate needs to be reevaluated                            |
  4705.   #----------------------------------------------------------------------------|
  4706.   def update_ecatb_base # New; Hotspot
  4707.     # Checks if the number of battlers, methods sums or the fill time's changed
  4708.     @ecatb_base_change = false
  4709.     base = {
  4710.       size: ecatb_def_sum_battlers.size,
  4711.       sum: @ecatb_battlers_def_sums,
  4712.       val: 100.0 / ecatb_base_fill_t / Graphics.frame_rate
  4713.     }
  4714.     base.each { |key, val|
  4715.       @ecatb_base_change = @ecatb_base[key] = val if @ecatb_base[key] != val
  4716.     }
  4717.     #
  4718.   end # update_ecatb_base
  4719.  
  4720.   #----------------------------------------------------------------------------|
  4721.   #  Initializes a party escape attempt                                        |
  4722.   #----------------------------------------------------------------------------|
  4723.   def init_ecatb_escape # New
  4724.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  4725.     @ecatb_esc = true
  4726.     # Resets all party members' charge rate and clears all unison data as well
  4727.     $game_party.battle_members.each(
  4728.     &DoubleX_RMVXA::ECATB::BLOCKS[:init_ecatb_escape])
  4729.     #
  4730.   end # init_ecatb_escape
  4731.  
  4732.   #----------------------------------------------------------------------------|
  4733.   #  Executes the fully charged party escape attempt                           |
  4734.   #----------------------------------------------------------------------------|
  4735.   def ecatb_esc_suc # New
  4736.     Sound.play_escape
  4737.     ecatb_esc_suc_cond ? process_abort : pay_ecatb_esc_cost
  4738.     wait_for_message
  4739.   end # ecatb_esc_suc
  4740.  
  4741.   #----------------------------------------------------------------------------|
  4742.   #  Asks all party members to pay the failed party escape attempt's costs     |
  4743.   #----------------------------------------------------------------------------|
  4744.   def pay_ecatb_esc_cost # New
  4745.     @escape_ratio += set_ecatb_esc_cost_compatibility
  4746.     $game_message.add('\.' + Vocab::EscapeFailure)
  4747.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4748.     $game_party.battle_members.each(&block[:pay_ecatb_esc_cost])
  4749.     @ecatb_esc = false
  4750.     $game_party.alive_members.each(&block[:ecatb_reset])
  4751.   end # pay_ecatb_escape_cost
  4752.  
  4753.   #----------------------------------------------------------------------------|
  4754.   #  Triggers all battlers' turn end effects and collapses all collapsible ones|
  4755.   #----------------------------------------------------------------------------|
  4756.   def ecatb_on_turn_end # New
  4757.     $game_party.alive_members.each(
  4758.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_on_turn_end])
  4759.     esc_phase = @ecatb_can_esc || @phase
  4760.     $game_troop.alive_members.each { |m|
  4761.       m.on_turn_end
  4762.       m.perform_collapse_effect if esc_phase && m.enemy? && m.can_collapse?
  4763.     }
  4764.   end # ecatb_on_turn_end
  4765.  
  4766.   #----------------------------------------------------------------------------|
  4767.   #  Marks a battler to become able to act and plays that battler's ready se   |
  4768.   #----------------------------------------------------------------------------|
  4769.   def make_ecatb_act(battler) # New
  4770.     # Stores that battler in the actable battler list and actor list for actors
  4771.     return if @action_battlers.include?(battler)
  4772.     @action_battlers << battler
  4773.     @ecatb_actor_act_list << battler if battler.actor?
  4774.     battler.make_actions
  4775.     battler.pre_ecatb_input_act
  4776.     return unless (se = battler.set_ecatb_se_ready_act).is_a?(RPG::SE)
  4777.     se.play
  4778.     #
  4779.   end # make_ecatb_act
  4780.  
  4781.   #----------------------------------------------------------------------------|
  4782.   #  Marks a battler to become unable to act                                   |
  4783.   #----------------------------------------------------------------------------|
  4784.   def del_ecatb_act(battler) # New
  4785.     # Removes that battler from the actable battler and actor list for actors
  4786.     return unless @action_battlers.include?(battler)
  4787.     @action_battlers.delete(battler)
  4788.     battler.clear_actions
  4789.     return unless battler.actor? && @ecatb_actor_act_list.include?(battler)
  4790.     @ecatb_actor_act_list.delete(battler)
  4791.     clear_actor if actor == self
  4792.     #
  4793.   end # del_ecatb_act
  4794.  
  4795.   #----------------------------------------------------------------------------|
  4796.   #  Returns the list of all currently inputable actors                        |
  4797.   #----------------------------------------------------------------------------|
  4798.   # id : The inputable actor id list request flag
  4799.   def ecatb_input_list(id = false) # New; Hotspot
  4800.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4801.     list = @ecatb_actor_act_list.select(&block[:ecatb_input_list_1])
  4802.     id ? list.collect!(&block[:ecatb_input_list_2]) : list
  4803.   end # ecatb_input_list
  4804.  
  4805.   # actors: The unison actors
  4806.   def ecatb_pool_reset(battler, actors) # v0.05a+; New
  4807.     # Ensures no repeated ecatb_reset call for any battler including unison ones
  4808.     if @ecatb_pool_reset_lock.include?(battler)
  4809.       return @ecatb_pool_reset_lock.delete(battler)
  4810.     end
  4811.     battlers = battler.actor? ? @ecatb_actor_act_list :
  4812.     @action_battlers - @ecatb_actor_act_list
  4813.     @ecatb_pool_reset_lock = battlers - [battler]
  4814.     (battlers - actors - [battler]).each(
  4815.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_reset])
  4816.     #
  4817.   end # ecatb_pool_reset
  4818.  
  4819.   #----------------------------------------------------------------------------|
  4820.   #  Checks if the battler atb values should be continually updated            |
  4821.   #----------------------------------------------------------------------------|
  4822.   def ecatb_ctb_break? # v0.04d+; New; Hotspot
  4823.     return true if $game_message.visible
  4824.     # Checks if the battle ended, action's executing or command window's showing
  4825.     return true if $game_party.all_dead? || $game_troop.all_dead?
  4826.     return true unless @phase && @ecatb_can_esc && ecatb_ctb
  4827.     return true unless SceneManager.scene_is?(Scene_Battle)
  4828.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4829.     return true if $game_party.alive_members.any?(&block[:ecatb_refresh])
  4830.     return true if $game_troop.alive_members.any?(&block[:ecatb_refresh])
  4831.     @action_battlers.any?(&block[:ecatb_ctb_break?])
  4832.     #
  4833.   end # ecatb_ctb_break?
  4834.  
  4835.   #----------------------------------------------------------------------------|
  4836.   #  Tries to pick an inputable actor and returns if the attempt succeeded     |
  4837.   #----------------------------------------------------------------------------|
  4838.   def ecatb_update_act_actor? # v0.04d+; New; Hotspot
  4839.     # Points the actor index to the 1st inputable actor if any
  4840.     return false if (act_list = ecatb_input_list(true)).empty?
  4841.     @actor_index = act_list[0]
  4842.     #
  4843.   end # ecatb_update_act_actor?
  4844.  
  4845.   #----------------------------------------------------------------------------|
  4846.   #  Picks the prior or next inputable actor and returns the result            |
  4847.   #----------------------------------------------------------------------------|
  4848.   # sign: Indicator of whether the prior or next actor is to be picked
  4849.   def change_ecatb_actor?(sign) # v0.04d+; New; Potential Hotspot
  4850.     # Points the actor index to the prior or next actor if any
  4851.     return false if (act_list = ecatb_input_list(true)).empty?
  4852.     act_list.sort! { |a, b| a * sign <=> b * sign }.each { |a_index|
  4853.       return @actor_index = a_index if @actor_index * sign < a_index * sign
  4854.     }
  4855.     @actor_index = act_list[0]
  4856.     #
  4857.   end # change_ecatb_actor?
  4858.  
  4859.   #----------------------------------------------------------------------------|
  4860.   #  Lets the compatibility fix deals with compatibility issues                |
  4861.   #----------------------------------------------------------------------------|
  4862.   def set_ecatb_esc_cost_compatibility # New
  4863.     0.1
  4864.   end # set_ecatb_esc_cost_compatibility
  4865.  
  4866. end # BattleManager
  4867.  
  4868. #------------------------------------------------------------------------------|
  4869. #  * Temporarily stores the blocks right before clearing them                  |
  4870. #------------------------------------------------------------------------------|
  4871. class Game_Temp # v0.02c+; Edit
  4872.  
  4873.   #----------------------------------------------------------------------------|
  4874.   #  New public instance variables                                             |
  4875.   #----------------------------------------------------------------------------|
  4876.   attr_accessor :ecatb_add_actors # The member adding flag
  4877.   attr_accessor :ecatb_remove_actors # The member removing flag
  4878.   attr_reader :ecatb_unison_actors # All battlers' cached unison actors
  4879.   attr_reader :last_ecatb_item # All battlers' cached last used item
  4880.  
  4881.   def init_ecatb_vars # v0.05a+; New
  4882.     @ecatb_add_actors = []
  4883.     @ecatb_remove_actors = []
  4884.     @ecatb_unison_actors = {}
  4885.     @last_ecatb_item = {}
  4886.   end # init_ecatb_vars
  4887.  
  4888.   def clear_ecatb_vars # v0.05a+; New
  4889.     @ecatb_add_actors = @ecatb_remove_actors = nil
  4890.     @ecatb_unison_actors = @last_ecatb_item = nil
  4891.   end # clear_ecatb_vars
  4892.  
  4893. end # Game_Temp
  4894.  
  4895. #------------------------------------------------------------------------------|
  4896. #  * Selects the battle system and stores all configuration values             |
  4897. #------------------------------------------------------------------------------|
  4898. class Game_System # Edit
  4899.  
  4900.   #----------------------------------------------------------------------------|
  4901.   #  New public instance variables                                             |
  4902.   #----------------------------------------------------------------------------|
  4903.   # Stores all configuration values
  4904.   DoubleX_RMVXA::ECATB::CONFIG.each { |configs|
  4905.     configs.each_key { |config| attr_accessor eval(":#{config.id2name}") }
  4906.   }
  4907.   #
  4908.  
  4909.   #----------------------------------------------------------------------------|
  4910.   #  Stores all configuration values as well                                   |
  4911.   #----------------------------------------------------------------------------|
  4912.   alias initialize_ecatb initialize
  4913.   def initialize(*argv, &argb)
  4914.     initialize_ecatb(*argv, &argb)
  4915.     init_ecatb_configs # Added
  4916.   end # initialize
  4917.  
  4918.   #----------------------------------------------------------------------------|
  4919.   #  Set the battle system as :ecatb for using the ecatb battle system         |
  4920.   #----------------------------------------------------------------------------|
  4921.   alias set_battle_system_ecatb set_battle_system
  4922.   def set_battle_system(type, &argb)
  4923.     return @battle_system = :ecatb if type == :ecatb # Added
  4924.     set_battle_system_ecatb(type, &argb)
  4925.   end # set_battle_system
  4926.  
  4927.   #----------------------------------------------------------------------------|
  4928.   #  Returns :ecatb if using the ecatb battle system                           |
  4929.   #----------------------------------------------------------------------------|
  4930.   alias battle_system_corrected_ecatb battle_system_corrected
  4931.   def battle_system_corrected(type, &argb)
  4932.     # Rewritten
  4933.     type == :ecatb ? :ecatb : battle_system_corrected_ecatb(type, &argb)
  4934.     #
  4935.   end # battle_system_corrected
  4936.  
  4937.   #----------------------------------------------------------------------------|
  4938.   #  Stores all configuration values into this class's new variables           |
  4939.   #----------------------------------------------------------------------------|
  4940.   def init_ecatb_configs # New
  4941.     DoubleX_RMVXA::ECATB::CONFIG.each { |configs|
  4942.       configs.each { |config, val| send(:"#{config}=", val) }
  4943.     }
  4944.   end # init_ecatb_configs
  4945.  
  4946. end # Game_System
  4947.  
  4948. #------------------------------------------------------------------------------|
  4949. #  * Adds the action input confirmation flag for action executions             |
  4950. #------------------------------------------------------------------------------|
  4951. class Game_Action # Edit
  4952.  
  4953.   #----------------------------------------------------------------------------|
  4954.   #  New public instance variables                                             |
  4955.   #----------------------------------------------------------------------------|
  4956.   attr_accessor :last_ecatb_confirm # The last action confirmation flag
  4957.   attr_writer :ecatb_confirm # The action confirmation flag
  4958.  
  4959.   #----------------------------------------------------------------------------|
  4960.   #  Cancel the input confirmation as well                                     |
  4961.   #----------------------------------------------------------------------------|
  4962.   alias clear_ecatb clear
  4963.   def clear(*argv, &argb)
  4964.     clear_ecatb(*argv, &argb)
  4965.     @ecatb_confirm = @last_ecatb_confirm = false # Added
  4966.   end # clear
  4967.  
  4968.   #----------------------------------------------------------------------------|
  4969.   #  Corrects the action confirmation flag before returning it                 |
  4970.   #----------------------------------------------------------------------------|
  4971.   def ecatb_confirm # New
  4972.     @ecatb_confirm ||= !@subject.inputable?
  4973.   end # ecatb_confirm
  4974.  
  4975. end # Game_Action
  4976.  
  4977. #------------------------------------------------------------------------------|
  4978. #  * Implements the battler's calculations and decision making criteria        |
  4979. #------------------------------------------------------------------------------|
  4980. class Game_BattlerBase # Edit
  4981.  
  4982.   #----------------------------------------------------------------------------|
  4983.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  4984.   #----------------------------------------------------------------------------|
  4985.   alias erase_state_ecatb erase_state
  4986.   def erase_state(state_id, &argb)
  4987.     # Added
  4988.     if @states.include?(state_id)
  4989.       @ecatb_countdown_clock.delete(state_id)
  4990.       @ecatb_countdown_freeze.delete(state_id)
  4991.     end
  4992.     #
  4993.     erase_state_ecatb(state_id, &argb)
  4994.     set_ecatb_battler_change # Added
  4995.   end # erase_state
  4996.  
  4997.   #----------------------------------------------------------------------------|
  4998.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  4999.   #----------------------------------------------------------------------------|
  5000.   alias tp_equal_ecatb tp=
  5001.   def tp=(tp, &argb)
  5002.     tp_equal_ecatb(tp, &argb)
  5003.     set_ecatb_battler_change # Added
  5004.   end # tp=
  5005.  
  5006.   #----------------------------------------------------------------------------|
  5007.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5008.   #----------------------------------------------------------------------------|
  5009.   alias refresh_ecatb refresh
  5010.   def refresh(*argv, &argb)
  5011.     refresh_ecatb(*argv, &argb)
  5012.     set_ecatb_battler_change # Added
  5013.   end # refresh
  5014.  
  5015.   #----------------------------------------------------------------------------|
  5016.   #  Resets the battler's atb values and clear all actions as well             |
  5017.   #----------------------------------------------------------------------------|
  5018.   alias hide_ecatb hide # v0.04c+
  5019.   def hide(*argv, &argb)
  5020.     hide_ecatb(*argv, &argb)
  5021.     ecatb_reset(true) # Added
  5022.   end # hide
  5023.  
  5024.   #----------------------------------------------------------------------------|
  5025.   #  Checks if the user's charging and the costs need to be paid now as well   |
  5026.   #----------------------------------------------------------------------------|
  5027.   alias skill_cost_payable_ecatb? skill_cost_payable?
  5028.   def skill_cost_payable?(skill, &argb)
  5029.     return true if skill_cost_payable_ecatb?(skill, &argb) # Rewritten
  5030.     # Added
  5031.     return false unless BattleManager.btype?(:ecatb)
  5032.     return false if @ecatb_val[:charge] <= 0.0
  5033.     !DoubleX_RMVXA::ECATB.send(skill.ecatb_charge_prior_item_cost, self)
  5034.     #
  5035.   end # skill_cost_payable?
  5036.  
  5037.   #----------------------------------------------------------------------------|
  5038.   #  Checks if all unison battlers have enough action points as well           |
  5039.   #----------------------------------------------------------------------------|
  5040.   alias usable_ecatb? usable?
  5041.   def usable?(item, &argb)
  5042.     # Added
  5043.     if BattleManager.btype?(:ecatb) && item && item.is_a?(RPG::UsableItem)
  5044.       if SceneManager.scene_is?(Scene_Battle)
  5045.         ecatb = DoubleX_RMVXA::ECATB
  5046.         if actor?
  5047.           actors = ecatb.send(item.ecatb_unison_actor, self).collect!(
  5048.           &ecatb::BLOCKS[:usable?])
  5049.           return ecatb_unison_usable?(item, actors) if actors.size > 1
  5050.         end
  5051.         return false if @ecatb_val[:charge] <= 0.0 && @ecatb_act_times <
  5052.         ecatb.send(item.ecatb_act_cost, self)
  5053.       end
  5054.     end
  5055.     #
  5056.     usable_ecatb?(item, &argb)
  5057.   end # usable?(item)
  5058.  
  5059.   # act_times: The number of action points
  5060.   def ecatb_act_times=(act_times) # New
  5061.     return if @ecatb_act_times == act_times
  5062.     @ecatb_act_times = act_times
  5063.     set_ecatb_battler_change
  5064.   end # ecatb_act_times=
  5065.  
  5066.   #----------------------------------------------------------------------------|
  5067.   #  Raises the display redraw and cached notetag value reevaluation flags     |
  5068.   #----------------------------------------------------------------------------|
  5069.   def set_ecatb_battler_change # New
  5070.     @ecatb_battler_change ||= {}
  5071.     [:act, :atb, :charge, :cooldown, :order_icon, :order_opacity, :order_scale,
  5072.      :order_z, :rate, :se, :speed].each { |t| @ecatb_battler_change[t] = true }
  5073.     @ecatb_refresh = true
  5074.   end # set_ecatb_battler_change
  5075.  
  5076.   #----------------------------------------------------------------------------|
  5077.   #  Returns the currently displayed atb bar type                              |
  5078.   #----------------------------------------------------------------------------|
  5079.   def ecatb_bar_type # New; Hotspot
  5080.     return :cooldown if @ecatb_val[:cooldown] > 0.0
  5081.     @ecatb_val[:charge] > 0.0 ? :charge : :atb
  5082.   end # ecatb_bar_type
  5083.  
  5084.   #----------------------------------------------------------------------------|
  5085.   #  Returns the charge gain and cooldown loss value per frame                 |
  5086.   #----------------------------------------------------------------------------|
  5087.   # v0.02c+; New; Hotspot
  5088.   DoubleX_RMVXA::ECATB::CHARGE_COOLDOWN_RATE.each_value { |v| module_eval(v) }
  5089.   #
  5090.  
  5091.   #----------------------------------------------------------------------------|
  5092.   #  Caches and returns the atb rate                                           |
  5093.   #----------------------------------------------------------------------------|
  5094.   def ecatb_gain_rate # New; Hotspot
  5095.     # Reevaluates the atb rate only if any of its determinators' changed
  5096.     return @ecatb_rate[:atb] unless BattleManager.ecatb_base_change ||
  5097.     ecatb_battler_change?(:rate)
  5098.     @ecatb_rate[:atb] = set_ecatb_gain_rate(BattleManager.ecatb_base.clone)
  5099.     #
  5100.   end # ecatb_gain_rate
  5101.  
  5102.   #----------------------------------------------------------------------------|
  5103.   #  Evaluates the value of all atb gain rate notetags using its ordering      |
  5104.   #----------------------------------------------------------------------------|
  5105.   # base: The base atb gain rate
  5106.   def set_ecatb_gain_rate(base) # v0.05a+; New; Potential Hotspot
  5107.     ecatb = DoubleX_RMVXA::ECATB
  5108.     ecatb_rate_ord.each { |data|
  5109.       next unless send(@ecatb_item[data][0])
  5110.       send(@ecatb_item[data][1]).each { |item|
  5111.         (0..(item.ecatb_notes[:rate].size - 1)).each { |index|
  5112.           next unless note = item.ecatb_notes[:rate][index]
  5113.           base[:val] = ecatb.send(note, self, base)
  5114.         }
  5115.       }
  5116.     }
  5117.     base[:val]
  5118.   end # set_ecatb_gain_rate
  5119.  
  5120.   #----------------------------------------------------------------------------|
  5121.   #  Sets the current battler gradual action gain flag when its notetags change|
  5122.   #----------------------------------------------------------------------------|
  5123.   def set_gradual_ecatb_act_gain # v0.05a+; New; Hotspot
  5124.     # Updates the battler gradual action gain notetags using the current order
  5125.     return @ecatb_notes[:act] unless ecatb_battler_change?(:act)
  5126.     @ecatb_notes[:act] = nil
  5127.     gradual_ecatb_action_gain_ord.each { |data|
  5128.       if send(@ecatb_item[data][0])
  5129.         set_ecatb_notes(send(@ecatb_item[data][1]), :act)
  5130.       end
  5131.       return @ecatb_notes[:act] unless @ecatb_notes[:act].nil?
  5132.     }
  5133.     @ecatb_notes[:act] = gradual_ecatb_action_gain
  5134.     #
  5135.   end # set_gradual_ecatb_act_gain
  5136.  
  5137.   #----------------------------------------------------------------------------|
  5138.   #  Sets the color of the current atb bar type when its notetags change       |
  5139.   #----------------------------------------------------------------------------|
  5140.   # type: The atb type
  5141.   def set_ecatb_bar_colors(type) # New; Potential Hotspot
  5142.     # Updates the color notetags using the current order of the current atb type
  5143.     @ecatb_notes[type].clear
  5144.     (color_ord = set_ecatb_bar_color_ord(type))[0].each { |data|
  5145.       if send(@ecatb_item[data][0])
  5146.         set_ecatb_bar_color_notes(send(@ecatb_item[data][1]), type)
  5147.       end
  5148.       return if @ecatb_notes[type].size == 2
  5149.     }
  5150.     color_ord[1].each_with_index { |color, i| @ecatb_notes[type][i] ||= color }
  5151.     #
  5152.   end # set_ecatb_bar_colors
  5153.  
  5154.   #----------------------------------------------------------------------------|
  5155.   #  Returns the atb bar color orders and default values for current type      |
  5156.   #----------------------------------------------------------------------------|
  5157.   # type: The atb type
  5158.   def set_ecatb_bar_color_ord(type) # New; Potential Hotspot
  5159.     return [ecatb_bar_color_ord, ecatb_bar_colors] if type == :atb
  5160.     if type == :charge
  5161.       return [ecatb_charge_bar_color_ord, ecatb_charge_bar_colors]
  5162.     elsif type == :cooldown
  5163.       return [ecatb_cooldown_bar_color_ord, ecatb_cooldown_bar_colors]
  5164.     end
  5165.     [[], []] # Does nothing if type stores an invalid value
  5166.   end # set_ecatb_bar_color_ord(type)
  5167.  
  5168.   #----------------------------------------------------------------------------|
  5169.   #  Evaluates the value of all atb bar color notetags using their orderings   |
  5170.   #----------------------------------------------------------------------------|
  5171.   # items: The data containing the notetags
  5172.   # note: The notetag type
  5173.   def set_ecatb_bar_color_notes(items, note) # v0.05a+; New; Potential Hotspot
  5174.     # Reads all item's atb bar color 1 and 2 notetag values
  5175.     ecatb = DoubleX_RMVXA::ECATB
  5176.     items.each { |item|
  5177.       return if @ecatb_notes[note].size >= 2
  5178.       n = item.ecatb_notes[note][0]
  5179.       @ecatb_notes[note][0] ||= ecatb.send(n, self) if n
  5180.       next unless n = item.ecatb_notes[note][1]
  5181.       @ecatb_notes[note][1] ||= ecatb.send(n, self)
  5182.     }
  5183.     #
  5184.   end # set_ecatb_bar_color_notes
  5185.  
  5186.   #----------------------------------------------------------------------------|
  5187.   #  Reads all atb order battler icon, opacity, scale and z notes              |
  5188.   #----------------------------------------------------------------------------|
  5189.   # v0.01a+; New; Potential Hotspot
  5190.   DoubleX_RMVXA::ECATB::ORDER.each_value { |method| module_eval(method) }
  5191.   #
  5192.  
  5193.   #----------------------------------------------------------------------------|
  5194.   #  Sets the current battler ready se when its notetags change                |
  5195.   #----------------------------------------------------------------------------|
  5196.   def set_ecatb_se_ready_act # New
  5197.     # Updates the battler ready se notetags using the current order
  5198.     return @ecatb_notes[:se] unless ecatb_battler_change?(:se)
  5199.     @ecatb_notes[:se] = nil
  5200.     ecatb_se_ready_act_ord.each { |data|
  5201.       if send(@ecatb_item[data][0])
  5202.         set_ecatb_notes(send(@ecatb_item[data][1]), :se)
  5203.       end
  5204.       return @ecatb_notes[:se] if @ecatb_notes[:se]
  5205.     }
  5206.     @ecatb_notes[:se] = ecatb_se_ready_act
  5207.     #
  5208.   end # set_ecatb_se_ready_act
  5209.  
  5210.   #----------------------------------------------------------------------------|
  5211.   #  Sets the current battler action input speed reduction in frames           |
  5212.   #----------------------------------------------------------------------------|
  5213.   def set_ecatb_speed_reduce # v0.02a+; New
  5214.     # Updates the battler speed reduce notetags using the current order
  5215.     ecatb = DoubleX_RMVXA::ECATB
  5216.     ecatb_speed_reduce_ord.each { |data|
  5217.       next unless send(@ecatb_item[data][0])
  5218.       send(@ecatb_item[data][1]).each { |item|
  5219.         (0..(item.ecatb_notes[:speed].size - 1)).each { |index|
  5220.           next unless note = item.ecatb_notes[:speed][index]
  5221.           ecatb.send(note, self)
  5222.         }
  5223.       }
  5224.     }
  5225.     #
  5226.   end # set_ecatb_speed_reduce
  5227.  
  5228.   #----------------------------------------------------------------------------|
  5229.   #  Sets the starting atb value of the start type at the start of a battle    |
  5230.   #----------------------------------------------------------------------------|
  5231.   # start: The battle start type
  5232.   def set_ecatb_start_val(start) # New
  5233.     # Updates the start notetags of the start type using the current order
  5234.     ecatb = DoubleX_RMVXA::ECATB
  5235.     ecatb_start_val_ord.each { |data|
  5236.       next unless send(@ecatb_item[data][0])
  5237.       send(@ecatb_item[data][1]).each { |item|
  5238.         (0..(item.ecatb_notes[start].size - 1)).each { |index|
  5239.           next unless note = item.ecatb_notes[start][index]
  5240.           ecatb.send(note, self)
  5241.         }
  5242.       }
  5243.     }
  5244.     #
  5245.   end # set_ecatb_start_val
  5246.  
  5247.   #----------------------------------------------------------------------------|
  5248.   #  Evaluates the value of all specified notetags using their orderings       |
  5249.   #----------------------------------------------------------------------------|
  5250.   # items: The data containing the notetags
  5251.   # note: The notetag type
  5252.   def set_ecatb_notes(items, note) # New; Potential Hotspot
  5253.     # Reads all item's speficied notetag values until the maximum size's reached
  5254.     ecatb = DoubleX_RMVXA::ECATB
  5255.     items.each { |item|
  5256.       return if @ecatb_notes[note]
  5257.       next unless n = item.ecatb_notes[note]
  5258.       @ecatb_notes[note] = ecatb.send(n, self)
  5259.     }
  5260.     #
  5261.   end # set_ecatb_notes
  5262.  
  5263.   #----------------------------------------------------------------------------|
  5264.   #  Checks if any new notetag added, old one gone or its value changed        |
  5265.   #----------------------------------------------------------------------------|
  5266.   # note: The notetag type to be checked
  5267.   def ecatb_battler_change?(note) # New; Hotspot
  5268.     change = @ecatb_note_change[note]
  5269.     @ecatb_note_change[note] &&= !change
  5270.     return change unless @ecatb_battler_change[note]
  5271.     !(@ecatb_battler_change[note] = false)
  5272.   end # ecatb_battler_change?
  5273.  
  5274.   #----------------------------------------------------------------------------|
  5275.   #  Checks if charging should take place                                      |
  5276.   #----------------------------------------------------------------------------|
  5277.   def ecatb_charge_update? # New; Hotspot
  5278.     return false if @ecatb_val[:cooldown] > 0.0 || @ecatb_val[:atb] < 100.0
  5279.     return false unless current_action
  5280.     return enemy? || current_action.ecatb_confirm if current_action.item
  5281.     !(@ecatb_val[:charge] = 0.0)
  5282.   end # ecatb_charge_update?
  5283.  
  5284.   #----------------------------------------------------------------------------|
  5285.   #  Checks if the unison skill/item can continue charging                     |
  5286.   #----------------------------------------------------------------------------|
  5287.   def ecatb_unison_charge_update? # New; Hotspot
  5288.     return false unless actor? && current_action && item = current_action.item
  5289.     # Rechecks the unison skill/item usability if any unison actor's refreshed
  5290.     return usable?(item) if @ecatb_unison_actors.any?(
  5291.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_refresh])
  5292.     #
  5293.     true
  5294.   end # ecatb_unison_charge_update?
  5295.  
  5296.   #----------------------------------------------------------------------------|
  5297.   #  Checks if the battler's actions should be executed                        |
  5298.   #----------------------------------------------------------------------------|
  5299.   def exec_ecatb_act? # New; Hotspot
  5300.     # Checks if the battler's valid and has valid input being fully charged
  5301.     return false if ecatb_val[:charge] < 100.0 || ecatb_val[:atb] < 100.0
  5302.     enemy? || input && input.item && input.ecatb_confirm
  5303.     #
  5304.   end # exec_ecatb_act?
  5305.  
  5306.   #----------------------------------------------------------------------------|
  5307.   #  Helper methods used by @ecatb_item                                        |
  5308.   #----------------------------------------------------------------------------|
  5309.  
  5310.   def ecatb_states # New; Potential Hotspot
  5311.     @states
  5312.   end # ecatb_states
  5313.  
  5314.   def ecatb_enemy # New; Potential Hotspot
  5315.     [enemy]
  5316.   end # ecatb_enemy
  5317.  
  5318.   def enemy # New; Potential Hotspot
  5319.   end # enemy
  5320.  
  5321.   def armors # New; Potential Hotspot
  5322.     []
  5323.   end # armors
  5324.  
  5325.   def weapons # New; Potential Hotspot
  5326.     []
  5327.   end # armors
  5328.  
  5329.   def ecatb_class # New; Potential Hotspot
  5330.     [self.class]
  5331.   end # ecatb_class
  5332.  
  5333.   def class # New; Potential Hotspot
  5334.   end # class
  5335.  
  5336.   def ecatb_actor # New; Potential Hotspot
  5337.     [actor]
  5338.   end # ecatb_actor
  5339.  
  5340.   def actor # New
  5341.   end # actor
  5342.  
  5343.   #----------------------------------------------------------------------------|
  5344.   #  Lets the compatibility fix deals with compatibility issues                |
  5345.   #----------------------------------------------------------------------------|
  5346.   def ecatb_reset_compatibility? # New
  5347.   end # ecatb_reset_compatibility?
  5348.  
  5349. end # Game_BattlerBase
  5350.  
  5351. #------------------------------------------------------------------------------|
  5352. #  * Implements the battler's atb actions, control flows and logics            |
  5353. #------------------------------------------------------------------------------|
  5354. class Game_Battler < Game_BattlerBase # Edit
  5355.  
  5356.   #----------------------------------------------------------------------------|
  5357.   #  New public instance variables                                             |
  5358.   #----------------------------------------------------------------------------|
  5359.   attr_accessor :ecatb_act_times_add # The action point increment
  5360.   attr_accessor :ecatb_act_times_cap # The action point cap reaching flag
  5361.   attr_accessor :ecatb_refresh # The refresh calling flag
  5362.   attr_accessor :ecatb_reset_val # The atb reset value upon resetting atb
  5363.   attr_accessor :ecatb_unison_invoker # The unison skill/item invoker flag
  5364.   attr_accessor :ecatb_val_change # The atb value change flags
  5365.   attr_reader :ecatb_act_times # The number of action points
  5366.   attr_reader :ecatb_countdown_freeze # The countdown freeze statuses
  5367.   attr_reader :ecatb_note_change # The notetag value change flags
  5368.   attr_reader :ecatb_notes # The caches of all notetags used
  5369.   attr_reader :ecatb_rate # The cached atb rates
  5370.   attr_reader :ecatb_unison_actors # The cached unison actor list
  5371.   attr_reader :ecatb_unison_rule # The cached unison charge/cooldown rule
  5372.   attr_reader :ecatb_val # The atb values
  5373.   attr_writer :ecatb_unison_item # The unison skill/item for damage evaluation
  5374.  
  5375.   #----------------------------------------------------------------------------|
  5376.   #  New private instance variables                                            |
  5377.   #----------------------------------------------------------------------------|
  5378.   # @ecatb_battler_change: The battler data change flags
  5379.   # @ecatb_countdown_updates: The countdown update method iterator block
  5380.   # @ecatb_item: The notetag value reader storing data types with their ordering
  5381.   # @ecatb_item_change: The skill/item usage change flags
  5382.   # @ecatb_speed_reduce: The action input speed frame number
  5383.   # @fail_ecatb_esc: The party escape attempt failure flag
  5384.   # @last_ecatb_item: The last item used/being used
  5385.   # @last_ecatb_rate: The last atb gain rate
  5386.   # @last_ecatb_speed_reduce: The last action input speed frame number
  5387.   # @max_ecatb_act_times The maximum number of action points
  5388.   # @temp_ecatb_act_times The temporary number of action points
  5389.  
  5390.   #----------------------------------------------------------------------------|
  5391.   #  Updates states with different auto removal timing to at different timings |
  5392.   #----------------------------------------------------------------------------|
  5393.   def update_state_turns # Rewrite
  5394.     ecatb_update_state_turns(2) # Rewritten
  5395.   end # update_state_turns
  5396.  
  5397.   #----------------------------------------------------------------------------|
  5398.   #  Fixes bugs and initializes all new variables as well                      |
  5399.   #----------------------------------------------------------------------------|
  5400.   alias initialize_ecatb initialize
  5401.   def initialize(*argv, &argb)
  5402.     initialize_ecatb(*argv, &argb)
  5403.     init_ecatb_vars # Added to let created methods to use new variables as well
  5404.   end # initialize
  5405.  
  5406.   #----------------------------------------------------------------------------|
  5407.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5408.   #----------------------------------------------------------------------------|
  5409.   alias clear_states_ecatb clear_states
  5410.   def clear_states(*argv, &argb)
  5411.     clear_states_ecatb(*argv, &argb)
  5412.     # Added
  5413.     set_ecatb_battler_change
  5414.     @ecatb_countdown_clock = {}
  5415.     @ecatb_countdown_freeze = {}
  5416.     #
  5417.   end # clear_states
  5418.  
  5419.   #----------------------------------------------------------------------------|
  5420.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5421.   #----------------------------------------------------------------------------|
  5422.   alias add_new_state_ecatb add_new_state # v0.05a+
  5423.   def add_new_state(state_id, &argb)
  5424.     add_new_state_ecatb(state_id, &argb)
  5425.     set_ecatb_battler_change # Added
  5426.   end # add_new_state
  5427.  
  5428.   #----------------------------------------------------------------------------|
  5429.   #  Clears the atb values but not action points in the ecatb battle system    |
  5430.   #----------------------------------------------------------------------------|
  5431.   alias on_restrict_ecatb on_restrict
  5432.   def on_restrict(*argv, &argb)
  5433.     # Rewritten
  5434.     return on_restrict_ecatb(*argv, &argb) unless BattleManager.btype?(:ecatb)
  5435.     #
  5436.     # Added
  5437.     ecatb_reset
  5438.     states.each { |s| remove_state(s.id) if s.remove_by_restriction }
  5439.     #
  5440.   end # on_restrict
  5441.  
  5442.   #----------------------------------------------------------------------------|
  5443.   #  Initializes the state's countdown as well if any                          |
  5444.   #----------------------------------------------------------------------------|
  5445.   alias reset_state_counts_ecatb reset_state_counts
  5446.   def reset_state_counts(state_id, &argb)
  5447.     reset_state_counts_ecatb(state_id, &argb)
  5448.     # Added
  5449.     return unless $data_states[state_id].ecatb_countdown_interval
  5450.     return unless @states.include?(state_id)
  5451.     @ecatb_countdown_clock[state_id] = 0
  5452.     @ecatb_countdown_freeze[state_id] = false
  5453.     #
  5454.   end # reset_state_counts
  5455.  
  5456.   #----------------------------------------------------------------------------|
  5457.   #  Ensures only 1 non forced action can be inputted and executed at a time   |
  5458.   #----------------------------------------------------------------------------|
  5459.   alias make_action_times_ecatb make_action_times
  5460.   def make_action_times(*argv, &argb)
  5461.     # Rewritten
  5462.     BattleManager.btype?(:ecatb) ? 1 : make_action_times_ecatb(*argv, &argb)
  5463.     #
  5464.   end # make_action_times
  5465.  
  5466.   #----------------------------------------------------------------------------|
  5467.   #  Preserves the existing actions but executes the forced one first instead  |
  5468.   #----------------------------------------------------------------------------|
  5469.   alias force_action_ecatb force_action
  5470.   def force_action(skill_id, target_index, &argb)
  5471.     # Added
  5472.     if BattleManager.btype?(:ecatb)
  5473.       return set_ecatb_force_action(skill_id, target_index)
  5474.     end
  5475.     #
  5476.     force_action_ecatb(skill_id, target_index, &argb)
  5477.   end # force_action
  5478.  
  5479.   #----------------------------------------------------------------------------|
  5480.   #  Sets and resets user's methods before and after using an unison skill/item|
  5481.   #----------------------------------------------------------------------------|
  5482.   alias make_damage_value_ecatb make_damage_value
  5483.   def make_damage_value(user, item, &argb)
  5484.     # Added
  5485.     if user.actor? && user.ecatb_unison_actors.size > 1
  5486.       user.ecatb_unison_item = item
  5487.     end
  5488.     #
  5489.     make_damage_value_ecatb(user, item, &argb)
  5490.     user.ecatb_unison_item = nil # Added
  5491.   end # make_damage_value
  5492.  
  5493.   #----------------------------------------------------------------------------|
  5494.   #  Asks all unison invokees to pay the skill/item costs for unison skill/item|
  5495.   #----------------------------------------------------------------------------|
  5496.   alias use_item_ecatb use_item
  5497.   def use_item(item, &argb)
  5498.     # Rewritten
  5499.     return use_item_ecatb(item, &argb) unless BattleManager.btype?(:ecatb)
  5500.     #
  5501.     # Added
  5502.     unless DoubleX_RMVXA::ECATB.send(item.ecatb_charge_prior_item_cost, self)
  5503.       return item.effects.each { |effect| item_global_effect_apply(effect) }
  5504.     end
  5505.     return if @ecatb_unison_actors.size <= 1
  5506.     @ecatb_unison_actors.each { |actor| actor.pay_skill_cost(item) }
  5507.     item.effects.each { |effect| item_global_effect_apply(effect) }
  5508.     #
  5509.   end # use_item
  5510.  
  5511.   #----------------------------------------------------------------------------|
  5512.   #  Updates states with Auto-removal Timing being Action End as well          |
  5513.   #----------------------------------------------------------------------------|
  5514.   alias on_action_end_ecatb on_action_end
  5515.   def on_action_end(*argv, &argb)
  5516.     on_action_end_ecatb(*argv, &argb)
  5517.     ecatb_update_state_turns(1) if BattleManager.btype?(:ecatb) # Added
  5518.   end # on_action_end
  5519.  
  5520.   #----------------------------------------------------------------------------|
  5521.   #  Removes buffs and debuffs having 0 remaining turns as well                |
  5522.   #----------------------------------------------------------------------------|
  5523.   alias on_turn_end_ecatb on_turn_end
  5524.   def on_turn_end(*argv, &argb)
  5525.     on_turn_end_ecatb(*argv, &argb)
  5526.     remove_buffs_auto if BattleManager.btype?(:ecatb) # Added
  5527.   end # on_turn_end
  5528.  
  5529.   #----------------------------------------------------------------------------|
  5530.   #  Frees up unnecessary memory usage upon battle end                         |
  5531.   #----------------------------------------------------------------------------|
  5532.   alias on_battle_end_ecatb on_battle_end
  5533.   def on_battle_end(*argv, &argb) # v0.02c+
  5534.     on_battle_end_ecatb(*argv, &argb)
  5535.     # Added to clear all new variables that are only used in battles
  5536.     clear_ecatb_vars
  5537.     #
  5538.   end # on_battle_end
  5539.  
  5540.   #----------------------------------------------------------------------------|
  5541.   #  Preserves the existing actions but executes the forced one first          |
  5542.   #----------------------------------------------------------------------------|
  5543.   def set_ecatb_force_action(skill_id, target_index) # New
  5544.     @ecatb_unison_invoker = false
  5545.     @ecatb_unison_rule.clear
  5546.     (act = Game_Action.new(self, true)).set_skill(skill_id)
  5547.     if target_index == -2
  5548.       act.target_index = last_target_index
  5549.     elsif target_index == -1
  5550.       act.decide_random_target
  5551.     else
  5552.       act.target_index = target_index
  5553.     end
  5554.     @actions.unshift(act)
  5555.   end # set_ecatb_force_action
  5556.  
  5557.   #----------------------------------------------------------------------------|
  5558.   #  Initializes all new variables before checking any configuration validities|
  5559.   #----------------------------------------------------------------------------|
  5560.   def init_ecatb_vars # New
  5561.     @ecatb_esc = false
  5562.     @ecatb_item_change = {}
  5563.     @ecatb_note_change = {}
  5564.     @ecatb_notes = {}
  5565.     [:atb, :charge, :cooldown].each { |type| @ecatb_notes[type] = [] }
  5566.     @ecatb_unison_actors = []
  5567.     @ecatb_unison_rule = {}
  5568.     init_ecatb_block
  5569.     init_ecatb_item_vars
  5570.     init_ecatb_val_vars
  5571.   end # init_ecatb_vars
  5572.  
  5573.   def init_ecatb_val_vars # New
  5574.     @ecatb_act_times = @ecatb_act_times_add = @temp_ecatb_act_times = 0
  5575.     @ecatb_speed_reduce = @last_ecatb_speed_reduce = 0
  5576.     @ecatb_rate = {}
  5577.     @ecatb_reset_val = 0.0
  5578.     @ecatb_val = { atb: 0.0, charge: 0.0, cooldown: 0.0 }
  5579.     @ecatb_val_change = true
  5580.     @last_ecatb_rate = { charge: -1, cooldown: -1 }
  5581.     @max_ecatb_act_times = 1
  5582.   end # init_ecatb_val_vars
  5583.  
  5584.   def init_ecatb_item_vars # New
  5585.     @ecatb_item = {}
  5586.     notes = [:states, :enemies, :armors, :weapons, :classes, :actors]
  5587.     conds = [:ecatb_states, :enemy?, :actor?, :actor?, :actor?, :actor?]
  5588.     items = [:states, :ecatb_enemy, :armors, :weapons, :ecatb_class,
  5589.              :ecatb_actor]
  5590.     notes.each_with_index { |n, i| @ecatb_item[n] = [conds[i], items[i]] }
  5591.   end # init_ecatb_item_vars
  5592.  
  5593.   #----------------------------------------------------------------------------|
  5594.   #  Initializes the new block to trade memory usage for time performance      |
  5595.   #----------------------------------------------------------------------------|
  5596.   def init_ecatb_block # New
  5597.     # Calls this block instead of an anonymous function per enumerable iteration
  5598.     @ecatb_countdown_updates = -> state_id {
  5599.       next if @ecatb_countdown_freeze[state_id]
  5600.       next if (@ecatb_countdown_clock[state_id] += 1) % ecatb_countdown_min != 0
  5601.       @ecatb_countdown_clock[state_id] %= Graphics.frame_rate * DoubleX_RMVXA::
  5602.       ECATB.send($data_states[state_id].ecatb_countdown_interval, self)
  5603.       next if @ecatb_countdown_clock[state_id] != 0
  5604.       if @state_turns[state_id] > 0
  5605.         @state_turns[state_id] -= 1
  5606.         set_ecatb_battler_change
  5607.       end
  5608.       ecatb_countdown_update_compatibility_3(state_id)
  5609.       next unless @ecatb_battler_sprite
  5610.       ecatb_countdown_update_compatibility_2(@ecatb_battler_sprite, state_id)
  5611.     }
  5612.     #
  5613.   end # init_ecatb_block
  5614.  
  5615.   #----------------------------------------------------------------------------|
  5616.   #  Clears all variables that are useless outside battles upon battle end     |
  5617.   #----------------------------------------------------------------------------|
  5618.   def clear_ecatb_vars # v0.05a+; New
  5619.     clear_ecatb_blocks
  5620.     @ecatb_item = @ecatb_item_change = @ecatb_note_change = @ecatb_notes = nil
  5621.     @ecatb_rate = @ecatb_unison_actors = @ecatb_unison_rule = @ecatb_val = nil
  5622.     @ecatb_val_change = nil
  5623.   end # clear_ecatb_vars
  5624.  
  5625.   #----------------------------------------------------------------------------|
  5626.   #  Clears all cached blocks used in battles                                  |
  5627.   #----------------------------------------------------------------------------|
  5628.   def clear_ecatb_blocks # v0.01a; New
  5629.     # Clears all cached notetag values, the unison actor id list and skill/item
  5630.     if @ecatb_notes[:order_icon]
  5631.       bitmap = @ecatb_notes[:order_icon][0]
  5632.       bitmap.dispose if bitmap && !bitmap.disposed?
  5633.     end
  5634.     [:act, :order_icon, :order_opacity, :order_scale, :order_z, :se].each {
  5635.     |type| @ecatb_notes.delete(type) }
  5636.     [:atb, :charge, :cooldown].each { |type| @ecatb_notes[type].clear }
  5637.     $game_temp.ecatb_unison_actors[self] ||= @ecatb_unison_actors
  5638.     @ecatb_unison_actors.clear
  5639.     $game_temp.last_ecatb_item[self] ||= @last_ecatb_item
  5640.     @ecatb_battler_sprite = @ecatb_countdown_updates = @last_ecatb_item = nil
  5641.     #
  5642.   end # clear_ecatb_blocks
  5643.  
  5644.   #----------------------------------------------------------------------------|
  5645.   #  Resets all cached blocks used in battles                                  |
  5646.   #----------------------------------------------------------------------------|
  5647.   def reset_ecatb_blocks # v0.01a; New
  5648.     # Marks that all cached notetag values have to reread and restores the rest
  5649.     set_ecatb_battler_change
  5650.     if $game_temp.ecatb_unison_actors[self]
  5651.       @ecatb_unison_actors = $game_temp.ecatb_unison_actors.delete(self)
  5652.     end
  5653.     if $game_temp.last_ecatb_item[self]
  5654.       @last_ecatb_item = $game_temp.last_ecatb_item.delete(self)
  5655.     end
  5656.     init_ecatb_block
  5657.     #
  5658.   end # reset_ecatb_blocks
  5659.  
  5660.   # start: The battle start type
  5661.   def set_ecatb_start_val(start = :start_0) # New
  5662.     init_ecatb_vars
  5663.     set_ecatb_battler_change
  5664.     # Applies all the read notetag values to the default starting atb value
  5665.     default_ecatb_start_val(start)
  5666.     super(start)
  5667.     #
  5668.   end # set_ecatb_start_val
  5669.  
  5670.   # timing: The state auto removal timing
  5671.   def ecatb_update_state_turns(timing) # New
  5672.     change = false
  5673.     states.each { |state|
  5674.       next if @state_turns[state.id] <= 0 || state.auto_removal_timing != timing
  5675.       @state_turns[state.id] -= 1
  5676.       change = true
  5677.     }
  5678.     set_ecatb_battler_change if change
  5679.   end # ecatb_update_state_turns
  5680.  
  5681.   #----------------------------------------------------------------------------|
  5682.   #  Performs all the battler's atb frame updates                              |
  5683.   #----------------------------------------------------------------------------|
  5684.   def ecatb_updates # New; Hotspot
  5685.     unless @ecatb_val[:atb] <= 100.0 || set_gradual_ecatb_act_gain
  5686.       @temp_ecatb_act_times = @max_ecatb_act_times
  5687.       @ecatb_val[:atb] = 100.0
  5688.       @max_ecatb_act_times = 1
  5689.     end
  5690.     return unless @ecatb_esc || movable = restriction < 4
  5691.     # Updates the atb values, speed and countdown statuses and makes actions
  5692.     ecatb_val_updates(movable)
  5693.     ecatb_countdown_update unless @ecatb_countdown_clock.empty?
  5694.     #
  5695.   end # ecatb_updates
  5696.  
  5697.   #----------------------------------------------------------------------------|
  5698.   #  (v0.04c)Updates atb, charge and cooldown, speed reduce and makes actions  |
  5699.   #----------------------------------------------------------------------------|
  5700.   def ecatb_val_updates(movable) # New; Hotspot
  5701.     return ecatb_charge_update if @ecatb_esc || movable && ecatb_charge_update?
  5702.     if !@ecatb_esc && movable
  5703.       return ecatb_cooldown_update if @ecatb_val[:cooldown] > 0.0
  5704.       ecatb_update if @ecatb_val[:atb] < 100.0 * @max_ecatb_act_times
  5705.       return if @ecatb_val[:atb] < 100.0
  5706.       return ecatb_speed_reduce_update if @ecatb_speed_reduce > 0
  5707.     end
  5708.     make_ecatb_act unless @ecatb_val[:atb] < 100.0 || @ecatb_val[:charge] >
  5709.     0.0 || ecatb_reset_compatibility? || actor? && inputable? &&
  5710.     current_action && current_action.item && current_action.ecatb_confirm
  5711.   end # ecatb_val_updates
  5712.  
  5713.   #----------------------------------------------------------------------------|
  5714.   #  Updates the atb cooldown value and triggers cooldown finish upon finishing|
  5715.   #----------------------------------------------------------------------------|
  5716.   def ecatb_cooldown_update # New; Hotspot
  5717.     @ecatb_val[:cooldown] -= ecatb_cooldown_loss_rate
  5718.     return if @ecatb_val[:cooldown] > 0.0
  5719.     @ecatb_val[:cooldown] = 0.0 if @ecatb_val[:cooldown] < 0.0
  5720.     @ecatb_unison_actors.clear
  5721.     @ecatb_unison_invoker = @fail_ecatb_esc = false
  5722.     @ecatb_unison_rule.clear
  5723.     ecatb_cooldown_finish
  5724.   end # ecatb_cooldown_update
  5725.  
  5726.   def ecatb_update # New; Hotspot
  5727.     # Raises the change flag upon atb value change and caps it to its max
  5728.     @ecatb_val_change = @ecatb_val[:atb] != @ecatb_val[:atb] += ecatb_gain_rate
  5729.     max = 100.0 * @max_ecatb_act_times
  5730.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5731.     #
  5732.   end # ecatb_update
  5733.  
  5734.   #----------------------------------------------------------------------------|
  5735.   #  Updates the atb action input speed reduction by frames                    |
  5736.   #----------------------------------------------------------------------------|
  5737.   def ecatb_speed_reduce_update # v0.02a+; New; Hotspot
  5738.     # Returns the cached value unless it's to be reevalauted
  5739.     return set_ecatb_speed_reduce if ecatb_battler_change?(:speed)
  5740.     @ecatb_speed_reduce = 0 if (@ecatb_speed_reduce -= 1) < 0
  5741.     #
  5742.   end # ecatb_speed_reduce_update
  5743.  
  5744.   #----------------------------------------------------------------------------|
  5745.   #  Sets the atb action input speed reduction by frames                       |
  5746.   #----------------------------------------------------------------------------|
  5747.   def set_ecatb_speed_reduce # v0.02a+; New; Potential Hotspot
  5748.     # Adds the difference between the new and old to the current speed reduction
  5749.     last_speed_reduce = @last_ecatb_speed_reduce
  5750.     ecatb_speed_reduce
  5751.     super
  5752.     @ecatb_speed_reduce += @last_ecatb_speed_reduce - last_speed_reduce
  5753.     @ecatb_speed_reduce = 0 if @ecatb_speed_reduce < 0
  5754.     #
  5755.   end # set_ecatb_speed_reduce
  5756.  
  5757.   #----------------------------------------------------------------------------|
  5758.   #  Updates the atb charge value including the unison version                 |
  5759.   #----------------------------------------------------------------------------|
  5760.   def ecatb_charge_update # New; Hotspot
  5761.     unless @ecatb_unison_actors.size <= 1 || ecatb_unison_charge_update?
  5762.       return ecatb_reset
  5763.     end
  5764.     @ecatb_val[:charge] += ecatb_charge_gain_rate
  5765.     @ecatb_val[:charge] = 100.0 if @ecatb_val[:charge] > 100.0
  5766.   end # ecatb_charge_update
  5767.  
  5768.   #----------------------------------------------------------------------------|
  5769.   #  Makes actions and marks the battler as actable upon becoming able to act  |
  5770.   #----------------------------------------------------------------------------|
  5771.   def make_ecatb_act # New; Hotspot
  5772.     if @ecatb_act_times <= 0
  5773.       make_gradual_ecatb_act_gain
  5774.     elsif @ecatb_val[:atb] > 100.0
  5775.       make_ecatb_act_pool
  5776.     end
  5777.     BattleManager.make_ecatb_act(self)
  5778.   end # make_ecatb_act
  5779.  
  5780.   def make_gradual_ecatb_act_gain # v0.05a+; New
  5781.     unless set_gradual_ecatb_act_gain
  5782.       return @ecatb_act_times_add = @ecatb_act_times =
  5783.       @temp_ecatb_act_times = make_action_times_ecatb
  5784.     end
  5785.     @ecatb_act_times_add = @ecatb_act_times = @temp_ecatb_act_times = 1
  5786.     @max_ecatb_act_times = make_action_times_ecatb
  5787.     # Prevents the previously reset atb value from exceeding the new maximum
  5788.     max = 100.0 * @max_ecatb_act_times
  5789.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5790.     #
  5791.     set_ecatb_battler_change
  5792.   end # make_gradual_ecatb_act_gain
  5793.  
  5794.   #----------------------------------------------------------------------------|
  5795.   #  Synchronize the party/troop action point pool when changing action points |
  5796.   #----------------------------------------------------------------------------|
  5797.   def make_ecatb_act_pool # v0.05a+; New; Hotspot
  5798.     # Ensures that all party/troop members change their action points together
  5799.     return if
  5800.     (act_add = @ecatb_val[:atb].to_i / 100 - @temp_ecatb_act_times) == 0
  5801.     @ecatb_act_times_add = act_add
  5802.     return if @ecatb_act_times_cap =
  5803.     @temp_ecatb_act_times >= @max_ecatb_act_times
  5804.     @ecatb_act_times += @ecatb_act_times_add
  5805.     @temp_ecatb_act_times += @ecatb_act_times_add
  5806.     set_ecatb_battler_change
  5807.     #
  5808.   end # make_ecatb_act_pool
  5809.  
  5810.   #----------------------------------------------------------------------------|
  5811.   #  Updates all states' countdown clocks that aren't frozen if any            |
  5812.   #----------------------------------------------------------------------------|
  5813.   def ecatb_countdown_update # New; Hotspot
  5814.     @ecatb_battler_sprite ||= ecatb_countdown_update_compatibility_1
  5815.     # Checks if the clocks are divisible by seconds to boost time performance
  5816.     @ecatb_countdown_clock.each_key(&@ecatb_countdown_updates)
  5817.     #
  5818.     remove_states_auto(3)
  5819.   end # ecatb_countdown_update
  5820.  
  5821.   def confirm_ecatb_item # New
  5822.     # Recaches the cached values upon changes and pays costs now if specified
  5823.     @ecatb_item_change[:charge] = @ecatb_item_change[:cooldown] =
  5824.     @last_ecatb_item != @last_ecatb_item = current_action.item
  5825.     pay_prior_ecatb_charge if @last_ecatb_item
  5826.     #
  5827.   end # confirm_ecatb_item
  5828.  
  5829.   def pay_prior_ecatb_charge # New
  5830.     ecatb = DoubleX_RMVXA::ECATB
  5831.     unless ecatb.send(@last_ecatb_item.ecatb_charge_prior_act_cost, self)
  5832.       pay_ecatb_unison_act_cost
  5833.     end
  5834.     return if ecatb.send(@last_ecatb_item.ecatb_charge_prior_item_cost, self)
  5835.     return consume_item(@last_ecatb_item) if @last_ecatb_item.is_a?(RPG::Item)
  5836.     pay_skill_cost(@last_ecatb_item) if @last_ecatb_item.is_a?(RPG::Skill)
  5837.   end # pay_prior_ecatb_charge
  5838.  
  5839.   #----------------------------------------------------------------------------|
  5840.   #  Pays the action cost and sets the atb reset value unless it's forced      |
  5841.   #----------------------------------------------------------------------------|
  5842.   # forced: The action force flag
  5843.   def exec_ecatb_act_cost(forced) # New
  5844.     return unless current_action && item = current_action.item
  5845.     ecatb = DoubleX_RMVXA::ECATB
  5846.     if (force_act_cost = ecatb.send(item.ecatb_force_act_cost, self)) || !forced
  5847.       # Pays the action cost now if the skill/item requests so
  5848.       if ecatb.send(item.ecatb_charge_prior_act_cost, self)
  5849.         pay_ecatb_unison_act_cost
  5850.       end
  5851.       #
  5852.       set_ecatb_reset_val
  5853.     end
  5854.     force_act_cost
  5855.   end # exec_ecatb_act_cost
  5856.  
  5857.   def pay_ecatb_unison_act_cost # New
  5858.     return pay_ecatb_act_cost if @ecatb_unison_actors.size <= 1
  5859.     @ecatb_unison_actors.each(
  5860.     &DoubleX_RMVXA::ECATB::BLOCKS[:pay_ecatb_act_cost])
  5861.   end # pay_ecatb_unison_act_cost
  5862.  
  5863.   def pay_ecatb_act_cost # New
  5864.     return unless current_action && item = current_action.item
  5865.     set_ecatb_battler_change
  5866.     cost = DoubleX_RMVXA::ECATB.send(item.ecatb_act_cost, self)
  5867.     @temp_ecatb_act_times -= cost
  5868.     unless friends_unit.ecatb_pool
  5869.       @ecatb_val[:atb] -= cost * 100.0 if set_gradual_ecatb_act_gain
  5870.       return @ecatb_act_times -= cost
  5871.     end
  5872.     size = (members = friends_unit.alive_members).size
  5873.     members.each { |mem|
  5874.       mem.ecatb_act_times -= cost
  5875.       next unless mem.set_gradual_ecatb_act_gain
  5876.       mem.ecatb_val[:atb] -= cost * 100.0 / size
  5877.     }
  5878.   end # pay_ecatb_act_cost
  5879.  
  5880.   def set_ecatb_reset_val # New
  5881.     # Sets all unison invokee's atb reset values as well for unison skill/item
  5882.     val = current_action.item.ecatb_reset_val
  5883.     @ecatb_reset_val = (ecatb = DoubleX_RMVXA::ECATB).send(val, self)
  5884.     return if @ecatb_unison_actors.size <= 1
  5885.     (@ecatb_unison_actors & $game_party.alive_members).each{ |actor|
  5886.       actor.ecatb_reset_val = ecatb.send(val, actor)
  5887.     }
  5888.     #
  5889.   end # set_ecatb_reset_val
  5890.  
  5891.   #----------------------------------------------------------------------------|
  5892.   #  Resets the atb values and reset value, speed reduce and action points     |
  5893.   #----------------------------------------------------------------------------|
  5894.   # reset: The atb reset flag
  5895.   def ecatb_reset(reset = restriction > 3) # New
  5896.     # Pays the escape cost, refreshes the battler and triggers the pre and post
  5897.     pre_ecatb_reset
  5898.     pay_ecatb_esc_cost if @ecatb_esc
  5899.     @ecatb_speed_reduce = 0
  5900.     @ecatb_val_change = true
  5901.     return ecatb_val_reset_compatibility(reset) if ecatb_reset_compatibility?
  5902.     BattleManager.del_ecatb_act(self)
  5903.     ecatb_act_val_reset(reset)
  5904.     post_ecatb_reset
  5905.     set_ecatb_battler_change
  5906.     #
  5907.   end # ecatb_reset
  5908.  
  5909.   # reset: The atb reset flag
  5910.   def ecatb_act_val_reset(reset) # New
  5911.     @ecatb_val[:cooldown] = 0.0 if dead?
  5912.     use_ecatb_reset_val if reset || @ecatb_act_times <= 0
  5913.     @temp_ecatb_act_times = @ecatb_act_times = 0 if reset &&
  5914.     @ecatb_act_times > 0
  5915.     @max_ecatb_act_times = 1 if reset || @ecatb_act_times <= 0
  5916.     ecatb_unison_reset(reset)
  5917.     @ecatb_val[:charge] = 0.0
  5918.     return if @ecatb_act_times > 0 && index && restriction <= 0
  5919.     @ecatb_reset_val = 0.0
  5920.   end # ecatb_act_val_reset
  5921.  
  5922.   def use_ecatb_reset_val # v0.04d+; New
  5923.     BattleManager.ecatb_pool_reset(self, @ecatb_unison_actors) if
  5924.     friends_unit.ecatb_pool
  5925.     @ecatb_val[:atb] = @ecatb_reset_val
  5926.     return @ecatb_val[:atb] = 0.0 if @ecatb_val[:atb] < 0.0
  5927.     max = 100.0 * @max_ecatb_act_times
  5928.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5929.   end # use_ecatb_reset_val
  5930.  
  5931.   def ecatb_unison_reset(reset) # v0.05a+; New
  5932.     # Clears the unison actor and invoker cache if there's no unison cooldown
  5933.     if reset || @ecatb_val[:charge] < 100.0
  5934.       @ecatb_unison_actors.clear
  5935.       @ecatb_unison_invoker = false
  5936.       return @ecatb_unison_rule.clear
  5937.     end
  5938.     #
  5939.     @ecatb_val[:cooldown] = 100.0
  5940.   end # ecatb_unison_reset
  5941.  
  5942.   #----------------------------------------------------------------------------|
  5943.   #  Lets the compatibility fix deals with compatibility issues                |
  5944.   #----------------------------------------------------------------------------|
  5945.  
  5946.   def ecatb_countdown_update_compatibility_1 # New; Hotspot
  5947.   end # ecatb_countdown_update_compatibility_1
  5948.  
  5949.   def ecatb_countdown_update_compatibility_2(battler_sprite, state_id) # New;
  5950.   # Potential Hotspot
  5951.   end # ecatb_countdown_update_compatibility_2
  5952.  
  5953.   def ecatb_countdown_update_compatibility_3(state_id) # New; Potential Hotspot
  5954.   end # ecatb_countdown_update_compatibility_3
  5955.  
  5956.   # reset: The atb reset flag
  5957.   def ecatb_val_reset_compatibility(reset) # New
  5958.   end # ecatb_val_reset_compatibility
  5959.  
  5960. end # Game_Battler
  5961.  
  5962. #------------------------------------------------------------------------------|
  5963. #  * Implements the actor's additional atb actions, control flows and logics   |
  5964. #------------------------------------------------------------------------------|
  5965. class Game_Actor < Game_Battler # Edit
  5966.  
  5967.   #----------------------------------------------------------------------------|
  5968.   #  New public instance variable                                              |
  5969.   #----------------------------------------------------------------------------|
  5970.   attr_accessor :ecatb_esc # The party escape attempt flag
  5971.  
  5972.   #----------------------------------------------------------------------------|
  5973.   #  New private instance variable                                             |
  5974.   #----------------------------------------------------------------------------|
  5975.   # @ecatb_reserve: The reserved member flag
  5976.  
  5977.   #----------------------------------------------------------------------------|
  5978.   #  Creates new methods of all configurations used by actors as well          |
  5979.   #----------------------------------------------------------------------------|
  5980.   alias setup_ecatb setup
  5981.   def setup(actor_id, &argb)
  5982.     setup_ecatb(actor_id, &argb)
  5983.     # Added to fix nil @action_input_index and actors added during battle bugs
  5984.     @action_input_index = 0
  5985.     @ecatb_reserve = true
  5986.     create_ecatb_defs
  5987.     #
  5988.   end # setup
  5989.  
  5990.   #----------------------------------------------------------------------------|
  5991.   #  Confirms inputs made with the auto battle status as well                  |
  5992.   #----------------------------------------------------------------------------|
  5993.   alias make_auto_battle_actions_ecatb make_auto_battle_actions
  5994.   def make_auto_battle_actions(*argv, &argb) # v0.00d+
  5995.     make_auto_battle_actions_ecatb(*argv, &argb)
  5996.     # Added
  5997.     return unless BattleManager.btype?(:ecatb)
  5998.     confirm_ecatb_item
  5999.     set_ecatb_speed_reduce
  6000.     #
  6001.   end # make_auto_battle_actions
  6002.  
  6003.   #----------------------------------------------------------------------------|
  6004.   #  Confirms inputs made with the confusion status as well                    |
  6005.   #----------------------------------------------------------------------------|
  6006.   alias make_confusion_actions_ecatb make_confusion_actions
  6007.   def make_confusion_actions(*argv, &argb) # v0.00d+
  6008.     make_confusion_actions_ecatb(*argv, &argb)
  6009.     # Added
  6010.     return unless BattleManager.btype?(:ecatb)
  6011.     confirm_ecatb_item
  6012.     set_ecatb_speed_reduce
  6013.     #
  6014.   end # make_confusion_actions
  6015.  
  6016.   #----------------------------------------------------------------------------|
  6017.   #  Ensures actors added during battles are properly initialized as well      |
  6018.   #----------------------------------------------------------------------------|
  6019.   def on_battle_end(*argv, &argb) # v0.04e+; New
  6020.     super(*argv, &argb)
  6021.     @ecatb_reserve = true
  6022.   end # on_battle_end
  6023.  
  6024.   #----------------------------------------------------------------------------|
  6025.   #  Creates and checks the associated method for each configuration used here |
  6026.   #----------------------------------------------------------------------------|
  6027.   # config: The configuration requesting its associated method
  6028.   # validate: The configuration value validation flag
  6029.   def create_ecatb_def(config, validate = true) # New
  6030.     # Uses the name and value of configuration as its method's name and contents
  6031.     method = config.id2name
  6032.     eval(%Q(
  6033.   def #{method}#{DoubleX_RMVXA::ECATB::GAME_ACTOR[config][0]}
  6034.     #{$game_system.send(config)}
  6035.   end
  6036.     ))
  6037.     #
  6038.     return unless validate
  6039.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::GAME_ACTOR[config])
  6040.   end # create_ecatb_def
  6041.  
  6042.   #----------------------------------------------------------------------------|
  6043.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6044.   #----------------------------------------------------------------------------|
  6045.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:GAME_ACTOR]) # New
  6046.  
  6047.   #----------------------------------------------------------------------------|
  6048.   #  Ensures actors added during battles are properly initialized as well      |
  6049.   #----------------------------------------------------------------------------|
  6050.   def set_ecatb_start_val(start = :start_0) # v0.04e+; New
  6051.     super(start)
  6052.     @ecatb_reserve = false
  6053.   end # set_ecatb_start_val
  6054.  
  6055.   # start: The battle start type
  6056.   def default_ecatb_start_val(start) # New
  6057.     return normal_actor_1st_ecatb_val if start == :start_0
  6058.     return preemptive_actor_1st_ecatb_val if start == :start_1
  6059.     surprise_actor_1st_ecatb_val
  6060.   end # default_ecatb_start_val
  6061.  
  6062.   #----------------------------------------------------------------------------|
  6063.   #  Ensures actors added during battles are properly initialized as well      |
  6064.   #----------------------------------------------------------------------------|
  6065.   def ecatb_updates # v0.04e+; New ; Hotspot
  6066.     if @ecatb_reserve
  6067.       init_ecatb_vars
  6068.       @ecatb_reserve = false
  6069.     end
  6070.     super
  6071.   end # ecatb_updates
  6072.  
  6073.   def confirm_ecatb_item # New
  6074.     super
  6075.     input.ecatb_confirm = input.last_ecatb_confirm = true
  6076.     # Caches the unison actors, charge and cooldown rules if any as well
  6077.     ecatb = DoubleX_RMVXA::ECATB
  6078.     @ecatb_unison_actors = ecatb.send(@last_ecatb_item.ecatb_unison_actor, self)
  6079.     @ecatb_unison_actors.collect!(&ecatb::BLOCKS[:usable?])
  6080.     if @ecatb_unison_invoker
  6081.       @ecatb_unison_rule[:charge] = ecatb.send(
  6082.       @last_ecatb_item.ecatb_unison_charge_rule, self)
  6083.       @ecatb_unison_rule[:cooldown] = ecatb.send(
  6084.       @last_ecatb_item.ecatb_unison_cooldown_rule, self)
  6085.     end
  6086.     #
  6087.     post_ecatb_input_act
  6088.     set_ecatb_battler_change
  6089.   end # confirm_ecatb_item
  6090.  
  6091.   def init_ecatb_escape # v0.05a+; New
  6092.     @ecatb_esc = @ecatb_item_change[:charge] = true
  6093.     @ecatb_unison_actors.clear
  6094.     @ecatb_unison_invoker = false
  6095.     @ecatb_unison_rule.clear
  6096.     BattleManager.del_ecatb_act(self)
  6097.   end # init_ecatb_escape
  6098.  
  6099.   def pay_ecatb_esc_cost # New
  6100.     @ecatb_act_times -= cost = ecatb_esc_act_cost
  6101.     @temp_ecatb_act_times -= cost
  6102.     @ecatb_reset_val = ecatb_esc_reset_val
  6103.     @ecatb_val[:atb] -= cost * 100.0 if @ecatb_val[:atb] > 100.0
  6104.     @ecatb_val[:charge] = 100.0
  6105.     @ecatb_esc = false
  6106.     @ecatb_item_change[:cooldown] = @fail_ecatb_esc = true
  6107.     set_ecatb_battler_change
  6108.   end # pay_ecatb_esc_cost
  6109.  
  6110.   def ecatb_inputable? # New; Hotspot
  6111.     return false if @ecatb_val[:charge] > 0.0 || @ecatb_val[:cooldown] > 0.0
  6112.     @ecatb_act_times > 0 && inputable? && !ecatb_reset_compatibility?
  6113.   end # ecatb_inputable?
  6114.  
  6115.   # actors: The unison actors
  6116.   def ecatb_unison_usable?(item, actors) # New
  6117.     return false unless item.is_a?(RPG::UsableItem) && actors.include?(self)
  6118.     # Checks if all unison actors are inputable and can use the skill/item
  6119.     return false unless (actors - BattleManager.ecatb_actor_act_list).empty?
  6120.     unless actors.all? { |actor| actor.ecatb_unison_actor?(item, actors) }
  6121.       return false
  6122.     end
  6123.     #
  6124.     ecatb_unison_skill_item_usable?(item, actors)
  6125.   end # ecatb_unison_usable?
  6126.  
  6127.   #----------------------------------------------------------------------------|
  6128.   #  Checks if the actor's can input the skill/item and pay its costs          |
  6129.   #----------------------------------------------------------------------------|
  6130.   # actors: The unison actors
  6131.   def ecatb_unison_actor?(item, actors) # New
  6132.     return false unless inputable?
  6133.     return false unless item.is_a?(RPG::Skill) || item_conditions_met?(item)
  6134.     return false unless skills.include?(item) || skill_conditions_met?(item)
  6135.     cost = (ecatb = DoubleX_RMVXA::ECATB).send(item.ecatb_act_cost, self)
  6136.     cost *= actors.size if $game_party.ecatb_pool
  6137.     return true if @ecatb_act_times >= cost
  6138.     return false if @ecatb_val[:charge] <= 0.0
  6139.     !ecatb.send(item.ecatb_charge_prior_act_cost, self)
  6140.   end # ecatb_unison_actor?
  6141.  
  6142.   #----------------------------------------------------------------------------|
  6143.   #  Checks if the unison actors can input or use the unison skill/item        |
  6144.   #----------------------------------------------------------------------------|
  6145.   # actors: The unison actors
  6146.   def ecatb_unison_skill_item_usable?(item, actors) # New
  6147.     # Checks if all unison actors are inputable or they're all charging
  6148.     input = charge = true
  6149.     actors.each { |actor|
  6150.       act = actor.current_action
  6151.       input &&= (!act || !act.item) && actor.ecatb_val[:charge] <= 0.0
  6152.       charge &&= act && act.item == item
  6153.       return false unless input || charge
  6154.     }
  6155.     #
  6156.   end # ecatb_unison_skill_item_usable?
  6157.  
  6158. end # Game_Actor
  6159.  
  6160. #------------------------------------------------------------------------------|
  6161. #  * Implements the enemy's additional atb actions, control flows and logics   |
  6162. #------------------------------------------------------------------------------|
  6163. class Game_Enemy < Game_Battler # New
  6164.  
  6165.   #----------------------------------------------------------------------------|
  6166.   #  New private instance variables                                            |
  6167.   #----------------------------------------------------------------------------|
  6168.   # @ecatb_bar_show: The cached atb bar part display flags with display details
  6169.   # @ecatb_state_change: The state change flags
  6170.  
  6171.   #----------------------------------------------------------------------------|
  6172.   #  Confirms the action and pays its now if charge prior costs are true also  |
  6173.   #----------------------------------------------------------------------------|
  6174.   alias make_actions_ecatb make_actions
  6175.   def make_actions(*argv, &argb)
  6176.     make_actions_ecatb(*argv, &argb)
  6177.     # Added
  6178.     return unless BattleManager.btype?(:ecatb)
  6179.     return unless current_action && current_action.item
  6180.     confirm_ecatb_item
  6181.     set_ecatb_speed_reduce
  6182.     #
  6183.   end # make_actions
  6184.  
  6185.   #----------------------------------------------------------------------------|
  6186.   #  Creates and checks the associated method for each configuration used here |
  6187.   #----------------------------------------------------------------------------|
  6188.   # config: The configuration requesting its associated method
  6189.   # validate: The configuration value validation flag
  6190.   def create_ecatb_def(config, validate = true) # New
  6191.     # Uses the name and value of configuration as its method's name and contents
  6192.     method = config.id2name
  6193.     eval(%Q(
  6194.   def #{method}#{DoubleX_RMVXA::ECATB::GAME_ENEMY[config][0]}
  6195.     #{$game_system.send(config)}
  6196.   end
  6197.     ))
  6198.     #
  6199.     return unless validate
  6200.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::GAME_ENEMY[config])
  6201.   end # create_ecatb_def
  6202.  
  6203.   #----------------------------------------------------------------------------|
  6204.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6205.   #----------------------------------------------------------------------------|
  6206.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:GAME_ENEMY]) # New
  6207.  
  6208.   #----------------------------------------------------------------------------|
  6209.   #  Marks that the state array changed as well                                |
  6210.   #----------------------------------------------------------------------------|
  6211.   def erase_state(state_id, &argb) # New
  6212.     @ecatb_state_change = [true, true, true, true] if @states.include?(state_id)
  6213.     super(state_id, &argb)
  6214.   end # erase_state
  6215.  
  6216.   #----------------------------------------------------------------------------|
  6217.   #  Marks that the state array changed as well                                |
  6218.   #----------------------------------------------------------------------------|
  6219.   def clear_states(*argv, &argb) # New
  6220.     super(*argv, &argb)
  6221.     @ecatb_state_change = [true, true, true, true]
  6222.   end # clear_states
  6223.  
  6224.   #----------------------------------------------------------------------------|
  6225.   #  Marks that the state array changed as well                                |
  6226.   #----------------------------------------------------------------------------|
  6227.   def add_new_state(state_id, &argb) # New
  6228.     super(state_id, &argb)
  6229.     @ecatb_state_change = [true, true, true, true]
  6230.   end # add_new_state
  6231.  
  6232.   def init_ecatb_vars # New
  6233.     super
  6234.     @ecatb_bar_show = []
  6235.   end # init_ecatb_vars
  6236.  
  6237.   #----------------------------------------------------------------------------|
  6238.   #  Marks that the enemy with id being this enemy's id has been killed before |
  6239.   #----------------------------------------------------------------------------|
  6240.   def die # New
  6241.     super
  6242.     return if $game_party.ecatb_dead_enemies.include?(@enemy_id)
  6243.     $game_party.ecatb_dead_enemies << @enemy_id
  6244.   end # die
  6245.  
  6246.   # start: The battle start type
  6247.   def default_ecatb_start_val(start) # New
  6248.     return normal_enemy_1st_ecatb_val if start == :start_0
  6249.     return preemptive_enemy_1st_ecatb_val if start == :start_1
  6250.     surprise_enemy_1st_ecatb_val
  6251.   end # default_ecatb_start_val
  6252.  
  6253.   def confirm_ecatb_item # New
  6254.     super
  6255.     post_ecatb_input_act
  6256.   end # confirm_ecatb_item
  6257.  
  6258.   # index: The indicator of which atb bar parts queries its display flag
  6259.   def ecatb_bar_show?(index) # New; Hotspot
  6260.     # Reevaluates the atb bar part display flags only if the states changed
  6261.     if @ecatb_state_change[index]
  6262.       @ecatb_state_change[index] = @ecatb_bar_show[index] = nil
  6263.       states.each { |state|
  6264.         next if (show = state.enemy_ecatb_bar_show[index]).nil?
  6265.         return @ecatb_bar_show[index] = show
  6266.       }
  6267.     end
  6268.     #
  6269.     return @ecatb_bar_show[index] unless @ecatb_bar_show[index].nil?
  6270.     enemy.enemy_ecatb_bar_show[index]
  6271.   end # ecatb_bar_show?
  6272.  
  6273. end # Game_Enemy
  6274.  
  6275. #------------------------------------------------------------------------------|
  6276. #  * Hosts the atb pool mode flag for game party and troop                     |
  6277. #------------------------------------------------------------------------------|
  6278. class Game_Unit # Edit
  6279.  
  6280.   #----------------------------------------------------------------------------|
  6281.   #  New public instance variable                                              |
  6282.   #----------------------------------------------------------------------------|
  6283.   attr_accessor :ecatb_pool # The party/troop atb pool mode flag
  6284.  
  6285. end # Game_Unit
  6286.  
  6287. #------------------------------------------------------------------------------|
  6288. #  * Holds the defeated enemies, added actors and removed actors during battles|
  6289. #------------------------------------------------------------------------------|
  6290. class Game_Party < Game_Unit # Edit
  6291.  
  6292.   #----------------------------------------------------------------------------|
  6293.   #  New public instance variable                                              |
  6294.   #----------------------------------------------------------------------------|
  6295.   attr_accessor :ecatb_dead_enemies # The list of defeated enemies
  6296.  
  6297.   #----------------------------------------------------------------------------|
  6298.   #  Creates new methods of all configurations used by actors as well          |
  6299.   #----------------------------------------------------------------------------|
  6300.   alias initialize_ecatb initialize
  6301.   def initialize(*argv, &argb)
  6302.     initialize_ecatb(*argv, &argb)
  6303.     create_ecatb_defs # Added
  6304.   end # initialize
  6305.  
  6306.   #----------------------------------------------------------------------------|
  6307.   #  Initializes all new variables as well                                     |
  6308.   #----------------------------------------------------------------------------|
  6309.   alias init_all_items_ecatb init_all_items
  6310.   def init_all_items(*argv, &argb)
  6311.     init_all_items_ecatb(*argv, &argb)
  6312.     @ecatb_dead_enemies = [] # Added
  6313.   end # init_all_items
  6314.  
  6315.   #----------------------------------------------------------------------------|
  6316.   #  Notifies that an actor's added into the party as well                     |
  6317.   #----------------------------------------------------------------------------|
  6318.   alias add_actor_ecatb add_actor # v0.02b+
  6319.   def add_actor(actor_id, &argb)
  6320.     # Added
  6321.     if @in_battle && !@actors.include?(actor_id)
  6322.       $game_temp.ecatb_add_actors << $game_actors[actor_id]
  6323.     end
  6324.     #
  6325.     add_actor_ecatb(actor_id, &argb)
  6326.   end # add_actor
  6327.  
  6328.   #----------------------------------------------------------------------------|
  6329.   #  Notifies that an actor's removed from the party as well                   |
  6330.   #----------------------------------------------------------------------------|
  6331.   alias remove_actor_ecatb remove_actor # v0.02b+
  6332.   def remove_actor(actor_id, &argb)
  6333.     # Added
  6334.     if @in_battle && @actors.include?(actor_id)
  6335.       $game_temp.ecatb_remove_actors << $game_actors[actor_id]
  6336.     end
  6337.     #
  6338.     remove_actor_ecatb(actor_id, &argb)
  6339.   end # remove_actor
  6340.  
  6341.   #----------------------------------------------------------------------------|
  6342.   #  Creates and checks the associated method for each configuration used here |
  6343.   #----------------------------------------------------------------------------|
  6344.   # config: The configuration requesting its associated method
  6345.   # validate: The configuration value validation flag
  6346.   def create_ecatb_def(config, validate = true) # New
  6347.     # Uses the name and value of configuration as its method's name and contents
  6348.     method = config.id2name
  6349.     eval(%Q(
  6350.   def #{method}#{DoubleX_RMVXA::ECATB::GAME_PARTY_TROOP[config][0]}
  6351.     #{$game_system.send(config)}
  6352.   end
  6353.     ))
  6354.     #
  6355.     return unless validate
  6356.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::GAME_PARTY_TROOP[config])
  6357.   end # create_ecatb_def
  6358.  
  6359.   #----------------------------------------------------------------------------|
  6360.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6361.   #----------------------------------------------------------------------------|
  6362.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:GAME_PARTY_TROOP]) # New
  6363.  
  6364. end # Game_Party
  6365.  
  6366. class Game_Troop < Game_Unit # Edit
  6367.  
  6368.   #----------------------------------------------------------------------------|
  6369.   #  Initializes all enemies' new variables and methods as well                |
  6370.   #----------------------------------------------------------------------------|
  6371.   alias setup_ecatb setup
  6372.   def setup(troop_id, &argb)
  6373.     setup_ecatb(troop_id, &argb)
  6374.     @enemies.each(&DoubleX_RMVXA::ECATB::BLOCKS[:create_ecatb_defs]) # Added
  6375.   end # setup
  6376.  
  6377.   #----------------------------------------------------------------------------|
  6378.   #  Creates and checks the associated method for each configuration used here |
  6379.   #----------------------------------------------------------------------------|
  6380.   # config: The configuration requesting its associated method
  6381.   # validate: The configuration value validation flag
  6382.   def create_ecatb_def(config, validate = true) # New
  6383.     # Uses the name and value of configuration as its method's name and contents
  6384.     method = config.id2name
  6385.     eval(%Q(
  6386.   def #{method}#{DoubleX_RMVXA::ECATB::GAME_PARTY_TROOP[config][0]}
  6387.     #{$game_system.send(config)}
  6388.   end
  6389.     ))
  6390.     #
  6391.     return unless validate
  6392.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::GAME_PARTY_TROOP[config])
  6393.   end # create_ecatb_def
  6394.  
  6395.   #----------------------------------------------------------------------------|
  6396.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6397.   #----------------------------------------------------------------------------|
  6398.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:GAME_PARTY_TROOP]) # New
  6399.  
  6400. end # Game_Troop
  6401.  
  6402. #------------------------------------------------------------------------------|
  6403. #  * Hosts actor/enemy sprite atb, charge and cooldown bars                    |
  6404. #------------------------------------------------------------------------------|
  6405. class Sprite_Battler < Sprite_Base # Edit
  6406.  
  6407.   #----------------------------------------------------------------------------|
  6408.   #  New private instance variable                                             |
  6409.   #----------------------------------------------------------------------------|
  6410.   # @ecatb_bars: The battler's atb bars
  6411.  
  6412.   #----------------------------------------------------------------------------|
  6413.   #  Create all atb bars as well                                               |
  6414.   #----------------------------------------------------------------------------|
  6415.   alias initialize_ecatb initialize
  6416.   def initialize(viewport, battler = nil, &argb)
  6417.     initialize_ecatb(viewport, battler, &argb)
  6418.     # Added
  6419.     return unless BattleManager.btype?(:ecatb) && @battler
  6420.     return unless @battler.enemy? || BattleManager.actor_sprite_ecatb_bar
  6421.     create_ecatb_bars
  6422.     #
  6423.   end # initialize
  6424.  
  6425.   #----------------------------------------------------------------------------|
  6426.   #  Disposes all atb bars as well                                             |
  6427.   #----------------------------------------------------------------------------|
  6428.   alias dispose_ecatb dispose
  6429.   def dispose(*argv, &argb)
  6430.     dispose_ecatb(*argv, &argb)
  6431.     # Added
  6432.     return unless @ecatb_bars && BattleManager.btype?(:ecatb)
  6433.     @ecatb_bars.each_value(&DoubleX_RMVXA::ECATB::BLOCKS[:dispose])
  6434.     @ecatb_bars = nil
  6435.     #
  6436.   end # dispose
  6437.  
  6438.   #----------------------------------------------------------------------------|
  6439.   #  Updates all atb bars as well                                              |
  6440.   #----------------------------------------------------------------------------|
  6441.   alias update_ecatb update
  6442.   def update # Hotspot
  6443.     update_ecatb
  6444.     # Added
  6445.     return unless @ecatb_bars && BattleManager.btype?(:ecatb)
  6446.     @ecatb_bars.each_value(&DoubleX_RMVXA::ECATB::BLOCKS[:update])
  6447.     #
  6448.   end # update
  6449.  
  6450.   #----------------------------------------------------------------------------|
  6451.   #  Creates the back, atb, charge, color and text bars                        |
  6452.   #----------------------------------------------------------------------------|
  6453.   def create_ecatb_bars # New
  6454.     @ecatb_bars = {}
  6455.     # Uses 1 bar for each atb type if multilayer's used
  6456.     types = if @battler.ecatb_bar_multilayer
  6457.       [:back, :atb, :charge, :cooldown, :text]
  6458.     else
  6459.       [:back, :atbs, :text]
  6460.     end
  6461.     #
  6462.     types.each { |type| @ecatb_bars[type] = ECATB_Bar.new(@battler, type) }
  6463.   end # create_ecatb_bars
  6464.  
  6465. end # Sprite_Battler
  6466.  
  6467. #------------------------------------------------------------------------------|
  6468. #  * (v0.00b+)Fixes bugs and edge cases                                        |
  6469. #------------------------------------------------------------------------------|
  6470. class Spriteset_Battle # Edit
  6471.  
  6472.   #----------------------------------------------------------------------------|
  6473.   #  Inserts actors into the actor sprites as well                             |
  6474.   #----------------------------------------------------------------------------|
  6475.   alias create_actors_ecatb create_actors
  6476.   def create_actors(*argv, &argb)
  6477.     # Rewritten
  6478.     return create_actors_ecatb(*argv, &argb) unless BattleManager.btype?(:ecatb)
  6479.     dispose_actors if @actor_sprites
  6480.     @actor_sprites = $game_party.battle_members.reverse!.collect! { |actor|
  6481.       Sprite_Battler.new(@viewport1, actor)
  6482.     }
  6483.     #
  6484.   end # create_actors
  6485.  
  6486. end # Spriteset_Battle
  6487.  
  6488. #------------------------------------------------------------------------------|
  6489. #  * (v0.01a+)Handles the battler icons in the atb battler order window        |
  6490. #------------------------------------------------------------------------------|
  6491. class ECATB_Order_Battler_Icon < Sprite # New
  6492.  
  6493.   #----------------------------------------------------------------------------|
  6494.   #  Private instance variables                                                |
  6495.   #----------------------------------------------------------------------------|
  6496.   # @battler: The battler using the atb order icon
  6497.   # @icon: The battler atb order icon
  6498.   # @window: The battler atb order window
  6499.  
  6500.   def initialize(battler, window)
  6501.     super(SceneManager.scene.spriteset.viewport1)
  6502.     @battler = battler
  6503.     @window = window
  6504.     update
  6505.   end # initialize
  6506.  
  6507.   def dispose
  6508.     return if disposed?
  6509.     bitmap.dispose unless bitmap.disposed?
  6510.     super
  6511.   end # dispose
  6512.  
  6513.   def update # Hotspot
  6514.     return unless (self.visible = @battler.alive?) &&
  6515.     BattleManager.phase != :init
  6516.     if @icon != icon = @battler.set_ecatb_order_battler_icon
  6517.       @icon = icon.clone
  6518.       create_sprite_bitmap
  6519.     end
  6520.     update_pos
  6521.   end # update
  6522.  
  6523.   def create_sprite_bitmap # Potential Hotspot
  6524.     bitmap.dispose if bitmap && !bitmap.disposed?
  6525.     self.bitmap = Bitmap.new(dw = @icon[1].width, dh = @icon[1].height)
  6526.     self.ox = self.oy = 0
  6527.     scale = @battler.set_ecatb_order_battler_scale
  6528.     bitmap.stretch_blt(Rect.new(0, 0, dw * scale, dh * scale), @icon[0],
  6529.     @icon[1], @battler.set_ecatb_order_battler_opacity)
  6530.     @icon[0].dispose unless @icon[0].disposed?
  6531.   end # create_sprite_bitmap
  6532.  
  6533.   #----------------------------------------------------------------------------|
  6534.   #  Updates the icon x, y and z positions if they're changed                  |
  6535.   #----------------------------------------------------------------------------|
  6536.   def update_pos # Hotspot
  6537.     # Checks the battler's atb type and updates the icon positions accordingly
  6538.     dw = @window.ecatb_order_bar_wh[0] / 3
  6539.     xyz = @window.ecatb_order_window_xyz
  6540.     dx = xyz[0] + @battler.ecatb_order_battler_icon_x
  6541.     dx += if (type = @battler.ecatb_bar_type) == :cooldown
  6542.       (100.0 - @battler.ecatb_val[type] % 100.0) / 100.0 * dw
  6543.     else
  6544.       ([@battler.ecatb_val[type], 100.0].min / 100.0 +
  6545.       (type == :atb ? 1 : 2)) * dw
  6546.     end
  6547.     #
  6548.     self.x = dx if x != dx
  6549.     dy = xyz[1] + if @battler.actor?
  6550.       @battler.ecatb_order_actor_icon_y
  6551.     else
  6552.       @battler.ecatb_order_enemy_icon_y
  6553.     end
  6554.     self.y = dy if y != dy
  6555.     dz = @battler.set_ecatb_order_battler_z
  6556.     self.z = dz if z != dz
  6557.   end # update_pos
  6558.  
  6559. end # ECATB_Order_Battler_Icon
  6560.  
  6561. #------------------------------------------------------------------------------|
  6562. #  * Handles the actor/enemy sprite atb, charge and cooldown bars              |
  6563. #------------------------------------------------------------------------------|
  6564. class ECATB_Bar < Viewport # New
  6565.  
  6566.   #----------------------------------------------------------------------------|
  6567.   #  Private instance variables                                                |
  6568.   #----------------------------------------------------------------------------|
  6569.   # @battler: The battler using the atb bar
  6570.   # @last_wh: The last atb bar width and height
  6571.   # @last_text_xy_offset : The last text x and y offsets
  6572.   # @last_x: The last atb bar x position
  6573.   # @last_y: The last atb bar y position
  6574.   # @last_xy_offset: The last atb bar x and y offsets
  6575.   # @one_color: The color 1 and color 2 being the same flag
  6576.   # @outline: The atb bar outline drawing flag
  6577.   # @plane: The plane with the bitmap drawing the atb bar
  6578.   # @type: The atb bar type
  6579.  
  6580.   # type: The atb bar type
  6581.   def initialize(battler, type)
  6582.     init_vars(battler, type)
  6583.     create_ecatb_defs
  6584.     dw = (wh = ecatb_bar_wh)[0]
  6585.     dh = @type == :text ? ecatb_bar_text_size : wh[1]
  6586.     if @outline
  6587.       dw += 2
  6588.       dh += 2
  6589.     end
  6590.     super(Rect.new((xy = ecatb_bar_xy_offset)[0], xy[1], dw, dh))
  6591.     init_bars
  6592.   end # initialize
  6593.  
  6594.   # type: The atb bar type
  6595.   def init_vars(battler, type)
  6596.     @battler = battler
  6597.     @type = type
  6598.     @outline = @type == :back || @type == :text
  6599.   end # init_vars
  6600.  
  6601.   #----------------------------------------------------------------------------|
  6602.   #  Creates and checks the associated method for each configuration used here |
  6603.   #----------------------------------------------------------------------------|
  6604.   # config: The configuration requesting its associated method
  6605.   # validate: The configuration value validation flag
  6606.   def create_ecatb_def(config, validate = true) # v0.04f+
  6607.     # Uses the name and value of configuration as its method's name and contents
  6608.     method = config.id2name
  6609.     eval(%Q(
  6610.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_BAR[config][0]}
  6611.     #{$game_system.send(config)}
  6612.   end
  6613.     ))
  6614.     #
  6615.     return unless validate
  6616.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_BAR[config])
  6617.   end # create_ecatb_def
  6618.  
  6619.   #----------------------------------------------------------------------------|
  6620.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6621.   #----------------------------------------------------------------------------|
  6622.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_BAR]) # v0.04f+
  6623.  
  6624.   def init_bars
  6625.     (@plane = Plane.new(self)).bitmap = Bitmap.new(rect.width * 2, rect.height)
  6626.     self.visible = false
  6627.     update_pos
  6628.     draw_bars
  6629.   end # init_bars
  6630.  
  6631.   def dispose
  6632.     return if @plane.disposed?
  6633.     @plane.bitmap.dispose if @plane.bitmap
  6634.     @plane.dispose
  6635.     super
  6636.   end # dispose
  6637.  
  6638.   #----------------------------------------------------------------------------|
  6639.   #  Updates the bar visibility, xy positions, width, height, color and text   |
  6640.   #----------------------------------------------------------------------------|
  6641.   def update # Hotspot
  6642.     super
  6643.     return unless self.visible = visible?
  6644.     update_pos
  6645.     unless @outline
  6646.       update_bar_w
  6647.       if @battler.ecatb_battler_change?(type = @battler.ecatb_bar_type)
  6648.         return draw_bars unless @type != type && @battler.ecatb_bar_multilayer
  6649.       end
  6650.     end
  6651.     return update_text if @type == :text
  6652.     @plane.ox -= ecatb_bar_ani_ox if @one_color && ecatb_bar_ani
  6653.   end # update
  6654.  
  6655.   #----------------------------------------------------------------------------|
  6656.   #  Updates the bar xy positions and height only if any of them changes       |
  6657.   #----------------------------------------------------------------------------|
  6658.   def update_pos # Hotspot
  6659.     z_pos = ecatb_bar_z
  6660.     self.z = z_pos if z != z_pos
  6661.     return unless update_pos?
  6662.     rect.width = @last_wh[0] + 2 if @outline
  6663.     rect.height = @last_wh[1] + (@outline ? 2 : 0)
  6664.     update_xy
  6665.   end # update_pos
  6666.  
  6667.   #----------------------------------------------------------------------------|
  6668.   #  Updates the bar and text xy positions                                     |
  6669.   #----------------------------------------------------------------------------|
  6670.   def update_xy # Hotspot
  6671.     dx = @last_x + @last_xy_offset[0] - (@last_wh[0] + (@outline ? 2 : 0)) / 2
  6672.     dy = @last_y + @last_xy_offset[1]
  6673.     if @type == :text
  6674.       dx += @last_text_xy_offset[0]
  6675.       dy += @last_text_xy_offset[1]
  6676.     end
  6677.     rect.x = dx
  6678.     dh = rect.height + (@outline ? 1 : 3)
  6679.     rect.y = dy + (@outline ? 0 : 1)
  6680.   end # update_xy
  6681.  
  6682.   def draw_bars
  6683.     dw = rect.width
  6684.     dh = rect.height
  6685.     @outline ? rect.width = @last_wh[0] + 2 : update_bar_w
  6686.     @one_color = (colors = set_bar_colors)[0] == colors[1]
  6687.     (bitmap = @plane.bitmap).gradient_fill_rect(0, 0, dw, dh, colors[0],
  6688.     colors[1])
  6689.     bitmap.gradient_fill_rect(dw, 0, dw, dh, colors[1], colors[0])
  6690.   end # draw_bars
  6691.  
  6692.   #----------------------------------------------------------------------------|
  6693.   #  Updates the atb bar width if it's changed                                 |
  6694.   #----------------------------------------------------------------------------|
  6695.   def update_bar_w # Hotspot
  6696.     type = @battler.ecatb_bar_multilayer ? @type : @battler.ecatb_bar_type
  6697.     w = @battler.ecatb_val[type] % 100.0 * @last_wh[0] / 100.0
  6698.     rect.width = w if rect.width != w
  6699.   end # update_bar_w
  6700.  
  6701.   def set_bar_colors
  6702.     return ecatb_bar_back_colors if @type == :back
  6703.     return [Color.new(0, 0, 0, 0), Color.new(0, 0, 0, 0)] if @type == :text
  6704.     type = @battler.ecatb_bar_multilayer ? @type : @battler.ecatb_bar_type
  6705.     @battler.set_ecatb_bar_colors(type)
  6706.     @battler.ecatb_notes[type]
  6707.   end # set_bar_colors
  6708.  
  6709.   #----------------------------------------------------------------------------|
  6710.   #  Redraws the atb bar texts only if its contents and/or fonts changed       |
  6711.   #----------------------------------------------------------------------------|
  6712.   def update_text # Hotspot
  6713.     text = ecatb_bar_text((text = set_text)[0], text[1])
  6714.     return unless update_text_font? || @last_text != text
  6715.     @last_text = text
  6716.     return self.visible = false if text.empty?
  6717.     self.visible = true
  6718.     dw = (bitmap = @plane.bitmap).text_size(text).width
  6719.     bitmap.clear
  6720.     bitmap.draw_text(@last_wh[0] + 2 - dw, 0, dw,
  6721.     bitmap.text_size(text).height, text)
  6722.   end # update_text
  6723.  
  6724.   #----------------------------------------------------------------------------|
  6725.   #  Sets the atb bar fill percent and action point text if they're to be shown|
  6726.   #----------------------------------------------------------------------------|
  6727.   def set_text # Hotspot
  6728.     [@battler.actor? || @battler.ecatb_bar_show?(2) ?
  6729.      @battler.ecatb_val[@battler.ecatb_bar_type].to_i.to_s : "",
  6730.      @battler.actor? || @battler.ecatb_bar_show?(3) ?
  6731.      @battler.ecatb_act_times.to_s : ""]
  6732.   end # set_text
  6733.  
  6734.   #----------------------------------------------------------------------------|
  6735.   #  Checks if the atb bars and text should be visible                         |
  6736.   #----------------------------------------------------------------------------|
  6737.   def visible? # Hotspot
  6738.     # Checks if the battler's alive and the enemy's bars should be shown
  6739.     return false if $game_party.all_dead? || $game_troop.all_dead?
  6740.     return @battler.alive? if @battler.actor?
  6741.     return false unless @battler.alive? && @battler.ecatb_bar_show?(1)
  6742.     return true unless @battler.ecatb_bar_show?(0)
  6743.     $game_party.ecatb_dead_enemies.include?(@battler.enemy_id)
  6744.     #
  6745.   end # visible?
  6746.  
  6747.   #----------------------------------------------------------------------------|
  6748.   #  Checks if the atb bar and text positions need to be updated               |
  6749.   #----------------------------------------------------------------------------|
  6750.   def update_pos? # Hotspot
  6751.     # Checks if the bar width, height, offset or battler x or y position changes
  6752.     dx = @battler.screen_x
  6753.     dy = @battler.screen_y
  6754.     xy_offset = ecatb_bar_xy_offset
  6755.     same_pos = @last_wh == (wh = ecatb_bar_wh) && @last_x == dx &&
  6756.     @last_y == dy && @last_xy_offset == xy_offset
  6757.     return false if @type != :text && same_pos
  6758.     if @type == :text
  6759.       text_xy_offset = ecatb_bar_text_xy_offset
  6760.       return false if same_pos && @last_text_xy_offset == text_xy_offset
  6761.       @last_text_xy_offset = text_xy_offset.clone
  6762.     end
  6763.     @last_wh = wh.clone
  6764.     @last_x = dx
  6765.     @last_y = dy
  6766.     @last_xy_offset = xy_offset
  6767.     #
  6768.   end # update_pos?
  6769.  
  6770.   #----------------------------------------------------------------------------|
  6771.   #  Checks if the atb bar text color and size's changed and updates them if so|
  6772.   #----------------------------------------------------------------------------|
  6773.   def update_text_font? # Hotspot
  6774.     change = false
  6775.     if (font = @plane.bitmap.font).color != color = ecatb_bar_text_color
  6776.       change = font.color = color
  6777.     end
  6778.     size = ecatb_bar_text_size
  6779.     change = font.size = size if font.size != size
  6780.     change
  6781.     #
  6782.   end # update_text_font?
  6783.  
  6784. end # ECATB_Bar
  6785.  
  6786. #------------------------------------------------------------------------------|
  6787. #  * Handles the battle atb clock bar in battle atb clock and turn window      |
  6788. #------------------------------------------------------------------------------|
  6789. class ECATB_Clock_Bar < Viewport # New
  6790.  
  6791.   #----------------------------------------------------------------------------|
  6792.   #  Private instance variables                                                |
  6793.   #----------------------------------------------------------------------------|
  6794.   # @last_w: Stores the last width of the atb clock bar
  6795.   # @plane: Stores the plane with the bitmap drawing the atb clock bar
  6796.  
  6797.   def initialize
  6798.     create_ecatb_defs
  6799.     xy = ecatb_clock_bar_xy
  6800.     rect = Rect.new(xy[0], xy[1], (wh = ecatb_clock_bar_wh)[0], wh[1])
  6801.     super(rect)
  6802.     create_bars
  6803.     update_bar_wh
  6804.     update_bar_xy
  6805.   end # initialize
  6806.  
  6807.   #----------------------------------------------------------------------------|
  6808.   #  Creates and checks the associated method for each configuration used here |
  6809.   #----------------------------------------------------------------------------|
  6810.   # config: The configuration requesting its associated method
  6811.   # validate: The configuration value validation flag
  6812.   def create_ecatb_def(config, validate = true) # New
  6813.     # Uses the name and value of configuration as its method's name and contents
  6814.     method = config.id2name
  6815.     eval(%Q(
  6816.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_CLOCK_BAR[config][0]}
  6817.     #{$game_system.send(config)}
  6818.   end
  6819.     ))
  6820.     #
  6821.     return unless validate
  6822.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_CLOCK_BAR[config])
  6823.   end # create_ecatb_def
  6824.  
  6825.   #----------------------------------------------------------------------------|
  6826.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6827.   #----------------------------------------------------------------------------|
  6828.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_CLOCK_BAR]) # New
  6829.  
  6830.   def dispose
  6831.     return if @plane.disposed?
  6832.     @plane.bitmap.dispose if @plane.bitmap
  6833.     @plane.dispose
  6834.     super
  6835.   end # dispose
  6836.  
  6837.   def create_bars
  6838.     (@plane = Plane.new(self)).bitmap = Bitmap.new(rect.width * 2, rect.height)
  6839.     update_bar_colors
  6840.     self.visible = true
  6841.   end # create_bars
  6842.  
  6843.   def update_bar_colors # Potential Hotspot
  6844.     @plane.bitmap.gradient_fill_rect(0, 0, rect.width, rect.height,
  6845.     (colors = ecatb_clock_bar_colors)[0], colors[1])
  6846.     rect.width = 0
  6847.   end # update_bar_colors
  6848.  
  6849.   #----------------------------------------------------------------------------|
  6850.   #  Updates the atb clock window bar width and height only if they've changed |
  6851.   #----------------------------------------------------------------------------|
  6852.   def update_bar_wh # Potential Hotspot
  6853.     wh = ecatb_clock_bar_wh
  6854.     rect.width = @last_w = wh[0] if @last_w != wh[0]
  6855.     rect.height = wh[1] if rect.height != wh[1]
  6856.   end # update_bar_wh
  6857.  
  6858.   #----------------------------------------------------------------------------|
  6859.   #  Updates the atb clock window bar xy positions only if they've changed     |
  6860.   #----------------------------------------------------------------------------|
  6861.   def update_bar_xy # Potential Hotspot
  6862.     xy = ecatb_clock_bar_xy
  6863.     rect.x = xy[0] if rect.x != xy[0]
  6864.     rect.y = xy[1] if rect.y != xy[1]
  6865.   end # update_bar_xy
  6866.  
  6867.   #----------------------------------------------------------------------------|
  6868.   #  Updates the atb clock window bar length only if it needs to change        |
  6869.   #----------------------------------------------------------------------------|
  6870.   # cur_clock: The number of frames passed in the current turn
  6871.   # max_clock: The number of frames of the current turn
  6872.   def update_bar(cur_clock, max_clock) # Hotspot
  6873.     update
  6874.     w = @last_w * 1.0 * cur_clock / max_clock
  6875.     rect.width = w if rect.width != w
  6876.   end # update_bar
  6877.  
  6878. end # ECATB_Clock_Bar
  6879.  
  6880. #------------------------------------------------------------------------------|
  6881. #  * Fixes bugs and edge cases                                                 |
  6882. #------------------------------------------------------------------------------|
  6883. class Window_ItemList < Window_Selectable # Edit
  6884.  
  6885.   #----------------------------------------------------------------------------|
  6886.   #  Disables items in battles when the user doesn't have enough action points |
  6887.   #----------------------------------------------------------------------------|
  6888.   alias enable_ecatb? enable?
  6889.   def enable?(item)
  6890.     # Added
  6891.     if SceneManager.scene_is?(Scene_Battle) && item && item.is_a?(RPG::Item)
  6892.       if BattleManager.btype?(:ecatb)
  6893.         battler = BattleManager.actor
  6894.         return battler.usable?(item) if (ecatb = DoubleX_RMVXA::ECATB).send(
  6895.         item.ecatb_act_cost, battler) > 1 || ecatb.send(
  6896.         item.ecatb_unison_actor, battler).size > 1
  6897.       end
  6898.     end
  6899.     #
  6900.     enable_ecatb?(item)
  6901.   end # enable?
  6902.  
  6903. end # Window_ItemList
  6904.  
  6905. #------------------------------------------------------------------------------|
  6906. #  * Fixes bugs and edge cases                                                 |
  6907. #------------------------------------------------------------------------------|
  6908. class Window_EquipItem < Window_ItemList # v0.02d+; Edit
  6909.  
  6910.   #----------------------------------------------------------------------------|
  6911.   #  Clears and resets all blocks of the actor before and after serialization  |
  6912.   #----------------------------------------------------------------------------|
  6913.   alias update_help_ecatb update_help
  6914.   def update_help
  6915.     @actor.clear_ecatb_blocks # Added
  6916.     update_help_ecatb
  6917.     @actor.reset_ecatb_blocks if SceneManager.scene_is?(Scene_Battle) # Added
  6918.   end # update_help
  6919.  
  6920. end # Window_EquipItem
  6921.  
  6922. #------------------------------------------------------------------------------|
  6923. #  * Shows all unison actors' names when executing an unison skill/item        |
  6924. #------------------------------------------------------------------------------|
  6925. class Window_BattleLog < Window_Selectable # Edit
  6926.  
  6927.   #----------------------------------------------------------------------------|
  6928.   #  Displays all unison actors' names if they're all to be shown as well      |
  6929.   #----------------------------------------------------------------------------|
  6930.   alias display_use_item_ecatb display_use_item
  6931.   def display_use_item(subject, item, &argb)
  6932.     # Added
  6933.     if BattleManager.btype?(:ecatb) && subject.show_ecatb_unison_battlers
  6934.       if subject.ecatb_unison_actors.size > 1
  6935.         return display_ecatb_unison_item(item, subject.ecatb_unison_actors)
  6936.       end
  6937.     end
  6938.     #
  6939.     display_use_item_ecatb(subject, item, &argb)
  6940.   end # display_use_item
  6941.  
  6942.   # actors: The unison actors
  6943.   def display_ecatb_unison_item(item, actors) # New
  6944.     battler_names = ecatb_unison_battler_names(actors)
  6945.     unless item.is_a?(RPG::Skill)
  6946.       return add_text(sprintf(Vocab::UseItem, battler_names, item.name))
  6947.     end
  6948.     add_text(battler_names + item.message1)
  6949.     return if item.message2.empty?
  6950.     wait
  6951.     add_text(item.message2)
  6952.   end # display_use_item
  6953.  
  6954.   # actors: The unison actors
  6955.   def ecatb_unison_battler_names(actors) # New
  6956.     names = ""
  6957.     max_index = actors.size - 1
  6958.     actors.each_with_index { |actor, index|
  6959.       (names += index < max_index ? ", " : " and ") if index > 0
  6960.       names += actor.name
  6961.     }
  6962.     names
  6963.   end # ecatb_unison_battler_names
  6964.  
  6965. end # Window_BattleLog
  6966.  
  6967. #------------------------------------------------------------------------------|
  6968. #  * Adds actor selection hotkeys and lets directional commands cycle          |
  6969. #------------------------------------------------------------------------------|
  6970. class Window_ActorCommand < Window_Command # Edit
  6971.  
  6972.   #----------------------------------------------------------------------------|
  6973.   #  New private instance variable                                             |
  6974.   #----------------------------------------------------------------------------|
  6975.   # @ecatb_hotkey_block: The hotkey handling block
  6976.  
  6977.   #----------------------------------------------------------------------------|
  6978.   #  Initializes the new block used by process_handling as well                |
  6979.   #----------------------------------------------------------------------------|
  6980.   alias initialize_ecatb initialize
  6981.   def initialize(*argv, &argb)
  6982.     initialize_ecatb(*argv, &argb)
  6983.     init_ecatb_block # Added
  6984.   end # initialize
  6985.  
  6986.   #----------------------------------------------------------------------------|
  6987.   #  Set left arrow output as switching to prior actor in ecatb battle system  |
  6988.   #----------------------------------------------------------------------------|
  6989.   alias process_dir4_ecatb process_dir4
  6990.   def process_dir4 # Potential Hotspot
  6991.     return process_dir4_ecatb unless BattleManager.btype?(:ecatb) # Rewritten
  6992.     # Added
  6993.     Sound.play_cursor
  6994.     Input.update
  6995.     deactivate
  6996.     call_handler(:dir4)
  6997.     #
  6998.   end # process_dir4
  6999.  
  7000.   #----------------------------------------------------------------------------|
  7001.   #  Calls the hotkey handler methods if the hotkey's pressed                  |
  7002.   #----------------------------------------------------------------------------|
  7003.   module_eval(DoubleX_RMVXA::ECATB::ACTOR_HOTKEY) # Alias; Hotspot
  7004.  
  7005.   #----------------------------------------------------------------------------|
  7006.   #  Initializes the new block to trade memory usage for time performance      |
  7007.   #----------------------------------------------------------------------------|
  7008.   def init_ecatb_block # New
  7009.     # Calls this block instead of an anonymous function per enumerable iteration
  7010.     @ecatb_hotkey_block =
  7011.     -> hotkey { return call_handler(hotkey) if Input.trigger?(hotkey) }
  7012.     #
  7013.   end # init_ecatb_block
  7014.  
  7015. end # Window_ActorCommand
  7016.  
  7017. #------------------------------------------------------------------------------|
  7018. #  * Draws the atb, charge and cooldown bars of all actors                     |
  7019. #------------------------------------------------------------------------------|
  7020. class Window_BattleStatus < Window_Selectable # New
  7021.  
  7022.   #----------------------------------------------------------------------------|
  7023.   #  (v0.04f+)New public instance variables                                    |
  7024.   #----------------------------------------------------------------------------|
  7025.   attr_writer :ecatb_text_change # The atb bar text format change notifier
  7026.   attr_writer :ecatb_word_change # The atb bar description change notifier
  7027.   attr_writer :ecatb_y_add_change # The atb bar y offset change notifier
  7028.  
  7029.   #----------------------------------------------------------------------------|
  7030.   #  New private instance variables                                            |
  7031.   #----------------------------------------------------------------------------|
  7032.   # @ecatb_draw_bars: The atb bar drawing iteartor block
  7033.   # @last_ecatb_text: The last atb bar fill percentage and action point text
  7034.   # @last_ecatb_w: The last atb bar width
  7035.  
  7036.   #----------------------------------------------------------------------------|
  7037.   #  Initializes all new methods and block as well                             |
  7038.   #----------------------------------------------------------------------------|
  7039.   alias initialize_ecatb initialize
  7040.   def initialize(*argv, &argb)
  7041.     initialize_ecatb(*argv, &argb)
  7042.     # Added
  7043.     create_ecatb_defs
  7044.     @last_ecatb_text = {}
  7045.     @last_ecatb_w = {}
  7046.     init_ecatb_block
  7047.     #
  7048.   end # initialize
  7049.  
  7050.   #----------------------------------------------------------------------------|
  7051.   #  Redraws the atb bar and text if the battle started as well                |
  7052.   #----------------------------------------------------------------------------|
  7053.   alias draw_item_ecatb draw_item
  7054.   def draw_item(index, &argb) # Potential Hotspot
  7055.     draw_item_ecatb(index, &argb)
  7056.     # Added
  7057.     return if BattleManager.phase == :init
  7058.     return unless index && BattleManager.btype?(:ecatb)
  7059.     set_ecatb_bar(index, true) unless BattleManager.actor_sprite_ecatb_bar
  7060.     #
  7061.   end # draw_item
  7062.  
  7063.   #----------------------------------------------------------------------------|
  7064.   #  Creates and checks the associated method for each configuration used here |
  7065.   #----------------------------------------------------------------------------|
  7066.   # config: The configuration requesting its associated method
  7067.   # validate: The configuration value validation flag
  7068.   def create_ecatb_def(config, validate = true) # New
  7069.     # Uses the name and value of configuration as its method's name and contents
  7070.     method = config.id2name
  7071.     eval(%Q(
  7072.   def #{method}#{DoubleX_RMVXA::ECATB::WINDOW_BATTLESTATUS[config][0]}
  7073.     #{$game_system.send(config)}
  7074.   end
  7075.     ))
  7076.     #
  7077.     return unless validate
  7078.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::WINDOW_BATTLESTATUS[config])
  7079.   end # create_ecatb_def
  7080.  
  7081.   #----------------------------------------------------------------------------|
  7082.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7083.   #----------------------------------------------------------------------------|
  7084.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:WINDOW_BATTLESTATUS]) # New
  7085.  
  7086.   #----------------------------------------------------------------------------|
  7087.   #  Initializes the new block to trade memory usage for time performance      |
  7088.   #----------------------------------------------------------------------------|
  7089.   def init_ecatb_block # New
  7090.     # Calls this block instead of an anonymous function per enumerable iteration
  7091.     @ecatb_draw_bars = -> index { set_ecatb_bar(index) }
  7092.     #
  7093.   end # init_ecatb_block
  7094.  
  7095.   def ecatb_bar_refresh # New; Hotspot
  7096.     item_max.times(&@ecatb_draw_bars)
  7097.   end # ecatb_bar_refresh
  7098.  
  7099.   #----------------------------------------------------------------------------|
  7100.   #  Sets the color, length, width and y position of the actor's atb bar       |
  7101.   #----------------------------------------------------------------------------|
  7102.   # redrawn: The status window redrawn flag
  7103.   def set_ecatb_bar(index, redrawn = false) # New; Hotspot
  7104.     return if $game_troop.all_dead?
  7105.     return unless actor = $game_party.battle_members[index]
  7106.     battler_change = actor.ecatb_battler_change?(type = actor.ecatb_bar_type)
  7107.     # Redraws atb bar and text only if they're changed or window's redrawn
  7108.     return unless draw_ecatb_bar?(actor, redrawn, type, battler_change)
  7109.     draw_ecatb_bar(actor, (rect = item_rect(index)).x + 2, line_height +
  7110.     YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + actor_ecatb_bar_y_add,
  7111.     rect.width - 4, actor.ecatb_bar_type, battler_change)
  7112.     #
  7113.   end # set_ecatb_bar
  7114.  
  7115.   #----------------------------------------------------------------------------|
  7116.   #  Draws the actor's atb bar with its description and details text           |
  7117.   #----------------------------------------------------------------------------|
  7118.   # type: The atb bar type to be drawn
  7119.   # change: The atb bar color change flag
  7120.   def draw_ecatb_bar(actor, dx, dy, width, type, change) # New; Hotspot
  7121.     actor.set_ecatb_bar_colors(type) if change
  7122.     draw_gauge(dx, dy, width, actor.ecatb_val[type] % 100.0 / 100.0,
  7123.     (colors = actor.ecatb_notes[type])[0], colors[1])
  7124.     change_color(system_color)
  7125.     draw_text(dx + 2, dy + (Font.default_size - contents.font.size) / 2 + 1,
  7126.     30, line_height, actor_ecatb_bar_word)
  7127.     return if @last_ecatb_text[actor].empty?
  7128.     draw_ecatb_text(actor, dx, dy, width, type)
  7129.   end # draw_ecatb_bar
  7130.  
  7131.   # type: The atb bar type to be drawn
  7132.   def draw_ecatb_text(actor, dx, dy, width, type) # New; Hotspot
  7133.     dw = text_size(text = actor_ecatb_bar_text(@last_ecatb_text[actor][0],
  7134.     @last_ecatb_text[actor][1])).width + 2
  7135.     draw_text(dx + width - dw, dy + (Font.default_size - contents.font.size) /
  7136.     2 + 1, dw, line_height, text)
  7137.   end # draw_ecatb_text
  7138.  
  7139.   # redrawn: The status window redrawn flag
  7140.   def draw_ecatb_bar?(actor, redrawn, type, battler_change) # v0.04f+; New;
  7141.   # Hotspot
  7142.     w_change = @last_ecatb_w[actor] != @last_ecatb_w[actor] =
  7143.     actor.ecatb_val[type] % 100.0 * (item_rect(index).width - 4) / 100.0
  7144.     text_change = @last_ecatb_text[actor] != @last_ecatb_text[actor] = [
  7145.     actor.ecatb_val[type].to_i.to_s, actor.ecatb_act_times.to_s]
  7146.     # Lets users notifies that the atb bar text format's changed instead
  7147.     return false unless redrawn || battler_change || w_change || text_change ||
  7148.     @ecatb_text_change || @ecatb_word_change || @ecatb_y_add_change
  7149.     !(@ecatb_text_change = @ecatb_word_change = @ecatb_y_add_change = false)
  7150.     #
  7151.   end # set_ecatb_bar
  7152.  
  7153. end # Window_BattleStatus
  7154.  
  7155. #------------------------------------------------------------------------------|
  7156. #  * Adds actor selection hotkeys and lets directional commands cycle          |
  7157. #------------------------------------------------------------------------------|
  7158. class Window_BattleActor < Window_BattleStatus # Edit
  7159.  
  7160.   #----------------------------------------------------------------------------|
  7161.   #  New private instance variable                                             |
  7162.   #----------------------------------------------------------------------------|
  7163.   # @ecatb_hotkey_block: The hotkey handling block
  7164.  
  7165.   #----------------------------------------------------------------------------|
  7166.   #  Always allow cyclic directional navigations in the ecatb battle system    |
  7167.   #----------------------------------------------------------------------------|
  7168.   alias horizontal_ecatb? horizontal?
  7169.   def horizontal? # Hotspot
  7170.     BattleManager.btype?(:ecatb) || horizontal_ecatb? # Rewritten
  7171.   end # horizontal?
  7172.  
  7173.   #----------------------------------------------------------------------------|
  7174.   #  Always allow cyclic directional navigations in the ecatb battle system    |
  7175.   #----------------------------------------------------------------------------|
  7176.   alias cursor_right_ecatb cursor_right
  7177.   def cursor_right(wrap = false) # Hotspot
  7178.     cursor_right_ecatb(wrap || BattleManager.btype?(:ecatb)) # Rewritten
  7179.   end # cursor_right
  7180.  
  7181.   #----------------------------------------------------------------------------|
  7182.   #  Always allow cyclic directional navigations in the ecatb battle system    |
  7183.   #----------------------------------------------------------------------------|
  7184.   alias cursor_left_ecatb cursor_left
  7185.   def cursor_left(wrap = false) # Hotspot
  7186.     cursor_left_ecatb(wrap || BattleManager.btype?(:ecatb)) # Rewritten
  7187.   end # cursor_left
  7188.  
  7189.   #----------------------------------------------------------------------------|
  7190.   #  Calls the hotkey handler methods if the hotkey's pressed                  |
  7191.   #----------------------------------------------------------------------------|
  7192.   module_eval(DoubleX_RMVXA::ECATB::ACTOR_HOTKEY) # Alias; Hotspot
  7193.  
  7194.   #----------------------------------------------------------------------------|
  7195.   #  Initializes the new block to trade memory usage for time performance      |
  7196.   #----------------------------------------------------------------------------|
  7197.   def init_ecatb_block # New
  7198.     super
  7199.     # Calls this block instead of an anonymous function per enumerable iteration
  7200.     @ecatb_hotkey_block =
  7201.     -> hotkey { return call_handler(hotkey) if Input.trigger?(hotkey) }
  7202.     #
  7203.   end # init_ecatb_block
  7204.  
  7205. end # Window_BattleActor
  7206.  
  7207. #------------------------------------------------------------------------------|
  7208. #  * Adds enemy selection hotkeys and fixes bugs and edge cases                |
  7209. #------------------------------------------------------------------------------|
  7210. class Window_BattleEnemy < Window_Selectable # Edit
  7211.  
  7212.   #----------------------------------------------------------------------------|
  7213.   #  New private instance variable                                             |
  7214.   #----------------------------------------------------------------------------|
  7215.   # @ecatb_hotkey_block: The hotkey handling block
  7216.  
  7217.   #----------------------------------------------------------------------------|
  7218.   #  Updates only when the enemies has changed                                 |
  7219.   #----------------------------------------------------------------------------|
  7220.   def update # Rewrite; Hotspot
  7221.     super
  7222.     # Added
  7223.     return unless active && (!BattleManager.btype?(:ecatb) || ecatb_update?)
  7224.     #
  7225.     return enemy.sprite_effect_type = :whiten unless select_all?
  7226.     @data.each(&DoubleX_RMVXA::ECATB::BLOCKS[:window_battleenemy_update])
  7227.   end # update
  7228.  
  7229.   #----------------------------------------------------------------------------|
  7230.   #  Initializes the new block used by process_handling as well                |
  7231.   #----------------------------------------------------------------------------|
  7232.   alias initialize_ecatb initialize # v0.04d+
  7233.   def initialize(info_viewport, &argb)
  7234.     initialize_ecatb(info_viewport, &argb)
  7235.     init_ecatb_block # Added
  7236.   end # initialize
  7237.  
  7238.   #----------------------------------------------------------------------------|
  7239.   #  Prevents division by 0 error                                              |
  7240.   #----------------------------------------------------------------------------|
  7241.   alias col_max_ecatb col_max
  7242.   def col_max # Hotspot
  7243.     # Added
  7244.     return ((max = col_max_ecatb) < 1 ? 1 : max) if BattleManager.btype?(:ecatb)
  7245.     #
  7246.     col_max_ecatb
  7247.   end # col_max
  7248.  
  7249.   #----------------------------------------------------------------------------|
  7250.   #  Calls the hotkey handler methods if the hotkey's pressed                  |
  7251.   #----------------------------------------------------------------------------|
  7252.   module_eval(DoubleX_RMVXA::ECATB::ACTOR_HOTKEY) # v0.04d+; Alias; Hotspot
  7253.  
  7254.   #----------------------------------------------------------------------------|
  7255.   #  Checks if the enemies has changed and updates their data accordingly      |
  7256.   #----------------------------------------------------------------------------|
  7257.   def ecatb_update? # New; Hotspot
  7258.     return false if (alive_members = $game_troop.alive_members).empty?
  7259.     if @data.size != alive_members.size
  7260.       @data = alive_members
  7261.       @data.sort!(&DoubleX_RMVXA::ECATB::BLOCKS[:sort_screen_x])
  7262.       @index = @data.size - 1 if @index >= @data.size
  7263.     end
  7264.     true
  7265.   end # ecatb_update?
  7266.  
  7267.   #----------------------------------------------------------------------------|
  7268.   #  Initializes the new block to trade memory usage for time performance      |
  7269.   #----------------------------------------------------------------------------|
  7270.   def init_ecatb_block # v0.04d+; New
  7271.     # Calls this block instead of an anonymous function per enumerable iteration
  7272.     @ecatb_hotkey_block =
  7273.     -> hotkey { return call_handler(hotkey) if Input.trigger?(hotkey) }
  7274.     #
  7275.   end # init_ecatb_block
  7276.  
  7277. end # Window_BattleEnemy
  7278.  
  7279. #------------------------------------------------------------------------------|
  7280. #  * Fixes bugs and edge cases                                                 |
  7281. #------------------------------------------------------------------------------|
  7282. class Window_BattleHelp < Window_Help # v0.04a+; Edit
  7283.  
  7284.   #----------------------------------------------------------------------------|
  7285.   #  Only lets valid battlers have their names retrieved                       |
  7286.   #----------------------------------------------------------------------------|
  7287.   alias battler_name_ecatb battler_name
  7288.   def battler_name(battler) # Hotspot
  7289.     battler ? battler_name_ecatb(battler) : nil # Rewritten
  7290.   end # battler_name
  7291.  
  7292.   alias refresh_battler_name_ecatb refresh_battler_name
  7293.   def refresh_battler_name(battler) # v0.05a+; Hotspot
  7294.     refresh_battler_name_ecatb(battler) if battler # Rewritten
  7295.   end # refresh_battler_name
  7296.  
  7297. end # Window_BattleHelp
  7298.  
  7299. #------------------------------------------------------------------------------|
  7300. #  * Handles the battle atb clock and turn number window                       |
  7301. #------------------------------------------------------------------------------|
  7302. class ECATB_Clock_Window < Window_Base # New
  7303.  
  7304.   #----------------------------------------------------------------------------|
  7305.   #  Public instance variables                                                 |
  7306.   #----------------------------------------------------------------------------|
  7307.   attr_reader :clock_bar # The atb clock bar
  7308.   attr_writer :cur_clock # The current atb clock
  7309.   attr_writer :max_clock # The atb clock maximum
  7310.  
  7311.   #----------------------------------------------------------------------------|
  7312.   #  Private instance variables                                                |
  7313.   #----------------------------------------------------------------------------|
  7314.   # @last_text_x: The last text x position
  7315.   # @last_text_y: The last text y position
  7316.  
  7317.   # cur_clock: The number of frames passed in the current turn
  7318.   # max_clock: The number of frames of the current turn
  7319.   def initialize(cur_clock, max_clock)
  7320.     create_ecatb_defs
  7321.     xyz = ecatb_clock_window_xyz
  7322.     super(xyz[0], xyz[1], (wh = ecatb_clock_window_wh)[0], wh[1])
  7323.     self.z = xyz[2]
  7324.     @clock_bar = ECATB_Clock_Bar.new
  7325.     @cur_clock = cur_clock
  7326.     @max_clock = max_clock
  7327.     update_text_font
  7328.     update_text_xy
  7329.     refresh
  7330.   end # initialize
  7331.  
  7332.   #----------------------------------------------------------------------------|
  7333.   #  Creates and checks the associated method for each configuration used here |
  7334.   #----------------------------------------------------------------------------|
  7335.   # config: The configuration requesting its associated method
  7336.   # validate: The configuration value validation flag
  7337.   def create_ecatb_def(config, validate = true) # New
  7338.     # Uses the name and value of configuration as its method's name and contents
  7339.     method = config.id2name
  7340.     eval(%Q(
  7341.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_CLOCK_WINDOW[config][0]}
  7342.     #{$game_system.send(config)}
  7343.   end
  7344.     ))
  7345.     #
  7346.     return unless validate
  7347.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_CLOCK_WINDOW[config])
  7348.   end # create_ecatb_def
  7349.  
  7350.   #----------------------------------------------------------------------------|
  7351.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7352.   #----------------------------------------------------------------------------|
  7353.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_CLOCK_WINDOW])
  7354.  
  7355.   def dispose
  7356.     @clock_bar.dispose if @clock_bar
  7357.     super
  7358.   end # dispose
  7359.  
  7360.   #----------------------------------------------------------------------------|
  7361.   #  Updates the window positions, width and height, and text font             |
  7362.   #----------------------------------------------------------------------------|
  7363.   module_eval(DoubleX_RMVXA::ECATB::WINDOW_DEFS[:clock])
  7364.  
  7365.   #----------------------------------------------------------------------------|
  7366.   #  Updates the atb clock text x and y positions only if they change          |
  7367.   #----------------------------------------------------------------------------|
  7368.   def update_text_xy # Potential Hotspot
  7369.     xy = ecatb_clock_text_xy
  7370.     @last_text_x = xy[0] if @last_text_x != xy[0]
  7371.     @last_text_y = xy[1] if @last_text_y != xy[1]
  7372.   end # update_text_xy
  7373.  
  7374.   #----------------------------------------------------------------------------|
  7375.   #  Refreshes the atb clock window bar and text                               |
  7376.   #----------------------------------------------------------------------------|
  7377.   def refresh # Hotspot
  7378.     contents.clear
  7379.     @clock_bar.update_bar(@cur_clock, @max_clock)
  7380.       draw_text(@last_text_x, @last_text_y, contents.width, contents.height,
  7381.     ecatb_clock_text(@cur_clock, @max_clock, $game_troop.turn_count), 0)
  7382.   end # refresh
  7383.  
  7384. end # ECATB_Clock_Window
  7385.  
  7386. #------------------------------------------------------------------------------|
  7387. #  * Handles the atb force status window                                       |
  7388. #------------------------------------------------------------------------------|
  7389. class ECATB_Force_Window < Window_Base # New
  7390.  
  7391.   #----------------------------------------------------------------------------|
  7392.   #  Private instance variables                                                |
  7393.   #----------------------------------------------------------------------------|
  7394.   # @last_text_x: The last text x position
  7395.   # @last_text_y: The last text y position
  7396.  
  7397.   # force: The atb force status
  7398.   def initialize(force)
  7399.     create_ecatb_defs
  7400.     xyz = ecatb_force_window_xyz
  7401.     super(xyz[0], xyz[1], (wh = ecatb_force_window_wh)[0], wh[1])
  7402.     self.z = xyz[2]
  7403.     update_text_font
  7404.     update_text_xy
  7405.     draw_text(force ||= :nil)
  7406.   end # initialize
  7407.  
  7408.   #----------------------------------------------------------------------------|
  7409.   #  Creates and checks the associated method for each configuration used here |
  7410.   #----------------------------------------------------------------------------|
  7411.   # config: The configuration requesting its associated method
  7412.   # validate: The configuration value validation flag
  7413.   def create_ecatb_def(config, validate = true) # New
  7414.     # Uses the name and value of configuration as its method's name and contents
  7415.     method = config.id2name
  7416.     eval(%Q(
  7417.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_FORCE_WINDOW[config][0]}
  7418.     #{$game_system.send(config)}
  7419.   end
  7420.     ))
  7421.     #
  7422.     return unless validate
  7423.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_FORCE_WINDOW[config])
  7424.   end # create_ecatb_def
  7425.  
  7426.   #----------------------------------------------------------------------------|
  7427.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7428.   #----------------------------------------------------------------------------|
  7429.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_FORCE_WINDOW])
  7430.  
  7431.   #----------------------------------------------------------------------------|
  7432.   #  Updates the window positions, width and height, and text font             |
  7433.   #----------------------------------------------------------------------------|
  7434.   module_eval(DoubleX_RMVXA::ECATB::WINDOW_DEFS[:force])
  7435.  
  7436.   #----------------------------------------------------------------------------|
  7437.   #  Updates the atb force text x and y positions only if they change          |
  7438.   #----------------------------------------------------------------------------|
  7439.   def update_text_xy # Potential Hotspot
  7440.     xy = ecatb_force_text_xy
  7441.     @last_text_x = xy[0] if @last_text_x != xy[0]
  7442.     @last_text_y = xy[1] if @last_text_y != xy[1]
  7443.   end # update_text_xy
  7444.  
  7445.   # force: The atb force status
  7446.   def draw_text(force)
  7447.     contents.clear
  7448.     text = if force == :nil
  7449.       ecatb_force_nil_text
  7450.     elsif force == :run
  7451.       ecatb_force_run_text
  7452.     else
  7453.       ecatb_force_stop_text
  7454.     end
  7455.       super(@last_text_x, @last_text_y, contents.width, contents.height, text, 0)
  7456.   end # draw_text
  7457.  
  7458. end # ECATB_Force_Window
  7459.  
  7460. #------------------------------------------------------------------------------|
  7461. #  * Handles the atb battler icon order window                                 |
  7462. #------------------------------------------------------------------------------|
  7463. class ECATB_Order_Window < Window_Base # v0.01a+; New
  7464.  
  7465.   #----------------------------------------------------------------------------|
  7466.   #  Private instance variable                                                 |
  7467.   #----------------------------------------------------------------------------|
  7468.   # @battler_icons: All atb order battler icons
  7469.  
  7470.   def initialize
  7471.     create_ecatb_defs
  7472.     xyz = ecatb_order_window_xyz
  7473.     super(xyz[0], xyz[1], (wh = ecatb_order_window_wh)[0], wh[1])
  7474.     self.z = xyz[2]
  7475.     draw_bars
  7476.     @battler_icons = {}
  7477.     ($game_party.all_members + $game_troop.members).each { |mem|
  7478.       @battler_icons[mem] = ECATB_Order_Battler_Icon.new(mem, self)
  7479.     }
  7480.   end # initialize
  7481.  
  7482.   #----------------------------------------------------------------------------|
  7483.   #  Creates and checks the associated method for each configuration used here |
  7484.   #----------------------------------------------------------------------------|
  7485.   # config: The configuration requesting its associated method
  7486.   # validate: The configuration value validation flag
  7487.   def create_ecatb_def(config, validate = true) # New
  7488.     # Uses the name and value of configuration as its method's name and contents
  7489.     method = config.id2name
  7490.     eval(%Q(
  7491.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_ORDER_WINDOW[config][0]}
  7492.     #{$game_system.send(config)}
  7493.   end
  7494.     ))
  7495.     #
  7496.     return unless validate
  7497.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_ORDER_WINDOW[config])
  7498.   end # create_ecatb_def
  7499.  
  7500.   #----------------------------------------------------------------------------|
  7501.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7502.   #----------------------------------------------------------------------------|
  7503.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_ORDER_WINDOW])
  7504.  
  7505.   def dispose
  7506.     @battler_icons.each_value(&DoubleX_RMVXA::ECATB::BLOCKS[:dispose])
  7507.     super
  7508.   end # dispose
  7509.  
  7510.   #----------------------------------------------------------------------------|
  7511.   #  Updates the window positions, width and height, and text font             |
  7512.   #----------------------------------------------------------------------------|
  7513.   module_eval(DoubleX_RMVXA::ECATB::WINDOW_DEFS[:order])
  7514.  
  7515.   #----------------------------------------------------------------------------|
  7516.   #  Adding and removing some battler icons as well as updating existing ones  |
  7517.   #----------------------------------------------------------------------------|
  7518.   def update_battler_icons # Hotspot
  7519.     update_battler_icon_list
  7520.     @battler_icons.each_value(&DoubleX_RMVXA::ECATB::BLOCKS[:update])
  7521.   end # update_battler_icons
  7522.  
  7523.   #----------------------------------------------------------------------------|
  7524.   #  Updates the list of battlers having icons showing the orders              |
  7525.   #----------------------------------------------------------------------------|
  7526.   def update_battler_icon_list # v0.02b+; Hotspot
  7527.     # Creates and delete icons for newly added and removed battlers respectively
  7528.     unless (actors = $game_temp.ecatb_add_actors).empty?
  7529.       $game_temp.ecatb_add_actors.clear
  7530.       actors.each { |actor|
  7531.         @battler_icons[actor] ||= ECATB_Order_Battler_Icon.new(actor, self)
  7532.       }
  7533.     end
  7534.     return if (actors = $game_temp.ecatb_remove_actors).empty?
  7535.     $game_temp.ecatb_remove_actors.clear
  7536.     actors.each { |a| @battler_icons[a].dispose if @battler_icons[a] }
  7537.     #
  7538.   end # update_battler_icon_list
  7539.  
  7540.   #----------------------------------------------------------------------------|
  7541.   #  Draws the cooldown, atb and charge bars  from the left to the right       |
  7542.   #----------------------------------------------------------------------------|
  7543.   def draw_bars # Potential Hotspot
  7544.     color = ecatb_order_cooldown_bar_colors
  7545.     contents.gradient_fill_rect((xy = ecatb_order_bar_xy)[0], xy[1],
  7546.     (wh = ecatb_order_bar_wh)[0] / 3, wh[1], color[0], color[1])
  7547.     contents.gradient_fill_rect(xy[0] + wh[0] / 3, xy[1], wh[0] / 3, wh[1],
  7548.     (color = ecatb_order_bar_colors)[0], color[1])
  7549.     contents.gradient_fill_rect(xy[0] + wh[0] * 2 / 3, xy[1], wh[0] / 3, wh[1],
  7550.     (color = ecatb_order_charge_bar_colors)[0], color[1])
  7551.     draw_texts(wh[0] / 3)
  7552.   end # draw_bars
  7553.  
  7554.   #----------------------------------------------------------------------------|
  7555.   #  Draws the cooldown, atb and charge texts from the left to the right       |
  7556.   #----------------------------------------------------------------------------|
  7557.   # dw: The maximum cooldown, atb and charge text width
  7558.   def draw_texts(dw) # Potential Hotspot
  7559.     update_text_font
  7560.     wh = text_size(text = ecatb_order_cooldown_bar_text)
  7561.     xy = ecatb_order_text_xy
  7562.     draw_text(xy[0], xy[1], wh.width + 2, wh.height, text)
  7563.     wh = text_size(text = ecatb_order_bar_text)
  7564.     draw_text(xy[0] + dw, xy[1], wh.width + 2, wh.height, text)
  7565.     wh = text_size(text = ecatb_order_charge_bar_text)
  7566.     draw_text(xy[0] + dw * 2, xy[1], wh.width + 2, wh.height, text)
  7567.   end # draw_texts
  7568.  
  7569. end # ECATB_Order_Window
  7570.  
  7571. #------------------------------------------------------------------------------|
  7572. #  * Handles the pool atb mode window                                          |
  7573. #------------------------------------------------------------------------------|
  7574. class ECATB_Pool_Window < Window_Base # New
  7575.  
  7576.   #----------------------------------------------------------------------------|
  7577.   #  Private instance variables                                                |
  7578.   #----------------------------------------------------------------------------|
  7579.   # @last_party_x: The last party pool text x position
  7580.   # @last_party_y: The last party pool text y position
  7581.   # @last_troop_x: The last troop pool text x position
  7582.   # @last_troop_y: The last troop pool text y position
  7583.  
  7584.   def initialize
  7585.     create_ecatb_defs
  7586.     xyz = ecatb_pool_window_xyz
  7587.     super(xyz[0], xyz[1], (wh = ecatb_pool_window_wh)[0], wh[1])
  7588.     self.z = xyz[2]
  7589.     update_text_font
  7590.     update_text_xy
  7591.     draw_text
  7592.   end # initialize
  7593.  
  7594.   #----------------------------------------------------------------------------|
  7595.   #  Creates and checks the associated method for each configuration used here |
  7596.   #----------------------------------------------------------------------------|
  7597.   # config: The configuration requesting its associated method
  7598.   # validate: The configuration value validation flag
  7599.   def create_ecatb_def(config, validate = true) # New
  7600.     # Uses the name and value of configuration as its method's name and contents
  7601.     method = config.id2name
  7602.     eval(%Q(
  7603.   def #{method}#{DoubleX_RMVXA::ECATB::ECATB_POOL_WINDOW[config][0]}
  7604.     #{$game_system.send(config)}
  7605.   end
  7606.     ))
  7607.     #
  7608.     return unless validate
  7609.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::ECATB_POOL_WINDOW[config])
  7610.   end # create_ecatb_def
  7611.  
  7612.   #----------------------------------------------------------------------------|
  7613.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7614.   #----------------------------------------------------------------------------|
  7615.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:ECATB_POOL_WINDOW])
  7616.  
  7617.   #----------------------------------------------------------------------------|
  7618.   #  Updates the window positions, width and height, and text font             |
  7619.   #----------------------------------------------------------------------------|
  7620.   module_eval(DoubleX_RMVXA::ECATB::WINDOW_DEFS[:pool])
  7621.  
  7622.   #----------------------------------------------------------------------------|
  7623.   #  Updates party and troop atb pool mode text x, y positions if they change  |
  7624.   #----------------------------------------------------------------------------|
  7625.   def update_text_xy # Potential Hotspot
  7626.     xy = ecatb_pool_party_text_xy
  7627.     @last_party_x = xy[0] if @last_party_x != xy[0]
  7628.     @last_party_y = xy[1] if @last_party_y != xy[1]
  7629.     xy = ecatb_pool_troop_text_xy
  7630.     @last_troop_x = xy[0] if @last_troop_x != xy[0]
  7631.     @last_troop_y = xy[1] if @last_troop_y != xy[1]
  7632.   end # update_text_xy
  7633.  
  7634.   #----------------------------------------------------------------------------|
  7635.   #  Draws the party and troop atb mode text on the window                     |
  7636.   #----------------------------------------------------------------------------|
  7637.   def draw_text # Potential Hotspot
  7638.     contents.clear
  7639.       super(@last_party_x, @last_party_y, contents.width, contents.height,
  7640.     ecatb_pool_party_actor_text[$game_party.ecatb_pool ? 0 : 1], 0)
  7641.       super(@last_troop_x, @last_troop_y, contents.width, contents.height,
  7642.     ecatb_pool_troop_enemy_text[$game_troop.ecatb_pool ? 0 : 1], 0)
  7643.   end # draw_text
  7644.  
  7645. end # ECATB_Pool_Window
  7646.  
  7647. #------------------------------------------------------------------------------|
  7648. #  * Reconstructs the the whole battle flow to control the atb system          |
  7649. #------------------------------------------------------------------------------|
  7650. class Scene_Battle < Scene_Base # Edit
  7651.  
  7652.   #----------------------------------------------------------------------------|
  7653.   #  New public instance variables                                             |
  7654.   #----------------------------------------------------------------------------|
  7655.   attr_accessor :ecatb_clock_window # The atb clock window
  7656.   attr_accessor :ecatb_force_window # The atb force window
  7657.   attr_accessor :ecatb_order_window # The atb order window
  7658.   attr_accessor :ecatb_pool_window # The atb pool window
  7659.  
  7660.   #----------------------------------------------------------------------------|
  7661.   #  New private instance variables                                            |
  7662.   #----------------------------------------------------------------------------|
  7663.   # @ecatb_act_block: The action execution iterator block
  7664.   # @ecatb_cancel_help_window: The atb cancel help window
  7665.   # @ecatb_clock: The global atb clock
  7666.   # @ecatb_force_clock: The atb force status
  7667.   # @ecatb_refresh_block: The window refresh iterator block
  7668.  
  7669.   #----------------------------------------------------------------------------|
  7670.   #  Creates new methods, window command handlers, variables and blocks as well|
  7671.   #----------------------------------------------------------------------------|
  7672.   alias start_ecatb start
  7673.   def start(*argv, &argb)
  7674.     start_ecatb(*argv, &argb)
  7675.     ecatb_start # Added
  7676.   end # start
  7677.  
  7678.   #----------------------------------------------------------------------------|
  7679.   #  Updates the atb cancel window and force clock for the ecatb battle system |
  7680.   #----------------------------------------------------------------------------|
  7681.   alias update_basic_ecatb update_basic
  7682.   def update_basic # Hotspot
  7683.     update_basic_ecatb
  7684.     # Added
  7685.     return unless BattleManager.btype?(:ecatb)
  7686.     update_ecatb_cancel_window if update_ecatb_cancel_window?
  7687.     update_ecatb_force_clock
  7688.     #
  7689.   end # update_basic
  7690.  
  7691.   #----------------------------------------------------------------------------|
  7692.   #  Run the atb frame update if the wait conditions aren't met as well        |
  7693.   #----------------------------------------------------------------------------|
  7694.   alias update_for_wait_ecatb update_for_wait
  7695.   def update_for_wait # Hotspot
  7696.     update_for_wait_ecatb
  7697.     # Added
  7698.     return unless BattleManager.phase != :init && BattleManager.btype?(:ecatb)
  7699.     ecatb_update if ecatb_update?
  7700.     #
  7701.   end # update_for_wait
  7702.  
  7703.   #----------------------------------------------------------------------------|
  7704.   #  Moves the info viewport according to which windows are active as well     |
  7705.   #----------------------------------------------------------------------------|
  7706.   alias update_info_viewport_ecatb update_info_viewport
  7707.   def update_info_viewport # Hotspot
  7708.     update_info_viewport_ecatb
  7709.     ecatb_update_info_viewport if BattleManager.btype?(:ecatb) # Added
  7710.   end # update_info_viewport
  7711.  
  7712.   #----------------------------------------------------------------------------|
  7713.   #  Open the active status, actor command and party command windows as well   |
  7714.   #----------------------------------------------------------------------------|
  7715.   alias update_message_open_ecatb update_message_open
  7716.   def update_message_open # Hotspot
  7717.     update_message_open_ecatb
  7718.     # Added
  7719.     return if $game_message.busy?
  7720.     return unless @status_window.close?
  7721.     return if $game_troop.all_dead? || $game_party.all_dead?
  7722.     ecatb_update_message_open if BattleManager.btype?(:ecatb)
  7723.     #
  7724.   end # update_message_open
  7725.  
  7726.   #----------------------------------------------------------------------------|
  7727.   #  Create new windows in the ecatb battle system as well                     |
  7728.   #----------------------------------------------------------------------------|
  7729.   alias create_all_windows_ecatb create_all_windows
  7730.   def create_all_windows(*argv, &argb)
  7731.     create_all_windows_ecatb(*argv, &argb)
  7732.     create_ecatb_windows if BattleManager.btype?(:ecatb) # Added
  7733.   end # create_all_windows
  7734.  
  7735.   alias start_actor_command_selection_ecatb start_actor_command_selection
  7736.   def start_actor_command_selection # v0.05a+; Potential Hotspot
  7737.     start_actor_command_selection_ecatb
  7738.     @actor_command_window.show if BattleManager.btype?(:ecatb) # Added
  7739.   end # start_actor_command_selection
  7740.  
  7741.   #----------------------------------------------------------------------------|
  7742.   #  Processes unison attacks as well                                          |
  7743.   #----------------------------------------------------------------------------|
  7744.   alias command_attack_ecatb command_attack
  7745.   def command_attack(*argv, &argb)
  7746.     # Added
  7747.     return unless actor = BattleManager.actor
  7748.     if BattleManager.btype?(:ecatb)
  7749.       ecatb = DoubleX_RMVXA::ECATB
  7750.       actors = ecatb.send($data_skills[actor.attack_skill_id].
  7751.       ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?])
  7752.       return command_ecatb_unison_attack(actors) if actors.size > 1
  7753.     end
  7754.     #
  7755.     command_attack_ecatb(*argv, &argb)
  7756.     @status_window.draw_item(actor.index) # Added
  7757.   end # command_attack
  7758.  
  7759.   #----------------------------------------------------------------------------|
  7760.   #  Fixes bugs and edge cases                                                 |
  7761.   #----------------------------------------------------------------------------|
  7762.   alias command_skill_ecatb command_skill
  7763.   def command_skill(*argv, &argb)
  7764.     return if BattleManager.btype?(:ecatb) && !BattleManager.actor # Added
  7765.     command_skill_ecatb(*argv, &argb)
  7766.   end # command_skill
  7767.  
  7768.   #----------------------------------------------------------------------------|
  7769.   #  Confirms the guard and processes unison guards as well                    |
  7770.   #----------------------------------------------------------------------------|
  7771.   alias command_guard_ecatb command_guard
  7772.   def command_guard(*argv, &argb)
  7773.     # Added
  7774.     return unless actor = BattleManager.actor
  7775.     if ecatb = BattleManager.btype?(:ecatb)
  7776.       ecatb = DoubleX_RMVXA::ECATB
  7777.       actors = ecatb.send($data_skills[actor.guard_skill_id].
  7778.       ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?])
  7779.       return command_ecatb_unison_attack(actors) if actors.size > 1
  7780.     end
  7781.     actor.input.set_guard
  7782.     if ecatb
  7783.       actor.confirm_ecatb_item
  7784.       @status_window.draw_item(actor.index)
  7785.     end
  7786.     #
  7787.     command_guard_ecatb(*argv, &argb)
  7788.   end # command_guard
  7789.  
  7790.   #----------------------------------------------------------------------------|
  7791.   #  Confirms the skill/item and processes unison confirmation as well         |
  7792.   #----------------------------------------------------------------------------|
  7793.   alias on_actor_ok_ecatb on_actor_ok
  7794.   def on_actor_ok(*argv, &argb)
  7795.     # Added
  7796.     return unless actor = BattleManager.actor
  7797.     if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:ok, @actor_window)
  7798.       return
  7799.     elsif BattleManager.btype?(:ecatb)
  7800.       actor.confirm_ecatb_item
  7801.       @status_window.draw_item(actor.index)
  7802.     end
  7803.     #
  7804.     on_actor_ok_ecatb(*argv, &argb)
  7805.   end # on_actor_ok
  7806.  
  7807.   #----------------------------------------------------------------------------|
  7808.   #  Confirms the skill/item and processes unison confirmation as well         |
  7809.   #----------------------------------------------------------------------------|
  7810.   alias on_enemy_ok_ecatb on_enemy_ok
  7811.   def on_enemy_ok(*argv, &argb)
  7812.     # Added
  7813.     return unless (actor = BattleManager.actor) && @enemy_window.ecatb_update?
  7814.     if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:ok, @enemy_window)
  7815.       return
  7816.     elsif BattleManager.btype?(:ecatb)
  7817.       actor.confirm_ecatb_item
  7818.       @status_window.draw_item(actor.index)
  7819.     end
  7820.     #
  7821.     on_enemy_ok_ecatb(*argv, &argb)
  7822.   end # on_enemy_ok
  7823.  
  7824.   #----------------------------------------------------------------------------|
  7825.   #  Processes unison skill/item target cancellation as well                   |
  7826.   #----------------------------------------------------------------------------|
  7827.   # Alias
  7828.   DoubleX_RMVXA::ECATB::ON_TARGET_CANCEL.each_value { |val| module_eval(val) }
  7829.   #
  7830.  
  7831.   #----------------------------------------------------------------------------|
  7832.   #  Processes unison skill/item selection as well                             |
  7833.   #----------------------------------------------------------------------------|
  7834.   # Alias
  7835.   DoubleX_RMVXA::ECATB::ON_SKILL_ITEM_OK.each_value { |val| module_eval(val) }
  7836.   #
  7837.  
  7838.   #----------------------------------------------------------------------------|
  7839.   #  Closes all input windows right after finishing inputting actions          |
  7840.   #----------------------------------------------------------------------------|
  7841.   alias turn_start_ecatb turn_start
  7842.   def turn_start(*argv, &argb)
  7843.     return ecatb_turn_start if BattleManager.btype?(:ecatb) # Added
  7844.     turn_start_ecatb(*argv, &argb)
  7845.   end # turn_start
  7846.  
  7847.   #----------------------------------------------------------------------------|
  7848.   #  Triggers the atb frame update and executes forced actions as well         |
  7849.   #----------------------------------------------------------------------------|
  7850.   alias process_action_ecatb process_action
  7851.   def process_action # Hotspot
  7852.     return process_action_ecatb unless BattleManager.btype?(:ecatb) # Rewritten
  7853.     # Added
  7854.     ecatb_update if ecatb_update?
  7855.     return unless BattleManager.action_forced?
  7856.     exec_ecatb_act(@subject, true) if exec_ecatb_act?(@subject, true)
  7857.     #
  7858.   end # process_action
  7859.  
  7860.   #----------------------------------------------------------------------------|
  7861.   #  Refreshes all active command, item and target selection windows as well   |
  7862.   #----------------------------------------------------------------------------|
  7863.   alias status_redraw_target_ecatb status_redraw_target
  7864.   def status_redraw_target(target, &argb)
  7865.     # Added
  7866.     return if $game_party.all_dead? || $game_troop.all_dead?
  7867.     return unless BattleManager.phase
  7868.     #
  7869.     status_redraw_target_ecatb(target, &argb)
  7870.     # Added
  7871.     return unless BattleManager.btype?(:ecatb) && target.actor?
  7872.     refresh_ecatb_windows(true)
  7873.     #
  7874.   end # status_redraw_target
  7875.  
  7876.   def ecatb_start # v0.04d+; New
  7877.     create_ecatb_defs
  7878.     if BattleManager.btype?(:ecatb)
  7879.       set_ecatb_battler_window_handlers
  7880.       set_ecatb_actor_command_window_handlers
  7881.     end
  7882.     @ecatb_clock = { tick: 0, act: 0, battler: 0, force: 0 }
  7883.     @ecatb_force_clock = :nil
  7884.     init_ecatb_act_block
  7885.     init_ecatb_actor_refresh_block
  7886.   end # ecatb_start
  7887.  
  7888.   #----------------------------------------------------------------------------|
  7889.   #  Creates and checks the associated method for each configuration used here |
  7890.   #----------------------------------------------------------------------------|
  7891.   # config: The configuration requesting its associated method
  7892.   # validate: The configuration value validation flag
  7893.   def create_ecatb_def(config, validate = true) # New
  7894.     # Uses the name and value of configuration as its method's name and contents
  7895.     method = config.id2name
  7896.     eval(%Q(
  7897.   def #{method}#{DoubleX_RMVXA::ECATB::SCENE_BATTLE[config][0]}
  7898.     #{$game_system.send(config)}
  7899.   end
  7900.     ))
  7901.     #
  7902.     return unless validate
  7903.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::SCENE_BATTLE[config])
  7904.   end # create_ecatb_def
  7905.  
  7906.   #----------------------------------------------------------------------------|
  7907.   #  Checks all new methods and resets them to the defaults if they're invalid |
  7908.   #----------------------------------------------------------------------------|
  7909.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:SCENE_BATTLE]) # New
  7910.  
  7911.   #----------------------------------------------------------------------------|
  7912.   #  Initializes the new block to trade memory usage for time performance      |
  7913.   #----------------------------------------------------------------------------|
  7914.   def init_ecatb_act_block # New
  7915.     # Calls this block instead of an anonymous function per enumerable iteration
  7916.     @ecatb_act_block = -> battler {
  7917.       if battler.actor? && battler.input
  7918.         if !battler.input.last_ecatb_confirm && battler.input.ecatb_confirm
  7919.           battler.make_actions
  7920.         end
  7921.       end
  7922.       exec_ecatb_act(battler) if !@subject && exec_ecatb_act?(battler)
  7923.     }
  7924.     #
  7925.   end # init_ecatb_act_block
  7926.  
  7927.   #----------------------------------------------------------------------------|
  7928.   #  Initializes the new block to trade memory usage for time performance      |
  7929.   #----------------------------------------------------------------------------|
  7930.   def init_ecatb_actor_refresh_block # New
  7931.     # Calls this block instead of an anonymous function per enumerable iteration
  7932.     @ecatb_actor_refresh_block = -> mem {
  7933.       next unless mem.ecatb_refresh
  7934.       @actor_window.draw_item(mem.index) if @actor_window.active
  7935.       if @ecatb_cancel_window && @ecatb_cancel_window.active
  7936.         @ecatb_cancel_window.draw_item(mem.index)
  7937.       end
  7938.       @status_aid_window.refresh if @status_aid_window.visible
  7939.       @status_window.draw_item(mem.index) unless @status_window.close?
  7940.       mem.ecatb_refresh = false
  7941.       @ecatb_refresh = true
  7942.     }
  7943.     #
  7944.   end # init_ecatb_actor_refresh_block
  7945.  
  7946.   def create_ecatb_windows # New
  7947.     create_ecatb_cancel_window
  7948.     create_ecatb_clock_window
  7949.     create_ecatb_force_window
  7950.     create_ecatb_order_window
  7951.     create_ecatb_pool_window
  7952.   end # create_ecatb_windows
  7953.  
  7954.   #----------------------------------------------------------------------------|
  7955.   #  Closes all windows upon battle end                                        |
  7956.   #----------------------------------------------------------------------------|
  7957.   def close_ecatb_windows # New
  7958.     @ecatb_cancel_window.hide.deactivate.close if @ecatb_cancel_window
  7959.     close_ecatb_clock_window if @ecatb_clock_window
  7960.     close_ecatb_force_window if @ecatb_force_window
  7961.     close_ecatb_order_window if @ecatb_order_window
  7962.     close_ecatb_pool_window if @ecatb_pool_window
  7963.     [@actor_window, @enemy_window, @skill_window, @item_window, @help_window,
  7964.      @actor_command_window, @party_command_window, @status_aid_window].each(
  7965.     &DoubleX_RMVXA::ECATB::BLOCKS[:close_ecatb_windows])
  7966.   end # close_ecatb_windows
  7967.  
  7968.   #----------------------------------------------------------------------------|
  7969.   #  Sets the battler window selection hotkeys and their handlers              |
  7970.   #----------------------------------------------------------------------------|
  7971.   def set_ecatb_battler_window_handlers # New
  7972.     battler_hotkeys = ecatb_battler_hotkeys
  7973.     create_ecatb_battler_hotkey_defs(battler_hotkeys, "actor", "actor")
  7974.     create_ecatb_battler_hotkey_defs(battler_hotkeys, "enemy", "enemy")
  7975.     battler_hotkeys.each_with_index { |hotkey, index|
  7976.       @actor_window.set_handler(hotkey, method(
  7977.       :"ecatb_actor_hotkey_#{index = index.to_s}"))
  7978.       @enemy_window.set_handler(hotkey, method(:"ecatb_enemy_hotkey_#{index}"))
  7979.     }
  7980.   end # set_ecatb_battler_window_handlers
  7981.  
  7982.   #----------------------------------------------------------------------------|
  7983.   #  Sets actor command window directional inputs and hotkeys and handlers     |
  7984.   #----------------------------------------------------------------------------|
  7985.   def set_ecatb_actor_command_window_handlers # New
  7986.     @actor_command_window.set_handler(:dir4, method(:prior_ecatb_actor))
  7987.     @actor_command_window.set_handler(:dir6, method(:next_ecatb_actor))
  7988.     actor_hotkeys = ecatb_battler_hotkeys
  7989.     create_ecatb_actor_command_hotkey_defs(actor_hotkeys)
  7990.     actor_hotkeys.each_with_index { |hotkey, index|
  7991.       @actor_command_window.set_handler(hotkey, method(
  7992.       :"ecatb_actor_command_hotkey_#{index.to_s}"))
  7993.     }
  7994.   end # set_ecatb_actor_command_window_handlers
  7995.  
  7996.   #----------------------------------------------------------------------------|
  7997.   #  Creates methods used by the actor command hotkey handlers                 |
  7998.   #----------------------------------------------------------------------------|
  7999.   def create_ecatb_actor_command_hotkey_defs(actor_hotkeys) # New
  8000.     actor_hotkeys.each_index { |index|
  8001.       next if respond_to?(:"ecatb_actor_command_hotkey_#{index = index.to_s}")
  8002.       eval(%Q(
  8003.     def ecatb_actor_command_hotkey_#{index}
  8004.       return if @ecatb_cancel_window && @ecatb_cancel_window.active
  8005.       return unless BattleManager.ecatb_input_list(true).include?(#{index})
  8006.       BattleManager.actor_index = #{index}
  8007.       start_actor_command_selection
  8008.     end
  8009.       ))
  8010.     }
  8011.   end # create_ecatb_actor_command_hotkey_defs
  8012.  
  8013.   def create_ecatb_cancel_window # New
  8014.     (@ecatb_cancel_help_window = Window_Help.new).visible = false
  8015.     (@ecatb_cancel_window = Window_BattleActor.new(@info_viewport)).x = 64
  8016.     @ecatb_cancel_window.set_handler(:ok, method(:on_ecatb_cancel_ok))
  8017.     @ecatb_cancel_window.set_handler(:cancel, method(:on_ecatb_cancel_back))
  8018.     battler_hotkeys = eval($game_system.ecatb_battler_hotkeys)
  8019.     create_ecatb_battler_hotkey_defs(battler_hotkeys, "cancel", "ecatb_cancel")
  8020.     battler_hotkeys.each_with_index { |hotkey, index|
  8021.       @ecatb_cancel_window.set_handler(hotkey, method(
  8022.       :"ecatb_cancel_hotkey_#{index.to_s}"))
  8023.     }
  8024.   end # create_ecatb_cancel_window
  8025.  
  8026.   #----------------------------------------------------------------------------|
  8027.   #  Creates methods used by the battler target selection hotkey handlers      |
  8028.   #----------------------------------------------------------------------------|
  8029.   def create_ecatb_battler_hotkey_defs(battler_hotkeys, type, window) # New
  8030.     battler_hotkeys.each_index { |index|
  8031.       eval(%Q(
  8032.     def ecatb_#{type}_hotkey_#{index = index.to_s}
  8033.       @#{window}_window.select(#{index})
  8034.     end
  8035.       )) unless respond_to?(:"ecatb_#{type}_hotkey_#{index}")
  8036.     }
  8037.   end # create_ecatb_battler_hotkey_defs
  8038.  
  8039.   def update_ecatb_cancel_window # New; Hotspot
  8040.     if @ecatb_cancel_window.active
  8041.       unless BattleManager.actor_sprite_ecatb_bar
  8042.         @ecatb_cancel_window.ecatb_bar_refresh
  8043.       end
  8044.       return
  8045.     end
  8046.     activate_ecatb_cancel_window if Input.trigger?(ecatb_cancel_key)
  8047.   end # update_ecatb_cancel_window
  8048.  
  8049.   def activate_ecatb_cancel_window # New
  8050.     @status_window.hide
  8051.     @actor_command_window.close if @actor_command_window.active
  8052.     @party_command_window.close if @party_command_window.active
  8053.     select_ecatb_cancel_selection
  8054.   end # activate_ecatb_cancel_window
  8055.  
  8056.   def on_ecatb_cancel_ok # New
  8057.     # Picks the actor and cancels that actor's action if it can be cancelled
  8058.     actor = $game_party.battle_members[@ecatb_cancel_window.index]
  8059.     return select_ecatb_cancel_selection unless actor.inputable?
  8060.     if actor.ecatb_val[:charge] <= 0.0 || actor.ecatb_val[:charge] >= 100.0
  8061.       return select_ecatb_cancel_selection unless actor.ecatb_esc
  8062.     end
  8063.     ecatb_cancel_act(actor)
  8064.     #
  8065.   end # on_ecatb_cancel_ok
  8066.  
  8067.   #----------------------------------------------------------------------------|
  8068.   #  Asks the actor to pay the action costs and clears that action             |
  8069.   #----------------------------------------------------------------------------|
  8070.   def ecatb_cancel_act(actor) # New
  8071.     # Asks all unison invokees to do those as well if the skill/item is unison
  8072.     if actor.ecatb_unison_actors.size < 2
  8073.       actor.ecatb_reset
  8074.       @status_window.draw_item(actor.index)
  8075.       @ecatb_cancel_window.draw_item(actor.index)
  8076.     else
  8077.       ecatb_cancel_unison_act(actor.ecatb_unison_actors)
  8078.     end
  8079.     #
  8080.     select_ecatb_cancel_selection
  8081.   end # ecatb_cancel_act
  8082.  
  8083.   #----------------------------------------------------------------------------|
  8084.   #  Pays the action costs and clears that action for unison skills/items      |
  8085.   #----------------------------------------------------------------------------|
  8086.   # actors: The unison actors
  8087.   def ecatb_cancel_unison_act(actors) # New
  8088.     actors.each { |actor|
  8089.       actor.ecatb_reset
  8090.       @status_window.draw_item(actor.index)
  8091.       @ecatb_cancel_window.draw_item(actor.index)
  8092.     }
  8093.   end # ecatb_cancel_unison_act
  8094.  
  8095.   def select_ecatb_cancel_selection # New
  8096.     @ecatb_cancel_window.show.activate.refresh
  8097.     @ecatb_cancel_help_window.show.activate.set_text(ecatb_cancel_text)
  8098.   end # select_ecatb_cancel_selection
  8099.  
  8100.   def on_ecatb_cancel_back # New
  8101.     @ecatb_cancel_window.hide.deactivate
  8102.     @ecatb_cancel_help_window.hide.deactivate
  8103.     @status_window.show
  8104.     @actor_command_window.open if @actor_command_window.active
  8105.     @party_command_window.open if @party_command_window.active
  8106.   end # on_ecatb_cancel_back
  8107.  
  8108.   def create_ecatb_clock_window # New
  8109.     return if @ecatb_clock_window
  8110.     return unless eval($game_system.show_ecatb_clock_window)
  8111.     @ecatb_clock_window = ECATB_Clock_Window.new(@ecatb_clock ?
  8112.     @ecatb_clock[eval($game_system.ecatb_turn_type)] : 0, ecatb_max_clock)
  8113.   end # create_ecatb_clock_window
  8114.  
  8115.   def ecatb_max_clock # New
  8116.     if (type = eval($game_system.ecatb_turn_type)) == :tick
  8117.       return eval($game_system.ecatb_tick_count) * Graphics.frame_rate
  8118.     elsif type == :act
  8119.       return eval($game_system.ecatb_after_act)
  8120.     end
  8121.     eval($game_system.ecatb_battler_count) *
  8122.     eval($game_system.ecatb_battler_scale)[0]
  8123.   end # ecatb_max_clock
  8124.  
  8125.   #----------------------------------------------------------------------------|
  8126.   #  Creates the atb force, order and pool windows                             |
  8127.   #----------------------------------------------------------------------------|
  8128.   # v0.01b+; New
  8129.   DoubleX_RMVXA::ECATB::CREATE_WINDOW.each_value { |val| module_eval(val) }
  8130.   #
  8131.  
  8132.   #----------------------------------------------------------------------------|
  8133.   #  Closes the atb clock, force, order and pool windows                       |
  8134.   #----------------------------------------------------------------------------|
  8135.   # v0.01b+; New
  8136.   DoubleX_RMVXA::ECATB::CLOSE_WINDOW.each_value { |val| module_eval(val) }
  8137.   #
  8138.  
  8139.   #----------------------------------------------------------------------------|
  8140.   #  Moves the info viewport according to which windows are active             |
  8141.   #----------------------------------------------------------------------------|
  8142.   def ecatb_update_info_viewport # New; Hotspot
  8143.     return move_info_viewport(128) if @actor_command_window.active ||
  8144.     @actor_window.active || @enemy_window.active
  8145.     move_info_viewport(0) if @party_command_window.active ||
  8146.     update_msg_open_ecatb_compatibility?
  8147.   end # ecatb_update_info_viewport
  8148.  
  8149.   #----------------------------------------------------------------------------|
  8150.   #  Opens the status, command, item and target windows if they're active      |
  8151.   #----------------------------------------------------------------------------|
  8152.   def ecatb_update_message_open # New; Hotspot
  8153.     @status_window.open
  8154.     return @actor_command_window.open if @skill_window.active ||
  8155.     @item_window.active || @actor_window.active || @enemy_window.active ||
  8156.     @actor_command_window.active
  8157.     @party_command_window.open if @party_command_window.active ||
  8158.     update_msg_open_ecatb_compatibility?
  8159.   end # ecatb_update_message_open
  8160.  
  8161.   #----------------------------------------------------------------------------|
  8162.   #  Closes all input windows right after finishing inputting actions          |
  8163.   #----------------------------------------------------------------------------|
  8164.   def ecatb_turn_start # New
  8165.     @party_command_window.close
  8166.     @actor_command_window.close
  8167.     @status_window.unselect
  8168.     @log_window.wait
  8169.     @log_window.clear
  8170.   end # ecatb_turn_start
  8171.  
  8172.   def update_ecatb_force_clock # New; Hotspot
  8173.     if Input.trigger?(ecatb_force_run_key)
  8174.       @ecatb_force_clock = @ecatb_force_clock == :stop ? :nil : :run
  8175.       @ecatb_force_window.draw_text(@ecatb_force_clock) if @ecatb_force_window
  8176.     elsif Input.trigger?(ecatb_force_stop_key)
  8177.       @ecatb_force_clock = @ecatb_force_clock == :run ? :nil : :stop
  8178.       @ecatb_force_window.draw_text(@ecatb_force_clock) if @ecatb_force_window
  8179.     end
  8180.   end # update_ecatb_force_clock
  8181.  
  8182.   #----------------------------------------------------------------------------|
  8183.   #  Runs the atb frame update                                                 |
  8184.   #----------------------------------------------------------------------------|
  8185.   def ecatb_update # New; Hotspot
  8186.     pre_ecatb_update
  8187.     ecatb_ctb_update
  8188.     return unless BattleManager.phase
  8189.     refresh_ecatb_windows
  8190.     ecatb_update_actors
  8191.     unless @party_command_window.active || @status_window.index >= 0
  8192.       unless @ecatb_cancel_window && @ecatb_cancel_window.active
  8193.         start_actor_command_selection if BattleManager.ecatb_update_act_actor?
  8194.       end
  8195.     end
  8196.     BattleManager.action_battlers.each(&@ecatb_act_block)
  8197.     post_ecatb_update
  8198.   end # ecatb_update
  8199.  
  8200.   #----------------------------------------------------------------------------|
  8201.   #  Runs the battle and all battlers' atb clocks until any of them has to stop|
  8202.   #----------------------------------------------------------------------------|
  8203.   def ecatb_ctb_update # v0.04d+; New; Hotspot
  8204.     begin
  8205.       ecatb_update_tick_battler_count
  8206.       BattleManager.ecatb_update
  8207.     end until BattleManager.ecatb_ctb_break?
  8208.     @ecatb_clock_window.refresh if @ecatb_clock_window
  8209.   end # ecatb_ctb_update
  8210.  
  8211.   #----------------------------------------------------------------------------|
  8212.   #  Refreshes all windows used by actors if at least 1 of them has refreshed  |
  8213.   #----------------------------------------------------------------------------|
  8214.   # redrawn: Whether the whole status window has been redrawn
  8215.   def refresh_ecatb_windows(redrawn = false) # New; Hotspot
  8216.     $game_party.alive_members.each(&@ecatb_actor_refresh_block)
  8217.     @ecatb_order_window.update_battler_icons if @ecatb_order_window
  8218.     if @ecatb_refresh
  8219.       [@skill_window, @item_window, @actor_command_window,
  8220.       @party_command_window].each(
  8221.       &DoubleX_RMVXA::ECATB::BLOCKS[:refresh_ecatb_windows])
  8222.       refresh_ecatb_windows_compatibility
  8223.       return @ecatb_refresh = false
  8224.     end
  8225.     return if BattleManager.actor_sprite_ecatb_bar
  8226.     @status_window.ecatb_bar_refresh unless redrawn && @status_window.close?
  8227.     @actor_window.ecatb_bar_refresh if @actor_window.active
  8228.   end # refresh_ecatb_windows
  8229.  
  8230.   #----------------------------------------------------------------------------|
  8231.   #  Resets non-actable selected actor's atb and updates all windows           |
  8232.   #----------------------------------------------------------------------------|
  8233.   def ecatb_update_actors # New; Hotspot
  8234.     if @status_window.index >= 0
  8235.       return if BattleManager.ecatb_input_list(true).include?(
  8236.       @status_window.index)
  8237.       ecatb_update_windows
  8238.     elsif BattleManager.ecatb_input_list.empty?
  8239.       @party_command_window.deactivate.close if @party_command_window.active
  8240.     end
  8241.   end # ecatb_update_actors
  8242.  
  8243.   def ecatb_update_windows # New; Hotspot
  8244.     if @skill_window.visible || @item_window.visible ||
  8245.     @actor_window.visible || @enemy_window.visible
  8246.       @status_window.open.show
  8247.       @status_aid_window.hide
  8248.     end
  8249.     [@actor_window, @enemy_window, @skill_window, @item_window,
  8250.      @actor_command_window].each(
  8251.      &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_update_windows])
  8252.     @status_window.unselect
  8253.   end # ecatb_update_windows
  8254.  
  8255.   def ecatb_update_tick_battler_count # New; Hotspot
  8256.     return ecatb_update_tick_count if (type = ecatb_turn_type) == :tick
  8257.     return if type != :battler || ecatb_battler_scale[1] != :tick
  8258.     ecatb_update_battler_count
  8259.   end # ecatb_update_tick_battler_count
  8260.  
  8261.   def ecatb_update_tick_count # New; Hotspot
  8262.     max_clock = ecatb_tick_count * Graphics.frame_rate
  8263.     if (@ecatb_clock[:tick] += 1) >= max_clock
  8264.       @ecatb_clock[:tick] = 0
  8265.       ecatb_turn_add
  8266.     end
  8267.     return unless @ecatb_clock_window
  8268.     @ecatb_clock_window.cur_clock = @ecatb_clock[:tick]
  8269.     @ecatb_clock_window.max_clock = max_clock
  8270.   end # ecatb_update_tick_count
  8271.  
  8272.   # forced: The action force flag
  8273.   def exec_ecatb_act(subject, forced = false) # New
  8274.     # Disables party escape during action executions
  8275.     BattleManager.ecatb_can_esc = false
  8276.     force_act_cost = nil
  8277.     if @subject.current_action
  8278.       force_act_cost = exec_ecatb_act_loop(forced)
  8279.       exec_ecatb_act_clock(forced)
  8280.       process_action_end
  8281.     end
  8282.     BattleManager.ecatb_can_esc = true
  8283.     #
  8284.     return if BattleManager.judge_win_loss
  8285.     exec_ecatb_act_reset(forced, force_act_cost) if BattleManager.phase
  8286.   end # exec_ecatb_act
  8287.  
  8288.   #----------------------------------------------------------------------------|
  8289.   #  Executes all the battler's valid actions and sets their costs             |
  8290.   #----------------------------------------------------------------------------|
  8291.   # forced: The action force flag
  8292.   def exec_ecatb_act_loop(forced) # New
  8293.     while @subject.current_action.valid?
  8294.       @subject.current_action.prepare
  8295.       execute_action
  8296.       force_act_cost = @subject.exec_ecatb_act_cost(forced)
  8297.       process_event
  8298.       @subject.remove_current_action
  8299.       return if force_act_cost = exec_ecatb_act_loop_compatibility?(forced)
  8300.     end
  8301.     force_act_cost
  8302.   end # exec_ecatb_act_loop
  8303.  
  8304.   # forced: The action force flag
  8305.   def exec_ecatb_act_clock(forced) # New
  8306.     return exec_ecatb_act_update(forced) if (type = ecatb_turn_type) == :act
  8307.     return if type != :battler || ecatb_battler_scale[1] != :act
  8308.     ecatb_update_battler_count(forced)
  8309.   end # exec_ecatb_act_clock
  8310.  
  8311.   # forced: The action force flag
  8312.   def exec_ecatb_act_update(forced) # New
  8313.     @ecatb_clock[:act] += 1 if !forced || ecatb_force_act_count
  8314.     if @ecatb_clock[:act] >= (after_act = ecatb_after_act)
  8315.       @ecatb_clock[:act] = 0
  8316.       ecatb_turn_add
  8317.     end
  8318.     return unless @ecatb_clock_window
  8319.     @ecatb_clock_window.cur_clock = @ecatb_clock[:act]
  8320.     @ecatb_clock_window.max_clock = after_act
  8321.     @ecatb_clock_window.refresh
  8322.   end # exec_ecatb_act_update
  8323.  
  8324.   # forced: The action force flag
  8325.   def ecatb_update_battler_count(forced = false) # New; Hotspot
  8326.     @ecatb_clock[:battler] += 1 if !forced || ecatb_force_act_count
  8327.     max_clock = ecatb_battler_count * ecatb_battler_scale[0]
  8328.     if @ecatb_clock[:battler] >= (max_clock *= Graphics.frame_rate)
  8329.       @ecatb_clock[:battler] = 0
  8330.       ecatb_turn_add
  8331.     end
  8332.     return unless @ecatb_clock_window
  8333.     @ecatb_clock_window.cur_clock = @ecatb_clock[:tick]
  8334.     @ecatb_clock_window.max_clock = max_clock
  8335.   end # ecatb_update_battler_count
  8336.  
  8337.   #----------------------------------------------------------------------------|
  8338.   #  Resets the battler's atb and refreshes the actor in the status window     |
  8339.   #----------------------------------------------------------------------------|
  8340.   # forced: The action force flag
  8341.   def exec_ecatb_act_reset(forced, force_act_cost) # New
  8342.     if !forced || force_act_cost
  8343.       if @subject.ecatb_unison_actors.size > 1
  8344.         (@subject.ecatb_unison_actors & $game_party.alive_members).each { |a|
  8345.           a.ecatb_reset
  8346.           @status_window.draw_item(a.index)
  8347.         }
  8348.       else
  8349.         @subject.ecatb_reset
  8350.         @status_window.draw_item(@subject.index) if @subject.actor?
  8351.       end
  8352.     end
  8353.     @subject = nil
  8354.   end # exec_ecatb_act_reset
  8355.  
  8356.   def ecatb_turn_add # New
  8357.     BattleManager.turn_end if BattleManager.phase
  8358.     ecatb_turn_add_compatibility
  8359.     BattleManager.ecatb_on_turn_end
  8360.     $game_troop.increase_turn
  8361.   end # ecatb_turn_add
  8362.  
  8363.   #----------------------------------------------------------------------------|
  8364.   #  Picks and setups the prior inputable actor if any                         |
  8365.   #----------------------------------------------------------------------------|
  8366.   def prior_ecatb_actor # New; Potential Hotspot
  8367.     return if @ecatb_cancel_window && @ecatb_cancel_window.active
  8368.     start_actor_command_selection if BattleManager.change_ecatb_actor?(-1)
  8369.   end # prior_ecatb_actor
  8370.  
  8371.   #----------------------------------------------------------------------------|
  8372.   #  Picks and setups the next inputable actor if any                          |
  8373.   #----------------------------------------------------------------------------|
  8374.   def next_ecatb_actor # New; Potential Hotspot
  8375.     return if @ecatb_cancel_window && @ecatb_cancel_window.active
  8376.     start_actor_command_selection if BattleManager.change_ecatb_actor?(1)
  8377.   end # next_ecatb_actor
  8378.  
  8379.   # actors: The unison actors
  8380.   def command_ecatb_unison_attack(actors) # New
  8381.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  8382.     actors.each { |actor|
  8383.       actor.input.set_attack
  8384.       @status_window.draw_item(actor.index)
  8385.     }
  8386.     select_enemy_selection
  8387.   end # command_ecatb_unison_attack
  8388.  
  8389.   # actors: The unison actors
  8390.   def command_ecatb_unison_guard(actors) # New
  8391.     $game_temp.battle_aid = $data_skills[BattleManager.actor.guard_skill_id]
  8392.     confirm_ecatb_unison_item(actors)
  8393.     next_command
  8394.   end # command_ecatb_unison_guard
  8395.  
  8396.   # actors: The unison actors
  8397.   # window: The window having the unison item
  8398.   def on_ecatb_unison_target_ok(actors, window) # New
  8399.     $game_temp.battle_aid = nil
  8400.     unless BattleManager.actor.usable?(BattleManager.actor.input.item)
  8401.       return on_ecatb_unison_target_cancel(actors, window)
  8402.     end
  8403.     confirm_ecatb_unison_item(actors, window)
  8404.     window.hide
  8405.     @skill_window.hide
  8406.     @item_window.hide
  8407.     next_command
  8408.   end # on_ecatb_unison_target_ok
  8409.  
  8410.   # actors: The unison actors
  8411.   # window: The window having the unison item
  8412.   def confirm_ecatb_unison_item(actors, window = nil) # New
  8413.     actors.each { |actor|
  8414.       window ? actor.input.target_index = window.index : actor.input.set_guard
  8415.       actor.ecatb_unison_invoker = actor == BattleManager.actor
  8416.       actor.confirm_ecatb_item
  8417.       @status_window.draw_item(actor.index)
  8418.     }
  8419.   end # confirm_ecatb_unison_item
  8420.  
  8421.   # actors: The unison actors
  8422.   # window: The window having the unison item
  8423.   def on_ecatb_unison_target_cancel(actors, window) # New
  8424.     # Clears the unison item from all unison actors and backs to the last window
  8425.     clear_ecatb_unison_item(actors)
  8426.     @status_aid_window.refresh
  8427.     $game_temp.battle_aid = nil
  8428.     window.hide
  8429.     on_ecatb_unison_target_cancel_compatibility
  8430.     #
  8431.   end # on_ecatb_unison_target_cancel
  8432.  
  8433.   # actors: The unison actors
  8434.   def clear_ecatb_unison_item(actors) # New
  8435.     (actors & BattleManager.ecatb_input_list).each { |actor|
  8436.       actor.input.clear if actor.input
  8437.       @status_window.draw_item(actor.index)
  8438.     }
  8439.   end # on_ecatb_unison_target_cancel
  8440.  
  8441.   # actors: The unison actors
  8442.   # window: The window having the unison item
  8443.   def on_ecatb_unison_item_ok(actors, window) # New
  8444.     $game_temp.battle_aid = item = window.item
  8445.     $game_party.last_item.object = item if item.is_a?(RPG::Item)
  8446.     skill = item.is_a?(RPG::Skill)
  8447.     actors.each { |actor|
  8448.       actor.input.set_skill(item.id)
  8449.       actor.last_skill.object = item if skill
  8450.       @status_window.draw_item(actor.index)
  8451.     }
  8452.     return select_enemy_selection if item.for_opponent?
  8453.     select_actor_selection if item.for_friend?
  8454.   end # on_ecatb_unison_item_ok
  8455.  
  8456.   # actors: The unison actors
  8457.   # window: The window using the command
  8458.   def on_ecatb_unison_command(actors, command, window) # New
  8459.     return on_ecatb_unison_target_ok(actors, window) if command == :ok
  8460.     on_ecatb_unison_target_cancel(actors, window)
  8461.   end # on_ecatb_unison_command
  8462.  
  8463.   #----------------------------------------------------------------------------|
  8464.   #  Checks if the unison skill/item can be inputted                           |
  8465.   #----------------------------------------------------------------------------|
  8466.   def on_ecatb_unison_item_ok?(window) # New
  8467.     # Checks if the skill/item is an unison one and all unison actors' present
  8468.     return false unless BattleManager.btype?(:ecatb)
  8469.     ecatb = DoubleX_RMVXA::ECATB
  8470.     actors = ecatb.send(window.item.ecatb_unison_actor, BattleManager.actor)
  8471.     actors.collect!(&ecatb::BLOCKS[:usable?])
  8472.     return false if actors.size < 2
  8473.     on_ecatb_unison_item_ok(actors, window)
  8474.     true
  8475.     #
  8476.   end # on_ecatb_unison_item_ok?
  8477.  
  8478.   def update_ecatb_cancel_window? # New; Hotspot
  8479.     # Checks if no window that can interfere the atb cancel window is shown
  8480.     return false if @actor_window.active || @enemy_window.active
  8481.     return false if @skill_window.active || @item_window.active
  8482.     return false if $game_message.busy?
  8483.     !update_msg_open_ecatb_compatibility?
  8484.     #
  8485.   end # update_ecatb_cancel_window?
  8486.  
  8487.   #----------------------------------------------------------------------------|
  8488.   #  Checks if the atb frame update should be run                              |
  8489.   #----------------------------------------------------------------------------|
  8490.   def ecatb_update? # New; Hotspot
  8491.     # Checks if atb frame update can be updated and the wait condition isn't met
  8492.     return false if scene_changing? || BattleManager.phase == :init
  8493.     return false if $game_party.all_dead? || $game_troop.all_dead?
  8494.     return false if $game_message.visible
  8495.     BattleManager.phase && !ecatb_wait_cond
  8496.     #
  8497.   end # ecatb_update?
  8498.  
  8499.   #----------------------------------------------------------------------------|
  8500.   #  Checks if the battler's actions should be executed                        |
  8501.   #----------------------------------------------------------------------------|
  8502.   # forced: The action force flag
  8503.   def exec_ecatb_act?(subject, forced = false) # New; Hotspot
  8504.     # Checks if the battler's valid and has a fully charged valid input
  8505.     if subject
  8506.       return false unless forced || subject.exec_ecatb_act?
  8507.       @subject = subject
  8508.     end
  8509.     @subject
  8510.     #
  8511.   end # exec_ecatb_act?
  8512.  
  8513.   #----------------------------------------------------------------------------|
  8514.   #  Checks if the unison item command handlers should be called               |
  8515.   #----------------------------------------------------------------------------|
  8516.   # window: The window using the command
  8517.   def on_ecatb_unison?(command, window) # New
  8518.     # Checks if the input is an unison item and calls unison handlers if so
  8519.     return false unless (actor = BattleManager.actor).input && actor.input.item
  8520.     ecatb = DoubleX_RMVXA::ECATB
  8521.     actors = ecatb.send(actor.input.item.ecatb_unison_actor, actor)
  8522.     actors.collect!(&ecatb::BLOCKS[:usable?])
  8523.     return false if actors.size < 2
  8524.     on_ecatb_unison_command(actors, command, window)
  8525.     true
  8526.     #
  8527.   end # on_ecatb_unison?
  8528.  
  8529.   #----------------------------------------------------------------------------|
  8530.   #  (New)Lets the compatibility fix deals with compatibility issues           |
  8531.   #----------------------------------------------------------------------------|
  8532.  
  8533.   def refresh_ecatb_windows_compatibility # Potential Hotspot
  8534.   end # refresh_ecatb_windows_compatibility
  8535.  
  8536.   def update_msg_open_ecatb_compatibility? # Hotspot
  8537.   end # update_msg_open_ecatb_compatibility?
  8538.  
  8539.   # forced: The action force flag
  8540.   def exec_ecatb_act_loop_compatibility?(forced)
  8541.     forced || !@subject.current_action
  8542.   end # exec_ecatb_act_loop_compatibility?
  8543.  
  8544.   def ecatb_turn_add_compatibility
  8545.   end # ecatb_turn_add_compatibility
  8546.  
  8547.   def on_ecatb_unison_target_cancel_compatibility
  8548.     # Shows the last window upon cancelling picking targets of unison skill/item
  8549.     if @actor_command_window.current_symbol == :skill
  8550.       return @skill_window.activate.show
  8551.     elsif @actor_command_window.current_symbol == :item
  8552.       return @item_window.activate.show
  8553.     end
  8554.     @actor_command_window.activate.show
  8555.     #
  8556.   end # on_ecatb_unison_target_cancel_compatibility
  8557.  
  8558. end # Scene_Battle
  8559.  
  8560.   # Aliases all methods using unison method rules
  8561.   DoubleX_RMVXA::ECATB::UNISON_DEFS.each { |klass, defs|
  8562.     klass_def = %Q(
  8563. class #{klass[0].id2name}#{klass[1] ? " < #{klass[1].id2name}" : ""}
  8564.     )
  8565.     defs.each { |name|
  8566.       klass_def += %Q(
  8567.   alias #{name = name.id2name}_ecatb #{name}
  8568.   def #{name}(*argv, &argb)
  8569.     return #{name}_ecatb(*argv, &argb) unless @ecatb_unison_item
  8570.     defs = @ecatb_unison_item.ecatb_unison_actor_def[:#{name}]
  8571.     return #{name}_ecatb(*argv, &argb) unless defs
  8572.     ecatb = DoubleX_RMVXA::ECATB
  8573.     defs = [#{name}_ecatb(*argv, &argb)] + (ecatb.send(defs, self) - [id]).
  8574.     collect! { |i| $game_actors[i].#{name}(*argv, &argb) }
  8575.     rule = ecatb.send(@ecatb_unison_item.ecatb_unison_def_rule[:#{name}], self)
  8576.     ecatb_unison_rules(defs, rule)
  8577.   end
  8578.      )
  8579.     }
  8580.     eval(klass_def + %Q(
  8581. end
  8582.     ))
  8583.   }
  8584.  
  8585. #------------------------------------------------------------------------------|
  8586.  
  8587. else
  8588.  
  8589.   # Informs users that they didn't place YEA-BattleEngine above this script
  8590.   msgbox("To use DoubleX RMVXA Enhanced YSA Battle System: Classical ATB, put it
  8591.          below:\n" +
  8592.          "Yanfly Engine Ace - Ace Battle Engine\n" +
  8593.          "but above Main") unless $imported["YEA-BattleEngine"]
  8594.  
  8595.   # Informs users that they used YSA-CATB with this script
  8596.   msgbox("DoubleX RMVXA Enhanced YSA Battle System: Classical ATB can't be used
  8597.          with:\n" +
  8598.          "YSA Battle System: Classical ATB") if $imported["YSA-CATB"]
  8599.  
  8600. end # if $imported["YEA-BattleEngine"] && !$imported["YSA-CATB"]
  8601.  
  8602. #==============================================================================|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement