TheSixth

Static State Parameter Bonuses

Sep 24th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.38 KB | None | 0 0
  1. =begin
  2.  
  3. Static State Parameter Bonuses
  4. Made by: Sixth
  5.  
  6. - Description:
  7. This script lets your states have static parameter bonuses (or debuffs).
  8.  
  9. - Usage:
  10. Use this note-tag on your states:
  11.  
  12.   <static prm param_id: +value>   # Increases parameter
  13.   <static prm param_id: -value>   # Lowers parameter
  14.  
  15. Replace the param_id with the ID of the parameter. They are:
  16.   0 - MHP, 1 - MMP, 2 - ATK, 3 - DEF, 4 - MAG, 5 - MDF, 6 - AGI, 7 - LUK
  17.  
  18. Replace the value with the value of change. It must be an integer!
  19. You must use a + or - sign before the value!
  20.  
  21. - Examples:
  22.  
  23.   <static prm 1: +200>
  24.   <static prm 4: -50>
  25.   <static prm 7: +777>
  26.  
  27. - Note:
  28. The added values will get multiplied by the multiplier bonuses from the default
  29. parameter features and buffs/debuffs!
  30.  
  31. =end
  32.  
  33. class RPG::State < RPG::BaseItem
  34.  
  35.   attr_accessor :static_prm
  36.  
  37.   def static_prm
  38.     init_static_prm if @static_prm.nil?
  39.     return @static_prm
  40.   end
  41.  
  42.   def init_static_prm
  43.     @static_prm = []
  44.     8.times do |i|
  45.       if @note =~ /<static prm #{i}(?:\s*):(?:\s*)([+\-]\d+)>/i
  46.         @static_prm[i] = $1.to_i
  47.       else
  48.         @static_prm[i] = 0
  49.       end
  50.     end
  51.   end
  52.  
  53. end
  54.  
  55. class Game_BattlerBase
  56.  
  57.   alias add_st_prms9927 param_plus
  58.   def param_plus(pid)
  59.     return states.inject(add_st_prms9927(pid)) {|r, st| r += st.static_prm[pid] }
  60.   end
  61.  
  62. end
  63. # End of script! O_O
Add Comment
Please, Sign In to add comment