Advertisement
Dekita

Refine Script

Oct 10th, 2012
1,387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 131.82 KB | None | 0 0
  1. module Dekita__Refine_Script
  2. =begin =========================================================================
  3. Dekita's v0.9
  4. ★ Perfect Equip Refine System™ ★
  5.  
  6. ================================================================================
  7. Script Information:
  8. ====================
  9.  
  10. NOTE :
  11. This is still a work in progress, i plan on increasing effiency and customisation
  12. options quite a lot, so if you have any ideas for improvements or a bug to report
  13. please let me know.
  14.  
  15. NOTE 2 :
  16. Tsukihime's Custom DataManager script can be used with this script to increase
  17. compatability with other scripts. it is not required.
  18.  
  19. Refining is a method of enhancing your gear by adding bonus stats to it.
  20. After each successful refine the refinement level of the equipment will
  21. increase up to a maximum of +12(default).
  22. Refining equipment adds any stat that you notetag the equipment with.
  23. e.g if you notetagged a piece of equipment like so...
  24. <ref_mhp>
  25. <ref_atk>
  26. <ref_def>
  27. <ref_luk>
  28. when you refined that equipment you would gain MaxHP, Atk, Def and Luk.
  29. equal to the formula (explained below).
  30.  
  31. The only required items to refine a piece of equipment are "Mirage Celestones"
  32. BUT there are also refinement aids that will increase your chances of
  33. successful refinements.
  34. You can select how many mirage celestones are required for each piece of
  35. equipment by putting <req mir: X> in the equipment notebox.
  36. where X is the value you need to refine that equipment item.
  37.  
  38. The higher the upgrade, the more difficult it becomes. Starting from level 1,
  39. your success is not guaranteed. If you fail an upgrade, your item returns to
  40. level 0 unless you use refinement aids which prevent loss (Explained later).
  41.  
  42. ================================================================================
  43. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  44. ================================================================================
  45. 1. You must give credit to "Dekita"
  46. 2. You are NOT allowed to repost this script.(or modified versions)
  47. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  48. 4. You are NOT allowed to use this script for Commercial games.
  49. 5. ENJOY!
  50.  
  51. "FINE PRINT"
  52. By using this script you hereby agree to the above terms and conditions,
  53. if any violation of the above terms occurs "legal action" may be taken.
  54. Not understanding the above terms and conditions does NOT mean that
  55. they do not apply to you.
  56. If you wish to discuss the terms and conditions in further detail you can
  57. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  58.  
  59. ================================================================================
  60. History:
  61. =========
  62. D /M /Y
  63. 08/12/2o12 - Finished,(v0.9)
  64. 20/09/2o12 - Started Script,
  65.  
  66. ================================================================================
  67. Credit and Thanks to :
  68. =======================
  69. Tsukihime - For the custom database script that makes this one more efficient,
  70. and various other help ^_^
  71.  
  72. ================================================================================
  73. Known Bugs:
  74. ============
  75. You will not be able to use conditional branch checks for weapons and armors.
  76. I am working on improving this.
  77.  
  78. If a new bug is found please contact me at
  79. http://dekitarpg.wordpress.com/
  80.  
  81. ================================================================================
  82. INSTRUCTIONS:
  83. ==============
  84. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  85.  
  86. ================================================================================
  87. =end #######################
  88. # CUSTOMISATION BEGIN #
  89. #######################
  90.  
  91. # VOCAB:
  92. Select_Equip = "Select Equip"
  93. S_E_Help_Info = "Select the piece of equipment you wish to refine."
  94.  
  95. Select_Item = "Select Aid"
  96. S_I_Help_Info = "Select Refine Aid"
  97.  
  98. Start_Refine = "Refine"
  99. S_R_Help_Info = "Start the refine process"
  100.  
  101. S_R_Success = "Refine Successfull !"
  102. S_R_Fail = "Refine Failed !"
  103. S_R_Total_Fail = "Your equipment lost all refine !"
  104. S_R_Single_Fail = "Equipment refine level dropped by 1"
  105. S_R_NO_Fail = "Equipment refine level unchanged"
  106.  
  107.  
  108. # for selected equipment info box.
  109. Refine_Symbol = " +"
  110. # for equip screen.
  111. Refine_Symbols = "+%2d"
  112.  
  113. Grade_Symbol = "Grade: "
  114.  
  115.  
  116. # Notetag for equipments mirage requirement
  117. Mirage_Celestone_Req_Note = /<req mir: (.*)>/i
  118.  
  119. # Notetags for equipment's stats to increase upon refine
  120. Refine_MHP_Notetag = /<ref_mhp>/i
  121. Refine_MMP_Notetag = /<ref_mmp>/i
  122. Refine_Atk_Notetag = /<ref_atk>/i
  123. Refine_Def_Notetag = /<ref_def>/i
  124. Refine_Mat_Notetag = /<ref_mat>/i
  125. Refine_Mdf_Notetag = /<ref_mdf>/i
  126. Refine_Agi_Notetag = /<ref_agi>/i
  127. Refine_Luk_Notetag = /<ref_luk>/i
  128.  
  129. # The level of refinement determines the multiple of the base refinement
  130. # bonus you will receive.
  131. # The base refinement value is determined by the equipment grade
  132.  
  133. # <grade: X> X = value .
  134. # e.g <grade: 5>
  135. Equipment_Grade_Notetag = /<grade: (.*)>/i
  136.  
  137. # The refinement bonuses are as follows: (default settings)
  138. ##################################################################
  139. # REFINE LV # BONUS VALUE #=|=# REFINE LV # BONUS VALUE #
  140. # +1 # Grade * 1 #=|=# +7 # Grade * 9.95 #
  141. # +2 # Grade * 2 #=|=# +8 # Grade * 13 #
  142. # +3 # Grade * 3.05 #=|=# +9 # Grade * 17.05 #
  143. # +4 # Grade * 4.3 #=|=# +10 # Grade * 22.03 #
  144. # +5 # Grade * 5.75 #=|=# +11 # Grade * 29 #
  145. # +6 # Grade * 7.55 #=|=# +12 # Grade * 37.5 #
  146. ##################################################################
  147. # Refine Lvl = Bonus Multiplier
  148. Plus_1_Ref_Val = 1.0
  149. Plus_2_Ref_Val = 2.0
  150. Plus_3_Ref_Val = 3.05
  151. Plus_4_Ref_Val = 4.3
  152. Plus_5_Ref_Val = 5.75
  153. Plus_6_Ref_Val = 7.55
  154. Plus_7_Ref_Val = 9.95
  155. Plus_8_Ref_Val = 13.0
  156. Plus_9_Ref_Val = 17.05
  157. Plus_10_Ref_Val = 22.03
  158. Plus_11_Ref_Val = 29.0
  159. Plus_12_Ref_Val = 37.5
  160.  
  161. # The basic chances of refining success are as follows: (default settings)
  162. ##############################################################################
  163. # Refine Level # Mirage Only # Tienkang Stone # Tisha Stone # Chienkun Stone #
  164. # +1 # 50% # 65% # 53.5% # 100% #
  165. # +2 # 30% # 45% # 33.5% # 25% #
  166. # +3 # 30% # 45% # 33.5% # 10% #
  167. # +4 # 30% # 45% # 33.5% # 4% #
  168. # +5 # 30% # 45% # 33.5% # 1.67% #
  169. # +6 # 30% # 45% # 33.5% # 0.77% #
  170. # +7 # 30% # 45% # 33.5% # 0.47% #
  171. # +8 # 30% # 45% # 33.5% # 0.25% #
  172. # +9 # 25% # 40% # 28.5% # 0.13% #
  173. # +10 # 20% # 35% # 23.5% # 0.07% #
  174. # +11 # 12% # 27% # 15.5% # 0.04% #
  175. # +12 # 5% # 20% # 8.5% # 0.02% #
  176. ##############################################################################
  177. # There is also "dragon orbs" that give you 100% success rate (explained later)
  178.  
  179.  
  180. # Mirage Celestone ONLY
  181. # If refining fails, the item loses all previous refining and reverts back to +0.
  182.  
  183. # If you want mirages to show in the refine aid list give it this notetag.
  184. Mirage_Celestone_Note = /<mirage>/i
  185.  
  186. # Database ID for Mirage Celestones
  187. Mirage_Celestone_ID = 1
  188.  
  189. # Success Rate's
  190. Plus_1_Mir_Val = 0.50
  191. Plus_2_Mir_Val = 0.30
  192. Plus_3_Mir_Val = 0.30
  193. Plus_4_Mir_Val = 0.30
  194. Plus_5_Mir_Val = 0.30
  195. Plus_6_Mir_Val = 0.30
  196. Plus_7_Mir_Val = 0.30
  197. Plus_8_Mir_Val = 0.30
  198. Plus_9_Mir_Val = 0.25
  199. Plus_10_Mir_Val = 0.20
  200. Plus_11_Mir_Val = 0.12
  201. Plus_12_Mir_Val = 0.05
  202.  
  203.  
  204. # Mirage Celestone AND Teinkang Stones
  205. # Teinkang Stones boost the chances of success.
  206. # If refining fails, the item loses all previous refining and reverts back to +0.
  207.  
  208. # Notetag for tienkang stones
  209. Tienkang_Stone_Note = /<tienkang>/i
  210.  
  211. # Success Rate's
  212. Plus_1_Tein_Val = 0.65
  213. Plus_2_Tein_Val = 0.45
  214. Plus_3_Tein_Val = 0.45
  215. Plus_4_Tein_Val = 0.45
  216. Plus_5_Tein_Val = 0.45
  217. Plus_6_Tein_Val = 0.45
  218. Plus_7_Tein_Val = 0.45
  219. Plus_8_Tein_Val = 0.45
  220. Plus_9_Tein_Val = 0.40
  221. Plus_10_Tein_Val = 0.35
  222. Plus_11_Tein_Val = 0.27
  223. Plus_12_Tein_Val = 0.20
  224.  
  225.  
  226. # Mirage Celestone AND Tisha Stones
  227. # Tisha Stones boost the chance of success AND prevent the item from
  228. # dropping more than 1 refining level if refining fails.
  229.  
  230. # Notetag for tisha stones
  231. Tisha_Stone_Note = /<tisha>/i
  232.  
  233. # Success Rate's
  234. Plus_1_Tish_Val = 0.535
  235. Plus_2_Tish_Val = 0.335
  236. Plus_3_Tish_Val = 0.335
  237. Plus_4_Tish_Val = 0.335
  238. Plus_5_Tish_Val = 0.335
  239. Plus_6_Tish_Val = 0.335
  240. Plus_7_Tish_Val = 0.335
  241. Plus_8_Tish_Val = 0.335
  242. Plus_9_Tish_Val = 0.285
  243. Plus_10_Tish_Val = 0.235
  244. Plus_11_Tish_Val = 0.155
  245. Plus_12_Tish_Val = 0.085
  246.  
  247. # Mirage Celestone AND Chienkun Stones
  248. # Chienkun Stones LOWER the chance of success (except refine to lv 1)
  249. # AND prevent the item from dropping ANY level at all with failure.
  250.  
  251. # Notetag for Chienkun stones
  252. Chienkun_Stone_Note = /<chienkun>/i
  253.  
  254. # Success Rate's
  255. Plus_1_CKun_Val = 1.00 # 1.00 = 100% success
  256. Plus_2_CKun_Val = 0.25
  257. Plus_3_CKun_Val = 0.10
  258. Plus_4_CKun_Val = 0.04
  259. Plus_5_CKun_Val = 0.0167
  260. Plus_6_CKun_Val = 0.0077
  261. Plus_7_CKun_Val = 0.0047
  262. Plus_8_CKun_Val = 0.0025
  263. Plus_9_CKun_Val = 0.0013
  264. Plus_10_CKun_Val = 0.0007
  265. Plus_11_CKun_Val = 0.0004
  266. Plus_12_CKun_Val = 0.0002
  267.  
  268.  
  269. # Mirage Celestone AND Dragon Orb
  270. # Dragon Orbs Guarantee successfull refine as long as the equipments current
  271. # refine level is lower than the dragon orb level.
  272.  
  273. # <dorb: X>
  274. # replace X with a value between 1 - 12
  275. Dragon_Orb_Note = /<dorb: (.*)>/i
  276.  
  277. # NOTE: you cannot set this higher than 12, only lower(if you want).
  278. Max_Refine = 12
  279.  
  280. Wait_Time = 60
  281. end # Dekita__Refine_Script
  282. #####################
  283. # CUSTOMISATION END #
  284. #####################
  285. #===============================================================================#
  286. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  287. # YES?\.\. #
  288. # OMG, REALLY? #
  289. # WELL SLAP MY FACE AND CALL ME A DRAGON.\..\.. #
  290. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  291. #===============================================================================#
  292. module Dekita__Refine_Script
  293.  
  294. COMMANDS =[
  295. [:sel_eqp, "Equips"],
  296. [:sel_itm, "Aids"],
  297. [:ref_str, "Refine"],
  298. # [:exit, "Quit Scene"],
  299. ]#DO NOT REMOVE
  300.  
  301. Refine_Info =[ # // Dont Delete This.
  302. [:refine_equip, "Chosen Equipment :"],
  303. [:blank, " "],
  304. [:blank, " "],
  305. [:blank, " "],
  306. [:refine_aid, "Refine Aid :"],
  307. [:blank, " "],
  308. [:mirage_cost, "Mirage Cost :"],
  309. ] # Do not remove this.
  310.  
  311. Item_Refine_Info =[ # // Dont Delete This.
  312. [:blank, " "],
  313. [:blank, " "],
  314. [:blank, " "],
  315. [:blank, " "],
  316. [:blank, " "],
  317. [:blank, " "],
  318. [:blank, " "],
  319. ] # Do not remove this.
  320.  
  321. end # module
  322.  
  323. $imported = {} if $imported.nil?
  324. $imported["DPB-WCB"] = true
  325.  
  326. #==============================================================================
  327. class Object
  328. #==============================================================================
  329.  
  330. def dup!
  331. Marshal.load(Marshal.dump(self))
  332. end
  333.  
  334. end
  335.  
  336. #==============================================================================
  337. module DataManager
  338. #==============================================================================
  339. if !$imported["Tsuki_CustomDataManager"]
  340.  
  341. def self.save_game_without_rescue(index)
  342. File.open(make_filename(index), "wb") do |file|
  343. $game_system.on_before_save
  344. Marshal.dump(make_save_header, file)
  345. Marshal.dump(make_save_contents, file)
  346. Marshal.dump($data_weapons, file)
  347. Marshal.dump($data_armors, file)
  348. @last_savefile_index = index
  349. end
  350. return true
  351. end
  352.  
  353. def self.load_game_without_rescue(index)
  354. File.open(make_filename(index), "rb") do |file|
  355. Marshal.load(file)
  356. extract_save_contents(Marshal.load(file))
  357. $data_weapons = Marshal.load(file)
  358. $data_armors = Marshal.load(file)
  359. reload_map_if_updated
  360. @last_savefile_index = index
  361. end
  362. return true
  363. end
  364.  
  365. end # if $imported["Tsuki_CustomDataManager"]
  366.  
  367.  
  368. class <<self; alias load_database_refine_level load_database; end
  369. def self.load_database
  370. load_database_refine_level
  371. load_notetags_refine_level
  372. end
  373.  
  374. def self.load_notetags_refine_level
  375. groups = [$data_weapons, $data_armors, $data_items]
  376. for group in groups
  377. for obj in group
  378. next if obj.nil?
  379. obj.load_notetags_refine_level
  380. end
  381. end
  382. end
  383.  
  384. end # DataManager
  385.  
  386. #==============================================================================
  387. module Dekita_Refine_Script
  388. #==============================================================================
  389.  
  390. def self.copy_weapon(from_item)
  391. new_item = from_item.dup!
  392. make_new_copy(new_item, from_item)
  393. id = self.gain_weapon_id($data_weapons)
  394. if id.nil?
  395. new_item.id = $data_weapons.size
  396. $custom_weapons.push(new_item) if $imported["Tsuki_CustomDataManager"]
  397. $data_weapons.push(new_item)
  398. print "new weapon id #{new_item.id}\n"
  399. print "weapon array size #{$data_weapons.size}\n"
  400. print "Custom weapon array size #{$custom_weapons.size}\n" if $imported["Tsuki_CustomDataManager"]
  401. else
  402. new_item.id = id
  403. $data_weapons[id] = new_item
  404. end
  405. return new_item
  406. end
  407.  
  408. def self.copy_armor(from_item)
  409. new_item = from_item.dup!
  410. make_new_copy(new_item, from_item)
  411. id = self.gain_armor_id($data_armors)
  412. if id.nil?
  413. new_item.id = $data_armors.size
  414. $custom_armors.push(new_item) if $imported["Tsuki_CustomDataManager"]
  415. $data_armors.push(new_item)
  416. print "new armor id #{new_item.id}\n"
  417. print "armor array size #{$data_armors.size}\n"
  418. print "Custom armor array size #{$custom_armors.size}\n" if $imported["Tsuki_CustomDataManager"]
  419. else
  420. new_item.id = id
  421. $data_armors[id] = new_item
  422. end
  423. return new_item
  424. end
  425.  
  426. def self.gain_weapon_id(database)
  427. id = 1
  428. for i in 1...database.size
  429. weapon = database[i]
  430. if weapon.nil?
  431. print id
  432. return id
  433. end
  434. id += 1
  435. end
  436. return nil
  437. end
  438.  
  439. def self.gain_armor_id(database)
  440. id = 1
  441. for i in 1...database.size
  442. armor = database[i]
  443. if armor.nil?
  444. print id
  445. return id
  446. end
  447. id += 1
  448. end
  449. return nil
  450. end
  451.  
  452. def self.make_new_copy(new_item, from_item)
  453. new_item.params = from_item.params.dup!
  454. new_item.features = from_item.features.dup!
  455. new_item.xparams = from_item.xparams.dup! if $imported["DPB-PSPDS"]
  456. new_item.sparams = from_item.sparams.dup! if $imported["DPB-PSPDS"]
  457. new_item.dpbzparams = from_item.dpbzparams.dup! if $imported["DPB-PSPDS"]
  458. new_item.dpbzformulazS = from_item.dpbzformulazS.dup! if $imported["DPB-ATLANDDFL"]
  459. new_item.pwistyles = from_item.pwistyles.dup! if $imported["DPB-SoulForce"]
  460. end
  461.  
  462. end # module
  463.  
  464. #==============================================================================
  465. class RPG::Item < RPG::UsableItem
  466. #==============================================================================
  467. include Dekita__Refine_Script
  468.  
  469. attr_accessor :mirage_celestone
  470. attr_accessor :tienkang_stone
  471. attr_accessor :tisha_stone
  472. attr_accessor :chienkun_stone
  473. attr_accessor :dragon_orb
  474. attr_accessor :refine_item
  475. attr_accessor :dpbz_epik_refinez_id_fs_Fs_Fs_fs
  476.  
  477. def load_notetags_refine_level
  478. @refine_item = false
  479. @mirage_celestone = false
  480. @tienkang_stone = false
  481. @tisha_stone = false
  482. @chienkun_stone = false
  483. @dragon_orb = 0
  484. @dpbz_epik_refinez_id_fs_Fs_Fs_fs = nil
  485. self.note.split(/[\r\n]+/).each { |line|
  486. case line
  487. when Mirage_Celestone_Note
  488. @mirage_celestone = true
  489. @refine_item = true
  490. when Tienkang_Stone_Note
  491. @tienkang_stone = true
  492. @refine_item = true
  493. when Tisha_Stone_Note
  494. @tisha_stone = true
  495. @refine_item = true
  496. when Chienkun_Stone_Note
  497. @chienkun_stone = true
  498. @refine_item = true
  499. when Dragon_Orb_Note
  500. @dragon_orb = $1.to_i
  501. @refine_item = true
  502. end
  503. } # self.note.split
  504. end
  505.  
  506.  
  507. end # RPG::Item < RPG::UsableItem
  508.  
  509. #==============================================================================
  510. class RPG::EquipItem < RPG::BaseItem
  511. #==============================================================================
  512. include Dekita__Refine_Script
  513.  
  514. attr_accessor :mirage_celestone_req
  515. attr_accessor :refine_mhp
  516. attr_accessor :refine_mmp
  517. attr_accessor :refine_atk
  518. attr_accessor :refine_def
  519. attr_accessor :refine_mat
  520. attr_accessor :refine_mdf
  521. attr_accessor :refine_agi
  522. attr_accessor :refine_luk
  523. attr_accessor :refine_level
  524. attr_accessor :equipment_grade
  525. attr_accessor :times_modified
  526.  
  527. def load_notetags_refine_level
  528. @mirage_celestone_req = 0
  529. @equipment_grade = 0
  530. @times_modified = 0
  531. @refine_level = 0
  532. @refine_mhp = false
  533. @refine_mmp = false
  534. @refine_atk = false
  535. @refine_def = false
  536. @refine_mat = false
  537. @refine_mdf = false
  538. @refine_agi = false
  539. @refine_luk = false
  540. @refine_eva = false
  541. self.note.split(/[\r\n]+/).each { |line|
  542. case line
  543. when Mirage_Celestone_Req_Note
  544. @mirage_celestone_req = $1.to_i
  545. when Equipment_Grade_Notetag
  546. @equipment_grade = $1.to_i
  547. when Refine_MHP_Notetag
  548. @refine_mhp = true
  549. when Refine_MMP_Notetag
  550. @refine_mmp = true
  551. when Refine_Atk_Notetag
  552. @refine_atk = true
  553. when Refine_Def_Notetag
  554. @refine_def = true
  555. when Refine_Mat_Notetag
  556. @refine_mat = true
  557. when Refine_Mdf_Notetag
  558. @refine_mdf = true
  559. when Refine_Agi_Notetag
  560. @refine_agi = true
  561. when Refine_Luk_Notetag
  562. @refine_luk = true
  563. end
  564. } # self.note.split
  565. end
  566.  
  567. def max_refine
  568. return Max_Refine
  569. end
  570.  
  571. def refine_level_up(item)
  572. @refine_level += 1
  573. end
  574.  
  575. def refine_level_down(item)
  576. health_loss(item) if item.refine_mhp
  577. mana_loss(item) if item.refine_mmp
  578. attack_loss(item) if item.refine_atk
  579. defence_loss(item) if item.refine_def
  580. magic_loss(item) if item.refine_mat
  581. magic_def_loss(item) if item.refine_mdf
  582. agility_loss(item) if item.refine_agi
  583. luck_loss(item) if item.refine_luk
  584. item.refine_level -= 1
  585. end
  586.  
  587. def refine_fail(item)
  588. health_fail(item) if item.refine_mhp
  589. mana_fail(item) if item.refine_mmp
  590. attack_fail(item) if item.refine_atk
  591. defence_fail(item) if item.refine_def
  592. magic_fail(item) if item.refine_mat
  593. magic_def_fail(item) if item.refine_mdf
  594. agility_fail(item) if item.refine_agi
  595. luck_fail(item) if item.refine_luk
  596. @refine_level = 0
  597. end
  598.  
  599. def determine_refine_bonus(item)
  600. return if item.refine_level == item.max_refine
  601. health_refine(item) if item.refine_mhp
  602. mana_refine(item) if item.refine_mmp
  603. attack_refine(item) if item.refine_atk
  604. defence_refine(item) if item.refine_def
  605. magic_refine(item) if item.refine_mat
  606. magic_def_refine(item) if item.refine_mdf
  607. agility_refine(item) if item.refine_agi
  608. luck_refine(item) if item.refine_luk
  609. refine_level_up(item)
  610. end
  611.  
  612. def health_refine(item)
  613. if @refine_level == 0
  614. item.params[0] += (item.equipment_grade * Plus_1_Ref_Val).to_i
  615. elsif @refine_level == 1
  616. item.params[0] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  617. elsif @refine_level == 2
  618. item.params[0] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  619. elsif @refine_level == 3
  620. item.params[0] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  621. elsif @refine_level == 4
  622. item.params[0] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  623. elsif @refine_level == 5
  624. item.params[0] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  625. elsif @refine_level == 6
  626. item.params[0] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  627. elsif @refine_level == 7
  628. item.params[0] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  629. elsif @refine_level == 8
  630. item.params[0] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  631. elsif @refine_level == 9
  632. item.params[0] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  633. elsif @refine_level == 10
  634. item.params[0] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  635. elsif @refine_level == 11
  636. item.params[0] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  637. end
  638. end
  639.  
  640. def health_loss(item)
  641. if @refine_level == 0
  642. elsif @refine_level == 1
  643. item.params[0] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  644. elsif @refine_level == 2
  645. item.params[0] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  646. elsif @refine_level == 3
  647. item.params[0] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  648. elsif @refine_level == 4
  649. item.params[0] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  650. elsif @refine_level == 5
  651. item.params[0] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  652. elsif @refine_level == 6
  653. item.params[0] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  654. elsif @refine_level == 7
  655. item.params[0] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  656. elsif @refine_level == 8
  657. item.params[0] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  658. elsif @refine_level == 9
  659. item.params[0] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  660. elsif @refine_level == 10
  661. item.params[0] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  662. elsif @refine_level == 11
  663. item.params[0] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  664. end
  665. end
  666.  
  667. def health_fail(item)
  668. index = 0
  669. if @refine_level == 0
  670. elsif @refine_level == 1
  671. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  672. elsif @refine_level == 2
  673. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  674. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  675. elsif @refine_level == 3
  676. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  677. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  678. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  679. elsif @refine_level == 4
  680. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  681. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  682. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  683. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  684. elsif @refine_level == 5
  685. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  686. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  687. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  688. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  689. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  690. elsif @refine_level == 6
  691. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  692. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  693. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  694. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  695. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  696. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  697. elsif @refine_level == 7
  698. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  699. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  700. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  701. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  702. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  703. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  704. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  705. elsif @refine_level == 8
  706. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  707. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  708. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  709. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  710. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  711. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  712. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  713. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  714. elsif @refine_level == 9
  715. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  716. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  717. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  718. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  719. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  720. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  721. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  722. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  723. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  724. elsif @refine_level == 10
  725. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  726. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  727. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  728. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  729. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  730. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  731. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  732. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  733. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  734. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  735. elsif @refine_level == 11
  736. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  737. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  738. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  739. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  740. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  741. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  742. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  743. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  744. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  745. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  746. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  747. end
  748. end
  749.  
  750. def mana_refine(item)
  751. if @refine_level == 0
  752. item.params[1] += (item.equipment_grade * Plus_1_Ref_Val).to_i
  753. elsif @refine_level == 1
  754. item.params[1] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  755. elsif @refine_level == 2
  756. item.params[1] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  757. elsif @refine_level == 3
  758. item.params[1] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  759. elsif @refine_level == 4
  760. item.params[1] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  761. elsif @refine_level == 5
  762. item.params[1] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  763. elsif @refine_level == 6
  764. item.params[1] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  765. elsif @refine_level == 7
  766. item.params[1] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  767. elsif @refine_level == 8
  768. item.params[1] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  769. elsif @refine_level == 9
  770. item.params[1] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  771. elsif @refine_level == 10
  772. item.params[1] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  773. elsif @refine_level == 11
  774. item.params[1] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  775. end
  776. end
  777.  
  778. def mana_loss(item)
  779. if @refine_level == 0
  780. elsif @refine_level == 1
  781. item.params[1] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  782. elsif @refine_level == 2
  783. item.params[1] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  784. elsif @refine_level == 3
  785. item.params[1] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  786. elsif @refine_level == 4
  787. item.params[1] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  788. elsif @refine_level == 5
  789. item.params[1] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  790. elsif @refine_level == 6
  791. item.params[1] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  792. elsif @refine_level == 7
  793. item.params[1] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  794. elsif @refine_level == 8
  795. item.params[1] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  796. elsif @refine_level == 9
  797. item.params[1] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  798. elsif @refine_level == 10
  799. item.params[1] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  800. elsif @refine_level == 11
  801. item.params[1] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  802. end
  803. end
  804.  
  805. def mana_fail(item)
  806. index = 1
  807. if item.refine_level == 0
  808. elsif item.refine_level == 1
  809. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  810. elsif item.refine_level == 2
  811. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  812. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  813. elsif item.refine_level == 3
  814. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  815. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  816. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  817. elsif item.refine_level == 4
  818. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  819. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  820. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  821. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  822. elsif item.refine_level == 5
  823. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  824. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  825. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  826. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  827. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  828. elsif item.refine_level == 6
  829. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  830. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  831. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  832. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  833. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  834. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  835. elsif item.refine_level == 7
  836. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  837. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  838. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  839. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  840. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  841. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  842. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  843. elsif @refine_level == 8
  844. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  845. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  846. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  847. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  848. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  849. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  850. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  851. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  852. elsif @refine_level == 9
  853. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  854. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  855. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  856. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  857. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  858. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  859. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  860. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  861. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  862. elsif @refine_level == 10
  863. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  864. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  865. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  866. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  867. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  868. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  869. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  870. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  871. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  872. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  873. elsif @refine_level == 11
  874. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  875. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  876. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  877. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  878. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  879. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  880. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  881. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  882. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  883. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  884. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  885. end
  886. end
  887.  
  888. def attack_refine(item)
  889. if @refine_level == 0
  890. item.params[2] += item.equipment_grade * Plus_1_Ref_Val
  891. elsif @refine_level == 1
  892. item.params[2] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  893. elsif @refine_level == 2
  894. item.params[2] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  895. elsif @refine_level == 3
  896. item.params[2] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  897. elsif @refine_level == 4
  898. item.params[2] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  899. elsif @refine_level == 5
  900. item.params[2] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  901. elsif @refine_level == 6
  902. item.params[2] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  903. elsif @refine_level == 7
  904. item.params[2] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  905. elsif @refine_level == 8
  906. item.params[2] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  907. elsif @refine_level == 9
  908. item.params[2] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  909. elsif @refine_level == 10
  910. item.params[2] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  911. elsif @refine_level == 11
  912. item.params[2] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  913. end
  914. end
  915.  
  916. def attack_loss(item)
  917. if @refine_level == 0
  918. elsif @refine_level == 1
  919. item.params[2] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  920. elsif @refine_level == 2
  921. item.params[2] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  922. elsif @refine_level == 3
  923. item.params[2] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  924. elsif @refine_level == 4
  925. item.params[2] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  926. elsif @refine_level == 5
  927. item.params[2] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  928. elsif @refine_level == 6
  929. item.params[2] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  930. elsif @refine_level == 7
  931. item.params[2] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  932. elsif @refine_level == 8
  933. item.params[2] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  934. elsif @refine_level == 9
  935. item.params[2] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  936. elsif @refine_level == 10
  937. item.params[2] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  938. elsif @refine_level == 11
  939. item.params[2] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  940. end
  941. end
  942.  
  943. def attack_fail(item)
  944. index = 2
  945. if @refine_level == 0
  946. elsif @refine_level == 1
  947. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  948. elsif @refine_level == 2
  949. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  950. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  951. elsif @refine_level == 3
  952. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  953. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  954. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  955. elsif @refine_level == 4
  956. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  957. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  958. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  959. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  960. elsif @refine_level == 5
  961. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  962. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  963. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  964. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  965. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  966. elsif @refine_level == 6
  967. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  968. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  969. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  970. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  971. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  972. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  973. elsif @refine_level == 7
  974. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  975. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  976. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  977. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  978. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  979. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  980. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  981. elsif @refine_level == 8
  982. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  983. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  984. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  985. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  986. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  987. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  988. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  989. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  990. elsif @refine_level == 9
  991. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  992. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  993. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  994. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  995. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  996. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  997. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  998. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  999. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1000. elsif @refine_level == 10
  1001. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1002. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1003. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1004. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1005. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1006. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1007. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1008. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1009. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1010. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1011. elsif @refine_level == 11
  1012. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1013. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1014. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1015. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1016. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1017. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1018. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1019. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1020. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1021. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1022. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1023. end
  1024. end
  1025.  
  1026. def defence_refine(item)
  1027. if @refine_level == 0
  1028. item.params[3] += item.equipment_grade * Plus_1_Ref_Val
  1029. elsif @refine_level == 1
  1030. item.params[3] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1031. elsif @refine_level == 2
  1032. item.params[3] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1033. elsif @refine_level == 3
  1034. item.params[3] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1035. elsif @refine_level == 4
  1036. item.params[3] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1037. elsif @refine_level == 5
  1038. item.params[3] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1039. elsif @refine_level == 6
  1040. item.params[3] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1041. elsif @refine_level == 7
  1042. item.params[3] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1043. elsif @refine_level == 8
  1044. item.params[3] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1045. elsif @refine_level == 9
  1046. item.params[3] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1047. elsif @refine_level == 10
  1048. item.params[3] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1049. elsif @refine_level == 11
  1050. item.params[3] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  1051. end
  1052. end
  1053.  
  1054. def defence_loss(item)
  1055. if @refine_level == 0
  1056. elsif @refine_level == 1
  1057. item.params[3] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1058. elsif @refine_level == 2
  1059. item.params[3] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1060. elsif @refine_level == 3
  1061. item.params[3] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1062. elsif @refine_level == 4
  1063. item.params[3] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1064. elsif @refine_level == 5
  1065. item.params[3] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1066. elsif @refine_level == 6
  1067. item.params[3] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1068. elsif @refine_level == 7
  1069. item.params[3] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1070. elsif @refine_level == 8
  1071. item.params[3] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1072. elsif @refine_level == 9
  1073. item.params[3] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1074. elsif @refine_level == 10
  1075. item.params[3] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1076. elsif @refine_level == 11
  1077. item.params[3] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1078. end
  1079. end
  1080.  
  1081. def defence_fail(item)
  1082. index = 3
  1083. if @refine_level == 0
  1084. elsif @refine_level == 1
  1085. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1086. elsif @refine_level == 2
  1087. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1088. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1089. elsif @refine_level == 3
  1090. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1091. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1092. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1093. elsif @refine_level == 4
  1094. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1095. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1096. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1097. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1098. elsif @refine_level == 5
  1099. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1100. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1101. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1102. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1103. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1104. elsif @refine_level == 6
  1105. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1106. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1107. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1108. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1109. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1110. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1111. elsif @refine_level == 7
  1112. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1113. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1114. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1115. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1116. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1117. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1118. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1119. elsif @refine_level == 8
  1120. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1121. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1122. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1123. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1124. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1125. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1126. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1127. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1128. elsif @refine_level == 9
  1129. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1130. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1131. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1132. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1133. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1134. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1135. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1136. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1137. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1138. elsif @refine_level == 10
  1139. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1140. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1141. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1142. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1143. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1144. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1145. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1146. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1147. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1148. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1149. elsif @refine_level == 11
  1150. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1151. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1152. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1153. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1154. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1155. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1156. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1157. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1158. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1159. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1160. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1161. end
  1162. end
  1163.  
  1164. def magic_refine(item)
  1165. if @refine_level == 0
  1166. item.params[4] += item.equipment_grade * Plus_1_Ref_Val
  1167. elsif @refine_level == 1
  1168. item.params[4] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1169. elsif @refine_level == 2
  1170. item.params[4] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1171. elsif @refine_level == 3
  1172. item.params[4] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1173. elsif @refine_level == 4
  1174. item.params[4] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1175. elsif @refine_level == 5
  1176. item.params[4] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1177. elsif @refine_level == 6
  1178. item.params[4] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1179. elsif @refine_level == 7
  1180. item.params[4] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1181. elsif @refine_level == 8
  1182. item.params[4] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1183. elsif @refine_level == 9
  1184. item.params[4] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1185. elsif @refine_level == 10
  1186. item.params[4] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1187. elsif @refine_level == 11
  1188. item.params[4] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  1189. end
  1190. end
  1191.  
  1192. def magic_loss(item)
  1193. if @refine_level == 0
  1194. elsif @refine_level == 1
  1195. item.params[4] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1196. elsif @refine_level == 2
  1197. item.params[4] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1198. elsif @refine_level == 3
  1199. item.params[4] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1200. elsif @refine_level == 4
  1201. item.params[4] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1202. elsif @refine_level == 5
  1203. item.params[4] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1204. elsif @refine_level == 6
  1205. item.params[4] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1206. elsif @refine_level == 7
  1207. item.params[4] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1208. elsif @refine_level == 8
  1209. item.params[4] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1210. elsif @refine_level == 9
  1211. item.params[4] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1212. elsif @refine_level == 10
  1213. item.params[4] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1214. elsif @refine_level == 11
  1215. item.params[4] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1216. end
  1217. end
  1218.  
  1219. def magic_fail(item)
  1220. index = 4
  1221. if @refine_level == 4
  1222. elsif @refine_level == 1
  1223. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1224. elsif @refine_level == 2
  1225. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1226. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1227. elsif @refine_level == 3
  1228. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1229. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1230. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1231. elsif @refine_level == 4
  1232. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1233. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1234. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1235. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1236. elsif @refine_level == 5
  1237. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1238. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1239. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1240. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1241. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1242. elsif @refine_level == 6
  1243. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1244. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1245. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1246. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1247. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1248. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1249. elsif @refine_level == 7
  1250. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1251. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1252. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1253. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1254. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1255. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1256. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1257. elsif @refine_level == 8
  1258. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1259. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1260. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1261. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1262. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1263. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1264. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1265. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1266. elsif @refine_level == 9
  1267. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1268. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1269. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1270. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1271. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1272. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1273. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1274. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1275. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1276. elsif @refine_level == 10
  1277. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1278. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1279. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1280. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1281. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1282. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1283. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1284. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1285. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1286. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1287. elsif @refine_level == 11
  1288. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1289. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1290. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1291. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1292. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1293. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1294. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1295. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1296. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1297. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1298. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1299. end
  1300. end
  1301.  
  1302. def magic_def_refine(item)
  1303. if @refine_level == 0
  1304. item.params[5] += item.equipment_grade * Plus_1_Ref_Val
  1305. elsif @refine_level == 1
  1306. item.params[5] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1307. elsif @refine_level == 2
  1308. item.params[5] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1309. elsif @refine_level == 3
  1310. item.params[5] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1311. elsif @refine_level == 4
  1312. item.params[5] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1313. elsif @refine_level == 5
  1314. item.params[5] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1315. elsif @refine_level == 6
  1316. item.params[5] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1317. elsif @refine_level == 7
  1318. item.params[5] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1319. elsif @refine_level == 8
  1320. item.params[5] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1321. elsif @refine_level == 9
  1322. item.params[5] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1323. elsif @refine_level == 10
  1324. item.params[5] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1325. elsif @refine_level == 11
  1326. item.params[5] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  1327. end
  1328. end
  1329.  
  1330. def magic_def_loss(item)
  1331. if @refine_level == 0
  1332. elsif @refine_level == 1
  1333. item.params[5] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1334. elsif @refine_level == 2
  1335. item.params[5] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1336. elsif @refine_level == 3
  1337. item.params[5] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1338. elsif @refine_level == 4
  1339. item.params[5] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1340. elsif @refine_level == 5
  1341. item.params[5] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1342. elsif @refine_level == 6
  1343. item.params[5] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1344. elsif @refine_level == 7
  1345. item.params[5] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1346. elsif @refine_level == 8
  1347. item.params[5] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1348. elsif @refine_level == 9
  1349. item.params[5] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1350. elsif @refine_level == 10
  1351. item.params[5] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1352. elsif @refine_level == 11
  1353. item.params[5] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1354. end
  1355. end
  1356.  
  1357. def magic_def_fail(item)
  1358. index = 5
  1359. if @refine_level == 0
  1360. elsif @refine_level == 1
  1361. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1362. elsif @refine_level == 2
  1363. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1364. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1365. elsif @refine_level == 3
  1366. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1367. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1368. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1369. elsif @refine_level == 4
  1370. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1371. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1372. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1373. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1374. elsif @refine_level == 5
  1375. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1376. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1377. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1378. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1379. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1380. elsif @refine_level == 6
  1381. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1382. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1383. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1384. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1385. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1386. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1387. elsif @refine_level == 7
  1388. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1389. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1390. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1391. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1392. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1393. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1394. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1395. elsif @refine_level == 8
  1396. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1397. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1398. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1399. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1400. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1401. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1402. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1403. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1404. elsif @refine_level == 9
  1405. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1406. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1407. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1408. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1409. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1410. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1411. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1412. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1413. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1414. elsif @refine_level == 10
  1415. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1416. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1417. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1418. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1419. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1420. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1421. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1422. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1423. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1424. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1425. elsif @refine_level == 11
  1426. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1427. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1428. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1429. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1430. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1431. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1432. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1433. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1434. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1435. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1436. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1437. end
  1438. end
  1439.  
  1440. def agility_refine(item)
  1441. if @refine_level == 0
  1442. item.params[6] += item.equipment_grade * Plus_1_Ref_Val
  1443. elsif @refine_level == 1
  1444. item.params[6] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1445. elsif @refine_level == 2
  1446. item.params[6] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1447. elsif @refine_level == 3
  1448. item.params[6] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1449. elsif @refine_level == 4
  1450. item.params[6] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1451. elsif @refine_level == 5
  1452. item.params[6] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1453. elsif @refine_level == 6
  1454. item.params[6] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1455. elsif @refine_level == 7
  1456. item.params[6] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1457. elsif @refine_level == 8
  1458. item.params[6] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1459. elsif @refine_level == 9
  1460. item.params[6] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1461. elsif @refine_level == 10
  1462. item.params[6] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1463. elsif @refine_level == 11
  1464. item.params[6] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  1465. end
  1466. end
  1467.  
  1468. def agility_loss(item)
  1469. if @refine_level == 0
  1470. elsif @refine_level == 1
  1471. item.params[6] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1472. elsif @refine_level == 2
  1473. item.params[6] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1474. elsif @refine_level == 3
  1475. item.params[6] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1476. elsif @refine_level == 4
  1477. item.params[6] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1478. elsif @refine_level == 5
  1479. item.params[6] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1480. elsif @refine_level == 6
  1481. item.params[6] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1482. elsif @refine_level == 7
  1483. item.params[6] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1484. elsif @refine_level == 8
  1485. item.params[6] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1486. elsif @refine_level == 9
  1487. item.params[6] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1488. elsif @refine_level == 10
  1489. item.params[6] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1490. elsif @refine_level == 11
  1491. item.params[6] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1492. end
  1493. end
  1494.  
  1495. def agility_fail(item)
  1496. index = 6
  1497. if @refine_level == 0
  1498. elsif @refine_level == 1
  1499. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1500. elsif @refine_level == 2
  1501. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1502. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1503. elsif @refine_level == 3
  1504. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1505. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1506. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1507. elsif @refine_level == 4
  1508. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1509. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1510. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1511. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1512. elsif @refine_level == 5
  1513. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1514. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1515. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1516. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1517. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1518. elsif @refine_level == 6
  1519. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1520. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1521. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1522. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1523. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1524. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1525. elsif @refine_level == 7
  1526. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1527. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1528. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1529. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1530. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1531. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1532. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1533. elsif @refine_level == 8
  1534. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1535. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1536. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1537. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1538. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1539. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1540. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1541. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1542. elsif @refine_level == 9
  1543. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1544. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1545. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1546. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1547. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1548. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1549. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1550. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1551. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1552. elsif @refine_level == 10
  1553. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1554. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1555. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1556. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1557. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1558. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1559. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1560. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1561. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1562. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1563. elsif @refine_level == 11
  1564. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1565. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1566. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1567. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1568. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1569. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1570. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1571. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1572. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1573. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1574. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1575. end
  1576. end
  1577.  
  1578. def luck_refine(item)
  1579. if @refine_level == 0
  1580. item.params[7] += item.equipment_grade * Plus_1_Ref_Val
  1581. elsif @refine_level == 1
  1582. item.params[7] += (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1583. elsif @refine_level == 2
  1584. item.params[7] += (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1585. elsif @refine_level == 3
  1586. item.params[7] += (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1587. elsif @refine_level == 4
  1588. item.params[7] += (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1589. elsif @refine_level == 5
  1590. item.params[7] += (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1591. elsif @refine_level == 6
  1592. item.params[7] += (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1593. elsif @refine_level == 7
  1594. item.params[7] += (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1595. elsif @refine_level == 8
  1596. item.params[7] += (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1597. elsif @refine_level == 9
  1598. item.params[7] += (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1599. elsif @refine_level == 10
  1600. item.params[7] += (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1601. elsif @refine_level == 11
  1602. item.params[7] += (item.equipment_grade * Plus_12_Ref_Val - (item.equipment_grade)).to_i
  1603. end
  1604. end
  1605.  
  1606. def luck_loss(item)
  1607. if @refine_level == 0
  1608. elsif @refine_level == 1
  1609. item.params[7] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1610. elsif @refine_level == 2
  1611. item.params[7] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1612. elsif @refine_level == 3
  1613. item.params[7] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1614. elsif @refine_level == 4
  1615. item.params[7] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1616. elsif @refine_level == 5
  1617. item.params[7] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1618. elsif @refine_level == 6
  1619. item.params[7] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1620. elsif @refine_level == 7
  1621. item.params[7] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1622. elsif @refine_level == 8
  1623. item.params[7] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1624. elsif @refine_level == 9
  1625. item.params[7] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1626. elsif @refine_level == 10
  1627. item.params[7] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1628. elsif @refine_level == 11
  1629. item.params[7] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1630. end
  1631. end
  1632.  
  1633. def luck_fail(item)
  1634. index = 7
  1635. if @refine_level == 0
  1636. elsif @refine_level == 1
  1637. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1638. elsif @refine_level == 2
  1639. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1640. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1641. elsif @refine_level == 3
  1642. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1643. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1644. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1645. elsif @refine_level == 4
  1646. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1647. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1648. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1649. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1650. elsif @refine_level == 5
  1651. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1652. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1653. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1654. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1655. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1656. elsif @refine_level == 6
  1657. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1658. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1659. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1660. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1661. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1662. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1663. elsif @refine_level == 7
  1664. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1665. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1666. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1667. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1668. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1669. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1670. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1671. elsif @refine_level == 8
  1672. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1673. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1674. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1675. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1676. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1677. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1678. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1679. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1680. elsif @refine_level == 9
  1681. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1682. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1683. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1684. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1685. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1686. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1687. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1688. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1689. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1690. elsif @refine_level == 10
  1691. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1692. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1693. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1694. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1695. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1696. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1697. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1698. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1699. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1700. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1701. elsif @refine_level == 11
  1702. item.params[index] -= (item.equipment_grade * Plus_1_Ref_Val).to_i
  1703. item.params[index] -= (item.equipment_grade * Plus_2_Ref_Val - (item.equipment_grade)).to_i
  1704. item.params[index] -= (item.equipment_grade * Plus_3_Ref_Val - (item.equipment_grade)).to_i
  1705. item.params[index] -= (item.equipment_grade * Plus_4_Ref_Val - (item.equipment_grade)).to_i
  1706. item.params[index] -= (item.equipment_grade * Plus_5_Ref_Val - (item.equipment_grade)).to_i
  1707. item.params[index] -= (item.equipment_grade * Plus_6_Ref_Val - (item.equipment_grade)).to_i
  1708. item.params[index] -= (item.equipment_grade * Plus_7_Ref_Val - (item.equipment_grade)).to_i
  1709. item.params[index] -= (item.equipment_grade * Plus_8_Ref_Val - (item.equipment_grade)).to_i
  1710. item.params[index] -= (item.equipment_grade * Plus_9_Ref_Val - (item.equipment_grade)).to_i
  1711. item.params[index] -= (item.equipment_grade * Plus_10_Ref_Val - (item.equipment_grade)).to_i
  1712. item.params[index] -= (item.equipment_grade * Plus_11_Ref_Val - (item.equipment_grade)).to_i
  1713. end
  1714. end
  1715.  
  1716. end # equip item
  1717.  
  1718. #==============================================================================
  1719. class Game_Party < Game_Unit
  1720. #==============================================================================
  1721.  
  1722. alias item_number_gp_dpbz item_number
  1723. def item_number(item)
  1724. if item.is_a?(RPG::EquipItem)
  1725. return 1
  1726. else
  1727. return item_number_gp_dpbz(item)
  1728. end
  1729. end
  1730.  
  1731. alias gain_item_gp_dpbz gain_item
  1732. def gain_item(item, amount, include_equip = false)
  1733. if item.is_a?(RPG::Weapon)
  1734. if amount > 0
  1735. amount.times do
  1736. new_item = Dekita_Refine_Script.copy_weapon(item)
  1737. @weapons[new_item.id] = new_item
  1738. end
  1739. elsif amount < 0
  1740. @weapons.delete(item.id)
  1741. end
  1742. elsif item.is_a?(RPG::Armor)
  1743. if amount > 0
  1744. amount.times do
  1745. new_item = Dekita_Refine_Script.copy_armor(item)
  1746. @armors[new_item.id] = new_item
  1747. end
  1748. elsif amount < 0
  1749. @armors.delete(item.id)
  1750. end
  1751. else
  1752. gain_item_gp_dpbz(item, amount, include_equip)
  1753. end
  1754. end
  1755.  
  1756. end # Game_Party
  1757.  
  1758. #==============================================================================
  1759. class Window_ItemList < Window_Selectable
  1760. #==============================================================================
  1761.  
  1762. def draw_item(index)
  1763. item = @data[index]
  1764. if item
  1765. rect = item_rect(index)
  1766. rect.width -= 4
  1767. draw_item_name(item, rect.x, rect.y, enable?(item))
  1768. if item.is_a?(RPG::EquipItem)
  1769. draw_item_refine_level(rect, item)
  1770. else
  1771. draw_item_number(rect, item)
  1772. end
  1773. end
  1774. end
  1775.  
  1776. def draw_item_refine_level(rect, item)
  1777. plu = Dekita__Refine_Script::Refine_Symbols
  1778. draw_text(rect, sprintf(plu, item.refine_level), 2)
  1779. end
  1780.  
  1781. end # Window_ItemList
  1782.  
  1783. #==============================================================================
  1784. class Window_DPBzEquipCommand < Window_Command
  1785. #==============================================================================
  1786.  
  1787. def initialize(x, y, width)
  1788. @window_width = width
  1789. super(x, y)
  1790. end
  1791.  
  1792. def window_width
  1793. return @window_width
  1794. end
  1795.  
  1796. def make_command_list
  1797. for command in Dekita__Refine_Script::COMMANDS
  1798. case command[0]
  1799. when :sel_eqp
  1800. add_command("", :sel_eqp)
  1801. when :sel_itm
  1802. add_command("", :sel_itm)
  1803. when :ref_str
  1804. add_command("", :ref_str)
  1805. when :eqp_inf
  1806. add_command("", :eqp_inf)
  1807. when :exit
  1808. add_command("", :exit)
  1809. else
  1810. end
  1811. end
  1812. end
  1813.  
  1814. end # Window_DPBzEquipCommand
  1815.  
  1816. #==============================================================================
  1817. class Window_RefineConfirm < Window_Command
  1818. #==============================================================================
  1819.  
  1820. def initialize(x, y, width)
  1821. @window_width = width
  1822. super(x, y)
  1823. end
  1824.  
  1825. def window_width
  1826. @window_width
  1827. end
  1828.  
  1829. def window_height
  1830. fitting_height(4)
  1831. end
  1832.  
  1833. def make_command_list
  1834. add_command("ok", :ok)
  1835. add_command("cancel", :cancel)
  1836. end
  1837.  
  1838. end # Window_Refine_Confirm
  1839.  
  1840. #==============================================================================
  1841. class Window_MirageItemList < Window_ItemList
  1842. #==============================================================================
  1843.  
  1844. def col_max
  1845. return 1
  1846. end
  1847.  
  1848. def include?(item)
  1849. return true if item.is_a?(RPG::Item) && item.mirage_celestone
  1850. return false
  1851. end
  1852.  
  1853. def enable?(item)
  1854. $game_party.usable?(item)
  1855. end
  1856.  
  1857. end # Window
  1858.  
  1859. #==============================================================================
  1860. class Window_RefineItemList < Window_ItemList
  1861. #==============================================================================
  1862.  
  1863. def col_max
  1864. return 1
  1865. end
  1866.  
  1867. def include?(item)
  1868. return true if item.is_a?(RPG::Item) && item.refine_item
  1869. return false
  1870. end
  1871.  
  1872. def enable?(item)
  1873. $game_party.usable?(item)
  1874. end
  1875.  
  1876. end # Window
  1877.  
  1878. #==============================================================================
  1879. class Window_RefineEquipList < Window_ItemList
  1880. #==============================================================================
  1881.  
  1882. def col_max
  1883. return 1
  1884. end
  1885.  
  1886. def include?(item)
  1887. return true if item.is_a?(RPG::EquipItem)
  1888. return false
  1889. end
  1890.  
  1891. def enable?(item)
  1892. return false if item.refine_level == item.max_refine
  1893. return false if item.equipment_grade == 0
  1894. return true
  1895. end
  1896.  
  1897. end # Window
  1898.  
  1899. #==============================================================================
  1900. class Window_DPBzEquipStatus < Window_Base
  1901. #==============================================================================
  1902.  
  1903. attr_reader :item_window
  1904.  
  1905. def initialize(x, y, width, height)
  1906. super(x, y, width, height)
  1907. @actor = nil
  1908. @temp_actor = nil
  1909. @width = width
  1910. @height = height
  1911. refresh
  1912. end
  1913.  
  1914. def window_width
  1915. return @width
  1916. end
  1917.  
  1918. def window_height
  1919. @height
  1920. end
  1921.  
  1922. def visible_line_number
  1923. return 7
  1924. end
  1925.  
  1926. def actor=(actor)
  1927. return if @actor == actor
  1928. @actor = actor
  1929. refresh
  1930. end
  1931.  
  1932. def refresh
  1933. contents.clear
  1934. draw_selected_equip
  1935. draw_equipinfo_list
  1936. draw_commands_list
  1937. ax = (window_width-24)/2.5
  1938. draw_actor_face(@actor, ax, 0) if @actor
  1939. draw_horz_line(line_height * 4)
  1940. draw_horz_line((Graphics.height) - (line_height * 4))
  1941. end
  1942.  
  1943. def draw_horz_line(y)
  1944. line_y = y + line_height / 2 - 1
  1945. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  1946. end
  1947.  
  1948. def line_color
  1949. color = normal_color
  1950. color.alpha = 48
  1951. color
  1952. end
  1953.  
  1954. def set_temp_actor(temp_actor)
  1955. return if @temp_actor == temp_actor
  1956. @temp_actor = temp_actor
  1957. refresh
  1958. end
  1959.  
  1960. def item
  1961. @actor ? @actor.equips[index] : nil
  1962. end
  1963.  
  1964. def draw_selected_equip
  1965. dx = 0
  1966. dw = (Graphics.width-24) / 2
  1967. dy = Graphics.height / 3
  1968. for info in Dekita__Refine_Script::Refine_Info
  1969. dy = draw_info(info, dx, dy, dw)
  1970. end
  1971. end
  1972.  
  1973. def draw_commands_list
  1974. dx = 0
  1975. dw = (window_width + 24) / 5
  1976. dy = line_height * 0
  1977. for info in Dekita__Refine_Script::COMMANDS
  1978. dy = draw_info(info, dx, dy, dw)
  1979. end
  1980. end
  1981.  
  1982. def draw_equipinfo_list
  1983. dx = (Graphics.width) / 4 * 2
  1984. dw = (window_width + 24) / 2
  1985. dy = Graphics.height/3
  1986. for info in Dekita__Refine_Script::Item_Refine_Info
  1987. dy = draw_info(info, dx, dy, dw)
  1988. end
  1989. end
  1990.  
  1991. def draw_pagefour_info3
  1992. dx = 5
  1993. dw = (window_width - 24)
  1994. dy = line_height * DPB::PSS::INFO3LH
  1995. for info in Dekita__Refine_Script::Refine_Info
  1996. dy = draw_info(info, dx, dy, dw)
  1997. end
  1998. end
  1999.  
  2000. def draw_info(info, dx, dy, dw)
  2001. case info[0]
  2002. when :refine_equip
  2003. text = ""
  2004. when :refine_aid
  2005. text = ""
  2006. when :mirage_cost
  2007. text = ""
  2008. when :blank
  2009. when :sel_eqp
  2010. when :sel_itm
  2011. when :ref_Str
  2012. when :eqp_inf
  2013. end
  2014. colour = Color.new(0, 0, 0, translucent_alpha/2)
  2015. rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  2016. contents.fill_rect(rect, colour)
  2017. change_color(system_color)
  2018. draw_text(dx+4, dy, dw-8, line_height, info[1], 0)
  2019. change_color(normal_color)
  2020. draw_text(dx+4, dy, dw-8, line_height, text, 2)
  2021. return dy + line_height
  2022. end
  2023.  
  2024. end # end Window_DPBzEquipStatus
  2025.  
  2026. #==============================================================================
  2027. class Game_Temp
  2028. #==============================================================================
  2029.  
  2030. attr_reader :select_refine_equip
  2031. attr_reader :select_refine_item
  2032.  
  2033. alias refinesGTinit initialize
  2034. def initialize
  2035. refinesGTinit
  2036. @select_refine_equip = 0
  2037. @select_refine_item = 0
  2038. end
  2039.  
  2040. end # class
  2041.  
  2042. #==============================================================================
  2043. class Scene_Refine < Scene_MenuBase
  2044. #==============================================================================
  2045.  
  2046. def msg
  2047. s = [
  2048. "#{Dekita__Refine_Script::S_E_Help_Info}",
  2049. "#{Dekita__Refine_Script::S_I_Help_Info}",
  2050. "#{Dekita__Refine_Script::S_R_Help_Info}",
  2051. "#{""}"
  2052. ] # Do not remove this
  2053. return s
  2054. end
  2055.  
  2056. def start
  2057. super
  2058. create_status_window
  2059. create_help_window
  2060. create_command_window
  2061. @command_window.opacity = 0
  2062. create_refine_selection_window
  2063. make_selected_item_window
  2064. make_refine_prog_window
  2065. make_refine_cost_window
  2066. make_item_info_window
  2067. create_category_window
  2068. create_refine_item_window
  2069. create_refine_equip_window
  2070. # create_mirage_window
  2071. # / Equip Name
  2072. @rs_window.x = 0
  2073. @rs_window.y = (Graphics.height/5*2)-4
  2074. @rs_window.opacity = 0
  2075. # / Grade
  2076. @rp_window.x = 0
  2077. @rp_window.y = @rs_window.y + 24
  2078. @rp_window.opacity = 0
  2079. # / Aid Name
  2080. @is_window.x = 0
  2081. @is_window.y = (Graphics.height / 5 * 3) + 8
  2082. @is_window.opacity = 0
  2083. # / Cost
  2084. @rc_window.x = 0
  2085. @rc_window.y = (Graphics.height / 5 * 3) + 33
  2086. @rc_window.opacity = 0
  2087. # / Cost
  2088. @ii_window.x = 0
  2089. @ii_window.y = (Graphics.height / 2) / 1.5
  2090. @ii_window.opacity = 0
  2091. @ii_window.height = 200
  2092. # / Help
  2093. @help_window.y = Graphics.height - @help_window.height
  2094. @help_window.set_text(msg[@command_window.index])
  2095. @help_window.opacity = 0
  2096. end
  2097.  
  2098. def create_refine_selection_window
  2099. @rs_window = Window_Help.new
  2100. @rs_window.viewport = @viewport
  2101. end
  2102.  
  2103. def make_selected_item_window
  2104. @is_window = Window_Help.new
  2105. @is_window.viewport = @viewport
  2106. end
  2107.  
  2108. def make_refine_prog_window
  2109. @rp_window = Window_Help.new
  2110. @rp_window.viewport = @viewport
  2111. end
  2112.  
  2113. def make_refine_cost_window
  2114. @rc_window = Window_Help.new
  2115. @rc_window.viewport = @viewport
  2116. end
  2117.  
  2118. def make_item_info_window
  2119. @ii_window = Window_Help.new
  2120. @ii_window.viewport = @viewport
  2121. end
  2122.  
  2123. def create_status_window
  2124. wx = 0
  2125. wy = 0
  2126. ww = Graphics.width
  2127. wh = Graphics.height
  2128. @status_window = Window_DPBzEquipStatus.new(wx, wy, ww, wh)
  2129. @status_window.viewport = @viewport
  2130. @status_window.actor = @actor
  2131. end
  2132.  
  2133. def create_command_window
  2134. wx = 0
  2135. wy = 0
  2136. ww = 140
  2137. @command_window = Window_DPBzEquipCommand.new(wx, wy, ww)
  2138. @command_window.viewport = @viewport
  2139. @command_window.help_window = @help_window
  2140. @command_window.set_handler(:sel_eqp,method(:command_select_equip))
  2141. @command_window.set_handler(:sel_itm,method(:command_select_item))
  2142. @command_window.set_handler(:ref_str,method(:command_start_refine))
  2143. @command_window.set_handler(:eqp_inf,method(:command_start_refine))
  2144. @command_window.set_handler(:exit, method(:return_scene))
  2145. @command_window.set_handler(:cancel, method(:return_scene))
  2146. @command_window.set_handler(:pagedown, method(:next_actor))
  2147. @command_window.set_handler(:pageup, method(:prev_actor))
  2148. end
  2149.  
  2150. def create_confirm_window
  2151. wx = @command_window.width - 24
  2152. wy = 0
  2153. ww = 140
  2154. @confirm_window = Window_RefineConfirm.new(wx, wy, ww)
  2155. @confirm_window.opacity = 0
  2156. @confirm_window.viewport = @viewport
  2157. @confirm_window.help_window = @help_window
  2158. @confirm_window.set_handler(:ok, method(:confirm_equip))
  2159. @confirm_window.set_handler(:cancel, method(:select_equip_cancel))
  2160. end
  2161.  
  2162. def create_confirm_item_window
  2163. wx = @command_window.width - 24
  2164. wy = 0
  2165. ww = 140
  2166. @confirm_window = Window_RefineConfirm.new(wx, wy, ww)
  2167. @confirm_window.opacity = 0
  2168. @confirm_window.viewport = @viewport
  2169. @confirm_window.help_window = @help_window
  2170. @confirm_window.set_handler(:ok, method(:confirm_item))
  2171. @confirm_window.set_handler(:cancel, method(:select_equip_cancel))
  2172. end
  2173.  
  2174. def create_item_window
  2175. wx = Graphics.width / 2
  2176. wy = Graphics.height / 3
  2177. ww = Graphics.width / 2
  2178. wh = Graphics.height - wy - @help_window.height
  2179. @item_window = Window_DPBzEquipItem.new(wx, wy, ww, wh)
  2180. @item_window.viewport = @viewport
  2181. @item_window.help_window = @help_window
  2182. @item_window.status_window = @status_window
  2183. @item_window.actor = @actor
  2184. @item_window.set_handler(:ok, method(:on_item_ok))
  2185. @item_window.set_handler(:cancel, method(:on_item_cancel))
  2186. end
  2187.  
  2188. def create_category_window
  2189. @category_window = Window_ItemCategory.new
  2190. @category_window.viewport = @viewport
  2191. @category_window.help_window = @help_window
  2192. @category_window.y = @help_window.height
  2193. @category_window.opacity = 0
  2194. @category_window.deactivate
  2195. @category_window.hide
  2196. @category_window.set_handler(:ok, method(:on_category_ok))
  2197. @category_window.set_handler(:cancel, method(:return_scene))
  2198. end
  2199.  
  2200. def create_refine_item_window
  2201. wx = Graphics.width / 2 * 1
  2202. wy = Graphics.height / 3
  2203. ww = Graphics.width / 2
  2204. wh = Graphics.height - wy - @help_window.height
  2205. @refine_item_window = Window_RefineItemList.new(wx, wy, ww, wh)
  2206. @refine_item_window.viewport = @viewport
  2207. @refine_item_window.opacity = 0
  2208. @refine_item_window.hide
  2209. @refine_item_window.help_window = @help_window
  2210. @refine_item_window.set_handler(:ok, method(:on_refine_item_ok))
  2211. @refine_item_window.set_handler(:cancel, method(:on_item_cancel))
  2212. @category_window.item_window = @refine_item_window
  2213. end
  2214.  
  2215. def create_refine_equip_window
  2216. wx = Graphics.width / 2 * 1
  2217. wy = Graphics.height / 3
  2218. ww = Graphics.width / 2
  2219. wh = Graphics.height - wy - @help_window.height
  2220. @refine_equip_window = Window_RefineEquipList.new(wx, wy, ww, wh)
  2221. @refine_equip_window.opacity = 0
  2222. @refine_equip_window.hide
  2223. @refine_equip_window.viewport = @viewport
  2224. @refine_equip_window.help_window = @help_window
  2225. @refine_equip_window.set_handler(:ok, method(:on_refine_equip_ok))
  2226. @refine_equip_window.set_handler(:cancel, method(:on_item_cancel))
  2227. @category_window.item_window = @refine_equip_window
  2228. end
  2229.  
  2230. def create_mirage_window
  2231. wx = Graphics.width / 2 * 1
  2232. wy = (Graphics.height / 3) - 48
  2233. ww = Graphics.width / 2
  2234. wh = Graphics.height - wy - @help_window.height
  2235. @mirage_window = Window_MirageItemList.new(wx, wy, ww, wh)
  2236. @mirage_window.opacity = 0
  2237. @mirage_window.viewport = @viewport
  2238. @category_window.item_window = @mirage_window
  2239. end
  2240.  
  2241. def on_category_ok
  2242. end
  2243.  
  2244. def command_select_equip
  2245. @refine_equip_window.activate
  2246. @refine_equip_window.select_last
  2247. end
  2248.  
  2249.  
  2250. def command_select_item
  2251. @refine_item_window.activate
  2252. @refine_item_window.select_last
  2253. end
  2254.  
  2255. def command_start_refine
  2256. check_refine_success
  2257. @status_window.refresh
  2258. @command_window.activate
  2259. @refine_equip_window.refresh
  2260. @refine_item_window.refresh
  2261. # @mirage_window.refresh
  2262. end
  2263.  
  2264. def command_refine
  2265. @select_refine_equip.refine_level_up
  2266. end
  2267.  
  2268. def on_slot_ok
  2269. create_confirm_window
  2270. end
  2271.  
  2272. def on_slot_cancel
  2273. @command_window.activate
  2274. end
  2275.  
  2276. def select_equip_cancel
  2277. @refine_equip_window.unselect
  2278. @confirm_window.close
  2279. @command_window.open
  2280. @command_window.activate
  2281. end
  2282. # // Confirm Equip Choice
  2283. def confirm_equip
  2284. @confirm_window.close
  2285. if !@refine_equip_window.item.nil?
  2286. @select_refine_equip = @refine_equip_window.item
  2287. @select_refine_equip_name = @refine_equip_window.item.name
  2288. @rs_window.set_text(@refine_equip_window.item.name + " +" +
  2289. @refine_equip_window.item.refine_level.to_s)
  2290. @rp_window.set_text("Grade #{@refine_equip_window.item.equipment_grade.to_s}")
  2291. @rc_window.set_text("Mirage Cost : #{@refine_equip_window.item.mirage_celestone_req.to_s}")
  2292. end
  2293. @refine_equip_window.select_last
  2294. @refine_equip_window.unselect
  2295. @command_window.activate
  2296. end
  2297. # // Confirm Aid Choice
  2298. def confirm_item
  2299. @confirm_window.close
  2300. if !@refine_item_window.item.nil?
  2301. @select_refine_item = @refine_item_window.item
  2302. @is_window.set_text(@refine_item_window.item.name)
  2303. end
  2304. @refine_item_window.select_last
  2305. @refine_item_window.unselect
  2306. @command_window.activate
  2307. end
  2308.  
  2309. def on_item_ok
  2310. create_confirm_window
  2311. @select_refine_item = @item_window.item
  2312. end
  2313.  
  2314. def on_refine_item_ok
  2315. create_confirm_item_window
  2316. @select_refine_item = @refine_item_window.item
  2317. end
  2318.  
  2319. def on_refine_equip_ok
  2320. create_confirm_window
  2321. @select_refine_equip = @refine_equip_window.item
  2322. end
  2323.  
  2324. def on_item_cancel
  2325. @command_window.activate
  2326. @refine_item_window.unselect
  2327. @refine_equip_window.unselect
  2328. end
  2329.  
  2330. def on_actor_change
  2331. @status_window.actor = @actor
  2332. @command_window.activate
  2333. end
  2334.  
  2335. def update
  2336. super
  2337. if @command_window.active
  2338. @help_window.set_text(msg[@command_window.index])
  2339. update_item_windowz
  2340. elsif @refine_equip_window.active
  2341. @help_window.set_item(@refine_equip_window.item)
  2342. elsif @refine_item_window.active
  2343. @help_window.set_item(@refine_item_window.item)
  2344. else
  2345. end
  2346. end
  2347.  
  2348. def update_item_windowz
  2349. if @command_window.index == 0
  2350. @refine_equip_window.show
  2351. @refine_item_window.hide
  2352. elsif @command_window.index == 1
  2353. @refine_equip_window.hide
  2354. @refine_item_window.show
  2355. elsif @command_window.index == 3
  2356. @refine_equip_window.hide
  2357. @refine_item_window.hide
  2358. else
  2359. end
  2360. end
  2361.  
  2362. def check_refine_success
  2363. item = @select_refine_equip
  2364. aid = @select_refine_item
  2365. # // Mirage check / loss
  2366. return false if item.nil?
  2367. mir_loss = item.mirage_celestone_req
  2368. mir = Dekita__Refine_Script::Mirage_Celestone_ID
  2369. return false if $game_party.item_number($data_items[mir]) < item.mirage_celestone_req
  2370. $game_party.lose_item($data_items[mir], mir_loss)
  2371. # // Check for AIDS !!
  2372. if aid.nil?
  2373. mirage_only_aid
  2374. item.times_modified += 1
  2375. elsif aid.refine_item
  2376. # // Tisha Stone
  2377. if aid.tisha_stone
  2378. tisha_stone_aid
  2379. item.times_modified += 1
  2380. $game_party.lose_item(aid, 1)
  2381. if $game_party.has_item?(aid, include_equip = false)
  2382. @is_window.set_text(aid.name)
  2383. else
  2384. @select_refine_item = nil
  2385. aid = @select_refine_item
  2386. @is_window.set_text("")
  2387. end
  2388. # // Tienkang Stone
  2389. elsif aid.tienkang_stone
  2390. tienkang_stone_aid
  2391. item.times_modified += 1
  2392. $game_party.lose_item(aid, 1)
  2393. if $game_party.has_item?(aid, include_equip = false)
  2394. @is_window.set_text(aid.name)
  2395. else
  2396. @select_refine_item = nil
  2397. aid = @select_refine_item
  2398. @is_window.set_text("")
  2399. end
  2400. # // Chienkun Stone
  2401. elsif aid.chienkun_stone
  2402. chienkun_stone_aid
  2403. item.times_modified += 1
  2404. $game_party.lose_item(aid, 1)
  2405. if $game_party.has_item?(aid, include_equip = false)
  2406. @is_window.set_text(aid.name)
  2407. else
  2408. @select_refine_item = nil
  2409. aid = @select_refine_item
  2410. @is_window.set_text("")
  2411. end
  2412. # // Dragon Orb
  2413. elsif aid.dragon_orb
  2414. dragon_orb_aid
  2415. item.times_modified += 1
  2416. $game_party.lose_item(aid, 1)
  2417. if $game_party.has_item?(aid, include_equip = false)
  2418. @is_window.set_text(aid.name)
  2419. else
  2420. @select_refine_item = nil
  2421. aid = @select_refine_item
  2422. @is_window.set_text("")
  2423. end
  2424. end
  2425. end
  2426. @rs_window.set_text("#{item.name+Dekita__Refine_Script::Refine_Symbol+item.refine_level.to_s}")
  2427. wait(Dekita__Refine_Script::Wait_Time)
  2428. end
  2429.  
  2430. # Tisha Stone Aid
  2431. def tisha_stone_aid
  2432. item = @select_refine_equip
  2433. aid = @select_refine_item
  2434. @aid_val_find = rand(0.99999)
  2435. if item.refine_level == 0
  2436. if @aid_val_find <= Dekita__Refine_Script::Plus_1_Tish_Val
  2437. item.determine_refine_bonus(@select_refine_equip)
  2438. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2439. else
  2440. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2441. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2442. end
  2443. elsif item.refine_level == 1
  2444. if @aid_val_find <= Dekita__Refine_Script::Plus_2_Tish_Val
  2445. item.determine_refine_bonus(@select_refine_equip)
  2446. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2447. else
  2448. item.refine_level_down(@select_refine_equip)
  2449. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2450. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2451. end
  2452. elsif item.refine_level == 2
  2453. if @aid_val_find <= Dekita__Refine_Script::Plus_3_Tish_Val
  2454. item.determine_refine_bonus(@select_refine_equip)
  2455. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2456. else
  2457. item.refine_level_down(@select_refine_equip)
  2458. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2459. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2460. end
  2461. elsif item.refine_level == 3
  2462. if @aid_val_find <= Dekita__Refine_Script::Plus_4_Tish_Val
  2463. item.determine_refine_bonus(@select_refine_equip)
  2464. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2465. else
  2466. item.refine_level_down(@select_refine_equip)
  2467. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2468. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2469. end
  2470. elsif item.refine_level == 4
  2471. if @aid_val_find <= Dekita__Refine_Script::Plus_5_Tish_Val
  2472. item.determine_refine_bonus(@select_refine_equip)
  2473. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2474. else
  2475. item.refine_level_down(@select_refine_equip)
  2476. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2477. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2478. end
  2479. elsif item.refine_level == 5
  2480. if @aid_val_find <= Dekita__Refine_Script::Plus_6_Tish_Val
  2481. item.determine_refine_bonus(@select_refine_equip)
  2482. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2483. else
  2484. item.refine_level_down(@select_refine_equip)
  2485. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2486. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2487. end
  2488. elsif item.refine_level == 6
  2489. if @aid_val_find <= Dekita__Refine_Script::Plus_7_Tish_Val
  2490. item.determine_refine_bonus(@select_refine_equip)
  2491. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2492. else
  2493. item.refine_level_down(@select_refine_equip)
  2494. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2495. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2496. end
  2497. elsif item.refine_level == 7
  2498. if @aid_val_find <= Dekita__Refine_Script::Plus_8_Tish_Val
  2499. item.determine_refine_bonus(@select_refine_equip)
  2500. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2501. else
  2502. item.refine_level_down(@select_refine_equip)
  2503. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2504. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2505. end
  2506. elsif item.refine_level == 8
  2507. if @aid_val_find <= Dekita__Refine_Script::Plus_9_Tish_Val
  2508. item.determine_refine_bonus(@select_refine_equip)
  2509. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2510. else
  2511. item.refine_level_down(@select_refine_equip)
  2512. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2513. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2514. end
  2515. elsif item.refine_level == 9
  2516. if @aid_val_find <= Dekita__Refine_Script::Plus_10_Tish_Val
  2517. item.determine_refine_bonus(@select_refine_equip)
  2518. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2519. else
  2520. item.refine_level_down(@select_refine_equip)
  2521. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2522. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2523. end
  2524. elsif item.refine_level == 10
  2525. if @aid_val_find <= Dekita__Refine_Script::Plus_11_Tish_Val
  2526. item.determine_refine_bonus(@select_refine_equip)
  2527. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2528. else
  2529. item.refine_level_down(@select_refine_equip)
  2530. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2531. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2532. end
  2533. elsif item.refine_level == 11
  2534. if @aid_val_find <= Dekita__Refine_Script::Plus_12_Tish_Val
  2535. item.determine_refine_bonus(@select_refine_equip)
  2536. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2537. else
  2538. item.refine_level_down(@select_refine_equip)
  2539. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2540. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2541. end
  2542. end
  2543. end
  2544.  
  2545. # Tienkang Stone Aid
  2546. def tienkang_stone_aid
  2547. item = @select_refine_equip
  2548. aid = @select_refine_item
  2549. @aid_val_find = rand(0.99999)
  2550. if item.refine_level == 0
  2551. if @aid_val_find <= Dekita__Refine_Script::Plus_1_Tein_Val
  2552. item.determine_refine_bonus(@select_refine_equip)
  2553. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2554. else
  2555. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2556. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2557. end
  2558. elsif item.refine_level == 1
  2559. if @aid_val_find <= Dekita__Refine_Script::Plus_2_Tein_Val
  2560. item.determine_refine_bonus(@select_refine_equip)
  2561. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2562. else
  2563. item.refine_fail(@select_refine_equip)
  2564. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2565. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2566. end
  2567. elsif item.refine_level == 2
  2568. if @aid_val_find <= Dekita__Refine_Script::Plus_3_Tein_Val
  2569. item.determine_refine_bonus(@select_refine_equip)
  2570. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2571. else
  2572. item.refine_fail(@select_refine_equip)
  2573. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2574. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2575. end
  2576. elsif item.refine_level == 3
  2577. if @aid_val_find <= Dekita__Refine_Script::Plus_4_Tein_Val
  2578. item.determine_refine_bonus(@select_refine_equip)
  2579. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2580. else
  2581. item.refine_fail(@select_refine_equip)
  2582. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2583. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2584. end
  2585. elsif item.refine_level == 4
  2586. if @aid_val_find <= Dekita__Refine_Script::Plus_5_Tein_Val
  2587. item.determine_refine_bonus(@select_refine_equip)
  2588. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2589. else
  2590. item.refine_fail(@select_refine_equip)
  2591. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2592. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2593. end
  2594. elsif item.refine_level == 5
  2595. if @aid_val_find <= Dekita__Refine_Script::Plus_6_Tein_Val
  2596. item.determine_refine_bonus(@select_refine_equip)
  2597. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2598. else
  2599. item.refine_fail(@select_refine_equip)
  2600. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2601. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2602. end
  2603. elsif item.refine_level == 6
  2604. if @aid_val_find <= Dekita__Refine_Script::Plus_7_Tein_Val
  2605. item.determine_refine_bonus(@select_refine_equip)
  2606. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2607. else
  2608. item.refine_fail(@select_refine_equip)
  2609. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2610. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2611. end
  2612. elsif item.refine_level == 7
  2613. if @aid_val_find <= Dekita__Refine_Script::Plus_8_Tein_Val
  2614. item.determine_refine_bonus(@select_refine_equip)
  2615. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2616. else
  2617. item.refine_fail(@select_refine_equip)
  2618. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2619. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2620. end
  2621. elsif item.refine_level == 8
  2622. if @aid_val_find <= Dekita__Refine_Script::Plus_9_Tein_Val
  2623. item.determine_refine_bonus(@select_refine_equip)
  2624. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2625. else
  2626. item.refine_fail(@select_refine_equip)
  2627. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2628. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2629. end
  2630. elsif item.refine_level == 9
  2631. if @aid_val_find <= Dekita__Refine_Script::Plus_10_Tein_Val
  2632. item.determine_refine_bonus(@select_refine_equip)
  2633. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2634. else
  2635. item.refine_fail(@select_refine_equip)
  2636. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2637. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2638. end
  2639. elsif item.refine_level == 10
  2640. if @aid_val_find <= Dekita__Refine_Script::Plus_11_Tein_Val
  2641. item.determine_refine_bonus(@select_refine_equip)
  2642. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2643. else
  2644. item.refine_fail(@select_refine_equip)
  2645. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2646. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2647. end
  2648. elsif item.refine_level == 11
  2649. if @aid_val_find <= Dekita__Refine_Script::Plus_12_Tein_Val
  2650. item.determine_refine_bonus(@select_refine_equip)
  2651. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2652. else
  2653. item.refine_fail(@select_refine_equip)
  2654. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2655. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2656. end
  2657. end
  2658. end
  2659.  
  2660. # Chienkun Stone Aid
  2661. def chienkun_stone_aid
  2662. item = @select_refine_equip
  2663. aid = @select_refine_item
  2664. @aid_val_find = rand(0.99999)
  2665. if item.refine_level == 0
  2666. if @aid_val_find <= Dekita__Refine_Script::Plus_1_CKun_Val
  2667. item.determine_refine_bonus(@select_refine_equip)
  2668. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2669. else
  2670. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2671. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2672. end
  2673. elsif item.refine_level == 1
  2674. if @aid_val_find <= Dekita__Refine_Script::Plus_2_CKun_Val
  2675. item.determine_refine_bonus(@select_refine_equip)
  2676. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2677. else
  2678. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2679. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2680. end
  2681. elsif item.refine_level == 2
  2682. if @aid_val_find <= Dekita__Refine_Script::Plus_3_CKun_Val
  2683. item.determine_refine_bonus(@select_refine_equip)
  2684. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2685. else
  2686. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2687. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2688. end
  2689. elsif item.refine_level == 3
  2690. if @aid_val_find <= Dekita__Refine_Script::Plus_4_CKun_Val
  2691. item.determine_refine_bonus(@select_refine_equip)
  2692. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2693. else
  2694. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2695. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2696. end
  2697. elsif item.refine_level == 4
  2698. if @aid_val_find <= Dekita__Refine_Script::Plus_5_CKun_Val
  2699. item.determine_refine_bonus(@select_refine_equip)
  2700. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2701. else
  2702. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2703. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2704. end
  2705. elsif item.refine_level == 5
  2706. if @aid_val_find <= Dekita__Refine_Script::Plus_6_CKun_Val
  2707. item.determine_refine_bonus(@select_refine_equip)
  2708. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2709. else
  2710. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2711. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2712. end
  2713. elsif item.refine_level == 6
  2714. if @aid_val_find <= Dekita__Refine_Script::Plus_7_CKun_Val
  2715. item.determine_refine_bonus(@select_refine_equip)
  2716. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2717. else
  2718. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2719. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2720. end
  2721. elsif item.refine_level == 7
  2722. if @aid_val_find <= Dekita__Refine_Script::Plus_8_CKun_Val
  2723. item.determine_refine_bonus(@select_refine_equip)
  2724. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2725. else
  2726. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2727. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2728. end
  2729. elsif item.refine_level == 8
  2730. if @aid_val_find <= Dekita__Refine_Script::Plus_9_CKun_Val
  2731. item.determine_refine_bonus(@select_refine_equip)
  2732. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2733. else
  2734. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2735. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2736. end
  2737. elsif item.refine_level == 9
  2738. if @aid_val_find <= Dekita__Refine_Script::Plus_10_CKun_Val
  2739. item.determine_refine_bonus(@select_refine_equip)
  2740. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2741. else
  2742. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2743. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2744. end
  2745. elsif item.refine_level == 10
  2746. if @aid_val_find <= Dekita__Refine_Script::Plus_11_CKun_Val
  2747. item.determine_refine_bonus(@select_refine_equip)
  2748. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2749. else
  2750. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2751. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2752. end
  2753. elsif item.refine_level == 11
  2754. if @aid_val_find <= Dekita__Refine_Script::Plus_12_CKun_Val
  2755. item.determine_refine_bonus(@select_refine_equip)
  2756. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2757. else
  2758. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2759. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2760. end
  2761. end
  2762. end
  2763.  
  2764. # Dragon Orb Aid
  2765. def dragon_orb_aid
  2766. item = @select_refine_equip
  2767. aid = @select_refine_item
  2768. @aid_val_find = rand(0.99999)
  2769. if item.refine_level == 0
  2770. if aid.dragon_orb >= 1
  2771. item.determine_refine_bonus(@select_refine_equip)
  2772. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2773. else
  2774. mirage_only_aid
  2775. end
  2776. elsif item.refine_level == 1
  2777. if aid.dragon_orb >= 2
  2778. item.determine_refine_bonus(@select_refine_equip)
  2779. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2780. else
  2781. mirage_only_aid
  2782. end
  2783. elsif item.refine_level == 2
  2784. if aid.dragon_orb >= 3
  2785. item.determine_refine_bonus(@select_refine_equip)
  2786. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2787. else
  2788. mirage_only_aid
  2789. end
  2790. elsif item.refine_level == 3
  2791. if aid.dragon_orb >= 4
  2792. item.determine_refine_bonus(@select_refine_equip)
  2793. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2794. else
  2795. mirage_only_aid
  2796. end
  2797. elsif item.refine_level == 4
  2798. if aid.dragon_orb >= 5
  2799. item.determine_refine_bonus(@select_refine_equip)
  2800. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2801. else
  2802. mirage_only_aid
  2803. end
  2804. elsif item.refine_level == 5
  2805. if aid.dragon_orb >= 6
  2806. item.determine_refine_bonus(@select_refine_equip)
  2807. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2808. else
  2809. mirage_only_aid
  2810. end
  2811. elsif item.refine_level == 6
  2812. if aid.dragon_orb >= 7
  2813. item.determine_refine_bonus(@select_refine_equip)
  2814. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2815. else
  2816. mirage_only_aid
  2817. end
  2818. elsif item.refine_level == 7
  2819. if aid.dragon_orb >= 8
  2820. item.determine_refine_bonus(@select_refine_equip)
  2821. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2822. else
  2823. mirage_only_aid
  2824. end
  2825. elsif item.refine_level == 8
  2826. if aid.dragon_orb >= 9
  2827. item.determine_refine_bonus(@select_refine_equip)
  2828. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2829. else
  2830. mirage_only_aid
  2831. end
  2832. elsif item.refine_level == 9
  2833. if aid.dragon_orb >= 10
  2834. item.determine_refine_bonus(@select_refine_equip)
  2835. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2836. else
  2837. mirage_only_aid
  2838. end
  2839. elsif item.refine_level == 10
  2840. if aid.dragon_orb >= 11
  2841. item.determine_refine_bonus(@select_refine_equip)
  2842. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2843. else
  2844. mirage_only_aid
  2845. end
  2846. elsif item.refine_level == 11
  2847. if aid.dragon_orb >= 12
  2848. item.determine_refine_bonus(@select_refine_equip)
  2849. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2850. else
  2851. mirage_only_aid
  2852. end
  2853. end
  2854. end
  2855.  
  2856. # Mirage Stone Aid
  2857. def mirage_only_aid
  2858. item = @select_refine_equip
  2859. aid = @select_refine_item
  2860. @aid_val_find = rand(0.99999)
  2861. if item.refine_level == 0
  2862. if @aid_val_find <= Dekita__Refine_Script::Plus_1_Mir_Val
  2863. item.determine_refine_bonus(@select_refine_equip)
  2864. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2865. else
  2866. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2867. #{Dekita__Refine_Script::S_R_NO_Fail}")
  2868. end
  2869. elsif item.refine_level == 1
  2870. if @aid_val_find <= Dekita__Refine_Script::Plus_2_Mir_Val
  2871. item.determine_refine_bonus(@select_refine_equip)
  2872. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2873. else
  2874. item.refine_fail(@select_refine_equip)
  2875. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2876. #{Dekita__Refine_Script::S_R_Single_Fail}")
  2877. end
  2878. elsif item.refine_level == 2
  2879. if @aid_val_find <= Dekita__Refine_Script::Plus_3_Mir_Val
  2880. item.determine_refine_bonus(@select_refine_equip)
  2881. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2882. else
  2883. item.refine_fail(@select_refine_equip)
  2884. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2885. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2886. end
  2887. elsif item.refine_level == 3
  2888. if @aid_val_find <= Dekita__Refine_Script::Plus_4_Mir_Val
  2889. item.determine_refine_bonus(@select_refine_equip)
  2890. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2891. else
  2892. item.refine_fail(@select_refine_equip)
  2893. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2894. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2895. end
  2896. elsif item.refine_level == 4
  2897. if @aid_val_find <= Dekita__Refine_Script::Plus_5_Mir_Val
  2898. item.determine_refine_bonus(@select_refine_equip)
  2899. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2900. else
  2901. item.refine_fail(@select_refine_equip)
  2902. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2903. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2904. end
  2905. elsif item.refine_level == 5
  2906. if @aid_val_find <= Dekita__Refine_Script::Plus_6_Mir_Val
  2907. item.determine_refine_bonus(@select_refine_equip)
  2908. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2909. else
  2910. item.refine_fail(@select_refine_equip)
  2911. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2912. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2913. end
  2914. elsif item.refine_level == 6
  2915. if @aid_val_find <= Dekita__Refine_Script::Plus_7_Mir_Val
  2916. item.determine_refine_bonus(@select_refine_equip)
  2917. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2918. else
  2919. item.refine_fail(@select_refine_equip)
  2920. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2921. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2922. end
  2923. elsif item.refine_level == 7
  2924. if @aid_val_find <= Dekita__Refine_Script::Plus_8_Mir_Val
  2925. item.determine_refine_bonus(@select_refine_equip)
  2926. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2927. else
  2928. item.refine_fail(@select_refine_equip)
  2929. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2930. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2931. end
  2932. elsif item.refine_level == 8
  2933. if @aid_val_find <= Dekita__Refine_Script::Plus_9_Mir_Val
  2934. item.determine_refine_bonus(@select_refine_equip)
  2935. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2936. else
  2937. item.refine_fail(@select_refine_equip)
  2938. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2939. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2940. end
  2941. elsif item.refine_level == 9
  2942. if @aid_val_find <= Dekita__Refine_Script::Plus_10_Mir_Val
  2943. item.determine_refine_bonus(@select_refine_equip)
  2944. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2945. else
  2946. item.refine_fail(@select_refine_equip)
  2947. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2948. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2949. end
  2950. elsif item.refine_level == 10
  2951. if @aid_val_find <= Dekita__Refine_Script::Plus_11_Mir_Val
  2952. item.determine_refine_bonus(@select_refine_equip)
  2953. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2954. else
  2955. item.refine_fail(@select_refine_equip)
  2956. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2957. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2958. end
  2959. elsif item.refine_level == 11
  2960. if @aid_val_find <= Dekita__Refine_Script::Plus_12_Mir_Val
  2961. item.determine_refine_bonus(@select_refine_equip)
  2962. @help_window.set_text(Dekita__Refine_Script::S_R_Success)
  2963. else
  2964. item.refine_fail(@select_refine_equip)
  2965. @help_window.set_text("#{Dekita__Refine_Script::S_R_Fail}
  2966. #{Dekita__Refine_Script::S_R_Total_Fail}")
  2967. end
  2968. end
  2969. end
  2970.  
  2971. def wait(time)
  2972. t = 0 ; loop do
  2973. Graphics.update
  2974. if t == time
  2975. break
  2976. end ; t += 1 ; end
  2977. end
  2978.  
  2979. end # end scene
  2980.  
  2981. #==============================================================================#
  2982. # http://dekitarpg.wordpress.com/ #
  2983. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement