Advertisement
Dekita

state shift thing

Aug 28th, 2014
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #===============================================================================
  2. module GA_State_Shift
  3. #===============================================================================
  4. #-----------------------------------------------------------------------------
  5. #
  6. #-----------------------------------------------------------------------------
  7. Actor_ID = 1
  8. State_ID = [10, 11]
  9. Perc = 100
  10. Min_Dmg = 1
  11. end
  12. #===============================================================================
  13. class Game_Actor
  14. #===============================================================================
  15. #-----------------------------------------------------------------------------
  16. alias :odmgstateshift :on_damage
  17. #-----------------------------------------------------------------------------
  18. #
  19. #-----------------------------------------------------------------------------
  20. def on_damage value
  21. odmgstateshift value
  22. perform_state_dmg_change value
  23. end
  24. #-----------------------------------------------------------------------------
  25. #
  26. #-----------------------------------------------------------------------------
  27. def perform_state_dmg_change value
  28. return unless self.is_a? Game_Actor
  29. return unless GA_State_Shift::Actor_ID == self.id
  30. return unless GA_State_Shift::Perc <= rand(101)
  31. return unless GA_State_Shift::Min_Dmg <= value
  32. if self.state? GA_State_Shift::State_ID.first
  33. remove_state GA_State_Shift::State_ID.first
  34. add_state GA_State_Shift::State_ID.last
  35. else
  36. remove_state GA_State_Shift::State_ID.last
  37. add_state GA_State_Shift::State_ID.first
  38. end
  39. end
  40. #-----------------------------------------------------------------------------
  41. #
  42. #-----------------------------------------------------------------------------
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement