Advertisement
Dekita

pnupd

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