Double_X

DoubleX RMVXA Enhanced YSA Battle System: Classical ATB

May 11th, 2015 (edited)
1,806
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================|
  2. #  ** Script Info                                                              |
  3. #------------------------------------------------------------------------------|
  4. #  * Script Name                                                               |
  5. #    DoubleX RMVXA Enhanced YSA Battle System: Classical ATB                   |
  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. #------------------------------------------------------------------------------|
  250. #  * Authors                                                                   |
  251. #    DoubleX:                                                                  |
  252. #    1. This script                                                            |
  253. #    Yami:                                                                     |
  254. #    1. YSA Battle System: Classical ATB                                       |
  255. #------------------------------------------------------------------------------|
  256. #  * Changelog                                                                 |
  257. #    v0.05c(GMT 0600 28-11-2021):                                              |
  258. #    1. Fixed wrong eval of ecatb_battler_scale and uninitialized battler turn |
  259. #       bugs                                                                   |
  260. #    v0.05b(GMT 0200 7-11-2015):                                               |
  261. #    1. Updated (DoubleX)ECATB Base Formula                                    |
  262. #    2. Notetag values are now symbols of methods in the configuration regions |
  263. #    3. Fixed battler order icon not placed correctly when atb >= 100.0 bug    |
  264. #    4. Simplified the party/troop atb pool reset implementations              |
  265. #    5. Updated some outdated documentations                                   |
  266. #    6. Further improved this script's compatibility, efficiency and simplicity|
  267. #    v0.05a(GMT 0400 21-10-2015):                                              |
  268. #    1. Implemented the Gradual Action Points Gain feature                     |
  269. #       - Right now it doesn't work well with the ATB Pool feature             |
  270. #    2. Updated (DoubleX)ECATB Base Formula                                    |
  271. #    3. Added configuration :ecatb_countdown_mib in the added feature COUNTDOWN|
  272. #    4. ecatb_se_ready_act changed to take SE or nil instead of an array       |
  273. #    5. Fixed battler order and se notetags falsely returning nil bug          |
  274. #    6. Fixed undisposed battler atb order icons upon battle end bug           |
  275. #    7. Fixed repeated actor sprite creation bug                               |
  276. #    8. Fixed battler atb order icons not keeping updated upon icon change bug |
  277. #    9. Fixed pre ecatb input act only triggering upon becoming able to act bug|
  278. #    10. Fixed split second countdown interval never updating turns bug        |
  279. #    11. Fixed active actor command window not showing in atb pool mode bug    |
  280. #    12. Fixed enemy atb bar not showing for those having at least 1 state bug |
  281. #    13. Fixed nil cooldown rate when the atb gain rate remain unchanged bug   |
  282. #    14. Fixed false unison charging for non unison skills/items after using   |
  283. #        unison ones bug                                                       |
  284. #    15. Fixed corrupted battler's last skill/item cache bug                   |
  285. #    16. Fixed running the atb frame update upon battle end bug                |
  286. #    17. Fixed non-sync unison cooldown with party/troop atb pool mode bug     |
  287. #    18. Fixed troop atb pool reset not resetting all enemies' atb values bug  |
  288. #    19. Fixed party/troop atb pool reset falsely resetting other members'     |
  289. #        actions bug                                                           |
  290. #        Right now all members' actions will still be reset when the action    |
  291. #        point pool's depleted                                                 |
  292. #    21. Fixed battler ready se not playing when the battler's become able to  |
  293. #        act bug                                                               |
  294. #    22. Debugging this script becomes easier and simpler with the console open|
  295. #    23. Removed some more redundant variables and methods                     |
  296. #    24. Further boosted this script's compactness, correctness, effectiveness,|
  297. #        efficiency, maintainability, readability, robustness and simplicity   |
  298. #    v0.04f(GMT 0400 12-9-2015):                                               |
  299. #    1. Added 3 script calls for notifying changes of new status window methods|
  300. #    2. The battler sprite atb bar methods are now under ECATB_Bar             |
  301. #    3. Fixed issues with clearing/resetting battler blocks twice consecutively|
  302. #    4. Further improved this script's effectiveness, efficiency and robustness|
  303. #    v0.04e(GMT 1500 11-8-2015):                                               |
  304. #    1. Fixed crash upon changing equips outside battles bug                   |
  305. #    2. Fixed triggering pre and post atb reset effects upon battle end bug    |
  306. #    3. Fixed enemy ecatb bar show not working properly bug                    |
  307. #    4. Fixed actors added during battles not properly initialized bug         |
  308. #    5. Fixed disabling party escape if not all party members are movable bug  |
  309. #    6. Fixed failed party escape attempts not cooling down properly bug       |
  310. #    7. Updated the outdated configuration documentations                      |
  311. #    8. Further improved this script's compactness, memory usage and robustness|
  312. #    v0.04d(GMT 1400 1-8-2015):                                                |
  313. #    1. Updated (DoubleX)ECATB Base Formula                                    |
  314. #    2. Changed :color to :atb and %Q(%Q()) to %Q()                            |
  315. #    3. Added configuration :ecatb_bar_multilayer in feature BAR               |
  316. #    4. Changed configuration :ecatb_actor_hotkeys to :ecatb_battler_hotkeys   |
  317. #    5. UNISON_DEFS doesn't have to include method arguments now               |
  318. #    6. Battler bars displayed on their sprites can overlap with status window |
  319. #    7. Added video https://www.youtube.com/watch?v=6E0-X0wbLAM                |
  320. #    8. Fixed complete freeze upon battle end in the ctb replication mode bug  |
  321. #    9. Fixed actors being inputable without action points in the atb pool mode|
  322. #    10. Fixed uncleared blocks for actors not in the party when saving bug    |
  323. #    11. Fixed unison rules not being properly applied to user's methods bug   |
  324. #    12. Fixed countdown freeze not freezing the countdown clock entirely bug  |
  325. #    13. Fixed notetag value reevaluation not always correctly triggered bug   |
  326. #    14. Further increased this script's compactness, compatibility,           |
  327. #        correctness, effectiveness, efficiency, flexibility, maintainability, |
  328. #        modularity, readability, robustness, simplicity and user-friendliness |
  329. #    v0.04c(GMT 1600 5-7-2015):                                                |
  330. #    1. Fixed duplicate actor sprite creations from other scripts doing so     |
  331. #    2. Fixed executing and/or inputting actions from/to hidden battlers bug   |
  332. #    3. Further increased this script's compactness and efficiency             |
  333. #    4. Removed some more redundant variables and compatibility socket methods |
  334. #    v0.04b(GMT 1600 29-6-2015):                                               |
  335. #    1. Reduced lag right after executing actions with ctb replication         |
  336. #    2. Fixed nil atb bar color bug upon party member change at battle end     |
  337. #    3. Removed some redundant variables and compatibility socket methods      |
  338. #    v0.04a(GMT 0300 27-6-2015):                                               |
  339. #    1. Implemented the CTB Replication feature                                |
  340. #    2. Lets users set if problematic configuration values will be reset       |
  341. #    3. Fixed retrieving nil battler name bug in the help window               |
  342. #    4. Increased this script's compactness and memory performance             |
  343. #    v0.03a(GMT 0900 27-5-2015):                                               |
  344. #    1. Implemented these features:                                            |
  345. #       -  Action Input Events                                                 |
  346. #       -  ATB Reset Events                                                    |
  347. #       -  Cooldown Finish Events                                              |
  348. #    2. Improved this script's efficiency and robustness                       |
  349. #    v0.02d(GMT 0400 25-5-2015):                                               |
  350. #    1. Fixed starting atb value not working bug                               |
  351. #    2. Fixed some typos and outdated stuffs                                   |
  352. #    v0.02c(GMT 1300 15-5-2015):                                               |
  353. #    1. Fixed default atb starting value not working bug                       |
  354. #    2. Fixed nil color upon victory and unexpected change equip results bug   |
  355. #    3. Fixed not clearing battlers' lambdas before calling Marshal bug        |
  356. #    4. Fixed failing to load saved games upon restarting the game bug         |
  357. #    5. Fixed unison method rules not working bug                              |
  358. #    6. Improved the battler cooldown and party escape implementations         |
  359. #    7. Further improved this script's efficiency                              |
  360. #    v0.02b(GMT 1500 12-5-2015):                                               |
  361. #    1. Fixed some typos and outdated stuffs                                   |
  362. #    2. Fixed order battler icon bugs upon adding/removing party members       |
  363. #    v0.02a(GMT 0700 9-5-2015):                                                |
  364. #    1. Implemented the Action Input Speed feature                             |
  365. #    2. Further improved this script's efficiency                              |
  366. #    v0.01b(GMT 1600 4-5-2015):                                                |
  367. #    1. Improved this script's efficiency                                      |
  368. #    v0.01a(GMT 1300 2-5-2015):                                                |
  369. #    1. Implemented the Battler Order Window feature                           |
  370. #    v0.00d(GMT 0800 22-4-2015):                                               |
  371. #    1. Fixed actor auto battle and confusion action not executing properly bug|
  372. #    2. Fixed compatibility methods not being called bug                       |
  373. #    3. Fixed unison charging value reset bug(the charging finishes upon reset)|
  374. #    v0.00c(GMT 1200 18-4-2015):                                               |
  375. #    1. Fixed the atb bar y offset not working bug                             |
  376. #    2. Fixed the faulty example notetag values of <ecatb color: type, num, CX>|
  377. #    3. Found unison charging value reset bug(the charging finishes upon reset)|
  378. #    v0.00b(GMT 0900 15-4-2015):                                               |
  379. #    1. Outsourced the countdown state sprite display to                       |
  380. #       DoubleX RMVXA State Counters                                           |
  381. #    2. Actor atb bars can be displayed on their sprites                       |
  382. #    v0.00a(GMT 1200 9-4-2015):                                                |
  383. #    1. 1st testing version of this script finished                            |
  384. #==============================================================================|
  385.  
  386. #==============================================================================|
  387. #  ** Notetag Info                                                             |
  388. #     Notetag settings override their corresponding configuration settings     |
  389. #     Search the notetags themselves to navigate between their info and values |
  390. #------------------------------------------------------------------------------|
  391. #  * Actors/Classes/Weapons/Armors/Enemies/States Notetags(in their noteboxes):|
  392. #    1. <ecatb color: type, num, cx>                                           |
  393. #       Sets the color num of atb bar with type being atb, charge or cooldown, |
  394. #       and num being 1or 2 as cx, which can be set in Color Notetag Values    |
  395. #    2. (v0.05a+)<ecatb gradual action gain: gagx>                             |
  396. #       Sets the battler to gradually gain action points instead of gaining its|
  397. #       maximum instantly if gagx, which can be set in Gradual Action Gain     |
  398. #       Notetag Values, returns true                                           |
  399. #    3. <ecatb order battler icon: obix>                                       |
  400. #       Sets the icon representing its battler's order as obix, which can be   |
  401. #       set in Order Battler Icon Notetag Values                               |
  402. #    4. <ecatb order battler opacity: obox>                                    |
  403. #       Sets the opacity of the icon representing its battler's order as obox, |
  404. #       which can be set in Order Battler Opacity Notetag Values               |
  405. #    5. <ecatb order battler scale: obsx>                                      |
  406. #       Sets the scale of the icon representing its battler's order as obsx,   |
  407. #       which can be set in Order Battler Scale Notetag Values                 |
  408. #    6. <ecatb order battler z: obzx>                                          |
  409. #       Sets the z position of the icon representing its battler's order as    |
  410. #       obzx, which can be awr in Order Battler Z Notetag Values               |
  411. #    7. <ecatb rate: rx>                                                       |
  412. #       Sets the atb fill rate of the battler as rx, which can be set in Rate  |
  413. #       Notetag Values                                                         |
  414. #       All rx of all data currently applied to the battler will be used, with |
  415. #       the output of the ith rx being the input of the (i + 1)th rx           |
  416. #    8. <ecatb se ready act: serax>                                            |
  417. #       Sets the se to be played when a battler becomes able to act as serax,  |
  418. #       which can be set in SE Ready Act Notetag Values                        |
  419. #    9. <ecatb speed reduce: srx>                                              |
  420. #       Sets the number of frames an enemy or actor with autobattle and/or     |
  421. #       confusion needs when inputting actions as srx, which can be set in     |
  422. #       Speed Reduce Notetag Values                                            |
  423. #       All srx of all data currently applied to the battler will be used      |
  424. #    10. <ecatb start val: start, svx>                                         |
  425. #        Sets the atb value at the start of the battle as svx, which can be set|
  426. #        in Start Value Notetag Values                                         |
  427. #        start can be either 0, 1 or 2, meaning the notetag will be used in    |
  428. #        normal, preemptive or surprise starts respectively                    |
  429. #        All svx of all data currently applied to the battler will be used     |
  430. #------------------------------------------------------------------------------|
  431. #  * Skill/Item Notetags(in their noteboxes):                                  |
  432. #    1. <ecatb act cost: acx>                                                  |
  433. #       Sets the number of actions needed for the skill/item as acx, which can |
  434. #       be set in Action Cost Notetag Values                                   |
  435. #       Users can't use it if they don't have enough actions                   |
  436. #       Setting acx as 0 means no action point is needed nor will be used      |
  437. #       Setting acx as negative means users will have more actions afterwards  |
  438. #    2. <ecatb charge prior act cost: cpacx>                                   |
  439. #       The skill/item action cost will be paid before and after finished      |
  440. #       charging if cpacx, which can be set in Charge Prior Act Cost Notetag   |
  441. #       Values, returns false and true respectively                            |
  442. #    3. <ecatb charge prior item cost: cpicx>                                  |
  443. #       The skill/item non-action cost will be paid before and after finished  |
  444. #       charging if cpicx, which can be set in Charge Prior Item Cost Notetag  |
  445. #       Values, returns false and true respectively                            |
  446. #    4. <ecatb charge rate: crx>                                               |
  447. #       The skill/item will have to charge with atb fill rate being crx, which |
  448. #       can be set in Charge Rate Notetag Values, before releasing if this     |
  449. #       notetag's used                                                         |
  450. #    5. <ecatb cooldown rate: cdrx>                                            |
  451. #       The battler will have to cool down with atb fill rate being cdrx, which|
  452. #       can be set in Cooldown Rate Notetag Values, after using the skill/item |
  453. #       before the battler's atb will be filled again if this notetag's used   |
  454. #    6. <ecatb force act cost: facx>                                           |
  455. #       The battler will and won't pay the action cost after using the forced  |
  456. #       action if facx, which can be set in Force Action Cost Notetag Values,  |
  457. #       returns false and true respectively                                    |
  458. #    7. <ecatb reset val: rvx>                                                 |
  459. #       Sets the atb value after using the skill/item as rvx, which can be set |
  460. #       in Reset Value Notetag Values                                          |
  461. #       The atb value right after users have no more actions will be the sum of|
  462. #       rvx of all skills/items used before users have no more actions if the  |
  463. #       battler doesn't gain action points gradually                           |
  464. #    8. <ecatb unison actor: uax>                                              |
  465. #       Sets the ids of actors needed to use the skill/item as uax, which can  |
  466. #       be set in Unison Actor Notetag Values                                  |
  467. #       All those actors must be able to use the skill/item                    |
  468. #       They'll charge it with the same charge rate, use it together and have  |
  469. #       a cooldown with the same cooldown rate                                 |
  470. #    9. <ecatb unison actor def: uadx>                                         |
  471. #       Sets the ids of actors used to calculate the result of def as uadx,    |
  472. #       which can be set in Unison Actor Method Notetag Values                 |
  473. #       def must be the symbol of a battler method returning real numbers and  |
  474. #       should be those used in the skill/item's damage formula                |
  475. #       If a method's used in the skill/item's damage formula but doesn't use  |
  476. #       this notetag, its value will be that of the battler inputting the      |
  477. #       skill/item                                                             |
  478. #       Only 1 uadx will be used per def                                       |
  479. #    10. <ecatb unison def rule: udrx>                                         |
  480. #        Sets the calculation rule of def as udrx, which can be set in Unison  |
  481. #        Method Rule Notetag Values                                            |
  482. #        def must be the symbol of a battler method returning real numbers and |
  483. #        should be those used in the skill/item's damage formula               |
  484. #        The rules are used when the skill/item's executing damage             |
  485. #        Only 1 udrx will be used per def                                      |
  486. #    11. <ecatb unison charge rule: ucrx>                                      |
  487. #        Sets the charge rate calculation rule as ucrx, which can be set in    |
  488. #        Unison Charge Rule Notetag Values                                     |
  489. #        The rules are used when the skill/item's charging                     |
  490. #    12. <ecatb unison cooldown rule: ucdrx>                                   |
  491. #        Sets the calculation rule of def as ucdrx, which can be set in Unison |
  492. #        Cooldown Rule Notetag Values                                          |
  493. #        The rules are used when the skill/item's users are cooling down       |
  494. #------------------------------------------------------------------------------|
  495. #  * Enemy/State Notetags(in their noteboxes):                                 |
  496. #    1. <enemy ecatb bar show: kill, bar, percent, act>                        |
  497. #       Sets if the enemy atb bar should be shown with fill percent and action |
  498. #       points                                                                 |
  499. #       The bar won't be shown if kill is true and the enemy isn't killed first|
  500. #       bar, act and percent will be ignored will be above condition is met    |
  501. #       The bar will be shown if bar is true                                   |
  502. #       act and percent will be ignored if bar is false                        |
  503. #       Action points and fill percent will be shown if act and percent are    |
  504. #       true respectively                                                      |
  505. #       Setting the value of an entry as nil means that entry will be ignored  |
  506. #       t, f and n represents true, false and nil values respectively          |
  507. #       The entry with the highest priority will be used if it's not nil       |
  508. #       Enemy's notetags are of the lowest priorities and will never be ignored|
  509. #------------------------------------------------------------------------------|
  510. #  * State Notetags(in their noteboxes):                                       |
  511. #    1. <ecatb countdown interval: cix>                                        |
  512. #       Sets the duration of the state as cix seconds, which  can be set in    |
  513. #       Coundown Interval Notetag Values                                       |
  514. #        All cix of all states currently applied to the battler will be used   |
  515. #==============================================================================|
  516.  
  517. #==============================================================================|
  518. #  ** Script Call Info                                                         |
  519. #------------------------------------------------------------------------------|
  520. #  * Configuration Settings                                                    |
  521. #    1. $game_system.set_battle_system(system)                                 |
  522. #       - Changes the battle system as system, which is one of those supported |
  523. #         by Yanfly Engine Ace - Ace Battle Engine                             |
  524. #       - It can only be used outside battles                                  |
  525. #    2. $game_system.ecatb_config = val                                        |
  526. #       - Sets the value of :ecatb_config as val                               |
  527. #         Example: $game_system.ecatb_base_fill_t = "$game_variables[x]" sets  |
  528. #                  the value of :ecatb_base_fill_t as that of variable with id |
  529. #                  x                                                           |
  530. #    3. create_ecatb_def(config, validate)                                     |
  531. #       - Updates the corresponding method of configuration config             |
  532. #         That method will be validated if validate is true                    |
  533. #         Example: BattleManager.create_ecatb_def(:ecatb_base_fill_t, true)    |
  534. #                  updates and validates the corresponding method of           |
  535. #                  :ecatb_base_fill_t                                          |
  536. #  * Battler manipulations                                                     |
  537. #    1. ecatb_act_times                                                        |
  538. #       - Returns the number of the current action points                      |
  539. #    2. ecatb_act_times = val                                                  |
  540. #       - Sets the number of the current action points as val                  |
  541. #    3. ecatb_countdown_freeze[state_id]                                       |
  542. #       - Returns if the countdown of state with id state_id is frozen         |
  543. #    4. ecatb_countdown_freeze[state_id] = val                                 |
  544. #       - Sets if the duration in turns of a countdown state with id state_id  |
  545. #         will be frozen                                                       |
  546. #    5. ecatb_note_change[note] = true                                         |
  547. #       - Notifies at least a value of a notetag with type note of a data used |
  548. #         by the battler has changed                                           |
  549. #       - note can be :act, :atb, :charge, :cooldown, :order_icon,             |
  550. #         :order_opacity,:order_scale, :order_z, :rate, :se, :speed, :start_0, |
  551. #         :start_1, :start_2, meaning gradual action gain, charge rate,        |
  552. #         bar color, cooldown rate, order icon, order opacity, order scale,    |
  553. #         order z, atb gain rate, speed reduce, battler ready se and start     |
  554. #         value notetags with normal, preemptive and surprise start types      |
  555. #         respectively                                                         |
  556. #       - This script call can also be used to change the charge, cooldown, atb|
  557. #         gain rate and bar colors per frame when it's called per frame        |
  558. #    6. ecatb_reset(reset)                                                     |
  559. #       - Cancels the battler's charging actions                               |
  560. #       - The battler's atb and action points will be reset as well if reset   |
  561. #         is true                                                              |
  562. #    7. ecatb_rate[type]                                                       |
  563. #       Returns the atb gain rate with type type                               |
  564. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  565. #         charge and cooldown atb types respectively                           |
  566. #    8. ecatb_val[type]                                                        |
  567. #       Returns the atb value with type type                                   |
  568. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  569. #         charge and cooldown atb types respectively                           |
  570. #    9. ecatb_val[type] = val                                                  |
  571. #       - Sets the atb value with type type as val                             |
  572. #       - type can be either :atb, :charge or :cooldown, meaning normal,       |
  573. #         charge and cooldown atb types respectively                           |
  574. #  * Party/Troop manipulations                                                 |
  575. #    1. ecatb_pool = enable                                                    |
  576. #       - Converts all actors/enemies' atb into a party/troop atb if enable is |
  577. #         true and vice versa if enable is false                               |
  578. #       - It can't be used in battles                                          |
  579. #  * Hotkey manipulations                                                      |
  580. #    1. SceneManager.scene.set_ecatb_battler_window_handlers                   |
  581. #       - Creates all battler target selection hotkey handlers                 |
  582. #       - It can only be used in battles                                       |
  583. #    2. SceneManager.scene.set_ecatb_actor_command_window_handlers             |
  584. #       - Creates all inputable actor setup hotkey handlers                    |
  585. #       - It can only be used in battles                                       |
  586. #    3. SceneManager.scene.create_ecatb_cancel_window                          |
  587. #       - Creates all charging actor cancellation hotkey handlers              |
  588. #       - It can only be used in battles                                       |
  589. #  * Window manipulations                                                      |
  590. #    1. SceneManager.scene.create_ecatb_clock_window                           |
  591. #       - Creates the atb clock window if :show_ecatb_clock_window returns     |
  592. #         true                                                                 |
  593. #       - It can only be used in battles                                       |
  594. #    2. SceneManager.scene_close_ecatb_clock_window                            |
  595. #       - Closes the atb clock window                                          |
  596. #       - It can only be used in battles with an atb clock window              |
  597. #    3. SceneManager.scene.ecatb_clock_window.update_text_xy                   |
  598. #       - Updates the atb clock window text x and y positions                  |
  599. #       - It can only be used in battles having an atb clock window            |
  600. #    4. SceneManager.scene.ecatb_clock_window.update_pos                       |
  601. #       - Updates the atb clock window x, y and z positions                    |
  602. #       - It can only be used in battles having an atb clock window            |
  603. #    5. SceneManager.scene.ecatb_clock_window.update_wh                        |
  604. #       - Updates the atb clock window width and height                        |
  605. #       - It can only be used in battles having an atb clock window            |
  606. #    6. SceneManager.scene.ecatb_clock_window.update_text_font                 |
  607. #       - Updates the atb clock window text color and size                     |
  608. #       - It can only be used in battles having an atb clock window            |
  609. #    7. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_colors      |
  610. #       - Updates the atb clock window bar colors                              |
  611. #       - It can only be used in battles having an atb clock window            |
  612. #    8. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_wh          |
  613. #       - Updates the atb clock window bar width and height                    |
  614. #       - It can only be used in battles having an atb clock window            |
  615. #    9. SceneManager.scene.ecatb_clock_window.clock_bar.update_bar_xy          |
  616. #       - Updates the atb clock window bar x and y positions                   |
  617. #       - It can only be used in battles having an atb clock window            |
  618. #    10. SceneManager.scene.ecatb_clock_window.refresh                         |
  619. #        - Refreshes the atb clock window bar and text                         |
  620. #        - It can only be used in battles having an atb clock window           |
  621. #    11. SceneManager.scene.create_ecatb_force_window                          |
  622. #        - Creates the atb force window if :show_ecatb_force_window returns    |
  623. #          true                                                                |
  624. #        - It can only be used in battles                                      |
  625. #    12. SceneManager.scene.close_ecatb_force_window                           |
  626. #        - Closes the atb force window                                         |
  627. #        - It can only be used in battles with an atb force window             |
  628. #    13. SceneManager.scene.ecatb_force_window.update_pos                      |
  629. #        - Updates the atb force window x, y and z positions                   |
  630. #        - It can only be used in battles having an atb force window           |
  631. #    14. SceneManager.scene.ecatb_force_window.update_wh                       |
  632. #        - Updates the atb force window width and height                       |
  633. #        - It can only be used in battles having an atb force window           |
  634. #    15. SceneManager.scene.ecatb_force_window.update_text_font                |
  635. #        - Updates the atb force window text color and size                    |
  636. #        - It can only be used in battles having an atb force window           |
  637. #    16. SceneManager.scene.ecatb_force_window.update_text                     |
  638. #        - Updates the atb force window text                                   |
  639. #        - It can only be used in battles having an atb force window           |
  640. #    17. SceneManager.scene.ecatb_force_window.update_text_xy                  |
  641. #        - Updates the atb force window text x and y positions                 |
  642. #        - It can only be used in battles having an atb force window           |
  643. #    18. SceneManager.scene.ecatb_force_window.draw_text                       |
  644. #        - Draws the atb force window text                                     |
  645. #        - It can only be used in battles having an atb force window           |
  646. #    19. SceneManager.scene.create_ecatb_order_window                          |
  647. #        - Creates the atb pool window if :show_ecatb_order_window returns true|
  648. #        - It can only be used in battles                                      |
  649. #    20. SceneManager.scene.close_ecatb_order_window                           |
  650. #        - Closes the atb order window                                         |
  651. #        - It can only be used in battles with an atb order window             |
  652. #    21. SceneManager.scene.ecatb_order_window.draw_bars                       |
  653. #        - Draws the atb order bars and text                                   |
  654. #        - It can only be used in battles with an atb order window             |
  655. #    22. SceneManager.scene.ecatb_pool_window.update_pos                       |
  656. #        - Updates the atb pool window x, y and z positions                    |
  657. #        - It can only be used in battles having an atb pool window            |
  658. #    23. SceneManager.scene.ecatb_pool_window.update_wh                        |
  659. #        - Updates the atb pool window width and height                        |
  660. #        - It can only be used in battles having an atb pool window            |
  661. #    24. SceneManager.scene.ecatb_pool_window.update_text_font                 |
  662. #        - Updates the atb pool window text color and size                     |
  663. #        - It can only be used in battles having an atb pool window            |
  664. #    25. SceneManager.scene.create_ecatb_pool_window                           |
  665. #        - Creates the atb pool window if :show_ecatb_pool_window returns true |
  666. #        - It can only be used in battles                                      |
  667. #    26. SceneManager.scene.close_ecatb_pool_window                            |
  668. #        - Closes the atb pool window                                          |
  669. #        - It can only be used in battles with an atb pool window              |
  670. #    27. SceneManager.scene.ecatb_pool_window.update_pos                       |
  671. #        - Updates the atb pool window x, y and z positions                    |
  672. #        - It can only be used in battles having an atb pool window            |
  673. #    28. SceneManager.scene.ecatb_pool_window.update_wh                        |
  674. #        - Updates the atb pool window width and height                        |
  675. #        - It can only be used in battles having an atb pool window            |
  676. #    29. SceneManager.scene.ecatb_pool_window.update_text_font                 |
  677. #        - Updates the atb pool window text color and size                     |
  678. #        - It can only be used in battles having an atb pool window            |
  679. #    30. SceneManager.scene.ecatb_pool_window.update_text_xy                   |
  680. #        - Updates the atb pool window text x and y positions                  |
  681. #        - It can only be used in battles having an atb pool window            |
  682. #    31. SceneManager.scene.ecatb_pool_window.draw_text                        |
  683. #        - Draws the atb pool window text                                      |
  684. #        - It can only be used in battles having an atb pool window            |
  685. #    32. (v0.04f+)SceneManager.scene.status_window.ecatb_text_change = true    |
  686. #        - Notifies that the atb bar text format's changed                     |
  687. #        - It can only be used in battles                                      |
  688. #    33. (v0.04f+)SceneManager.scene.status_window.ecatb_word_change = true    |
  689. #        - Notifies that the atb bar description word's changed                |
  690. #        - It can only be used in battles                                      |
  691. #    34. (v0.04f+)SceneManager.scene.status_window.ecatb_y_add_change = true   |
  692. #        - Notifies that the atb bar y offset's changed                        |
  693. #        - It can only be used in battles                                      |
  694. #==============================================================================|
  695.  
  696. ($doublex_rmvxa ||= {})[:ECATB] = "v0.05c"
  697.  
  698. #==============================================================================|
  699. #  ** Script Configurations                                                    |
  700. #     You only need to edit this part as it's about what this script does      |
  701. #------------------------------------------------------------------------------|
  702.  
  703. module DoubleX_RMVXA
  704.  
  705.   module ECATB
  706.  
  707.     # Sets if configuration values that can crash the game will be rescued
  708.     # If it's set as true, players will be informed that the values of those
  709.     # configurations are invalid and will be reset to their default ones
  710.     # If it's set as false, the game will crash and the error log will be shown
  711.     # It can't be changed once set
  712.     # Example: To let invalid configuration values crash the game to have the
  713.     #          error log, set this as false
  714.     RESCUE_CONFIG_VAL = true
  715.  
  716.     # (v0.04a+)Sets if configuration values that are invalid or can crash the
  717.     # game will be reset to their defaults
  718.     # It can't be changed once set
  719.     # Example: To reset invalid or faulty configuration values to their
  720.     #          defaults, set this as true
  721.     RESET_CONFIG_VAL = true
  722.  
  723.     # Sets if the text showing an invalid or faulty configuration value will be
  724.     # displayed right after checking them
  725.     # It can't be changed once set
  726.     # Example: To silently reset invalid or faulty configuration values, set
  727.     #          this as true
  728.     SUPPRESS_RESET_CONFIG_VAL_TEXT = false
  729.  
  730.   #----------------------------------------------------------------------------|
  731.   #  * Core                                                                    |
  732.   #    Setups configurations and notetag values of the core features           |
  733.   #----------------------------------------------------------------------------|
  734.  
  735.     #--------------------------------------------------------------------------|
  736.     #  Color Notetag Values                                                    |
  737.     #  - Setups cx used by <ecatb color: type, num, cx> notetags               |
  738.     #--------------------------------------------------------------------------|
  739.     # cx are read at:
  740.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  741.     #    - next @ecatb_notes[$1.downcase.to_sym][$2.to_i] ||= $3.downcase.to_sym
  742.     #      in load_ecatb_notes
  743.     # cx are used at:
  744.     # 1. Game_BattlerBase
  745.     #    - @ecatb_notes[note][0] ||= ecatb.send(n, self) if n and
  746.     #    - @ecatb_notes[note][1] ||= ecatb.send(n, self) in
  747.     #      set_ecatb_bar_color_notes
  748.     # cx are strings of names of methods under DoubleX_RMVXA::ECATB
  749.     # cx must return an array of colors
  750.     # cx names can only use alphanumeric characters and can't use uppercase
  751.     # letters
  752.     # battler is the battler calling the cx
  753.     # The below cx are examples added to help you set your cx
  754.     # You can freely use, rewrite and/or delete these examples
  755.  
  756.     # Sets the atb bar colors as text color c and r, g, b, a rgba values
  757.     def self.c1(battler)
  758.       Colour.text_colour(c)
  759.     end
  760.  
  761.     # Sets the atb bar colors as r, g, b, a rgba values
  762.     def self.c2(battler)
  763.       Color.new(r, g, b, a)
  764.     end
  765.  
  766.     # Adds new cx here
  767.    
  768.  
  769.     #--------------------------------------------------------------------------|
  770.     #  Rate Notetag Values                                                     |
  771.     #  - Setups rx used by <ecatb rate: rx> notetags                           |
  772.     #--------------------------------------------------------------------------|
  773.     # rx are read at:
  774.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  775.     #    - next @ecatb_notes[:rate] << $1.downcase.to_sym in load_ecatb_notes
  776.     # rx are used at:
  777.     # 1. Game_BattlerBase
  778.     #    - base[:val] = ecatb.send(note, self, base) in set_ecatb_gain_rate
  779.     # rx are strings of names of methods under DoubleX_RMVXA::ECATB
  780.     # rx must return a real number and should return a floating-point number
  781.     # rx names can only use alphanumeric characters and can't use uppercase
  782.     # letters
  783.     # battler is the battler calling the rx
  784.     # The base atb rate can be referenced by base[:val]
  785.     # The number of battlers counted for method sums can be referenced by
  786.     # base[:size]
  787.     # The method sum of all battlers counted can be referneced by
  788.     # base[:sum][method_name]
  789.     # method_name must be included in :ecatb_battlers_def_sum
  790.     # The below rx are examples to help you set your rx
  791.     # You can freely use, rewrite and/or delete these examples
  792.  
  793.     # Mutliplies the atb fill rate by the battler's agi / all battlers'
  794.     # average agi
  795.     # all battlers is the value of :def_sum_battlers
  796.     def self.r1(battler, base)
  797.       base[:val] * battler.agi * base[:size] / base[:sum][:agi]
  798.     end
  799.  
  800.     # Sets the atb fill rate as x% per frame
  801.     def self.r2(battler, base)
  802.       x
  803.     end
  804.  
  805.     # Sets the atb fill rate as the value of variable with id x * 100% per frame
  806.     def self.r3(battler, base)
  807.       $game_variables[x]
  808.     end
  809.  
  810.     # Adds new rx here
  811.    
  812.  
  813.     #--------------------------------------------------------------------------|
  814.     #  Start Value Notetag Values                                              |
  815.     #  - Setups svx used by <ecatb start val: start, svx> notetags             |
  816.     #--------------------------------------------------------------------------|
  817.     # svx are read at:
  818.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  819.     #    - next @ecatb_notes[("start_" + $1).to_sym] << $2.downcase.to_sym in
  820.     #      load_ecatb_notes
  821.     # svx are used at:
  822.     # 1. Game_BattlerBase
  823.     #    - ecatb.send(note, self) in set_ecatb_start_val
  824.     # svx are strings of names of methods under DoubleX_RMVXA::ECATB
  825.     # svx must return a non-negative real number and should return a
  826.     # non-negative floating-point number
  827.     # svx names can only use alphanumeric characters and can't use uppercase
  828.     # letters
  829.     # battler is the battler calling the svx
  830.     # The below svx are examples added to help you set your svx
  831.     # You can freely use, rewrite and/or delete these examples
  832.  
  833.     # Sets the starting atb value as x%
  834.     def self.sv1(battler)
  835.       battler.ecatb_val[:atb] = x
  836.     end
  837.  
  838.     # Sets the atb value as that of variable with id x * 100%
  839.     def self.sv2(battler)
  840.       battler.ecatb_val[:atb] = $game_variables[x]
  841.     end
  842.  
  843.     # Adds the atb starting value by x%
  844.     def self.sv3(battler)
  845.       battler.ecatb_val[:atb] += x
  846.     end
  847.  
  848.     # Adds new svx here
  849.    
  850.  
  851.     #--------------------------------------------------------------------------|
  852.     #  Action Cost Notetag Values                                              |
  853.     #  - Setups acx used by <ecatb act cost: acx> notetags                     |
  854.     #--------------------------------------------------------------------------|
  855.     # acx are read at:
  856.     # 1. RPG::UsableItem
  857.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  858.     # acx are used at:
  859.     # 1. Game_BattlerBase
  860.     #    - return false if @ecatb_val[:charge] <= 0.0 && @ecatb_act_times <
  861.     #      ecatb.send(item.ecatb_act_cost, self) in usable?
  862.     # 2. Game_Battler
  863.     #    - cost = DoubleX_RMVXA::ECATB.send(item.ecatb_act_cost, self) in
  864.     #      pay_ecatb_act_cost
  865.     #    - cost = (ecatb = DoubleX_RMVXA::ECATB).send(item.ecatb_act_cost, self)
  866.     #      in ecatb_unison_actor?
  867.     # 3. Window_ItemList
  868.     #    - return battler.usable?(item) if (ecatb = DoubleX_RMVXA::ECATB).send(
  869.     #      item.ecatb_act_cost, battler) > 1 || ecatb.send(
  870.     #      item.ecatb_unison_actor, battler).size > 1 in enable?
  871.     # acx are strings of names of methods under DoubleX_RMVXA::ECATB
  872.     # acx must return a real number and should return a non-random integer
  873.     # acx names can only use alphanumeric characters and can't use uppercase
  874.     # letters
  875.     # battler is the battler calling the acx
  876.     # The below acx are examples added to help you set your acx
  877.     # You can freely use, rewrite and/or delete these examples
  878.  
  879.     # Sets the action cost as x
  880.     def self.ac1(battler)
  881.       x
  882.     end
  883.  
  884.     # Sets the action cost as the value of variable with id x
  885.     def self.ac2(battler)
  886.       $game_variables[x]
  887.     end
  888.  
  889.     # Adds new acx here
  890.    
  891.  
  892.     # Sets the number of action points needed to execute actions
  893.     # It'll be used only if no acx are used
  894.     # It must return a real number and should return a non-random integer
  895.     # battler is the battler calling ecatb_act_cost
  896.     # Example: To set the number of action points needed to execute actions as
  897.     #          the value of variable with id x, set this as
  898.     #          %Q($game_variables[x])
  899.     def self.ecatb_act_cost(battler)
  900.       1
  901.     end
  902.  
  903.     #--------------------------------------------------------------------------|
  904.     #  Force Action Cost Notetags Values                                       |
  905.     #  - Setups facx used by <ecatb force act cost: facx> notetags             |
  906.     #--------------------------------------------------------------------------|
  907.     # facx are read at:
  908.     # 1. RPG::UsableItem
  909.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  910.     # facx are used at:
  911.     # 1. Game_BattlerBase
  912.     #    - if (force_act_cost = ecatb.send(item.ecatb_force_act_cost, self)) ||
  913.     #      !forced in exec_ecatb_act_cost
  914.     # facx are strings of names of methods under DoubleX_RMVXA::ECATB
  915.     # facx names can only use alphanumeric characters and can't use uppercase
  916.     # letters
  917.     # battler is the battler calling the facx
  918.     # The below facx are examples added to help you set your facx
  919.     # You can freely use, rewrite and/or delete these examples
  920.  
  921.     # Sets the force action cost as true
  922.     def self.fac1(battler)
  923.       true
  924.     end
  925.  
  926.     # Sets the force action cost as false
  927.     def self.fac2(battler)
  928.       false
  929.     end
  930.  
  931.     # Sets the force action cost as the state of switch with id x
  932.     def self.fac3(battler)
  933.       $game_switches[x]
  934.     end
  935.  
  936.     # Adds new facx here
  937.    
  938.  
  939.     # Sets if force actions cost action points
  940.     # It'll be used only if no facx are used
  941.     # battler is the battler calling ecatb_force_act_cost
  942.     # Example: To set force actions to cost action points if switch with id x is
  943.     #          on, set this as %Q($game_switches[x])
  944.     def self.ecatb_force_act_cost(battler)
  945.       false
  946.     end
  947.  
  948.     #--------------------------------------------------------------------------|
  949.     #  Reset Value Notetags Values                                             |
  950.     #  - Setups rvx used by <ecatb reset val: rvx> notetags                    |
  951.     #--------------------------------------------------------------------------|
  952.     # rvx are read at:
  953.     # 1. RPG::UsableItem
  954.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  955.     # rvx are used at:
  956.     # 1. Game_BattlerBase
  957.     #    - @ecatb_reset_val = (ecatb = DoubleX_RMVXA::ECATB).send(val, self) in
  958.     #      set_ecatb_reset_val
  959.     # rvx are strings of names of methods under DoubleX_RMVXA::ECATB
  960.     # rvx must return a real number and should return a floating-point number
  961.     # rvx names can only use alphanumeric characters and can't use uppercase
  962.     # letters
  963.     # battler is the battler calling the rvx
  964.     # The below rvx are examples added to help you set your rvx
  965.     # You can freely use, rewrite and/or delete these examples
  966.  
  967.     # Sets the atb reset value as x%
  968.     def self.rv1(battler)
  969.       x
  970.     end
  971.  
  972.     # Sets the atb reset value as the value of variable with id x * 100%
  973.     def self.rv2(battler)
  974.       $game_variables[x]
  975.     end
  976.  
  977.     # Adds the atb reset value by x%
  978.     def self.rv3(battler)
  979.       battler.ecatb_reset_val + x
  980.     end
  981.  
  982.     # Adds new rvx here
  983.    
  984.  
  985.     # Sets the atb reset value after using a skill/item
  986.     # It'll be used only if no rvx are used
  987.     # It must return a real number and should return a floating-point number
  988.     # battler is the battler calling ecatb_reset_val
  989.     # Example: To set the atb reset value as x%, set this as %Q(x)
  990.     def self.ecatb_reset_val(battler)
  991.       battler.set_gradual_ecatb_act_gain ? battler.ecatb_val[:atb] : 0.0
  992.     end
  993.  
  994.     #--------------------------------------------------------------------------|
  995.     #  Escape Initialization Condition Configurations                          |
  996.     #  - Setups EICX used by :ecatb_esc_init_cond                              |
  997.     #--------------------------------------------------------------------------|
  998.     # EICX are used at:
  999.     # 1. BattleManager
  1000.     #    - init_ecatb_escape if @ecatb_can_esc && ecatb_esc_init_cond in
  1001.     #      process_escape
  1002.     # EICX are strings of RGSS3 codes
  1003.     # EICX names can only use alphanumeric characters
  1004.     # The below EICX are examples added to help you set your EICX
  1005.     # You can freely use, rewrite and/or delete these examples
  1006.  
  1007.     # Checks if the member can pay the escape action cost
  1008.     EIC1 = -> mem { mem.ecatb_act_times >= mem.ecatb_esc_act_cost }
  1009.  
  1010.     # Adds new EICX here
  1011.    
  1012.  
  1013.     #--------------------------------------------------------------------------|
  1014.     #  Escape Charge Condition Configurations                                  |
  1015.     #  - Setups ECCX used by :ecatb_esc_charge_cond                            |
  1016.     #--------------------------------------------------------------------------|
  1017.     # ECCX are used at:
  1018.     # 1. BattleManager
  1019.     #    - return pay_ecatb_esc_cost unless ecatb_esc_charge_cond in
  1020.     #      ecatb_update
  1021.     # ECCX are strings of RGSS3 codes
  1022.     # ECCX names can only use alphanumeric characters
  1023.     # The below ECCX are examples added to help you set your ECCX
  1024.     # You can freely use, rewrite and/or delete these examples
  1025.  
  1026.     # Checks if the member is charging the party escape
  1027.     ECC1 = -> mem { mem.ecatb_esc }
  1028.  
  1029.     # Adds new ECCX here
  1030.    
  1031.  
  1032.     #--------------------------------------------------------------------------|
  1033.     #  Escape Execution Condition Configurations                               |
  1034.     #  - Setups EECX used by :ecatb_esc_exec_cond                              |
  1035.     #--------------------------------------------------------------------------|
  1036.     # EECX are used at:
  1037.     # 1. BattleManager
  1038.     #    - ecatb_esc_suc if ecatb_esc_exec_cond in ecatb_update
  1039.     # EECX are strings of RGSS3 codes
  1040.     # EECX names can only use alphanumeric characters
  1041.     # The below EECX are examples added to help you set your EECX
  1042.     # You can freely use, rewrite and/or delete these examples
  1043.  
  1044.     # Checks if the member has fully charged a skill/item
  1045.     EEC1 = -> mem { mem.ecatb_val[:charge] >= 100.0 }
  1046.  
  1047.     # Adds new EECX here
  1048.    
  1049.  
  1050.     #--------------------------------------------------------------------------|
  1051.     #  Wait Condition Configurations                                           |
  1052.     #  - Setups WCX used by :ecatb_wait_cond                                   |
  1053.     #--------------------------------------------------------------------------|
  1054.     # WCX are used at:
  1055.     # 1. Scene_Battle
  1056.     #    - BattleManager.phase && !ecatb_wait_cond in ecatb_update?
  1057.     # WCX are strings of RGSS3 codes
  1058.     # WCX names can only use alphanumeric characters
  1059.     # The below WCX are examples added to help you set your WCX
  1060.     # Your can freely use, rewrite and/or delete these examples
  1061.  
  1062.     # Checks if the atb clock is forced to stop
  1063.     WC1 = %Q(@ecatb_force_clock == :stop)
  1064.  
  1065.     # Checks if the atb clock isn't forced to run
  1066.     WC2 = %Q(@ecatb_force_clock != :run)
  1067.  
  1068.     # Checks if an action's executing
  1069.     WC3 = %Q(!BattleManager.ecatb_can_esc)
  1070.  
  1071.     # Checks if the cancel window's active
  1072.     WC4 = %Q(@ecatb_cancel_window && @ecatb_cancel_window.active)
  1073.  
  1074.     # Checks if the party command window's active
  1075.     WC5 = %Q(@party_command_window.active)
  1076.  
  1077.     # Checks if the actor target window's active
  1078.     WC6 = %Q(@actor_window.active)
  1079.  
  1080.     # Checks if the enemy target window's active
  1081.     WC7 = %Q(@enemy_window.active)
  1082.  
  1083.     # Checks if the skill window's active
  1084.     WC8 = %Q(@skill_window.active)
  1085.  
  1086.     # Checks if the item window's active
  1087.     WC9 = %Q(@item_window.active)
  1088.  
  1089.     # Checks if the actor command window's active
  1090.     WC10 = %Q(@actor_command_window.active)
  1091.  
  1092.     # Checks if the combat log window's visible
  1093.     WCC1 = %Q(update_msg_open_ecatb_compatibility?)
  1094.  
  1095.     # Adds new WCX here
  1096.    
  1097.  
  1098.     #--------------------------------------------------------------------------|
  1099.     #  Core Configurations                                                     |
  1100.     #  - Setups the configurations of the core features                        |
  1101.     #  - The value of each configuration is the string of the content of its   |
  1102.     #    corresponding method                                                  |
  1103.     #--------------------------------------------------------------------------|
  1104.  
  1105.     CORE = {
  1106.  
  1107.       # Sets the conditions for initializing party escape
  1108.       # A party escape is first initialized, then charged, and finally executed
  1109.       # An executed party escape can either success or fail
  1110.       # Its corresponding method's created under BattleManager
  1111.       # Party Escape can't be initialized nor executed while executing an action
  1112.       # Example: To demand at least 1 inputable party member that can pay the
  1113.       #          party escape cost, set this as
  1114.       #          %Q(ecatb_input_list.any?(&DoubleX_RMVXA::ECATB::EIC1))
  1115.       :ecatb_esc_init_cond => %Q((list = ecatb_input_list).size >= $game_party.
  1116.                  battle_members.size && list.all?(&DoubleX_RMVXA::ECATB::EIC1)),
  1117.  
  1118.       # Sets the conditions for continuing to charge the party escape
  1119.       # A party escape is first initialized, then charged, and finally executed
  1120.       # An executed party escape can either success or fail
  1121.       # Its corresponding method's created under BattleManager
  1122.       # Example: To demand a key with mapping :KEY to be pressed and at least 1
  1123.       #          party member to continue charging the party escape, set this as
  1124.       #          %Q(Input.press?(:KEY) &&
  1125.       #             $game_party.members.any?(&DoubleX_RMVXA::ECATB::ECC1))
  1126.       :ecatb_esc_charge_cond => %Q($game_party.battle_members.all?(
  1127.                                    &DoubleX_RMVXA::ECATB::ECC1)),
  1128.  
  1129.       # Sets the conditions for executing party escape
  1130.       # A party escape is first initialized, then charged, and finally executed
  1131.       # An executed party escape can either success or fail
  1132.       # Its corresponding method's created under BattleManager
  1133.       # Example: To demand at least 1 party member to finish charging the party
  1134.       #          escape before executing it, set this as
  1135.       #          %Q($game_party.members.any?(&DoubleX_RMVXA::ECATB::EEC1))
  1136.       :ecatb_esc_exec_cond => %Q($game_party.alive_members.all?(
  1137.                                  &DoubleX_RMVXA::ECATB::EEC1)),
  1138.  
  1139.       # Sets the conditions for successful party escape
  1140.       # A party escape is first initialized, then charged, and finally executed
  1141.       # An executed party escape can either success or fail
  1142.       # Its corresponding method's created under BattleManager
  1143.       # Example: To check the preemptive status or use escape ratio as the
  1144.       #          success probability and have at least 1 party member being able
  1145.       #          to pay the party escape cost, set this as
  1146.       #          %Q((@preemptive || rand < @escape_ratio) &&
  1147.       #             $game_party.alive_members.any?(&DoubleX_RMVXA::ECATB::EIC1))
  1148.       :ecatb_esc_suc_cond => %Q((@preemptive || rand < @escape_ratio) &&
  1149.                    $game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EIC1)),
  1150.  
  1151.       # Sets the atb clock wait condition
  1152.       # Its corresponding method's created under Scene_Battle
  1153.       # The atb clock will always wait if the game message is visible
  1154.       # Only 1 action can be executed at a time
  1155.       # Example: To run the atb clock if switch with id x is on, set this as
  1156.       #          %Q($game_switches[x])
  1157.       :ecatb_wait_cond => %Q(#{WC1} || #{WC2} && (#{WC3} || #{WC4} || #{WC5} ||
  1158.                              #{WC6} || #{WC7} || #{WC8} || #{WC9} || #{WC10} ||
  1159.                              #{WCC1})),
  1160.  
  1161.       # Sets the base atb fill time in seconds
  1162.       # Its corresponding method's created under BattleManager
  1163.       # It must return a positive real number
  1164.       # Example: To set the base atb fill time as 1 frame, set this as
  1165.       #          %Q(1 / Graphics.frame_rate)
  1166.       :ecatb_base_fill_t => %Q(10),
  1167.  
  1168.       # Sets the turn type
  1169.       # Its corresponding method's created under Scene_Battle
  1170.       # It must return either :tick, :battler or :act
  1171.       # :tick means turn length's controlled by the number of ticks
  1172.       # :battler means turn length is controlled by the number of battlers
  1173.       # :act means turn length's controlled by the number of actions executed
  1174.       # Example: To set the atb turn type as :act, set this as %Q(:act)
  1175.       :ecatb_turn_type => %Q(:tick),
  1176.  
  1177.       # Needs :ecatb_turn to be :tick to be used
  1178.       # Sets the turn length in seconds
  1179.       # Its corresponding method's created under Scene_Battle
  1180.       # It must return a positive real number
  1181.       # Example: To set the turn length as the base atb fill time, set this as
  1182.       #          %Q(BattleManager.ecatb_base_fill_t)
  1183.       :ecatb_tick_count => %Q(10),
  1184.  
  1185.       # Needs :ecatb_turn to be :act to be used
  1186.       # Sets the turn length in the number of actions counted
  1187.       # Its corresponding method's created under Scene_Battle
  1188.       # It must return a positive real number and should return a natural number
  1189.       # Example: To set the turn length as x actions, set this as %Q(x)
  1190.       :ecatb_after_act => %Q(10),
  1191.  
  1192.       # Needs :ecatb_turn to be :battler to be used
  1193.       # Sets the number of units per battler counted added to the turn length
  1194.       # The unit can either be :tick or :act
  1195.       # :tick means the unit is second
  1196.       # :act means the unit is the number of actions
  1197.       # Its corresponding method's created under Scene_Battle
  1198.       # It must return an array
  1199.       # Its 1st element must return a positive real number and should return a
  1200.       # natural number
  1201.       # Its 2nd element must return either :tick or :act
  1202.       # Example: To set the battler scale as x actions, set this as
  1203.       #          %Q([x, :act])
  1204.       :ecatb_battler_scale => %Q([1, :tick]),
  1205.  
  1206.       # Needs :ecatb_turn to be :battler to be used
  1207.       # Sets the battlers to be counted in the battler scale
  1208.       # Its corresponding method's created under Scene_Battle
  1209.       # It must return a positive real number and should return the size of
  1210.       # an array of battlers
  1211.       # Example: To include all battlers, set this as
  1212.       #          Q($game_party.members.size + $game_troop.members.size)
  1213.       :ecatb_battler_count => %Q($game_party.alive_members.size +
  1214.                                  $game_troop.alive_members.size),
  1215.  
  1216.       # Needs :ecatb_turn to be :act or :battler to be used
  1217.       # Sets if force actions are counted as well
  1218.       # Its corresponding method's created under Scene_Battle
  1219.       # Example: To count the force actions as well if switch with id x is on,
  1220.       #          set this as %Q($game_switches[x])
  1221.       :ecatb_force_act_count => %Q(false),
  1222.  
  1223.       # (v0.04a+)Sets if battles will behave like a CTB by skipping the atb,
  1224.       # charge and cooldown filling times, and the global atb tick clock
  1225.       # Its corresponding method's created under BattleManager
  1226.       # Example: To replicate a CTB system if switch with id x is on, set this
  1227.       #          as %Q($game_switches[x])
  1228.       :ecatb_ctb => %Q(false),
  1229.  
  1230.       # Sets the priority of the ecatb rate notetags to be used
  1231.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1232.       # It must return an array with elements being either :states, :enemies,
  1233.       # :armors, :weapons, :classes or :actors
  1234.       # Example: To set actors to have a higher priority than that of states,
  1235.       #          set this as %Q([:actors, :states])
  1236.       :ecatb_rate_ord => %Q([:actors, :classes, :weapons, :armors, :enemies,
  1237.                              :states]),
  1238.  
  1239.       # Sets the 1st atb value of actors when battles start normally
  1240.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1241.       # It must return a non-negative real number and should return a
  1242.       # non-negative floating-point number
  1243.       # Example: To set the 1st atb value of actors when battler start normally
  1244.       #          as x%, set this as %Q(@ecatb_val[:atb] = x)
  1245.       :normal_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1246.  
  1247.       # Sets the 1st atb value of enemies when battles start normally
  1248.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1249.       # It must return a non-negative real number and should return a
  1250.       # non-negative floating-point number
  1251.       # Example: To set the 1st atb value of enemies when battler start normally
  1252.       #          as x%, set this as %Q(@ecatb_val[:atb] = x)
  1253.       :normal_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1254.  
  1255.       # Sets the 1st atb value of actors when battles start with preemptive
  1256.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1257.       # It must return a non-negative real number and should return a
  1258.       # non-negative floating-point number
  1259.       # Example: To set the 1st atb value of actors when battler start with
  1260.       #          preemptive as x%, set this as %Q(@ecatb_val[:atb] = x)
  1261.       :preemptive_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 100.0),
  1262.  
  1263.       # Sets the 1st atb value of enemies when battles start with preemptive
  1264.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1265.       # It must return a non-negative real number and should return a
  1266.       # non-negative floating-point number
  1267.       # Example: To set the 1st atb value of enemies when battler start with
  1268.       #          preemptive as x%, set this as %Q(@ecatb_val[:atb] = x)
  1269.       :preemptive_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1270.  
  1271.       # Sets the 1st atb value of actors when battles start with surprise
  1272.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1273.       # It must return a non-negative real number and should return a
  1274.       # non-negative floating-point number
  1275.       # Example: To set the 1st atb value of actors when battler start with
  1276.       #          surprise as x%, set this as %Q(@ecatb_val[:atb] = x)
  1277.       :surprise_actor_1st_ecatb_val => %Q(@ecatb_val[:atb] = 0.0),
  1278.  
  1279.       # Sets the 1st atb value of enemies when battles start with surprise
  1280.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1281.       # It must return a non-negative real number and should return a
  1282.       # non-negative floating-point number
  1283.       # Example: To set the 1st atb value of enemies when battler start with
  1284.       #          surprise as x%, set this as %Q(@ecatb_val[:atb] = x)
  1285.       :surprise_enemy_1st_ecatb_val => %Q(@ecatb_val[:atb] = 100.0),
  1286.  
  1287.       # Sets the priority of the ecatb start value notetags to be used
  1288.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1289.       # It must return an array with elements being either :states, :enemies,
  1290.       # :armors, :weapons, :classes or :actors
  1291.       # Example: To set actors to have a higher priority than that of states,
  1292.       #          set this as %Q([:actors, :states])
  1293.       :ecatb_start_val_ord => %Q([:actors, :classes, :weapons, :armors,
  1294.                                   :enemies, :states]),
  1295.  
  1296.       # Sets the battler methods included to calculate the sum of each of those
  1297.       # methods of battlers in :ecatb_def_sum_battlers
  1298.       # Its corresponding method's created under BattleManager
  1299.       # It must return an array of symbols being defined battler methods
  1300.       # Example: To calculate the sum of luk of all battlers in
  1301.       #          :ecatb_def_sum_battlers, set this as %Q([:luk])
  1302.       :ecatb_battlers_def_sum => %Q([:agi]),
  1303.  
  1304.       # Sets the battlers to be included to calculate each of their method sums
  1305.       # Its corresponding method's created under BattleManager
  1306.       # It must return an array of battlers
  1307.       # Example: To set all battlers to be included to calculate each of their
  1308.       #          method sums, set this as
  1309.       #          %Q($game_party.battle_members + $game_troop.members)
  1310.       :ecatb_def_sum_battlers => %Q($game_party.alive_members +
  1311.                                     $game_troop.alive_members),
  1312.  
  1313.       # Sets if the sum of each battler method in :ecatb_battlers_def_sum of all
  1314.       # battlers in :ecatb_def_sum_battlers will be updated
  1315.       # Its corresponding method's created under BattleManager
  1316.       # Example: To update the sum of each battler method in
  1317.       #          :ecatb_battlers_def_sum of all battlers in
  1318.       #          :ecatb_def_sum_battlers if switch with id x is on, set this as
  1319.       #          %Q($game_switches[x])
  1320.       :update_ecatb_battlers_def_sums => %Q(ecatb_def_sum_battlers.any?(
  1321.                                             &DoubleX_RMVXA::ECATB::BLOCKS[
  1322.                                             :ecatb_refresh])),
  1323.  
  1324.       # Sets the action points reduced for all party members upon failed escapes
  1325.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1326.       # It must return a real number and should return an integer
  1327.       # Example: To set the escape action cost as x, set this as %Q(x)
  1328.       :ecatb_esc_act_cost => %Q(1),
  1329.  
  1330.       # Sets the atb reset value upon each failed escape
  1331.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1332.       # It must return a real number and should return a floating-point number
  1333.       # Example: To add the atb reset value upon a failed escape by x%, set this
  1334.       #          as %Q(@ecatb_reset_val + x)
  1335.       :ecatb_esc_reset_val => %Q(0.0),
  1336.  
  1337.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1338.       # Sets the text to be displayed on actor atb bars showing its details
  1339.       # The atb bar fill rate and action points can be referneced by percent and
  1340.       # action respectively
  1341.       # Its corresponding method's created under Window_BattleStatus
  1342.       # It must return a string
  1343.       # Example: To set the text to be displayed on actor atb bars showing the
  1344.       #          actors' action points, set this as %Q(act)
  1345.       :actor_ecatb_bar_text => %Q(percent + "% " + act),
  1346.  
  1347.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1348.       # Sets the word describing and displayed on actor atb bars
  1349.       # Its corresponding method's created under Window_BattleStatus
  1350.       # It must return a string
  1351.       # Example: To use the word "ATB" to describe and be displayed on actor atb
  1352.       #          bars, set this as %Q("ATB")
  1353.       :actor_ecatb_bar_word => %Q("AP"),
  1354.  
  1355.       # It won't be used if :actor_sprite_ecatb_bar returns true
  1356.       # Sets the actor atb bar y offset
  1357.       # Its corresponding method's created under Window_BattleStatus
  1358.       # It must return a real number and should return an integer
  1359.       # Example: To set the actor atb bar y offset as x, set this as %Q(x)
  1360.       :actor_ecatb_bar_y_add => %Q(12),
  1361.  
  1362.       # Sets the atb bar colors
  1363.       # It'll be used only if no corresponding color notetags are used
  1364.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1365.       # It must return an array of colors
  1366.       # Example: To set the atb bar colors as text color c and r, g, b, a rgba
  1367.       #          values, set this as
  1368.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1369.       :ecatb_bar_colors => %Q([Colour.text_colour(7), Colour.text_colour(8)]),
  1370.  
  1371.       # Sets the priority of the ecatb bar color notetags to be used
  1372.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1373.       # It must return an array with elements being either :states, :enemies,
  1374.       # :armors, :weapons, :classes or :actors
  1375.       # Example: To set states to have a higher priority than that of actors,
  1376.       #          set this as %Q([:states, :actors])
  1377.       :ecatb_bar_color_ord => %Q([:states, :enemies, :armors, :weapons,
  1378.                                   :classes, :actors]),
  1379.  
  1380.       # (v0.03a+)Sets something to happen right before inputting actions by a
  1381.       # battler
  1382.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1383.       # Example: To call a common event with id x right before inputting actions
  1384.       #          by a battler, set this as
  1385.       #          %Q($game_temp.reserve_common_event(x))
  1386.       :pre_ecatb_input_act => %Q(),
  1387.  
  1388.       # (v0.03a+)Sets something to happen right after inputting actions by a
  1389.       # battler
  1390.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1391.       # Example: To call a common event with id x right after inputting actions
  1392.       #          by a battler, set this as
  1393.       #          %Q($game_temp.reserve_common_event(x))
  1394.       :post_ecatb_input_act => %Q(),
  1395.  
  1396.       # (v0.03a+)Sets something to happen right before resetting a battler's
  1397.       # atb
  1398.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1399.       # Example: To call a common event with id x right before resetting a
  1400.       #          battler's atb, set this as
  1401.       #          %Q($game_temp.reserve_common_event(x))
  1402.       :pre_ecatb_reset => %Q(),
  1403.  
  1404.       # (v0.03a+)Sets something to happen right after resetting a battler's
  1405.       # atb
  1406.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1407.       # Example: To call a common event with id x right after resetting a
  1408.       #          battler's atb, set this as
  1409.       #          %Q($game_temp.reserve_common_event(x))
  1410.       :post_ecatb_reset => %Q(),
  1411.  
  1412.       # Sets something to happen right before updating the atb clock
  1413.       # Its corresponding method's created under Scene_Battle
  1414.       # Example: To support changing atb, charge and cooldown bar colors of all
  1415.       #          battlers per frame, set this as
  1416.       #          %Q(all_battle_members.each { |mem|
  1417.       #               mem.ecatb_note_change[:atb] =
  1418.       #               mem.ecatb_note_change[:charge] =
  1419.       #               mem.ecatb_note_change[:cooldown] = true
  1420.       #             })
  1421.       :pre_ecatb_update => %Q(),
  1422.  
  1423.       # Sets something to happen right after updating the atb clock
  1424.       # Its corresponding method's created under Scene_Battle
  1425.       # Example: To call a common event with id x right after updating the atb
  1426.       #          clock, set this as %Q($game_temp.reserve_common_event(x))
  1427.       :post_ecatb_update => %Q()
  1428.  
  1429.     }
  1430.  
  1431.   #----------------------------------------------------------------------------|
  1432.   #  * (v0.05a+)Action                                                         |
  1433.   #    Setups configurations of the action features                            |
  1434.   #----------------------------------------------------------------------------|
  1435.  
  1436.     #--------------------------------------------------------------------------|
  1437.     #  Gradual Action Gain Notetag Values                                      |
  1438.     #  - Setups gagx used by <ecatb gradual action gain: gagx> notetags        |
  1439.     #--------------------------------------------------------------------------|
  1440.     # gagx are read at:
  1441.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  1442.     #    - next @ecatb_notes[:act] = $1.downcase.to_sym in load_ecatb_notes
  1443.     # gagx are used at:
  1444.     # 1. Game_BattlerBase
  1445.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  1446.     # gagx are strings of names of methods under DoubleX_RMVXA::ECATB
  1447.     # gagx names can only use alphanumeric characters and can't use uppercase
  1448.     # letters
  1449.     # battler is the battler calling the gagx
  1450.     # The below gagx are examples added to help you set your gagx
  1451.     # You can freely use, rewrite and/or delete these examples
  1452.  
  1453.     # Sets gradual action gain as true
  1454.     def self.gag1(battler)
  1455.       true
  1456.     end
  1457.  
  1458.     # Sets gradual action gain as false
  1459.     def self.gag2(battler)
  1460.       false
  1461.     end
  1462.  
  1463.     # Sets gradual action gain as the state of switch with id x
  1464.     def self.gag3(battler)
  1465.       $game_switches[x]
  1466.     end
  1467.  
  1468.     # Adds new gagx here
  1469.    
  1470.  
  1471.     #--------------------------------------------------------------------------|
  1472.     #  Action Configurations                                                   |
  1473.     #  - Setups configurations of the action features                          |
  1474.     #  - The value of each configuration is the string of the content of its   |
  1475.     #    corresponding method                                                  |
  1476.     #--------------------------------------------------------------------------|
  1477.  
  1478.     ACTION = {
  1479.  
  1480.       # Sets whether a battler gains action points gradually instead of gaining
  1481.       # its maximum instantly
  1482.       # It'll be used only if no corresponding color notetags are used
  1483.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1484.       # Example: To set a battler to gain the maximum action points instantly if
  1485.       #          switch with id x is on, set this as %Q($game_switches[x])
  1486.       :gradual_ecatb_action_gain => %Q(true),
  1487.  
  1488.       # Sets the priority of the ecatb gradual action gain notetags to be used
  1489.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1490.       # It must return an array with elements being either :states, :enemies,
  1491.       # :armors, :weapons, :classes or :actors
  1492.       # Example: To set states to have a higher priority than that of actors,
  1493.       #          set this as %Q([:states, :actors])
  1494.       :gradual_ecatb_action_gain_ord => %Q([:states, :enemies, :armors,
  1495.                                             :weapons, :classes, :actors])
  1496.  
  1497.     }
  1498.  
  1499.   #----------------------------------------------------------------------------|
  1500.   #  * Bar                                                                     |
  1501.   #    Setups configurations and default notetag values of the bar features    |
  1502.   #----------------------------------------------------------------------------|
  1503.  
  1504.     #--------------------------------------------------------------------------|
  1505.     #  Bar Configurations                                                      |
  1506.     #  - Setups configurations and default notetag values of the bar features  |
  1507.     #  - The value of each configuration is the string of the content of its   |
  1508.     #    corresponding method                                                  |
  1509.     #--------------------------------------------------------------------------|
  1510.  
  1511.     # Sets if only enemies being dead before are shown with the atb bar
  1512.     # It'll only be used if it's not set by
  1513.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1514.     # It must be either true or false
  1515.     # Example: To sets only enemies being dead before to be shown with the atb
  1516.     # bar, set this as %Q(true)
  1517.     BAR_KILL_ENEMY_1ST = %Q(false)
  1518.  
  1519.     # Sets if enemy atb bars are shown
  1520.     # It'll only be used if it's not set by
  1521.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1522.     # It must be either true or false
  1523.     # Example: To hide enemy atb bars, set this as %Q(false)
  1524.     ENEMY_BAR_SHOW = %Q(true)
  1525.  
  1526.     # Sets if enemy action point is shown on enemy atb bars
  1527.     # It'll only be used if it's not set by
  1528.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1529.     # It must be either true or false
  1530.     # Example: To hide the enemy action points from the enemy atb bar, set this
  1531.     # as %Q(false)
  1532.     ENEMY_BAR_SHOW_ACT = %Q(true)
  1533.  
  1534.     # Sets if atb fill percent is shown on enemy atb bars
  1535.     # It'll only be used if it's not set by
  1536.     # <enemy ecatb bar show: kill, bar, percent, act> notetags
  1537.     # It must be either true or false
  1538.     # Example: To hide the enemy atb fill percent from the enemy atb bar, set
  1539.     # this as %Q(false)
  1540.     ENEMY_BAR_SHOW_PERCENT = %Q(true)
  1541.  
  1542.     BAR = {
  1543.  
  1544.       # Sets if the actor atb bars are displayed on their sprites instead
  1545.       # Its corresponding method's created under BattleManager
  1546.       # It must always return the same result during the same battle
  1547.       # Example: To display the actor atb bars on their sprites as well if
  1548.       #          switch with id x is on, set this as %Q($game_switches[x])
  1549.       :actor_sprite_ecatb_bar => %Q(false),
  1550.  
  1551.       # (v0.04d+)Sets if the atb and charge/cooldown bars are displayed
  1552.       # simultaneously
  1553.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1554.       # It must return the same value during the same battle
  1555.       # Example: To stop displaying atb and charge/cooldown bars simultaneously,
  1556.       #          set this as %Q(false)
  1557.       :ecatb_bar_multilayer => %Q(true),
  1558.  
  1559.       # Sets if battler sprite atb bars are animated
  1560.       # Its corresponding method's created under ECATB_Bar
  1561.       # Example: To animate the battler sprite atb bars if switch with id x is
  1562.       #          on, set this as %Q($game_switches[x])
  1563.       :ecatb_bar_ani => %Q(true),
  1564.  
  1565.       # Sets the battler sprite atb bar to animate horizontally per frame
  1566.       # Its corresponding method's created under ECATB_Bar
  1567.       # It must return a real number and should return an integer
  1568.       # Example: To set the battler sprite atb bar to animate horizontally by
  1569.       #          number of pixels being the value of variable with id x per
  1570.       #          frame, set this as %Q($game_variables[x])
  1571.       :ecatb_bar_ani_ox => %Q(2),
  1572.  
  1573.       # Sets the battler sprite atb bar width and height
  1574.       # Its corresponding method's created under ECATB_Bar
  1575.       # It must return an array of positive real numbers and should return an
  1576.       # array of natural numbers
  1577.       # Example: To set the battler sprite atb bar width and height to be the
  1578.       #          values of variables with id x and y respectively, set this as
  1579.       #          %Q([$game_variables[x], $game_variables[y]])
  1580.       :ecatb_bar_wh => %Q([48, 12]),
  1581.  
  1582.       # Sets the battler sprite atb bar xy offsets from the host battler sprite
  1583.       # Its corresponding method's created under ECATB_Bar
  1584.       # It must return an array of real numbers and should return an array of
  1585.       # integers
  1586.       # Example: To set the battler sprite atb bar x and y offsets as the value
  1587.       #          of variables with id a and b respectively, set this as
  1588.       #          %Q([$game_variables[a], $game_variables[b]])
  1589.       :ecatb_bar_xy_offset => %Q([0, 0]),
  1590.  
  1591.       # Sets the battler sprite atb bar z position
  1592.       # Its corresponding method's created under ECATB_Bar
  1593.       # It must return a non-negative real number and should return a
  1594.       # non-negative integer
  1595.       # Example: To set the battler sprite atb bar z position as the value of
  1596.       #          variable with id x, set this as %Q($game_variables[x])
  1597.       :ecatb_bar_z => %Q(0),
  1598.  
  1599.       # Sets the text to be displayed on battler sprite atb bars showing its
  1600.       # details
  1601.       # The atb bar fill rate and action points can be referneced by percent and
  1602.       # action respectively
  1603.       # Its corresponding method's created under ECATB_Bar
  1604.       # It must return a string
  1605.       # Example: To set the text to be displayed on battler sprite atb bars
  1606.       #          showing the battlers' action points, set this as %Q(act)
  1607.       :ecatb_bar_text => %Q(percent + "% " + act),
  1608.  
  1609.       # Sets the battler sprite atb bar text color
  1610.       # Its corresponding method's created under ECATB_Bar
  1611.       # It must return a color
  1612.       # Example: To set the battler sprite atb bar text color as r, g, b, a rgba
  1613.       #          values, set this as %Q(Color.new(r, g ,b ,a))
  1614.       :ecatb_bar_text_color => %Q(Colour.text_colour(0)),
  1615.  
  1616.       # Sets the battler sprite atb bar text size
  1617.       # Its corresponding method's created under ECATB_Bar
  1618.       # It must return a positive real number and should return an integer
  1619.       # Example: To set the battler sprite atb bar text saize as the value of
  1620.       #          variable with id x, set this as %Q($game_variables[x])
  1621.       :ecatb_bar_text_size => %Q(16),
  1622.  
  1623.       # Sets the battler sprite atb bar text x and y offsets from the atb bars
  1624.       # Its corresponding method's created under ECATB_Bar
  1625.       # It must return an array of real numbers and should return an array of
  1626.       # integers
  1627.       # Example: To set the battler sprite atb bar text x and y offsets from the
  1628.       #          atb bars as the values of variables with id a and b
  1629.       #          respectively, set this as
  1630.       #          %Q([$game_variables[a], $game_variables[b]])
  1631.       :ecatb_bar_text_xy_offset => %Q([-1, -1]),
  1632.  
  1633.       # Sets the battler sprite atb bar back colors
  1634.       # Its corresponding method's created under ECATB_Bar
  1635.       # It must return an array of colors
  1636.       # Example: To set the battler sprite atb back bar colors as text color c
  1637.       #          and r, g, b, a rgba values, set this as
  1638.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1639.       :ecatb_bar_back_colors => %Q([Colour.text_colour(15),
  1640.                                     Colour.text_colour(15)])
  1641.  
  1642.     }
  1643.  
  1644.   #----------------------------------------------------------------------------|
  1645.   #  * Cancel                                                                  |
  1646.   #    Setups configurations of the cancel features                            |
  1647.   #----------------------------------------------------------------------------|
  1648.  
  1649.     #--------------------------------------------------------------------------|
  1650.     #  Cancel Configurations                                                   |
  1651.     #  - Setups configurations of the cancel features                          |
  1652.     #  - The value of each configuration is the string of the content of its   |
  1653.     #    corresponding method                                                  |
  1654.     #--------------------------------------------------------------------------|
  1655.  
  1656.     CANCEL = {
  1657.  
  1658.       # Sets the key opening the cancel window
  1659.       # Its corresponding method's created under Scene_Battle
  1660.       # It must return a symbol and should return an Input constant
  1661.       # Example: To set the cancel window opening key as X, set this as %Q(:X)
  1662.       :ecatb_cancel_key => %Q(:SHIFT),
  1663.  
  1664.       # Sets the description text of the cancel window
  1665.       # Its corresponding method's created under Scene_Battle
  1666.       # It must return a string
  1667.       # Example: To set the description text of the cancel window as
  1668.       #          "Actor name", set this as
  1669.       #          %Q($game_party.members[@ecatb_cancel_window.index].name)
  1670.  
  1671.       :ecatb_cancel_text => %Q("Select an actor without autobattle nor " +
  1672.                                "confusion to\ncancel his/her/its partially " +
  1673.                                "charging skill/item.")
  1674.  
  1675.     }
  1676.  
  1677.   #----------------------------------------------------------------------------|
  1678.   #  * Charge                                                                  |
  1679.   #    Setups configurations and notetag values of the charge features         |
  1680.   #----------------------------------------------------------------------------|
  1681.  
  1682.     #--------------------------------------------------------------------------|
  1683.     #  Charge Prior Action Cost Notetag Values                                 |
  1684.     #  - Setups cpacx used by <ecatb charge prior act cost: cpacx> notetags    |
  1685.     #--------------------------------------------------------------------------|
  1686.     # cpacx are read at:
  1687.     # 1. RPG::UsableItem
  1688.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1689.     # cpacx are used at:
  1690.     # 1. Game_Battler
  1691.     #    - unless ecatb.send(@last_ecatb_item.ecatb_charge_prior_act_cost, self)
  1692.     #      in pay_prior_ecatb_charge
  1693.     #    - if ecatb.send(item.ecatb_charge_prior_act_cost, self) in
  1694.     #      exec_ecatb_act_cost
  1695.     #    - !ecatb.send(item.ecatb_charge_prior_act_cost, self) in
  1696.     #      ecatb_unison_actor?
  1697.     # cpacx shouldn't return random values
  1698.     # cpacx are strings of names of methods under DoubleX_RMVXA::ECATB
  1699.     # cpacx names can only use alphanumeric characters and can't use uppercase
  1700.     # letters
  1701.     # battler is the battler calling the cpacx
  1702.     # The below cpacx are examples to help you set your cpacx
  1703.     # You can freely use, rewrite and/or delete these examples
  1704.  
  1705.     # Sets charge prior action cost as true
  1706.     def self.cpac1(battler)
  1707.       true
  1708.     end
  1709.  
  1710.     # Sets charge prior action cost as false
  1711.     def self.cpac2(battler)
  1712.       false
  1713.     end
  1714.  
  1715.     # Sets charge prior action cost as the state of switch with id x
  1716.     def self.cpac3(battler)
  1717.       $game_switches[x]
  1718.     end
  1719.  
  1720.     # Adds new cpacx here
  1721.    
  1722.  
  1723.     # Sets if action cost is paid after finished charging
  1724.     # It'll be used only if no cpacx are used
  1725.     # battler is the battler calling the ecatb_charge_prior_act_cost
  1726.     # Example: To set the default action costs to be paid after charging if
  1727.     #          switch with id x is on, set this as %Q($game_switches[x])
  1728.     def self.ecatb_charge_prior_act_cost(battler)
  1729.       true
  1730.     end
  1731.  
  1732.     #--------------------------------------------------------------------------|
  1733.     #  Charge Prior Item Cost Notetag Values                                   |
  1734.     #  - Setups cpicx used by <ecatb charge prior item cost: cpicx> notetags   |
  1735.     #--------------------------------------------------------------------------|
  1736.     # cpicx are read at:
  1737.     # 1. RPG::UsableItem
  1738.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1739.     # cpicx are used at:
  1740.     # 1. Game_Battler
  1741.     #    - !DoubleX_RMVXA::ECATB.send(skill.ecatb_charge_prior_item_cost, self)
  1742.     #      in skill_cost_payable?
  1743.     #    - unless DoubleX_RMVXA::ECATB.send(item.ecatb_charge_prior_item_cost,
  1744.     #      self)in use_item
  1745.     #    - return if ecatb.send(@last_ecatb_item.ecatb_charge_prior_item_cost,
  1746.     #      self) in pay_prior_ecatb_charge
  1747.     # cpicx shouldn't return random values
  1748.     # cpicx are strings of names of methods under DoubleX_RMVXA::ECATB
  1749.     # cpicx names can only use alphanumeric characters and can't use uppercase
  1750.     # letters
  1751.     # battler is the battler calling the cpicx
  1752.     # The below cpicx are examples to help you set your cpicx
  1753.     # You can freely use, rewrite and/or delete these examples
  1754.  
  1755.     # Sets charge prior item cost as true
  1756.     def self.cpic1(battler)
  1757.       true
  1758.     end
  1759.  
  1760.     # Sets charge prior item cost as false
  1761.     def self.cpic2(battler)
  1762.       false
  1763.     end
  1764.  
  1765.     # Sets charge prior item cost as the state of switch with id x
  1766.     def self.cpic3(battler)
  1767.       $game_switches[x]
  1768.     end
  1769.  
  1770.     # Adds new cpicx here
  1771.    
  1772.  
  1773.     # Sets if item costs are paid after finished charging
  1774.     # It'll be used only if no cpicx are used
  1775.     # battler is the battler calling ecatb_charge_prior_item_cost
  1776.     # Example: To set the default item costs to be paid after charging if switch
  1777.     #          with id x is on, set this as %Q($game_switches[x])
  1778.     def self.ecatb_charge_prior_item_cost(battler)
  1779.       true
  1780.     end
  1781.  
  1782.     #--------------------------------------------------------------------------|
  1783.     #  Charge Rate Notetag Values                                              |
  1784.     #  - Setups crx used by <ecatb charge rate: crx> notetags                  |
  1785.     #--------------------------------------------------------------------------|
  1786.     # crx are read at:
  1787.     # 1. RPG::UsableItem
  1788.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1789.     # crx are used at:
  1790.     # 1. Game_BattlerBase
  1791.     #    - DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_charge_rate, self,
  1792.     #      @last_ecatb_rate[:charge]) in ecatb_charge_gain_rate
  1793.     # crx are strings of names of methods under DoubleX_RMVXA::ECATB
  1794.     # crx must return a real number and should return a floating-point number
  1795.     # crx names can only use alphanumeric characters and can't use uppercase
  1796.     # letters
  1797.     # battler is the battler calling the crx
  1798.     # rate is the atb gain rate of battler
  1799.     # The below crx are examples to help you set your crx
  1800.     # You can freely use, rewrite and/or delete these examples
  1801.  
  1802.     # Sets the charge rate as x% per frame
  1803.     def self.cr1(battler, rate)
  1804.       x
  1805.     end
  1806.  
  1807.     # Sets the charge rate as the value of variable with id x * 100% per frame
  1808.     def self.cr2(battler, rate)
  1809.       $game_variables[x]
  1810.     end
  1811.  
  1812.     # Sets the charge rate as x times the atb gain rate
  1813.     def self.cr3(battler, rate)
  1814.       rate * x
  1815.     end
  1816.  
  1817.     # Adds new crx here
  1818.    
  1819.  
  1820.     # Sets the default charge rate
  1821.     # It'll be used only if no crx are used
  1822.     # battler is the battler calling ecatb_charge_rate
  1823.     # rate is the atb gain rate of battler
  1824.     # Example: To disable charging, set this as %Q(100.0)
  1825.     def self.ecatb_charge_rate(battler, rate)
  1826.       100.0
  1827.     end
  1828.  
  1829.     #--------------------------------------------------------------------------|
  1830.     #  Charge Configurations                                                   |
  1831.     #  - Setups configurations of the charge features                          |
  1832.     #  - The value of each configuration is the string of the content of its   |
  1833.     #    corresponding method                                                  |
  1834.     #--------------------------------------------------------------------------|
  1835.  
  1836.     CHARGE = {
  1837.  
  1838.       # Sets the charge bar colors
  1839.       # It'll be used only if no corresponding color notetags are used
  1840.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1841.       # It must return an array of colors
  1842.       # Example: To set the charge bar colors as text color c and r, g, b, a
  1843.       #          rgba values, set this as
  1844.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1845.       :ecatb_charge_bar_colors => %Q([Colour.text_colour(30),
  1846.                                       Colour.text_colour(31)]),
  1847.  
  1848.       # Sets the priority of the ecatb charge bar color notetags to be used
  1849.       # Its corresponding method's created under Game_Actor and Game_Enemy
  1850.       # It must return an array with elements being either :states, :enemies,
  1851.       # :armors, :weapons, :classes or :actors
  1852.       # Example: To set states to have a higher priority than that of actors,
  1853.       #          set this as %Q([:states, :actors])
  1854.       :ecatb_charge_bar_color_ord => %Q([:states, :enemies, :armors, :weapons,
  1855.                                          :classes, :actors]),
  1856.  
  1857.       # Sets the party escape charge rate
  1858.       # The atb rate can be referneced by charge
  1859.       # Its corresponding method's created under Game_Actor
  1860.       # It must return a real number and should return a floating-point number
  1861.       # Example: To disable party escape charging, set this as %Q(100.0)
  1862.       :esc_ecatb_charge_rate => %Q(100.0)
  1863.  
  1864.     }
  1865.  
  1866.   #----------------------------------------------------------------------------|
  1867.   #  * Clock                                                                   |
  1868.   #    Setups configurations of the clock features                             |
  1869.   #----------------------------------------------------------------------------|
  1870.  
  1871.     #--------------------------------------------------------------------------|
  1872.     #  Clock Configurations                                                    |
  1873.     #--------------------------------------------------------------------------|
  1874.  
  1875.     CLOCK = {
  1876.  
  1877.       # Shows the atb clock window
  1878.       # It's used under Scene_Battle but it doesn't have any associated method
  1879.       # Example: To show the atb clock window if switch with id x is on, set
  1880.       #          this as %Q($game_switches[x])
  1881.       :show_ecatb_clock_window => %Q(true),
  1882.  
  1883.       # Sets the atb clock window width and height
  1884.       # Its corresponding method's created under ECATB_Clock_Window
  1885.       # It must return an array of positive real numbers and should return an
  1886.       # array of natural numbers
  1887.       # Example: To set the atb clock window width and height as the value of
  1888.       #          variables with id x and y respectively, set this as
  1889.       #          %Q([$game_variables[x], $game_variables[y]])
  1890.       :ecatb_clock_window_wh => %Q([128, 48]),
  1891.  
  1892.       # Sets the atb clock window x, y and z positions
  1893.       # Its corresponding method's created under ECATB_Clock_Window
  1894.       # It must return an array of real numbers and should return an array of
  1895.       # integers
  1896.       # Example: To set the atb clock window x, y and z positions as the value
  1897.       #          of variables with id a, b and c respectively, set this as
  1898.       #         %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  1899.       :ecatb_clock_window_xyz => %Q([0, 0, 0]),
  1900.  
  1901.       # Sets the turn portion bar colors
  1902.       # Its corresponding method's created under ECATB_Clock_Bar
  1903.       # It must return an array of colors
  1904.       # Example: To set the turn portion bar colors as text color c and r, g, b,
  1905.       #          a rgba values, set this as
  1906.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  1907.       :ecatb_clock_bar_colors => %Q([Colour.text_colour(7),
  1908.                                      Colour.text_colour(8)]),
  1909.  
  1910.       # Sets the turn portion bar width and height
  1911.       # Its corresponding method's created under ECATB_Clock_Bar
  1912.       # It must return an array of positive real numbers and should return an
  1913.       # array of natural numbers
  1914.       # Example: To set the turn portion bar width and height as the value of
  1915.       #          variables with id x and y respectively, set this as
  1916.       #          %Q([$game_variables[x], $game_variables[y]])
  1917.       :ecatb_clock_bar_wh => %Q([104, 12]),
  1918.  
  1919.       # Sets the turn portion bar x and y positions
  1920.       # Its corresponding method's created under ECATB_Clock_Bar
  1921.       # It must return an array of real numbers and should return an array of
  1922.       # integers
  1923.       # Example: To set the turn portion bar x and y positions as the value of
  1924.       #          variables with id x and y respectively, set this as
  1925.       #          %Q([$game_variables[x], $game_variables[y]])
  1926.       :ecatb_clock_bar_xy => %Q([8, 8]),
  1927.  
  1928.       # Sets the way the turn portion and count text are shown
  1929.       # The current atb clcok can be referneced by cur_clock
  1930.       # The maximum atb clock can be referneced by max_clock
  1931.       # The turn count can be referenced by turn_count
  1932.       # Its corresponding method's created under ECATB_Clock_Window
  1933.       # It must return a string
  1934.       # Example: To set the way the turn portion and count text are shown as
  1935.       #          "cur_clock/max_clock", set this as
  1936.       #          %Q(cur_clock.to_s + "/" + max_clock.to_s)
  1937.       :ecatb_clock_text => %Q(cur_clock.to_s + "/" + max_clock.to_s + " " +
  1938.                               turn_count.to_s),
  1939.  
  1940.       # Sets the turn portion and count text color
  1941.       # Its corresponding method's created under ECATB_Clock_Window
  1942.       # It must return a color
  1943.       # Example: To set the turn portion and count text color's rgba values as
  1944.       #          r, g, b and a, set this as %Q(Color.new(r, g, b, a))
  1945.       :ecatb_clock_text_color => %Q(Colour.text_colour(0)),
  1946.  
  1947.       # Sets the turn portion and count text size
  1948.       # Its corresponding method's created under ECATB_Clock_Window
  1949.       # It must return a positive real number and should return a natural number
  1950.       # Example: To set the turn portion and count text size as the value of
  1951.       #          variable with id x, set this as %Q($game_variables[x])
  1952.       :ecatb_clock_text_size => %Q(16),
  1953.  
  1954.       # Sets the turn portion and count text x and y positions
  1955.       # Its corresponding method's created under ECATB_Clock_Window
  1956.       # It must return an array of real numbers and should return an array of
  1957.       # integers
  1958.       # Example: To set the turn portion and count text x and y positions as the
  1959.       #          value of variables with id a and b respectively, set this as
  1960.       #          %Q([$game_variables[a], $game_variables[b]])
  1961.       :ecatb_clock_text_xy => %Q([0, 4])
  1962.  
  1963.     }
  1964.  
  1965.   #----------------------------------------------------------------------------|
  1966.   #  * Cooldown                                                                |
  1967.   #    Setups configurations and notetag values of the cooldown features       |
  1968.   #----------------------------------------------------------------------------|
  1969.  
  1970.     #--------------------------------------------------------------------------|
  1971.     #  Cooldown Rate Notetag Values                                            |
  1972.     #  - Setups cdrx used by <ecatb cooldown rate: cdrx> notetags              |
  1973.     #--------------------------------------------------------------------------|
  1974.     # cdrx are read at:
  1975.     # 1. RPG::UsableItem
  1976.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  1977.     # cdrx are used at:
  1978.     # 1. Game_BattlerBase
  1979.     #    - DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_cooldown_rate, self,
  1980.     #      @last_ecatb_rate[:cooldown]) in ecatb_cooldown_loss_rate
  1981.     # The atb rate can be referenced by val
  1982.     # cdrx are strings of names of methods under DoubleX_RMVXA::ECATB
  1983.     # cdrx must return a real number and should return a floating-point number
  1984.     # cdrx names can only use alphanumeric characters and can't use uppercase
  1985.     # letters
  1986.     # battler is the battler calling the cdrx
  1987.     # rate is the atb gain rate of battler
  1988.     # The below cdrx are examples to help you set your cdrx
  1989.     # You can freely use, rewrite and/or delete these examples
  1990.  
  1991.     # Sets the cooldown rate as x% per frame
  1992.     def self.cdr1(battler, rate)
  1993.       x
  1994.     end
  1995.  
  1996.     # Sets the cooldown rate as the value of variable with id x* 100% per frame
  1997.     def self.cdr2(battler, rate)
  1998.       $game_variables[x]
  1999.     end
  2000.  
  2001.     # Sets the cooldown rate as x times the atb gain rate
  2002.     def self.cdr3(battler, rate)
  2003.       rate * x
  2004.     end
  2005.  
  2006.     # Adds new cdrx here
  2007.    
  2008.  
  2009.     # Sets the default cooldown rate
  2010.     # It'll be used only if no cdrx are used
  2011.     # battler is the battler calling ecatb_cooldown_rate
  2012.     # rate is the atb gain rate of battler
  2013.     # Example: To disable cooldown, set this as %Q(100.0)
  2014.     def self.ecatb_cooldown_rate(battler, rate)
  2015.       100.0
  2016.     end
  2017.  
  2018.     #--------------------------------------------------------------------------|
  2019.     #  Cooldown Configurations                                                 |
  2020.     #  - Setups configurations of the cooldown features                        |
  2021.     #  - The value of each configuration is the string of the content of its   |
  2022.     #    corresponding method                                                  |
  2023.     #--------------------------------------------------------------------------|
  2024.  
  2025.     COOLDOWN = {
  2026.  
  2027.       # Sets the cooldown bar colors
  2028.       # It'll be used only if no corresponding color notetags are used
  2029.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2030.       # It must return an array of colors
  2031.       # Example: To set the cooldown bar colors as text color c and r, g, b, a
  2032.       #          rgba values, set this as
  2033.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2034.       :ecatb_cooldown_bar_colors => %Q([Colour.text_colour(19),
  2035.                                         Colour.text_colour(26)]),
  2036.  
  2037.       # Sets the priority of the ecatb cooldown bar color notetags to be used
  2038.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2039.       # It must return an array with elements being either :states, :enemies,
  2040.       # :armors, :weapons, :classes or :actors
  2041.       # Example: To set states to have a higher priority than that of actors,
  2042.       #          set this as %Q([:states, :actors])
  2043.       :ecatb_cooldown_bar_color_ord => %Q([:states, :enemies, :armors,
  2044.                                            :weapons, :classes, :actors]),
  2045.  
  2046.       # (v0.03a+)Sets something to happen right after finishing cooling down
  2047.       # normally
  2048.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2049.       # Example: To call a common event with id x right after finishing cooling
  2050.       #          down normally, set this as
  2051.       #          %Q($game_temp.reserve_common_event(x))
  2052.       :ecatb_cooldown_finish => %Q(),
  2053.  
  2054.       # Sets the failed party escape cooldown rate
  2055.       # The atb rate can be referneced by cooldown
  2056.       # Its corresponding method's created under Game_Actor
  2057.       # It must return a real number and should return a floating-point number
  2058.       # Example: To disable failed party escape cooldown, set this as %Q(100.0)
  2059.       :esc_ecatb_cooldown_rate => %Q(100.0)
  2060.  
  2061.     }
  2062.  
  2063.   #----------------------------------------------------------------------------|
  2064.   #  * Countdown                                                               |
  2065.   #    Setups configurations and notetag values of the countdown features      |
  2066.   #----------------------------------------------------------------------------|
  2067.  
  2068.     #--------------------------------------------------------------------------|
  2069.     #  Countdown Interval Notetag Values                                       |
  2070.     #  - Setups cix used by <ecatb countdown interval: cix> notetags           |
  2071.     #--------------------------------------------------------------------------|
  2072.     # cix are read at:
  2073.     # 1. RPG::State
  2074.     #    - next @ecatb_countdown_interval = $1.downcase.to_sym in
  2075.     #      load_ecatb_notes
  2076.     # cix are used at:
  2077.     # 1. Game_Battler
  2078.     #    - return unless $data_states[state_id].ecatb_countdown_interval in
  2079.     #      reset_state_counts
  2080.     #    - @ecatb_countdown_clock.each_key(&@ecatb_countdown_updates) in
  2081.     #      ecatb_countdown_update
  2082.     # cix are strings of names of methods under DoubleX_RMVXA::ECATB
  2083.     # cix must return a positive real number and should return a natural number
  2084.     # cix names can only use alphanumeric characters and can't use uppercase
  2085.     # letters
  2086.     # battler is the battler calling the cix
  2087.     # The below cix are examples to help you set your cix
  2088.     # You can freely use, rewrite and/or delete these examples
  2089.  
  2090.     # Sets the countdown interval as x seconds
  2091.     def self.ci1(battler)
  2092.       x
  2093.     end
  2094.  
  2095.     # Sets the countdown interval as the number of seconds equal to the value of
  2096.     # variable with id x
  2097.     def self.ci2(battler)
  2098.       $game_variables[x]
  2099.     end
  2100.  
  2101.     # Adds new cix here
  2102.    
  2103.  
  2104.     #--------------------------------------------------------------------------|
  2105.     #  (v0.05a+)Countdown Configurations                                       |
  2106.     #  - Setups configurations of the countdown features                       |
  2107.     #  - The value of each configuration is the string of the content of its   |
  2108.     #    corresponding method                                                  |
  2109.     #--------------------------------------------------------------------------|
  2110.  
  2111.     COUNTDOWN = {
  2112.  
  2113.       # Sets the minimum countdown interval for all states in frames
  2114.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2115.       # It must return a natural number
  2116.       # Example: To minimum countdown interval for all states in frames as the
  2117.       #          half of the number of frames per second, set this as
  2118.       #          %Q(Graphics.frame_rate / 2)
  2119.       :ecatb_countdown_min => %Q(Graphics.frame_rate)
  2120.  
  2121.     }
  2122.  
  2123.   #----------------------------------------------------------------------------|
  2124.   #  * Force                                                                   |
  2125.   #    Setups configurations of the force features                             |
  2126.   #----------------------------------------------------------------------------|
  2127.  
  2128.     #--------------------------------------------------------------------------|
  2129.     #  Force Configurations                                                    |
  2130.     #  - Setups configurations of the force features                           |
  2131.     #  - The value of each configuration is the string of the content of its   |
  2132.     #    corresponding method                                                  |
  2133.     #--------------------------------------------------------------------------|
  2134.  
  2135.     FORCE = {
  2136.  
  2137.       # Sets the key forcing the atb clock to run
  2138.       # Its corresponding method's created under Scene_Battle
  2139.       # It must return a symbol and should return an Input constant
  2140.       # If :ecatb_force_stop_key is pressed before pressing
  2141.       # :ecatb_force_run_key, the latter will cancel the former instead of
  2142.       # forcing the atb clock to run
  2143.       # Pressing :ecatb_force_run_key again will force the atb clock to run
  2144.       # Example: To disable this feature, set this as %Q(:unused), where :unused
  2145.       #          is an unused keymap
  2146.       :ecatb_force_run_key => %Q(:CTRL),
  2147.  
  2148.       # Sets the key forcing the atb clock to stop
  2149.       # Its corresponding method's created under Scene_Battle
  2150.       # It must return a symbol and should return an Input constant
  2151.       # If :ecatb_force_run_key is pressed before pressing
  2152.       # :ecatb_force_stop_key, the latter will cancel the former instead of
  2153.       # forcing the atb clock to stop
  2154.       # Example: To disable this feature, set this as %Q(:unused), where :unused
  2155.       #          is an unused keymap
  2156.       :ecatb_force_stop_key => %Q(:ALT),
  2157.  
  2158.       # Shows the atb force window displaying the atb force status
  2159.       # It's used under Scene_Battle but it doesn't have any associated method
  2160.       # Example: To show the atb force window if switch with id x is on, set
  2161.       #          this as %Q($game_switches[x])
  2162.       :show_ecatb_force_window => %Q(true),
  2163.  
  2164.       # Sets the atb force window width and height
  2165.       # Its corresponding method's created under ECATB_Force_Window
  2166.       # It must return an array of positive real numbers and should return an
  2167.       # array of natural numbers
  2168.       # Example: To set the atb force window width and height as the value of
  2169.       #          variables with id x and y respectively, set this as
  2170.       #          %Q([$game_variables[x], $game_variables[y]])
  2171.       :ecatb_force_window_wh => %Q([128, 40]),
  2172.  
  2173.       # Sets the atb force widnow x, y and z positions
  2174.       # Its corresponding method's created under ECATB_Force_Window
  2175.       # It must return an array of real numbers and should return an array of
  2176.       # integers
  2177.       # Example: To set the atb force window x, y and z positions as the value
  2178.       #          of variables with id a, b and c respectively, set this as
  2179.       #         %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2180.       :ecatb_force_window_xyz => %Q([0, 48, 0]),
  2181.  
  2182.       # Sets the atb force window text to be displayed when the atb clock isn't
  2183.       # forced
  2184.       # Its corresponding method's created under ECATB_Force_Window
  2185.       # It must return a string
  2186.       # Example: To set the atb force window text to be displayed when the atb
  2187.       #          clock isn't forced as "nil", set this as %Q("nil")
  2188.       :ecatb_force_nil_text => %Q("No Force ATB"),
  2189.  
  2190.       # Sets the atb force window text to be displayed when the atb clock's
  2191.       # forced to run
  2192.       # Its corresponding method's created under ECATB_Force_Window
  2193.       # It must return a string
  2194.       # Example: To set the atb force window text to be displayed when the atb
  2195.       #          clock's force to run as "run", set this as %Q("run")
  2196.       :ecatb_force_run_text => %Q("ATB Force Run"),
  2197.  
  2198.       # Sets the atb force window text to be displayed when the atb clock's
  2199.       # forced to stop
  2200.       # Its corresponding method's created under ECATB_Force_Window
  2201.       # It must return a string
  2202.       # Example: To set the atb force window text to be displayed when the atb
  2203.       #          clock's force to run as "stop", set this as %Q("stop")
  2204.       :ecatb_force_stop_text => %Q("ATB Force Stop"),
  2205.  
  2206.       # Sets the atb force window text color
  2207.       # Its corresponding method's created under ECATB_Force_Window
  2208.       # It must return a color
  2209.       # Example: To set the atb force window text color's rgba values as r, g, b
  2210.       #          and a, set this as %Q(Color.new(r, g, b, a))
  2211.       :ecatb_force_text_color => %Q(Colour.text_colour(0)),
  2212.  
  2213.       # Sets the atb force window text size
  2214.       # Its corresponding method's created under ECATB_Force_Window
  2215.       # It must return a positive real number and should return a natural number
  2216.       # Example: To set the atb force window text size as the value of variable
  2217.       #          with id x, set this as %Q($game_variables[x])
  2218.       :ecatb_force_text_size => %Q(16),
  2219.  
  2220.       # Sets the atb force window text x and y positions
  2221.       # Its corresponding method's created under ECATB_Force_Window
  2222.       # It must return an array of real numbers and should return an array of
  2223.       # integers
  2224.       # Example: To set the atb force window text x and y positions as the value
  2225.       #          of variables with id a and b respectively, set this as
  2226.       #          %Q([$game_variables[a], $game_variables[b]])
  2227.       :ecatb_force_text_xy => %Q([0, 0])
  2228.  
  2229.     }
  2230.  
  2231.   #----------------------------------------------------------------------------|
  2232.   #  * Hotkey                                                                  |
  2233.   #    Setups configurations of the hotkey features                            |
  2234.   #----------------------------------------------------------------------------|
  2235.  
  2236.     #--------------------------------------------------------------------------|
  2237.     #  Hotkey Configurations                                                   |
  2238.     #  - Setups configurations of the hotkey features                          |
  2239.     #  - The value of each configuration is the string of the content of its   |
  2240.     #    corresponding method                                                  |
  2241.     #--------------------------------------------------------------------------|
  2242.  
  2243.     HOTKEY = {
  2244.  
  2245.       # Sets the hotkeys calling an actor in the status window that can input
  2246.       # actions or in the cancel window, or a battler in the target window
  2247.       # Its corresponding method's created under Scene_Battle
  2248.       # It must return an array of symbols and should return an array of
  2249.       # Input constants
  2250.       # The ith hotkey calls the actor with index i
  2251.       # Nothing will happen if the actor in the status window can't input
  2252.       # actions
  2253.       # Example: To disable this feature, set this as %Q([])
  2254.       :ecatb_battler_hotkeys => %Q([
  2255.         :NUMPAD1,
  2256.         :NUMPAD2,
  2257.         :NUMPAD3,
  2258.         :NUMPAD4,
  2259.         :NUMPAD5,
  2260.         :NUMPAD6,
  2261.         :NUMPAD7,
  2262.         :NUMPAD8,
  2263.         :NUMPAD9,
  2264.         :NUMPAD0
  2265.       ])
  2266.  
  2267.     }
  2268.  
  2269.   #----------------------------------------------------------------------------|
  2270.   #  * (v0.01a+)Order                                                          |
  2271.   #    Setups configurations of the order features                             |
  2272.   #----------------------------------------------------------------------------|
  2273.  
  2274.     #--------------------------------------------------------------------------|
  2275.     #  Order Battler Icon Notetag Values                                       |
  2276.     #  - Setups obix used by <ecatb order battler icon: obix> notetags         |
  2277.     #--------------------------------------------------------------------------|
  2278.     # obix are read at:
  2279.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2280.     #    - next @ecatb_notes[:order_icon] = $1.downcase.to_sym in
  2281.     #      load_ecatb_notes
  2282.     # obix are used at:
  2283.     # 1. Game_BattlerBase
  2284.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2285.     # obix are strings of names of methods under DoubleX_RMVXA::ECATB
  2286.     # obix must return an array with its 1st and 2nd element being a bitmap and
  2287.     # a rect respectively
  2288.     # obix names can only use alphanumeric characters and can't use uppercase
  2289.     # letters
  2290.     # battler is the battler calling the obix
  2291.     # The below obix are examples added to help you set your obix
  2292.     # You can freely use, rewrite and/or delete these examples
  2293.  
  2294.     # Uses the actor character graphic with frame at 1st row and 2nd column
  2295.     def self.obi1(battler)
  2296.       bitmap = Cache.character(battler.actor.character_name)
  2297.       w = bitmap.width / 12
  2298.       h = bitmap.height / 8
  2299.       index = battler.actor.character_index
  2300.       [bitmap, Rect.new((index % 4 * 3 + 1) * w, (index / 4 * 4) * h, w, h)]
  2301.     end
  2302.  
  2303.     # Uses bitmap "Monsters2" in "Characters" with part at 1st row and 3rd
  2304.     # column and frame in that part at 1st row and 2nd column
  2305.     def self.obi2(battler)
  2306.       bitmap = Cache.character("Monster2")
  2307.       w = bitmap.width / 12
  2308.       h = bitmap.height / 8
  2309.       [bitmap, Rect.new((2 % 4 * 3 + 1) * w, (2 / 4 * 4) * h, w, h)]
  2310.     end
  2311.  
  2312.     # Adds new obix here
  2313.    
  2314.  
  2315.     #--------------------------------------------------------------------------|
  2316.     #  Order Battler Opacity Notetag Values                                    |
  2317.     #  - Setups obox used by <ecatb order battler opacity: obox> notetags      |
  2318.     #--------------------------------------------------------------------------|
  2319.     # obox are read at:
  2320.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2321.     #    - next @ecatb_notes[:order_opacity] = $1.downcase.to_sym in
  2322.     #      load_ecatb_notes
  2323.     # obox are used at:
  2324.     # 1. Game_BattlerBase
  2325.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2326.     # obox are strings of names of methods under DoubleX_RMVXA::ECATB
  2327.     # obox must return a non-negative real number and should return a
  2328.     # non-negatve integer
  2329.     # obox names can only use alphanumeric characters and can't use uppercase
  2330.     # letters
  2331.     # battler is the battler calling the obox
  2332.     # The below obox are examples added to help you set your obox
  2333.     # You can freely use, rewrite and/or delete these examples
  2334.  
  2335.     # Sets the opacity of the icon representing its battler order as x
  2336.     def self.obo1(battler)
  2337.       x
  2338.     end
  2339.  
  2340.     # Sets the opacity of the icon representing its battler order as the value
  2341.     # of variable with id x
  2342.     def self.obo2(battler)
  2343.       $game_variables[x]
  2344.     end
  2345.  
  2346.     # Adds new obox here
  2347.    
  2348.  
  2349.     #--------------------------------------------------------------------------|
  2350.     #  Order Battler Scale Notetag Values                                      |
  2351.     #  - Setups obsx used by <ecatb order battler scale: obsx> notetags        |
  2352.     #--------------------------------------------------------------------------|
  2353.     # obsx are read at:
  2354.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2355.     #    - next @ecatb_notes[:order_scale] = $1.downcase.to_sym in
  2356.     #      load_ecatb_notes
  2357.     # obsx are used at:
  2358.     # 1. Game_BattlerBase
  2359.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2360.     # obsx are strings of names of methods under DoubleX_RMVXA::ECATB
  2361.     # obsx must return a positive real number
  2362.     # obsx names can only use alphanumeric characters and can't use uppercase
  2363.     # letters
  2364.     # battler is the battler calling the obsx
  2365.     # The below obsx are examples added to help you set your obsx
  2366.     # You can freely use, rewrite and/or delete these examples
  2367.  
  2368.     # Sets the opacity of the icon representing its battler order as x
  2369.     def self.obs1(battler)
  2370.       x
  2371.     end
  2372.  
  2373.     # Sets the opacity of the icon representing its battler order as the value
  2374.     # of variable with id x
  2375.     def self.obs2(battler)
  2376.       $game_variables[x]
  2377.     end
  2378.  
  2379.     # Adds new obsx here
  2380.    
  2381.  
  2382.     #--------------------------------------------------------------------------|
  2383.     #  Order Battler Z Notetag Values                                          |
  2384.     #  - Setups obzx used by <ecatb order battler z: obzx> notetags            |
  2385.     #--------------------------------------------------------------------------|
  2386.     # obzx are read at:
  2387.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2388.     #    - next @ecatb_notes[:order_z] = $1.downcase.to_sym in load_ecatb_notes
  2389.     # obzx are used at:
  2390.     # 1. Game_BattlerBase
  2391.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2392.     # obzx are strings of names of methods under DoubleX_RMVXA::ECATB
  2393.     # obzx must return a non-negative real number and should return a
  2394.     # non-negatve integer
  2395.     # obzx names can only use alphanumeric characters and can't use uppercase
  2396.     # letters
  2397.     # battler is the battler calling the obzx
  2398.     # The below obzx are examples added to help you set your obzx
  2399.     # You can freely use, rewrite and/or delete these examples
  2400.  
  2401.     # Sets the z position of the icon representing its battler order as x
  2402.     def self.obz1(battler)
  2403.       x
  2404.     end
  2405.  
  2406.     # Sets the z position of the icon representing its battler order as the
  2407.     # value of variable with id x
  2408.     def self.obz2(battler)
  2409.       $game_variables[x]
  2410.     end
  2411.  
  2412.     # Adds new obzx here
  2413.    
  2414.  
  2415.     #--------------------------------------------------------------------------|
  2416.     #  Order Configurations                                                    |
  2417.     #  - Setups configurations of the order features                           |
  2418.     #  - The value of each configuration is the string of the content of its   |
  2419.     #    corresponding method                                                  |
  2420.     #--------------------------------------------------------------------------|
  2421.  
  2422.     ORDER = {
  2423.  
  2424.       # Shows the battler order window
  2425.       # It's used under Scene_Battle but it doesn't have any associated method
  2426.       # Example: To show the battler atb window if switch with id x is on, set
  2427.       #          this as %Q($game_switches[x])
  2428.       :show_ecatb_order_window => %Q(true),
  2429.  
  2430.       # Sets the battler order window width and height
  2431.       # Its corresponding method's created under ECATB_Order_Window
  2432.       # It must return an array of positive real numbers and should return an
  2433.       # array of natural numbers
  2434.       # Example: To set the battler order window width and height as the value
  2435.       #          of variables with id x and y respectively, set this as
  2436.       #          %Q([$game_variables[x], $game_variables[y]])
  2437.       :ecatb_order_window_wh => %Q([128, 60]),
  2438.  
  2439.       # Sets the battler order window x, y and z positions
  2440.       # Its corresponding method's created under ECATB_Order_Window
  2441.       # It must return an array of real numbers and should return an array of
  2442.       # integers
  2443.       # Example: To set the battler order window x, y and z positions as the
  2444.       #          value of variables with id a, b and c respectively, set this as
  2445.       #     %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2446.       :ecatb_order_window_xyz => %Q([0, 88, 0]),
  2447.  
  2448.       # Sets the battler order atb bar colors
  2449.       # Its corresponding method's created under ECATB_Order_Window
  2450.       # It must return an array of colors
  2451.       # Example: To set the battler order atb bar colors as text color c and r,
  2452.       #          g, b, a rgba values, set this as
  2453.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2454.       :ecatb_order_bar_colors => %Q([Colour.text_colour(7),
  2455.                                      Colour.text_colour(8)]),
  2456.  
  2457.       # Sets the battler order atb charge bar colors
  2458.       # Its corresponding method's created under ECATB_Order_Window
  2459.       # It must return an array of colors
  2460.       # Example: To set the battler order atb charge bar colors as text color c
  2461.       #          and r, g, b, a rgba values, set this as
  2462.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2463.       :ecatb_order_charge_bar_colors => %Q([Colour.text_colour(30),
  2464.                                             Colour.text_colour(31)]),
  2465.  
  2466.       # Sets the battler order atb cooldown bar colors
  2467.       # Its corresponding method's created under ECATB_Order_Window
  2468.       # It must return an array of colors
  2469.       # Example: To set the battler order atb cooldown bar colors as text color
  2470.       #          c and r, g, b, a rgba values, set this as
  2471.       #          %Q([Colour.text_colour(c), Color.new(r, g, b, a)])
  2472.       :ecatb_order_cooldown_bar_colors => %Q([Colour.text_colour(19),
  2473.                                               Colour.text_colour(26)]),
  2474.  
  2475.       # Sets the battler order bars width and height
  2476.       # Its corresponding method's created under ECATB_Order_Window
  2477.       # It must return an array of positive real numbers and should return an
  2478.       # array of natural numbers
  2479.       # Example: To set the battler order bars width and height as the value of
  2480.       #          variables with id x and y respectively, set this as
  2481.       #          %Q([$game_variables[x], $game_variables[y]])
  2482.       :ecatb_order_bar_wh => %Q([108, 12]),
  2483.  
  2484.       # Sets the battler order bars x and y positions
  2485.       # Its corresponding method's created under ECATB_Order_Window
  2486.       # It must return an array of real numbers and should return an array of
  2487.       # integers
  2488.       # Example: To set the battler order bars x and y positions as the value of
  2489.       #          variables with id x and y respectively, set this as
  2490.       #          %Q([$game_variables[x], $game_variables[y]])
  2491.       :ecatb_order_bar_xy => %Q([0, 12]),
  2492.  
  2493.       # Sets the battler order atb bar text
  2494.       # Its corresponding method's created under ECATB_Order_Window
  2495.       # It must return a string
  2496.       # Example: To set the battler order atb bar text as "Norm", set this as
  2497.       #          %Q("Norm")
  2498.       :ecatb_order_bar_text => %Q("ATB"),
  2499.  
  2500.       # Sets the battler order atb charge bar text
  2501.       # Its corresponding method's created under ECATB_Order_Window
  2502.       # It must return a string
  2503.       # Example: To set the battler order atb charge bar text as "Charging", set
  2504.       #          this as %Q("Charging")
  2505.       :ecatb_order_charge_bar_text => %Q("Charge"),
  2506.  
  2507.       # Sets the battler order atb cooldown bar text
  2508.       # Its corresponding method's created under ECATB_Order_Window
  2509.       # It must return a string
  2510.       # Example: To set the battler order atb cooldown bar text as "Cooldown",
  2511.       #          set this as %Q("Cooldown")
  2512.       :ecatb_order_cooldown_bar_text => %Q("Cool"),
  2513.  
  2514.       # Sets the battler order bars text color
  2515.       # Its corresponding method's created under ECATB_Order_Window
  2516.       # It must return a color
  2517.       # Example: To set the battler order bars text color's rgba values as
  2518.       #          r, g, b and a, set this as %Q(Color.new(r, g, b, a))
  2519.       :ecatb_order_text_color => %Q(Colour.text_colour(0)),
  2520.  
  2521.       # Sets the battler order bars text size
  2522.       # Its corresponding method's created under ECATB_Order_Window
  2523.       # It must return a positive real number and should return a natural number
  2524.       # Example: To set the battler order bars text size as the value of
  2525.       #          variable with id x, set this as %Q($game_variables[x])
  2526.       :ecatb_order_text_size => %Q(12),
  2527.  
  2528.       # Sets the battler order bars text x and y positions
  2529.       # Its corresponding method's created under ECATB_Order_Window
  2530.       # It must return an array of real numbers and should return an array of
  2531.       # integers
  2532.       # Example: To set the battler order bars text x and y positions as the
  2533.       #          value of variables with id a and b respectively, set this as
  2534.       #          %Q([$game_variables[a], $game_variables[b]])
  2535.       :ecatb_order_text_xy => %Q([2, 14]),
  2536.  
  2537.       # Sets the icon representing the battlers in the battler order window
  2538.       # It'll be used only if no corresponding order battler icon notetags are
  2539.       # used
  2540.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2541.       # It must return an array with its 1st and 2nd element being a bitmap and
  2542.       # a rect respectively
  2543.       # Example: To use the icon with index x in the iconset, set this as
  2544.       #          %Q(
  2545.       #    [Cache.system("Iconset"), Rect.new(x % 16 * 24, x / 16 * 24, 24, 24)]
  2546.       #    ),
  2547.       :ecatb_order_battler_icon => %Q(
  2548.        [Cache.system("Iconset"), Rect.new(121 % 16 * 24, 121 / 16 * 24, 24, 24)]
  2549.       ),
  2550.  
  2551.       # Sets the priority of the ecatb order battler icon notetags to be used
  2552.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2553.       # It must return an array with elements being either :states, :enemies,
  2554.       # :armors, :weapons, :classes or :actors
  2555.       # Example: To set states to have a higher priority than that of actors,
  2556.       #          set this as %Q([:states, :actors])
  2557.       :ecatb_order_battler_icon_ord => %Q([:states, :enemies, :armors,
  2558.                                            :weapons, :classes, :actors]),
  2559.  
  2560.       # Sets the opacity of icons representing the battlers in the battler order
  2561.       # window
  2562.       # It'll be used only if no corresponding order battler icon notetags are
  2563.       # used
  2564.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2565.       # It must return a non-negative real number and should return an integer
  2566.       # between 0 and 255
  2567.       # Example: To set the opacity of icons representing the actors as the
  2568.       #          value of variable with id x, set this as %Q($game_variables[x])
  2569.       :ecatb_order_battler_opacity => %Q(255),
  2570.  
  2571.       # Sets the priority of the ecatb order battler opacity notetags to be used
  2572.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2573.       # It must return an array with elements being either :states, :enemies,
  2574.       # :armors, :weapons, :classes or :actors
  2575.       # Example: To set states to have a higher priority than that of actors,
  2576.       #          set this as %Q([:states, :actors])
  2577.       :ecatb_order_battler_opacity_ord => %Q([:states, :enemies, :armors,
  2578.                                               :weapons, :classes, :actors]),
  2579.  
  2580.       # Sets the scale of icons representing the battlers in the battler order
  2581.       # window
  2582.       # It'll be used only if no corresponding order battler icon notetags are
  2583.       # used
  2584.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2585.       # It must return a positive real number
  2586.       # Example: To set the scale of icons representing the actors as the
  2587.       #          value of variable with id x, set this as %Q($game_variables[x])
  2588.       :ecatb_order_battler_scale => %Q(0.5),
  2589.  
  2590.       # Sets the priority of the ecatb order battler scale notetags to be used
  2591.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2592.       # It must return an array with elements being either :states, :enemies,
  2593.       # :armors, :weapons, :classes or :actors
  2594.       # Example: To set states to have a higher priority than that of actors,
  2595.       #          set this as %Q([:states, :actors])
  2596.       :ecatb_order_battler_scale_ord => %Q([:states, :enemies, :armors,
  2597.                                             :weapons, :classes, :actors]),
  2598.  
  2599.       # Sets the z position of icons representing the battlers in the battler
  2600.       # order window
  2601.       # It'll be used only if no corresponding order battler icon notetags are
  2602.       # used
  2603.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2604.       # It must return a non-negative real number and should return a
  2605.       # non-negatve integer
  2606.       # Example: To set the z position of icons representing the actors as the
  2607.       #          value of variable with id x, set this as %Q($game_variables[x])
  2608.       :ecatb_order_battler_z => %Q(500),
  2609.  
  2610.       # Sets the priority of the ecatb order battler z notetags to be used
  2611.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2612.       # It must return an array with elements being either :states, :enemies,
  2613.       # :armors, :weapons, :classes or :actors
  2614.       # Example: To set states to have a higher priority than that of actors,
  2615.       #          set this as %Q([:states, :actors])
  2616.       :ecatb_order_battler_z_ord => %Q([:states, :enemies, :armors, :weapons,
  2617.                                         :classes, :actors]),
  2618.  
  2619.       # Sets the x position of icons representing the battlers in the battler
  2620.       # order window
  2621.       # It must return a real number and should return an integer
  2622.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2623.       # Example: To set the x position of icons representing the battlers as the
  2624.       #          value of variable with id x, set this as %Q($game_variables[x])
  2625.       :ecatb_order_battler_icon_x => %Q(4),
  2626.  
  2627.       # Sets the y position of icons representing the actors in the battler
  2628.       # order window
  2629.       # It must return a real number and should return an integer
  2630.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2631.       # Example: To set the y position of icons representing the actors as the
  2632.       #          value of variable with id x, set this as %Q($game_variables[x])
  2633.       :ecatb_order_actor_icon_y => %Q(36),
  2634.  
  2635.       # Sets the y position of icons representing the enemies in the battler
  2636.       # order window
  2637.       # It must return a real number and should return an integer
  2638.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2639.       # Example: To set the y position of icons representing the enemies as the
  2640.       #          value of variable with id x, set this as %Q($game_variables[x])
  2641.       :ecatb_order_enemy_icon_y => %Q(8)
  2642.  
  2643.     }
  2644.  
  2645.   #----------------------------------------------------------------------------|
  2646.   #  * Pool                                                                    |
  2647.   #    Setups configurations of the pool features                              |
  2648.   #----------------------------------------------------------------------------|
  2649.  
  2650.     #--------------------------------------------------------------------------|
  2651.     #  Pool Configurations                                                     |
  2652.     #  - Setups configurations of the pool features                            |
  2653.     #  - The value of each configuration is the string of the content of its   |
  2654.     #    corresponding method                                                  |
  2655.     #--------------------------------------------------------------------------|
  2656.  
  2657.     POOL = {
  2658.  
  2659.       # Evaluates the party/troop pool atb value from all actors/enemies' ones
  2660.       # The actors/enemies' atb values can be referenced by vals
  2661.       # Its corresponding method's created under Game_Party and Game_Troop
  2662.       # It must return a non-negative real number and should return a
  2663.       # non-negative integer
  2664.       # Example: To use the minimum atb value of all actors/enemies, set this as
  2665.       #          %Q(vals.empty? ? 0 : vals.min)
  2666.       :ecatb_pool_val => %Q(vals.empty? ? 0 : vals.inject(:+) / vals.size),
  2667.  
  2668.       # Shows the atb pool window displaying the atb mode
  2669.       # It's used under Scene_Battle but it doesn't have any associated method
  2670.       # Example: To show the atb pool window if switch with id x is on, set
  2671.       #          this as %Q($game_switches[x])
  2672.       :show_ecatb_pool_window => %Q(true),
  2673.  
  2674.       # Sets the atb pool window width and height
  2675.       # Its corresponding method's created under ECATB_Pool_Window
  2676.       # It must return an array of positive real numbers and should return an
  2677.       # array of natural numbers
  2678.       # Example: To set the atb pool window width and height as the value of
  2679.       #          variables with id x and y respectively, set this as
  2680.       # %Q([$game_variables[x], $game_variables[y]])
  2681.       :ecatb_pool_window_wh => %Q([128, 56]),
  2682.  
  2683.       # Sets the atb pool widnow x, y and z positions
  2684.       # Its corresponding method's created under ECATB_Pool_Window
  2685.       # It must return an array of real numbers and should return an array of
  2686.       # integers
  2687.       # Example: To set the atb pool window x, y and z positions as the value
  2688.       #          of variables with id a, b and c respectively, set this as
  2689.       # %Q([$game_variables[a], $game_variables[b], $game_variables[c]])
  2690.       :ecatb_pool_window_xyz => %Q([0, 148, 0]),
  2691.  
  2692.       # Sets the party atb pool window text to be displayed
  2693.       # Its corresponding method's created under ECATB_Pool_Window
  2694.       # It must return an array of strings
  2695.       # The 1st and 2nd element of the array is displayed when the atb pool
  2696.       # mode's on and off respectively
  2697.       # Example: To set the party atb pool window text to be displayed when the
  2698.       #          atb pool mode's on and off as "Party ATB Pool Mode On" and
  2699.       #          "Party ATB Pool Mode Off" respectively, set this as
  2700.       #          %Q(["Party ATB Pool Mode On", "Party ATB Pool Mode Off"])
  2701.       :ecatb_pool_party_actor_text => %Q(["Party ATB", "Actor ATB"]),
  2702.  
  2703.       # Sets the troop atb pool window text to be displayed
  2704.       # Its corresponding method's created under ECATB_Pool_Window
  2705.       # It must return an array of strings
  2706.       # The 1st and 2nd element of the array is displayed when the atb pool
  2707.       # mode's on and off respectively
  2708.       # Example: To set the troop atb pool window text to be displayed when the
  2709.       #          atb pool mode's on and off as "Troop ATB Pool Mode On" and
  2710.       #          "Troop ATB Pool Mode Off" respectively, set this as
  2711.       #          %Q(["Troop ATB Pool Mode On", "Troop ATB Pool Mode Off"])
  2712.       :ecatb_pool_troop_enemy_text => %Q(["Troop ATB", "Enemy ATB"]),
  2713.  
  2714.       # Sets the atb pool window text color
  2715.       # Its corresponding method's created under ECATB_Pool_Window
  2716.       # It must return a color
  2717.       # Example: To set the atb pool window text color's rgba values as r, g, b
  2718.       #          and a, set this as %Q(Color.new(r, g, b, a))
  2719.       :ecatb_pool_text_color => %Q(Colour.text_colour(0)),
  2720.  
  2721.       # Sets the atb pool window text size
  2722.       # Its corresponding method's created under ECATB_Pool_Window
  2723.       # It must return a positive real number and should return a natural number
  2724.       # Example: To set the atb pool window text size as the value of variable
  2725.       #          with id x, set this as %Q($game_variables[x])
  2726.       :ecatb_pool_text_size => %Q(16),
  2727.  
  2728.       # Sets the atb party pool window text x and y positions
  2729.       # Its corresponding method's created under ECATB_Pool_Window
  2730.       # It must return an array of real numbers and should return an array of
  2731.       # integers
  2732.       # Example: To set the atb party pool window text x and y positions as the
  2733.       #          value of variables with id a and b respectively, set this as
  2734.       #          %Q([$game_variables[a], $game_variables[b]])
  2735.       :ecatb_pool_party_text_xy => %Q([0, 8]),
  2736.  
  2737.       # Sets the atb troop pool window text x and y positions
  2738.       # Its corresponding method's created under ECATB_Pool_Window
  2739.       # It must return an array of real numbers and should return an array of
  2740.       # integers
  2741.       # Example: To set the atb troop pool window text x and y positions as the
  2742.       #          value of variables with id a and b respectively, set this as
  2743.       #          %Q([$game_variables[a], $game_variables[b]])
  2744.       :ecatb_pool_troop_text_xy => %Q([0, -8])
  2745.  
  2746.     }
  2747.  
  2748.   #----------------------------------------------------------------------------|
  2749.   #  * SE                                                                      |
  2750.   #    Setups configurations of the se features                                |
  2751.   #----------------------------------------------------------------------------|
  2752.  
  2753.     #--------------------------------------------------------------------------|
  2754.     #  SE Ready Act Notetag Values                                             |
  2755.     #  - Setups serax used by <ecatb se ready act: serax> notetags             |
  2756.     #--------------------------------------------------------------------------|
  2757.     # serax are read at:
  2758.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2759.     #    - next @ecatb_notes[:se] = $1.downcase.to_sym in load_ecatb_notes
  2760.     # serax are used at:
  2761.     # 1. Game_BattlerBase
  2762.     #    - @ecatb_notes[note] = ecatb.send(n, self) in set_ecatb_notes
  2763.     # serax are strings of names of methods under DoubleX_RMVXA::ECATB
  2764.     # serax names can only use alphanumeric characters and can't use uppercase
  2765.     # letters
  2766.     # battler is the battler calling the serax
  2767.     # The below serax are examples added to help you set your serax
  2768.     # You can freely use, rewrite and/or delete these examples
  2769.  
  2770.     # Sets the battler ready se as se with name "name", volume volume and pitch
  2771.     # pitch
  2772.     def self.sera1(battler)
  2773.       RPG::SE.new("file", volume, pitch)
  2774.     end
  2775.  
  2776.     # Disables the use of the battler ready se
  2777.     def self.sera2(battler)
  2778.       nil
  2779.     end
  2780.  
  2781.     # Adds new serax here
  2782.    
  2783.  
  2784.     #--------------------------------------------------------------------------|
  2785.     #  SE Configurations                                                       |
  2786.     #  - Setups configurations of the se features                              |
  2787.     #  - The value of each configuration is the string of the content of its   |
  2788.     #    corresponding method                                                  |
  2789.     #--------------------------------------------------------------------------|
  2790.  
  2791.     SE = {
  2792.  
  2793.       # Sets the se to be played when a battler becomes able to act
  2794.       # It'll be used only if no corresponding color notetags are used
  2795.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2796.       # Example: To set the se to be played when a battler becomes able to act
  2797.       #          as se with name "name", volume volume and pitch pitch, set this
  2798.       #          as %Q(RPG::SE.new("name", volume, pitch))
  2799.       :ecatb_se_ready_act => %Q(nil),
  2800.  
  2801.       # Sets the priority of the ecatb se ready act notetags to be used
  2802.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2803.       # It must return an array with elements being either :states, :enemies,
  2804.       # :armors, :weapons, :classes or :actors
  2805.       # Example: To set states to have a higher priority than that of actors,
  2806.       #          set this as %Q([:states, :actors])
  2807.       :ecatb_se_ready_act_ord => %Q([:states, :enemies, :armors, :weapons,
  2808.                                      :classes, :actors])
  2809.  
  2810.     }
  2811.  
  2812.   #----------------------------------------------------------------------------|
  2813.   #  * (v0.02a+)Speed                                                          |
  2814.   #    Setups configurations and notetag values of the speed features          |
  2815.   #----------------------------------------------------------------------------|
  2816.  
  2817.     #--------------------------------------------------------------------------|
  2818.     #  Speed Reduce Notetag Values                                             |
  2819.     #  - Setups srx used by <ecatb speed reduce: srx> notetags                 |
  2820.     #--------------------------------------------------------------------------|
  2821.     # srx are read at:
  2822.     # 1. RPG::Actor, RPG::Class, RPG::EquipItem, RPG::Enemy, RPG::State
  2823.     #    - next @ecatb_notes[:speed] << $1.downcase.to_sym in load_ecatb_notes
  2824.     # srx are used at:
  2825.     # 1. Game_BattlerBase
  2826.     #    - ecatb.send(note, self) in set_ecatb_speed_reduce
  2827.     # srx are strings of names of methods under DoubleX_RMVXA::ECATB
  2828.     # srx must return a non-negative integer
  2829.     # srx names can only use alphanumeric characters and can't use uppercase
  2830.     # letters
  2831.     # battler is the battler calling the srx
  2832.     # The below srx are examples to help you set your srx
  2833.     # You can freely use, rewrite and/or delete these examples
  2834.  
  2835.     # Sets the action input speed reduction as x frames
  2836.     def self.sr1(battler)
  2837.       battler.instance_exec { @last_ecatb_speed_reduce = x }
  2838.     end
  2839.  
  2840.     # Sets the action input speed reduction as the number of frames being the
  2841.     # value of variable with id x
  2842.     def self.sr2(battler)
  2843.       battler.instance_exec { @last_ecatb_speed_reduce = $game_variables[x] }
  2844.     end
  2845.  
  2846.     # Adds the action input speed reduction by x frames
  2847.     def self.sr3(battler)
  2848.       battler.instance_exec { @last_ecatb_speed_reduce += x }
  2849.     end
  2850.  
  2851.     # Adds new srx here
  2852.    
  2853.  
  2854.     #--------------------------------------------------------------------------|
  2855.     #  Speed Configurations                                                    |
  2856.     #  - Setups configurations of the speed features                           |
  2857.     #  - The value of each configuration is the string of the content of its   |
  2858.     #    corresponding method                                                  |
  2859.     #--------------------------------------------------------------------------|
  2860.  
  2861.     SPEED = {
  2862.  
  2863.       # Sets the action input speed reduction for enemies and/or actors with
  2864.       # autobattle and/or confusion
  2865.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2866.       # It must return a non-negative integer
  2867.       # Example: To set the action input speed reduction for enemies and/or
  2868.       #          actors with autobattle and/or confusion as the value of
  2869.       #          variable with id x, set this as
  2870.       #          %Q(@last_ecatb_speed_reduce = $game_variables[x])
  2871.       :ecatb_speed_reduce => %Q(@last_ecatb_speed_reduce = 0),
  2872.  
  2873.       # Sets the priority of the ecatb speed reduce notetags to be used
  2874.       # Its corresponding method's created under Game_Actor and Game_Enemy
  2875.       # It must return an array with elements being either :states, :enemies,
  2876.       # :armors, :weapons, :classes or :actors
  2877.       # Example: To set actors to have a higher priority than that of states,
  2878.       #          set this as %Q([:actors, :states])
  2879.       :ecatb_speed_reduce_ord => %Q([:actors, :classes, :weapons, :armors,
  2880.                                      :enemies, :states])
  2881.  
  2882.     }
  2883.  
  2884.   #----------------------------------------------------------------------------|
  2885.   #  * Unison                                                                  |
  2886.   #    Setups configurations of the unison features                            |
  2887.   #----------------------------------------------------------------------------|
  2888.  
  2889.     #--------------------------------------------------------------------------|
  2890.     #  Unison Actor Notetag Values                                             |
  2891.     #  - Setups uax used by <ecatb unison actor: uax> notetags                 |
  2892.     #--------------------------------------------------------------------------|
  2893.     # uax are read at:
  2894.     # 1. RPG::UsableItem
  2895.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2896.     # uax are used at:
  2897.     # 1. Game_BattlerBase
  2898.     #    - actors = ecatb.send(item.ecatb_unison_actor, self).collect!(
  2899.     #      &ecatb::BLOCKS[:usable?]) in usable?
  2900.     # 2. Game_Actor
  2901.     #    - @ecatb_unison_actors = ecatb.send(
  2902.     #      @last_ecatb_item.ecatb_unison_actor, self) in confirm_ecatb_item
  2903.     # 3. Window_ItemList
  2904.     #    - return battler.usable?(item) if (ecatb = DoubleX_RMVXA::ECATB).send(
  2905.     #      item.ecatb_act_cost, battler) > 1 || ecatb.send(
  2906.     #      item.ecatb_unison_actor, battler).size > 1 in enable?
  2907.     # 4. Scene_Battle
  2908.     #    - actors = ecatb.send($data_skills[actor.attack_skill_id].
  2909.     #      ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?]) in
  2910.     #      command_attack
  2911.     #    - actors = ecatb.send($data_skills[actor.guard_skill_id].
  2912.     #      ecatb_unison_actor, actor).collect!(&ecatb::BLOCKS[:usable?]) in
  2913.     #      command_guard
  2914.     #    - actors = ecatb.send(window.item.ecatb_unison_actor,
  2915.     #      BattleManager.actor) in on_ecatb_unison_item_ok?
  2916.     #    - actors = ecatb.send(actor.input.item.ecatb_unison_actor, actor) in
  2917.     #      on_ecatb_unison?
  2918.     # uax are strings of names of methods under DoubleX_RMVXA::ECATB
  2919.     # uax shouldn't return random values
  2920.     # uax must return an array of actor ids and the array must have more
  2921.     # than 1 actor ids
  2922.     # uax names can only use alphanumeric characters and can't use uppercase
  2923.     # letters
  2924.     # battler is the battler calling the uax
  2925.     # The below uax are examples added to help you set your uax
  2926.     # You can freely use, rewrite and/or delete these examples
  2927.  
  2928.     # Sets the unison actors as those with id x, y and z respectively
  2929.     def self.ua1(battler)
  2930.       [x, y, z]
  2931.     end
  2932.  
  2933.     # Adds new uax here
  2934.    
  2935.  
  2936.     # Don't edit this unless you understand what it does and how it works
  2937.     def self.ecatb_unison_actor(battler)
  2938.       []
  2939.     end
  2940.  
  2941.     #--------------------------------------------------------------------------|
  2942.     #  Unison Charge Rule Notetag Values                                       |
  2943.     #  - Setups ucrx used by <ecatb unison charge rule: ucrx> notetags         |
  2944.     #--------------------------------------------------------------------------|
  2945.     # ucrx are read at:
  2946.     # 1. RPG::UsableItem
  2947.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2948.     # ucrx are used at:
  2949.     # 1. Game_Actor
  2950.     #    - @ecatb_unison_rule[:charge] = ecatb.send(
  2951.     #      @last_ecatb_item.ecatb_unison_charge_rule, self) in
  2952.     #      confirm_ecatb_item
  2953.     # ucrx are strings of names of methods under DoubleX_RMVXA::ECATB
  2954.     # ucrx must return a symbol
  2955.     # You must implement the rule in ecatb_unison_rules
  2956.     # ucrx names can only use alphanumeric characters and can't use uppercase
  2957.     # letters
  2958.     # battler is the battler calling the ucrx
  2959.     # The below ucrx are examples added to help you set your ucrx
  2960.     # You can freely use, rewrite and/or delete these examples
  2961.  
  2962.     # Sets the unison charge rule as returning the maximum
  2963.     def self.ucr1(battler)
  2964.       :max
  2965.     end
  2966.  
  2967.     # Adds new ucrx here
  2968.    
  2969.  
  2970.     # Sets the default unison charge rule
  2971.     # It'll be used for def only if it's no ucrx to use
  2972.     # battler is the battler calling ecatb_unison_charge_rule
  2973.     # Example: To set the default unison charge rule as returning the minimum,
  2974.     # set this as %Q(:min)
  2975.     def self.ecatb_unison_charge_rule(battler)
  2976.       :avg
  2977.     end
  2978.  
  2979.     #--------------------------------------------------------------------------|
  2980.     #  Unison Cooldown Rule Notetag Values                                     |
  2981.     #  - Setups ucdrx used by <ecatb unison cooldown rule: ucdrx> notetags     |
  2982.     #--------------------------------------------------------------------------|
  2983.     # ucdrx are read at:
  2984.     # 1. RPG::UsableItem
  2985.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  2986.     # ucdrx are used at:
  2987.     # 1. Game_Actor
  2988.     #    - @ecatb_unison_rule[:cooldown] = ecatb.send(
  2989.     #      @last_ecatb_item.ecatb_unison_cooldown_rule, self) in
  2990.     #      confirm_ecatb_item
  2991.     # ucdrx are strings of names of methods under DoubleX_RMVXA::ECATB
  2992.     # ucdrx must return a symbol
  2993.     # You must implement the rule in ecatb_unison_rules
  2994.     # ucdrx names can only use alphanumeric characters and can't use uppercase
  2995.     # letters
  2996.     # battler is the battler calling the ucdrx
  2997.     # The below UCDRX are examples added to help you set your ucdrx
  2998.     # You can freely use, rewrite and/or delete these examples
  2999.  
  3000.     # Sets the unison cooldown rule as returning the maximum
  3001.     def self.ucdr1(battler)
  3002.       :max
  3003.     end
  3004.  
  3005.     # Adds new ucdrx here
  3006.    
  3007.  
  3008.     # Sets the default unison charge rule
  3009.     # It'll be used for def only if it's no ucdrx to use
  3010.     # battler is the battler calling ecatb_unison_cooldown_rule
  3011.     # Example: To set the default unison cooldown rule as returning the minimum,
  3012.     # set this as %Q(:min)
  3013.     def self.ecatb_unison_cooldown_rule(battler)
  3014.       :avg
  3015.     end
  3016.  
  3017.     #--------------------------------------------------------------------------|
  3018.     #  Unison Actor Method Notetag Values                                      |
  3019.     #  - Setups uadx used by <ecatb unison actor def: uadx> notetags           |
  3020.     #--------------------------------------------------------------------------|
  3021.     # uadx are read at:
  3022.     # 1. RPG::UsableItem
  3023.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  3024.     # uadx are used at methods included in UNISON_DEFS
  3025.     # uadx are strings of names of methods under DoubleX_RMVXA::ECATB
  3026.     # uadx must return an array of actor ids
  3027.     # uadx names can only use alphanumeric characters and can't use uppercase
  3028.     # letters
  3029.     # battler is the battler calling the uadx
  3030.     # The below uadx are examples added to help you set your uadx
  3031.     # You can freely use, rewrite and/or delete these examples
  3032.  
  3033.     # Sets the def used to be those of actors with id x, y and z respectively
  3034.     def self.uad1(battler)
  3035.       [x, y, z]
  3036.     end
  3037.  
  3038.     # Adds new uadx here
  3039.    
  3040.  
  3041.     # Don't edit this unless you understand what it does and how it works
  3042.     def self.ecatb_unison_actor_def(battler)
  3043.       []
  3044.     end
  3045.  
  3046.     #--------------------------------------------------------------------------|
  3047.     #  Unison Method Rule Notetag Values                                       |
  3048.     #  - Setups udrx used by <ecatb unison def rule: udrx> notetags            |
  3049.     #--------------------------------------------------------------------------|
  3050.     # udrx are read at:
  3051.     # 1. RPG::UsableItem
  3052.     #    - send(:"#{note}=", send(:"#{note}") || val) in load_ecatb_notes
  3053.     # udrx are used at methods included in UNISON_DEFS
  3054.     # udrx are strings of names of methods under DoubleX_RMVXA::ECATB
  3055.     # udrx must return a symbol
  3056.     # You must implement the rule in ecatb_unison_rules
  3057.     # udrx names can only use alphanumeric characters and can't use uppercase
  3058.     # letters
  3059.     # battler is the battler calling the udrx
  3060.     # The below udrx are examples added to help you set your udrx
  3061.     # You can freely use, rewrite and/or delete these examples
  3062.  
  3063.     # Sets the unison method rule as returning the maximum
  3064.     UDR1 = %Q(:max)
  3065.     def self.udr1(battler)
  3066.       :max
  3067.     end
  3068.  
  3069.     # Adds new udrx here
  3070.    
  3071.  
  3072.     # Sets the default unison method rule
  3073.     # It'll be used for def only if it's no udrx to use
  3074.     # battler is the battler calling ecatb_unison_def_rule
  3075.     # Example: To set the default unison mthod rule as returning the minimum,
  3076.     # set this as %Q(:min)
  3077.     def self.ecatb_unison_def_rule(battler)
  3078.       :avg
  3079.     end
  3080.  
  3081.     #--------------------------------------------------------------------------|
  3082.     #  Unison Configurations                                                   |
  3083.     #  - Setups configurations of the unison features                          |
  3084.     #  - The value of each configuration is the string of the content of its   |
  3085.     #    corresponding method                                                  |
  3086.     #--------------------------------------------------------------------------|
  3087.  
  3088.     # Sets the battler methods to use the unison method rules
  3089.     # It can't be chnaged once set
  3090.     # Its keys must be the battler method name symbols
  3091.     # Methods with name method_name will be aliased to method_name_ecatb
  3092.     UNISON_DEFS = {
  3093.  
  3094.       # General Form:
  3095.       # [:method_class, :super_class] => [
  3096.       #   :method_name
  3097.       # ]
  3098.  
  3099.       [:Game_BattlerBase] => [
  3100.         :hp,
  3101.         :mp,
  3102.         :tp,
  3103.         :mhp,
  3104.         :mmp,
  3105.         :atk,
  3106.         :def,
  3107.         :mat,
  3108.         :mdf,
  3109.         :agi
  3110.         # Adds new methods here
  3111.        
  3112.       ],
  3113.  
  3114.       [:Game_Actor, :Game_Battler] => [
  3115.         :level
  3116.         # Adds new methods here
  3117.        
  3118.       ]
  3119.  
  3120.       # Adds new classes here
  3121.      
  3122.  
  3123.     }
  3124.  
  3125.     UNISON = {
  3126.  
  3127.       # Sets if all battlers using the unison skill/item are shown in the
  3128.       # battle log window
  3129.       # Its corresponding method's created under Game_Actor and Game_Enemy
  3130.       # Example: To show all battlers using the unison skill/item if switch with
  3131.       #          id x is on, set this as %Q($game_switches[x])
  3132.       :show_ecatb_unison_battlers => %Q(true),
  3133.  
  3134.       # Implements the unison method rules
  3135.       # The unison method of all unison battlers can be referneced by vals
  3136.       # The unison method rule can be referenced by rule
  3137.       # Its corresponding method's created under Game_Actor and Game_Enemy
  3138.       # It must return a real number
  3139.       :ecatb_unison_rules => %Q(
  3140.         if rule == :min
  3141.           vals.min
  3142.         elsif rule == :avg
  3143.           vals.inject(:+) / vals.size
  3144.         elsif rule == :max
  3145.           vals.max
  3146.         else
  3147.           0
  3148.         end
  3149.       )
  3150.  
  3151.     }
  3152.  
  3153. #==============================================================================|
  3154.  
  3155. #==============================================================================|
  3156. #  ** Script Implementations                                                   |
  3157. #     You need not edit this part as it's about how this script works          |
  3158. #     You need to understand the related parts of a configuration/notetag value|
  3159. #     locally to fully utilize that configuration/notetag value                |
  3160. #------------------------------------------------------------------------------|
  3161. #  * Script Support Info:                                                      |
  3162. #    1. Prerequisites                                                          |
  3163. #       - Thorough comprehension of how this script works on the user level    |
  3164. #       - Thorough comprehension of how Yanfly Engine Ace - Ace Battle Engine  |
  3165. #         works                                                                |
  3166. #       - Advanced RGSS3 scripting proficiency to fully comprehend this script |
  3167. #    2. Method documentation                                                   |
  3168. #       - The 1st part describes why this method's rewritten/aliased for       |
  3169. #         rewritten/aliased methods or what the method does for new methods    |
  3170. #       - The 2nd part describes what the arguments of the method are          |
  3171. #       - The 3rd part informs which version rewritten, aliased or created this|
  3172. #         method                                                               |
  3173. #       - The 4th part informs whether the method's rewritten or new           |
  3174. #       - The 5th part informs whether the method's a real or potential hotspot|
  3175. #       - The 6th part describes how this method works for new methods only,   |
  3176. #         and describes the parts added, removed or rewritten for rewritten or |
  3177. #         aliased methods only                                                 |
  3178. #       Example:                                                               |
  3179. # #--------------------------------------------------------------------------| |
  3180. # #  Why rewrite/alias/What this method does                                 | |
  3181. # #--------------------------------------------------------------------------| |
  3182. # # *argv: What these variables are                                            |
  3183. # # &argb: What this block is                                                  |
  3184. # def def_name(*argv, &argb) # Version X+; Rewrite/New; Hotspot                |
  3185. #   # Added/Removed/Rewritten to do something/How this method works            |
  3186. #   def_name_code                                                              |
  3187. #   #                                                                          |
  3188. # end # def_name                                                               |
  3189. #------------------------------------------------------------------------------|
  3190.  
  3191.     # Stores all types of configurations
  3192.     CONFIG = [CORE, ACTION, BAR, CANCEL, CHARGE, CLOCK, COOLDOWN, COUNTDOWN,
  3193.               FORCE, HOTKEY, ORDER, POOL, SE, SPEED, UNISON]
  3194.  
  3195.     # Stores all configurations having methods in BattleManager
  3196.     # General form: :config => [
  3197.     #                 %Q(arguments),
  3198.     #                 %Q(validation check),
  3199.     #                 %Q(default value)
  3200.     #               ]
  3201.     BATTLEMANAGER = {
  3202.       :ecatb_esc_init_cond => [
  3203.         %Q(),
  3204.         %Q(true),
  3205.         %Q((list = ecatb_input_list).size >= $game_party.battle_members.size &&
  3206.            list.all?(&DoubleX_RMVXA::ECATB::EIC1))
  3207.       ],
  3208.       :ecatb_esc_charge_cond => [
  3209.         %Q(),
  3210.         %Q(true),
  3211.         %Q($game_party.battle_members.all?(&DoubleX_RMVXA::ECATB::ECC1))
  3212.       ],
  3213.       :ecatb_esc_exec_cond => [
  3214.         %Q(),
  3215.         %Q(true),
  3216.         %Q($game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EEC1))
  3217.       ],
  3218.       :ecatb_esc_suc_cond => [
  3219.         %Q(),
  3220.         %Q(true),
  3221.         %Q((@preemptive || rand < @escape_ratio) &&
  3222.            $game_party.alive_members.all?(&DoubleX_RMVXA::ECATB::EIC1))
  3223.       ],
  3224.       :ecatb_base_fill_t => [
  3225.         %Q(),
  3226.         %Q(val.is_a?(Numeric) && val >= 0),
  3227.         %Q(10)
  3228.       ],
  3229.       :ecatb_ctb => [
  3230.         %Q(),
  3231.         %Q(true),
  3232.         %Q(false),
  3233.       ],
  3234.       :ecatb_battlers_def_sum => [
  3235.         %Q(),
  3236.         %Q(val.is_a?(Array) &&
  3237.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_sym])),
  3238.         %Q([:agi])
  3239.       ],
  3240.       :ecatb_def_sum_battlers => [
  3241.         %Q(),
  3242.         %Q(val.is_a?(Array) &&
  3243.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_game_battler])),
  3244.         %Q($game_party.alive_members + $game_troop.alive_members)
  3245.       ],
  3246.       :update_ecatb_battlers_def_sums => [
  3247.         %Q(),
  3248.         %Q(true),
  3249.         %Q(ecatb_def_sum_battlers.any?(
  3250.            &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_refresh]))
  3251.       ],
  3252.       :actor_sprite_ecatb_bar => [
  3253.         %Q(),
  3254.         %Q(true),
  3255.         %Q(false)
  3256.       ],
  3257.     }
  3258.  
  3259.     # Stores all configurations having methods in Game_Battler
  3260.     # General form: :config => [
  3261.     #                 %Q(arguments),
  3262.     #                 %Q(validation check),
  3263.     #                 %Q(default value)
  3264.     #               ]
  3265.     GAME_BATTLER = {
  3266.       :ecatb_rate_ord => [
  3267.         %Q(),
  3268.         %Q(val.is_a?(Array) &&
  3269.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3270.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3271.       ],
  3272.       :normal_actor_1st_ecatb_val => [
  3273.         %Q(),
  3274.         %Q(val.is_a?(Numeric) && val >= 0),
  3275.         %Q(0.0)
  3276.       ],
  3277.       :normal_enemy_1st_ecatb_val => [
  3278.         %Q(),
  3279.         %Q(val.is_a?(Numeric) && val >= 0),
  3280.         %Q(0.0)
  3281.       ],
  3282.       :preemptive_actor_1st_ecatb_val => [
  3283.         %Q(),
  3284.         %Q(val.is_a?(Numeric) && val >= 0),
  3285.         %Q(100.0)
  3286.       ],
  3287.       :preemptive_enemy_1st_ecatb_val => [
  3288.         %Q(),
  3289.         %Q(val.is_a?(Numeric) && val >= 0),
  3290.         %Q(0.0)
  3291.       ],
  3292.       :surprise_actor_1st_ecatb_val => [
  3293.         %Q(),
  3294.         %Q(val.is_a?(Numeric) && val >= 0),
  3295.         %Q(0.0)
  3296.       ],
  3297.       :surprise_enemy_1st_ecatb_val => [
  3298.         %Q(),
  3299.         %Q(val.is_a?(Numeric) && val >= 0),
  3300.         %Q(100.0)
  3301.       ],
  3302.       :ecatb_start_val_ord => [
  3303.         %Q(),
  3304.         %Q(val.is_a?(Array) &&
  3305.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3306.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3307.       ],
  3308.       :pre_ecatb_input_act => [
  3309.         %Q(),
  3310.         %Q(true),
  3311.         %Q()
  3312.       ],
  3313.       :post_ecatb_input_act => [
  3314.         %Q(),
  3315.         %Q(true),
  3316.         %Q()
  3317.       ],
  3318.       :pre_ecatb_reset => [
  3319.         %Q(),
  3320.         %Q(true),
  3321.         %Q()
  3322.       ],
  3323.       :post_ecatb_reset => [
  3324.         %Q(),
  3325.         %Q(true),
  3326.         %Q()
  3327.       ],
  3328.       :ecatb_bar_colors => [
  3329.         %Q(),
  3330.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3331.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3332.       ],
  3333.       :ecatb_bar_color_ord => [
  3334.         %Q(),
  3335.         %Q(val.is_a?(Array) &&
  3336.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3337.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3338.       ],
  3339.       :gradual_ecatb_action_gain => [
  3340.         %Q(),
  3341.         %Q(true),
  3342.         %Q(false),
  3343.       ],
  3344.       :gradual_ecatb_action_gain_ord => [
  3345.         %Q(),
  3346.         %Q(val.is_a?(Array) &&
  3347.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3348.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3349.       ],
  3350.       :ecatb_bar_multilayer => [
  3351.         %Q(),
  3352.         %Q(true),
  3353.         %Q(true)
  3354.       ],
  3355.       :ecatb_charge_bar_colors => [
  3356.         %Q(),
  3357.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3358.         %Q([Colour.text_colour(30), Colour.text_colour(31)])
  3359.       ],
  3360.       :ecatb_charge_bar_color_ord => [
  3361.         %Q(),
  3362.         %Q(val.is_a?(Array) &&
  3363.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3364.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3365.       ],
  3366.       :ecatb_cooldown_bar_colors => [
  3367.         %Q(),
  3368.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3369.         %Q([Colour.text_colour(19), Colour.text_colour(26)])
  3370.       ],
  3371.       :ecatb_cooldown_bar_color_ord => [
  3372.         %Q(),
  3373.         %Q(val.is_a?(Array) &&
  3374.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3375.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3376.       ],
  3377.       :ecatb_cooldown_finish => [
  3378.         %Q(),
  3379.         %Q(true),
  3380.         %Q()
  3381.       ],
  3382.       :ecatb_countdown_min => [
  3383.         %Q(),
  3384.         %Q(val.is_a?(Integer) && val >= 0),
  3385.         %Q(Graphics.frame_rate)
  3386.       ],
  3387.       :ecatb_order_battler_icon => [
  3388.         %Q(),
  3389.         %Q(val.is_a?(Array) && val[0].is_a?(Bitmap) && val[1].is_a?(Rect)),
  3390.         %Q(
  3391.        [Cache.system("Iconset"), Rect.new(121 % 16 * 24, 121 / 16 * 24, 24, 24)]
  3392.         )
  3393.       ],
  3394.       :ecatb_order_battler_icon_ord => [
  3395.         %Q(),
  3396.         %Q(val.is_a?(Array) &&
  3397.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3398.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3399.       ],
  3400.       :ecatb_order_battler_opacity => [
  3401.         %Q(),
  3402.         %Q(val.is_a?(Numeric) && val >= 0),
  3403.         %Q(255)
  3404.       ],
  3405.       :ecatb_order_battler_opacity_ord => [
  3406.         %Q(),
  3407.         %Q(val.is_a?(Array) &&
  3408.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3409.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3410.       ],
  3411.       :ecatb_order_battler_scale => [
  3412.         %Q(),
  3413.         %Q(val.is_a?(Numeric) && val >= 0),
  3414.         %Q(0.5)
  3415.       ],
  3416.       :ecatb_order_battler_scale_ord => [
  3417.         %Q(),
  3418.         %Q(val.is_a?(Array) &&
  3419.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3420.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3421.       ],
  3422.       :ecatb_order_battler_z => [
  3423.         %Q(),
  3424.         %Q(val.is_a?(Numeric) && val >= 0),
  3425.         %Q(500)
  3426.       ],
  3427.       :ecatb_order_battler_z_ord => [
  3428.         %Q(),
  3429.         %Q(val.is_a?(Array) &&
  3430.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3431.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3432.       ],
  3433.       :ecatb_order_battler_icon_x => [
  3434.         %Q(),
  3435.         %Q(val.is_a?(Numeric)),
  3436.         %Q(4)
  3437.       ],
  3438.       :ecatb_se_ready_act => [
  3439.         %Q(),
  3440.         %Q(true),
  3441.         %Q(nil)
  3442.       ],
  3443.       :ecatb_se_ready_act_ord => [
  3444.         %Q(),
  3445.         %Q(val.is_a?(Array) &&
  3446.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3447.         %Q([:states, :enemies, :armors, :weapons, :classes, :actors])
  3448.       ],
  3449.       :ecatb_speed_reduce => [
  3450.         %Q(),
  3451.         %Q(val.is_a?(Numeric) && val >= 0),
  3452.         %Q(0)
  3453.       ],
  3454.       :ecatb_speed_reduce_ord => [
  3455.         %Q(),
  3456.         %Q(val.is_a?(Array) &&
  3457.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_ord])),
  3458.         %Q([:actors, :classes, :weapons, :armors, :enemies, :states])
  3459.       ],
  3460.       :show_ecatb_unison_battlers => [
  3461.         %Q(),
  3462.         %Q(true),
  3463.         %Q(true)
  3464.       ],
  3465.       :ecatb_unison_rules => [
  3466.         %Q((vals, rule)),
  3467.         %Q(val.is_a?(Numeric)),
  3468.         %Q(
  3469.     if rule == :min
  3470.       vals.min
  3471.     elsif rule == :avg
  3472.       vals.inject(:+) / vals.size
  3473.     elsif rule == :max
  3474.       vals.max
  3475.     end
  3476.         )
  3477.       ]
  3478.     }
  3479.  
  3480.     # Stores all configurations having methods in Game_Actor
  3481.     # General form: :config => [
  3482.     #                 %Q(arguments),
  3483.     #                 %Q(validation check),
  3484.     #                 %Q(default value)
  3485.     #               ]
  3486.     GAME_ACTOR = GAME_BATTLER.merge({
  3487.       :ecatb_esc_act_cost => [
  3488.         %Q(),
  3489.         %Q(val.is_a?(Numeric)),
  3490.         %Q(1)
  3491.       ],
  3492.       :ecatb_esc_reset_val => [
  3493.         %Q(),
  3494.         %Q(val.is_a?(Numeric)),
  3495.         %Q(0.0)
  3496.       ],
  3497.       :esc_ecatb_charge_rate => [
  3498.         %Q((charge)),
  3499.         %Q(val.is_a?(Numeric) && val >= 0),
  3500.         %Q(100.0)
  3501.       ],
  3502.       :esc_ecatb_cooldown_rate => [
  3503.         %Q((cooldown)),
  3504.         %Q(val.is_a?(Numeric) && val >= 0),
  3505.         %Q(100.0)
  3506.       ],
  3507.       :ecatb_order_actor_icon_y => [
  3508.         %Q(),
  3509.         %Q(val.is_a?(Numeric)),
  3510.         %Q(36)
  3511.       ]
  3512.     })
  3513.  
  3514.     # (v0.01a+)Stores all configurations having methods in Game_Enemy
  3515.     # General form: :config => [
  3516.     #                 %Q(arguments),
  3517.     #                 %Q(validation check),
  3518.     #                 %Q(default value)
  3519.     #               ]
  3520.     GAME_ENEMY = GAME_BATTLER.merge({
  3521.       :ecatb_order_enemy_icon_y => [
  3522.         %Q(),
  3523.         %Q(val.is_a?(Numeric)),
  3524.         %Q(8)
  3525.       ]
  3526.     })
  3527.  
  3528.     # Stores all configurations having methods in Game_Party and Game_Troop
  3529.     # General form: :config => [
  3530.     #                 %Q(arguments),
  3531.     #                 %Q(validation check),
  3532.     #                 %Q(default value)
  3533.     #               ]
  3534.     GAME_PARTY_TROOP = {
  3535.       :ecatb_pool_val => [
  3536.         %Q((vals)),
  3537.         %Q(val.is_a?(Numeric) && val >= 0),
  3538.         %Q(vals.empty? ? 0 : vals.inject(:+) / vals.size)
  3539.       ]
  3540.     }
  3541.  
  3542.     # Stores all configurations having methods in ECATB_Bar
  3543.     # General form: :config => [
  3544.     #                 %Q(arguments),
  3545.     #                 %Q(validation check),
  3546.     #                 %Q(default value)
  3547.     #               ]
  3548.     ECATB_BAR = {
  3549.       :ecatb_bar_ani => [
  3550.         %Q(),
  3551.         %Q(true),
  3552.         %Q(true)
  3553.       ],
  3554.       :ecatb_bar_ani_ox => [
  3555.         %Q(),
  3556.         %Q(val.is_a?(Numeric)),
  3557.         %Q(2)
  3558.       ],
  3559.       :ecatb_bar_wh => [
  3560.         %Q(),
  3561.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3562.            val[1].is_a?(Numeric) && val[1] >= 0),
  3563.         %Q([48, 12])
  3564.       ],
  3565.       :ecatb_bar_xy_offset => [
  3566.         %Q(),
  3567.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) &&val[1].is_a?(Numeric)),
  3568.         %Q([0, 0])
  3569.       ],
  3570.       :ecatb_bar_z => [
  3571.         %Q(),
  3572.         %Q(val.is_a?(Numeric) && val >= 0),
  3573.         %Q(0)
  3574.       ],
  3575.       :ecatb_bar_text => [
  3576.         %Q((percent, act)),
  3577.         %Q("val.is_a?(String)"),
  3578.         %Q(percent + "% " + act)
  3579.       ],
  3580.       :ecatb_bar_text_color => [
  3581.         %Q(),
  3582.         %Q(val.is_a?(Color)),
  3583.         %Q(Colour.text_colour(0))
  3584.       ],
  3585.       :ecatb_bar_text_size => [
  3586.         %Q(),
  3587.         %Q(val.is_a?(Numeric) && val >= 0),
  3588.         %Q(16)
  3589.       ],
  3590.       :ecatb_bar_text_xy_offset => [
  3591.         %Q(),
  3592.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3593.         %Q([-1, -1])
  3594.       ],
  3595.       :ecatb_bar_back_colors => [
  3596.         %Q(),
  3597.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3598.         %Q([Colour.text_colour(15), Colour.text_colour(15)])
  3599.       ]
  3600.     }
  3601.  
  3602.     # Stores all configurations having methods in ECATB_Clock_Bar
  3603.     # General form: :config => [
  3604.     #                 %Q(arguments),
  3605.     #                 %Q(validation check),
  3606.     #                 %Q(default value)
  3607.     #               ]
  3608.     ECATB_CLOCK_BAR = {
  3609.       :ecatb_clock_bar_colors => [
  3610.         %Q(),
  3611.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3612.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3613.       ],
  3614.       :ecatb_clock_bar_wh => [
  3615.         %Q(),
  3616.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3617.            val[1].is_a?(Numeric) && val[1] >= 0),
  3618.         %Q([112, 12])
  3619.       ],
  3620.       :ecatb_clock_bar_xy => [
  3621.         %Q(),
  3622.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3623.         %Q([8, 8])
  3624.       ]
  3625.     }
  3626.  
  3627.     # Stores all configurations having methods in Window_BattleStatus
  3628.     # General form: :config => [
  3629.     #                 %Q(arguments),
  3630.     #                 %Q(validation check),
  3631.     #                 %Q(default value)
  3632.     #               ]
  3633.     WINDOW_BATTLESTATUS = {
  3634.       :actor_ecatb_bar_text => [
  3635.         %Q((percent, act)),
  3636.         %Q(val.is_a?(String)),
  3637.         %Q(percent + "% " + act)
  3638.       ],
  3639.       :actor_ecatb_bar_word => [
  3640.         %Q(),
  3641.         %Q(val.is_a?(String)),
  3642.         %Q("AP")
  3643.       ],
  3644.       :actor_ecatb_bar_y_add => [
  3645.         %Q(),
  3646.         %Q(val.is_a?(Numeric)),
  3647.         %Q(12)
  3648.       ]
  3649.     }
  3650.  
  3651.     # Stores all configurations having methods in ECATB_Clock_Window
  3652.     # General form: :config => [
  3653.     #                 %Q(arguments),
  3654.     #                 %Q(validation check),
  3655.     #                 %Q(default value)
  3656.     #               ]
  3657.     ECATB_CLOCK_WINDOW = {
  3658.       :ecatb_clock_window_wh => [
  3659.         %Q(),
  3660.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3661.            val[1].is_a?(Numeric) && val[1] >= 0),
  3662.         %Q([128, 48])
  3663.       ],
  3664.       :ecatb_clock_window_xyz => [
  3665.         %Q(),
  3666.         %Q(val.is_a?(Array) &&
  3667.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3668.         %Q([0, 0, 0])
  3669.       ],
  3670.       :ecatb_clock_text => [
  3671.         %Q((cur_clock, max_clock, turn_count)),
  3672.         %Q(val.is_a?(String)),
  3673.         %Q(cur_clock.to_s + "/" + max_clock.to_s + " " + turn_count.to_s)
  3674.       ],
  3675.       :ecatb_clock_text_color => [
  3676.         %Q(),
  3677.         %Q(val.is_a?(Color)),
  3678.         %Q(Colour.text_colour(0))
  3679.       ],
  3680.       :ecatb_clock_text_size => [
  3681.         %Q(),
  3682.         %Q(val.is_a?(Numeric) && val >= 0),
  3683.         %Q(16)
  3684.       ],
  3685.       :ecatb_clock_text_xy => [
  3686.         %Q(),
  3687.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3688.         %Q([0, 4])
  3689.       ]
  3690.     }
  3691.  
  3692.     # Stores all configurations having methods in ECATB_Force_Window
  3693.     # General form: :config => [
  3694.     #                 %Q(arguments),
  3695.     #                 %Q(validation check),
  3696.     #                 %Q(default value)
  3697.     #               ]
  3698.     ECATB_FORCE_WINDOW = {
  3699.       :ecatb_force_window_wh => [
  3700.         %Q(),
  3701.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3702.            val[1].is_a?(Numeric) && val[1] >= 0),
  3703.         %Q([128, 40])
  3704.       ],
  3705.       :ecatb_force_window_xyz => [
  3706.         %Q(),
  3707.         %Q(val.is_a?(Array) &&
  3708.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3709.         %Q([0, 48, 0])
  3710.       ],
  3711.       :ecatb_force_nil_text => [
  3712.         %Q(),
  3713.         %Q(val.is_a?(String)),
  3714.         %Q("No Force ATB")
  3715.       ],
  3716.       :ecatb_force_run_text => [
  3717.         %Q(),
  3718.         %Q(val.is_a?(String)),
  3719.         %Q("ATB Force Run")
  3720.       ],
  3721.       :ecatb_force_stop_text => [
  3722.         %Q(),
  3723.         %Q(val.is_a?(String)),
  3724.         %Q("ATB Force Stop")
  3725.       ],
  3726.       :ecatb_force_text_color => [
  3727.         %Q(),
  3728.         %Q(val.is_a?(Color)),
  3729.         %Q(Colour.text_colour(0))
  3730.       ],
  3731.       :ecatb_force_text_size => [
  3732.         %Q(),
  3733.         %Q(val.is_a?(Numeric) && val >= 0),
  3734.         %Q(16)
  3735.       ],
  3736.       :ecatb_force_text_xy => [
  3737.         %Q(),
  3738.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3739.         %Q([0, 0])
  3740.       ]
  3741.     }
  3742.  
  3743.     # (v0.01a+)Stores all configurations having methods in ECATB_Order_Window
  3744.     # General form: :config => [
  3745.     #                 %Q(arguments),
  3746.     #                 %Q(validation check),
  3747.     #                 %Q(default value)
  3748.     #               ]
  3749.     ECATB_ORDER_WINDOW = {
  3750.       :ecatb_order_window_wh => [
  3751.         %Q(),
  3752.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3753.            val[1].is_a?(Numeric) && val[1] >= 0),
  3754.         %Q([128, 60])
  3755.       ],
  3756.       :ecatb_order_window_xyz => [
  3757.         %Q(),
  3758.         %Q(val.is_a?(Array) &&
  3759.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3760.         %Q([0, 88, 0])
  3761.       ],
  3762.       :ecatb_order_bar_colors => [
  3763.         %Q(),
  3764.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3765.         %Q([Colour.text_colour(7), Colour.text_colour(8)])
  3766.       ],
  3767.       :ecatb_order_charge_bar_colors => [
  3768.         %Q(),
  3769.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3770.         %Q([Colour.text_colour(30), Colour.text_colour(31)])
  3771.       ],
  3772.       :ecatb_order_cooldown_bar_colors => [
  3773.         %Q(),
  3774.         %Q(val.is_a?(Array) && val[0].is_a?(Color) && val[1].is_a?(Color)),
  3775.         %Q([Colour.text_colour(19), Colour.text_colour(26)])
  3776.       ],
  3777.       :ecatb_order_bar_wh => [
  3778.         %Q(),
  3779.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3780.            val[1].is_a?(Numeric) && val[1] >= 0),
  3781.         %Q([108, 12])
  3782.       ],
  3783.       :ecatb_order_bar_xy => [
  3784.         %Q(),
  3785.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3786.         %Q([0, 12])
  3787.       ],
  3788.       :ecatb_order_bar_text => [
  3789.         %Q(),
  3790.         %Q(val.is_a?(String)),
  3791.         %Q("ATB")
  3792.       ],
  3793.       :ecatb_order_charge_bar_text => [
  3794.         %Q(),
  3795.         %Q(val.is_a?(String)),
  3796.         %Q("Charge")
  3797.       ],
  3798.       :ecatb_order_cooldown_bar_text => [
  3799.         %Q(),
  3800.         %Q(val.is_a?(String)),
  3801.         %Q("Cool")
  3802.       ],
  3803.       :ecatb_order_text_color => [
  3804.         %Q(),
  3805.         %Q(val.is_a?(Color) || val.is_a?(Color)),
  3806.         %Q(Colour.text_colour(0))
  3807.       ],
  3808.       :ecatb_order_text_size => [
  3809.         %Q(),
  3810.         %Q(val.is_a?(Numeric) && val >= 0),
  3811.         %Q(12)
  3812.       ],
  3813.       :ecatb_order_text_xy => [
  3814.         %Q(),
  3815.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3816.         %Q([2, 14])
  3817.       ]
  3818.     }
  3819.  
  3820.     # Stores all configurations having methods in ECATB_Pool_Window
  3821.     # General form: :config => [
  3822.     #                 %Q(arguments),
  3823.     #                 %Q(validation check),
  3824.     #                 %Q(default value)
  3825.     #               ]
  3826.     ECATB_POOL_WINDOW = {
  3827.       :ecatb_pool_window_wh => [
  3828.         %Q(),
  3829.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3830.            val[1].is_a?(Numeric) && val[1] >= 0),
  3831.         %Q([128, 56])
  3832.       ],
  3833.       :ecatb_pool_window_xyz => [
  3834.         %Q(),
  3835.         %Q(val.is_a?(Array) &&
  3836.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_us_num])),
  3837.         %Q([0, 148, 0])
  3838.       ],
  3839.       :ecatb_pool_party_actor_text => [
  3840.         %Q(),
  3841.         %Q(val.is_a?(Array) && val[0].is_a?(String) && val[1].is_a?(String)),
  3842.         %Q(["Party ATB", "Actor ATB"])
  3843.       ],
  3844.       :ecatb_pool_troop_enemy_text => [
  3845.         %Q(),
  3846.         %Q(val.is_a?(Array) && val[0].is_a?(String) && val[1].is_a?(String)),
  3847.         %Q(["Troop ATB", "Enemy ATB"])
  3848.       ],
  3849.       :ecatb_pool_text_color => [
  3850.         %Q(),
  3851.         %Q(val.is_a?(Color)),
  3852.         %Q(Colour.text_colour(0))
  3853.       ],
  3854.       :ecatb_pool_text_size => [
  3855.         %Q(),
  3856.         %Q(val.is_a?(Numeric) && val >= 0),
  3857.         %Q(16)
  3858.       ],
  3859.       :ecatb_pool_party_text_xy => [
  3860.         %Q(),
  3861.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3862.         %Q([0, 8])
  3863.       ],
  3864.       :ecatb_pool_troop_text_xy => [
  3865.         %Q(),
  3866.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[1].is_a?(Numeric)),
  3867.         %Q([0, -8])
  3868.       ]
  3869.     }
  3870.  
  3871.     # Stores all configurations having methods in Scene_Battle
  3872.     # General form: :config => [
  3873.     #                 %Q(arguments),
  3874.     #                 %Q(validation check),
  3875.     #                 %Q(default value)
  3876.     #               ]
  3877.     SCENE_BATTLE = {
  3878.       :ecatb_wait_cond => [
  3879.         %Q(),
  3880.         %Q(true),
  3881.         %Q(#{WC1} || #{WC2} && (#{WC3} || #{WC4} || #{WC5} || #{WC6} ||
  3882.            #{WC7} || #{WC8} || #{WC9} || #{WC10} || #{WCC1}))
  3883.       ],
  3884.       :ecatb_turn_type => [
  3885.         %Q(),
  3886.         %Q(val == :tick || val == :act || val == :battler),
  3887.         %Q(:tick)
  3888.       ],
  3889.       :ecatb_tick_count => [
  3890.         %Q(),
  3891.         %Q(val.is_a?(Numeric) && val >= 0),
  3892.         %Q(10)
  3893.       ],
  3894.       :ecatb_after_act => [
  3895.         %Q(),
  3896.         %Q(val.is_a?(Numeric) && val >= 0),
  3897.         %Q(10)
  3898.       ],
  3899.       :ecatb_battler_scale => [
  3900.         %Q(),
  3901.         %Q(val.is_a?(Array) && val[0].is_a?(Numeric) && val[0] >= 0 &&
  3902.            (val[1] == :tick || val[1] == :act)),
  3903.         %Q([1, :tick])
  3904.       ],
  3905.       :ecatb_battler_count => [
  3906.         %Q(),
  3907.         %Q(val.is_a?(Numeric) && val >= 0),
  3908.         %Q($game_party.alive_members.size + $game_troop.alive_members.size)
  3909.       ],
  3910.       :ecatb_force_act_count => [
  3911.         %Q(),
  3912.         %Q(true),
  3913.         %Q(false)
  3914.       ],
  3915.       :pre_ecatb_update => [
  3916.         %Q(),
  3917.         %Q(true),
  3918.         %Q()
  3919.       ],
  3920.       :post_ecatb_update => [
  3921.         %Q(),
  3922.         %Q(true),
  3923.         %Q()
  3924.       ],
  3925.       :ecatb_cancel_key => [
  3926.         %Q(),
  3927.         %Q(val.is_a?(Symbol)),
  3928.         %Q(:SHIFT)
  3929.       ],
  3930.       :ecatb_cancel_text=> [
  3931.         %Q(),
  3932.         %Q(val.is_a?(String)),
  3933.         %Q("Select an actor without autobattle norconfusion to\ncancel " +
  3934.            "his/her/its partially charging skill/item.")
  3935.       ],
  3936.       :ecatb_force_run_key => [
  3937.         %Q(),
  3938.         %Q(val.is_a?(Symbol)),
  3939.         %Q(:CTRL)
  3940.       ],
  3941.       :ecatb_force_stop_key => [
  3942.         %Q(),
  3943.         %Q(val.is_a?(Symbol)),
  3944.         %Q(:ALT)
  3945.       ],
  3946.       :ecatb_battler_hotkeys => [
  3947.         %Q(),
  3948.         %Q(val.is_a?(Array) &&
  3949.            val.all?(&DoubleX_RMVXA::ECATB::BLOCKS[:check_sym])),
  3950.         %Q([:NUMPAD1, :NUMPAD2, :NUMPAD3, :NUMPAD4, :NUMPAD5, :NUMPAD6,
  3951.             :NUMPAD7, :NUMPAD8, :NUMPAD9, :NUMPAD0])
  3952.       ]
  3953.     }
  3954.  
  3955.     # Stores all iterator blocks
  3956.     # General form: :def_name => iterator_block
  3957.     BLOCKS = {
  3958.       :check_game_battler => -> v { v.is_a?(Game_Battler) },
  3959.       :check_ord => -> v { v == :states || v == :enemies || v == :armors ||
  3960.                            v == :weapons || v == :classes || v == :actors },
  3961.       :check_sym => -> v { v.is_a?(Symbol) },
  3962.       :check_us_num => -> v { v.is_a?(Numeric) && v >= 0 },
  3963.       :close_ecatb_windows => -> window { window.hide.deactivate.close },
  3964.       :clear_ecatb_blocks => -> mem { mem.clear_ecatb_blocks },
  3965.       :create_ecatb_defs => -> mem { mem.create_ecatb_defs },
  3966.       :dispose => -> obj { obj.dispose if obj && !obj.disposed? },
  3967.       :ecatb_ctb_break? => -> b { b.actor? && b.ecatb_inputable? ||
  3968.                                   b.exec_ecatb_act? },
  3969.       :ecatb_reset => -> mem { mem.ecatb_reset },
  3970.       :ecatb_input_list_1 => -> actor { actor.ecatb_inputable? },
  3971.       :ecatb_input_list_2 => -> actor { actor.index },
  3972.       :ecatb_on_turn_end => -> mem { mem.on_turn_end },
  3973.       :ecatb_refresh => -> battler { battler.ecatb_refresh },
  3974.       :ecatb_update_windows => -> w { w.hide.deactivate.close if w.active },
  3975.       :ecatb_updates => -> mem { mem.ecatb_updates },
  3976.       :init_ecatb_escape => -> mem { mem.init_ecatb_escape },
  3977.       :load_ecatb_notes => -> d { d.each(&BLOCKS[:load_ecatb_notes_each]) },
  3978.       :load_ecatb_notes_each => -> obj { obj.load_ecatb_notes if obj },
  3979.       :pay_ecatb_act_cost => -> actor { actor.pay_ecatb_act_cost },
  3980.       :pay_ecatb_esc_cost => -> mem { mem.pay_ecatb_esc_cost if mem.ecatb_esc },
  3981.       :refresh_ecatb_windows => ->  window { window.refresh if window.active },
  3982.       :reset_ecatb_blocks => -> mem { mem.reset_ecatb_blocks },
  3983.       :reset_ecatb_refresh => -> battler { battler.ecatb_refresh = false },
  3984.       :sort_screen_x => -> a, b { a.screen_x - b.screen_x },
  3985.       :update => -> obj { obj.update },
  3986.       :update_ecatb_pool => -> unit {
  3987.         next unless unit.ecatb_pool
  3988.         if (members = unit.alive_members).any?(&BLOCKS[:update_ecatb_pool_any])
  3989.           val = members.collect(&BLOCKS[:update_ecatb_pool_collect])
  3990.           max = val.max
  3991.           size = val.size
  3992.           val = unit.ecatb_pool_val(val)
  3993.           val = max if max - val <= Float::EPSILON * size * max
  3994.           members.each { |mem|
  3995.             mem.ecatb_val[:atb] = val
  3996.             mem.ecatb_val_change = false
  3997.           }
  3998.         end
  3999.         next unless members.all?(&BLOCKS[:update_ecatb_pool_all])
  4000.         act = 0
  4001.         members.each { |mem|
  4002.           next if mem.ecatb_act_times_cap
  4003.           mem.ecatb_act_times_cap = false
  4004.           act += mem.ecatb_act_times_add
  4005.           mem.ecatb_act_times -= mem.ecatb_act_times_add
  4006.           mem.ecatb_act_times_add = 0
  4007.         }
  4008.         members.each { |mem| mem.ecatb_act_times += act } if act > 0
  4009.       },
  4010.       :update_ecatb_pool_any => -> mem { mem.ecatb_val_change },
  4011.       :update_ecatb_pool_collect => -> mem { mem.ecatb_val[:atb] },
  4012.       :update_ecatb_pool_all => -> mem { mem.ecatb_act_times_add > 0 },
  4013.       :update_ecatb_unison => -> mem {
  4014.         next unless mem.ecatb_unison_invoker
  4015.         actors = mem.ecatb_unison_actors
  4016.         if actors.any?(&BLOCKS[:update_ecatb_unison_any_1])
  4017.           type = :charge
  4018.         elsif actors.any?(&BLOCKS[:update_ecatb_unison_any_2])
  4019.           actors &= $game_party.alive_members
  4020.           type = :cooldown
  4021.         else
  4022.           next
  4023.         end
  4024.         val = actors.collect { |actor| actor.ecatb_val[type] }
  4025.         val = mem.ecatb_unison_rules(val, mem.ecatb_unison_rule[type])
  4026.         actors.each { |actor| actor.ecatb_val[type] = val }
  4027.       },
  4028.       :update_ecatb_unison_any_1 => -> actor { actor.ecatb_val[:charge] > 0.0 },
  4029.       :update_ecatb_unison_any_2 => -> a { a.ecatb_val[:cooldown] > 0.0 },
  4030.       :usable? => -> actor_id { $game_actors[actor_id] },
  4031.       :window_battleenemy_update => -> m { m.sprite_effect_type = :whiten }
  4032.     }
  4033.  
  4034.     # Stores all regular expressions of the non-usableitem notetags
  4035.     REGEX = [
  4036.       /< *ecatb +color *: *(\w+) *, *(\d+) *, *(\w+) *>/i,
  4037.       /< *ecatb +gradual +action +gain *: *(\w+) *>/i,
  4038.       /< *ecatb +order +battler +icon *: *(\w+) *>/i,
  4039.       /< *ecatb +order +battler +opacity *: *(\w+) *>/i,
  4040.       /< *ecatb +order +battler +scale *: *(\w+) *>/i,
  4041.       /< *ecatb +order +battler +z *: *(\w+) *>/i,
  4042.       /< *ecatb +rate *: *(\w+) *>/i,
  4043.       /< *ecatb +se +ready +act *: *(\w+) *>/i,
  4044.       /< *ecatb +speed +reduce *: *(\w+) *>/i,
  4045.       /< *ecatb +start +val *: *(\d+) *, *(\w+) *>/i,
  4046.       /< *enemy +ecatb +bar +show *: *(\w+) *, *(\w+) *, *(\w+) *, *(\w+) *>/i,
  4047.       /< *ecatb +countdown +interval *: *(\w+) *>/i,
  4048.       /< *ecatb +act +cost *: *(\w+) *>/i,
  4049.       /< *ecatb +charge +prior +act +cost *: *(\w+) *>/i,
  4050.       /< *ecatb +charge +prior +item +cost *: *(\w+) *>/i,
  4051.       /< *ecatb +charge +rate *: *(\w+) *>/i,
  4052.       /< *ecatb +cooldown +rate *: *(\w+) *>/i,
  4053.       /< *ecatb +force +act +cost *: *(\w+) *>/i,
  4054.       /< *ecatb +reset +val *: *(\w+) *>/i,
  4055.       /< *ecatb +unison +actor *: *(\w+) *>/i,
  4056.       /< *ecatb +unison +charge +rule *: *(\w+) *>/i,
  4057.       /< *ecatb +unison +cooldown +rule *: *(\w+) *>/i,
  4058.       /< *ecatb +unison +actor +(\w+) *: *(\w+) *>/i,
  4059.       /< *ecatb +unison +(\w+) +rule *: *(\w+) *>/
  4060.     ]
  4061.  
  4062.     # Stores all regular expressions of the usableitem notetags
  4063.     USABLEITEM_NOTES = [
  4064.       "ecatb_act_cost",
  4065.       "ecatb_charge_prior_act_cost",
  4066.       "ecatb_charge_prior_item_cost",
  4067.       "ecatb_charge_rate",
  4068.       "ecatb_cooldown_rate",
  4069.       "ecatb_force_act_cost",
  4070.       "ecatb_reset_val",
  4071.       "ecatb_unison_actor",
  4072.       "ecatb_unison_charge_rule",
  4073.       "ecatb_unison_cooldown_rule",
  4074.       "ecatb_unison_actor_def",
  4075.       "ecatb_unison_def_rule"
  4076.     ]
  4077.  
  4078.     #Stores all pieces of codes used for reading notetags in all database parts
  4079.     NOTE_START = %Q(
  4080.   attr_reader :ecatb_notes
  4081.   def load_ecatb_notes
  4082.     @ecatb_notes = {}
  4083.     ecatb = DoubleX_RMVXA::ECATB
  4084.     )
  4085.     NOTE_MID = %Q(
  4086.     [:atb, :charge, :cooldown, :rate, :speed, :start_0, :start_1, :start_2].
  4087.     each { |note| @ecatb_notes[note] = [] }
  4088.     @note.split(/[\r\n]+/).each { |line|
  4089.       if line =~ ecatb::REGEX[0]
  4090.         next @ecatb_notes[$1.downcase.to_sym][$2.to_i] ||= $3.downcase.to_sym
  4091.       elsif line =~ ecatb::REGEX[1]
  4092.         next @ecatb_notes[:act] = $1.downcase.to_sym
  4093.       elsif line =~ ecatb::REGEX[2]
  4094.         next @ecatb_notes[:order_icon] = $1.downcase.to_sym
  4095.       elsif line =~ ecatb::REGEX[3]
  4096.         next @ecatb_notes[:order_opacity] = $1.downcase.to_sym
  4097.       elsif line =~ ecatb::REGEX[4]
  4098.         next @ecatb_notes[:order_scale] = $1.downcase.to_sym
  4099.       elsif line =~ ecatb::REGEX[5]
  4100.         next @ecatb_notes[:order_z] = $1.downcase.to_sym
  4101.       elsif line =~ ecatb::REGEX[6]
  4102.         next @ecatb_notes[:rate] << $1.downcase.to_sym
  4103.       elsif line =~ ecatb::REGEX[7]
  4104.         next @ecatb_notes[:se] = $1.downcase.to_sym
  4105.       elsif line =~ ecatb::REGEX[8]
  4106.         next @ecatb_notes[:speed] << $1.downcase.to_sym
  4107.       elsif line =~ ecatb::REGEX[9]
  4108.         next @ecatb_notes[("start_" + $1).to_sym] << $2.downcase.to_sym
  4109.     )
  4110.     NOTE_QUARTER = %Q(
  4111.       end
  4112.     }
  4113.     )
  4114.     NOTE_END = %Q(
  4115.   end
  4116.     )
  4117.     BAR_NOTE_START = %Q(
  4118.   attr_accessor :enemy_ecatb_bar_show
  4119.     )
  4120.     BAR_NOTE_MID = %Q(
  4121.     @enemy_ecatb_bar_show = [
  4122.       eval(ecatb::BAR_KILL_ENEMY_1ST),
  4123.       eval(ecatb::ENEMY_BAR_SHOW),
  4124.       eval(ecatb::ENEMY_BAR_SHOW_PERCENT),
  4125.       eval(ecatb::ENEMY_BAR_SHOW_ACT),
  4126.     ]
  4127.     )
  4128.     BAR_NOTE_END = %Q(
  4129.       elsif line =~ ecatb::REGEX[10]
  4130.         next @enemy_ecatb_bar_show = [eval($1.downcase), eval($2.downcase),
  4131.         eval($3.downcase), eval($4.downcase)]
  4132.     )
  4133.     COUNTDOWN_NOTE_START = %Q(
  4134.   attr_accessor :ecatb_countdown_interval
  4135.     )
  4136.     COUNTDOWN_NOTE_MID = %Q(
  4137.       elsif line =~ ecatb::REGEX[11]
  4138.         next @ecatb_countdown_interval = $1.downcase.to_sym
  4139.     )
  4140.     COUNTDOWN_NOTE_END = %Q(
  4141.     @auto_removal_timing = 3 if @ecatb_countdown_interval
  4142.     )
  4143.  
  4144.     # Stores the method load_ecatb_notes in actors, classes and equips
  4145.     CLASS_NOTES = EQUIP_NOTES = ACTOR_NOTES = NOTE_START + NOTE_MID +
  4146.     NOTE_QUARTER + NOTE_END
  4147.  
  4148.     # Stores the method load_ecatb_notes in enemies
  4149.     ENEMY_NOTES = BAR_NOTE_START + NOTE_START + %Q(
  4150.     t, f, n = true, false, nil
  4151.     ) + BAR_NOTE_MID + NOTE_MID + BAR_NOTE_END + NOTE_QUARTER + NOTE_END
  4152.  
  4153.     # Stores the method load_ecatb_notes in states
  4154.     STATE_NOTES = BAR_NOTE_START + COUNTDOWN_NOTE_START + NOTE_START +
  4155.                   BAR_NOTE_MID + NOTE_MID + COUNTDOWN_NOTE_MID + BAR_NOTE_END +
  4156.                   NOTE_QUARTER + COUNTDOWN_NOTE_END + NOTE_END
  4157.  
  4158.     # Stores the abstract method creator and validator for all configurations
  4159.     CHECK_RESET_DEF = {}
  4160.     [:BATTLEMANAGER, :GAME_ACTOR, :GAME_ENEMY, :GAME_PARTY_TROOP,
  4161.      :WINDOW_BATTLESTATUS, :ECATB_CLOCK_WINDOW, :ECATB_BAR, :ECATB_CLOCK_BAR,
  4162.      :ECATB_FORCE_WINDOW, :ECATB_ORDER_WINDOW, :ECATB_POOL_WINDOW,
  4163.      :SCENE_BATTLE].each { |key|
  4164.       CHECK_RESET_DEF[key] = %Q(
  4165.   def create_ecatb_defs
  4166.     DoubleX_RMVXA::ECATB::#{key.id2name}.each_key { |config|
  4167.       create_ecatb_def(config) unless respond_to?(config)
  4168.     }
  4169.   end
  4170.  
  4171.   def check_ecatb_def(config, check)
  4172.     percent = act = ""
  4173.     charge = cooldown = cur_clock = max_clock = turn_count = rule = -1
  4174.     vals = []
  4175.     #{RESCUE_CONFIG_VAL ? "begin" : ""}
  4176.     val = eval(config + check[0])
  4177.     reset_ecatb_def(config, check, "is invalid.") unless eval(check[1])
  4178.     #{RESCUE_CONFIG_VAL ? %Q(rescue Exception => error
  4179.     msgbox("This error message's raised:\n" + error.message)
  4180.     reset_ecatb_def(config, check, "could crash the game.")
  4181.     end) : ""}
  4182.   end
  4183.  
  4184.   def reset_ecatb_def(config, check, type)
  4185.     #{RESET_CONFIG_VAL ? "" : "return"}
  4186.     #{SUPPRESS_RESET_CONFIG_VAL_TEXT ? "" : %Q(msgbox("The validation code " +
  4187.     "of " + config + " is\n" + check[1])
  4188.     msgbox("The value of " +
  4189.     config + " is\n" + $game_system.send(config.to_sym) + "\nwhich " + type))}
  4190.     $game_system.send((config + "=").to_sym, check[2])
  4191.     create_ecatb_def(config.to_sym, false)
  4192.     #{SUPPRESS_RESET_CONFIG_VAL_TEXT ? "" : %Q(msgbox(
  4193.     "Its value is reset to its default:\n" + check[2]))}
  4194.   end
  4195.       )
  4196.     }
  4197.  
  4198.     # (v0.02c+)Returns the atb charge gain and cooldown loss rate
  4199.     CHARGE_COOLDOWN_RATE = {}
  4200.     [:charge, :cooldown].each { |key|
  4201.       CHARGE_COOLDOWN_RATE[key] = %Q(
  4202.   def ecatb_#{type = key.id2name}_#{key == :charge ? "gain" : "loss"}_rate
  4203.     return @ecatb_rate[:#{type}] unless (@last_ecatb_rate[:#{type}] !=
  4204.     @last_ecatb_rate[:#{type}] = ecatb_gain_rate) ||
  4205.     @ecatb_item_change[:#{type}]
  4206.     @ecatb_item_change[:#{type}] = false
  4207.     @ecatb_rate[:#{type}] = if @#{key == :charge ? "" : "fail_"}ecatb_esc
  4208.       esc_ecatb_#{type}_rate(@last_ecatb_rate[:#{type}])
  4209.     else
  4210.       DoubleX_RMVXA::ECATB.send(@last_ecatb_item.ecatb_#{type}_rate, self,
  4211.       @last_ecatb_rate[:#{type}])
  4212.     end
  4213.   end
  4214.       )
  4215.     }
  4216.  
  4217.     # (v0.01a+)Reads all atb order battler icon, opacity, scale and z notetags
  4218.     ORDER = {}
  4219.     [:icon, :opacity, :scale, :z].each { |key|
  4220.       type = key.id2name
  4221.       ORDER[key] = %Q(
  4222.   def set_ecatb_order_battler_#{type}
  4223.     unless ecatb_battler_change?(:order_#{type})
  4224.       return @ecatb_notes[:order_#{type}]
  4225.     end
  4226.     @ecatb_notes[:order_#{type}] = nil
  4227.     ecatb_order_battler_#{type}_ord.each { |data|
  4228.       if send(@ecatb_item[data][0])
  4229.         set_ecatb_notes(send(@ecatb_item[data][1]), :order_#{type})
  4230.       end
  4231.       return @ecatb_notes[:order_#{type}] if @ecatb_notes[:order_#{type}]
  4232.     }
  4233.     @ecatb_notes[:order_#{type}] = ecatb_order_battler_#{type}
  4234.   end
  4235.       )
  4236.     }
  4237.  
  4238.     # Processes actor hotkeys used by Window_ActorCommand and Window_BattleActor
  4239.     ACTOR_HOTKEY = %Q(
  4240.   alias process_handling_ecatb process_handling
  4241.   def process_handling
  4242.     if BattleManager.btype?(:ecatb) && open? && active
  4243.       SceneManager.scene.ecatb_battler_hotkeys.each(&@ecatb_hotkey_block)
  4244.     end
  4245.     process_handling_ecatb
  4246.   end # process_handling
  4247.     )
  4248.  
  4249.     # Updates the positions, width and height and text font update methods
  4250.     WINDOW_DEFS = {}
  4251.     [:clock, :force, :order, :pool].each { |key|
  4252.       klass = key.id2name
  4253.       WINDOW_DEFS[key] = %Q(
  4254.   def update_pos
  4255.     xyz = ecatb_#{klass}_window_xyz
  4256.     self.x = xyz[0] if x != xyz[0]
  4257.     self.y = xyz[1] if y != xyz[1]
  4258.     self.z = xyz[2] if z != xyz[2]
  4259.   end
  4260.  
  4261.   def update_wh
  4262.     wh = ecatb_#{klass}_window_wh
  4263.     self.width = wh[0] if width != wh[0]
  4264.     self.height = wh[1] if height != wh[1]
  4265.   end
  4266.  
  4267.   def update_text_font
  4268.     if (font = contents.font).color != color = ecatb_#{klass}_text_color
  4269.       font.color = color
  4270.     end
  4271.     return if font.size == size = ecatb_#{klass}_text_size
  4272.     font.size = size
  4273.   end
  4274.       )
  4275.     }
  4276.  
  4277.     # (v0.04d+)Processes the skill/item target cancellation command
  4278.     ON_TARGET_CANCEL = {}
  4279.     [:actor, :enemy].each { |key|
  4280.       ON_TARGET_CANCEL[key] = %Q(
  4281.   alias on_#{key = key.id2name}_cancel_ecatb on_#{key}_cancel
  4282.   def on_#{key}_cancel(*argv, &argb)
  4283.     return unless actor = BattleManager.actor
  4284.     if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:cancel, @#{key}_window)
  4285.       return
  4286.     end
  4287.     on_#{key}_cancel_ecatb(*argv, &argb)
  4288.     @status_window.draw_item(actor.index)
  4289.   end
  4290.       )
  4291.     }
  4292.  
  4293.     # (v0.04d+)Processes the skill/item selection confirmation command
  4294.     ON_SKILL_ITEM_OK = {}
  4295.     [:skill, :item].each { |key|
  4296.       ON_SKILL_ITEM_OK[key] = %Q(
  4297.   alias on_#{key = key.id2name}_ok_ecatb on_#{key}_ok
  4298.   def on_#{key}_ok(*argv, &argb)
  4299.     return unless actor = BattleManager.actor
  4300.     return if on_ecatb_unison_item_ok?(@#{key}_window)
  4301.     on_#{key}_ok_ecatb(*argv, &argb)
  4302.     @status_window.draw_item(actor.index)
  4303.   end
  4304.       )
  4305.     }
  4306.  
  4307.     # (v0.01b+)Creates the atb force, order and pool windows
  4308.     CREATE_WINDOW = {}
  4309.     [:Force, :Order, :Pool].each { |key|
  4310.       name1 = key.id2name
  4311.       CREATE_WINDOW[key] = %Q(
  4312.   def create_ecatb_#{name2 = name1.downcase}_window
  4313.     return if @ecatb_#{name2}_window
  4314.     return unless eval($game_system.show_ecatb_#{name2}_window)
  4315.     @ecatb_#{name2}_window =
  4316.     ECATB_#{name1}_Window.new#{key == :Force ? "(@ecatb_force_clock)" : ""}
  4317.   end
  4318.       )
  4319.     }
  4320.  
  4321.     # (v0.01b+)Closes the atb clock, force, order and pool windows
  4322.     CLOSE_WINDOW = {}
  4323.     [:clock, :force, :order, :pool].each { |key|
  4324.       CLOSE_WINDOW[key] = %Q(
  4325.   def close_ecatb_#{name = key.id2name}_window
  4326.     @ecatb_#{name}_window.hide.deactivate.close
  4327.     @ecatb_#{name}_window.dispose unless @ecatb_#{name}_window.disposed?
  4328.     @ecatb_#{name}_window = nil
  4329.   end
  4330.       )
  4331.     }
  4332.  
  4333.   end # ECATB
  4334.  
  4335. end # DoubleX_RMVXA
  4336.  
  4337. if $imported["YEA-BattleEngine"] && !$imported["YSA-CATB"]
  4338.  
  4339. #------------------------------------------------------------------------------|
  4340.  
  4341. #------------------------------------------------------------------------------|
  4342. #  * Load all data's notetags and fixes bugs and edge cases                    |
  4343. #------------------------------------------------------------------------------|
  4344. class << DataManager # Edit
  4345.  
  4346.   #----------------------------------------------------------------------------|
  4347.   #  Loads all this script's notetags from the database as well                |
  4348.   #----------------------------------------------------------------------------|
  4349.   alias load_database_ecatb load_database
  4350.   def load_database(*argv, &argb)
  4351.     load_database_ecatb(*argv, &argb)
  4352.     load_ecatb_notes # Added
  4353.   end # load_database
  4354.  
  4355.   #----------------------------------------------------------------------------|
  4356.   #  Clears and resets all battlers' blocks before and after saving also       |
  4357.   #----------------------------------------------------------------------------|
  4358.   alias save_game_without_rescue_ecatb save_game_without_rescue
  4359.   def save_game_without_rescue(index, &argb)
  4360.     clear_ecatb_blocks # Added
  4361.     save_game_without_rescue_ecatb(index, &argb)
  4362.     init_ecatb_def_blocks # Added
  4363.   end # save_game_without_rescue
  4364.  
  4365.   #----------------------------------------------------------------------------|
  4366.   #  Resets all battlers' blocks and methods after loading as well             |
  4367.   #----------------------------------------------------------------------------|
  4368.   alias extract_save_contents_ecatb extract_save_contents
  4369.   def extract_save_contents(contents, &argb)
  4370.     extract_save_contents_ecatb(contents, &argb)
  4371.     init_ecatb_def_blocks(true) # Added
  4372.   end # extract_save_contents
  4373.  
  4374.   def load_ecatb_notes # New
  4375.     [$data_actors, $data_classes, $data_skills, $data_items, $data_weapons,
  4376.      $data_armors, $data_enemies, $data_states].each(
  4377.      &DoubleX_RMVXA::ECATB::BLOCKS[:load_ecatb_notes])
  4378.   end # load_ecatb_notes
  4379.  
  4380.   #----------------------------------------------------------------------------|
  4381.   #  Clears all blocks before serializations and after being unneeded          |
  4382.   #----------------------------------------------------------------------------|
  4383.   def clear_ecatb_blocks # New
  4384.     block = DoubleX_RMVXA::ECATB::BLOCKS[:clear_ecatb_blocks]
  4385.     $game_actors.instance_exec { @data.compact.each(&block) }
  4386.     $game_troop.members.each(&block)
  4387.   end # clear_ecatb_blocks
  4388.  
  4389.   #----------------------------------------------------------------------------|
  4390.   #  Resets all blocks after serializations and being needed                   |
  4391.   #----------------------------------------------------------------------------|
  4392.   def init_ecatb_def_blocks(create_def = false) # New
  4393.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4394.     $game_party.all_members.each(&block[:create_ecatb_defs]) if create_def
  4395.     $game_party.all_members.each(&block[:reset_ecatb_blocks])
  4396.     $game_troop.members.each(&block[:reset_ecatb_blocks])
  4397.   end # init_ecatb_def_blocks
  4398.  
  4399. end # DataManager
  4400.  
  4401. #------------------------------------------------------------------------------|
  4402. #  * Loads all the actor's notetags                                            |
  4403. #------------------------------------------------------------------------------|
  4404. class RPG::Actor < RPG::BaseItem # Edit
  4405.  
  4406.   module_eval(DoubleX_RMVXA::ECATB::ACTOR_NOTES) # New
  4407.  
  4408. end # RPG::Actor
  4409.  
  4410. #------------------------------------------------------------------------------|
  4411. #  * Loads all the class's notetags                                            |
  4412. #------------------------------------------------------------------------------|
  4413. class RPG::Class < RPG::BaseItem # Edit
  4414.  
  4415.   module_eval(DoubleX_RMVXA::ECATB::CLASS_NOTES) # New
  4416.  
  4417. end # RPG::Class
  4418.  
  4419. #------------------------------------------------------------------------------|
  4420. #  * Loads all the enemy's notetags                                            |
  4421. #------------------------------------------------------------------------------|
  4422. class RPG::Enemy < RPG::BaseItem # Edit
  4423.  
  4424.   module_eval(DoubleX_RMVXA::ECATB::ENEMY_NOTES) # New
  4425.  
  4426. end # RPG::Enemy
  4427.  
  4428. #------------------------------------------------------------------------------|
  4429. #  * Loads all the equip's notetags                                            |
  4430. #------------------------------------------------------------------------------|
  4431. class RPG::EquipItem < RPG::BaseItem # Edit
  4432.  
  4433.   module_eval(DoubleX_RMVXA::ECATB::EQUIP_NOTES) # New
  4434.  
  4435. end # RPG::EquipItem
  4436.  
  4437. #------------------------------------------------------------------------------|
  4438. #  * Loads all the state's notetags                                            |
  4439. #------------------------------------------------------------------------------|
  4440. class RPG::State < RPG::BaseItem # Edit
  4441.  
  4442.   module_eval(DoubleX_RMVXA::ECATB::STATE_NOTES) # New
  4443.  
  4444. end # RPG::State
  4445.  
  4446. class RPG::UsableItem < RPG::BaseItem # Edit
  4447.  
  4448.   #----------------------------------------------------------------------------|
  4449.   #  New public instance variables                                             |
  4450.   #----------------------------------------------------------------------------|
  4451.   # The values of all the skill/item's notetags
  4452.   DoubleX_RMVXA::ECATB::USABLEITEM_NOTES.each { |note|
  4453.     attr_accessor eval(":#{note}")
  4454.   }
  4455.   #
  4456.  
  4457.   def load_ecatb_notes # New
  4458.     @ecatb_unison_actor_def = {}
  4459.     @ecatb_unison_def_rule = {}
  4460.     ecatb = DoubleX_RMVXA::ECATB
  4461.     @note.split(/[\r\n]+/).each { |line|
  4462.       ecatb::USABLEITEM_NOTES.each_with_index { |note, index|
  4463.         next unless line =~ ecatb::REGEX[index + 12]
  4464.         if index > 9
  4465.           note += "[:#{$1}]"
  4466.           val = $2.downcase.to_sym
  4467.         else
  4468.           val = $1.downcase.to_sym
  4469.         end
  4470.         send(:"#{note}=", send(:"#{note}") || val)
  4471.       }
  4472.     }
  4473.     ecatb::USABLEITEM_NOTES.each_with_index { |note, index|
  4474.       send(:"#{note}=", send(:"#{note}") || note.to_sym) if index < 10
  4475.     }
  4476.   end # load_ecatb_notes
  4477.  
  4478. end # RPG::UsableItem
  4479.  
  4480. #------------------------------------------------------------------------------|
  4481. #  * Reimplements the the whole battle flow to run the atb system              |
  4482. #------------------------------------------------------------------------------|
  4483. class << BattleManager # Edit
  4484.  
  4485.   #----------------------------------------------------------------------------|
  4486.   #  New public instance variables                                             |
  4487.   #----------------------------------------------------------------------------|
  4488.   attr_accessor :actor_index # Accessed by Scene_Battle to setup actors
  4489.   attr_accessor :ecatb_can_esc # The party escape permission flag
  4490.   attr_reader :ecatb_actor_act_list # The list of actors that can act
  4491.   attr_reader :ecatb_base # The base atb rate determinators
  4492.   attr_reader :ecatb_base_change # The base atb rate determinators change flag
  4493.   attr_reader :action_battlers # Read by Scene_Battle to execute actions
  4494.   attr_reader :phase # Read by Scene_Battle to get the battle phase
  4495.  
  4496.   #----------------------------------------------------------------------------|
  4497.   #  New private instance variables                                            |
  4498.   #----------------------------------------------------------------------------|
  4499.   # @ecatb_battlers_def_sums: All method sums of all battlers
  4500.   # @ecatb_def_sums: The iteraotr block running all method sums of all battlers
  4501.   # @ecatb_esc: The party escape attempt flag
  4502.   # @ecatb_pool_reset_lock: The party/troop atb pool reset lock
  4503.  
  4504.   alias setup_ecatb setup
  4505.   def setup(troop_id, can_escape = true, can_lose = false, &argb)
  4506.     setup_ecatb(troop_id, can_escape, can_lose, &argb)
  4507.     # Added
  4508.     init_ecatb_vars
  4509.     create_ecatb_defs
  4510.     #
  4511.   end # setup
  4512.  
  4513.   #----------------------------------------------------------------------------|
  4514.   #  Always let actions to be executed at any frame for ecatb battle system    |
  4515.   #----------------------------------------------------------------------------|
  4516.   alias in_turn_ecatb? in_turn?
  4517.   def in_turn? # Hotspot
  4518.     btype?(:ecatb) || in_turn_ecatb? # Rewritten
  4519.   end # in_turn?
  4520.  
  4521.   #----------------------------------------------------------------------------|
  4522.   #  Disables the next command for ecatb battle system                         |
  4523.   #----------------------------------------------------------------------------|
  4524.   alias next_command_ecatb next_command
  4525.   def next_command(*argv, &argb)
  4526.     # Rewritten
  4527.     return false if btype?(:ecatb)
  4528.     next_command_ecatb(*argv, &argb)
  4529.     #
  4530.   end # next_command
  4531.  
  4532.   #----------------------------------------------------------------------------|
  4533.   #  Disables the prior command for ecatb battle system                        |
  4534.   #----------------------------------------------------------------------------|
  4535.   alias prior_command_ecatb prior_command
  4536.   def prior_command(*argv, &argb)
  4537.     # Rewritten
  4538.     return false if btype?(:ecatb)
  4539.     prior_command_ecatb(*argv, &argb)
  4540.     #
  4541.   end # prior_command
  4542.  
  4543.   #----------------------------------------------------------------------------|
  4544.   #  Initializes all battlers' starting atb values and their method sums also  |
  4545.   #----------------------------------------------------------------------------|
  4546.   alias battle_start_ecatb battle_start
  4547.   def battle_start(*argv, &argb)
  4548.     battle_start_ecatb(*argv, &argb)
  4549.     ecatb_battle_start if btype?(:ecatb) # Added
  4550.   end # battle_start
  4551.  
  4552.   #----------------------------------------------------------------------------|
  4553.   #  Closes all windows that should be closed before ending the battle as well |
  4554.   #----------------------------------------------------------------------------|
  4555.   alias process_victory_ecatb process_victory
  4556.   def process_victory(*argv, &argb)
  4557.     # Added
  4558.     if btype?(:ecatb) && SceneManager.scene_is?(Scene_Battle)
  4559.       SceneManager.scene.close_ecatb_windows
  4560.     end
  4561.     #
  4562.     process_victory_ecatb(*argv, &argb)
  4563.   end # process_victory
  4564.  
  4565.   #----------------------------------------------------------------------------|
  4566.   #  Checks if escape's allowed, no such attempt exists and the conditions' met|
  4567.   #----------------------------------------------------------------------------|
  4568.   alias process_escape_ecatb process_escape
  4569.   def process_escape(*argv, &argb)
  4570.     return process_escape_ecatb(*argv, &argb) unless btype?(:ecatb) # Rewritten
  4571.     # Added to initializes the escape attempt if all the requirements are met
  4572.     return false if @ecatb_esc
  4573.     init_ecatb_escape if @ecatb_can_esc && ecatb_esc_init_cond
  4574.     false
  4575.     #
  4576.   end # process_escape
  4577.  
  4578.   #----------------------------------------------------------------------------|
  4579.   #  Closes all windows that should be closed before ending the battle as well |
  4580.   #----------------------------------------------------------------------------|
  4581.   alias process_defeat_ecatb process_defeat
  4582.   def process_defeat(*argv, &argb)
  4583.     # Added
  4584.     if btype?(:ecatb) && SceneManager.scene_is?(Scene_Battle)
  4585.       SceneManager.scene.close_ecatb_windows
  4586.     end
  4587.     #
  4588.     process_defeat_ecatb(*argv, &argb)
  4589.   end # process_defeat
  4590.  
  4591.   #----------------------------------------------------------------------------|
  4592.   #  Stops making actions for any battler and unselecting any inputable actor  |
  4593.   #----------------------------------------------------------------------------|
  4594.   alias input_start_ecatb input_start
  4595.   def input_start(*argv, &argb)
  4596.     # Added
  4597.     if btype?(:ecatb)
  4598.       @phase = :input
  4599.       @surprise = false
  4600.     end
  4601.     #
  4602.     input_start_ecatb(*argv, &argb)
  4603.   end # input_start
  4604.  
  4605.   #----------------------------------------------------------------------------|
  4606.   #  Clears all temporarily stored battlers' blocks as well                    |
  4607.   #----------------------------------------------------------------------------|
  4608.   alias battle_end_ecatb battle_end # v0.03b+
  4609.   def battle_end(result, &argb)
  4610.     battle_end_ecatb(result, &argb)
  4611.     clear_ecatb_blocks # Added
  4612.   end # battle_end
  4613.  
  4614.   def init_ecatb_vars # New
  4615.     $game_temp.init_ecatb_vars
  4616.     @ecatb_actor_act_list = []
  4617.     @ecatb_base = { size: -1, sum: -1, val: -1 }
  4618.     @ecatb_battlers_def_sums = {}
  4619.     @ecatb_can_esc = true
  4620.     @ecatb_pool_reset_lock = []
  4621.     init_ecatb_block
  4622.   end # init_ecatb_vars
  4623.  
  4624.   #----------------------------------------------------------------------------|
  4625.   #  Initializes the new block to trade memory usage for time performance      |
  4626.   #----------------------------------------------------------------------------|
  4627.   def init_ecatb_block # New
  4628.     # Calls this block instead of an anonymous function per enumerable iteration
  4629.     @ecatb_def_sums = -> method {
  4630.       @ecatb_battlers_def_sums[method] = ecatb_def_sum_battlers.inject(0) {
  4631.       |sum, battler| sum + battler.send(method) }
  4632.     }
  4633.     #
  4634.   end # init_ecatb_block
  4635.  
  4636.   #----------------------------------------------------------------------------|
  4637.   #  Clears all temporarily stored battlers' blocks and frees memory as well   |
  4638.   #----------------------------------------------------------------------------|
  4639.   def clear_ecatb_blocks # v0.05a+; New
  4640.     $game_temp.clear_ecatb_vars
  4641.     @action_battlers = @ecatb_actor_act_list = @ecatb_base = nil
  4642.     @ecatb_battlers_def_sums = @ecatb_def_sums = @ecatb_pool_reset_lock = nil
  4643.   end # clear_ecatb_blocks
  4644.  
  4645.   #----------------------------------------------------------------------------|
  4646.   #  Creates and checks the associated method for each configuration used here |
  4647.   #----------------------------------------------------------------------------|
  4648.   # config: The configuration requesting its associated method
  4649.   # validate: The configuration value validation flag
  4650.   def create_ecatb_def(config, validate = true) # New
  4651.     # Uses the name and value of configuration as its method's name and contents
  4652.     method = config.id2name
  4653.     eval(%Q(
  4654.   def #{method}#{DoubleX_RMVXA::ECATB::BATTLEMANAGER[config][0]}
  4655.     #{$game_system.send(config)}
  4656.   end
  4657.     ))
  4658.     #
  4659.     return unless validate
  4660.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::BATTLEMANAGER[config])
  4661.   end # create_ecatb_def
  4662.  
  4663.   #----------------------------------------------------------------------------|
  4664.   #  Checks all new methods and resets them to the defaults if they're invalid |
  4665.   #----------------------------------------------------------------------------|
  4666.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:BATTLEMANAGER]) # New
  4667.  
  4668.   #----------------------------------------------------------------------------|
  4669.   #  Initializes all battlers' starting atb values and their method sums       |
  4670.   #----------------------------------------------------------------------------|
  4671.   def ecatb_battle_start # New
  4672.     type = @preemptive ? :start_1 : @surprise ? :start_2 : :start_0
  4673.     $game_party.battle_members.each { |mem| mem.set_ecatb_start_val(type) }
  4674.     $game_troop.members.each { |mem| mem.set_ecatb_start_val(type) }
  4675.     ecatb_battlers_def_sum.each(&@ecatb_def_sums)
  4676.   end # ecatb_battle_start
  4677.  
  4678.   #----------------------------------------------------------------------------|
  4679.   #  Updates all battlers' atb values and the party escape attempt status      |
  4680.   #----------------------------------------------------------------------------|
  4681.   def ecatb_update # New; Hotspot
  4682.     update_ecatb_base
  4683.     ecatb_block_update
  4684.     if update_ecatb_battlers_def_sums
  4685.       ecatb_battlers_def_sum.each(&@ecatb_def_sums)
  4686.     end
  4687.     return unless @ecatb_esc
  4688.     return pay_ecatb_esc_cost unless ecatb_esc_charge_cond
  4689.     ecatb_esc_suc if ecatb_esc_exec_cond
  4690.   end # ecatb_update
  4691.  
  4692.   def ecatb_block_update # v0.05a+; New; Hotspot
  4693.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4694.     $game_party.battle_members.each(&block[:ecatb_updates])
  4695.     $game_troop.alive_members.each(&block[:ecatb_updates])
  4696.     [$game_party, $game_troop].each(&block[:update_ecatb_pool])
  4697.     $game_party.alive_members.each(&block[:update_ecatb_unison])
  4698.     $game_troop.alive_members.each(&block[:reset_ecatb_refresh])
  4699.   end # ecatb_block_update
  4700.  
  4701.   #----------------------------------------------------------------------------|
  4702.   #  Checks if the atb rate needs to be reevaluated                            |
  4703.   #----------------------------------------------------------------------------|
  4704.   def update_ecatb_base # New; Hotspot
  4705.     # Checks if the number of battlers, methods sums or the fill time's changed
  4706.     @ecatb_base_change = false
  4707.     base = {
  4708.       size: ecatb_def_sum_battlers.size,
  4709.       sum: @ecatb_battlers_def_sums,
  4710.       val: 100.0 / ecatb_base_fill_t / Graphics.frame_rate
  4711.     }
  4712.     base.each { |key, val|
  4713.       @ecatb_base_change = @ecatb_base[key] = val if @ecatb_base[key] != val
  4714.     }
  4715.     #
  4716.   end # update_ecatb_base
  4717.  
  4718.   #----------------------------------------------------------------------------|
  4719.   #  Initializes a party escape attempt                                        |
  4720.   #----------------------------------------------------------------------------|
  4721.   def init_ecatb_escape # New
  4722.     $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
  4723.     @ecatb_esc = true
  4724.     # Resets all party members' charge rate and clears all unison data as well
  4725.     $game_party.battle_members.each(
  4726.     &DoubleX_RMVXA::ECATB::BLOCKS[:init_ecatb_escape])
  4727.     #
  4728.   end # init_ecatb_escape
  4729.  
  4730.   #----------------------------------------------------------------------------|
  4731.   #  Executes the fully charged party escape attempt                           |
  4732.   #----------------------------------------------------------------------------|
  4733.   def ecatb_esc_suc # New
  4734.     Sound.play_escape
  4735.     ecatb_esc_suc_cond ? process_abort : pay_ecatb_esc_cost
  4736.     wait_for_message
  4737.   end # ecatb_esc_suc
  4738.  
  4739.   #----------------------------------------------------------------------------|
  4740.   #  Asks all party members to pay the failed party escape attempt's costs     |
  4741.   #----------------------------------------------------------------------------|
  4742.   def pay_ecatb_esc_cost # New
  4743.     @escape_ratio += set_ecatb_esc_cost_compatibility
  4744.     $game_message.add('\.' + Vocab::EscapeFailure)
  4745.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4746.     $game_party.battle_members.each(&block[:pay_ecatb_esc_cost])
  4747.     @ecatb_esc = false
  4748.     $game_party.alive_members.each(&block[:ecatb_reset])
  4749.   end # pay_ecatb_escape_cost
  4750.  
  4751.   #----------------------------------------------------------------------------|
  4752.   #  Triggers all battlers' turn end effects and collapses all collapsible ones|
  4753.   #----------------------------------------------------------------------------|
  4754.   def ecatb_on_turn_end # New
  4755.     $game_party.alive_members.each(
  4756.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_on_turn_end])
  4757.     esc_phase = @ecatb_can_esc || @phase
  4758.     $game_troop.alive_members.each { |m|
  4759.       m.on_turn_end
  4760.       m.perform_collapse_effect if esc_phase && m.enemy? && m.can_collapse?
  4761.     }
  4762.   end # ecatb_on_turn_end
  4763.  
  4764.   #----------------------------------------------------------------------------|
  4765.   #  Marks a battler to become able to act and plays that battler's ready se   |
  4766.   #----------------------------------------------------------------------------|
  4767.   def make_ecatb_act(battler) # New
  4768.     # Stores that battler in the actable battler list and actor list for actors
  4769.     return if @action_battlers.include?(battler)
  4770.     @action_battlers << battler
  4771.     @ecatb_actor_act_list << battler if battler.actor?
  4772.     battler.make_actions
  4773.     battler.pre_ecatb_input_act
  4774.     return unless (se = battler.set_ecatb_se_ready_act).is_a?(RPG::SE)
  4775.     se.play
  4776.     #
  4777.   end # make_ecatb_act
  4778.  
  4779.   #----------------------------------------------------------------------------|
  4780.   #  Marks a battler to become unable to act                                   |
  4781.   #----------------------------------------------------------------------------|
  4782.   def del_ecatb_act(battler) # New
  4783.     # Removes that battler from the actable battler and actor list for actors
  4784.     return unless @action_battlers.include?(battler)
  4785.     @action_battlers.delete(battler)
  4786.     battler.clear_actions
  4787.     return unless battler.actor? && @ecatb_actor_act_list.include?(battler)
  4788.     @ecatb_actor_act_list.delete(battler)
  4789.     clear_actor if actor == self
  4790.     #
  4791.   end # del_ecatb_act
  4792.  
  4793.   #----------------------------------------------------------------------------|
  4794.   #  Returns the list of all currently inputable actors                        |
  4795.   #----------------------------------------------------------------------------|
  4796.   # id : The inputable actor id list request flag
  4797.   def ecatb_input_list(id = false) # New; Hotspot
  4798.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4799.     list = @ecatb_actor_act_list.select(&block[:ecatb_input_list_1])
  4800.     id ? list.collect!(&block[:ecatb_input_list_2]) : list
  4801.   end # ecatb_input_list
  4802.  
  4803.   # actors: The unison actors
  4804.   def ecatb_pool_reset(battler, actors) # v0.05a+; New
  4805.     # Ensures no repeated ecatb_reset call for any battler including unison ones
  4806.     if @ecatb_pool_reset_lock.include?(battler)
  4807.       return @ecatb_pool_reset_lock.delete(battler)
  4808.     end
  4809.     battlers = battler.actor? ? @ecatb_actor_act_list :
  4810.     @action_battlers - @ecatb_actor_act_list
  4811.     @ecatb_pool_reset_lock = battlers - [battler]
  4812.     (battlers - actors - [battler]).each(
  4813.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_reset])
  4814.     #
  4815.   end # ecatb_pool_reset
  4816.  
  4817.   #----------------------------------------------------------------------------|
  4818.   #  Checks if the battler atb values should be continually updated            |
  4819.   #----------------------------------------------------------------------------|
  4820.   def ecatb_ctb_break? # v0.04d+; New; Hotspot
  4821.     return true if $game_message.visible
  4822.     # Checks if the battle ended, action's executing or command window's showing
  4823.     return true if $game_party.all_dead? || $game_troop.all_dead?
  4824.     return true unless @phase && @ecatb_can_esc && ecatb_ctb
  4825.     return true unless SceneManager.scene_is?(Scene_Battle)
  4826.     block = DoubleX_RMVXA::ECATB::BLOCKS
  4827.     return true if $game_party.alive_members.any?(&block[:ecatb_refresh])
  4828.     return true if $game_troop.alive_members.any?(&block[:ecatb_refresh])
  4829.     @action_battlers.any?(&block[:ecatb_ctb_break?])
  4830.     #
  4831.   end # ecatb_ctb_break?
  4832.  
  4833.   #----------------------------------------------------------------------------|
  4834.   #  Tries to pick an inputable actor and returns if the attempt succeeded     |
  4835.   #----------------------------------------------------------------------------|
  4836.   def ecatb_update_act_actor? # v0.04d+; New; Hotspot
  4837.     # Points the actor index to the 1st inputable actor if any
  4838.     return false if (act_list = ecatb_input_list(true)).empty?
  4839.     @actor_index = act_list[0]
  4840.     #
  4841.   end # ecatb_update_act_actor?
  4842.  
  4843.   #----------------------------------------------------------------------------|
  4844.   #  Picks the prior or next inputable actor and returns the result            |
  4845.   #----------------------------------------------------------------------------|
  4846.   # sign: Indicator of whether the prior or next actor is to be picked
  4847.   def change_ecatb_actor?(sign) # v0.04d+; New; Potential Hotspot
  4848.     # Points the actor index to the prior or next actor if any
  4849.     return false if (act_list = ecatb_input_list(true)).empty?
  4850.     act_list.sort! { |a, b| a * sign <=> b * sign }.each { |a_index|
  4851.       return @actor_index = a_index if @actor_index * sign < a_index * sign
  4852.     }
  4853.     @actor_index = act_list[0]
  4854.     #
  4855.   end # change_ecatb_actor?
  4856.  
  4857.   #----------------------------------------------------------------------------|
  4858.   #  Lets the compatibility fix deals with compatibility issues                |
  4859.   #----------------------------------------------------------------------------|
  4860.   def set_ecatb_esc_cost_compatibility # New
  4861.     0.1
  4862.   end # set_ecatb_esc_cost_compatibility
  4863.  
  4864. end # BattleManager
  4865.  
  4866. #------------------------------------------------------------------------------|
  4867. #  * Temporarily stores the blocks right before clearing them                  |
  4868. #------------------------------------------------------------------------------|
  4869. class Game_Temp # v0.02c+; Edit
  4870.  
  4871.   #----------------------------------------------------------------------------|
  4872.   #  New public instance variables                                             |
  4873.   #----------------------------------------------------------------------------|
  4874.   attr_accessor :ecatb_add_actors # The member adding flag
  4875.   attr_accessor :ecatb_remove_actors # The member removing flag
  4876.   attr_reader :ecatb_unison_actors # All battlers' cached unison actors
  4877.   attr_reader :last_ecatb_item # All battlers' cached last used item
  4878.  
  4879.   def init_ecatb_vars # v0.05a+; New
  4880.     @ecatb_add_actors = []
  4881.     @ecatb_remove_actors = []
  4882.     @ecatb_unison_actors = {}
  4883.     @last_ecatb_item = {}
  4884.   end # init_ecatb_vars
  4885.  
  4886.   def clear_ecatb_vars # v0.05a+; New
  4887.     @ecatb_add_actors = @ecatb_remove_actors = nil
  4888.     @ecatb_unison_actors = @last_ecatb_item = nil
  4889.   end # clear_ecatb_vars
  4890.  
  4891. end # Game_Temp
  4892.  
  4893. #------------------------------------------------------------------------------|
  4894. #  * Selects the battle system and stores all configuration values             |
  4895. #------------------------------------------------------------------------------|
  4896. class Game_System # Edit
  4897.  
  4898.   #----------------------------------------------------------------------------|
  4899.   #  New public instance variables                                             |
  4900.   #----------------------------------------------------------------------------|
  4901.   # Stores all configuration values
  4902.   DoubleX_RMVXA::ECATB::CONFIG.each { |configs|
  4903.     configs.each_key { |config| attr_accessor eval(":#{config.id2name}") }
  4904.   }
  4905.   #
  4906.  
  4907.   #----------------------------------------------------------------------------|
  4908.   #  Stores all configuration values as well                                   |
  4909.   #----------------------------------------------------------------------------|
  4910.   alias initialize_ecatb initialize
  4911.   def initialize(*argv, &argb)
  4912.     initialize_ecatb(*argv, &argb)
  4913.     init_ecatb_configs # Added
  4914.   end # initialize
  4915.  
  4916.   #----------------------------------------------------------------------------|
  4917.   #  Set the battle system as :ecatb for using the ecatb battle system         |
  4918.   #----------------------------------------------------------------------------|
  4919.   alias set_battle_system_ecatb set_battle_system
  4920.   def set_battle_system(type, &argb)
  4921.     return @battle_system = :ecatb if type == :ecatb # Added
  4922.     set_battle_system_ecatb(type, &argb)
  4923.   end # set_battle_system
  4924.  
  4925.   #----------------------------------------------------------------------------|
  4926.   #  Returns :ecatb if using the ecatb battle system                           |
  4927.   #----------------------------------------------------------------------------|
  4928.   alias battle_system_corrected_ecatb battle_system_corrected
  4929.   def battle_system_corrected(type, &argb)
  4930.     # Rewritten
  4931.     type == :ecatb ? :ecatb : battle_system_corrected_ecatb(type, &argb)
  4932.     #
  4933.   end # battle_system_corrected
  4934.  
  4935.   #----------------------------------------------------------------------------|
  4936.   #  Stores all configuration values into this class's new variables           |
  4937.   #----------------------------------------------------------------------------|
  4938.   def init_ecatb_configs # New
  4939.     DoubleX_RMVXA::ECATB::CONFIG.each { |configs|
  4940.       configs.each { |config, val| send(:"#{config}=", val) }
  4941.     }
  4942.   end # init_ecatb_configs
  4943.  
  4944. end # Game_System
  4945.  
  4946. #------------------------------------------------------------------------------|
  4947. #  * Adds the action input confirmation flag for action executions             |
  4948. #------------------------------------------------------------------------------|
  4949. class Game_Action # Edit
  4950.  
  4951.   #----------------------------------------------------------------------------|
  4952.   #  New public instance variables                                             |
  4953.   #----------------------------------------------------------------------------|
  4954.   attr_accessor :last_ecatb_confirm # The last action confirmation flag
  4955.   attr_writer :ecatb_confirm # The action confirmation flag
  4956.  
  4957.   #----------------------------------------------------------------------------|
  4958.   #  Cancel the input confirmation as well                                     |
  4959.   #----------------------------------------------------------------------------|
  4960.   alias clear_ecatb clear
  4961.   def clear(*argv, &argb)
  4962.     clear_ecatb(*argv, &argb)
  4963.     @ecatb_confirm = @last_ecatb_confirm = false # Added
  4964.   end # clear
  4965.  
  4966.   #----------------------------------------------------------------------------|
  4967.   #  Corrects the action confirmation flag before returning it                 |
  4968.   #----------------------------------------------------------------------------|
  4969.   def ecatb_confirm # New
  4970.     @ecatb_confirm ||= !@subject.inputable?
  4971.   end # ecatb_confirm
  4972.  
  4973. end # Game_Action
  4974.  
  4975. #------------------------------------------------------------------------------|
  4976. #  * Implements the battler's calculations and decision making criteria        |
  4977. #------------------------------------------------------------------------------|
  4978. class Game_BattlerBase # Edit
  4979.  
  4980.   #----------------------------------------------------------------------------|
  4981.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  4982.   #----------------------------------------------------------------------------|
  4983.   alias erase_state_ecatb erase_state
  4984.   def erase_state(state_id, &argb)
  4985.     # Added
  4986.     if @states.include?(state_id)
  4987.       @ecatb_countdown_clock.delete(state_id)
  4988.       @ecatb_countdown_freeze.delete(state_id)
  4989.     end
  4990.     #
  4991.     erase_state_ecatb(state_id, &argb)
  4992.     set_ecatb_battler_change # Added
  4993.   end # erase_state
  4994.  
  4995.   #----------------------------------------------------------------------------|
  4996.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  4997.   #----------------------------------------------------------------------------|
  4998.   alias tp_equal_ecatb tp=
  4999.   def tp=(tp, &argb)
  5000.     tp_equal_ecatb(tp, &argb)
  5001.     set_ecatb_battler_change # Added
  5002.   end # tp=
  5003.  
  5004.   #----------------------------------------------------------------------------|
  5005.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5006.   #----------------------------------------------------------------------------|
  5007.   alias refresh_ecatb refresh
  5008.   def refresh(*argv, &argb)
  5009.     refresh_ecatb(*argv, &argb)
  5010.     set_ecatb_battler_change # Added
  5011.   end # refresh
  5012.  
  5013.   #----------------------------------------------------------------------------|
  5014.   #  Resets the battler's atb values and clear all actions as well             |
  5015.   #----------------------------------------------------------------------------|
  5016.   alias hide_ecatb hide # v0.04c+
  5017.   def hide(*argv, &argb)
  5018.     hide_ecatb(*argv, &argb)
  5019.     ecatb_reset(true) # Added
  5020.   end # hide
  5021.  
  5022.   #----------------------------------------------------------------------------|
  5023.   #  Checks if the user's charging and the costs need to be paid now as well   |
  5024.   #----------------------------------------------------------------------------|
  5025.   alias skill_cost_payable_ecatb? skill_cost_payable?
  5026.   def skill_cost_payable?(skill, &argb)
  5027.     return true if skill_cost_payable_ecatb?(skill, &argb) # Rewritten
  5028.     # Added
  5029.     return false unless BattleManager.btype?(:ecatb)
  5030.     return false if @ecatb_val[:charge] <= 0.0
  5031.     !DoubleX_RMVXA::ECATB.send(skill.ecatb_charge_prior_item_cost, self)
  5032.     #
  5033.   end # skill_cost_payable?
  5034.  
  5035.   #----------------------------------------------------------------------------|
  5036.   #  Checks if all unison battlers have enough action points as well           |
  5037.   #----------------------------------------------------------------------------|
  5038.   alias usable_ecatb? usable?
  5039.   def usable?(item, &argb)
  5040.     # Added
  5041.     if BattleManager.btype?(:ecatb) && item && item.is_a?(RPG::UsableItem)
  5042.       if SceneManager.scene_is?(Scene_Battle)
  5043.         ecatb = DoubleX_RMVXA::ECATB
  5044.         if actor?
  5045.           actors = ecatb.send(item.ecatb_unison_actor, self).collect!(
  5046.           &ecatb::BLOCKS[:usable?])
  5047.           return ecatb_unison_usable?(item, actors) if actors.size > 1
  5048.         end
  5049.         return false if @ecatb_val[:charge] <= 0.0 && @ecatb_act_times <
  5050.         ecatb.send(item.ecatb_act_cost, self)
  5051.       end
  5052.     end
  5053.     #
  5054.     usable_ecatb?(item, &argb)
  5055.   end # usable?(item)
  5056.  
  5057.   # act_times: The number of action points
  5058.   def ecatb_act_times=(act_times) # New
  5059.     return if @ecatb_act_times == act_times
  5060.     @ecatb_act_times = act_times
  5061.     set_ecatb_battler_change
  5062.   end # ecatb_act_times=
  5063.  
  5064.   #----------------------------------------------------------------------------|
  5065.   #  Raises the display redraw and cached notetag value reevaluation flags     |
  5066.   #----------------------------------------------------------------------------|
  5067.   def set_ecatb_battler_change # New
  5068.     @ecatb_battler_change ||= {}
  5069.     [:act, :atb, :charge, :cooldown, :order_icon, :order_opacity, :order_scale,
  5070.      :order_z, :rate, :se, :speed].each { |t| @ecatb_battler_change[t] = true }
  5071.     @ecatb_refresh = true
  5072.   end # set_ecatb_battler_change
  5073.  
  5074.   #----------------------------------------------------------------------------|
  5075.   #  Returns the currently displayed atb bar type                              |
  5076.   #----------------------------------------------------------------------------|
  5077.   def ecatb_bar_type # New; Hotspot
  5078.     return :cooldown if @ecatb_val[:cooldown] > 0.0
  5079.     @ecatb_val[:charge] > 0.0 ? :charge : :atb
  5080.   end # ecatb_bar_type
  5081.  
  5082.   #----------------------------------------------------------------------------|
  5083.   #  Returns the charge gain and cooldown loss value per frame                 |
  5084.   #----------------------------------------------------------------------------|
  5085.   # v0.02c+; New; Hotspot
  5086.   DoubleX_RMVXA::ECATB::CHARGE_COOLDOWN_RATE.each_value { |v| module_eval(v) }
  5087.   #
  5088.  
  5089.   #----------------------------------------------------------------------------|
  5090.   #  Caches and returns the atb rate                                           |
  5091.   #----------------------------------------------------------------------------|
  5092.   def ecatb_gain_rate # New; Hotspot
  5093.     # Reevaluates the atb rate only if any of its determinators' changed
  5094.     return @ecatb_rate[:atb] unless BattleManager.ecatb_base_change ||
  5095.     ecatb_battler_change?(:rate)
  5096.     @ecatb_rate[:atb] = set_ecatb_gain_rate(BattleManager.ecatb_base.clone)
  5097.     #
  5098.   end # ecatb_gain_rate
  5099.  
  5100.   #----------------------------------------------------------------------------|
  5101.   #  Evaluates the value of all atb gain rate notetags using its ordering      |
  5102.   #----------------------------------------------------------------------------|
  5103.   # base: The base atb gain rate
  5104.   def set_ecatb_gain_rate(base) # v0.05a+; New; Potential Hotspot
  5105.     ecatb = DoubleX_RMVXA::ECATB
  5106.     ecatb_rate_ord.each { |data|
  5107.       next unless send(@ecatb_item[data][0])
  5108.       send(@ecatb_item[data][1]).each { |item|
  5109.         (0..(item.ecatb_notes[:rate].size - 1)).each { |index|
  5110.           next unless note = item.ecatb_notes[:rate][index]
  5111.           base[:val] = ecatb.send(note, self, base)
  5112.         }
  5113.       }
  5114.     }
  5115.     base[:val]
  5116.   end # set_ecatb_gain_rate
  5117.  
  5118.   #----------------------------------------------------------------------------|
  5119.   #  Sets the current battler gradual action gain flag when its notetags change|
  5120.   #----------------------------------------------------------------------------|
  5121.   def set_gradual_ecatb_act_gain # v0.05a+; New; Hotspot
  5122.     # Updates the battler gradual action gain notetags using the current order
  5123.     return @ecatb_notes[:act] unless ecatb_battler_change?(:act)
  5124.     @ecatb_notes[:act] = nil
  5125.     gradual_ecatb_action_gain_ord.each { |data|
  5126.       if send(@ecatb_item[data][0])
  5127.         set_ecatb_notes(send(@ecatb_item[data][1]), :act)
  5128.       end
  5129.       return @ecatb_notes[:act] unless @ecatb_notes[:act].nil?
  5130.     }
  5131.     @ecatb_notes[:act] = gradual_ecatb_action_gain
  5132.     #
  5133.   end # set_gradual_ecatb_act_gain
  5134.  
  5135.   #----------------------------------------------------------------------------|
  5136.   #  Sets the color of the current atb bar type when its notetags change       |
  5137.   #----------------------------------------------------------------------------|
  5138.   # type: The atb type
  5139.   def set_ecatb_bar_colors(type) # New; Potential Hotspot
  5140.     # Updates the color notetags using the current order of the current atb type
  5141.     @ecatb_notes[type].clear
  5142.     (color_ord = set_ecatb_bar_color_ord(type))[0].each { |data|
  5143.       if send(@ecatb_item[data][0])
  5144.         set_ecatb_bar_color_notes(send(@ecatb_item[data][1]), type)
  5145.       end
  5146.       return if @ecatb_notes[type].size == 2
  5147.     }
  5148.     color_ord[1].each_with_index { |color, i| @ecatb_notes[type][i] ||= color }
  5149.     #
  5150.   end # set_ecatb_bar_colors
  5151.  
  5152.   #----------------------------------------------------------------------------|
  5153.   #  Returns the atb bar color orders and default values for current type      |
  5154.   #----------------------------------------------------------------------------|
  5155.   # type: The atb type
  5156.   def set_ecatb_bar_color_ord(type) # New; Potential Hotspot
  5157.     return [ecatb_bar_color_ord, ecatb_bar_colors] if type == :atb
  5158.     if type == :charge
  5159.       return [ecatb_charge_bar_color_ord, ecatb_charge_bar_colors]
  5160.     elsif type == :cooldown
  5161.       return [ecatb_cooldown_bar_color_ord, ecatb_cooldown_bar_colors]
  5162.     end
  5163.     [[], []] # Does nothing if type stores an invalid value
  5164.   end # set_ecatb_bar_color_ord(type)
  5165.  
  5166.   #----------------------------------------------------------------------------|
  5167.   #  Evaluates the value of all atb bar color notetags using their orderings   |
  5168.   #----------------------------------------------------------------------------|
  5169.   # items: The data containing the notetags
  5170.   # note: The notetag type
  5171.   def set_ecatb_bar_color_notes(items, note) # v0.05a+; New; Potential Hotspot
  5172.     # Reads all item's atb bar color 1 and 2 notetag values
  5173.     ecatb = DoubleX_RMVXA::ECATB
  5174.     items.each { |item|
  5175.       return if @ecatb_notes[note].size >= 2
  5176.       n = item.ecatb_notes[note][0]
  5177.       @ecatb_notes[note][0] ||= ecatb.send(n, self) if n
  5178.       next unless n = item.ecatb_notes[note][1]
  5179.       @ecatb_notes[note][1] ||= ecatb.send(n, self)
  5180.     }
  5181.     #
  5182.   end # set_ecatb_bar_color_notes
  5183.  
  5184.   #----------------------------------------------------------------------------|
  5185.   #  Reads all atb order battler icon, opacity, scale and z notes              |
  5186.   #----------------------------------------------------------------------------|
  5187.   # v0.01a+; New; Potential Hotspot
  5188.   DoubleX_RMVXA::ECATB::ORDER.each_value { |method| module_eval(method) }
  5189.   #
  5190.  
  5191.   #----------------------------------------------------------------------------|
  5192.   #  Sets the current battler ready se when its notetags change                |
  5193.   #----------------------------------------------------------------------------|
  5194.   def set_ecatb_se_ready_act # New
  5195.     # Updates the battler ready se notetags using the current order
  5196.     return @ecatb_notes[:se] unless ecatb_battler_change?(:se)
  5197.     @ecatb_notes[:se] = nil
  5198.     ecatb_se_ready_act_ord.each { |data|
  5199.       if send(@ecatb_item[data][0])
  5200.         set_ecatb_notes(send(@ecatb_item[data][1]), :se)
  5201.       end
  5202.       return @ecatb_notes[:se] if @ecatb_notes[:se]
  5203.     }
  5204.     @ecatb_notes[:se] = ecatb_se_ready_act
  5205.     #
  5206.   end # set_ecatb_se_ready_act
  5207.  
  5208.   #----------------------------------------------------------------------------|
  5209.   #  Sets the current battler action input speed reduction in frames           |
  5210.   #----------------------------------------------------------------------------|
  5211.   def set_ecatb_speed_reduce # v0.02a+; New
  5212.     # Updates the battler speed reduce notetags using the current order
  5213.     ecatb = DoubleX_RMVXA::ECATB
  5214.     ecatb_speed_reduce_ord.each { |data|
  5215.       next unless send(@ecatb_item[data][0])
  5216.       send(@ecatb_item[data][1]).each { |item|
  5217.         (0..(item.ecatb_notes[:speed].size - 1)).each { |index|
  5218.           next unless note = item.ecatb_notes[:speed][index]
  5219.           ecatb.send(note, self)
  5220.         }
  5221.       }
  5222.     }
  5223.     #
  5224.   end # set_ecatb_speed_reduce
  5225.  
  5226.   #----------------------------------------------------------------------------|
  5227.   #  Sets the starting atb value of the start type at the start of a battle    |
  5228.   #----------------------------------------------------------------------------|
  5229.   # start: The battle start type
  5230.   def set_ecatb_start_val(start) # New
  5231.     # Updates the start notetags of the start type using the current order
  5232.     ecatb = DoubleX_RMVXA::ECATB
  5233.     ecatb_start_val_ord.each { |data|
  5234.       next unless send(@ecatb_item[data][0])
  5235.       send(@ecatb_item[data][1]).each { |item|
  5236.         (0..(item.ecatb_notes[start].size - 1)).each { |index|
  5237.           next unless note = item.ecatb_notes[start][index]
  5238.           ecatb.send(note, self)
  5239.         }
  5240.       }
  5241.     }
  5242.     #
  5243.   end # set_ecatb_start_val
  5244.  
  5245.   #----------------------------------------------------------------------------|
  5246.   #  Evaluates the value of all specified notetags using their orderings       |
  5247.   #----------------------------------------------------------------------------|
  5248.   # items: The data containing the notetags
  5249.   # note: The notetag type
  5250.   def set_ecatb_notes(items, note) # New; Potential Hotspot
  5251.     # Reads all item's speficied notetag values until the maximum size's reached
  5252.     ecatb = DoubleX_RMVXA::ECATB
  5253.     items.each { |item|
  5254.       return if @ecatb_notes[note]
  5255.       next unless n = item.ecatb_notes[note]
  5256.       @ecatb_notes[note] = ecatb.send(n, self)
  5257.     }
  5258.     #
  5259.   end # set_ecatb_notes
  5260.  
  5261.   #----------------------------------------------------------------------------|
  5262.   #  Checks if any new notetag added, old one gone or its value changed        |
  5263.   #----------------------------------------------------------------------------|
  5264.   # note: The notetag type to be checked
  5265.   def ecatb_battler_change?(note) # New; Hotspot
  5266.     change = @ecatb_note_change[note]
  5267.     @ecatb_note_change[note] &&= !change
  5268.     return change unless @ecatb_battler_change[note]
  5269.     !(@ecatb_battler_change[note] = false)
  5270.   end # ecatb_battler_change?
  5271.  
  5272.   #----------------------------------------------------------------------------|
  5273.   #  Checks if charging should take place                                      |
  5274.   #----------------------------------------------------------------------------|
  5275.   def ecatb_charge_update? # New; Hotspot
  5276.     return false if @ecatb_val[:cooldown] > 0.0 || @ecatb_val[:atb] < 100.0
  5277.     return false unless current_action
  5278.     return enemy? || current_action.ecatb_confirm if current_action.item
  5279.     !(@ecatb_val[:charge] = 0.0)
  5280.   end # ecatb_charge_update?
  5281.  
  5282.   #----------------------------------------------------------------------------|
  5283.   #  Checks if the unison skill/item can continue charging                     |
  5284.   #----------------------------------------------------------------------------|
  5285.   def ecatb_unison_charge_update? # New; Hotspot
  5286.     return false unless actor? && current_action && item = current_action.item
  5287.     # Rechecks the unison skill/item usability if any unison actor's refreshed
  5288.     return usable?(item) if @ecatb_unison_actors.any?(
  5289.     &DoubleX_RMVXA::ECATB::BLOCKS[:ecatb_refresh])
  5290.     #
  5291.     true
  5292.   end # ecatb_unison_charge_update?
  5293.  
  5294.   #----------------------------------------------------------------------------|
  5295.   #  Checks if the battler's actions should be executed                        |
  5296.   #----------------------------------------------------------------------------|
  5297.   def exec_ecatb_act? # New; Hotspot
  5298.     # Checks if the battler's valid and has valid input being fully charged
  5299.     return false if ecatb_val[:charge] < 100.0 || ecatb_val[:atb] < 100.0
  5300.     enemy? || input && input.item && input.ecatb_confirm
  5301.     #
  5302.   end # exec_ecatb_act?
  5303.  
  5304.   #----------------------------------------------------------------------------|
  5305.   #  Helper methods used by @ecatb_item                                        |
  5306.   #----------------------------------------------------------------------------|
  5307.  
  5308.   def ecatb_states # New; Potential Hotspot
  5309.     @states
  5310.   end # ecatb_states
  5311.  
  5312.   def ecatb_enemy # New; Potential Hotspot
  5313.     [enemy]
  5314.   end # ecatb_enemy
  5315.  
  5316.   def enemy # New; Potential Hotspot
  5317.   end # enemy
  5318.  
  5319.   def armors # New; Potential Hotspot
  5320.     []
  5321.   end # armors
  5322.  
  5323.   def weapons # New; Potential Hotspot
  5324.     []
  5325.   end # armors
  5326.  
  5327.   def ecatb_class # New; Potential Hotspot
  5328.     [self.class]
  5329.   end # ecatb_class
  5330.  
  5331.   def class # New; Potential Hotspot
  5332.   end # class
  5333.  
  5334.   def ecatb_actor # New; Potential Hotspot
  5335.     [actor]
  5336.   end # ecatb_actor
  5337.  
  5338.   def actor # New
  5339.   end # actor
  5340.  
  5341.   #----------------------------------------------------------------------------|
  5342.   #  Lets the compatibility fix deals with compatibility issues                |
  5343.   #----------------------------------------------------------------------------|
  5344.   def ecatb_reset_compatibility? # New
  5345.   end # ecatb_reset_compatibility?
  5346.  
  5347. end # Game_BattlerBase
  5348.  
  5349. #------------------------------------------------------------------------------|
  5350. #  * Implements the battler's atb actions, control flows and logics            |
  5351. #------------------------------------------------------------------------------|
  5352. class Game_Battler < Game_BattlerBase # Edit
  5353.  
  5354.   #----------------------------------------------------------------------------|
  5355.   #  New public instance variables                                             |
  5356.   #----------------------------------------------------------------------------|
  5357.   attr_accessor :ecatb_act_times_add # The action point increment
  5358.   attr_accessor :ecatb_act_times_cap # The action point cap reaching flag
  5359.   attr_accessor :ecatb_refresh # The refresh calling flag
  5360.   attr_accessor :ecatb_reset_val # The atb reset value upon resetting atb
  5361.   attr_accessor :ecatb_unison_invoker # The unison skill/item invoker flag
  5362.   attr_accessor :ecatb_val_change # The atb value change flags
  5363.   attr_reader :ecatb_act_times # The number of action points
  5364.   attr_reader :ecatb_countdown_freeze # The countdown freeze statuses
  5365.   attr_reader :ecatb_note_change # The notetag value change flags
  5366.   attr_reader :ecatb_notes # The caches of all notetags used
  5367.   attr_reader :ecatb_rate # The cached atb rates
  5368.   attr_reader :ecatb_unison_actors # The cached unison actor list
  5369.   attr_reader :ecatb_unison_rule # The cached unison charge/cooldown rule
  5370.   attr_reader :ecatb_val # The atb values
  5371.   attr_writer :ecatb_unison_item # The unison skill/item for damage evaluation
  5372.  
  5373.   #----------------------------------------------------------------------------|
  5374.   #  New private instance variables                                            |
  5375.   #----------------------------------------------------------------------------|
  5376.   # @ecatb_battler_change: The battler data change flags
  5377.   # @ecatb_countdown_updates: The countdown update method iterator block
  5378.   # @ecatb_item: The notetag value reader storing data types with their ordering
  5379.   # @ecatb_item_change: The skill/item usage change flags
  5380.   # @ecatb_speed_reduce: The action input speed frame number
  5381.   # @fail_ecatb_esc: The party escape attempt failure flag
  5382.   # @last_ecatb_item: The last item used/being used
  5383.   # @last_ecatb_rate: The last atb gain rate
  5384.   # @last_ecatb_speed_reduce: The last action input speed frame number
  5385.   # @max_ecatb_act_times The maximum number of action points
  5386.   # @temp_ecatb_act_times The temporary number of action points
  5387.  
  5388.   #----------------------------------------------------------------------------|
  5389.   #  Updates states with different auto removal timing to at different timings |
  5390.   #----------------------------------------------------------------------------|
  5391.   def update_state_turns # Rewrite
  5392.     ecatb_update_state_turns(2) # Rewritten
  5393.   end # update_state_turns
  5394.  
  5395.   #----------------------------------------------------------------------------|
  5396.   #  Fixes bugs and initializes all new variables as well                      |
  5397.   #----------------------------------------------------------------------------|
  5398.   alias initialize_ecatb initialize
  5399.   def initialize(*argv, &argb)
  5400.     initialize_ecatb(*argv, &argb)
  5401.     init_ecatb_vars # Added to let created methods to use new variables as well
  5402.   end # initialize
  5403.  
  5404.   #----------------------------------------------------------------------------|
  5405.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5406.   #----------------------------------------------------------------------------|
  5407.   alias clear_states_ecatb clear_states
  5408.   def clear_states(*argv, &argb)
  5409.     clear_states_ecatb(*argv, &argb)
  5410.     # Added
  5411.     set_ecatb_battler_change
  5412.     @ecatb_countdown_clock = {}
  5413.     @ecatb_countdown_freeze = {}
  5414.     #
  5415.   end # clear_states
  5416.  
  5417.   #----------------------------------------------------------------------------|
  5418.   #  Raises the display redraw and cached notetag value reevaluation flags also|
  5419.   #----------------------------------------------------------------------------|
  5420.   alias add_new_state_ecatb add_new_state # v0.05a+
  5421.   def add_new_state(state_id, &argb)
  5422.     add_new_state_ecatb(state_id, &argb)
  5423.     set_ecatb_battler_change # Added
  5424.   end # add_new_state
  5425.  
  5426.   #----------------------------------------------------------------------------|
  5427.   #  Clears the atb values but not action points in the ecatb battle system    |
  5428.   #----------------------------------------------------------------------------|
  5429.   alias on_restrict_ecatb on_restrict
  5430.   def on_restrict(*argv, &argb)
  5431.     # Rewritten
  5432.     return on_restrict_ecatb(*argv, &argb) unless BattleManager.btype?(:ecatb)
  5433.     #
  5434.     # Added
  5435.     ecatb_reset
  5436.     states.each { |s| remove_state(s.id) if s.remove_by_restriction }
  5437.     #
  5438.   end # on_restrict
  5439.  
  5440.   #----------------------------------------------------------------------------|
  5441.   #  Initializes the state's countdown as well if any                          |
  5442.   #----------------------------------------------------------------------------|
  5443.   alias reset_state_counts_ecatb reset_state_counts
  5444.   def reset_state_counts(state_id, &argb)
  5445.     reset_state_counts_ecatb(state_id, &argb)
  5446.     # Added
  5447.     return unless $data_states[state_id].ecatb_countdown_interval
  5448.     return unless @states.include?(state_id)
  5449.     @ecatb_countdown_clock[state_id] = 0
  5450.     @ecatb_countdown_freeze[state_id] = false
  5451.     #
  5452.   end # reset_state_counts
  5453.  
  5454.   #----------------------------------------------------------------------------|
  5455.   #  Ensures only 1 non forced action can be inputted and executed at a time   |
  5456.   #----------------------------------------------------------------------------|
  5457.   alias make_action_times_ecatb make_action_times
  5458.   def make_action_times(*argv, &argb)
  5459.     # Rewritten
  5460.     BattleManager.btype?(:ecatb) ? 1 : make_action_times_ecatb(*argv, &argb)
  5461.     #
  5462.   end # make_action_times
  5463.  
  5464.   #----------------------------------------------------------------------------|
  5465.   #  Preserves the existing actions but executes the forced one first instead  |
  5466.   #----------------------------------------------------------------------------|
  5467.   alias force_action_ecatb force_action
  5468.   def force_action(skill_id, target_index, &argb)
  5469.     # Added
  5470.     if BattleManager.btype?(:ecatb)
  5471.       return set_ecatb_force_action(skill_id, target_index)
  5472.     end
  5473.     #
  5474.     force_action_ecatb(skill_id, target_index, &argb)
  5475.   end # force_action
  5476.  
  5477.   #----------------------------------------------------------------------------|
  5478.   #  Sets and resets user's methods before and after using an unison skill/item|
  5479.   #----------------------------------------------------------------------------|
  5480.   alias make_damage_value_ecatb make_damage_value
  5481.   def make_damage_value(user, item, &argb)
  5482.     # Added
  5483.     if user.actor? && user.ecatb_unison_actors.size > 1
  5484.       user.ecatb_unison_item = item
  5485.     end
  5486.     #
  5487.     make_damage_value_ecatb(user, item, &argb)
  5488.     user.ecatb_unison_item = nil # Added
  5489.   end # make_damage_value
  5490.  
  5491.   #----------------------------------------------------------------------------|
  5492.   #  Asks all unison invokees to pay the skill/item costs for unison skill/item|
  5493.   #----------------------------------------------------------------------------|
  5494.   alias use_item_ecatb use_item
  5495.   def use_item(item, &argb)
  5496.     # Rewritten
  5497.     return use_item_ecatb(item, &argb) unless BattleManager.btype?(:ecatb)
  5498.     #
  5499.     # Added
  5500.     unless DoubleX_RMVXA::ECATB.send(item.ecatb_charge_prior_item_cost, self)
  5501.       return item.effects.each { |effect| item_global_effect_apply(effect) }
  5502.     end
  5503.     return if @ecatb_unison_actors.size <= 1
  5504.     @ecatb_unison_actors.each { |actor| actor.pay_skill_cost(item) }
  5505.     item.effects.each { |effect| item_global_effect_apply(effect) }
  5506.     #
  5507.   end # use_item
  5508.  
  5509.   #----------------------------------------------------------------------------|
  5510.   #  Updates states with Auto-removal Timing being Action End as well          |
  5511.   #----------------------------------------------------------------------------|
  5512.   alias on_action_end_ecatb on_action_end
  5513.   def on_action_end(*argv, &argb)
  5514.     on_action_end_ecatb(*argv, &argb)
  5515.     ecatb_update_state_turns(1) if BattleManager.btype?(:ecatb) # Added
  5516.   end # on_action_end
  5517.  
  5518.   #----------------------------------------------------------------------------|
  5519.   #  Removes buffs and debuffs having 0 remaining turns as well                |
  5520.   #----------------------------------------------------------------------------|
  5521.   alias on_turn_end_ecatb on_turn_end
  5522.   def on_turn_end(*argv, &argb)
  5523.     on_turn_end_ecatb(*argv, &argb)
  5524.     remove_buffs_auto if BattleManager.btype?(:ecatb) # Added
  5525.   end # on_turn_end
  5526.  
  5527.   #----------------------------------------------------------------------------|
  5528.   #  Frees up unnecessary memory usage upon battle end                         |
  5529.   #----------------------------------------------------------------------------|
  5530.   alias on_battle_end_ecatb on_battle_end
  5531.   def on_battle_end(*argv, &argb) # v0.02c+
  5532.     on_battle_end_ecatb(*argv, &argb)
  5533.     # Added to clear all new variables that are only used in battles
  5534.     clear_ecatb_vars
  5535.     #
  5536.   end # on_battle_end
  5537.  
  5538.   #----------------------------------------------------------------------------|
  5539.   #  Preserves the existing actions but executes the forced one first          |
  5540.   #----------------------------------------------------------------------------|
  5541.   def set_ecatb_force_action(skill_id, target_index) # New
  5542.     @ecatb_unison_invoker = false
  5543.     @ecatb_unison_rule.clear
  5544.     (act = Game_Action.new(self, true)).set_skill(skill_id)
  5545.     if target_index == -2
  5546.       act.target_index = last_target_index
  5547.     elsif target_index == -1
  5548.       act.decide_random_target
  5549.     else
  5550.       act.target_index = target_index
  5551.     end
  5552.     @actions.unshift(act)
  5553.   end # set_ecatb_force_action
  5554.  
  5555.   #----------------------------------------------------------------------------|
  5556.   #  Initializes all new variables before checking any configuration validities|
  5557.   #----------------------------------------------------------------------------|
  5558.   def init_ecatb_vars # New
  5559.     @ecatb_esc = false
  5560.     @ecatb_item_change = {}
  5561.     @ecatb_note_change = {}
  5562.     @ecatb_notes = {}
  5563.     [:atb, :charge, :cooldown].each { |type| @ecatb_notes[type] = [] }
  5564.     @ecatb_unison_actors = []
  5565.     @ecatb_unison_rule = {}
  5566.     init_ecatb_block
  5567.     init_ecatb_item_vars
  5568.     init_ecatb_val_vars
  5569.   end # init_ecatb_vars
  5570.  
  5571.   def init_ecatb_val_vars # New
  5572.     @ecatb_act_times = @ecatb_act_times_add = @temp_ecatb_act_times = 0
  5573.     @ecatb_speed_reduce = @last_ecatb_speed_reduce = 0
  5574.     @ecatb_rate = {}
  5575.     @ecatb_reset_val = 0.0
  5576.     @ecatb_val = { atb: 0.0, charge: 0.0, cooldown: 0.0 }
  5577.     @ecatb_val_change = true
  5578.     @last_ecatb_rate = { charge: -1, cooldown: -1 }
  5579.     @max_ecatb_act_times = 1
  5580.   end # init_ecatb_val_vars
  5581.  
  5582.   def init_ecatb_item_vars # New
  5583.     @ecatb_item = {}
  5584.     notes = [:states, :enemies, :armors, :weapons, :classes, :actors]
  5585.     conds = [:ecatb_states, :enemy?, :actor?, :actor?, :actor?, :actor?]
  5586.     items = [:states, :ecatb_enemy, :armors, :weapons, :ecatb_class,
  5587.              :ecatb_actor]
  5588.     notes.each_with_index { |n, i| @ecatb_item[n] = [conds[i], items[i]] }
  5589.   end # init_ecatb_item_vars
  5590.  
  5591.   #----------------------------------------------------------------------------|
  5592.   #  Initializes the new block to trade memory usage for time performance      |
  5593.   #----------------------------------------------------------------------------|
  5594.   def init_ecatb_block # New
  5595.     # Calls this block instead of an anonymous function per enumerable iteration
  5596.     @ecatb_countdown_updates = -> state_id {
  5597.       next if @ecatb_countdown_freeze[state_id]
  5598.       next if (@ecatb_countdown_clock[state_id] += 1) % ecatb_countdown_min != 0
  5599.       @ecatb_countdown_clock[state_id] %= Graphics.frame_rate * DoubleX_RMVXA::
  5600.       ECATB.send($data_states[state_id].ecatb_countdown_interval, self)
  5601.       next if @ecatb_countdown_clock[state_id] != 0
  5602.       if @state_turns[state_id] > 0
  5603.         @state_turns[state_id] -= 1
  5604.         set_ecatb_battler_change
  5605.       end
  5606.       ecatb_countdown_update_compatibility_3(state_id)
  5607.       next unless @ecatb_battler_sprite
  5608.       ecatb_countdown_update_compatibility_2(@ecatb_battler_sprite, state_id)
  5609.     }
  5610.     #
  5611.   end # init_ecatb_block
  5612.  
  5613.   #----------------------------------------------------------------------------|
  5614.   #  Clears all variables that are useless outside battles upon battle end     |
  5615.   #----------------------------------------------------------------------------|
  5616.   def clear_ecatb_vars # v0.05a+; New
  5617.     clear_ecatb_blocks
  5618.     @ecatb_item = @ecatb_item_change = @ecatb_note_change = @ecatb_notes = nil
  5619.     @ecatb_rate = @ecatb_unison_actors = @ecatb_unison_rule = @ecatb_val = nil
  5620.     @ecatb_val_change = nil
  5621.   end # clear_ecatb_vars
  5622.  
  5623.   #----------------------------------------------------------------------------|
  5624.   #  Clears all cached blocks used in battles                                  |
  5625.   #----------------------------------------------------------------------------|
  5626.   def clear_ecatb_blocks # v0.01a; New
  5627.     # Clears all cached notetag values, the unison actor id list and skill/item
  5628.     if @ecatb_notes[:order_icon]
  5629.       bitmap = @ecatb_notes[:order_icon][0]
  5630.       bitmap.dispose if bitmap && !bitmap.disposed?
  5631.     end
  5632.     [:act, :order_icon, :order_opacity, :order_scale, :order_z, :se].each {
  5633.     |type| @ecatb_notes.delete(type) }
  5634.     [:atb, :charge, :cooldown].each { |type| @ecatb_notes[type].clear }
  5635.     $game_temp.ecatb_unison_actors[self] ||= @ecatb_unison_actors
  5636.     @ecatb_unison_actors.clear
  5637.     $game_temp.last_ecatb_item[self] ||= @last_ecatb_item
  5638.     @ecatb_battler_sprite = @ecatb_countdown_updates = @last_ecatb_item = nil
  5639.     #
  5640.   end # clear_ecatb_blocks
  5641.  
  5642.   #----------------------------------------------------------------------------|
  5643.   #  Resets all cached blocks used in battles                                  |
  5644.   #----------------------------------------------------------------------------|
  5645.   def reset_ecatb_blocks # v0.01a; New
  5646.     # Marks that all cached notetag values have to reread and restores the rest
  5647.     set_ecatb_battler_change
  5648.     if $game_temp.ecatb_unison_actors[self]
  5649.       @ecatb_unison_actors = $game_temp.ecatb_unison_actors.delete(self)
  5650.     end
  5651.     if $game_temp.last_ecatb_item[self]
  5652.       @last_ecatb_item = $game_temp.last_ecatb_item.delete(self)
  5653.     end
  5654.     init_ecatb_block
  5655.     #
  5656.   end # reset_ecatb_blocks
  5657.  
  5658.   # start: The battle start type
  5659.   def set_ecatb_start_val(start = :start_0) # New
  5660.     init_ecatb_vars
  5661.     set_ecatb_battler_change
  5662.     # Applies all the read notetag values to the default starting atb value
  5663.     default_ecatb_start_val(start)
  5664.     super(start)
  5665.     #
  5666.   end # set_ecatb_start_val
  5667.  
  5668.   # timing: The state auto removal timing
  5669.   def ecatb_update_state_turns(timing) # New
  5670.     change = false
  5671.     states.each { |state|
  5672.       next if @state_turns[state.id] <= 0 || state.auto_removal_timing != timing
  5673.       @state_turns[state.id] -= 1
  5674.       change = true
  5675.     }
  5676.     set_ecatb_battler_change if change
  5677.   end # ecatb_update_state_turns
  5678.  
  5679.   #----------------------------------------------------------------------------|
  5680.   #  Performs all the battler's atb frame updates                              |
  5681.   #----------------------------------------------------------------------------|
  5682.   def ecatb_updates # New; Hotspot
  5683.     unless @ecatb_val[:atb] <= 100.0 || set_gradual_ecatb_act_gain
  5684.       @temp_ecatb_act_times = @max_ecatb_act_times
  5685.       @ecatb_val[:atb] = 100.0
  5686.       @max_ecatb_act_times = 1
  5687.     end
  5688.     return unless @ecatb_esc || movable = restriction < 4
  5689.     # Updates the atb values, speed and countdown statuses and makes actions
  5690.     ecatb_val_updates(movable)
  5691.     ecatb_countdown_update unless @ecatb_countdown_clock.empty?
  5692.     #
  5693.   end # ecatb_updates
  5694.  
  5695.   #----------------------------------------------------------------------------|
  5696.   #  (v0.04c)Updates atb, charge and cooldown, speed reduce and makes actions  |
  5697.   #----------------------------------------------------------------------------|
  5698.   def ecatb_val_updates(movable) # New; Hotspot
  5699.     return ecatb_charge_update if @ecatb_esc || movable && ecatb_charge_update?
  5700.     if !@ecatb_esc && movable
  5701.       return ecatb_cooldown_update if @ecatb_val[:cooldown] > 0.0
  5702.       ecatb_update if @ecatb_val[:atb] < 100.0 * @max_ecatb_act_times
  5703.       return if @ecatb_val[:atb] < 100.0
  5704.       return ecatb_speed_reduce_update if @ecatb_speed_reduce > 0
  5705.     end
  5706.     make_ecatb_act unless @ecatb_val[:atb] < 100.0 || @ecatb_val[:charge] >
  5707.     0.0 || ecatb_reset_compatibility? || actor? && inputable? &&
  5708.     current_action && current_action.item && current_action.ecatb_confirm
  5709.   end # ecatb_val_updates
  5710.  
  5711.   #----------------------------------------------------------------------------|
  5712.   #  Updates the atb cooldown value and triggers cooldown finish upon finishing|
  5713.   #----------------------------------------------------------------------------|
  5714.   def ecatb_cooldown_update # New; Hotspot
  5715.     @ecatb_val[:cooldown] -= ecatb_cooldown_loss_rate
  5716.     return if @ecatb_val[:cooldown] > 0.0
  5717.     @ecatb_val[:cooldown] = 0.0 if @ecatb_val[:cooldown] < 0.0
  5718.     @ecatb_unison_actors.clear
  5719.     @ecatb_unison_invoker = @fail_ecatb_esc = false
  5720.     @ecatb_unison_rule.clear
  5721.     ecatb_cooldown_finish
  5722.   end # ecatb_cooldown_update
  5723.  
  5724.   def ecatb_update # New; Hotspot
  5725.     # Raises the change flag upon atb value change and caps it to its max
  5726.     @ecatb_val_change = @ecatb_val[:atb] != @ecatb_val[:atb] += ecatb_gain_rate
  5727.     max = 100.0 * @max_ecatb_act_times
  5728.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5729.     #
  5730.   end # ecatb_update
  5731.  
  5732.   #----------------------------------------------------------------------------|
  5733.   #  Updates the atb action input speed reduction by frames                    |
  5734.   #----------------------------------------------------------------------------|
  5735.   def ecatb_speed_reduce_update # v0.02a+; New; Hotspot
  5736.     # Returns the cached value unless it's to be reevalauted
  5737.     return set_ecatb_speed_reduce if ecatb_battler_change?(:speed)
  5738.     @ecatb_speed_reduce = 0 if (@ecatb_speed_reduce -= 1) < 0
  5739.     #
  5740.   end # ecatb_speed_reduce_update
  5741.  
  5742.   #----------------------------------------------------------------------------|
  5743.   #  Sets the atb action input speed reduction by frames                       |
  5744.   #----------------------------------------------------------------------------|
  5745.   def set_ecatb_speed_reduce # v0.02a+; New; Potential Hotspot
  5746.     # Adds the difference between the new and old to the current speed reduction
  5747.     last_speed_reduce = @last_ecatb_speed_reduce
  5748.     ecatb_speed_reduce
  5749.     super
  5750.     @ecatb_speed_reduce += @last_ecatb_speed_reduce - last_speed_reduce
  5751.     @ecatb_speed_reduce = 0 if @ecatb_speed_reduce < 0
  5752.     #
  5753.   end # set_ecatb_speed_reduce
  5754.  
  5755.   #----------------------------------------------------------------------------|
  5756.   #  Updates the atb charge value including the unison version                 |
  5757.   #----------------------------------------------------------------------------|
  5758.   def ecatb_charge_update # New; Hotspot
  5759.     unless @ecatb_unison_actors.size <= 1 || ecatb_unison_charge_update?
  5760.       return ecatb_reset
  5761.     end
  5762.     @ecatb_val[:charge] += ecatb_charge_gain_rate
  5763.     @ecatb_val[:charge] = 100.0 if @ecatb_val[:charge] > 100.0
  5764.   end # ecatb_charge_update
  5765.  
  5766.   #----------------------------------------------------------------------------|
  5767.   #  Makes actions and marks the battler as actable upon becoming able to act  |
  5768.   #----------------------------------------------------------------------------|
  5769.   def make_ecatb_act # New; Hotspot
  5770.     if @ecatb_act_times <= 0
  5771.       make_gradual_ecatb_act_gain
  5772.     elsif @ecatb_val[:atb] > 100.0
  5773.       make_ecatb_act_pool
  5774.     end
  5775.     BattleManager.make_ecatb_act(self)
  5776.   end # make_ecatb_act
  5777.  
  5778.   def make_gradual_ecatb_act_gain # v0.05a+; New
  5779.     unless set_gradual_ecatb_act_gain
  5780.       return @ecatb_act_times_add = @ecatb_act_times =
  5781.       @temp_ecatb_act_times = make_action_times_ecatb
  5782.     end
  5783.     @ecatb_act_times_add = @ecatb_act_times = @temp_ecatb_act_times = 1
  5784.     @max_ecatb_act_times = make_action_times_ecatb
  5785.     # Prevents the previously reset atb value from exceeding the new maximum
  5786.     max = 100.0 * @max_ecatb_act_times
  5787.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5788.     #
  5789.     set_ecatb_battler_change
  5790.   end # make_gradual_ecatb_act_gain
  5791.  
  5792.   #----------------------------------------------------------------------------|
  5793.   #  Synchronize the party/troop action point pool when changing action points |
  5794.   #----------------------------------------------------------------------------|
  5795.   def make_ecatb_act_pool # v0.05a+; New; Hotspot
  5796.     # Ensures that all party/troop members change their action points together
  5797.     return if
  5798.     (act_add = @ecatb_val[:atb].to_i / 100 - @temp_ecatb_act_times) == 0
  5799.     @ecatb_act_times_add = act_add
  5800.     return if @ecatb_act_times_cap =
  5801.     @temp_ecatb_act_times >= @max_ecatb_act_times
  5802.     @ecatb_act_times += @ecatb_act_times_add
  5803.     @temp_ecatb_act_times += @ecatb_act_times_add
  5804.     set_ecatb_battler_change
  5805.     #
  5806.   end # make_ecatb_act_pool
  5807.  
  5808.   #----------------------------------------------------------------------------|
  5809.   #  Updates all states' countdown clocks that aren't frozen if any            |
  5810.   #----------------------------------------------------------------------------|
  5811.   def ecatb_countdown_update # New; Hotspot
  5812.     @ecatb_battler_sprite ||= ecatb_countdown_update_compatibility_1
  5813.     # Checks if the clocks are divisible by seconds to boost time performance
  5814.     @ecatb_countdown_clock.each_key(&@ecatb_countdown_updates)
  5815.     #
  5816.     remove_states_auto(3)
  5817.   end # ecatb_countdown_update
  5818.  
  5819.   def confirm_ecatb_item # New
  5820.     # Recaches the cached values upon changes and pays costs now if specified
  5821.     @ecatb_item_change[:charge] = @ecatb_item_change[:cooldown] =
  5822.     @last_ecatb_item != @last_ecatb_item = current_action.item
  5823.     pay_prior_ecatb_charge if @last_ecatb_item
  5824.     #
  5825.   end # confirm_ecatb_item
  5826.  
  5827.   def pay_prior_ecatb_charge # New
  5828.     ecatb = DoubleX_RMVXA::ECATB
  5829.     unless ecatb.send(@last_ecatb_item.ecatb_charge_prior_act_cost, self)
  5830.       pay_ecatb_unison_act_cost
  5831.     end
  5832.     return if ecatb.send(@last_ecatb_item.ecatb_charge_prior_item_cost, self)
  5833.     return consume_item(@last_ecatb_item) if @last_ecatb_item.is_a?(RPG::Item)
  5834.     pay_skill_cost(@last_ecatb_item) if @last_ecatb_item.is_a?(RPG::Skill)
  5835.   end # pay_prior_ecatb_charge
  5836.  
  5837.   #----------------------------------------------------------------------------|
  5838.   #  Pays the action cost and sets the atb reset value unless it's forced      |
  5839.   #----------------------------------------------------------------------------|
  5840.   # forced: The action force flag
  5841.   def exec_ecatb_act_cost(forced) # New
  5842.     return unless current_action && item = current_action.item
  5843.     ecatb = DoubleX_RMVXA::ECATB
  5844.     if (force_act_cost = ecatb.send(item.ecatb_force_act_cost, self)) || !forced
  5845.       # Pays the action cost now if the skill/item requests so
  5846.       if ecatb.send(item.ecatb_charge_prior_act_cost, self)
  5847.         pay_ecatb_unison_act_cost
  5848.       end
  5849.       #
  5850.       set_ecatb_reset_val
  5851.     end
  5852.     force_act_cost
  5853.   end # exec_ecatb_act_cost
  5854.  
  5855.   def pay_ecatb_unison_act_cost # New
  5856.     return pay_ecatb_act_cost if @ecatb_unison_actors.size <= 1
  5857.     @ecatb_unison_actors.each(
  5858.     &DoubleX_RMVXA::ECATB::BLOCKS[:pay_ecatb_act_cost])
  5859.   end # pay_ecatb_unison_act_cost
  5860.  
  5861.   def pay_ecatb_act_cost # New
  5862.     return unless current_action && item = current_action.item
  5863.     set_ecatb_battler_change
  5864.     cost = DoubleX_RMVXA::ECATB.send(item.ecatb_act_cost, self)
  5865.     @temp_ecatb_act_times -= cost
  5866.     unless friends_unit.ecatb_pool
  5867.       @ecatb_val[:atb] -= cost * 100.0 if set_gradual_ecatb_act_gain
  5868.       return @ecatb_act_times -= cost
  5869.     end
  5870.     size = (members = friends_unit.alive_members).size
  5871.     members.each { |mem|
  5872.       mem.ecatb_act_times -= cost
  5873.       next unless mem.set_gradual_ecatb_act_gain
  5874.       mem.ecatb_val[:atb] -= cost * 100.0 / size
  5875.     }
  5876.   end # pay_ecatb_act_cost
  5877.  
  5878.   def set_ecatb_reset_val # New
  5879.     # Sets all unison invokee's atb reset values as well for unison skill/item
  5880.     val = current_action.item.ecatb_reset_val
  5881.     @ecatb_reset_val = (ecatb = DoubleX_RMVXA::ECATB).send(val, self)
  5882.     return if @ecatb_unison_actors.size <= 1
  5883.     (@ecatb_unison_actors & $game_party.alive_members).each{ |actor|
  5884.       actor.ecatb_reset_val = ecatb.send(val, actor)
  5885.     }
  5886.     #
  5887.   end # set_ecatb_reset_val
  5888.  
  5889.   #----------------------------------------------------------------------------|
  5890.   #  Resets the atb values and reset value, speed reduce and action points     |
  5891.   #----------------------------------------------------------------------------|
  5892.   # reset: The atb reset flag
  5893.   def ecatb_reset(reset = restriction > 3) # New
  5894.     # Pays the escape cost, refreshes the battler and triggers the pre and post
  5895.     pre_ecatb_reset
  5896.     pay_ecatb_esc_cost if @ecatb_esc
  5897.     @ecatb_speed_reduce = 0
  5898.     @ecatb_val_change = true
  5899.     return ecatb_val_reset_compatibility(reset) if ecatb_reset_compatibility?
  5900.     BattleManager.del_ecatb_act(self)
  5901.     ecatb_act_val_reset(reset)
  5902.     post_ecatb_reset
  5903.     set_ecatb_battler_change
  5904.     #
  5905.   end # ecatb_reset
  5906.  
  5907.   # reset: The atb reset flag
  5908.   def ecatb_act_val_reset(reset) # New
  5909.     @ecatb_val[:cooldown] = 0.0 if dead?
  5910.     use_ecatb_reset_val if reset || @ecatb_act_times <= 0
  5911.     @temp_ecatb_act_times = @ecatb_act_times = 0 if reset &&
  5912.     @ecatb_act_times > 0
  5913.     @max_ecatb_act_times = 1 if reset || @ecatb_act_times <= 0
  5914.     ecatb_unison_reset(reset)
  5915.     @ecatb_val[:charge] = 0.0
  5916.     return if @ecatb_act_times > 0 && index && restriction <= 0
  5917.     @ecatb_reset_val = 0.0
  5918.   end # ecatb_act_val_reset
  5919.  
  5920.   def use_ecatb_reset_val # v0.04d+; New
  5921.     BattleManager.ecatb_pool_reset(self, @ecatb_unison_actors) if
  5922.     friends_unit.ecatb_pool
  5923.     @ecatb_val[:atb] = @ecatb_reset_val
  5924.     return @ecatb_val[:atb] = 0.0 if @ecatb_val[:atb] < 0.0
  5925.     max = 100.0 * @max_ecatb_act_times
  5926.     @ecatb_val[:atb] = max if @ecatb_val[:atb] > max
  5927.   end # use_ecatb_reset_val
  5928.  
  5929.   def ecatb_unison_reset(reset) # v0.05a+; New
  5930.     # Clears the unison actor and invoker cache if there's no unison cooldown
  5931.     if reset || @ecatb_val[:charge] < 100.0
  5932.       @ecatb_unison_actors.clear
  5933.       @ecatb_unison_invoker = false
  5934.       return @ecatb_unison_rule.clear
  5935.     end
  5936.     #
  5937.     @ecatb_val[:cooldown] = 100.0
  5938.   end # ecatb_unison_reset
  5939.  
  5940.   #----------------------------------------------------------------------------|
  5941.   #  Lets the compatibility fix deals with compatibility issues                |
  5942.   #----------------------------------------------------------------------------|
  5943.  
  5944.   def ecatb_countdown_update_compatibility_1 # New; Hotspot
  5945.   end # ecatb_countdown_update_compatibility_1
  5946.  
  5947.   def ecatb_countdown_update_compatibility_2(battler_sprite, state_id) # New;
  5948.   # Potential Hotspot
  5949.   end # ecatb_countdown_update_compatibility_2
  5950.  
  5951.   def ecatb_countdown_update_compatibility_3(state_id) # New; Potential Hotspot
  5952.   end # ecatb_countdown_update_compatibility_3
  5953.  
  5954.   # reset: The atb reset flag
  5955.   def ecatb_val_reset_compatibility(reset) # New
  5956.   end # ecatb_val_reset_compatibility
  5957.  
  5958. end # Game_Battler
  5959.  
  5960. #------------------------------------------------------------------------------|
  5961. #  * Implements the actor's additional atb actions, control flows and logics   |
  5962. #------------------------------------------------------------------------------|
  5963. class Game_Actor < Game_Battler # Edit
  5964.  
  5965.   #----------------------------------------------------------------------------|
  5966.   #  New public instance variable                                              |
  5967.   #----------------------------------------------------------------------------|
  5968.   attr_accessor :ecatb_esc # The party escape attempt flag
  5969.  
  5970.   #----------------------------------------------------------------------------|
  5971.   #  New private instance variable                                             |
  5972.   #----------------------------------------------------------------------------|
  5973.   # @ecatb_reserve: The reserved member flag
  5974.  
  5975.   #----------------------------------------------------------------------------|
  5976.   #  Creates new methods of all configurations used by actors as well          |
  5977.   #----------------------------------------------------------------------------|
  5978.   alias setup_ecatb setup
  5979.   def setup(actor_id, &argb)
  5980.     setup_ecatb(actor_id, &argb)
  5981.     # Added to fix nil @action_input_index and actors added during battle bugs
  5982.     @action_input_index = 0
  5983.     @ecatb_reserve = true
  5984.     create_ecatb_defs
  5985.     #
  5986.   end # setup
  5987.  
  5988.   #----------------------------------------------------------------------------|
  5989.   #  Confirms inputs made with the auto battle status as well                  |
  5990.   #----------------------------------------------------------------------------|
  5991.   alias make_auto_battle_actions_ecatb make_auto_battle_actions
  5992.   def make_auto_battle_actions(*argv, &argb) # v0.00d+
  5993.     make_auto_battle_actions_ecatb(*argv, &argb)
  5994.     # Added
  5995.     return unless BattleManager.btype?(:ecatb)
  5996.     confirm_ecatb_item
  5997.     set_ecatb_speed_reduce
  5998.     #
  5999.   end # make_auto_battle_actions
  6000.  
  6001.   #----------------------------------------------------------------------------|
  6002.   #  Confirms inputs made with the confusion status as well                    |
  6003.   #----------------------------------------------------------------------------|
  6004.   alias make_confusion_actions_ecatb make_confusion_actions
  6005.   def make_confusion_actions(*argv, &argb) # v0.00d+
  6006.     make_confusion_actions_ecatb(*argv, &argb)
  6007.     # Added
  6008.     return unless BattleManager.btype?(:ecatb)
  6009.     confirm_ecatb_item
  6010.     set_ecatb_speed_reduce
  6011.     #
  6012.   end # make_confusion_actions
  6013.  
  6014.   #----------------------------------------------------------------------------|
  6015.   #  Ensures actors added during battles are properly initialized as well      |
  6016.   #----------------------------------------------------------------------------|
  6017.   def on_battle_end(*argv, &argb) # v0.04e+; New
  6018.     super(*argv, &argb)
  6019.     @ecatb_reserve = true
  6020.   end # on_battle_end
  6021.  
  6022.   #----------------------------------------------------------------------------|
  6023.   #  Creates and checks the associated method for each configuration used here |
  6024.   #----------------------------------------------------------------------------|
  6025.   # config: The configuration requesting its associated method
  6026.   # validate: The configuration value validation flag
  6027.   def create_ecatb_def(config, validate = true) # New
  6028.     # Uses the name and value of configuration as its method's name and contents
  6029.     method = config.id2name
  6030.     eval(%Q(
  6031.   def #{method}#{DoubleX_RMVXA::ECATB::GAME_ACTOR[config][0]}
  6032.     #{$game_system.send(config)}
  6033.   end
  6034.     ))
  6035.     #
  6036.     return unless validate
  6037.     check_ecatb_def(method, DoubleX_RMVXA::ECATB::GAME_ACTOR[config])
  6038.   end # create_ecatb_def
  6039.  
  6040.   #----------------------------------------------------------------------------|
  6041.   #  Checks all new methods and resets them to the defaults if they're invalid |
  6042.   #----------------------------------------------------------------------------|
  6043.   module_eval(DoubleX_RMVXA::ECATB::CHECK_RESET_DEF[:GAME_ACTOR]) # New
  6044.  
  6045.   #----------------------------------------------------------------------------|
  6046.   #  Ensures actors added during battles are properly initialized as well      |
  6047.   #----------------------------------------------------------------------------|
  6048.   def set_ecatb_start_val(start = :start_0) # v0.04e+; New
  6049.     super(start)
  6050.     @ecatb_reserve = false
  6051.   end # set_ecatb_start_val
  6052.  
  6053.   # start: The battle start type
  6054.   def default_ecatb_start_val(start) # New
  6055.     return normal_actor_1st_ecatb_val if start == :start_0
  6056.     return