Advertisement
dsiver144

Bless State Fix

Oct 26th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #===============================================================================
  2. # * Bless State Fix
  3. # by dsiver144
  4. #===============================================================================
  5. class Game_Battler < Game_BattlerBase
  6. #--------------------------------------------------------------------------
  7. # overwrite method: add_state
  8. #--------------------------------------------------------------------------
  9. def add_state(state_id)
  10. return if $data_states[state_id].nil?
  11. if state_id == 29
  12. @luck_bless ||= 0
  13. regexp = $data_states[state_id].note.split(/<luck:\s?(\d+)>/i)
  14. @luck_bless += regexp[1].to_i
  15. self.add_param(7, regexp[1].to_i)
  16. end
  17. state_rules = $data_states[state_id].state_reapply_rules
  18. return if state_rules == 0 && state?(state_id)
  19. if state_addable?(state_id)
  20. add_new_state(state_id) unless state?(state_id)
  21. reset_state_counts(state_id) if state_rules == 1
  22. total_state_counts(state_id) if state_rules == 2
  23. @result.added_states.push(state_id).uniq!
  24. end
  25. end
  26. #--------------------------------------------------------------------------
  27. # overwrite method: add_state
  28. #--------------------------------------------------------------------------
  29. def remove_state(state_id)
  30. if state_id == 29
  31. regexp = $data_states[state_id].note.split(/<luck:\s?(\d+)>/i)
  32. self.add_param(7, -regexp[1].to_i)
  33. if @luck_bless
  34. @luck_bless -= regexp[1].to_i
  35. end
  36. end
  37. if state?(state_id)
  38. revive if state_id == death_state_id
  39. erase_state(state_id)
  40. refresh
  41. @result.removed_states.push(state_id).uniq!
  42. end
  43. end
  44. #--------------------------------------------------------------------------
  45. # * Clear State Information
  46. #--------------------------------------------------------------------------
  47. alias_method(:dsi_remove_battle_states_bless_fix, :remove_battle_states)
  48. def remove_battle_states
  49. dsi_remove_battle_states_bless_fix
  50. if @luck_bless
  51. self.add_param(7, -@luck_bless)
  52. end
  53. end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement