Advertisement
thiago_d_d

Difficulty System

Jan 16th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.46 KB | None | 0 0
  1. #==============================================================
  2. # http://thiagodd.blogspot.com.br
  3. #
  4. # [TSDA] Difficulty System
  5. #   --> Version 1.0
  6. # by thiago_d_d
  7. #
  8. #--------------------------------------------------------------
  9. # * Features
  10. #--------------------------------------------------------------
  11. # + Adds an simples difficulty system. With it, the enemies will
  12. #   be weaker or stronger during battle. The system is controled
  13. #   by variables, so you can use the difficulty in other systems.
  14. #
  15. #--------------------------------------------------------------
  16. # * Install
  17. #--------------------------------------------------------------
  18. # Put this script above Main
  19. #
  20. #--------------------------------------------------------------
  21. # * Configuration
  22. #--------------------------------------------------------------
  23. # Go to the D_VARIABLE_ID line and put there the ID of the
  24. # variable you want to store the difficulty.
  25. # The value of this variable can be
  26. #    *0 - Normal difficulty
  27. #     Normal enemy atributes.
  28. #    *1 - Hard difficulty
  29. #     50% increased enemy atributes
  30. #    *2 - Very Hard difficulty
  31. #     70% increased enemy atributes
  32. #    *3 - God difficulty
  33. #     100% increased enemy atributes
  34. #    *4 - Easy difficulty
  35. #     40% decreased enemy atributes
  36. #==============================================================
  37. module TSDA
  38.   D_VARIABLE_ID = 1
  39. end
  40. #--------------------------------------------------------------
  41. class Game_Enemy
  42.   alias old_str str
  43.   def str
  44.     str = old_str
  45.     return str = apply_dificulty(str)
  46.   end
  47.   #------------------------------------------------------------
  48.   alias old_dex dex
  49.   def dex
  50.     dex = old_dex
  51.     return dex = apply_dificulty(dex)
  52.   end
  53.   #------------------------------------------------------------
  54.   alias old_agi agi
  55.   def agi
  56.     agi = old_agi
  57.     return agi = apply_dificulty(agi)
  58.   end
  59.   #------------------------------------------------------------
  60.   alias old_int int
  61.   def int
  62.     int = old_int
  63.     return int = apply_dificulty(int)
  64.   end
  65.   #------------------------------------------------------------
  66.   def apply_dificulty(atribute)
  67.     variable = $game_variables[TSDA::D_VARIABLE_ID]
  68.     case variable
  69.     when 0
  70.       return atribute
  71.     when 1
  72.       return (atribute * 1.50).to_int
  73.     when 2
  74.       return (atribute * 1.70).to_int
  75.     when 3
  76.       return (atribute * 2).to_int
  77.     when 4
  78.       return (atribute * 0.6).to_int
  79.     end
  80.     return atribute
  81.   end
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement