Archeia

Untitled

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