Advertisement
TroyZ

TroyZ - Slip Damage Mods

Oct 4th, 2014
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.58 KB | None | 0 0
  1. # ==============================================================================
  2. # ▼▼▼▼▼▼                    TroyZ - Slip Damage Mods                      ▼▼▼▼▼▼
  3. # ==============================================================================
  4. # Script by : Agung Prasetyo(TroyZ)
  5. # Contact me by : - Email agung.endisnear.xyz@gmail.com
  6. #                 - Forum RPGMakerID, username TroyZ
  7. #                 - Handphone 085756289121
  8. # Engine : VXAce
  9. # Level : Easy
  10. # Version : 1.0
  11. # ------------------------------------------------------------------------------
  12. # Change Logs :
  13. # 5 October 2014 : Version 1.0 released
  14. # ------------------------------------------------------------------------------
  15. # How this work :
  16. # Inspired by DotA hero Lesale Deathbringer - The Venomancer, where he have
  17. # 3 skills for poisoning the enemy. 2 of his skills (Venomous Gale and Poison
  18. # Sting) have slip damage that can kill the enemy, whether 1 of his skills
  19. # (Poison Nova, his ultimate skill), also have slip damage but can't kill the
  20. # enemy (the damage stops at 1 hp). This script allows you to create states
  21. # that have both possibilities.
  22. # ------------------------------------------------------------------------------
  23. # How to use :
  24. # Place it between material and main. Use this notetag inside states :
  25. #
  26. # <death on slip>
  27. #
  28. # The states that have this notetag will kill the target that get slipped by
  29. # the damage. States that don't have this notetag won't kill the target (the
  30. # damage stops at 1 hp). Make sure that the states that have killing slip damage
  31. # properties being set at higher priority than the states that doesn't have
  32. # killing slip damage properties.
  33. # ------------------------------------------------------------------------------
  34. # Compatibility issues :
  35. # - Theo In Map Slip Damage : put this script below that script.
  36. # - Theo State Damage Using Skill : put this script below Theo Basic Modules and
  37. #                                   Theo State Damage Using Skill (needs both
  38. #                                   scripts to work).
  39. # Also, this script overwrite the def regenerate_hp method, so KO by Slip Damage
  40. # option at the system tab of Database won't have any effects anymore.
  41. # ------------------------------------------------------------------------------
  42. # Who to credit :
  43. # - Allah swt. : For the chance of living that he has given to me.
  44. # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
  45. #                        I'm proud to be your follower. :)
  46. # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
  47. # ------------------------------------------------------------------------------
  48. # License :
  49. # - Free Game : Just credit those names above.
  50. # - Commercial Game : Same as free game's license.
  51. # ------------------------------------------------------------------------------
  52. $imported = {} if $imported.nil?
  53. $imported[:TroyZ_SlipDamageMods] = true
  54. # ------------------------------------------------------------------------------
  55. # There is nothing to config beyond this line
  56. # ------------------------------------------------------------------------------
  57. class RPG::State < RPG::BaseItem
  58.   def slip_damage_death?
  59.     self.note.include?("<death on slip>")
  60.   end
  61. end
  62.  
  63. class Game_Battler < Game_BattlerBase  
  64.   def base_damage(user, item)
  65.     value = item.damage.eval(user, self, $game_variables)
  66.     states.each do |state|
  67.       return value if state.slip_damage_death?
  68.       return [value, [hp - 1, 0].max].min
  69.     end
  70.     value
  71.   end
  72.  
  73.   def regenerate_hp
  74.     states.each do |state|
  75.       return slip_kill if state.slip_damage_death?
  76.       return slip_doesnt_kill
  77.     end
  78.     return slip_doesnt_kill
  79.   end
  80.  
  81.   def slip_kill
  82.     damage = -(mhp * hrg).to_i
  83.     perform_map_damage_effect if $game_party.in_battle && damage > 0    
  84.     @result.hp_damage = [damage, hp].min
  85.     self.hp -= @result.hp_damage
  86.   end
  87.  
  88.   def slip_doesnt_kill
  89.     damage = -(mhp * hrg).to_i
  90.     perform_map_damage_effect if $game_party.in_battle && damage > 0    
  91.     @result.hp_damage = [damage, [hp - 1, 0].max].min
  92.     self.hp -= @result.hp_damage
  93.   end  
  94. end
  95.  
  96.  
  97. class Game_Actor < Game_Battler
  98.   def perform_hp_damage(state)
  99.     return unless slip_hp?(state)
  100.     states.each do |state|
  101.       if state.slip_damage_death?
  102.         self.hp -= state.hp_slip_con
  103.         self.hp -= mhp * state.hp_slip_per
  104.       else
  105.         self.hp -= [state.hp_slip_con, [hp - 1, 0].max].min
  106.         self.hp -= [mhp * state.hp_slip_per, [hp - 1, 0].max].min
  107.       end    
  108.     perform_flash_hp_damage
  109.     end
  110.   end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement