TheoAllen

RGSS3 Core Damage Processing

May 3rd, 2013
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.01 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Core Damage Processing
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com
  5. # =============================================================================
  6. $imported = {} if $imported.nil?
  7. $imported[:Theo_CoreDamage] = true
  8. # =============================================================================
  9. =begin
  10.  
  11.   NOTE :
  12.   - Script ini cuman ngerubah alur perhitungan damage RGSS3. Secara default, di
  13.   RGSS3 tu perhitungan di make_damage_value sangat strict banget dan ngebikin
  14.   kita ga bisa aliasing dan berakhir dengan overwrite :3
  15.   - Script ini emang mirip ama punyanya si tsukihime. Cuman bedanya kalo
  16.   miliknya si tsuki ngga ngerubah apply critical.
  17.  
  18.   TERMS OF USE :
  19.   - Ga perlu kredit jg. Toh ini masuk hal common sense
  20.  
  21. =end
  22. # =============================================================================
  23. # Tidak ada konfigurasi
  24. # =============================================================================
  25. class Game_Battler < Game_BattlerBase
  26.  
  27.   def make_damage_value(user, item)
  28.     value = base_damage(user, item)
  29.     value = apply_element_rate(user, item, value)
  30.     value = process_damage_rate(user, item, value)
  31.     value = apply_damage_modifiers(user, item, value)
  32.     @result.make_damage(value.to_i, item)
  33.   end
  34.  
  35.   def base_damage(user, item)
  36.     value = item.damage.eval(user, self, $game_variables)
  37.     value
  38.   end
  39.  
  40.   def apply_element_rate(user, item, value)
  41.     value *= item_element_rate(user, item)
  42.     value
  43.   end
  44.  
  45.   def process_damage_rate(user, item, value)
  46.     value *= pdr if item.physical?
  47.     value *= mdr if item.magical?
  48.     value *= rec if item.damage.recover?
  49.     value
  50.   end
  51.  
  52.   def apply_damage_modifiers(user, item, value)
  53.     value = apply_critical(value, user) if @result.critical
  54.     value = apply_variance(value, item.damage.variance)
  55.     value = apply_guard(value)
  56.     value
  57.   end
  58.  
  59.   def apply_critical(damage, user)
  60.     damage * 3
  61.   end
  62.  
  63. end
Advertisement
Add Comment
Please, Sign In to add comment