Advertisement
TheSixth

Basic Enemy AI Module for Falcao's ABS by Sixth

Sep 2nd, 2015
1,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 47.36 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Basic AI Module for Falcao's Pearl ABS Liquid v3
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.2
  6. # * Updated: 02/09/2015
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (01/08/2015)
  12. #   - Initial release.
  13. # * Version 1.1 (05/08/2015)
  14. #   - Added situational tool group settings.
  15. #     These can not be used by the enemy if the conditions for them do not match.
  16. #     You can check for:
  17. #     ~ HP rates.
  18. #     ~ States inflicted.
  19. #     ~ States not inflicted.
  20. #     ~ Distance from another character (2 types).
  21. #     ~ Switches.
  22. #     ~ Variables.
  23. #     With these, you can check if any enemy on the screen matches the  
  24. #     condition(s) required or not.
  25. #   - Added forced "targeting scope" options.
  26. #     This will let the enemy heal the most wounded allies automatically, or
  27. #     will use cure only on poisoned enemies, for example.
  28. #   - Combine these two new features, and make highly intelligent healer enemies,
  29. #     or make enemies enrage when their partners are close to death (or dead)!
  30. #     These are just examples, use your imagination to make better AI for your
  31. #     enemies!
  32. # * Version 1.2 (02/09/2015)
  33. #   - Added some conditional movement script calls.
  34. #     You can now have a bit more control over how your enemy moves and when.
  35. #-------------------------------------------------------------------------------
  36. # * < Description >
  37. #-------------------------------------------------------------------------------
  38. # * By default, the random tool usage script calls Falcao provided are not very
  39. #   flexible. It simply selects a random tool from a pool you specify. It can
  40. #   not be used to define actual chance of usage for the tools, so if you would
  41. #   like to add 3 skills, for example, 1 weak, 1 mid and 1 very strong one, it
  42. #   is highly possible that the enemy will use a lot of very strong tools in a
  43. #   row, which is not something that a developer wants normally, right?
  44. # * With this script, you can set the chance of usage for each tool you add to
  45. #   the random pool, so you can limit a very strong tool to be only used 5% of
  46. #   the times, for example.
  47. # * You can also set up HP thresholds for your random tools. For example, you
  48. #   can remove a skill like "Heal" from the random pool if the enemy is above
  49. #   50% HP, and let the enemy only cast it if it's HP is below 50%.
  50. #   Effectively, this is the same function what Falcao provided with the HP
  51. #   threshold switch notes for enemies, but this one is more flexible and
  52. #   requires no switch usage at all!
  53. # * You can even set up a mixed group, meaning mix weapon and skill tools too
  54. #   in the random pool with the mixed group settings!
  55. # * From v.1.1, you are not limited to check the user's HP only!
  56. #   Check for any enemy's HP or states inflicted on the screen!
  57. #   Check if the player or any other enemy is in a specified range from the user!
  58. # * Add situational tools depending on other enemies' HP, states, distance!
  59. # * Activate a whole new group of tools for the enemy with a switch or variable!
  60. # * Basic AI for your enemies! Basic is better than no AI at all, riight? :D
  61. #-------------------------------------------------------------------------------
  62. # * < Script Calls>
  63. #-------------------------------------------------------------------------------
  64. # * All script calls are used within the Move Route event command!
  65. # * To make an enemy use a random tool from your tool group settings, simply use
  66. #   the following script calls:
  67. #
  68. #     adv_rand_w(group_id)  <-- For weapon tools.
  69. #     adv_rand_a(group_id)  <-- For armor tools.
  70. #     adv_rand_s(group_id)  <-- For skill tools.
  71. #     adv_rand_i(group_id)  <-- For item tools.
  72. #
  73. #     adv_tool_group(group_id) <-- For mixed tool types.
  74. #
  75. #   Replace 'group_id' with a key you used in your tool group settings.
  76. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  77. # * To make an enemy use situational tools, use the following script call:
  78. #
  79. #     epic_tool_group(adv_group_id,[group_data])
  80. #
  81. #   The 'adv_group_id' is the key of the situational tool list you want to use.
  82. #
  83. #   The '[group_data]' is an array, and that will be the regular tool list of
  84. #   the enemy. You can set up any tool group for it from the 'Weapons', 'Armors',
  85. #   'Skills', 'Items' or 'Mixed' settings in the script.
  86. #   Here is how it looks like:
  87. #     [:type,group_id]
  88. #   Replace :type with one of these: :weapon, :armor, :skill, :item or :mix.
  89. #   These will decide the type of the tool group settings.
  90. #   :weapon will read a group from the 'Weapons' settings, and so on.
  91. #   The group_id is the key of the tool group you want to use.
  92. #   For example: [:skill,2], [:mix,1], etc.
  93. #   If you omit this, than the enemy will not use any tool if no situational
  94. #   tool passed it's condition/chance checks. It will simply stay idle.
  95. #
  96. #   Example:
  97. #
  98. #     epic_tool_group(1,[:skill,3])
  99. #
  100. #   This will make the enemy first check the tools used in the situational group
  101. #   with the key of 1. If no tools can be used from that group (so the
  102. #   conditions for them do not match or all of them failed the chance check),
  103. #   it will select a tool from the 'Skills' tool groups (the HP thresholds and
  104. #   chance settings from that will still apply), specifically, from the group
  105. #   with the key of 3 in the settings.
  106. #
  107. #     epic_tool_group(4)
  108. #
  109. #   This will make the enemy check the tools from the situational group with the
  110. #   key of 4. If no tool can be used (conditions are not met or chance check
  111. #   failed) from the group, the enemy will not use any tool, it will just wait
  112. #   one round. You should put at least one 'wait' move command before or after
  113. #   this script call if this is the only thing you put in the enemy's auto-move
  114. #   command list. That will make sure that you won't have any performance issues
  115. #   (I tested, and I got no issues, even without any 'wait' command, but it's
  116. #   better to be safe than sorry, right? :P).
  117. #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  118. # * To add some distance conditions to the movement of the enemies, you can use
  119. #   the following script call:
  120. #
  121. #     custom_move_route(:type,range,target)
  122. #
  123. #   You have 3 options for the :type setting:
  124. #   1. :close_in = This will make the enemy approach the target if the target is
  125. #                  not yet within the specified range. If it is in range, it
  126. #                  will not move closer.
  127. #   2. :stay_in_range = This will make the enemy stay in the specified range.
  128. #                       If the enemy is closer than the range specified, it will
  129. #                       move away from the target, if the enemy is farther than
  130. #                       the range, it will move closer.
  131. #   3. :get_away = This will make the enemy move away from the target if it is
  132. #                  closer than the range specified.
  133. #
  134. #   The 'range' is the sum distance from the target on the X and Y axis.
  135. #   It is measured in tiles.
  136. #
  137. #   The 'target' is a valid character object. That can be:
  138. #   $game_player         # <-- For the player.
  139. #   $game_map.events[ID] # <-- For any events on the map.
  140. #   $game_followers[ID]  # <-- For any followers on the map. This is not tested!
  141. #   If you omit the target argument, $game_player is used by default.
  142. #
  143. #   Examples:
  144. #
  145. #     custom_move_route(:close_in,5)
  146. #   This makes the event where the script call is used move toward the player
  147. #   if the distance between them is more than 5 tiles. If it is less or equal,
  148. #   the event will not move.
  149. #
  150. #     custom_move_route(:stay_in_range,3,$game_map.events[2])
  151. #   This makes the event where the script call is used move toward the other
  152. #   event (with ID 2) when the distance between them is more than 3 tiles, and
  153. #   will make the event move away from the other one if the distance is less
  154. #   than 3 tiles. If the distance is equal 3 tiles, the event will not move.
  155. #
  156. #     custom_move_route(:get_away,4)
  157. #   This makes the event where the script call is used move away from the player
  158. #   if the distance between them is less than 4 tiles. If the distance is more
  159. #   or equal 4 tiles, the event will not move.
  160. #-------------------------------------------------------------------------------
  161. # * < Note-tags >
  162. #-------------------------------------------------------------------------------
  163. # * To make a healing or state curing situational tool work correctly, you must
  164. #   tag them with the following note-tags:
  165. #
  166. #   ~ For healing tools:
  167. #       Tool Enemy Heal = true
  168. #   This will automatically set the enemy with the lowest HP rate to be the
  169. #   target of this tool. The scope of the tool must be set to "One Ally" in the
  170. #   database, or else this function will NOT work!
  171. #
  172. #   ~ For state curing tools:
  173. #       Tool Enemy State = state_id1, state_id2, ... state_idN
  174. #   This will automatically set the first enemy found with any of the states
  175. #   listed inflicted to be the target of the tool.
  176. #   Replace the 'state_ids' with the state IDs you want to be cured on the target.
  177. #   You can add as many as you want.
  178. #   The scope of the tool must be set to "One Ally" ("or One Ally (Dead)" in the
  179. #   case of death state removal, aka state ID 1) in the database, or else this
  180. #   function will NOT work!
  181. #
  182. #   You only need to set these note-tags if you want the enemy to target
  183. #   intelligently, instead of blowing off healing and curing tools on random
  184. #   enemies. Even if you don't set these tags, the enemies will still use the
  185. #   selected situational tool, but they will simply select a target randomly.
  186. #   Needless to say that if your tool's scope is "All Ally" or an enemy related,
  187. #   you don't really need these new "targeting scopes".
  188. #-------------------------------------------------------------------------------
  189. # * < Installation >
  190. #-------------------------------------------------------------------------------
  191. # * Place this script below all of Falcao's ABS scripts but above Main!
  192. #-------------------------------------------------------------------------------
  193. # * < Compatibility Info >
  194. #-------------------------------------------------------------------------------
  195. # * No known incompatibilities.
  196. #-------------------------------------------------------------------------------
  197. # * < Known Issues >
  198. #-------------------------------------------------------------------------------
  199. # * No known issues.
  200. #-------------------------------------------------------------------------------
  201. # * < Terms of Use >
  202. #-------------------------------------------------------------------------------
  203. # * Free to use for whatever purposes you want.
  204. # * Credit me (Sixth) in your game, pretty please! :P
  205. # * Posting modified versions of this script is allowed as long as you notice me
  206. #   about it with a link to it!
  207. #===============================================================================
  208. $imported = {} if $imported.nil?
  209. $imported["SixthFalcaoABSBasicAI"] = true
  210. #===============================================================================
  211. # Settings:
  212. #===============================================================================
  213. module AdvRandTool
  214.   #-----------------------------------------------------------------------------
  215.   # Single Tool Group Settings
  216.   #-----------------------------------------------------------------------------
  217.   # These settings are good only if you don't plan on mixing weapon and skill
  218.   # tools in your group settings, for example.
  219.   # So, you can only use one type of tool in these settings.
  220.   # If you don't need mixed groups, than use these settings instead of the
  221.   # mixed one, because this one is a bit faster (the difference is not
  222.   # noticeable for human eyes, but still).
  223.   #
  224.   # Format:
  225.   #
  226.   #   group_id => {
  227.   #     hp_rate => {
  228.   #       tool_id => [chance_min,chance_max],
  229.   #       tool_id => [chance_min,chance_max],
  230.   #       # <-- You can add more tool settings here!
  231.   #     },
  232.   #     # <-- You can add more HP rate threshold settings here!
  233.   #   },
  234.   #   # <-- You can add more group settings here!
  235.   #
  236.   # group_id = The key used in the script calls, just an identifier.
  237.   #            I used numbers in my game, but you can use strings and symbols
  238.   #            too if you want. Do not make duplicates!
  239.   # hp_rate = HP rate threshold. Goes from lower to higher thresholds.
  240.   #           If the enemy got equal or lower HP rate than this number, the tool
  241.   #           group will be selected. 1 means 1%, 20 means 20%, and so on.
  242.   # tool_id = The ID of the weapon/armor/skill/item to use.
  243.   # [chance_min,chance_max] = Specify a range for the probability calculations.
  244.   #                           Valid numbers: from 0 to 99.
  245.   #                  Example: [0,21] means 22%, 22 numbers total from 0 to 21.
  246.   #                           It is inclusive, so 0 and 21 counts too!
  247.   #                           Adding higher numbers than 99 will mean nothing!
  248.   #
  249.   # Current formula:
  250.   # Checks for HP rates, selects the proper tool group based on HP.
  251.   # A random number is generated between 0 and 99. If the number is between the
  252.   # chance range of a tool, that tool will be selected.
  253.   #
  254.   # Example setting explanation:
  255.   # You can see one example in the Skills settings.
  256.   # The group_id I used is a number, a simple 1. This will be used in the script
  257.   # call. The script call would look like: adv_rand_s(1) .
  258.   # I set up a threshold for 25% HP or below and one 100% or below. The latter
  259.   # needs to be set up for every group! Every other thresholds are optional.
  260.   # You can add as many thresholds as you want.
  261.   # In the 25% HP threshold group, I added in a self-heal tool (ID 187), which
  262.   # will be used 78% of the times (22 to 99, meaning 78 numbers total), and a
  263.   # regular attack tool (ID 192), which will be used 22% of the times (0 to 21,
  264.   # meaning 22 numbers total).
  265.   # This means that if the random number generated is 65, for example, the
  266.   # "Heal" skill will be used. If the random number is 32, the "Heal" skill will
  267.   # be used again. If the number is 15, the enemy will attack. And so on...
  268.   # Effectively, when the enemy heals itself above 25% HP, it will switch to
  269.   # the 100% threshold tool group, and stops healing itself automatically,
  270.   # almost like an intelligent being. :P
  271.   #
  272.   # But healing AI is not the only thing you can do with this.
  273.   # You can make the enemy use stronger skills if they are below 30% HP,
  274.   # for example, or you can even switch it up, and make the enemy use stronger
  275.   # skills when they are close to full HP, instead of being almost dead.
  276.   #
  277.   # NOTE:
  278.   # If you miss some numbers from the chance setting, the enemies will randomly
  279.   # "do" nothing too! The more numbers you miss, the bigger the chance of them
  280.   # just waiting instead of acting (using a tool).
  281.   #-----------------------------------------------------------------------------
  282.   Weapons = {
  283.       # Add your weapon tool group settings here.
  284.   }
  285.  
  286.   Armors = {
  287.       # Add your armor tool group settings here.
  288.   }
  289.  
  290.   Skills = {
  291.     1 => { # Skill tool group setting 1.
  292.       25 => { 187 => [22,99], 192 => [0,21] },
  293.       100 => { 192 => [9,99], 196 => [0,8] },
  294.     },
  295.     2 => { # Skill tool group setting 2.
  296.       100 => { 193 => [0,99] },
  297.     },
  298.     3 => { # Skill tool group setting 3.
  299.       30 => { 187 => [36,99], 193 => [12,35], 214 => [0,11] },
  300.       100 => { 193 => [40,99], 214 => [0,39] },
  301.     },
  302.     4 => { # Skill tool group setting 4.
  303.       30 => { 187 => [36,99], 184 => [12,35], 172 => [0,11] },
  304.       100 => { 172 => [40,99], 186 => [0,39] },
  305.     },
  306.     # Add more skill tool group settings here.
  307.   }
  308.  
  309.   Items = {
  310.       # Add your item tool group settings here.
  311.   }
  312.  
  313.   #-----------------------------------------------------------------------------
  314.   # Mixed Tool Group Settings
  315.   #-----------------------------------------------------------------------------
  316.   # If you need to mix weapon tools with skill tools, or item tools with skills,
  317.   # and so on, you can set a mixed group up for it here.
  318.   # The format is almost the same, but instead of simply adding the tool IDs,
  319.   # you will use an array at that place to define the type of the tool and
  320.   # it's ID.
  321.   #
  322.   # The types are symbols and they are:
  323.   #   :weapon, :armor, :skill, :item
  324.   # It is pretty obvious what these mean, right? :P
  325.   # So, it looks like this: [:type,ID] => [chance_min,chance_max],
  326.   #
  327.   # In the example here, I use the same HP thresholds settings like in the
  328.   # skill group example, but now instead of a normal skill attack, I use a
  329.   # weapon tool instead. This means the enemy will use "Heal" 78% of times, and
  330.   # will use the weapon with the ID of 2 the rest of the times when it's HP is
  331.   # below 25%. If it is above, it will use a regular skill attack all the time.
  332.   # The script call for this would look like this: adv_tool_group(1) .
  333.   #-----------------------------------------------------------------------------
  334.   Mixed = {
  335.     1 => {
  336.       25 => { [:skill,187] => [22,99], [:weapon,2] => [0,21] },
  337.       100 => { [:skill,193] => [0,99] },
  338.     },
  339.     2 => {
  340.       25 => { [:skill,187] => [22,99], [:weapon,7] => [0,21] },
  341.       100 => { [:weapon,38] => [0,99] },
  342.     },
  343.     # Add more mixed tool group settings here.
  344.   }
  345.  
  346.   #-----------------------------------------------------------------------------
  347.   # Situational Tool Group Settings
  348.   #-----------------------------------------------------------------------------
  349.   # This is where you can set up some real AI involved thinking for your enemies.
  350.   # Every tool must have a condition set up here. The conditions will decide
  351.   # whether the enemy will use the tool or not.
  352.   # In other words, these are tools which will only be used when they are needed
  353.   # or if they are enabled.
  354.   # Great for making thinking healer enemies, for example.
  355.   # Another epic usage is to make enraged enemies when their partners get low HP.
  356.   # And yet another is making some complicated puzzles with the help of tools!
  357.   #
  358.   # Format:
  359.   #  
  360.   #   group_id => {
  361.   #     [type,ID] => {
  362.   #       :conditions => {
  363.   #         :hp => [:check_target,rate,check_type],            
  364.   #         :state => [:check_target,[state_ids],check_type],  
  365.   #         :nostate => [:check_target,[state_ids],check_type],
  366.   #         :distance => [:check_target,[x,y],[check_typeX,check_typeY],"check_mode"],
  367.   #         :distance2 => [:check_target,distance,"check_type"],
  368.   #         :switch => [[switch_ids],true/false,check_type],
  369.   #         :variable => [[var_id,value,check_type],...],
  370.   #       },
  371.   #       :chance => value,
  372.   #     },
  373.   #     # Add more tool settings here!
  374.   #   },
  375.   #   # Add more group settings here!
  376.   #
  377.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  378.   # Basic data explanation:
  379.   #
  380.   # These must be present for all of your tools you set up here!
  381.   #
  382.   # group_id = Same as for the basic group settings.
  383.   #            This is an identifier/key which can be anything from numbers to
  384.   #            strings, and even symbols. I used numbers in my game.
  385.   #            Must be a unique key, so no duplicates!
  386.   #            This is what you will use in your script calls.
  387.   #
  388.   # type = The type of the tool. You have 2 groups of settings here:
  389.   #        Use :weapon, :armor, :skill or :item if you want to set conditions
  390.   #        for single tools.
  391.   #        Use "weapon", "armor", "skill", "item" or "mix" if you want to set
  392.   #        a condition for a whole group of tools.
  393.   #        So, symbols for single tools, strings for groups!
  394.   #
  395.   # ID = The database ID of the tool (if you use a symbol for the type)
  396.   #      or the tool group key (if you use a string for the type).
  397.   #
  398.   # :chance = The chance of the tool being used.
  399.   #           Enter a number between 1 and 100 for the value.
  400.   #           1 = 1%, 30 = 30%, 100 = 100%
  401.   #          
  402.   # Note that even if the condition is matched, it is not 100% that the enemy
  403.   # will use that tool, unless you set the :chance for it to 100!
  404.   #
  405.   # Also, these tools or groups are higher priority on the tool selection list.
  406.   # The system will first check these settings.
  407.   # If the condition is true, and the usage chance check is passed, a tool from
  408.   # this list will be used instead of the tools from the regular tool group list.
  409.   # If the condition check returns false, or the chance check is false, it
  410.   # proceeds to select a tool from the regular tool group list.
  411.   #
  412.   # Now, let's start with the available condition check types!
  413.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  414.   # Condition Type 1 (HP rate checks):
  415.   #
  416.   #   :hp => [:check_target,rate,"check_type"],
  417.   #
  418.   # :check_target = 3 target type can be specified for this condition:
  419.   #   1. :self = Will only check the condition on the user itself.
  420.   #   2. :player = Will only check the condition on the player.
  421.   #   3. :any = Will check the condition on any visible enemies on the screen.
  422.   #             Even if only one enemy matches the condition, the tool can be used.
  423.   #
  424.   # rate = The HP rate to check for. Takes float numbers, meaning:
  425.   #        0.1 = 10%, 0.3 = 30%, 0.5 = 50%, 1.0 = 100%, and so on.
  426.   #
  427.   # "check_type" = The type of comparison used for the condition.
  428.   #                It can be: ">", ">=", "=", "<", "<=" or "!=".
  429.   #                These are strings, so use the quotation marks!
  430.   #                It's obvious what they mean (hint: basic math :P).
  431.   #
  432.   # Examples:
  433.   #
  434.   #   :hp => [:player,0.3,"<="],  
  435.   # A tool with this setup will only be used if the player is NOT above 30% HP.
  436.   #
  437.   #   :hp => [:any,0.5,"<"],
  438.   # A tool with this setup will only be used if there is at least one enemy on
  439.   # the visible screen with less than 50% HP. I sense thinking healer enemies!
  440.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  441.   # Condition Type 2 (State inflicted checks):
  442.   #
  443.   #   :state => [:check_target,[state_ids],"check_type"],
  444.   #
  445.   # :check_target = Same as for the HP rate condition type.
  446.   #
  447.   # [state_ids] = This is an array containing the IDs of the states you want to
  448.   #               check for. You can enter as many IDs as you want.
  449.   #
  450.   # "check_type" = The type of the check used. You have 2 options here:
  451.   #   1. "any" = This means that even if only one state from the list is
  452.   #              inflicted on the check target(s), the tool can be used.
  453.   #   2. "all" = This means that ALL of the entered states must be inflicted on
  454.   #              the check target(s) in order for this tool to be used.
  455.   #
  456.   # Examples:
  457.   #
  458.   #   :state => [:any,[1],"all"],
  459.   # This means that if any enemy on the screen got the state with ID 1 inflicted
  460.   # (in other words, if any enemy is dead), the tool can be used.
  461.   # Since there is only one state to be checked, it doesn't really matter what
  462.   # type of check you use, both "any" and "all" should work.
  463.   #
  464.   #   :state => [:any,[2,3,4,5,6],"any"],
  465.   # This means that if any enemy on the screen got any of the states listed
  466.   # inflicted, the tool can be used. A great way to make a healer enemy cure all
  467.   # these nasty negative states from an ally!
  468.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  469.   # Condition Type 3 (State NOT inflicted checks):
  470.   #
  471.   #   :nostate => [:check_target,[state_ids],"check_type"],
  472.   #
  473.   # The format is exactly the same as for the state inflicted checks, but this
  474.   # time, it will check if the state is NOT inflicted.
  475.   #
  476.   # Examples:
  477.   #
  478.   #   :nostate => [:player,[2],"all"],
  479.   # This tool will only be used if the player do NOT have the state with ID of 2
  480.   # inflicted already. It's "Poison" by default, so if the enemy already poisoned
  481.   # the player, it won't use this tool, until the poison wears off or cured.
  482.   #
  483.   #   :nostate => [:self,[6],"any"],
  484.   # If the user already got the state with ID of 6 inflicted on it, this tool
  485.   # will NOT be used. Possible uses include an "Enrage" tool, which is executed
  486.   # only when there is a dead enemy on the screen and only if the "Enrage" state
  487.   # is NOT present yet. Or if the enemy got the "Regen" status already, it won't
  488.   # re-cast it, until it wears off.
  489.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  490.   # Condition Type 4 (Distance checks - Type 1):
  491.   #
  492.   #   :distance => [:check_target,[x,y],["check_typeX","check_typeY"],"check_mode"],
  493.   #
  494.   # :check_target = 2 target type can be specified for this condition:
  495.   #   1. :player = Will only check the condition on the player.
  496.   #   2. :any = Will check the condition on any visible enemies on the screen.
  497.   #             Even if only one enemy matches the condition, the tool can be used.
  498.   #
  499.   # [x,y] = The distance to check for. Measured in tiles.
  500.   #         You can use a different number for X and Y if you want.
  501.   #
  502.   # "check_typeX" = The type of comparison used for the condition.
  503.   # "check_typeY"   "check_typeX" is for the X distance condition, while
  504.   #                 "check_typeY" is for the Y distance condition.
  505.   #                 These can be: ">", ">=", "=", "<", "<=" or "!=" .
  506.   #                 Don't forget that they must be put into an array!
  507.   #
  508.   # "check_mode" = The mode of the comparison. You have two options to use:
  509.   #                "any" = If you use this mode, than it's enough if only 1 of
  510.   #                        the distance checks return true, it can be either
  511.   #                        the X distance or Y distance.
  512.   #               "both" = If you use this mode, both the X and Y checks must
  513.   #                        be true to use this tool.
  514.   #
  515.   # Examples:
  516.   #
  517.   #   :distance => [:player,[2,2],["<=","<="],"both"],
  518.   # The enemy will only use this tool if the player is not further than 2 tiles
  519.   # from it in both the X and Y axis. For example, a plant which can't move will
  520.   # only use this tool if the player is in range, like a "Pollen Attack". But
  521.   # if the player is not close enough, it switches to use another tool.
  522.   # This is the difference between this condition and the regular enemy sensor
  523.   # settings for this ABS. The sensor only let's you add one distance condition,
  524.   # while with this, you can add as many as you want, and you are not limited
  525.   # to "closer than" checks (you can use "further than" checks too, for example).
  526.   #
  527.   #   :distance => [:any,[5,3],[">","<"],"any"],
  528.   # The enemy will only use this tool if any other enemy is further than 5 tiles
  529.   # from it on the X axis, OR closer than 3 tiles on the Y axis. Only one check
  530.   # needs to be true, not both!
  531.   # This can be used to create cool puzzles if you combine some other elements
  532.   # of this ABS and add some eventing to it, for example.
  533.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  534.   # Condition Type 5 (Distance checks - Type 2):
  535.   #
  536.   #   :distance2 => [:check_target,distance,"check_type"],
  537.   #
  538.   # :check_target = The same like at the previous distance condition check type.
  539.   #
  540.   # distance = The total distance from the target to check for. This means the
  541.   #            sum of the distance on the X and Y axis.
  542.   #
  543.   # "check_type" = The type of comparison used for the condition.
  544.   #                It can be: ">", ">=", "=", "<", "<=" or "!=".
  545.   #                These are strings, so use the quotation marks!
  546.   #
  547.   # Examples:
  548.   #
  549.   #   :distance2 => [:player,3,"<="],
  550.   # The enemy will only use this tool, if the player is in 3 tiles range. This
  551.   # means that if the player is 1 tile away on the X axis, and 2 tiles away on
  552.   # the Y axis, or 1 tile away on the X axis and 2 tiles away on the Y axis,
  553.   # so, if the total distance on both the X and Y axis is not more than 3, the
  554.   # tool can be used, otherwise it will be disabled.
  555.   # You can use this to create 2 different type of tool sets for your enemies,
  556.   # one for close combat, and another one for ranged combat, for example.
  557.   #
  558.   #   :distance2 => [:any,3,">"],
  559.   # The enemy will only use this tool if there is at least 1 other enemy 3 tiles
  560.   # away from it. This interesting check can be used to make some chained tools.
  561.   # Add this tool for more enemies, and if the player let them separate, they
  562.   # all can use a powerful skill. Just an example, but it can be used for many
  563.   # more things, if you have some imagination.
  564.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  565.   # Condition Type 6 (Switch checks):
  566.   #
  567.   #   :switch => [[switch_ids],true/false,"check_type"],
  568.   #
  569.   # [switch_ids] = The IDs of the switches you want to check for.
  570.   #                You can add as many as you want.
  571.   #
  572.   # true/false = The state of the switch(es) you want to check.
  573.   #              To check if a switch is turned ON, you should use true,
  574.   #              otherwise use false.
  575.   #
  576.   # "check_type" = The type of the check used. You have 2 options here:
  577.   #   1. "any" = This means that even if only one switch from the list matches
  578.   #              the state you checked for, the tool can be used.
  579.   #   2. "all" = This means that ALL of the entered switches must match the
  580.   #              state you checked for in order for this tool to be used.
  581.   #
  582.   # Examples:
  583.   #
  584.   #   :switch => [[12,14],true,"all"],
  585.   # This tool can only be used by the enemy if both switch 12 and 14 are turned
  586.   # ON. It is great for changing the behaviour of your enemies after some major
  587.   # events in your story-line.
  588.   #
  589.   #   :switch => [[13,15,35,34],true,"any"],
  590.   # This tool can be used by the enemy as soon as one of those switches is
  591.   # turned ON. In case you are designing a non-linear game, and you find
  592.   # yourself turning on different switches for different paths, but still want
  593.   # your enemies to get stronger after any major events, you can use the switch
  594.   # conditions like this, for example.
  595.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  596.   # Condition Type 7 (Variable checks):
  597.   #
  598.   #   :variable => [[var_id,value,"check_type"],...],
  599.   #
  600.   # var_id = The ID of the variable you want to check for.
  601.   #
  602.   # value = The value to check for.
  603.   #
  604.   # "check_type" = The type of comparison used for the condition.
  605.   #                It can be: ">", ">=", "=", "<", "<=" or "!=".
  606.   #                These are strings, so use the quotation marks!
  607.   #
  608.   # Note that all of these are put into an array! You can add more of these
  609.   # arrays to check for multiple variables at the same time too!
  610.   #
  611.   # Examples:
  612.   #
  613.   #   :variable => [[2,15,">="],[4,100,"<"]],
  614.   # This tool can only be used by the enemy if the value of variable 2 is higher
  615.   # than or equal 15, AND if the value of variable 4 is lower than 100.
  616.   # Can be used for puzzle making or for changing enemy behaviours depending on
  617.   # these variables.
  618.   #
  619.   #   :variable => [[24,"Code Word","="]],
  620.   # This tool can only be used by the enemy if the "value" of variable 24 is a
  621.   # string, specifically the words "Code Word". Yeah, you can check for stored
  622.   # texts too, but you can only use the "=" or "!=" check types for these, or
  623.   # else your game will crash! Good for word puzzles, password checks, etc.
  624.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  625.   # And this is it for now.
  626.   # Combine these condition checks however you want!
  627.   # You can add multiple different types of conditions for your tools too, but
  628.   # make sure that you do NOT use duplicates! So, only one HP condition check,
  629.   # or only one state condition check, etc!
  630.   #
  631.   # For example:
  632.   #
  633.   #   :conditions => {
  634.   #     :hp => [:any,0.25,"<"],
  635.   #     :state => [:self,[12],"any"],
  636.   #     :switch => [[45,84,74],true,"all"],
  637.   #   },
  638.   #
  639.   # This tool can only be used by the enemy if:
  640.   # 1. Any enemy on the screen got less than 25% HP.
  641.   # 2. The user got the state with ID 12 inflicted on him/her/itself.
  642.   # 3. The switches 45, 84 and 74 are all turned ON.
  643.   # If any of the conditions do not match, the tool can NOT be used!
  644.   #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  645.   # NOTE:
  646.   # In order for some of these tools to work, you must set up an extra note-tag
  647.   # for them! These are the tools with :any type HP rate conditions, and the
  648.   # ones with :any type state inflicted conditions. To make the user target the
  649.   # correct allies, you must set the provided new note-tags for these tools.
  650.   # You can read more on that in the note-tag explanation at the script's header.
  651.   # You only need these note-tags if the tool's scope is "One Ally" (or
  652.   # "One Ally (Dead)" in the case of death state) to make sure that the enemy
  653.   # using the tool will target the intended target instead of just randomly
  654.   # using the tool on allies.
  655.   #-----------------------------------------------------------------------------
  656.   Advanced = {
  657.     1 => {
  658.       [:skill,211] => { # Revive
  659.         :conditions => {
  660.           :state => [:any,[1],"any"], # If dead
  661.         },
  662.         :chance => 60, # 60% chance of casting
  663.       },
  664.       [:skill,209] => { # Heal
  665.         :conditions => {
  666.           :hp => [:any,0.5,"<="], # If HP <= 50%
  667.         },
  668.         :chance => 40, # 40% chance of casting
  669.       },
  670.       [:skill,210] => { # Poison Cure
  671.         :conditions => {
  672.           :state => [:any,[27],"any"], # If poisoned
  673.         },
  674.         :chance => 40, # 40% chance of casting
  675.       },
  676.     },
  677.     2 => {
  678.       [:skill,212] => { # Enrage
  679.         :conditions => {
  680.           :state => [:any,[1],"any"], # If dead
  681.           :nostate => [:self,[56],"any"], # If no Enrage state
  682.         },
  683.         :chance => 100, # 100% chance of casting
  684.       },
  685.     },
  686.     3 => {
  687.       [:skill,213] => { # Plant Pollen
  688.         :conditions => {
  689.           :distance => [:player,[2,2],["<=","<="],"both"], # If player is in 2 tiles range
  690.         },
  691.         :chance => 60, # 60% chance of casting
  692.       },
  693.     },
  694.     4 => {
  695.       ["skill",4] => { # Skill tool group 4 ("ranged combat tools")
  696.         :conditions => {
  697.           :distance2 => [:player,3,">"], # If player is further than 3 tiles total
  698.         },
  699.         :chance => 100, # 100% chance
  700.       },
  701.       ["mix",2] => { # Mixed tool group 2 ("close combat tools")
  702.         :conditions => {
  703.           :distance2 => [:player,3,"<="], # If player is in 3 tiles range total
  704.         },
  705.         :chance => 100, # 100% chance
  706.       },
  707.     },
  708.     # Add more situational tool group settings here.
  709.   }
  710.  
  711. end
  712. #===============================================================================
  713. # End of Settings! Editing anything below may lead to... you know it, right?
  714. #===============================================================================
  715.  
  716. class Game_CharacterBase
  717.  
  718.   def custom_move_route(type,range,target=$game_player)
  719.     dist = eval_distance(target).sum
  720.     case type
  721.     when :close_in
  722.       if case_comparison(">",dist,range)
  723.         move_toward_character(target)
  724.       end
  725.     when :stay_in_range
  726.       if case_comparison(">",dist,range)
  727.         move_toward_character(target)
  728.       elsif case_comparison("<",dist,range)
  729.         move_away_from_character(target)
  730.       end
  731.     when :get_away
  732.       if case_comparison("<",dist,range)
  733.         move_away_from_character(target)
  734.       end
  735.     end
  736.   end
  737.  
  738.   def epic_tool_group(adv_group_id,group_data=nil)
  739.     AdvRandTool::Advanced[adv_group_id].each do |tool_inf,data|
  740.       if check_tool_conditions(data[:conditions]) == true
  741.         if data[:chance] >= rand(100)
  742.           return unless tool_can_use?
  743.           p "#{self.battler.name} (Ev ID: #{self.id}) using #{tool_inf[0]} #{tool_inf[1]}!"
  744.           case tool_inf[0]
  745.           when Symbol
  746.             proc_mixed_tool(tool_inf[0],tool_inf[1])
  747.           when String
  748.             new_data = [tool_inf[0].to_sym,tool_inf[1]]
  749.             use_correct_group(new_data)
  750.           end
  751.           return
  752.         end
  753.       end
  754.     end
  755.     use_correct_group(group_data) if !group_data.nil?
  756.   end
  757.  
  758.   def use_correct_group(group_data)
  759.     case group_data[0]
  760.     when :weapon
  761.       adv_rand_w(group_data[1])
  762.     when :armor
  763.       adv_rand_a(group_data[1])
  764.     when :skill
  765.       adv_rand_s(group_data[1])
  766.     when :item
  767.       adv_rand_i(group_data[1])
  768.     when :mix
  769.       adv_tool_group(group_data[1])
  770.     end
  771.   end
  772.  
  773.   def proc_mixed_tool(type,id)
  774.     case type
  775.     when :weapon
  776.       process_tool_action($data_weapons[id])
  777.     when :armor
  778.       process_tool_action($data_armors[id])
  779.     when :skill
  780.       process_tool_action($data_skills[id])
  781.     when :item
  782.       process_tool_action($data_items[id])
  783.     end
  784.   end
  785.  
  786.   def check_tool_conditions(conditions)
  787.     conditions.each do |type,dt|
  788.       case type
  789.       when :distance
  790.         case dt[0]
  791.         when :player
  792.           dist = eval_distance($game_player)
  793.           p dist
  794.           case dt[3]
  795.           when "any"
  796.             if case_comparison(dt[2][0],dist[0],dt[1][0]) == false &&
  797.                case_comparison(dt[2][1],dist[1],dt[1][1]) == false
  798.               return false
  799.             end
  800.           when "both"
  801.             if case_comparison(dt[2][0],dist[0],dt[1][0]) == false ||
  802.                case_comparison(dt[2][1],dist[1],dt[1][1]) == false
  803.               return false
  804.             end
  805.           end
  806.         when :any
  807.           cond = false
  808.           $game_map.event_enemies.each do |event|
  809.             if event.on_battle_screen? && !event.erased && !event.killed
  810.               dist = eval_distance(event)
  811.               case dt[3]
  812.               when "any"
  813.                 if case_comparison(dt[2][0],dist[0],dt[1][0]) == true ||
  814.                    case_comparison(dt[2][1],dist[0],dt[1][1]) == true
  815.                   cond = true
  816.                   break
  817.                 end
  818.               when "both"
  819.                 if case_comparison(dt[2][0],dist[0],dt[1][0]) == true &&
  820.                    case_comparison(dt[2][1],dist[0],dt[1][1]) == true
  821.                   cond = true
  822.                   break
  823.                 end
  824.               end
  825.             end
  826.           end
  827.           return false if cond == false
  828.         end
  829.       when :distance2
  830.         case dt[0]
  831.         when :player
  832.           dist = eval_distance($game_player).sum
  833.           if case_comparison(dt[2],dist,dt[1]) == false
  834.             return false
  835.           end
  836.         when :any
  837.           cond = false
  838.           $game_map.event_enemies.each do |event|
  839.             if event.on_battle_screen? && !event.erased && !event.killed
  840.               dist = eval_distance(event).sum
  841.               if case_comparison(dt[2],dist,dt[1]) == true
  842.                 cond = true
  843.                 break
  844.               end
  845.             end
  846.           end
  847.           return false if cond == false
  848.         end
  849.       when :switch
  850.         return false if any_all_switch_check(dt[2],dt[0],dt[1]) == false
  851.       when :variable
  852.         cond = true
  853.         dt.each do |var_inf|
  854.           if case_comparison(var_inf[2], $game_variables[var_inf[0]], var_inf[1]) == false
  855.             cond = false
  856.             break
  857.           end
  858.         end
  859.         return false if cond == false
  860.       when :hp
  861.         case dt[0]
  862.         when :self
  863.           return false if case_comparison(dt[2],self.battler.hp_rate,dt[1]) == false
  864.         when :any
  865.           cond = false
  866.           $game_map.event_enemies.each do |event|
  867.             if event.on_battle_screen? && !event.erased && !event.killed
  868.               cond = true if case_comparison(dt[2],event.battler.hp_rate,dt[1]) == true
  869.               break if cond == true
  870.             end
  871.           end
  872.           return false if cond == false
  873.         when :player
  874.           return false if case_comparison(dt[2],$game_player.battler.hp_rate,dt[1]) == false
  875.         end
  876.       when :state
  877.         case dt[0]
  878.         when :self
  879.           return false unless any_all_type_check(dt[2],self,dt[1]) == true
  880.         when :any
  881.           cond = false
  882.           $game_map.event_enemies.each do |event|
  883.             if event.on_battle_screen? && ((!event.erased && !event.killed) || dt[1].include?(1))
  884.               cond = true if any_all_type_check(dt[2],event,dt[1]) == true
  885.               break if cond == true
  886.             end
  887.           end
  888.           return false if cond == false
  889.         when :player
  890.           return false unless any_all_type_check(dt[2],$game_player,dt[1]) == true
  891.         end
  892.       when :nostate
  893.         case dt[0]
  894.         when :self
  895.           return false if any_all_type_check(dt[2],self,dt[1]) == true
  896.         when :any
  897.           cond = true
  898.           $game_map.event_enemies.each do |event|
  899.             if event.on_battle_screen? && ((!event.erased && !event.killed) || dt[1].include?(1))
  900.               cond = false if any_all_type_check(dt[2],event,dt[1]) == true
  901.               break if cond == false
  902.             end
  903.           end
  904.           return false if cond == false
  905.         when :player
  906.           return false if any_all_type_check(dt[2],$game_player,dt[1]) == true
  907.         end
  908.       end
  909.     end
  910.     return true
  911.   end
  912.  
  913.   def any_all_switch_check(type,switches,state)
  914.     case type
  915.     when "any"
  916.       return switches.any? {|switch| $game_switches[switch] == state }
  917.     when "all"
  918.       return switches.all? {|switch| $game_switches[switch] == state }
  919.     else
  920.       return false
  921.     end
  922.   end
  923.  
  924.   def any_all_type_check(type,target,reqs)
  925.     case type
  926.     when "any"
  927.       return reqs.any? {|req| target.battler.state?(req) }
  928.     when "all"
  929.       return reqs.all? {|req| target.battler.state?(req) }
  930.     else
  931.       return false
  932.     end
  933.   end
  934.  
  935.   def case_comparison(type, data, req)
  936.     case type
  937.     when ">"
  938.       return data > req
  939.     when ">="
  940.       return data >= req
  941.     when "==", "="
  942.       return data == req
  943.     when "<"
  944.       return data < req
  945.     when "<="
  946.       return data <= req
  947.     when "!="
  948.       return data != req
  949.     else
  950.       return false
  951.     end
  952.   end
  953.  
  954.   def adv_tool_group(group_id)
  955.     sel = 0; tool_type = :none
  956.     random_num = rand(100)
  957.     AdvRandTool::Mixed[group_id].each do |hprt,data|
  958.       next unless battler.hp_rate*100 <= hprt
  959.       data.each do |tool_inf,chance|
  960.         if random_num.between?(*chance)
  961.           sel = tool_inf[1]
  962.           tool_type = tool_inf[0]
  963.           p "#{self.battler.name} (Ev ID: #{self.id}) using #{tool_inf[0]} #{tool_inf[1]}!"
  964.           break
  965.         end
  966.       end
  967.       break if sel != 0
  968.     end
  969.     return unless tool_can_use?
  970.     proc_mixed_tool(tool_type,sel)
  971.   end
  972.  
  973.   def adv_rand_w(group_id)
  974.     sel = 0
  975.     random_num = rand(100)
  976.     AdvRandTool::Weapons[group_id].each do |hprt,data|
  977.       next unless battler.hp_rate*100 <= hprt
  978.       data.each do |weapon_id,chance|
  979.         if random_num.between?(*chance)
  980.           sel = weapon_id
  981.           p "#{self.battler.name} (Ev ID: #{self.id}) using weapon #{sel}!"
  982.           break
  983.         end
  984.       end
  985.       break if sel != 0
  986.     end
  987.     return unless tool_can_use?
  988.     process_tool_action($data_weapons[sel])
  989.   end
  990.  
  991.   def adv_rand_a(group_id)
  992.     sel = 0
  993.     random_num = rand(100)
  994.     AdvRandTool::Armors[group_id].each do |hprt,data|
  995.       next unless battler.hp_rate*100 <= hprt
  996.       data.each do |armor_id,chance|
  997.         if random_num.between?(*chance)
  998.           sel = armor_id
  999.           p "#{self.battler.name} (Ev ID: #{self.id}) using armor #{sel}!"
  1000.           break
  1001.         end
  1002.       end
  1003.       break if sel != 0
  1004.     end
  1005.     return unless tool_can_use?
  1006.     process_tool_action($data_armors[sel])
  1007.   end
  1008.  
  1009.   def adv_rand_s(group_id)
  1010.     sel = 0
  1011.     random_num = rand(100)
  1012.     AdvRandTool::Skills[group_id].each do |hprt,data|
  1013.       next unless battler.hp_rate*100 <= hprt
  1014.       data.each do |skill_id,chance|
  1015.         if random_num.between?(*chance)
  1016.           sel = skill_id
  1017.           p "#{self.battler.name} (Ev ID: #{self.id}) using skill #{sel}!"
  1018.           break
  1019.         end
  1020.       end
  1021.       break if sel != 0
  1022.     end
  1023.     return unless tool_can_use?
  1024.     process_tool_action($data_skills[sel])
  1025.   end
  1026.  
  1027.   def adv_rand_i(group_id)
  1028.     sel = 0
  1029.     random_num = rand(100)
  1030.     AdvRandTool::Items[group_id].each do |hprt,data|
  1031.       next unless battler.hp_rate*100 <= hprt
  1032.       data.each do |item_id,chance|
  1033.         if random_num.between?(*chance)
  1034.           sel = item_id
  1035.           p "#{self.battler.name} (Ev ID: #{self.id}) using item #{sel}!"
  1036.           break
  1037.         end
  1038.       end
  1039.       break if sel != 0
  1040.     end
  1041.     return unless tool_can_use?
  1042.     process_tool_action($data_items[sel])
  1043.   end
  1044.  
  1045. end
  1046.  
  1047. class RPG::BaseItem
  1048.  
  1049.   def enemy_heal
  1050.     @note =~ /Tool Enemy Heal = (.*)/i ? $1.sub("\r","") : ""
  1051.   end
  1052.    
  1053.   def enemy_state
  1054.     states = []
  1055.     if @note =~ /Tool Enemy State = (\d+(?:\s*,\s*\d+)*)/i
  1056.       $1.scan(/\d+/).each { |id| states << id.to_i }
  1057.     end
  1058.     return states
  1059.   end
  1060.  
  1061. end
  1062.  
  1063. class Projectile < Game_Character
  1064.  
  1065.   alias adv_ai_part1100 set_targeting
  1066.   def set_targeting
  1067.     adv_ai_part1100
  1068.     if @item.enemy_heal == "true" and @user.battler.is_a?(Game_Enemy)
  1069.       target = $game_map.event_enemies.min_by {|event|
  1070.         (!event.on_battle_screen? || event.erased || event.killed) ? 2.0 : event.battler.hp_rate }
  1071.       target = @user if target.nil?
  1072.       @user.targeting = [true, nil, target]
  1073.       @target_effect = [@user.targeting[0], @user.targeting[2]]
  1074.       @user.turn_toward_character(target)
  1075.     end
  1076.     if @item.enemy_state != [] and @user.battler.is_a?(Game_Enemy)
  1077.       target = $game_map.event_enemies.find {|event|
  1078.         if event.on_battle_screen? && ((!event.erased && !event.killed) || @item.enemy_state.include?(1))
  1079.           @item.enemy_state.any? {|state_id| event.battler.state?(state_id)}
  1080.         else
  1081.           false
  1082.         end
  1083.       }
  1084.       target = @user if target.nil?
  1085.       @user.targeting = [true, nil, target]
  1086.       @target_effect = [@user.targeting[0], @user.targeting[2]]
  1087.       @user.turn_toward_character(target)
  1088.     end
  1089.   end
  1090.  
  1091.   alias adv_ai_part1200 apply_effectto_selection
  1092.   def apply_effectto_selection
  1093.     if @item.enemy_heal == "true" and @user.battler.is_a?(Game_Enemy)
  1094.       target = $game_map.event_enemies.min_by {|event|
  1095.         (!event.on_battle_screen? || event.erased || event.killed) ? 2.0 : event.battler.hp_rate }
  1096.       apply_self_effect(target, true) if !target.nil?
  1097.       apply_self_effect(@user, true) if target.nil?
  1098.       return
  1099.     end
  1100.     if @item.enemy_state != [] and @user.battler.is_a?(Game_Enemy)
  1101.       target = $game_map.event_enemies.find {|event|
  1102.         if event.on_battle_screen? && ((!event.erased && !event.killed) || @item.enemy_state.include?(1))
  1103.           @item.enemy_state.any? {|state_id| event.battler.state?(state_id)}
  1104.         else
  1105.           false
  1106.         end
  1107.       }
  1108.       apply_self_effect(target, true) if !target.nil?
  1109.       apply_self_effect(@user, true) if target.nil?
  1110.       target.apply_respawn if !target.nil? && target.killed && @item.enemy_state.include?(1)
  1111.       return
  1112.     end
  1113.     adv_ai_part1200
  1114.   end
  1115.  
  1116. end
  1117.  
  1118. class Array
  1119.  
  1120.   def sum
  1121.     a = 0
  1122.     for n in 0...size
  1123.       a += self[n]
  1124.     end
  1125.     return a
  1126.   end
  1127.  
  1128. end
  1129. #==============================================================================
  1130. # !!END OF SCRIPT - OHH, NOES!!
  1131. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement