TheSixth

Critical Damage Feature

Jan 23rd, 2021 (edited)
1,949
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.57 KB | None | 0 0
  1. =begin
  2. - Critical Damage Feature v1.1
  3. - Made by: Sixth
  4.  
  5. - Description
  6. Just a short script to allow setting up different critical damage for different
  7. skills and items.
  8.  
  9. - Note-tag:
  10. Use this note-tag on your skills/items to set a new critical damage for them:
  11.  
  12.   <cri_dmg: value>
  13.  
  14. The default value is 3, but in case you want to change the default to something
  15. else, you just change the only number 3 in this little script to any value you
  16. want (although it should be a positive number or weird things will happen :D).
  17. Note that you can use float values too if you want (1.5, 2.45, etc).
  18.  
  19. - Installation:
  20. Place this script between Materials and Main!
  21.  
  22. - Compatibility:
  23. This script overwrites a method that is very often used in many different types
  24. of custom scripts, so the possibility of a compatibility issue is kinda high.
  25. You will need a patch if you run into these issues to make the scripts work
  26. together.
  27.  
  28. - Terms of use:
  29. Credit me (Sixth) in your game, pretty please! :P
  30.  
  31. =end
  32.  
  33. class RPG::UsableItem < RPG::BaseItem
  34.  
  35.   attr_accessor :cri_dmg
  36.  
  37.   def cri_dmg
  38.     init_cri_dmg if @cri_dmg.nil?
  39.     return @cri_dmg
  40.   end
  41.  
  42.   def init_cri_dmg
  43.     @cri_dmg = @note =~ /<cri_dmg:(?:\s*)(.*)>/i ? $1.to_f : 3
  44.   end
  45.  
  46. end
  47.  
  48. class Game_Battler < Game_BattlerBase
  49.  
  50.   alias add_new_cri_dmg6192 item_element_rate
  51.   def item_element_rate(user, item)
  52.     val = add_new_cri_dmg6192(user, item)
  53.     val *= item.cri_dmg if @result.critical
  54.     return val
  55.   end
  56.    
  57.   def apply_critical(val) # Overwrite!
  58.     return val
  59.   end
  60.  
  61. end
  62. # End of script! O_O
Add Comment
Please, Sign In to add comment