Advertisement
Dekita

ev2

Nov 23rd, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.1
  3. ★ Pokémon Natures™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script replicates the natures / iv / levels feature from pokemon,
  9. e.g each pokemon, (in this case ENEMY) is given a random nature, iv value and
  10. level upon encounter, That enemies stats are then determined by that.
  11. Use map notetags toset enemy levels and use script calls to make fixed encounters
  12. e.g set nature iv and lvl.
  13.  
  14. NOTE: This works 100% like pokemon.
  15.  
  16. ================================================================================
  17. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  18. ================================================================================
  19. 1. You must give credit to "Dekita"
  20. 2. You are NOT allowed to repost this script.(or modified versions)
  21. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  22. 4. You are NOT allowed to use this script for Commercial games.
  23. 5. ENJOY!
  24.  
  25. "FINE PRINT"
  26. By using this script you hereby agree to the above terms and conditions,
  27. if any violation of the above terms occurs "legal action" may be taken.
  28. Not understanding the above terms and conditions does NOT mean that
  29. they do not apply to you.
  30. If you wish to discuss the terms and conditions in further detail you can
  31. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  32.  
  33. ================================================================================
  34. History:
  35. =========
  36. D /M /Y
  37. 16/11/2o12 - finished,
  38.  
  39. ================================================================================
  40. Credit and Thanks to :
  41. =======================
  42.  
  43. ================================================================================
  44. Known Bugs:
  45. ============
  46. N/A
  47.  
  48. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49. If a new bug is found please contact me at
  50. http://dekitarpg.wordpress.com/
  51.  
  52. ================================================================================
  53. INSTRUCTIONS:
  54. ==============
  55. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  56.  
  57. =end #==========================================================================#
  58. module Dekita__Pokemon_Enemies
  59.  
  60. # NOTETAGS :
  61.  
  62. # <lv: min, max>
  63. # <ene lv: enemy_id, min, max>
  64. # these go in map noteboxes, replace min with the maps minimum map level max
  65. # with the maximum,
  66. # enemy_id the enemy id in the database.
  67.  
  68. # SCRIPT CALLS :
  69. # fix_lv_battle(val)
  70. # fix_nature_battle(val)
  71. # fix_iv_battle(mhp, mmp, atk, def, mat, mdf, agi, luk)
  72.  
  73. # val = an integer
  74. # replace mhp, mmp, atk, def, mat, mdf, agi and luk with values between 0 - 31
  75. # and this will change that enemies iv values to whatever you set.
  76. # REMEMBER iv values are different from the acctual param value, but they do
  77. # affect param values
  78.  
  79. # The maximum level for enemies
  80. Max_Level = 100
  81.  
  82. # as enemy levels are based on maps and during battle test there is no map id,
  83. # you have to set the min and max level for enemies in test battles here.
  84. BattleTest_Level = [5, 10] # [min, max]
  85.  
  86. end
  87.  
  88. $imported = {} if $imported.nil?
  89. $imported[:Dekita_Pokémon_Enemies] = true
  90.  
  91. #################################################################################
  92. #################################################################################
  93. # As team rocket where once again "blasting off" Ash, Brock and Misty slowly #
  94. # lifted their bodies from the ground, turning, gasping at the horror they could#
  95. # see before them... #
  96. #################################################################################
  97. #################### !! DONT MODIFY SHIT AFTER HERE !! ##########################
  98. #################################################################################
  99. class RPG::Map
  100. #===============================================================================#
  101.  
  102. attr_accessor :map_level_range
  103. attr_accessor :map_level_rangeind_poks
  104.  
  105. def load_enemy_levels
  106. @map_level_range = [1, Dekita__Pokemon_Enemies::Max_Level]
  107. @map_level_rangeind_poks = []
  108. self.note.split(/[\r\n]+/).each { |line|
  109. case line
  110. when /<lv: (.*), (.*)>/i
  111. @map_level_range = [$1.to_i, $2.to_i]
  112. #---
  113. when /<ene lv: (.*), (.*), (.*)>/i
  114. @map_level_rangeind_poks.push([$1.to_i, $2.to_i, $3.to_i])
  115. #---
  116. p "PUSHED"
  117. end
  118. } # self.note.split
  119. end
  120.  
  121. end
  122.  
  123. #===============================================================================#
  124. class Game_Map
  125. #===============================================================================#
  126.  
  127. attr_reader :level_range_min
  128. attr_reader :level_range_max
  129. attr_reader :map_level_rangeind_poks
  130.  
  131. alias enemylevelsmapsetup setup
  132. def setup(map_id)
  133. enemylevelsmapsetup(map_id)
  134. @map.load_enemy_levels
  135. @level_range_min = @map.map_level_range[0]
  136. @level_range_max = @map.map_level_range[1]
  137. @map_level_rangeind_poks = @map.map_level_rangeind_poks
  138. p "@map_level_rangeind_poks = #{@map_level_rangeind_poks}"
  139. end
  140.  
  141. end
  142.  
  143. #===============================================================================#
  144. class Game_Temp
  145. #===============================================================================#
  146.  
  147. attr_accessor :fixed_level_battle
  148. attr_accessor :fixed_nature_battle
  149. attr_accessor :fixed_iv_battle
  150.  
  151. alias pokenemylvsgtinit initialize
  152. def initialize
  153. pokenemylvsgtinit
  154. init_fixed_enemies_info
  155. end
  156.  
  157. def init_fixed_enemies_info
  158. @fixed_level_battle = [false, 0]
  159. @fixed_nature_battle = [false, 0]
  160. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  161. end
  162.  
  163. def clear_fixed_level_data
  164. @fixed_level_battle = [false, 0]
  165. end
  166.  
  167. def clear_fixed_nature_data
  168. @fixed_nature_battle = [false, 0]
  169. end
  170.  
  171. def clear_fixed_iv_data
  172. @fixed_iv_battle = [false, 0, 0, 0, 0, 0, 0, 0, 0]
  173. end
  174.  
  175. end # Game_Temp
  176.  
  177. #===============================================================================#
  178. class Game_Enemy < Game_Battler
  179. #===============================================================================#
  180.  
  181. attr_accessor :level
  182. attr_accessor :nature
  183. attr_accessor :init_ivs
  184.  
  185. alias init_for_enemy_levels initialize
  186. def initialize(index, enemy_id)
  187. setup_enemies_pokestylee(enemy_id)
  188. init_for_enemy_levels(index, enemy_id)
  189. end
  190.  
  191. def setup_enemies_pokestylee(enemy_id)
  192. dekita_natures_for_enemies_agogo
  193. get_enemy_level(enemy_id)
  194. end
  195.  
  196. def dekita_natures_for_enemies_agogo
  197. return if !$imported[:Dekita_Pokémon_Natures]
  198. @init_ivs = [0] * 8
  199. @nature = get_rand_nature
  200. get_init_ivs
  201. end
  202.  
  203. def get_enemy_level(enemy_id)
  204. @level = ($game_map.level_range_min + rand($game_map.level_range_max - $game_map.level_range_min+1))
  205. if $game_temp.fixed_level_battle[0] == true
  206. @level = $game_temp.fixed_level_battle[1]
  207. $game_temp.clear_fixed_level_data
  208. elsif $BTEST
  209. min = Dekita__Pokemon_Enemies::BattleTest_Level[0]
  210. max = Dekita__Pokemon_Enemies::BattleTest_Level[1]
  211. @level = (min+rand(max-min+1))
  212. else
  213. $game_map.map_level_rangeind_poks.size.times {|i|
  214. p "Checked"
  215. if $game_map.map_level_rangeind_poks[i][0] == enemy_id
  216. p "Returned"
  217. checker = $game_map.map_level_rangeind_poks[i]
  218. @level = (checker[1] + rand(checker[2] - checker[1]+1))
  219. else
  220. p "Not Returned"
  221. @level = ($game_map.level_range_min + rand($game_map.level_range_max - $game_map.level_range_min+1))
  222. end
  223. }
  224. end
  225. @level = [[@level, Dekita__Pokemon_Enemies::Max_Level].min, 1].max
  226. end
  227.  
  228. def fixed_enemy_level_for_map(check)
  229. checker = $game_map.map_level_rangeind_poks[check]
  230. @level = (checker[1] + rand(checker[2] - checker[1]+1))
  231. end
  232.  
  233. def get_init_ivs
  234. return get_fixed_ivs if $game_temp.fixed_iv_battle[0]
  235. p "Got enemies iv's RAND"
  236. 8.times {|i| @init_ivs[i] = (rand(Dekita__Pokémon_Nature::Max_IV_Amount+1))}
  237. end
  238.  
  239. def get_fixed_ivs
  240. p "Got enemies iv's FIXED"
  241. fixed_val = $game_temp.fixed_iv_battle
  242. 8.times {|i| @init_ivs[i] = fixed_val[i+1]}
  243. $game_temp.clear_fixed_iv_data
  244. end
  245.  
  246. def get_rand_nature
  247. t1_ = $game_temp.fixed_nature_battle[0]
  248. dnar = (Dekita__Pokémon_Nature::Nature.size)
  249. val = rand(dnar)
  250. if t1_
  251. val = $game_temp.fixed_nature_battle[1]
  252. $game_temp.clear_fixed_nature_data
  253. return Dekita__Pokémon_Nature::Nature[val]
  254. end
  255. return Dekita__Pokémon_Nature::Nature[val]
  256. end
  257.  
  258. alias enemiesparbase param_base
  259. def param_base(param_id)
  260. if $imported[:Dekita_Pokémon_Natures]
  261. par_id = param_id
  262. case par_id
  263. when 0, 1 # NOTE : if you change these calculations your a fucking moron ! ijs...
  264. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+10+@level)*@nature[par_id+1]).to_i
  265. when 2, 3, 4, 5, 6, 7
  266. return ( (((@init_ivs[par_id]+2*enemy.params[par_id]+(0/4))*@level/100)+5)*@nature[par_id+1]).to_i
  267. end
  268. else
  269. enemiesparbase(param_id)
  270. end
  271. end
  272.  
  273. alias pokgold gold
  274. def gold
  275. (@level * pokgold)
  276. end
  277.  
  278. end # Game_Enemy < Game_Battler
  279.  
  280. #==============================================================================
  281. class Game_Interpreter
  282. #==============================================================================
  283.  
  284. def fix_lv_battle(val)
  285. $game_temp.fixed_level_battle[0] = true
  286. $game_temp.fixed_level_battle[1] = val
  287. end
  288.  
  289. def fix_nature_battle(val)
  290. $game_temp.fixed_nature_battle[0] = true
  291. $game_temp.fixed_nature_battle[1] = val
  292. end
  293.  
  294. def fix_iv_battle(val_1,val_2,val_3,val_4,val_5,val_6,val_7,val_8)
  295. $game_temp.fixed_iv_battle[0] = true
  296. $game_temp.fixed_iv_battle[1] = val_1
  297. $game_temp.fixed_iv_battle[2] = val_2
  298. $game_temp.fixed_iv_battle[3] = val_3
  299. $game_temp.fixed_iv_battle[4] = val_4
  300. $game_temp.fixed_iv_battle[5] = val_5
  301. $game_temp.fixed_iv_battle[6] = val_6
  302. $game_temp.fixed_iv_battle[7] = val_7
  303. $game_temp.fixed_iv_battle[8] = val_8
  304. end
  305.  
  306. end # Game_Interpreter
  307.  
  308. #===============================================================================#
  309. # - SCRIPT END - #
  310. #===============================================================================#
  311. # http://dekitarpg.wordpress.com/ #
  312. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement