estriole

EST - HIME Effect - Share The Pain Revised

Apr 29th, 2021 (edited)
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.55 KB | None | 0 0
  1. =begin
  2. #==============================================================================
  3. ** Effect: Share the pain
  4. Author: Estriole
  5. Date: Nov 2, 2012
  6. revised: Apr 30, 2021
  7.  
  8. Effect Manager Version : 2.6
  9.  
  10. ------------------------------------------------------------------------------
  11. ** Change log
  12. ------------------------------------------------------------------------------
  13. ** Terms of Use
  14. * Free to use in commercial/non-commercial projects
  15. * No real support. The script is provided as-is
  16. * Will do bug fixes, but no compatibility patches
  17. * Features may be requested but no guarantees, especially if it is non-trivial
  18. * Preserve this header
  19. ------------------------------------------------------------------------------
  20.  
  21. if anyone damage actor/enemy with this state. all the party member/ troop member
  22. that have the same state will suffer the same damage.
  23.  
  24. tag the state with this:
  25.  
  26. <eff: share_the_pain x>
  27.  
  28. Where x is the percentage of damage that should be shared.
  29. By default it is 1, which means 100%
  30. to make every 1hp damage deal 10hp damage to other share the pain... change it to 10
  31. to make only 20% just change to 0.2
  32.  
  33. #==============================================================================
  34.  
  35. =end
  36.  
  37. $imported = {} if $imported.nil?
  38. $imported["Effect_ShareThePain"] = true
  39.  
  40. #==============================================================================
  41.  
  42. # ** Rest of the script
  43.  
  44. #==============================================================================
  45.  
  46. module Effect
  47.   module Share_The_Pain
  48.     Effect_Manager.register_effect(:share_the_pain,2.6)
  49.   end
  50. end
  51.  
  52. class Game_Battler < Game_BattlerBase
  53.   def state_effect_share_the_pain_guard(user, state, effect)
  54.     return if user == self  
  55.     return if @result.hp_damage <=0
  56.     mod = eval(effect.value1[0]) rescue 1
  57.     hp_damage = (@result.hp_damage * mod).to_i
  58.       for member in $game_party.battle_members
  59.         next if !member.state?(state.id)
  60.         next if member == self
  61.         member.hp -= hp_damage if hp_damage >0
  62.         member.perform_collapse_effect if member.dead?
  63.         @result.effect_results.push("%s shared the pain and received %d damage" %[member.name, hp_damage.to_i])
  64.       end
  65.       for enemy in $game_troop.members
  66.         next if !enemy.state?(state.id)
  67.         next if enemy == self
  68.         enemy.hp -= hp_damage if hp_damage >0
  69.         enemy.perform_collapse_effect if enemy.dead?
  70.         @result.effect_results.push("%s shared the pain and received %d damage" %[enemy.name, hp_damage.to_i])
  71.       end
  72.     @result.success = true
  73.   end
  74. end
Add Comment
Please, Sign In to add comment