Balrogic

Skill Self Effects: Bugfixed

Dec 27th, 2014
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.99 KB | None | 0 0
  1. #===============================================================================
  2. # Skill Self Effects
  3. # By Jet10985 (Jet)
  4. # Requested by Touchfuzzy
  5. # Debugged by Balrogic  TODO: Update the fixed regex to restore multiple effects in one tag
  6. #===============================================================================
  7. # This script will allow you to specify a skill's effects tot arget the user
  8. # instead of the target, on skills that don't already effect the user.
  9. # This script has: 0 customization options.
  10. #===============================================================================
  11. # Overwritten Methods:
  12. # None
  13. #-------------------------------------------------------------------------------
  14. # Aliased methods:
  15. # Game_Battler: item_effect_apply
  16. #===============================================================================
  17. =begin
  18. To specify the effects, use this notetag in the skill's notebox:
  19.      
  20. <self effect: 1>
  21. or
  22. <self effect: 1>
  23. <self effect: 2>
  24. <self effect: 3> to specify more than 1 effect
  25. --------------------------------------------------------------------------------
  26. Use of this script could be as the following.
  27.      
  28. You make a "Berserk Strike" skill, which does 200% damage to an enemy.
  29. You make the 2nd effect "Defense Down 50%" and want it applied to the user.
  30. You'd use this notetag: <self effect: 2>
  31. =end
  32.      
  33. class RPG::Skill
  34.  
  35.   def self_effects
  36.     if @self_effects.nil?
  37.       @self_effects = []
  38.       note = @note.scan(/(?<=<self effect: ).*?(?=[>])/)
  39.       note.each{|note|
  40.       @self_effects.push(@effects[note.to_i - 1]) if note.to_i >= 1
  41.       }
  42.     end
  43.     @self_effects
  44.   end
  45. end
  46.  
  47. class Game_Battler
  48.      
  49.   alias jet3745_item_effect_apply item_effect_apply
  50.   def item_effect_apply(user, item, effect, reffed = false)
  51.     if item.is_a?(RPG::Skill) && item.self_effects.include?(effect) && !reffed
  52.       user.item_effect_apply(user, item, effect, true)
  53.       return
  54.     end
  55.     jet3745_item_effect_apply(user, item, effect)
  56.   end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment