Advertisement
blucalm

Scale Enemy Stats

Nov 7th, 2012
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. #==============================================================================
  2. # Scale Enemy Stats
  3. #==============================================================================
  4. # Version 0.0 2012 Sept, 4 by Eshra
  5. # Compatibility: RPG Maker VX Ace
  6. # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
  7. # About
  8. # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
  9. #
  10. # This script allows the stats of all of the enemies in the database or all of
  11. # the members of the current enemies in battle to be modified by a scalar. It
  12. # might be useful if you feel like the enemies in your game are a bit too weak,
  13. # a bit too strong, you want to have varying difficulty levels, etc. i.e. you
  14. # want to modify the stats of all the enemies in your game and you don't want to
  15. # have to go through your entire database and change the values manually.
  16. #
  17. # - NOTE -
  18. # The modification is being applied directly to the values in $data_enemies and
  19. # so if temporary results are desired (during runtime), the stats will need to be
  20. # returned to their original values later.
  21. #
  22. # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
  23. # How to Use
  24. # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
  25. #
  26. # Make this script call:
  27. #
  28. # EnemyStatScale.mod_stats_scalar(arg)
  29. # (replace arg with a float)
  30. #
  31. # To modify all of the enemies' stats inside $data_enemies by arg.
  32. #
  33. # Make this script call:
  34. #
  35. # EnemyStatScale.mod_troop_stats(arg)
  36. # (replace arg with a float)
  37. #
  38. # To modify the stats of the current troop the player is battling by arg
  39. #
  40. # Auto Scaling:
  41. # The stats for all enemies in the database can be modified upon loading the
  42. # game by changing the value of EnemyStatScale::InitScalar
  43.  
  44. ($imported ||= {})["Ra Scale Enemy Stats"] = true
  45. #==============================================================================
  46. # ** EnemyStatScale
  47. #------------------------------------------------------------------------------
  48. # Handles manipulation of enemy.params for each element in $data_enemies
  49. #==============================================================================
  50. module EnemyStatScale
  51. InitScalar = 1 # Change this value to modify all stats upon load
  52.  
  53. #
  54. # * Scales stats for all enemies according to param
  55. #
  56. def self.mod_stats_scalar(mod)
  57. $data_enemies.each{ |foe| mod_params(foe, mod) }
  58. end # End - mod_stats_scalar
  59.  
  60. #
  61. # * Scale the stats of the current game troop
  62. #
  63. def self.mod_troop_stats(mod)
  64. $game_troop.members.each{|memb| mod_params($data_enemies[memb.enemy_id],mod)}
  65. end # End - mod_troop_stats
  66.  
  67. #
  68. # * Helper method for mod_troop_stats and mod_stats_scalar
  69. #
  70. def self.mod_params(foe, mod)
  71. foe ? foe.params = foe.params.map{|val| (val*mod).to_i} : nil
  72. end # End - mod_params
  73. end # End - EnemyStatScale
  74.  
  75. #==============================================================================
  76. # ** DataManager
  77. #------------------------------------------------------------------------------
  78. # Alias Method:
  79. # load_database - given functionality to apply stat modifications upon
  80. # loading if desired.
  81. #==============================================================================
  82. module DataManager
  83. class <<self; alias dmang_load_dbase_mod_enemy_stats_9989 load_database; end
  84. def self.load_database
  85. dmang_load_dbase_mod_enemy_stats_9989
  86. EnemyStatScale.mod_stats_scalar(EnemyStatScale::InitScalar)
  87. end
  88. end
  89.  
  90. #==============================================================================
  91. # ** RPG::Enemy
  92. #------------------------------------------------------------------------------
  93. # The params array is made public
  94. #==============================================================================
  95. class RPG::Enemy < RPG::BaseItem
  96. attr_accessor :params # array = [hp, mp, atk, def, matk, mdef, agi, luck]
  97. end # End RPG::Enemy
  98. # End of File
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement