SHARE
TWEET

DoubleX RMVXA Enhanced YSA Battle System: Classical ATB

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