Advertisement
dsiver144

Hime's Battle Reactions & DSI Unit System Compatible Fix Bug

Feb 2nd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. #==============================================================================
  2. # Hime's Battle Reactions & DSI Unit System Compatible Fix Bug.
  3. # -- Last Updated: 2018.02.03
  4. # -- Author: dsiver144
  5. # -- Requires: Battle Reactions & DSI Unit System
  6. #==============================================================================
  7. if $imported["DSI-UnitSystem"]
  8. msgbox_p("DSI Unit System not found! Please re-install it to proceed.")
  9. end
  10. #==============================================================================
  11. class Game_ActorUnit < Game_Actor
  12. #-----------------------------------------------------------------------------
  13. # overwrite method: remove_execution_states
  14. #-----------------------------------------------------------------------------
  15. def remove_execution_states
  16. return unless @added_execution_states
  17. @added_execution_states.each {|state| remove_state(state.state_id)}
  18. end
  19. #-----------------------------------------------------------------------------
  20. # overwrite method: skill_reactions
  21. #-----------------------------------------------------------------------------
  22. def skill_reactions(item)
  23. reaction_objects.inject([]) do |r, obj|
  24. r.concat(obj.skill_reactions(item))
  25. end
  26. end
  27. #-----------------------------------------------------------------------------
  28. # overwrite method: get_reactions
  29. #-----------------------------------------------------------------------------
  30. def get_reactions(item)
  31. res = []
  32. reaction_objects.each do |obj|
  33. res.concat(obj.reactions(item))
  34. end
  35. return res
  36. end
  37. #-----------------------------------------------------------------------------
  38. # overwrite method: make_reaction
  39. #-----------------------------------------------------------------------------
  40. def make_reaction(user, reaction)
  41. return unless reaction.condition_met?(self, user)
  42. return unless movable? || reaction.forced
  43. chance = reaction.chance(self, user)
  44. return if chance < rand
  45. skill = $data_skills[reaction.react_id]
  46. action = Game_Action.new(self, reaction.forced)
  47. if skill.for_opponent?
  48. action.target_index = user.index
  49. elsif skill.for_friend?
  50. action.target_index = self.index
  51. end
  52. action.set_skill(reaction.react_id)
  53. action.make_targets
  54. @actions.push(action)
  55. BattleManager.force_reaction(self)
  56. end
  57. #-----------------------------------------------------------------------------
  58. # overwrite method: backup_actions
  59. #-----------------------------------------------------------------------------
  60. def backup_actions
  61. @reaction_backup = @actions.dup
  62. end
  63. #-----------------------------------------------------------------------------
  64. # overwrite method: restore_actions
  65. #-----------------------------------------------------------------------------
  66. def restore_actions
  67. @actions = @reaction_backup.dup
  68. end
  69. #-----------------------------------------------------------------------------
  70. # overwrite method: reaction_objects
  71. #-----------------------------------------------------------------------------
  72. def reaction_objects
  73. super
  74. end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement