adiktuzmiko

Slip Damage EX v1.06

Jun 1st, 2013
1,437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 30.25 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # Slip Damage EX v1.06
  4. # by AdiktuzMiko
  5. # --- Date Created: 06/02/2013
  6. # --- Last Date Updated: 10/23/2014
  7. # --- Level: Easy
  8. #
  9. # Basically it allows you to give more control over slip damage values.
  10. # Right now, slip damage is done via negative regeneration, which is
  11. # only based on max hp/mp.
  12. #
  13. # With this script, you can add slip damage to equipments and states and
  14. # have more control over the amount of damage.
  15. #
  16. # This script supports slip damage to HP, MP and TP
  17. #
  18. # You can also set different values for battle and map slip damages
  19. #
  20. # You can also define two behaviors for slip damage calculation
  21. # -Damage is only calculated when the state is added
  22. # -Damage is calculated every time it will be dealt
  23. #
  24. # If you have the ElementsEX script, you can also make slip damages have
  25. # an element, which makes it affected by the elemental defense of the
  26. # afflicted unit. The element only works for the hp slip damages.
  27. #          
  28. # If you have Yanfly's element pop up + my Element's EX script, battle hp slip
  29. # damages will now show correct element color and weakness/resistance rates
  30. #
  31. # Take note that the damage/regeneration that will show in battle if you
  32. # have a damage pop-up screen will be the total of the individual
  33. # slip damages that your battler might have.
  34. #
  35. #==============================================================================
  36. #   ++ Notetags ++
  37. #==============================================================================
  38. #
  39. # These tags goes into weapons, armors and states.
  40. #
  41. # To assign element to slip_damage (Requires: Elements EX script)
  42. #
  43. # <slip_element x>
  44. #     x => element id
  45. #
  46. # Note: 1) The element is only applied to hp slip damage
  47. #       2) If you have element pop up by Yanfly, the pop-up for hp slip damage
  48. #          will still be white/green in color no matter what element you put.
  49. #
  50. # If you want to use the caster's info for the formula, use:
  51. #
  52. # a.xx
  53. #   xx => actor/battler info like hp, mhp, cri etc
  54. #
  55. # Note: -Caster data is not advisable to be used for map slip damages
  56. #       -Using caster data for updating damages might cause errors in cases
  57. #        like if the caster is removed from the game during the duration of
  58. #        the state so unless you're sure that it won't happen, better just
  59. #        use them for non-updating damages
  60. #
  61. # If you want to use the affected battler's info for the formula, use:
  62. #
  63. # b.xx
  64. #   xx => actor/battler info like hp, mhp, cri etc
  65. #
  66. # You can also retrieve data about the state itself using the variable: state
  67. # and about the equipment using the variable: equip
  68. #
  69. # state variable will only work for state slip damages and equip variable will only work for equip slip
  70. # damages...
  71. #
  72. # Positive value = damage
  73. # Negative value = regeneration
  74. #
  75. # The following tags are for updating damages
  76. # -Damages are calculated every time that it will be
  77. #  dealt
  78. #
  79. # Put this tag to denote the start of a custom formula
  80. #
  81. # <U_SLIP_X_START>
  82. #     x => HP, MP or TP
  83. #
  84. # Put this tag to denote the end of a custom formula
  85. #
  86. # <U_SLIP_X_END>
  87. #     x => HP, MP or TP
  88. #
  89. # For slip damages that should happen on the map
  90. #
  91. # Put this tag to denote the start of a custom formula
  92. #
  93. # <U_SLIP_X_MAP_START>
  94. #     x => HP, MP or TP
  95. #
  96. # Put this tag to denote the end of a custom formula
  97. #
  98. # <U_SLIP_X_MAP_END>
  99. #     x => HP, MP or TP
  100. #      
  101. # The following tags are for non-updating damages
  102. # -Damages are calculated only upon the time that
  103. #  the states are inflicted
  104. # -For states only
  105. #
  106. # Put this tag to denote the start of a custom formula
  107. #
  108. # <SLIP_X_START>
  109. #     x => HP, MP or TP
  110. #
  111. # Put this tag to denote the end of a custom formula
  112. #
  113. # <SLIP_X_END>
  114. #     x => HP, MP or TP
  115. #
  116. # For slip damages that should happen on the map
  117. #
  118. # Put this tag to denote the start of a custom formula
  119. #
  120. # <SLIP_X_MAP_START>
  121. #     x => HP, MP or TP
  122. #
  123. # Put this tag to denote the end of a custom formula
  124. #
  125. # <SLIP_X_MAP_END>
  126. #     x => HP, MP or TP
  127. #      
  128. # Example:
  129. #
  130. # <SLIP_MP_START>
  131. #  -b.mmp
  132. # <SLIP_MP_END>
  133. #
  134. # => This will cause the unit to regenerate its max mp per turn in battle
  135. #
  136. # Example:
  137. #
  138. # <SLIP_HP_START>
  139. #  (a.atk + a.mat)
  140. # <SLIP_HP_END>
  141. #
  142. # => This will cause the unit to get damaged equal to the caster's attack + magic attack
  143. #
  144. # <U_SLIP_HP_START>
  145. #  -b.hp*0.1
  146. # <U_SLIP_HP_END>
  147. #
  148. # => This will cause the unit to get regenerate 10% of his hp every turn
  149. #
  150. # <SLIP_HP_START>
  151. #  -b.hp*0.1
  152. # <SLIP_HP_END>
  153. #
  154. # => This will cause the unit to get regenerate 10% of his current hp
  155. #    (during application of state) per turn
  156. #
  157. # <SLIP_HP_START>
  158. #  (a.actor? 200 : 100)
  159. # <SLIP_HP_END>
  160. #
  161. # => This will cause the unit to get damaged by 200 is the cause is an actor, 100 if not
  162. #
  163. # Note: The slip damage values per object are additive for battle hp slips.
  164. #
  165. # NOTICE: To be safe, enclose the formula in parenthesis
  166. #
  167. #==============================================================================
  168. #   ++ Installation ++
  169. #==============================================================================
  170. # Install this script in the Materials section in your project's
  171. # script editor and start tagging.
  172. #
  173. # Modify the max damage amounts below in case you want to have a damage cap.
  174. #
  175. #==============================================================================
  176. #   ++ Compatibility ++
  177. #==============================================================================
  178. # This script aliases the following default VXA methods:
  179. #
  180. #     DataManager: Load_Database
  181. #     Game_Battler: regenerate_hp, regenerate_mp, regenerate_tp
  182. #
  183. # This script is tested and is working with Yanfly's Battle Engine
  184. #
  185. #==============================================================================
  186. #   ++ Terms and Conditions ++
  187. #==============================================================================
  188. #
  189. # Read this: http://lescripts.wordpress.com/terms-and-conditions/
  190. #
  191. #==============================================================================
  192.  
  193. $imported = {} if $imported.nil?
  194. $imported["SlipDamageEX"] = true
  195.  
  196. #--------------------------------------------------------------------------
  197. # ? module Adiktuz
  198. #--------------------------------------------------------------------------
  199. module Adiktuz
  200.   #--------------------------------------------------------------------------
  201.   # ? module SlipDamageEx
  202.   #--------------------------------------------------------------------------
  203.   module SlipDamageEx
  204.     #The max damage that can be done by slip damages dealt
  205.     #using this script, does not affect slip damages
  206.     #done through the traits
  207.     #You can use any formula that RGSS3 can process
  208.     #Set to nil for unlimited damage
  209.     MAX_HP_DAMAGE = nil #example: if you set it to "mhp", hp slip damages
  210.                         #won't exceed the unit's max hp
  211.     MAX_MP_DAMAGE = nil #example: if you set it to "mmp", mp slip damages
  212.                         #won't exceed the unit's max mp
  213.     MAX_TP_DAMAGE = nil #example: if you set it to "mtp", tp slip damages
  214.                         #won't exceed the unit's max tp
  215.    
  216.     #Note: If you set a postive max damage, then negative slip damages (regen)
  217.     #      can be of any value since they are negative.
  218.    
  219.     #Notetags used by the script
  220.     #Do not edit
  221.     #Seriously, don't edit anything below this line
  222.     #Don't even view coz you might accidentally change something
  223.     SLIP_ELEMENT = /<slip_element (.*)>/i
  224.     SLIP_HP_BEGIN = /<(?:SLIP_HP_START)>/i
  225.     SLIP_HP_END = /<(?:SLIP_HP_END)>/i
  226.     SLIP_MP_BEGIN = /<(?:SLIP_MP_START)>/i
  227.     SLIP_MP_END = /<(?:SLIP_MP_END)>/i
  228.     SLIP_TP_BEGIN = /<(?:SLIP_TP_START)>/i
  229.     SLIP_TP_END = /<(?:SLIP_TP_END)>/i
  230.     SLIP_HP_MAP_BEGIN = /<(?:SLIP_HP_MAP_START)>/i
  231.     SLIP_HP_MAP_END = /<(?:SLIP_HP_MAP_END)>/i
  232.     SLIP_MP_MAP_BEGIN = /<(?:SLIP_MP_MAP_START)>/i
  233.     SLIP_MP_MAP_END = /<(?:SLIP_MP_MAP_END)>/i
  234.     SLIP_TP_MAP_BEGIN = /<(?:SLIP_TP_MAP_START)>/i
  235.     SLIP_TP_MAP_END = /<(?:SLIP_TP_MAP_END)>/i
  236.     U_SLIP_HP_BEGIN = /<(?:U_SLIP_HP_START)>/i
  237.     U_SLIP_HP_END = /<(?:U_SLIP_HP_END)>/i
  238.     U_SLIP_MP_BEGIN = /<(?:U_SLIP_MP_START)>/i
  239.     U_SLIP_MP_END = /<(?:U_SLIP_MP_END)>/i
  240.     U_SLIP_TP_BEGIN = /<(?:U_SLIP_TP_START)>/i
  241.     U_SLIP_TP_END = /<(?:U_SLIP_TP_END)>/i
  242.     U_SLIP_HP_MAP_BEGIN = /<(?:U_SLIP_HP_MAP_START)>/i
  243.     U_SLIP_HP_MAP_END = /<(?:U_SLIP_HP_MAP_END)>/i
  244.     U_SLIP_MP_MAP_BEGIN = /<(?:U_SLIP_MP_MAP_START)>/i
  245.     U_SLIP_MP_MAP_END = /<(?:U_SLIP_MP_MAP_END)>/i
  246.     U_SLIP_TP_MAP_BEGIN = /<(?:U_SLIP_TP_MAP_START)>/i
  247.     U_SLIP_TP_MAP_END = /<(?:U_SLIP_TP_MAP_END)>/i
  248.    
  249.   end #module SlipDamageEx
  250. end #module Adiktuz
  251.  
  252. #==============================================================================
  253. # ? DataManager
  254. #==============================================================================
  255.  
  256. module DataManager
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # alias method: load_database
  260.   #--------------------------------------------------------------------------
  261.   class <<self; alias load_database_sdex load_database; end
  262.   def self.load_database
  263.     load_database_sdex
  264.     load_notetags_sdex
  265.   end
  266.  
  267.   #--------------------------------------------------------------------------
  268.   # new method: load_notetags_eds
  269.   #--------------------------------------------------------------------------
  270.   def self.load_notetags_sdex
  271.     groups = [$data_weapons, $data_armors, $data_states]
  272.     for group in groups
  273.       for obj in group
  274.         next if obj.nil?
  275.         obj.load_notetags_sdex
  276.       end
  277.     end
  278.   end
  279.  
  280. end # DataManager
  281.  
  282. #===============================================================================
  283. # ? class RPG::BaseItem
  284. #===============================================================================
  285.  
  286. class RPG::BaseItem
  287.  
  288.   #---------------------------------------------------------------------------
  289.   # public instance Variables
  290.   #---------------------------------------------------------------------------
  291.   attr_accessor :slip_hp_prog_eval
  292.   attr_accessor :slip_mp_prog_eval
  293.   attr_accessor :slip_tp_prog_eval
  294.   attr_accessor :slip_hp_map_prog_eval
  295.   attr_accessor :slip_mp_map_prog_eval
  296.   attr_accessor :slip_tp_map_prog_eval
  297.   attr_accessor :slip_hp_eval
  298.   attr_accessor :slip_mp_eval
  299.   attr_accessor :slip_tp_eval
  300.   attr_accessor :slip_hp_map_eval
  301.   attr_accessor :slip_mp_map_eval
  302.   attr_accessor :slip_tp_map_eval
  303.   attr_accessor :slip_element
  304.  
  305.  
  306.   #--------------------------------------------------------------------------
  307.   # common cache : load_notetags_sdex
  308.   #--------------------------------------------------------------------------
  309.   def load_notetags_sdex
  310.     @slip_element = 0
  311.     slip_hp_start = false
  312.     slip_mp_start = false
  313.     slip_tp_start = false
  314.     slip_hp_map_start = false
  315.     slip_mp_map_start = false
  316.     slip_tp_map_start = false
  317.     slip_hp_prog_start = false
  318.     slip_mp_prog_start = false
  319.     slip_tp_prog_start = false
  320.     slip_hp_map_prog_start = false
  321.     slip_mp_map_prog_start = false
  322.     slip_tp_map_prog_start = false
  323.     self.note.split(/[\r\n]+/).each do |line|
  324.       case line
  325.       when Adiktuz::SlipDamageEx::SLIP_ELEMENT
  326.         @slip_element = $1.to_i
  327.       when Adiktuz::SlipDamageEx::SLIP_HP_BEGIN
  328.         slip_hp_start = true
  329.       when Adiktuz::SlipDamageEx::SLIP_HP_END
  330.         slip_hp_start = false
  331.       when Adiktuz::SlipDamageEx::SLIP_MP_BEGIN
  332.         slip_mp_start = true
  333.       when Adiktuz::SlipDamageEx::SLIP_MP_END
  334.         slip_mp_start = false
  335.       when Adiktuz::SlipDamageEx::SLIP_TP_BEGIN
  336.         slip_tp_start = true
  337.       when Adiktuz::SlipDamageEx::SLIP_TP_END
  338.         slip_tp_start = false
  339.       when Adiktuz::SlipDamageEx::SLIP_HP_MAP_BEGIN
  340.         slip_hp_map_start = true
  341.       when Adiktuz::SlipDamageEx::SLIP_HP_MAP_END
  342.         slip_hp_map_start = false
  343.       when Adiktuz::SlipDamageEx::SLIP_MP_MAP_BEGIN
  344.         slip_mp_map_start = true
  345.       when Adiktuz::SlipDamageEx::SLIP_MP_MAP_END
  346.         slip_mp_map_start = false
  347.       when Adiktuz::SlipDamageEx::SLIP_TP_MAP_BEGIN
  348.         slip_tp_map_start = true
  349.       when Adiktuz::SlipDamageEx::SLIP_TP_MAP_END
  350.         slip_tp_map_start = false
  351.       when Adiktuz::SlipDamageEx::U_SLIP_HP_BEGIN
  352.         slip_hp_prog_start = true
  353.       when Adiktuz::SlipDamageEx::U_SLIP_HP_END
  354.         slip_hp_prog_start = false
  355.       when Adiktuz::SlipDamageEx::U_SLIP_MP_BEGIN
  356.         slip_mp_prog_start = true
  357.       when Adiktuz::SlipDamageEx::U_SLIP_MP_END
  358.         slip_mp_prog_start = false
  359.       when Adiktuz::SlipDamageEx::U_SLIP_TP_BEGIN
  360.         slip_tp_prog_start = true
  361.       when Adiktuz::SlipDamageEx::U_SLIP_TP_END
  362.         slip_tp_prog_start = false
  363.       when Adiktuz::SlipDamageEx::U_SLIP_HP_MAP_BEGIN
  364.         slip_hp_map_prog_start = true
  365.       when Adiktuz::SlipDamageEx::U_SLIP_HP_MAP_END
  366.         slip_hp_map_prog_start = false
  367.       when Adiktuz::SlipDamageEx::U_SLIP_MP_MAP_BEGIN
  368.         slip_mp_map_prog_start = true
  369.       when Adiktuz::SlipDamageEx::U_SLIP_MP_MAP_END
  370.         slip_mp_map_prog_start = false
  371.       when Adiktuz::SlipDamageEx::U_SLIP_TP_MAP_BEGIN
  372.         slip_tp_map_prog_start = true
  373.       when Adiktuz::SlipDamageEx::U_SLIP_TP_MAP_END
  374.         slip_tp_map_prog_start = false
  375.       else
  376.         @slip_hp_prog_eval = "" if slip_hp_prog_start && @slip_hp_prog_eval.nil?
  377.         @slip_mp_prog_eval = "" if slip_mp_prog_start && @slip_mp_prog_eval.nil?
  378.         @slip_tp_prog_eval = "" if slip_tp_prog_start && @slip_tp_prog_eval.nil?
  379.         @slip_hp_prog_eval += line.to_s if slip_hp_prog_start
  380.         @slip_mp_prog_eval += line.to_s if slip_mp_prog_start
  381.         @slip_tp_prog_eval += line.to_s if slip_tp_prog_start
  382.         @slip_hp_map_prog_eval = "" if slip_hp_map_prog_start && @slip_hp_map_prog_eval.nil?
  383.         @slip_mp_map_prog_eval = "" if slip_mp_map_prog_start && @slip_mp_map_prog_eval.nil?
  384.         @slip_tp_map_prog_eval = "" if slip_tp_map_prog_start && @slip_tp_map_prog_eval.nil?
  385.         @slip_hp_map_prog_eval += line.to_s if slip_hp_map_prog_start
  386.         @slip_mp_map_prog_eval += line.to_s if slip_mp_map_prog_start
  387.         @slip_tp_map_prog_eval += line.to_s if slip_tp_map_prog_start
  388.         @slip_hp_eval = "" if slip_hp_start && @slip_hp_eval.nil?
  389.         @slip_mp_eval = "" if slip_mp_start && @slip_mp_eval.nil?
  390.         @slip_tp_eval = "" if slip_tp_start && @slip_tp_eval.nil?
  391.         @slip_hp_eval += line.to_s if slip_hp_start
  392.         @slip_mp_eval += line.to_s if slip_mp_start
  393.         @slip_tp_eval += line.to_s if slip_tp_start
  394.         @slip_hp_map_eval = "" if slip_hp_map_start && @slip_hp_map_eval.nil?
  395.         @slip_mp_map_eval = "" if slip_mp_map_start && @slip_mp_map_eval.nil?
  396.         @slip_tp_map_eval = "" if slip_tp_map_start && @slip_tp_map_eval.nil?
  397.         @slip_hp_map_eval += line.to_s if slip_hp_map_start
  398.         @slip_mp_map_eval += line.to_s if slip_mp_map_start
  399.         @slip_tp_map_eval += line.to_s if slip_tp_map_start
  400.       end
  401.     end
  402.   end
  403.  
  404. end # << RPG::BaseItem
  405.  
  406. class Game_BattlerBase
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # ? new method: make_slip_popup
  410.   #--------------------------------------------------------------------------
  411.   def make_slip_popup(value,rate,element)
  412.     flags = []
  413.     return if value == 0
  414.     if rate > 1.0
  415.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  416.       rules = "WEAK_ELE"
  417.       flags.push("weakness")
  418.     elsif rate == 0.0
  419.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  420.       rules = "IMMU_ELE"
  421.       flags.push("immune")
  422.     elsif rate < 0.0
  423.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  424.       rules = "ABSB_ELE"
  425.       flags.push("absorbed")
  426.     else
  427.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  428.       rules = "REST_ELE"
  429.       flags.push("resistant")
  430.     end
  431.     create_popup(text, rules, flags) unless rate == 1.0
  432.     value = value*-1
  433.     value = value.to_i
  434.     if value > 0
  435.       value = "+" + value.to_s + " HP"
  436.     else
  437.       value = value.to_s + " HP"
  438.     end
  439.    
  440.     element > 0 ? create_popup(value, "ELEMENT_" + element.to_s) : create_popup(value, "HP_DMG")
  441.   end
  442.  
  443. end
  444.  
  445. #--------------------------------------------------------------------------
  446. # ? class Game_Battler
  447. #--------------------------------------------------------------------------
  448.  
  449. class Game_Battler < Game_BattlerBase
  450.  
  451.   #--------------------------------------------------------------------------
  452.   # ? new method: clear_slip_states
  453.   #--------------------------------------------------------------------------
  454.   def clear_slip_states
  455.     @state_cause = {}
  456.     @slip_hp_damage = [0] * $data_states.size
  457.     @slip_mp_damage = [0] * $data_states.size
  458.     @slip_tp_damage = [0] * $data_states.size
  459.     @slip_hp_map_damage = [0] * $data_states.size
  460.     @slip_mp_map_damage = [0] * $data_states.size
  461.     @slip_tp_map_damage = [0] * $data_states.size
  462.   end
  463.  
  464.   #--------------------------------------------------------------------------
  465.   # ? alias method: add_state
  466.   #--------------------------------------------------------------------------
  467.   alias slip_add_state add_state
  468.   def add_state(state_id)
  469.     slip_add_state(state_id)
  470.     clear_slip_states if @state_cause == nil
  471.     @state_cause[state_id] = @cause
  472.     a = @cause
  473.     b = self
  474.     state = $data_states[state_id]
  475.     @slip_hp_damage[state_id] = eval(state.slip_hp_eval) unless state.slip_hp_eval.nil?
  476.     @slip_mp_damage[state_id] = eval(state.slip_mp_eval) unless state.slip_mp_eval.nil?
  477.     @slip_tp_damage[state_id] = eval(state.slip_tp_eval) unless state.slip_tp_eval.nil?
  478.     @slip_hp_map_damage[state_id] = eval(state.slip_hp_map_eval) unless state.slip_hp_map_eval.nil?
  479.     @slip_mp_map_damage[state_id] = eval(state.slip_mp_map_eval) unless state.slip_mp_map_eval.nil?
  480.     @slip_tp_map_damage[state_id] = eval(state.slip_tp_map_eval) unless state.slip_tp_map_eval.nil?
  481.   end
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # ? alias method: item_effect_add_state_attack
  485.   #--------------------------------------------------------------------------
  486.   alias slip_item_effect_add_state_attack item_effect_add_state_attack
  487.   def item_effect_add_state_attack(user, item, effect)
  488.     @cause = user
  489.     slip_item_effect_add_state_attack(user, item, effect)
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ? alias method: item_effect_add_state_normal
  493.   #--------------------------------------------------------------------------
  494.   alias slip_item_effect_add_state_normal item_effect_add_state_normal
  495.   def item_effect_add_state_normal(user, item, effect)
  496.     @cause = user
  497.     slip_item_effect_add_state_normal(user, item, effect)
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # ? alias method: remove_state
  502.   #--------------------------------------------------------------------------
  503.   alias slip_remove_state remove_state
  504.   def remove_state(state_id)
  505.     slip_remove_state(state_id)
  506.     clear_slip_states if @state_cause == nil
  507.     @state_cause[state_id] = nil
  508.     @slip_hp_damage[state_id] = 0
  509.     @slip_mp_damage[state_id] = 0
  510.     @slip_tp_damage[state_id] = 0
  511.     @slip_hp_map_damage[state_id] = 0
  512.     @slip_mp_map_damage[state_id] = 0
  513.     @slip_tp_map_damage[state_id] = 0
  514.   end
  515.  
  516.   #--------------------------------------------------------------------------
  517.   # ? new method: get_rate_slip_ex
  518.   #--------------------------------------------------------------------------
  519.   def get_rate_slip_ex(obj)
  520.     obj.slip_element > 0 ? 1.0 - get_def_element_multi(obj.slip_element) : 1.0
  521.   end
  522.  
  523.   #--------------------------------------------------------------------------
  524.   # ? new method: regenerate_hp_battle
  525.   #--------------------------------------------------------------------------
  526.   def regenerate_hp_battle
  527.     damage = 0
  528.     if actor?
  529.       for equip in equips
  530.         next if equip.nil?
  531.         b = self
  532.         damage += eval(equip.slip_hp_prog_eval) unless equip.slip_hp_prog_eval.nil?
  533.       end
  534.       for state in states
  535.         next if state.nil?
  536.         damage += @slip_hp_damage[state.id]
  537.         a = @state_cause[state.id]
  538.         b = self
  539.         damage += eval(state.slip_hp_prog_eval) unless state.slip_hp_prog_eval.nil?
  540.       end
  541.     elsif enemy?
  542.       for state in states
  543.         next if state.nil?
  544.         damage += @slip_hp_damage[state.id]
  545.         a = @state_cause[state.id]
  546.         b = self
  547.         damage += eval(state.slip_hp_prog_eval) unless state.slip_hp_prog_eval.nil?
  548.       end
  549.     end
  550.     return damage
  551.   end
  552.  
  553.   #--------------------------------------------------------------------------
  554.   # ? new method: regenerate_hp_battle_element
  555.   #--------------------------------------------------------------------------
  556.   def regenerate_hp_battle_element
  557.     damage = 0
  558.     if actor?
  559.       for equip in equips
  560.         next if equip.nil?
  561.         damage = 0
  562.         rate = get_rate_slip_ex(equip)
  563.         b = self
  564.         damage += rate*eval(equip.slip_hp_prog_eval) unless equip.slip_hp_prog_eval.nil?
  565.         damage -= get_def_element_bonus(equip.slip_element)
  566.         unless Adiktuz::SlipDamageEx::MAX_HP_DAMAGE.nil? then
  567.           slip_max = eval(Adiktuz::SlipDamageEx::MAX_HP_DAMAGE)
  568.           damage = [damage,slip_max].min.to_i  
  569.           @result.hp_damage = damage
  570.         else
  571.           @result.hp_damage = damage.to_i  
  572.         end
  573.         self.hp -= @result.hp_damage
  574.         self.make_slip_popup(damage,rate,equip.slip_element) if $imported["YEA-BattleEngine"]
  575.       end
  576.       for state in states
  577.         next if state.nil?
  578.         damage = 0
  579.         rate = get_rate_slip_ex(state)
  580.         damage += rate*@slip_hp_damage[state.id]
  581.         a = @state_cause[state.id]
  582.         b = self
  583.         damage += rate*eval(state.slip_hp_prog_eval) unless state.slip_hp_prog_eval.nil?
  584.         damage -= get_def_element_bonus(state.slip_element)
  585.         unless Adiktuz::SlipDamageEx::MAX_HP_DAMAGE.nil? then
  586.           slip_max = eval(Adiktuz::SlipDamageEx::MAX_HP_DAMAGE)
  587.           damage = [damage,slip_max].min.to_i  
  588.           @result.hp_damage = damage
  589.         else
  590.           @result.hp_damage = damage.to_i  
  591.         end
  592.         self.hp -= @result.hp_damage
  593.         self.make_slip_popup(damage,rate,state.slip_element) if $imported["YEA-BattleEngine"]
  594.       end
  595.     elsif enemy?
  596.       for state in states
  597.         next if state.nil?
  598.         damage = 0
  599.         rate = get_rate_slip_ex(state)
  600.         damage += rate*@slip_hp_damage[state.id]
  601.         a = @state_cause[state.id]
  602.         b = self
  603.         damage += rate*eval(state.slip_hp_prog_eval) unless state.slip_hp_prog_eval.nil?
  604.         damage -= get_def_element_bonus(state.slip_element)
  605.         unless Adiktuz::SlipDamageEx::MAX_HP_DAMAGE.nil? then
  606.           slip_max = eval(Adiktuz::SlipDamageEx::MAX_HP_DAMAGE)
  607.           damage = [damage,slip_max].min.to_i  
  608.           @result.hp_damage = damage
  609.         else
  610.           @result.hp_damage = damage.to_i  
  611.         end
  612.         self.hp -= @result.hp_damage
  613.         self.make_slip_popup(damage,rate,state.slip_element) if $imported["YEA-BattleEngine"]
  614.       end
  615.     end
  616.     @result.hp_damage = 0
  617.   end
  618.  
  619.   #--------------------------------------------------------------------------
  620.   # ? new method: regenerate_hp_map
  621.   #--------------------------------------------------------------------------
  622.   def regenerate_hp_map
  623.     return 0 if enemy?
  624.     damage = 0
  625.     if actor?
  626.       for equip in equips
  627.         next if equip.nil?
  628.         b = self
  629.         damage += eval(equip.slip_hp_map_prog_eval) unless equip.slip_hp_map_prog_eval.nil?
  630.       end
  631.       for state in states
  632.         next if state.nil?
  633.         damage += @slip_hp_map_damage[state.id]
  634.         a = @state_cause[state.id]
  635.         b = self
  636.         damage += eval(state.slip_hp_map_prog_eval) unless state.slip_hp_map_prog_eval.nil?
  637.       end
  638.     end
  639.     return damage
  640.   end
  641.  
  642.   #--------------------------------------------------------------------------
  643.   # ? new method: regenerate_hp_map_element
  644.   #--------------------------------------------------------------------------
  645.   def regenerate_hp_map_element
  646.     return 0 if enemy?
  647.     damage = 0
  648.     if actor?
  649.       for equip in equips
  650.         next if equip.nil?
  651.         rate = get_rate_slip_ex(equip)
  652.         b = self
  653.         damage += rate*eval(equip.slip_hp_map_prog_eval) unless equip.slip_hp_map_prog_eval.nil?
  654.       end
  655.       for state in states
  656.         next if state.nil?
  657.         rate = get_rate_slip_ex(state)
  658.         damage += rate*@slip_hp_map_damage[state.id]
  659.         a = @state_cause[state.id]
  660.         b = self
  661.         damage += rate*eval(state.slip_hp_map_prog_eval) unless state.slip_hp_map_prog_eval.nil?
  662.       end
  663.     end
  664.     return damage
  665.   end
  666.  
  667.   #--------------------------------------------------------------------------
  668.   # ? alias method: regenerate_hp
  669.   #--------------------------------------------------------------------------
  670.   alias regenerate_hp_sdex regenerate_hp
  671.   def regenerate_hp
  672.     regenerate_hp_sdex
  673.     damage = 0
  674.     if $game_party.in_battle then
  675.       if $imported["ElementEX"]
  676.         regenerate_hp_battle_element
  677.         return
  678.       else
  679.         damage = regenerate_hp_battle
  680.       end
  681.     else
  682.       damage = $imported["ElementEX"] ? regenerate_hp_map_element : regenerate_hp_map
  683.     end
  684.     perform_map_damage_effect if damage > 0
  685.     unless Adiktuz::SlipDamageEx::MAX_HP_DAMAGE.nil? then
  686.       slip_max = eval(Adiktuz::SlipDamageEx::MAX_HP_DAMAGE)
  687.       @result.hp_damage = [damage,slip_max].min.to_i  
  688.     else
  689.       @result.hp_damage = damage.to_i  
  690.     end
  691.     self.hp -= @result.hp_damage
  692.     self.make_slip_popup(@result.hp_damage,1.0,0) if $imported["YEA-BattleEngine"]
  693.   end #regenerate_hp
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # ? new method: regenerate_mp_battle
  697.   #--------------------------------------------------------------------------
  698.   def regenerate_mp_battle
  699.     return 0 if enemy?
  700.     damage = 0
  701.     if actor?
  702.       for equip in equips
  703.         next if equip.nil?
  704.         b = self
  705.         damage += eval(equip.slip_mp_prog_eval) unless equip.slip_mp_prog_eval.nil?
  706.       end
  707.       for state in states
  708.         next if state.nil?
  709.         damage += @slip_mp_damage[state.id]
  710.         a = @state_cause[state.id]
  711.         b = self
  712.         damage += eval(state.slip_mp_prog_eval) unless state.slip_mp_prog_eval.nil?
  713.       end
  714.     elsif enemy?
  715.       for state in states
  716.         next if state.nil?
  717.         damage += @slip_mp_damage[state.id]
  718.         a = @state_cause[state.id]
  719.         b = self
  720.         damage += eval(state.slip_mp_prog_eval) unless state.slip_mp_prog_eval.nil?
  721.       end
  722.     end
  723.     return damage
  724.   end
  725.  
  726.   #--------------------------------------------------------------------------
  727.   # ? new method: regenerate_mp_map
  728.   #--------------------------------------------------------------------------
  729.   def regenerate_mp_map
  730.     damage = 0
  731.     if actor?
  732.       for equip in equips
  733.         next if equip.nil?
  734.         b = self
  735.         damage += eval(equip.slip_mp_map_prog_eval) unless equip.slip_mp_map_prog_eval.nil?
  736.       end
  737.       for state in states
  738.         next if state.nil?
  739.         damage += @slip_mp_map_damage[state.id]
  740.         a = @state_cause[state.id]
  741.         b = self
  742.         damage += eval(state.slip_mp_map_prog_eval) unless state.slip_mp_map_prog_eval.nil?
  743.       end
  744.     end
  745.     return damage
  746.   end
  747.  
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # ? alias method: regenerate_mp
  751.   #--------------------------------------------------------------------------
  752.   alias regenerate_mp_sdex regenerate_mp
  753.   def regenerate_mp
  754.     regenerate_mp_sdex
  755.     damage = 0
  756.     damage = $game_party.in_battle ? regenerate_mp_battle : regenerate_mp_map
  757.     perform_map_damage_effect if damage > 0
  758.     unless Adiktuz::SlipDamageEx::MAX_MP_DAMAGE.nil? then
  759.       slip_max = eval(Adiktuz::SlipDamageEx::MAX_MP_DAMAGE)
  760.       @result.mp_damage = [damage,slip_max].min.to_i  
  761.     else
  762.       @result.mp_damage = damage.to_i  
  763.     end
  764.     self.mp -= @result.mp_damage
  765.   end #regenerate_mp
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # ? new method: regenerate_tp_battle
  769.   #--------------------------------------------------------------------------
  770.   def regenerate_tp_battle
  771.     damage = 0
  772.     if actor?
  773.       for equip in equips
  774.         next if equip.nil?
  775.         b = self
  776.         damage += eval(equip.slip_tp_prog_eval) unless equip.slip_tp_prog_eval.nil?
  777.       end
  778.       for state in states
  779.         next if state.nil?
  780.         damage += @slip_tp_damage[state.id]
  781.         a = @state_cause[state.id]
  782.         b = self
  783.         damage += eval(state.slip_tp_prog_eval) unless state.slip_tp_prog_eval.nil?
  784.       end
  785.     end
  786.     return damage
  787.   end
  788.  
  789.   #--------------------------------------------------------------------------
  790.   # ? new method: regenerate_tp_map
  791.   #--------------------------------------------------------------------------
  792.   def regenerate_tp_map
  793.     damage = 0
  794.     if actor?
  795.       for equip in equips
  796.         next if equip.nil?
  797.         b = self
  798.         damage += eval(equip.slip_tp_map_prog_eval) unless equip.slip_tp_map_prog_eval.nil?
  799.       end
  800.       for state in states
  801.         next if state.nil?
  802.         damage += @slip_tp_map_damage[state.id]
  803.         a = @state_cause[state.id]
  804.         b = self
  805.         damage += eval(state.slip_tp_map_prog_eval) unless state.slip_tp_map_prog_eval.nil?
  806.       end
  807.     end
  808.     return damage
  809.   end
  810.  
  811.   #--------------------------------------------------------------------------
  812.   # ? alias method: regenerate_tp
  813.   #--------------------------------------------------------------------------
  814.   alias regenerate_tp_sdex regenerate_tp
  815.   def regenerate_tp
  816.     return if enemy?
  817.     regenerate_tp_sdex
  818.     damage = 0
  819.     damage = $game_party.in_battle ? regenerate_tp_battle : regenerate_tp_map
  820.     perform_map_damage_effect if damage > 0
  821.     unless Adiktuz::SlipDamageEx::MAX_TP_DAMAGE.nil? then
  822.       slip_max = eval(Adiktuz::SlipDamageEx::MAX_TP_DAMAGE)
  823.       @result.tp_damage = [damage,slip_max].min.to_i  
  824.     else
  825.       @result.tp_damage = damage.to_i  
  826.     end
  827.     self.tp -= @result.tp_damage
  828.   end #regenerate_tp
  829.  
  830. end
Advertisement
Add Comment
Please, Sign In to add comment