SHARE
TWEET

Falcao ABS Patch by Sixth

TheSixth Sep 2nd, 2015 (edited) 1,028 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2. DO READ THIS PART! I MEAN IT!
  3.  
  4. Since I am getting tired of answering the exact same question over and over
  5. again, I will just leave this little note here, at the top, thinking that maybe,
  6. just maybe, someone will actually read it before asking questions and/or
  7. reporting bugs which aren't even bugs...
  8.  
  9. Read the green letters below! Read! Read them, just once! All of it.
  10. If you are still thinking about asking THAT question or reporting THAT "bug"
  11. after reading the green letters I wrote (for some mysterious reason, starting
  12. to think that it is just a colossal waste of time to even try to write a
  13. documentation for any script, since no one reads them if they are longer than
  14. 5 lines anyway...), please read those meany green letters again, carefully.
  15. IF you are still convinced that you have a valid question or a valid bug report,
  16. feel free to PM me on the forums.
  17.  
  18. There, now you can start reading that documentation for real, thanks!
  19. =end
  20. #===============================================================================
  21. # * [ACE] Bug Fixes for Falcao's Pearl ABS Liquid v3
  22. #===============================================================================
  23. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  24. # * Version: 2.2
  25. # * Updated: 08/01/2017
  26. # * Requires: Falcao's Pearl ABS Liquid v3
  27. #-------------------------------------------------------------------------------
  28. # * < Change Log >
  29. #-------------------------------------------------------------------------------
  30. # * Version 1.0 (01/08/2015)
  31. #   - Initial release.
  32. # * Version 1.1 (08/08/2015)
  33. #   - Added settings to enable/disable the regen popups at will.
  34. #     Cut-scenes just don't look nice while random numbers are on the screen...
  35. #   - Added global cooldown note-tags for items.
  36. #     You can now prevent the player from executing multiple tools at the same
  37. #     time, so no more shooting fireballs and swinging your sword around while
  38. #     drinking a potion, those times are over!
  39. # * Version 1.2 (27/08/2015)
  40. #   - Added in the boss HP bar hiding feature.
  41. #     You can now manually hide the HP bar of bosses anytime with eventing.
  42. #   - Restored KO effect by slip damage.
  43. # * Version 1.3 (28/08/2015)
  44. #   - Fixed an issue with the enemy auto-turn on casting feature.
  45. #     Weapon and armor tools should no longer crash the game.
  46. #   - Added in thanasulas's fix for the combo delay issue.
  47. #   - I kinda missed the confusion state from this ABS, so...
  48. #     Added a way to make confusion states possible in the ABS.
  49. #     A character inflicted with confusion will get it's directions messed up!
  50. #     This feature is optional, and configurable.
  51. # * Version 1.4 (02/09/2015)
  52. #   - Fixed damage reduction on guarding. Damage will only be reduced if the
  53. #     shield's user is facing towards the incoming tool attack.
  54. #     The guarding state must be the default one (state 9) for this to work!
  55. #   - Guarding did not work properly against tools with bigger sizes.
  56. #     This is now fixed as well.
  57. #   - Added a script call for changing the HP of the enemies manually.
  58. #   - Added a note-tag that lets you make tools with "irregular" sizes.
  59. #     This means that you are not limited to make tools with the same width and
  60. #     height anymore. You can make a tool with 8 width and 1 height if you want,
  61. #     for example (firewall, anyone?).
  62. #   - Added a note-tag for reversing the targets of a tool. Since tools which
  63. #     target allies work differently than tools which target enemies, it was not
  64. #     possible to make a "Healing Glyph" skill, for example, without it healing
  65. #     the enemies as well as the party members in range. Now you can make tools
  66. #     like that and make them only affect the party/enemies, not both.
  67. #   - Changed the way the effect of the tools are triggered. Turns out I did
  68. #     this long time ago, and forgot about it. This resulted in me giving out
  69. #     wrong advice on the forums. Now you can manipulate how many times a tool
  70. #     hits the target(s) by adjusting it's effect and destroy delay properly.
  71. #     For example, if you set the effect delay to 60, the tool would trigger
  72. #     it's effect in every 60 seconds but only if the tool is not yet destroyed
  73. #     (so the tool's destroy delay must be at least 2x more + 2 than the effect
  74. #     delay to make a 2-hit tool, or it must be at least 3x more + 3 to make a
  75. #     3-hit tool, and so on)!
  76. #   - By default, tools are destroyed immediately when the target guards it
  77. #     completely ("Guard" text pops up). There are some tools which would not
  78. #     work like this (Healing Glyph, Firewall, etc). Now you can note-tag your
  79. #     tools to prevent their destruction when the target guards them.
  80. #   - By default, all of the tools can be guarded, be it a restorative one or
  81. #     an offensive one. You can note-tag any tools to make them ignore guarding.
  82. #   - By default, if the target is hit by an offensive tool, the target gets a
  83. #     20 frames long invincibility effect (can not be hit with any other tool
  84. #     for 20 frames). If the target is hit by multiple tools at the same time,
  85. #     it is possible that only one of them will trigger it's effect, and I did
  86. #     not like it this way. Also, since I changed the way when the effects are
  87. #     triggered, this function is not really needed anymore, so I added an
  88. #     option to completely remove it. This is an optional feature.
  89. # * Version 1.5 (04/09/2015)
  90. #   - Made the new effect trigger feature an optional one.
  91. #     Now you can use a note-tag to use my new effect trigger type.
  92. #     Tools without that note-tag will behave the default way.
  93. #   - Made another optional note-tag to set the invincible time of the targets
  94. #     on a per tool basis instead of a global time for all tools.
  95. #     You can set the default invincible time in the settings, and if you omit
  96. #     the note-tag for this, that value will be loaded by default.
  97. #   - Enemy sensors did not reset after a map change. This resulted in every
  98. #     enemy in the range of the player when the map transfer took place
  99. #     instantly become active after returning to the map at any later point,
  100. #     regardless if the enemies were in range after a map reset or not.
  101. #     This should be fixed now.
  102. # * Version 1.6 (05/10/2015)
  103. #   - Enemy sensors were turned ON/OFF even for dead enemies.
  104. #     This is not the case anymore.
  105. #     This might increase performance if you have a lot of enemies on a map.
  106. #   - Calling the tool/character selection menu was possible even when the
  107. #     interpreter was running (during non-parallel events). This is fixed.
  108. #   - Triggering a tool was possible even when the interpreter was running
  109. #     (during non-parallel events). This is fixed.
  110. #   - Added a switch setting to enable/disable the ABS tool triggers without
  111. #     hiding the HUD.
  112. #   - Added an experimental reflect feature. You can use it just like the normal
  113. #     reflect feature, just add MRF to your actors/enemies/equips/etc in the
  114. #     database. You can set which tools ignore the reflect state with a note-tag.
  115. # * Version 1.7 (06/05/2016)
  116. #   - Added compatibility for Pikakapi's Battle Royale Addon.
  117. #   - Fixed dual wield issues on tool usage. From now on, it will use the
  118. #     correct tool type for dual wielding actors (meaning weapon tools and not
  119. #     armor tools).
  120. #   - It was not possible to equip weapons on the second tool slot from the
  121. #     quick tool menu Falcao made. That is now fixed. It will check the actor's
  122. #     second equip slot to determine if it should include weapons or armors on
  123. #     the tool list. This is kinda necessary for the actors with dual wield
  124. #     features.
  125. #   - Now you can unequip any tool from the quick tool menu by pressing it's
  126. #     hotkey in the menu. It was not possible to do this before.
  127. # * Version 1.8 (06/05/2016)
  128. #   - Actors couldn't be equipped with any skills gained from equipment, state,
  129. #     class or actor features with the 'set_skill' script call. Fixed it.
  130. # * Version 1.9 (01/07/2016)
  131. #   - The characters will now be considered to be "acting" even if they guard.
  132. #   - Added a compatibility patch for my Equip Engine. That is a private script,
  133. #     so, if you are not me or the owner of that script, you don't have to worry
  134. #     about this!
  135. # * Version 2.0 (22/07/2016)
  136. #   - When used ally targeting items, the effect was based on the targets'
  137. #     parameters instead of the user's parameters like it should be.
  138. #     This is now fixed.
  139. #   - Added a compatibility patch for my ABS Battle Royale script.
  140. #     This is a private script, so if you are not me or the owner of that
  141. #     script, you don't have to worry about this one!
  142. # * Version 2.1 (03/08/2016)
  143. #   - Defeated enemy events did not reset their passive state.
  144. #     This is now fixed.
  145. # * Version 2.2 (08/01/2017)
  146. #   - Fixed a crash issue for enemies with the "Enemy Die Self Switch = x"
  147. #     note-tag.
  148. #   - Fixed drop items not showing up when using the above mentioned note-tag
  149. #     on an enemy.
  150. #-------------------------------------------------------------------------------
  151. # * < Description >
  152. #-------------------------------------------------------------------------------
  153. # * This script fixes several bugs/weird behaviors found in Falcao's ABS, and
  154. #   adds some new (optional) features too.
  155. #   These include:
  156. #   - The cooldown of the tools are updated even in the menu(s). Fixed.
  157. #   - The player is able to change tools on cooldown. Fixed.
  158. #   - The player is able to equip the same items/skills more than one time.
  159. #     Fixed. Even if this is not a real thing which needed a fix, it was
  160. #     necessary for the previous fix to work.
  161. #   - The animation frames on iconset animation are wrong when the player faces
  162. #     down. Fixed.
  163. #   - The dead icon sprites above dead party members are not disposed upon a
  164. #     map change. Fixed.
  165. #   - The boss bar will not get disposed upon a map change. Fixed.
  166. #   - The HP/MP/TP regen features are only working if these features are gained
  167. #     with a state. Actor, class, equipment regen features aren't working. Fixed.
  168. #   - HP/MP/TP regen states restore/damage the player in completely random
  169. #     time intervals. Fixed. All regen effects will be executed in every second
  170. #     from now on, instead of randomly triggering.
  171. #   - Characters are able to move around freely even when they are in the middle
  172. #     of casting. Fixed. This fix can be disabled at will.
  173. #   - Even if you disable the player's movement on casting, you can still allow
  174. #     the player to change directions during casting. This is not really a fix,
  175. #     more like an optional feature which might come in handy if you disable
  176. #     the player's movement during casting.
  177. #   - It is not possible to disable a hotkey for a tool slot. Fixed. You can now
  178. #     set 'nil' (without the apostrophes) for a tool's key setting to disable
  179. #     that tool entirely. Note that it won't remove the visuals for the tool,
  180. #     just restricts the usage of it!
  181. #   - The player is able to trigger multiple tools at the same time. Fixed.
  182. #     You need to tag your tools with the global cooldown note-tag for this!
  183. #   - No way to implement any kind of confusion states. "Fixed".
  184. #     Well, more like "added"...
  185. #   - Multiple issues are found with the guard feature. Fixed.
  186. #   - Added a new, optional feature for inverting the scope of the tools.
  187. #   - Added a new, optional feature for changing the effect trigger type of
  188. #     the tools.
  189. #   - Added a new, optional feature for setting custom invincible times for
  190. #     your tools.
  191. #   - Added a new, optional feature for more freedom in creating tool sizes
  192. #     with different width and height.
  193. #-------------------------------------------------------------------------------
  194. # * < Script Calls>
  195. #-------------------------------------------------------------------------------
  196. # * To hide the boss HP bar manually during the game, use this script call:
  197. #
  198. #     hide_boss_bar
  199. #
  200. #   This can come in handy in eventing.
  201. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  202. # * To manually change an enemy's HP, you can use this script call:
  203. #
  204. #     change_enemy_hp(id,val,allow_ko)
  205. #
  206. #   id = The ID of the event on the map (NOT the ID of the enemy!).
  207. #   val = The HP change value.
  208. #   allow_ko = This can be true or false. If true, the enemy can be killed with
  209. #              the script call in case it reaches 0 HP. If false, the enemy can
  210. #              not be killed with the script call (the enemy's HP will not be
  211. #              reduced below 1 HP ever).
  212. #              This can be omitted at will. The default value is true, so if you
  213. #              omit it, it will default to true.
  214. #
  215. #   Examples:
  216. #  
  217. #     change_enemy_hp(2,-50,true)
  218. #   This would reduce the HP of the event with ID 2 by 50, and in case it
  219. #   reaches 0 HP, it will die.
  220. #
  221. #     change_enemy_hp(2,-9999,false)
  222. #   Same as above, but this time it reduces 9999 HP and the enemy will not be
  223. #   killed no matter how many HP it had before the script call.
  224. #
  225. #     change_enemy_hp(2,200)
  226. #   This would add 200 HP to the enemy (for the event with ID 2 on the map).
  227. #-------------------------------------------------------------------------------
  228. # * < Note-tags >
  229. #-------------------------------------------------------------------------------
  230. # * To prevent the player from triggering multiple tools at the same time, you
  231. #   must tag your tools with the following note-tag:
  232. #
  233. #     Tool Global Cool = time
  234. #
  235. #   The 'time' is the number of frames the character (so any character who can
  236. #   use tools, not just the player) can NOT execute any other skills after using
  237. #   the note-tagged tool.
  238. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  239. # * To reverse the targets of the tool, you can use this note-tag:
  240. #
  241. #     <reverse target>
  242. #
  243. #   This means that if you set the scope of the tool for "All Allies" in the
  244. #   database, and use this note-tag on the tool, it would hit all opponents,
  245. #   instead of hitting all allies.
  246. #   By default, tools with "One Ally", "All Allies", "One Ally (KO)" and
  247. #   "All Allies (KO)" can not trigger their effects multiple times, only once,
  248. #   regardless of their tool effect/destroy time. The easiest way to make that
  249. #   happen is to reverse the scope of the target, and that is why this note-tag
  250. #   has been made.
  251. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  252. # * To make the tool ignore the guard effect (damage reduction, and full guard),
  253. #   use the following note-tag:
  254. #
  255. #     <ignore guard>
  256. #
  257. #   This will make the tool be completely "un-guardable".
  258. #   I'm pretty sure that this word does not exist, but who cares, right? :D
  259. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  260. # * To make the tool ignore the reflect effect use the following note-tag:
  261. #
  262. #     <ignore reflect>
  263. #
  264. #   This will make the tool ignore the reflection and hit the target.
  265. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  266. # * To make the tool stay even if the target guarded it,
  267. #   use the following note-tag:
  268. #
  269. #     <no guard destroy>
  270. #
  271. #   This will prevent the destruction of the tool if the target guards it.
  272. #   Useful for multiple-hit and area effect tools.
  273. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  274. # * To set a custom invincibility frame for your tools, you can use the
  275. #   following note-tag:
  276. #
  277. #     <inv time: time>
  278. #
  279. #   Replace 'time' with the time you want the target to be invincible after it's
  280. #   hit with the (offensive) tool.
  281. #   This is measured in frames, so 60 means 1 second!
  282. #   If the target's invincibility frame is not 0, it can NOT be hit with any
  283. #   offensive tools! An offensive tool means that it's scope is one of these:
  284. #   One Enemy, All Enemy, X Random Enemies.
  285. #   Invincibility frames are only triggered by offensive tools, regardless of
  286. #   their effects (so, even a HP recovering tool will trigger it)!
  287. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  288. # * To use my new way of triggering the effects of the tools, use the following
  289. #   note-tag:
  290. #
  291. #     <new effect delay>   <inv time: 0>
  292. #
  293. #   This will make the tool repeat it's effect periodically until it's destroyed.
  294. #   Only effective for tools with the following scopes:
  295. #   One Enemy, All Enemies, X Random Enemies.
  296. #
  297. #   Here is an example using these tool settings:
  298. #     Tool Effect Delay = 30
  299. #     Tool Destroy Delay = 340
  300. #   If you did not use the note-tag mentioned above, the tool will execute it's
  301. #   effect on the target first after 30 frames of it's usage. After the first
  302. #   effect trigger, the tool executes it's effect continuously until it is
  303. #   destroyed. If there would be no invincibility time after each hit, you
  304. #   would see hell of a lot damage popups within the blink of an eye. But
  305. #   there is an invincibility time by default, and it is set to 20 frames.
  306. #
  307. #   (You can now set the default invincibility time in this script, or you can
  308. #   make separate times for each of your tools by using the new note-tag for it.
  309. #   In the default system, it was set to 20, and you had no way to change it
  310. #   without editing the script itself, that's why I go with 20 frames now.)
  311. #
  312. #   Since there is an invincibility time after the effect triggering, any other
  313. #   offensive tool which hits the target while the invincibility frame is not 0
  314. #   will have absolutely no effect on the target.
  315. #
  316. #   This means that the tool will execute it's effects in every 20 frames after
  317. #   the effect delay countdown (which is 30 frames now). This also means that
  318. #   the total number of hits (if the enemy is in the tool's range all the time)
  319. #   equals:
  320. #   (340 - 30) / 20 = 310 / 20 = 15.5
  321. #   So, it would hit maximum 15 times.
  322. #   This is with the default effect trigger system Falcao made.
  323. #
  324. #   Now let's see what happens with my new trigger...
  325. #   Same tool settings, but now I will set the tool's invincibility frame
  326. #   trigger time to 0 with the new note-tag for it, and will use the note-tag
  327. #   to set the tool's effect trigger type to my new one.
  328. #   What happens now?
  329. #
  330. #   The tool will hit the target first after 30 frames, same like before, but
  331. #   now every other hit will be triggered after 30 frames. The tool will not
  332. #   trigger any invincibility frames for the targets at all, which means that
  333. #   multiple tools can hit the target at the same time (as long as they don't
  334. #   trigger any invincibility frame, that is), and all of them will execute
  335. #   their effects.
  336. #   This means:
  337. #   (340 - 30) / 30 = 10.3333...
  338. #   So, 10 hits maximum, with the ability to hit the target with any other tools
  339. #   in the meantime.
  340. #   This means that if the target is staying in a Fire Wall, and the opponent
  341. #   shoots arrows at it, AND an ally puts a Healing Glyph below it's feet, ALL
  342. #   of these effects will be executed if none of these tools got any
  343. #   invincibility frames set for them. This is the main reason I made this, to
  344. #   enable multiple tools to hit the targets at the same time.
  345. #
  346. #   I hope it's clear enough what's the difference.
  347. #   In case you don't want to use my new effect trigger, just don't use this
  348. #   note-tag on any of your tools, and set the default invincibility time to
  349. #   20 frames in the settings below. That results in the default system.
  350. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  351. # * If you want to make tools with different width and height, you can use
  352. #   this note-tag:
  353. #
  354. #     <tool size ex: width, height, dir_based>
  355. #
  356. #   Replace the width and height with the width and height of the tool.
  357. #   These are measured in tiles, NOT in pixels!
  358. #   Note that you still must use the default note-tag for size too!
  359. #
  360. #   The 'dir_based' can be either 0 or 1.
  361. #   0 means that regardless of the direction of the tool (or user) it will
  362. #   always have the same area of effect.
  363. #   If it is set to 1, the area will change depending on the direction of the
  364. #   tool. The note-tag represents the UP or DOWN directions in this case.
  365. #   The LEFT and RIGHT directions will change the area of effect to be rotated
  366. #   by 90 angles. So, the width and height will be exchanged in this case.
  367. #
  368. #   Examples:  <tool size ex: 4, 1, 0>  |  <tool size ex: 3, 2, 1>
  369. #
  370. #   Now, these numbers aren't exactly what they seem to be. I will use the 1st
  371. #   example to explain what they do.
  372. #
  373. #   The 4 means that the tool will be (3*2+1) tiles wide. I bet you mean
  374. #   WTFruit now, but look at the sketch below... (5 would be 4*2+1)
  375. #
  376. #   -----------------------------
  377. #   | 4 | 3 | 2 | 1 | 2 | 3 | 4 |
  378. #   -----------------------------
  379. #
  380. #   So, the 4 means the middle (indicated by an 1 on the sketch) plus the tiles
  381. #   on the left and right sides (3 on both sides).
  382. #
  383. #   If you would want a tool with 5 width, you would use 3 in the note-tag for
  384. #   it's width, since the middle plus 2 tiles on both sides is 5.
  385. #   Basically, just count from the middle and you will get the correct note-tag
  386. #   values easily.
  387. #
  388. #   The same applies to the height of the tools.
  389. #
  390. #   Here is an example sketch for a tool with the second note-tag example:
  391. #
  392. #   ---------------------  
  393. #   | 3 | 2 | 1 | 2 | 3 |   This is the real tool size in the game with the
  394. #   ---------------------   note-tag <tool size ex: 3, 2, 1> used for the tool.
  395. #   | 3 | 2 | 1 | 2 | 3 |   The default note-tag that Falcao provided works
  396. #   ---------------------   the same way actually. Some examples for that can
  397. #   | 3 | 2 | 1 | 2 | 3 |   be found below for comparison.
  398. #   ---------------------  
  399. #
  400. #   Falcao's tool size and note-tag examples:       -----
  401. #                                                   | 3 |
  402. #       -----                                   -------------
  403. #       | 2 |                                   | 2 | 2 | 2 |
  404. #   -------------   <-- Tool Size = 2       ---------------------
  405. #   | 2 | 1 | 2 |                           | 3 | 2 | 1 | 2 | 3 |
  406. #   -------------       Tool Size = 3 -->   ---------------------
  407. #       | 2 |                                   | 2 | 2 | 2 |
  408. #       -----                                   -------------
  409. #                                                   | 3 |
  410. #   See? It's the same eventually.                  -----
  411. #   Just count from the middle and that's it.
  412. #
  413. #   I made this feature for one-liner area effect tools, but you can use it for
  414. #   making way bigger area effects too, if you want.
  415. #-------------------------------------------------------------------------------
  416. # * < Installation >
  417. #-------------------------------------------------------------------------------
  418. # * Place this script below all of Falcao's ABS scripts but above Main!
  419. # * If you are using my Stat Bonus Addon for Falcao's ABS, you must put this
  420. #   script below that one!
  421. # * If you are using Pikakapi's Battle Royale Addon, this must be below that,
  422. #   and the Battle Royale Compatibility Patch must be below this script!
  423. #-------------------------------------------------------------------------------
  424. # * < Compatibility Info >
  425. #-------------------------------------------------------------------------------
  426. # * No known incompatibilities.
  427. #-------------------------------------------------------------------------------
  428. # * < Known Issues >
  429. #-------------------------------------------------------------------------------
  430. # * No known issues.
  431. #-------------------------------------------------------------------------------
  432. # * < Terms of Use >
  433. #-------------------------------------------------------------------------------
  434. # * Free to use for whatever purposes you want.
  435. # * Credit me (Sixth) in your game, pretty please! :P
  436. # * Posting modified versions of this script is allowed as long as you notice me
  437. #   about it with a link to it!
  438. #===============================================================================
  439. $imported = {} if $imported.nil?
  440. $imported["SixthFalcaoABSBugFixes"] = true
  441. #===============================================================================
  442. # Settings:
  443. #===============================================================================
  444. module Falcao_ABS_Fix1
  445.   #-----------------------------------------------------------------------------
  446.   # Regen Popup Settings
  447.   #-----------------------------------------------------------------------------
  448.   # You can enable or disable the regen pop up texts in the game with the
  449.   # switches you set up here. Set them to 0 if you want them to be always enabled.
  450.   # In case you don't want to show the MP regen texts, because the MP in your
  451.   # game always increases slowly for the player, or you need to turn the popups
  452.   # off because of a cut-scene, or for any other reason.
  453.   # To show the popups, turn the assigned switches ON.
  454.   # To hide them turn the switches OFF.
  455.   #-----------------------------------------------------------------------------
  456.   RegenPops = { :hp => 0, :mp => 0, :tp => 0 }
  457.  
  458.   #-----------------------------------------------------------------------------
  459.   # Confusion Addon Settings
  460.   #-----------------------------------------------------------------------------
  461.   # These settings let you make a basic confusion state in the ABS system.
  462.   # Like in many ABS based games, confusion messes up movement directions.
  463.   # That is what this addon aims to do, mess up user directions when the user is
  464.   # inflicted with confusion.
  465.   # There are many settings for you to set up here.
  466.   #
  467.   #   ConfEnabled = true/false
  468.   # This can be true or false. Set it to false to completely disable this addon.
  469.   # Set it to true to enable the confusion addon.
  470.   #
  471.   #   ConfPlayerOnly = true/false
  472.   # If you set this to true, only the player will be affected by the direction
  473.   # changes on confusion. If it is set to false, enemies and followers alike
  474.   # will be affected too!
  475.   #
  476.   #   ConfStates = [state_id1, state_id2, ... , state_idN]
  477.   # Any state IDs entered in the array here will be considered as a confusion
  478.   # inflicting state. Add as many as you want.
  479.   #
  480.   #   ConfType = :reverse/:random/:custom
  481.   # You can set the type of confusion here. 3 options are available:
  482.   # 1. :reverse = This simply inverts the movement directions when confused.
  483.   # 2. :random = This will move in complete random directions when confused.
  484.   #              If you choose this type, you can be sure that this state will
  485.   #              be the most annoying state in your entire game!
  486.   #              You have been warned! :P
  487.   # 3. :custom = With this type, you can set up your own unique directions for
  488.   #              the confusion state. You set up the direction groups in the
  489.   #              ConfCustom settings. Whenever the player is inflicted with a
  490.   #              confusion state, a random direction group will be selected
  491.   #              from those settings, and the movement of the characters will
  492.   #              depend on those settings until the confusion is cleared.
  493.   #              This type aims to give a slight random factor for confusion
  494.   #              directions while still keeping it below the uber-annoying
  495.   #              limits. Many games use this type of confusion mechanics, like
  496.   #              the YS series, for example.
  497.   #
  498.   #   ConfCustom = {
  499.   #     setup1 => {dir1 => cdir1, dir2 => cdir2, dir3 => cdir3, dir4 => cdir4},
  500.   #     setup2 => {dir1 => cdir1, dir2 => cdir2, dir3 => cdir3, dir4 => cdir4},
  501.   #     ...
  502.   #   }
  503.   # This is the place where you set up your own confusion directions. You can
  504.   # add as many settings as you want here. When the player is inflicted with
  505.   # confusion, a random setting will be loaded from here, and the directions
  506.   # will depend on the selected setting.
  507.   # The directions are named by numbers, and if you are ever in doubt which one
  508.   # is which, just take a look at your numpad numbers and their placement.
  509.   # In case you don't have a numpad (poor numpad-less laptops!):
  510.   # 2 = Down, 4 = Left, 6 = Right, 8 = Up.
  511.   # So, how to setup these groups correctly? First, name the group with a
  512.   # unique name, it can be anything, numbers, strings, symbols, etc.
  513.   # I used numbers, because I ... no real reasons, I always use numbers. :P
  514.   # After this, in the group hash, you must pair the normal directions with
  515.   # the confused directions. For example, 2 => 4 means that if the character is
  516.   # confused, and when the character would like to move down (2), it will move
  517.   # left (4) instead of down.
  518.   # The left number represents the normal direction and the right number is the
  519.   # direction change when confused.
  520.   # You must set up all 4 directions for all of your groups!
  521.   #-----------------------------------------------------------------------------
  522.   ConfEnabled = false
  523.   ConfPlayerOnly = false
  524.   ConfStates = [73]
  525.   ConfType = :custom
  526.   ConfCustom = {
  527.     1 => { 2 => 6, 4 => 8, 6 => 2, 8 => 4 },
  528.     2 => { 2 => 6, 4 => 8, 6 => 4, 8 => 2 },
  529.     3 => { 2 => 2, 4 => 6, 6 => 4, 8 => 8 },
  530.     4 => { 2 => 8, 4 => 4, 6 => 6, 8 => 2 },
  531.     5 => { 2 => 8, 4 => 6, 6 => 4, 8 => 2 },    
  532.     # Add more direction settings here!
  533.   }
  534.  
  535.   #-----------------------------------------------------------------------------
  536.   # Cast Time Settings
  537.   #-----------------------------------------------------------------------------
  538.   # All of the these settings are for changing some behaviors regarding the
  539.   # usage of tools with cast times.
  540.   #
  541.   #   CastMoveDisableEnemy = true/false   # <-- For the enemies.
  542.   #   CastMoveDisablePlayer = true/false  # <-- For the player.
  543.   # Setting these settings to 'true' will prevent enemy/player movement while
  544.   # a tool is being casted. Setting them to 'false' will disable this feature.
  545.   #
  546.   #   AutoTurnToPlayer = true/false
  547.   # Setting this setting to 'true' will make the enemies always turn toward
  548.   # the player on any enemy targeting tool usage.
  549.   # Setting it to 'false' will disable this feature.
  550.   # NOTE:
  551.   # Setting this to true automatically blocks enemy movement during cast time!
  552.   #
  553.   #   AllowPlayerDirChange = true/false
  554.   # Set this to 'true' if you want to allow the player to change directions
  555.   # during casting. Set this to 'false' to disable direction changes on casting.
  556.   #-----------------------------------------------------------------------------
  557.   CastMoveDisableEnemy = true   # <-- For the enemies.
  558.   CastMoveDisablePlayer = false  # <-- For the player.
  559.   AutoTurnToPlayer = true
  560.   AllowPlayerDirChange = true
  561.  
  562.   #-----------------------------------------------------------------------------
  563.   # Invincible Settings
  564.   #-----------------------------------------------------------------------------
  565.   # When a target is hit with an offensive tool (scope set to any kind of
  566.   # "enemy" type), it will become invincible for 20 frames by default.
  567.   # Now you can change the default time with this setting.
  568.   # Unless you make a custom invincibility time for an offensive tool with the
  569.   # provided new note-tags, this will be used for the tools.
  570.   # Remember that it is measured in frames, so 60 means 1 second!
  571.   #-----------------------------------------------------------------------------
  572.   InvincibleTime = 10
  573.  
  574.   #-----------------------------------------------------------------------------
  575.   # Switch Settings
  576.   #-----------------------------------------------------------------------------
  577.   # You can set up the switch used to enable/disable the tool usage of the
  578.   # player, and the switch used to enable/disable the menu calling for the ABS
  579.   # menus (tool selection and character selection).
  580.   # When the assigned switches are turned ON, the features are enabled, when
  581.   # they are turned OFF, they are disabled.
  582.   #-----------------------------------------------------------------------------
  583.   ToolToggleSwitch = 29
  584.   MenuToggleSwitch = 30
  585.    
  586.   #-----------------------------------------------------------------------------
  587.   # Tool Unequip Settings
  588.   #-----------------------------------------------------------------------------
  589.   # From v1.7, you can allow the player to unequip any tool from the quick tool
  590.   # selection menu by pressing the assigned buttons for the tools in the menu.
  591.   # It was not possible to unequip anything there before.
  592.   # Set this setting to true to enable this feature or false to disable it!
  593.   #-----------------------------------------------------------------------------
  594.   ToolUnequip = true
  595.  
  596. end
  597. #===============================================================================
  598. # End of Settings! Editing anything below may lead to... you know it, right?
  599. #===============================================================================
  600.  
  601. module PearlKey
  602.  
  603.   def self.press?(key)
  604.     return false if key.nil?
  605.     return @press[key]
  606.   end
  607.   # Enables the disabling of certain tool trigger keys.
  608.   def self.trigger?(key)
  609.     return false if key.nil?
  610.     return @trigger[key]
  611.   end
  612.  
  613. end
  614.  
  615. class Game_Interpreter
  616.  
  617.   def hide_boss_bar
  618.     SceneManager.scene.hide_boss_bar
  619.   end
  620.  
  621.   def change_enemy_hp(id,val,allow_ko = true)
  622.     return if $game_map.events[id].battler.nil? || $game_map.events[id].battler.dead?
  623.     if allow_ko == false && val < 0
  624.       val = [val,-($game_map.events[id].battler.hp-1)].max
  625.     end
  626.     $game_map.events[id].battler.hp += val
  627.     $game_map.events[id].colapse_time = 60 if $game_map.events[id].battler.dead?
  628.   end
  629.  
  630. end
  631.  
  632. class Game_Map
  633.  
  634.   alias fix_sensors5542 setup
  635.   def setup(map_id)
  636.     reset_enemy_sensors
  637.     fix_sensors5542(map_id)
  638.   end
  639.   # Sensor reset fix.
  640.   def reset_enemy_sensors
  641.     @event_enemies.each do |ev|
  642.       next unless $game_self_switches[[@map_id, ev.id, PearlKernel::Enemy_Sensor]]
  643.       $game_self_switches[[@map_id, ev.id, PearlKernel::Enemy_Sensor]] = false
  644.     end
  645.   end
  646.  
  647. end
  648.  
  649. class Game_Party < Game_Unit
  650.  
  651.   def set_skill(actor_id, sid, slot)
  652.     actor = $game_actors[actor_id] ; skill = $data_skills[sid]
  653.     return unless actor.skills.include?(skill)
  654.     case slot
  655.     when Key::Skill[1].to_sym  then actor.assigned_skill  = skill
  656.     when Key::Skill2[1].to_sym then actor.assigned_skill2 = skill
  657.     when Key::Skill3[1].to_sym then actor.assigned_skill3 = skill
  658.     when Key::Skill4[1].to_sym then actor.assigned_skill4 = skill
  659.     end
  660.   end
  661.  
  662. end
  663.  
  664. class Game_Player < Game_Character
  665.  
  666.   # Cast direction feature for player.
  667.   alias cast_dir_fix9989 move_by_input
  668.   def move_by_input
  669.     if Falcao_ABS_Fix1::AllowPlayerDirChange &&
  670.        !$game_map.interpreter.running? && @user_casting[0] > 0
  671.       set_direction(Input.dir4) if Input.dir4 > 0
  672.     else
  673.       cast_dir_fix9989
  674.     end    
  675.   end
  676.   # Cast movement fix for player.
  677.   alias cast_move_dis6653 movable?
  678.   def movable?
  679.     return false if Falcao_ABS_Fix1::CastMoveDisablePlayer && @user_casting[0] > 0
  680.     cast_move_dis6653    
  681.   end
  682.  
  683.   alias fix_tool_usage8864 update_tool_usage
  684.   def update_tool_usage
  685.     return if $game_switches[Falcao_ABS_Fix1::ToolToggleSwitch] == false
  686.     return if $game_map.interpreter.running?
  687.     return if PearlSkillBar.hidden?
  688.     return unless normal_walk?
  689.     if trigger_tool?(Key::Armor[0], :keys) || trigger_tool?(2, :mouse)
  690.       if actor.equips[1] && actor.equips[1].is_a?(RPG::Weapon)
  691.         use_weapon(actor.equips[1].id) # Dual wield fix 1!
  692.         return
  693.       end
  694.     end
  695.     if trigger_tool?(Key::Weapon[0], :keys) || trigger_tool?(1, :mouse)
  696.       if actor.equips[0] && actor.equips[0].is_a?(RPG::Armor)
  697.         use_armor(actor.equips[0].id) # Patch for my Equip Engine 1!
  698.         return
  699.       end
  700.     end
  701.     fix_tool_usage8864
  702.   end
  703.  
  704.   alias fix_menu_calls7731 update_menu_buttons
  705.   def update_menu_buttons
  706.     return if $game_map.interpreter.running?
  707.     return if $game_switches[Falcao_ABS_Fix1::MenuToggleSwitch] == false
  708.     fix_menu_calls7731
  709.   end
  710.  
  711. end
  712.  
  713. class Game_Character < Game_CharacterBase
  714.  
  715.   attr_accessor :reflect_flag
  716.  
  717.   alias add_reflect_flags9942 init_public_members
  718.   def init_public_members
  719.     @reflect_flag = {}
  720.     add_reflect_flags9942
  721.   end
  722.  
  723.   def do_counter(tool,user)
  724.     battler.reflecting = true
  725.     @animation_id = 0
  726.     @animation_id = 94
  727.     while @animation_id > 0
  728.       turn_toward_character(user)
  729.       SceneManager.scene.update
  730.     end
  731.     case tool
  732.     when RPG::Weapon
  733.       use_weapon(tool.id)
  734.       user.set_reflect_flag(tool)
  735.     when RPG::Armor
  736.       use_armor(tool.id)
  737.       user.set_reflect_flag(tool)
  738.     when RPG::Skill
  739.       use_skill(tool.id)
  740.       user.set_reflect_flag(tool)
  741.     when RPG::Item
  742.       use_item(tool.id)
  743.       user.set_reflect_flag(tool)
  744.     end
  745.     battler.reflecting = false
  746.   end
  747.  
  748.   def set_reflect_flag(tool)
  749.     @reflect_flag[tool] = true
  750.   end
  751.  
  752. end
  753.  
  754. class Game_Event < Game_Character
  755.   # Cast movement fix for enemies.
  756.   alias cast_move_dis5543 update_self_movement
  757.   def update_self_movement
  758.     if @user_casting[0] > 0
  759.       if Falcao_ABS_Fix1::AutoTurnToPlayer == true && self.battler.is_a?(Game_Enemy)
  760.         if @user_casting[1].is_a?(RPG::Weapon) || @user_casting[1].is_a?(RPG::Armor) ||
  761.            [1,2,3,4,5,6].include?(@user_casting[1].scope)
  762.           turn_toward_player
  763.         end
  764.       end
  765.       if Falcao_ABS_Fix1::CastMoveDisableEnemy == false
  766.         cast_move_dis5543
  767.       end
  768.     else
  769.       cast_move_dis5543
  770.     end
  771.   end
  772.  
  773.   alias fix_ko_sensors6652 update_enemy_sensor
  774.   def update_enemy_sensor
  775.     return if collapsing?
  776.     fix_ko_sensors6652
  777.   end
  778.  
  779.   alias fix_revive1127 apply_respawn
  780.   def apply_respawn
  781.     @die_sswitch = nil
  782.     fix_revive1127
  783.     @epassive = @enemy.enemy.tool_data("Enemy Passive = ", false) == "true"
  784.   end
  785.  
  786.   def run_assigned_commands # Overwrite!
  787.     transform = @enemy.enemy.tool_data("Enemy Die Transform = ")
  788.     switch = @enemy.enemy.tool_data("Enemy Die Switch = ")
  789.     $game_switches[switch] = true if switch != nil
  790.     variable = @enemy.enemy.tool_data("Enemy Die Variable = ")
  791.     $game_variables[variable] += 1 if variable != nil
  792.     self_sw = @enemy.enemy.tool_data("Enemy Die Self Switch = ", false)
  793.     #$game_map.event_enemies.delete(self) if @enemy.object
  794.     #$game_map.enemies.delete(@enemy) if @enemy.object
  795.     if self_sw.is_a?(String)
  796.       $game_self_switches[[$game_map.map_id, self.id, self_sw]] = true
  797.       apply_respawn
  798.       make_drop_items if transform.nil? #myadd
  799.       $game_map.event_enemies.delete(self)
  800.       $game_map.enemies.delete(@enemy)
  801.       unless $game_system.remain_killed.has_key?($game_map.map_id)
  802.         $game_system.remain_killed[$game_map.map_id] = []
  803.       end
  804.       $game_system.remain_killed[$game_map.map_id].push(self.id) unless
  805.       $game_system.remain_killed[$game_map.map_id].include?(self.id)
  806.       @die_sswitch = self_sw # Added!
  807.       #@enemy = nil  # Disabled by Sixth!
  808.     else
  809.       erase unless @deadposee
  810.       respawn = @enemy.enemy.tool_data("Enemy Respawn Seconds = ")
  811.       animation = @enemy.enemy.tool_data("Enemy Respawn Animation = ")
  812.       @respawn_count = respawn * 60 unless respawn.nil?
  813.       @respawn_anim = animation unless animation.nil?
  814.     end
  815.     if transform != nil
  816.       @enemy = Game_Enemy.new(0, transform)
  817.       apply_respawn
  818.     end
  819.   end
  820.  
  821. end
  822.  
  823. class Projectile < Game_Character
  824.    
  825.   alias add_new_stuffs6631 load_item_data
  826.   def load_item_data
  827.     add_new_stuffs6631
  828.     @tool_effect_type = @original_item.effect_delay_type
  829.     @tool_inv_time = @original_item.tool_inv_time
  830.     @tool_ori_delay = @tool_effect_delay
  831.     @tool_reverse_target = @original_item.reverse_target
  832.     @tool_no_guard_destroy = @original_item.no_guard_destroy
  833.     @tool_ignore_guard = @original_item.ignore_guard
  834.     @tool_size = @original_item.tool_size_ex if !@original_item.tool_size_ex.nil?
  835.   end
  836.  
  837.   # Fixing combo delays. Thanks thanasulas for pointing this out!
  838.   def check_combo_effect
  839.     c = PearlKernel.tool_combo
  840.     return if c == 'nil' || c.nil?
  841.     c = c.split(", ")
  842.     return unless rand(101) <= c[2].to_i
  843.     @user.combodata << [c[0].to_sym, c[1].to_i, c[3], @tool_destroy_delay]
  844.     @has_combo = true
  845.   end
  846.    
  847.   def apply_damageto_enemy
  848.     return if @tool_effect_delay > 0
  849.     $game_map.event_enemies.each do |event|
  850.       next if event.collapsing?
  851.      
  852.       if event.battler.body_sized > 0
  853.         enabled = body_size?([event.x, event.y], @tool_size)
  854.         enabled = body_size?([event.x - 1, event.y], @tool_size) if !enabled
  855.         enabled = body_size?([event.x, event.y - 1], @tool_size) if !enabled
  856.         enabled = body_size?([event.x + 1, event.y], @tool_size) if !enabled
  857.         if event.battler.body_sized == 2
  858.           enabled = body_size?([event.x - 1, event.y-1], @tool_size) if !enabled
  859.           enabled = body_size?([event.x, event.y - 2], @tool_size) if !enabled
  860.           enabled = body_size?([event.x + 1, event.y-1], @tool_size) if !enabled
  861.         end
  862.       else
  863.         enabled = body_size?([event.x, event.y], @tool_size)
  864.       end
  865.      
  866.       if enabled and event.just_hitted == 0
  867.         event.just_hitted = @tool_inv_time
  868.         next if event.page.nil?
  869.         if !enable_dame_execution?(event.battler)
  870.           unless event.battler.object
  871.             RPG::SE.new(Key::GuardSe, 80).play
  872.             event.pop_damage('Guard')
  873.             play_hit_animation(event)
  874.           end
  875.           return
  876.         end
  877.         #-------------------------
  878.         execute_damageto_enemy(event)
  879.       end
  880.     end
  881.   end
  882.  
  883.   def apply_damageto_player
  884.     return if @tool_effect_delay > 0 || $game_player.battler.dead?
  885.     if obj_size?($game_player, @tool_size) and $game_player.just_hitted == 0
  886.       $game_player.just_hitted = @tool_inv_time
  887.       return if guard_success?($game_player, 1)
  888.       execute_damage($game_player)
  889.       $game_player.damage_pop.push(DamagePop_Obj.new($game_player)) unless
  890.       guard_success?($game_player, 2)
  891.       apply_blow_power($game_player)
  892.     end
  893.   end
  894.  
  895.   def apply_damageto_followers
  896.     return if @tool_effect_delay > 0
  897.     # followers
  898.     for actor in $game_player.followers
  899.       next unless actor.visible?
  900.       if obj_size?(actor, @tool_size) and actor.just_hitted == 0
  901.         actor.just_hitted = @tool_inv_time
  902.         next if actor.battler.dead?
  903.         return if guard_success?(actor, 1)
  904.         execute_damage(actor)
  905.         $game_player.damage_pop.push(DamagePop_Obj.new(actor)) unless
  906.         guard_success?(actor, 2)
  907.         apply_blow_power(actor)
  908.       end
  909.     end
  910.   end
  911.  
  912.   def can_reflect_tool?(target)
  913.     return false if @original_item.reflect_pierce
  914.     return false if target.reflect_flag[@original_item]
  915.     return false unless target.tool_can_use?
  916.     ref_sum = target.battler.features_sum(22, 5)
  917.     return ref_sum > 0.0 && ref_sum > rand
  918.   end
  919.  
  920.   alias fix_guard_dmg7753 execute_damage
  921.   def execute_damage(target)
  922.     if can_reflect_tool?(target)
  923.       unless @tool_piercing
  924.         @tool_distance = 0
  925.         @tool_destroy_delay = 0
  926.       end
  927.       if target.battler.is_a?(Game_Enemy)
  928.         target.awareness = true
  929.       end
  930.       target.do_counter(@original_item,@user)
  931.       return
  932.     end
  933.     if target.battler_guarding[0]
  934.       if faceto_face?(target) && !@tool_ignore_guard
  935.         target.battler.add_state(9)
  936.       else
  937.         target.battler.remove_state(9)
  938.       end
  939.     end
  940.     fix_guard_dmg7753(target)
  941.     @user.reflect_flag[@original_item] = false if @user.reflect_flag[@original_item]
  942.   end
  943.  
  944.   unless $imported && $imported["SixthABSBattleRoyale"]
  945.    
  946.     def apply_self_effect(target, pop=true)
  947.       target.battler.item_apply(@user.battler, @item)
  948.       target.animation_id = animation
  949.       $game_player.damage_pop.push(DamagePop_Obj.new(target))
  950.       @destroy_it = true
  951.     end
  952.    
  953.     def update_damage
  954.       if @user.battler.is_a?(Game_Actor)
  955.         apply_damageto_enemy unless @tool_reverse_target
  956.         if @tool_selfdamage || @tool_reverse_target
  957.           apply_damageto_player
  958.           apply_damageto_followers unless @ignore_followers
  959.         end
  960.       elsif @user.battler.is_a?(Game_Enemy)
  961.         if $game_player.normal_walk? && !@tool_reverse_target
  962.           apply_damageto_player
  963.           apply_damageto_followers unless @ignore_followers
  964.         end
  965.         apply_damageto_enemy if @tool_selfdamage || @tool_reverse_target
  966.       end
  967.     end
  968.    
  969.   end
  970.  
  971.   def update_timer
  972.     update_tool_movement
  973.     @mini_opacity -= 1 if  @mini_opacity > 0
  974.     @opacity = 255 if @mini_opacity == 1
  975.     # Edited!!! - by Sixth
  976.     if @tool_effect_type
  977.       @tool_effect_delay -= 1 if @tool_effect_delay >= 0
  978.       if @tool_ori_delay != 0 && @tool_effect_delay < 0
  979.         @tool_effect_delay = @tool_ori_delay
  980.       end
  981.     else
  982.       @tool_effect_delay -= 1 if @tool_effect_delay > 0
  983.     end
  984.     # Edit END!!! - by Sixth
  985.     if @tool_distance == 0
  986.       @tool_destroy_delay -= 1 if @tool_destroy_delay > 0
  987.       @destroy_it = true if @tool_destroy_delay == 0
  988.     end
  989.     update_animation_setting
  990.   end
  991.  
  992.   def guard_success?(userr, type)
  993.     return false if @tool_ignore_guard
  994.     if userr.battler_guarding[0]
  995.        # guard
  996.       if type == 1
  997.         if rand(101) <= userr.battler_guarding[1]
  998.           return false unless faceto_face?(userr)
  999.           RPG::SE.new(Key::GuardSe, 80).play
  1000.           $game_player.damage_pop.push(DamagePop_Obj.new(userr, 2))
  1001.           unless @user.making_spiral || @tool_no_guard_destroy
  1002.             @tool_distance = 0
  1003.             @tool_destroy_delay = 0
  1004.           end
  1005.           play_hit_animation(userr)
  1006.           return true
  1007.         end
  1008.         # block
  1009.       elsif type == 2
  1010.         return false unless faceto_face?(userr)
  1011.         $game_player.damage_pop.push(DamagePop_Obj.new(userr, 1))
  1012.         return true
  1013.       end
  1014.     end
  1015.     return false
  1016.   end
  1017.  
  1018. end
  1019.  
  1020. module DisplayTools
  1021.   # Tools can't be changed on cooldown from now on.
  1022.   def self.tool_cool(type)
  1023.     case type
  1024.     when :wp
  1025.       return @pearl_tool_sprite.weapon_cooldown > 0
  1026.     when :ar
  1027.       return @pearl_tool_sprite.armor_cooldown > 0
  1028.     when :i1
  1029.       return @pearl_tool_sprite.item_cooldown > 0
  1030.     when :i2
  1031.       return @pearl_tool_sprite.item_cooldown2 > 0
  1032.     when :s1
  1033.       return @pearl_tool_sprite.skill_cooldown > 0
  1034.     when :s2
  1035.       return @pearl_tool_sprite.skill_cooldown2 > 0
  1036.     when :s3
  1037.       return @pearl_tool_sprite.skill_cooldown3 > 0
  1038.     when :s4
  1039.       return @pearl_tool_sprite.skill_cooldown4 > 0
  1040.     end
  1041.   end
  1042.  
  1043. end
  1044.  
  1045. class << Input
  1046.  
  1047.   # Now only reducing cooldown time on the Map and not in the menus!
  1048.   def update_pearl_abs_cooldown
  1049.     PearlKey.update # Removed!
  1050.     if SceneManager.scene_is?(Scene_Map)
  1051.       eval_cooldown($game_party.all_members) if !$game_party.nil?
  1052.       eval_cooldown($game_map.enemies) if !$game_map.nil?
  1053.     end
  1054.   end
  1055.  
  1056.   alias add_glob_cool3321 eval_cooldown
  1057.   def eval_cooldown(operand)
  1058.     operand.each { |char| char.glob_cool -= 1 if char.glob_cool > 0 }
  1059.     add_glob_cool3321(operand)
  1060.   end
  1061.  
  1062. end
  1063.  
  1064. class RPG::BaseItem
  1065.  
  1066.   def glob_cool
  1067.     @note =~ /Tool Global Cool = (\d+)/i ? $1.to_i : 0
  1068.   end
  1069.  
  1070.   def reverse_target
  1071.     @note =~ /<reverse target>/i ? true : false
  1072.   end
  1073.  
  1074.   def tool_size_ex
  1075.     @note =~ /<tool size ex: (\d+), (\d+), (\d+)>/i ? [$1.to_i,$2.to_i,$3.to_i] : nil
  1076.   end
  1077.  
  1078.   def no_guard_destroy
  1079.     @note =~ /<no guard destroy>/i ? true : false
  1080.   end
  1081.  
  1082.   def ignore_guard
  1083.     @note =~ /<ignore guard>/i ? true : false
  1084.   end
  1085.  
  1086.   def effect_delay_type
  1087.     @note.include?("<new effect delay>") ? true : false
  1088.   end
  1089.  
  1090.   def tool_inv_time
  1091.     @note =~ /<inv time: (\d+)>/i ? $1.to_i : Falcao_ABS_Fix1::InvincibleTime
  1092.   end
  1093.  
  1094.   def reflect_pierce
  1095.     @note.include?("<ignore reflect>") ? true : false
  1096.   end
  1097.  
  1098. end
  1099.  
  1100. class Game_Battler < Game_BattlerBase
  1101.  
  1102.   attr_accessor :pop_fix, :glob_cool, :conf_type, :reflecting
  1103.  
  1104.   alias fix_regen_posp5542 initialize
  1105.   def initialize
  1106.     @glob_cool = 0
  1107.     @conf_type = nil
  1108.     @reflecting = false
  1109.     @pop_fix = {:hp => false, :mp => false, :tp => false}
  1110.     fix_regen_posp5542
  1111.   end
  1112.  
  1113.   alias conf_addon7411 add_new_state
  1114.   def add_new_state(state_id)
  1115.     if Falcao_ABS_Fix1::ConfStates.include?(state_id)
  1116.       @conf_type = Falcao_ABS_Fix1::ConfCustom.keys.sample
  1117.     end
  1118.     conf_addon7411(state_id)
  1119.   end
  1120.  
  1121.   def regenerate_hp
  1122.     old_hp = self.hp
  1123.     damage = -(mhp * hrg).to_i
  1124.     perform_map_damage_effect if $game_party.in_battle && damage > 0
  1125.     @result.hp_damage = [damage, max_slip_damage].min
  1126.     self.hp -= @result.hp_damage
  1127.     @pop_fix[:hp] = old_hp != self.hp ? true : false
  1128.   end
  1129.  
  1130.   def regenerate_mp
  1131.     old_mp = self.mp
  1132.     @result.mp_damage = -(mmp * mrg).to_i
  1133.     self.mp -= @result.mp_damage
  1134.     @pop_fix[:mp] = old_mp != self.mp ? true : false
  1135.   end
  1136.  
  1137.   def regenerate_tp
  1138.     old_tp = self.tp
  1139.     @result.tp_damage = -(max_tp * trg).to_i
  1140.     self.tp -= @result.tp_damage
  1141.     @pop_fix[:tp] = old_tp != self.tp ? true : false
  1142.   end
  1143.  
  1144.   # Global cooldowns.
  1145.   alias add_glob_cool7764 apply_cooldown
  1146.   def apply_cooldown(item, value)
  1147.     @glob_cool = item.glob_cool
  1148.     add_glob_cool7764(item, value)
  1149.   end
  1150.  
  1151. end
  1152.  
  1153. class Game_CharacterBase
  1154.  
  1155.   attr_accessor :die_sswitch
  1156.  
  1157.   alias fix_act_check8836 battler_acting?
  1158.   def battler_acting?
  1159.     return true if @battler_guarding[0]
  1160.     fix_act_check8836
  1161.   end
  1162.  
  1163.   if Falcao_ABS_Fix1::ConfEnabled == true
  1164.     alias confusion_addon7743 move_straight
  1165.     def move_straight(d, turn_ok = true)
  1166.       unless battler.nil? || self.is_a?(Projectile)
  1167.         if !Falcao_ABS_Fix1::ConfPlayerOnly || (Falcao_ABS_Fix1::ConfPlayerOnly && self.is_a?(Game_Player))
  1168.           case Falcao_ABS_Fix1::ConfType
  1169.           when :reverse
  1170.             d = Falcao_ABS_Fix1::ConfStates.any? {|id| battler.state?(id)} ? reverse_dir(d) : d
  1171.           when :random
  1172.             d = Falcao_ABS_Fix1::ConfStates.any? {|id| battler.state?(id)} ? [2,4,6,8].sample : d
  1173.           when :custom
  1174.             d = Falcao_ABS_Fix1::ConfStates.any? {|id| battler.state?(id)} ?
  1175.             Falcao_ABS_Fix1::ConfCustom[battler.conf_type][d] : d
  1176.           end
  1177.         end
  1178.         confusion_addon7743(d, turn_ok)
  1179.       else
  1180.         confusion_addon7743(d, turn_ok)
  1181.       end
  1182.     end
  1183.   end
  1184.  
  1185.   # Guard fix - part 2.
  1186.   def faceto_face?(target)
  1187.     if @tool_size.is_a?(Array)
  1188.       case @direction
  1189.       when 2
  1190.         return @tool_size[1] > 1 ? @y > target.y : target.direction == 8
  1191.       when 4
  1192.         return @tool_size[0] > 1 ? @x < target.x : target.direction == 6
  1193.       when 6
  1194.         return @tool_size[0] > 1 ? @x > target.x : target.direction == 4
  1195.       when 8
  1196.         return @tool_size[1] > 1 ? @y < target.y : target.direction == 2
  1197.       end
  1198.     else
  1199.       case @direction
  1200.       when 2
  1201.         return @tool_size > 1 ? @y > target.y : target.direction == 8
  1202.       when 4
  1203.         return @tool_size > 1 ? @x < target.x : target.direction == 6
  1204.       when 6
  1205.         return @tool_size > 1 ? @x > target.x : target.direction == 4
  1206.       when 8
  1207.         return @tool_size > 1 ? @y < target.y : target.direction == 2
  1208.       end
  1209.     end
  1210.   end
  1211.  
  1212.   alias size_addon5543 obj_size?
  1213.   def obj_size?(target, size)
  1214.     return false if size.nil? || target.nil?
  1215.     if size.is_a?(Array)
  1216.       distx = (@x - target.x).abs
  1217.       disty = (@y - target.y).abs
  1218.       if [4,6].include?(@direction) && size[2] == 1
  1219.         return true if distx <= size[1] - 1 && disty <= size[0] - 1
  1220.       else
  1221.         return true if distx <= size[0] - 1 && disty <= size[1] - 1
  1222.       end
  1223.     else
  1224.       size_addon5543(target,size)
  1225.     end
  1226.   end
  1227.  
  1228.   alias size_addon7721 body_size?
  1229.   def body_size?(target, size)
  1230.     #return false if size.nil?
  1231.     if size.is_a?(Array)
  1232.       distx = (@x - target[0]).abs
  1233.       disty = (@y - target[1]).abs
  1234.       if [4,6].include?(@direction) && size[2] == 1
  1235.         return true if distx <= size[1] - 1 && disty <= size[0] - 1
  1236.       else
  1237.         return true if distx <= size[0] - 1 && disty <= size[1] - 1
  1238.       end
  1239.     else
  1240.       size_addon7721(target,size)
  1241.     end
  1242.   end
  1243.  
  1244.   def update_state_action_steps
  1245.     # New way of handling Regen features!
  1246.     if battler.alive?
  1247.       if Graphics.frame_count % 60 == 0 && battler.features_sum(22, 7) != 0.0
  1248.         battler.regenerate_hp
  1249.         if battler.dead?
  1250.           @colapse_time = 80
  1251.           if $imported && $imported["SixthABSBattleRoyale"]
  1252.             self.aggro_data = {} #if target.battler.is_a?(Game_Actor)
  1253.             @agroto_f = nil
  1254.             @chasetime = 0 if self.is_a?(Game_Event)
  1255.             $game_map.battler_data_ko << self if !$game_map.battler_data_ko.include?(self)
  1256.             $game_map.battler_data.delete(self) if $game_map.battler_data.include?(self)
  1257.           end
  1258.         end
  1259.         unless self.battler.is_a?(Game_Enemy) && self.battler.object == true
  1260.           pop_damage if battler.pop_fix[:hp] == true && check_popup_enable(:hp)
  1261.         end
  1262.       end
  1263.       if Graphics.frame_count % 60 == 20 && battler.features_sum(22, 8) != 0.0
  1264.         battler.regenerate_mp
  1265.         pop_damage if battler.pop_fix[:mp] == true && check_popup_enable(:mp)
  1266.       end
  1267.       if Graphics.frame_count % 60 == 40 && battler.features_sum(22, 9) != 0.0
  1268.         battler.regenerate_tp
  1269.         pop_damage(battler.trg) if battler.pop_fix[:tp] == true && check_popup_enable(:tp)
  1270.       end
  1271.     end
  1272.  
  1273.     for state in battler.states
  1274.       if state.remove_by_walking
  1275.         if !battler.state_steps[state.id].nil? &&
  1276.           battler.state_steps[state.id] > 0
  1277.           battler.state_steps[state.id] -= 1
  1278.         end
  1279.         if battler.state_steps[state.id] == 0
  1280.           battler.remove_state(state.id)
  1281.           pop_damage
  1282.         end
  1283.       end
  1284.       if state.restriction == 4
  1285.         @stopped_movement = 10
  1286.         @pattern = 2 if @knockdown_data[0] == 0 && !@die_sswitch
  1287.       end
  1288.       state.features.each do |feature|
  1289.         if feature.code == 22 && !@die_sswitch
  1290.           @knockdown_data[0] = 10 if state.restriction == 4 && feature.data_id == 1
  1291.           # Removed the default way...
  1292.           #next unless feature.data_id.between?(7, 9)
  1293.           #apply_regen_state(state, feature.data_id)
  1294.         end
  1295.       end
  1296.     end
  1297.   end
  1298.  
  1299.   def check_popup_enable(data)
  1300.     if Falcao_ABS_Fix1::RegenPops[data] == 0 ||
  1301.        $game_switches[Falcao_ABS_Fix1::RegenPops[data]]
  1302.       return true
  1303.     end
  1304.     return false
  1305.   end
  1306.  
  1307.   # Added global cooldown checks here.
  1308.   alias add_glob_cool1126 tool_can_use?
  1309.   def tool_can_use?
  1310.     return false if battler.nil? || battler.glob_cool > 0
  1311.     #return false if battler.reflecting
  1312.     add_glob_cool1126
  1313.   end
  1314.  
  1315. end
  1316.  
  1317. class Sprite_Character < Sprite_Base
  1318.  
  1319.   # Fixed wrong animation frames when the character is facing down.
  1320.   def perform_animated(pattern)
  1321.     case pattern
  1322.     when 0
  1323.       apply_angle_pattern(10, -12, -166) if @character.user.direction == 2
  1324.       if @character.user.direction == 4 || @character.user.direction == 6
  1325.         apply_angle_pattern(-8, -26, -46)
  1326.         self.z = @character.user.screen_z - 1
  1327.       end
  1328.       apply_angle_pattern(-22, -10, 0)   if @character.user.direction == 8
  1329.     when 1
  1330.       apply_angle_pattern(8, -5, -210)   if @character.user.direction == 2
  1331.       apply_angle_pattern(-20, -10, 12) if @character.user.direction == 4
  1332.       apply_angle_pattern(7, -20, -78)  if @character.user.direction == 6
  1333.       if @character.user.direction == 8
  1334.         apply_angle_pattern(-8, -26, -46)
  1335.         self.z = @character.user.screen_z - 1
  1336.       end
  1337.     when 2
  1338.       apply_angle_pattern(0, 0, -266)    if @character.user.direction == 2
  1339.       apply_angle_pattern(-10, 2, 52)     if @character.user.direction == 4
  1340.       apply_angle_pattern(8, -15, -126)  if @character.user.direction == 6
  1341.       apply_angle_pattern(10, -16, - 100) if @character.user.direction == 8
  1342.     end
  1343.   end
  1344.  
  1345. end
  1346.  
  1347. class Spriteset_Map
  1348.  
  1349.   # Dispose fix for dead icons on the map.
  1350.   alias fix_dead_icons5542 create_pearl_abs_sprites
  1351.   def create_pearl_abs_sprites
  1352.     fix_dead_icons5542
  1353.     @dead_characters = []
  1354.     @dead_iconsprites = []
  1355.     for follower in $game_player.followers
  1356.       next if follower.visible? == nil
  1357.       next unless follower.battler.dead?
  1358.       unless @dead_characters.include?(follower)
  1359.         sprite = Sprite_DeadIcon.new(@viewport1, follower)
  1360.         @dead_iconsprites.push(sprite)
  1361.         @dead_characters.push(follower) if !@dead_characters.include?(follower)
  1362.       end
  1363.     end
  1364.   end
  1365.  
  1366.   alias fix_dead_icons8888 dispose_pearlabs_sprites
  1367.   def dispose_pearlabs_sprites
  1368.     fix_dead_icons8888
  1369.     @dead_iconsprites.each {|dsprite| dsprite.dispose}
  1370.     @dead_iconsprites.clear
  1371.     @dead_characters = []
  1372.   end
  1373.  
  1374.   def hide_boss_bar
  1375.     if !@enemyhpsp.nil?
  1376.       @enemyhpsp.dispose
  1377.       @enemyhpsp = nil
  1378.       $game_system.enemy_lifeobject = nil
  1379.       @enemy_lifeobject = nil
  1380.     end
  1381.   end
  1382.  
  1383. end
  1384.  
  1385. class Sprite_LifeBars < Sprite
  1386.   # Boss bar disposal fix on map changes.
  1387.   alias fix_map_change_bar6322 initialize
  1388.   def initialize(viewport, character)
  1389.     @map_id = $game_map.map_id
  1390.     fix_map_change_bar6322(viewport, character)
  1391.   end
  1392.  
  1393.   alias fix_map_change_bar5542 update
  1394.   def update
  1395.     fix_map_change_bar5542
  1396.     if boss?
  1397.       dispose if !self.disposed? && @map_id != $game_map.map_id
  1398.     end
  1399.   end
  1400.  
  1401. end
  1402.  
  1403. class Scene_Map < Scene_Base
  1404.  
  1405.   def hide_boss_bar
  1406.     @spriteset.hide_boss_bar
  1407.   end
  1408.  
  1409. end
  1410.  
  1411. class Window_SlotConfirm < Window_Command
  1412.  
  1413.   # SE fix.
  1414.   def process_ok
  1415.     if current_item_enabled?
  1416.       Input.update
  1417.       deactivate
  1418.       call_ok_handler
  1419.     else
  1420.       Sound.play_buzzer
  1421.     end
  1422.   end
  1423.  
  1424. end
  1425.  
  1426. class Window_ActorQuickTool < Window_Selectable
  1427.  
  1428.   def refresh(actor, kind) # Dual wield fix 2!
  1429.     self.contents.clear if self.contents != nil
  1430.     @data = []
  1431.     case kind
  1432.     when :weapon, :armor
  1433.       type = kind == :weapon ? actor.equip_slots[0] : actor.equip_slots[1]
  1434.       equips = $game_party.equip_items
  1435.       equips << actor.equips[0] if actor.equips[0] && !equips.include?(actor.equips[0])
  1436.       equips << actor.equips[1] if actor.equips[1] && !equips.include?(actor.equips[1])
  1437.       equips.each do |eq|
  1438.         next if eq.etype_id > 1
  1439.         next unless actor.equippable?(eq)
  1440.         next if eq.etype_id != type
  1441.         next if eq.tool_data("Exclude From Tool Menu = ", false) == "true"
  1442.         @data.push(eq)
  1443.       end
  1444.     when :skill
  1445.       actor.skills.each do |sk|
  1446.         next if sk.tool_data("Exclude From Tool Menu = ", false) == "true"
  1447.         @data.push(sk)        
  1448.       end
  1449.     when :item
  1450.       $game_party.items.each do |it|
  1451.         next if it.tool_data("Exclude From Tool Menu = ", false) == "true"
  1452.         @data.push(it)
  1453.       end
  1454.     end
  1455.     @item_max = @data.size
  1456.     if @item_max > 0
  1457.       self.contents = Bitmap.new(width - 32, row_max * 24)
  1458.       for i in 0...@item_max
  1459.         draw_item(i)
  1460.       end
  1461.     end
  1462.   end
  1463.  
  1464. end
  1465.  
  1466. class Scene_QuickTool < Scene_MenuBase
  1467.  
  1468.   # Tool equip fixes.
  1469.   def perform_item_ok
  1470.     return if @items_w.item.nil?
  1471.     case @type_select.current_symbol
  1472.     when :weapon
  1473.       if DisplayTools.tool_cool(:wp) || $game_player.in_combat_mode?
  1474.         Sound.play_buzzer
  1475.       else
  1476.         actor.change_equip_by_id(0, @items_w.item.id)
  1477.         equip_play
  1478.       end
  1479.     when :armor
  1480.       if DisplayTools.tool_cool(:ar) || $game_player.in_combat_mode?
  1481.         Sound.play_buzzer
  1482.       else
  1483.         actor.change_equip_by_id(1, @items_w.item.id)
  1484.         equip_play
  1485.       end
  1486.     when :item
  1487.       activate_slots
  1488.     when :skill
  1489.       activate_slots
  1490.     end
  1491.     DisplayTools.sprite.refresh_texts
  1492.   end
  1493.  
  1494.   def open_slots
  1495.     if @type_select.current_symbol == :item
  1496.       case @slot_confirm.current_symbol
  1497.       when :slot1
  1498.         if DisplayTools.tool_cool(:i1) || $game_player.in_combat_mode? ||
  1499.            actor.assigned_item2 == @items_w.item
  1500.           Sound.play_buzzer
  1501.         else
  1502.           actor.assigned_item  = @items_w.item; equip_play
  1503.         end
  1504.       when :slot2
  1505.         if DisplayTools.tool_cool(:i2) || $game_player.in_combat_mode? ||
  1506.            actor.assigned_item == @items_w.item
  1507.           Sound.play_buzzer
  1508.         else
  1509.           actor.assigned_item2 = @items_w.item; equip_play
  1510.         end
  1511.       end
  1512.     else
  1513.       case @slot_confirm.current_symbol
  1514.       when :slot1
  1515.         if DisplayTools.tool_cool(:s1) || $game_player.in_combat_mode? ||
  1516.            [actor.assigned_skill2,actor.assigned_skill3,actor.assigned_skill4].any? {|skill| skill == @items_w.item}
  1517.           Sound.play_buzzer
  1518.         else
  1519.           actor.assigned_skill = @items_w.item; equip_play
  1520.         end
  1521.       when :slot2
  1522.         if DisplayTools.tool_cool(:s2) || $game_player.in_combat_mode? ||
  1523.            [actor.assigned_skill,actor.assigned_skill3,actor.assigned_skill4].any? {|skill| skill == @items_w.item}
  1524.           Sound.play_buzzer
  1525.         else
  1526.           actor.assigned_skill2 = @items_w.item; equip_play
  1527.         end
  1528.       when :slot3
  1529.         if DisplayTools.tool_cool(:s3) || $game_player.in_combat_mode? ||
  1530.            [actor.assigned_skill2,actor.assigned_skill,actor.assigned_skill4].any? {|skill| skill == @items_w.item}
  1531.           Sound.play_buzzer
  1532.         else
  1533.           actor.assigned_skill3 = @items_w.item; equip_play
  1534.         end
  1535.       when :slot4
  1536.         if DisplayTools.tool_cool(:s4) || $game_player.in_combat_mode? ||
  1537.            [actor.assigned_skill2,actor.assigned_skill3,actor.assigned_skill].any? {|skill| skill == @items_w.item}
  1538.           Sound.play_buzzer
  1539.         else
  1540.           actor.assigned_skill4 = @items_w.item; equip_play
  1541.         end
  1542.       end
  1543.     end
  1544.     deactivate_slots
  1545.     DisplayTools.sprite.refresh_texts
  1546.   end
  1547.  
  1548.   alias add_tool_remove9937 update
  1549.   def update
  1550.     add_tool_remove9937
  1551.     update_tool_remove if Falcao_ABS_Fix1::ToolUnequip
  1552.   end
  1553.  
  1554.   def update_tool_remove
  1555.     if PearlKey.trigger?(Key::Weapon[0])
  1556.       return unless actor.equips[0]
  1557.       if actor.equip_change_ok?(0)
  1558.         actor.change_equip(0, nil)
  1559.         Sound.play_equip; DisplayTools.sprite.refresh_texts
  1560.       else
  1561.         Sound.play_buzzer
  1562.       end
  1563.     end
  1564.     if PearlKey.trigger?(Key::Armor[0])
  1565.       return unless actor.equips[1]
  1566.       if actor.equip_change_ok?(1)
  1567.         actor.change_equip(1, nil)
  1568.         Sound.play_equip; DisplayTools.sprite.refresh_texts
  1569.       else
  1570.         Sound.play_buzzer
  1571.       end
  1572.     end
  1573.     if PearlKey.trigger?(Key::Skill[0]) && actor.assigned_skill
  1574.       actor.assigned_skill = nil
  1575.       Sound.play_equip; DisplayTools.sprite.refresh_texts
  1576.     elsif PearlKey.trigger?(Key::Skill2[0]) && actor.assigned_skill2
  1577.       actor.assigned_skill2 = nil
  1578.       Sound.play_equip; DisplayTools.sprite.refresh_texts
  1579.     elsif PearlKey.trigger?(Key::Skill3[0]) && actor.assigned_skill3
  1580.       actor.assigned_skill3 = nil
  1581.       Sound.play_equip; DisplayTools.sprite.refresh_texts
  1582.     end
  1583.     if PearlKey.trigger?(Key::Item[0]) && actor.assigned_item
  1584.       actor.assigned_item = nil
  1585.       Sound.play_equip; DisplayTools.sprite.refresh_texts
  1586.     end
  1587.   end
  1588.  
  1589. end
  1590. #==============================================================================
  1591. # !!END OF SCRIPT - OHH, NOES!!
  1592. #==============================================================================
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top