bgillisp

Slip Damage Change Script, Version 1.0

Sep 3rd, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. # Slip Damage Change Script, version 1.0
  2. # Author: bgillisp
  3. # Released: 9/3/2014
  4.  
  5. # This script allows you to set up certain states to not cause
  6. # fatal slip damage, and others which do cause fatal slip damage.
  7.  
  8. # To use:
  9. # Place the script in the materials section, above main, but below
  10. # any scripts which overwrite add_state and remove_state. Also, this
  11. # script overwrites the max_slip_damage function of the Game_Battler
  12. # class, place this above any scripts which alias this function
  13. # to ensure those scripts continue to work.
  14.  
  15. # To make a state cause fatal slip damage:
  16. # Add the notetag <KO on Slip> to the note box of the state which
  17. # is to cause the fatal slip damage. Copy and paste that notetag
  18. # exactly as written here.
  19.  
  20. # To make a state not cause fatal slip damage:
  21. # Do nothing. The default in this script is non-fatal slip damage,
  22. # regardless of the setting in the database.
  23.  
  24. # Terms of use:
  25. # Free for use in commercial and non-commercial games, with credit
  26. # given
  27.  
  28. #--------------------------------------------------------------------------
  29.  
  30.  
  31. #Do not edit anything below here unless you know what you are doing.
  32. #Failure to ahead to this warning may result in unpredictable behavior in
  33. #your game. Consider yourself warned
  34. #__________________________________________________________________________
  35.  
  36. module DataManager
  37.  
  38. #--------------------------------------------------------------------------
  39. # alias method: load_database
  40. #--------------------------------------------------------------------------
  41. class <<self; alias load_database_bg_slip_damage_change load_database; end
  42. def self.load_database
  43. load_database_bg_slip_damage_change
  44. load_notetags_slip_damage_change
  45. end
  46.  
  47. #--------------------------------------------------------------------------
  48. # new method: load_notetags_bg_bpbarrier
  49. #--------------------------------------------------------------------------
  50. def self. load_notetags_slip_damage_change
  51. groups = [$data_states]
  52. for group in groups
  53. for obj in group
  54. next if obj.nil?
  55. obj.load_notetages_slip_damage
  56. end
  57. end
  58. end
  59.  
  60. end # DataManager
  61.  
  62. class RPG::BaseItem
  63.  
  64. attr_accessor :ko_on_slip
  65.  
  66. def load_notetages_slip_damage
  67.  
  68. #Set to the default
  69. self.ko_on_slip = false
  70.  
  71. if(self.note[/<KO on Slip>/im])
  72. self.ko_on_slip = true
  73. end
  74. end
  75.  
  76. end #End of class RPG::BaseItem
  77.  
  78. class Game_Battler < Game_BattlerBase
  79.  
  80. attr_accessor :ko_on_slip
  81.  
  82. alias bg_slip_damage_change_initialize initialize
  83. alias bg_slip_damage_change_remove_state remove_state
  84. alias bg_slip_damage_change_add_state add_state
  85.  
  86. #Alias method, initialize
  87. def initialize
  88. #Start all battlers with being unable to be KO'd on slip damage
  89. self.ko_on_slip = false
  90.  
  91. #Call aliased method
  92. bg_slip_damage_change_initialize
  93. end
  94.  
  95. #Alias method, add state
  96. def add_state(state_id)
  97.  
  98. #Call aliased method
  99. bg_slip_damage_change_add_state(state_id)
  100.  
  101. #Turn on ko on slip damage if the state is to do that.
  102. if($data_states[state_id].ko_on_slip == true)
  103. self.ko_on_slip = true
  104. end #End if statement
  105.  
  106. end #End add state.
  107.  
  108. #Aliased method, remove_state
  109. def remove_state(state_id)
  110.  
  111. if state?(state_id)
  112. #Call aliased method
  113. bg_slip_damage_change_remove_state(state_id)
  114.  
  115. #Turn back off slip damage if we are supposed to do that now
  116. if($data_states[state_id].ko_on_slip == true)
  117.  
  118. #Check to see if other states are on that would still need slip
  119. #damage to be fatal
  120. states.each do |tempstate|
  121.  
  122. #If we find another state that causes fatal slip damage, abort, as all
  123. #other work is done.
  124. if($data_states[tempstate.id].ko_on_slip == true && tempstate.id != state_id)
  125. return
  126. end #End of foor loop
  127.  
  128. end #End of for loop
  129.  
  130. self.ko_on_slip = false
  131. end #End if statement
  132.  
  133. end #End check if the state is on the battler
  134.  
  135. end #end of remove_state
  136.  
  137. #Overwritten method max_slip_damage
  138. def max_slip_damage
  139.  
  140. value_to_return = 0
  141. #Check to see if inflicted with something that allows ko on slip. If
  142. #not, then cap it at 1 HP. If so, cap is the target's hp
  143. if(self.ko_on_slip == true)
  144. value_to_return = hp
  145. elsif
  146. value_to_return = [hp - 1, 0].max
  147. end
  148.  
  149. return value_to_return
  150. end #End of max_slip_damage
  151.  
  152. end #End of Game_Battler Class
Advertisement
Add Comment
Please, Sign In to add comment