Advertisement
Dekita

natures and shit

Nov 7th, 2012
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.96 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 / ev feature from pokemon,
  9. e.g each pokemon, (in this case actor) is given a random nature and iv value
  10. upon entering the party.
  11. That actors growth rates are then determined by its nature and its iv, ev also
  12. has a role in how characters grow, you can gain ev from killing enemies
  13. and script calls.
  14. NOTE: This works 100% like pokemon. unsure which generation, but its pokemon :p
  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. 07/11/2o12 - updated - v1.1
  38. 30/10/2o12 - finished,
  39. 29/10/2o12 - started,
  40.  
  41. ================================================================================
  42. Credit and Thanks to :
  43. =======================
  44. http://www.serebii.net/games/stats.shtml for stat calculations.
  45.  
  46. ================================================================================
  47. Known Bugs:
  48. ============
  49. N/A
  50.  
  51. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  52. If a new bug is found please contact me at
  53. http://dekitarpg.wordpress.com/
  54.  
  55. ================================================================================
  56. INSTRUCTIONS:
  57. ==============
  58. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  59.  
  60. ================================================================================
  61. Script Calls:
  62. ==============
  63. $game_actors[ACTOR_ID].gain_evs(PARAM_ID, VALUE)
  64. ACTOR_ID = the database number of the actor
  65. PARAM_ID = the param id
  66. (0 = mhp, 1 = mmp, 2 = atk, 3 = def, 4 = mat, 5 = mdf, 6 = agi, 7 = luk)
  67. VALUE = the amount of ev you wish to gain.
  68.  
  69. you could also do...
  70. $game_party.members[PARTY_MEMBER_ID].gain_evs(PARAM_ID, VALUE)
  71.  
  72. ================================================================================
  73. Notetags: (default)
  74. ==========
  75. <ev: mhp, mmp, atk, def, mat, mdf, agi, luk>
  76.  
  77. give this to an enemy if you want them to give you ev when they are killed
  78. replace mhp, mmp, atk, def, mat, mdf, agi, luk with numbers.
  79.  
  80. =end #==========================================================================#
  81. module Dekita__Pokémon_Nature
  82. #==============================================================================
  83. Nature = []# <- DO NOT DELETE.
  84.  
  85.  
  86. Nature_Vocab = "Nature :"
  87. # NOTE: nature multipliers are percentage values, this means that
  88. # 1.1 = 110% 0.9 = 90% 0.01 = 1%
  89. # 1 is the default, any stats you do not want modified make sure they are 1.
  90.  
  91. # Traditional Pokemon Natures
  92. #Nature id =[ Name, mhp, mmp, atk, def, mat, mdf, agi, luk]
  93. Nature[0] = ["Adamant", 1, 1, 1.1, 1, 0.9, 1, 1, 1]
  94. Nature[1] = ["Bashfull", 1, 1, 1, 1, 1, 1, 1, 1]
  95. Nature[2] = ["Bold", 1, 1, 0.9, 1.1, 1, 1, 1, 1]
  96. Nature[3] = ["Brave", 1, 1, 1.1, 1, 1, 1, 0.9, 1]
  97. Nature[4] = ["Calm", 1, 1, 0.9, 1, 1, 1.1, 1, 1]
  98. Nature[5] = ["Careful", 1, 1, 1, 1, 0.9, 1.1, 1, 1]
  99. Nature[6] = ["Docile", 1, 1, 1, 1, 1, 1, 1, 1]
  100. Nature[7] = ["Gentle", 1, 1, 0.9, 1, 1, 1.1, 1, 1]
  101. Nature[8] = ["Hardy", 1, 1, 1, 1, 1, 1, 1, 1]
  102. Nature[9] = ["Hasty", 1, 1, 1, 0.9, 1, 1, 1.1, 1]
  103. Nature[10]= ["Impish", 1, 1, 1, 1.1, 0.9, 1, 1, 1]
  104. Nature[11]= ["Jolly", 1, 1, 1, 1, 0.9, 1, 1.1, 1]
  105. Nature[12]= ["Lax", 1, 1, 1, 1.1, 1, 0.9, 1, 1]
  106. Nature[13]= ["Lonely", 1, 1, 1.1, 0.9, 1, 1, 1, 1]
  107. Nature[14]= ["Mild", 1, 1, 1, 0.9, 1.1, 1, 1, 1]
  108. Nature[15]= ["Modest", 1, 1, 0.9, 1, 1.1, 1, 1, 1]
  109. Nature[16]= ["Naive", 1, 1, 1, 1, 1, 0.9, 1.1, 1]
  110. Nature[17]= ["Naughty", 1, 1, 1.1, 1, 1, 0.9, 1, 1]
  111. Nature[18]= ["Quiet", 1, 1, 1, 1, 1.1, 1, 0.9, 1]
  112. Nature[19]= ["Quirky", 1, 1, 1, 1, 1, 1, 1, 1]
  113. Nature[20]= ["Rash", 1, 1, 1, 1, 1.1, 0.9, 1, 1]
  114. Nature[21]= ["Relaxed", 1, 1, 1, 1.1, 1, 1, 0.9, 1]
  115. Nature[22]= ["Sassy", 1, 1, 1, 1, 1, 1.1, 0.9, 1]
  116. Nature[23]= ["Serious", 1, 1, 1, 1, 1, 1, 1, 1]
  117. Nature[24]= ["Timid", 1, 1, 0.9, 1, 1, 1, 1.1, 1]
  118.  
  119. # Dekita EPIC Natures
  120. Nature[25]= ["A Dick", 0.9, 0.9, 1.3, 0.9, 1.3, 0.9, 0.9, 0.9]
  121. Nature[26]= ["Like a G6",1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1]
  122.  
  123. # You can continue to add to this array at will like so...
  124. # Nature[NUMBER] = ["NAME", 1, 1, 1, 1, 1, 1, 1, 1]
  125. # Make sure NUMBER is the next number in the list to avoid crashes.
  126.  
  127.  
  128. #############################
  129. # CUSTOMISATION OPTIONS END #
  130. #############################
  131.  
  132. # For MHP and MMP
  133. # (((IVs + 2 * BASE + (EVs / 4) ) * level / 100) + 10 + level ) * NATURE
  134.  
  135. # For ATK, DEF, MAT, MDF, AGI, LUK
  136. # (((IVs + 2 * BASE + (EVs / 4) ) * level / 100) + 5) * NATURE
  137.  
  138.  
  139. # BASE = Base is determined by each stats level 1 parameter in the database,
  140. # higher = more end game stats, lower = less end game stats
  141.  
  142. # NATURE = the nature modifier (settings above) if the actors nature modifies
  143. # these stats
  144.  
  145. # NOTE : pokemon natures do not modify hp and mp, but i have included the option
  146. # for " THE FUCKING LOLz™ "
  147.  
  148. end ## Dekita__Pokémon_Nature
  149.  
  150. $imported = {} if $imported.nil?
  151. $imported[:Dekita_Pokémon_Natures] = true
  152. #################################################################################
  153. #################################################################################
  154. # As team rocket where once again "blasting off" Ash, Brock and Misty slowly #
  155. # lifted their bodies from the ground, turning, gasping at the horror they could#
  156. # see before them... #
  157. #################################################################################
  158. #################### !! DONT MODIFY SHIT AFTER HERE !! ##########################
  159. #################################################################################
  160. module DataManager
  161. #==============================================================================
  162.  
  163. class <<self; alias load_database_Natures load_database; end
  164. def self.load_database
  165. load_database_Natures
  166. load_notetags_Natures
  167. end
  168.  
  169. def self.load_notetags_Natures
  170. groups = [$data_enemies]
  171. for group in groups
  172. for obj in group
  173. next if obj.nil?
  174. obj.load_notetags_Natures
  175. end
  176. end
  177. end
  178.  
  179. end # DataManager
  180.  
  181. #==============================================================================
  182. module BattleManager
  183. #==============================================================================
  184. class <<self; alias battlemanager_display_exp__Natures display_exp; end
  185. def self.display_exp
  186. battlemanager_display_exp__Natures
  187. gain_evs
  188. end
  189.  
  190. def self.gain_evs
  191. mhp_ev_val = $game_troop.mhp_evs_total
  192. mmp_ev_val = $game_troop.mmp_evs_total
  193. atk_ev_val = $game_troop.atk_evs_total
  194. def_ev_val = $game_troop.def_evs_total
  195. mat_ev_val = $game_troop.mat_evs_total
  196. mdf_ev_val = $game_troop.mdf_evs_total
  197. agi_ev_val = $game_troop.agi_evs_total
  198. luk_ev_val = $game_troop.luk_evs_total
  199. for member in $game_party.members
  200. member.gain_evs(0, mhp_ev_val)
  201. member.gain_evs(1, mmp_ev_val)
  202. member.gain_evs(2, atk_ev_val)
  203. member.gain_evs(3, def_ev_val)
  204. member.gain_evs(4, mat_ev_val)
  205. member.gain_evs(5, mdf_ev_val)
  206. member.gain_evs(6, agi_ev_val)
  207. member.gain_evs(7, luk_ev_val)
  208. end
  209. end
  210.  
  211. end # BattleManager
  212.  
  213. #==============================================================================
  214. class RPG::Enemy < RPG::BaseItem
  215. #==============================================================================
  216.  
  217. attr_accessor :dist_evs
  218.  
  219. def load_notetags_Natures
  220. @dist_evs = []
  221. @dist_evs[0] = 0
  222. @dist_evs[1] = 0
  223. @dist_evs[2] = 0
  224. @dist_evs[3] = 0
  225. @dist_evs[4] = 0
  226. @dist_evs[5] = 0
  227. @dist_evs[6] = 0
  228. @dist_evs[7] = 0
  229. self.note.split(/[\r\n]+/).each { |line|
  230. case line
  231. when /<ev: (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*)>/i
  232. p "Reading Enemy EV Notes for #{name}"
  233. @dist_evs[0] = $1.to_i
  234. @dist_evs[1] = $2.to_i
  235. @dist_evs[2] = $3.to_i
  236. @dist_evs[3] = $4.to_i
  237. @dist_evs[4] = $5.to_i
  238. @dist_evs[5] = $6.to_i
  239. @dist_evs[6] = $7.to_i
  240. @dist_evs[7] = $8.to_i
  241. #---
  242. end
  243. } # self.note.split
  244. #---
  245. end
  246.  
  247. end # RPG::Enemy
  248.  
  249. #==============================================================================
  250. class Game_Actor < Game_Battler
  251. #==============================================================================
  252.  
  253. attr_accessor :nature
  254. attr_accessor :init_ivs
  255. attr_accessor :curr_evs
  256.  
  257. alias pokemon_nature_A_GO_GO setup
  258. def setup(actor_id)
  259. @init_ivs = [0] * 8
  260. @curr_evs = [0] * 8
  261. @nature = get_rand_nature
  262. get_init_ivs
  263. get_init_evs
  264. pokemon_nature_A_GO_GO(actor_id)
  265. end
  266.  
  267. def get_init_ivs
  268. 8.times {|i| @init_ivs[i] = rand(31)}
  269. end
  270.  
  271. def get_init_evs
  272. 8.times {|i| @curr_evs[i] = 0}
  273. end
  274.  
  275. def param_base(param_id)
  276. par_id = param_id
  277. case par_id
  278. when 0, 1 # NOTE : if you change these calculations your a fucking moron ! ijs...
  279. return (((@init_ivs[par_id]+2*self.class.params[par_id, 1]+(@curr_evs[par_id]/4))*@level/100)+10+@level)*@nature[par_id+1]
  280. when 2, 3, 4, 5, 6, 7
  281. return (((@init_ivs[par_id]+2*self.class.params[par_id, 1]+(@curr_evs[par_id]/4))*@level/100)+5)*@nature[par_id+1]
  282. end
  283. end
  284.  
  285. def gain_evs(ev_id, value)
  286. tote_ev_val = get_total_ev_count
  287. return if tote_ev_val == max_ev_all_val
  288. if @curr_evs[ev_id] <= max_ev_each_val && value + @curr_evs[ev_id] <= max_ev_each_val
  289. @curr_evs[ev_id] += value if value + tote_ev_val <= max_ev_all_val
  290. else
  291. @curr_evs[ev_id] = max_ev_each_val if value + tote_ev_val <= max_ev_all_val
  292. end
  293. end
  294.  
  295. def max_ev_each_val
  296. return 255
  297. end
  298.  
  299. def max_ev_all_val
  300. return 510
  301. end
  302.  
  303. def get_total_ev_count
  304. val = @curr_evs[0]
  305. val += @curr_evs[1]
  306. val += @curr_evs[2]
  307. val += @curr_evs[3]
  308. val += @curr_evs[4]
  309. val += @curr_evs[5]
  310. val += @curr_evs[6]
  311. val += @curr_evs[7]
  312. return val
  313. end
  314.  
  315. def get_rand_nature
  316. dnar = (Dekita__Pokémon_Nature::Nature.size)
  317. val = rand(dnar)
  318. p "Got nature #{Dekita__Pokémon_Nature::Nature[val][0]}"
  319. return Dekita__Pokémon_Nature::Nature[val]
  320. end
  321.  
  322. end # Game_Actor < Game_Battler
  323.  
  324. #==============================================================================
  325. class Game_Enemy < Game_Battler
  326. #==============================================================================
  327.  
  328. def mhp_evs_from_death
  329. return enemy.dist_evs[0]
  330. end
  331.  
  332. def mmp_evs_from_death
  333. return enemy.dist_evs[1]
  334. end
  335.  
  336. def atk_evs_from_death
  337. return enemy.dist_evs[2]
  338. end
  339.  
  340. def def_evs_from_death
  341. return enemy.dist_evs[3]
  342. end
  343.  
  344. def mat_evs_from_death
  345. return enemy.dist_evs[4]
  346. end
  347.  
  348. def mdf_evs_from_death
  349. return enemy.dist_evs[5]
  350. end
  351.  
  352. def agi_evs_from_death
  353. return enemy.dist_evs[6]
  354. end
  355.  
  356. def luk_evs_from_death
  357. return enemy.dist_evs[7]
  358. end
  359.  
  360. end # Game_Enemy
  361.  
  362. #==============================================================================
  363. class Game_Troop < Game_Unit
  364. #==============================================================================
  365.  
  366. def mhp_evs_total
  367. dead_members.inject(0) {|r, enemy| r += enemy.mhp_evs_from_death }
  368. end
  369.  
  370. def mmp_evs_total
  371. dead_members.inject(0) {|r, enemy| r += enemy.mmp_evs_from_death }
  372. end
  373.  
  374. def atk_evs_total
  375. dead_members.inject(0) {|r, enemy| r += enemy.atk_evs_from_death }
  376. end
  377.  
  378. def def_evs_total
  379. dead_members.inject(0) {|r, enemy| r += enemy.def_evs_from_death }
  380. end
  381.  
  382. def mat_evs_total
  383. dead_members.inject(0) {|r, enemy| r += enemy.mat_evs_from_death }
  384. end
  385.  
  386. def mdf_evs_total
  387. dead_members.inject(0) {|r, enemy| r += enemy.mdf_evs_from_death }
  388. end
  389.  
  390. def agi_evs_total
  391. dead_members.inject(0) {|r, enemy| r += enemy.agi_evs_from_death }
  392. end
  393.  
  394. def luk_evs_total
  395. dead_members.inject(0) {|r, enemy| r += enemy.luk_evs_from_death }
  396. end
  397.  
  398. end # Game_Troop
  399.  
  400. #===============================================================================#
  401. # - SCRIPT END - #
  402. #===============================================================================#
  403. # http://dekitarpg.wordpress.com/ #
  404. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement