Advertisement
Dekita

SUG 1.2

Mar 29th, 2014
2,147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 77.23 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Skill Upgrade
  5. # -- Author : Dekita
  6. # -- Version : 1.2
  7. # -- Level : Insane
  8. # -- Requires : $D13x Core
  9. # -- Engine : RPG Maker VX Ace
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:SUG]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # o2/o3/2o14 - Updated efficiency,
  21. # o1/o3/2o14 - Updated for additional customization,
  22. # 28/o2/2o14 - Finished,
  23. # ??/??/2o13 - Started,
  24. #
  25. #===============================================================================
  26. # ☆ Introduction
  27. #-------------------------------------------------------------------------------
  28. # This script creates a highly dymanic and customizable Skill Upgrade scene.
  29. # You can use either Exp, SP or Gold to obtain skills this way.
  30. #
  31. # Using this script you will be able to make a huge assortment of skill tree's
  32. # each different from the last. You can also enable each actor to utilize a
  33. # different skill tree, very useful for different classes.
  34. #
  35. # In order to function correctly, this script requires the scripts listed below;
  36. # $D13x - Core v2.2
  37. # $D13x - Skill Levels v1.7
  38. # $D13x - Learn Skill Requirements v2.0
  39. #
  40. #===============================================================================
  41. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  42. #===============================================================================
  43. # 1. You MUST give credit to "Dekita" !!
  44. # 2. You are NOT allowed to repost this script.(or modified versions)
  45. # 3. You are NOT allowed to convert this script.
  46. # 4. You are NOT allowed to use this script for Commercial games.
  47. # 5. ENJOY!
  48. #
  49. # "FINE PRINT"
  50. # By using this script you hereby agree to the above terms and conditions,
  51. # if any violation of the above terms occurs "legal action" may be taken.
  52. # Not understanding the above terms and conditions does NOT mean that
  53. # they do not apply to you.
  54. # If you wish to discuss the terms and conditions in further detail you can
  55. # contact me at http://dekitarpg.wordpress.com/
  56. #
  57. #===============================================================================
  58. # ☆ Instructions
  59. #-------------------------------------------------------------------------------
  60. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  61. #
  62. #===============================================================================
  63. # ☆ Script Calls
  64. #-------------------------------------------------------------------------------
  65. # $game_actors[ID].gain_general_sp(eval)
  66. # eval = a string of code to eval(within Game_Actor), examples;
  67. # "atk + mhp + (def*2)"
  68. # "5 + @level"
  69. # "10"
  70. #
  71. # $game_actors[ID].skill_points
  72. # returns the value of actor ID's skill points.
  73. #
  74. #===============================================================================
  75. # ☆ Notetags ( default )
  76. #-------------------------------------------------------------------------------
  77. # <sp gain: VAL>
  78. # VAL = the amount of SP gain when an item or skill with this tag is used.
  79. #
  80. #-------------------------------------------------------------------------------
  81. # <sug cost: VAL>
  82. # VAL = the skill upgrade Cost_Setup id. To be used for skills only
  83. #
  84. #-------------------------------------------------------------------------------
  85. # <sug id: ID>
  86. # ID = skill Tree[ id ] for this actor / class.
  87. # NOTE: Actors have priority over Classes
  88. #
  89. #===============================================================================
  90. # ☆ HELP
  91. #-------------------------------------------------------------------------------
  92. # If you require additional assistancce, please leave a message on my blog @
  93. # http://dekitarpg.wordpress.com/
  94. #
  95. #===============================================================================
  96. module Skill_Upgrade
  97. #===============================================================================
  98. Tree=[] # << KEEP
  99. Cost_Setup=[] # << KEEP
  100. #-----------------------------------------------------------------------------
  101. # // Learning Requirements, use this to turn reqs off for testing.
  102. # // eg. no exp req for skill to be learned if :exp => false
  103. #-----------------------------------------------------------------------------
  104. Reqs={
  105. :exp => false,
  106. :gold => true,
  107. :sp => true,
  108. }
  109. #-----------------------------------------------------------------------------
  110. # // Settings for drawn requirements.
  111. #-----------------------------------------------------------------------------
  112. Draw_Exp_Req = true
  113. Draw_SP_Req = true
  114. Draw_Gold_Req = true
  115. #-----------------------------------------------------------------------------
  116. # // Graphics Folder
  117. #-----------------------------------------------------------------------------
  118. Folder = "$D13x/Skill Upgrade/"
  119. #-----------------------------------------------------------------------------
  120. # // Arrow Graphics, Must be in the folder defined above.
  121. #-----------------------------------------------------------------------------
  122. Arrows={
  123. :L => ['Arrow_L', 0], # ['image_name', hue]
  124. :R => ['Arrow_R', 0],
  125. :U => ['Arrow_U', 0],
  126. :D => ['Arrow_D', 0],
  127. }# << END Arrows
  128. #-----------------------------------------------------------------------------
  129. # // Skill Box Graphic. Must be in the folder defined above.
  130. #-----------------------------------------------------------------------------
  131. Skill_Bx = ["Skill_Box", 0]
  132. #-----------------------------------------------------------------------------
  133. # // Selected skill graphic. Must be in the folder defined above.
  134. #-----------------------------------------------------------------------------
  135. Selected = ["Selected_Box", 0]
  136. #-----------------------------------------------------------------------------
  137. # // Iconset Graphics.
  138. # // Must be in Graphics/System folder.
  139. #-----------------------------------------------------------------------------
  140. Iconset = "Iconset"
  141. #--------------------------------------------------------------------------
  142. # // This option only works if using my $D13x Scene Backgrounds Script.
  143. # // The background folder is set in the Scene BackGrounds script.
  144. #--------------------------------------------------------------------------
  145. BGs=[
  146. # ['NAME' , x, y, x scroll, y scroll, z, hue, init opac, max opac],
  147. ['Sunbeam_Overlay_by ShinGamix',0,0, 0, 0, 1, 0, 105, 255],
  148. ['ShinGamox_by ShinGamix',0,0, 0, 0, 1, 0, 105, 245],
  149. ['Fog_By_hyde' , 100, 100, 2, -2, 1, 0, 74, 125],
  150. ['$Dekita_II' , 0, 0, 1, 1, 2, 0, 0, 255],
  151. ]# << end
  152. #-----------------------------------------------------------------------------
  153. # // Noise when move left/right.
  154. #-----------------------------------------------------------------------------
  155. Cursor_Move_Sound = "Cursor1"
  156. #-----------------------------------------------------------------------------
  157. # // Vocab for Skill Points.
  158. #-----------------------------------------------------------------------------
  159. SP_Vocab = ["Skill Pts:" , "SP Cost:", "SP:"]
  160. #-----------------------------------------------------------------------------
  161. # // Vocab to confirm purchase
  162. #-----------------------------------------------------------------------------
  163. def self.confirm(skill)
  164. return "Confirm purchase of #{skill.name}?"
  165. end
  166. #-----------------------------------------------------------------------------
  167. # // vocab for a skill that has been maxed already
  168. #-----------------------------------------------------------------------------
  169. def self.maxxed(skill)
  170. return "#{skill.name}'s level is already maxxed"
  171. end
  172. #-----------------------------------------------------------------------------
  173. # // Vocab for failing to purchase a skill due to requirements.
  174. #-----------------------------------------------------------------------------
  175. def self.fail_buy(skill,lv_name)
  176. return "Requirements to purchase #{skill.name} #{lv_name} have not been met."
  177. end
  178. #-----------------------------------------------------------------------------
  179. # // Vocab for upgraded skills
  180. #-----------------------------------------------------------------------------
  181. def self.upgrade(skill,lv_name)
  182. return "#{skill.name} was upgraded to #{lv_name}."
  183. end
  184. #-----------------------------------------------------------------------------
  185. # // Vocab for learning skills
  186. #-----------------------------------------------------------------------------
  187. def self.learn(skill,lv_name)
  188. return "#{skill.name} has been learned."
  189. end
  190. #-----------------------------------------------------------------------------
  191. # // SP Gain Settings
  192. #-----------------------------------------------------------------------------
  193. SP_Settings={
  194. :each_lvl_up => '@level * 5',
  195. # Default SP gained Per Battle
  196. :each_battle => '@level * 5',
  197. # Default SP Gained Each Attack
  198. :each_attack => '@level * 1.5',
  199. # Default SP Gained Each Guard
  200. :each_guard => '@level * 1.5',
  201. # Default SP Gained Each Skill
  202. :each_skill => '@level * 1.8',
  203. # Default SP Gained Each Item
  204. :each_item => '@level * 2.0',
  205. # Default SP when Skill / Items are Used
  206. :each__use => '@level * 1.2',
  207. } #<< Keep
  208. #-----------------------------------------------------------------------------
  209. # // Notetag for additional SP gained when a skill / item is used.
  210. #-----------------------------------------------------------------------------
  211. SP_Use_Note = /<sp gain:(.*)>/i
  212. #-----------------------------------------------------------------------------
  213. # // Skill Cost Setups, Use the Cost_Note notetag to change a skills
  214. # // Cost_Setup ID
  215. #-----------------------------------------------------------------------------
  216. Cost_Note = /<sug cost:(.*)>/i
  217. #-----------------------------------------------------------------------------
  218. # // Skill Tree [id] notetag. Used for actors && classes.
  219. # // NOTE: Actors have priority over Classes
  220. #-----------------------------------------------------------------------------
  221. SUG_Note = /<sug id:(.*)>/i
  222. #-----------------------------------------------------------------------------
  223. # // Default Skill Cost ID
  224. #-----------------------------------------------------------------------------
  225. Default_Cost_Setup = 1
  226. #-----------------------------------------------------------------------------
  227. # // Default Skill Tree ID
  228. #-----------------------------------------------------------------------------
  229. Default_Skill_Tree = 0
  230. #-----------------------------------------------------------------------------
  231. # // Skill Points when each actor is added to party.
  232. #-----------------------------------------------------------------------------
  233. Starting_SP ={0=>0,# << KEEP
  234. 1 => 10, # Actor 1
  235. 2 => 20, # Actor 2
  236. 3 => 30, # Actor 3
  237. 4 => 40, # Actor 4
  238. 5 => 50, # ...
  239. 6 => 60,
  240. 7 => 70,
  241. 8 => 80,
  242. 9 => 90,
  243. 10 => 100,
  244. }# << END Starting_SP
  245. #-----------------------------------------------------------------------------
  246. # // Cost_Setup[ 0 ]
  247. #-----------------------------------------------------------------------------
  248. Cost_Setup[0]={
  249. 1 => {:sp => 0, :gold => nil },
  250. 2 => {:sp => 0, :gold => nil },
  251. 3 => {:sp => 0, :gold => nil },
  252. 4 => {:sp => 0, :gold => nil },
  253. 5 => {:sp => 100, :gold => nil },
  254. 6 => {:sp => 200, :gold => nil },
  255. 7 => {:sp => 400, :gold => nil },
  256. 8 => {:sp => 800, :gold => nil },
  257. 9 => {:sp => 2000, :gold => 100_000 },
  258. } # << Cost_Setup[0]
  259. #-----------------------------------------------------------------------------
  260. # // Cost_Setup[ 1 ]
  261. #-----------------------------------------------------------------------------
  262. Cost_Setup[1]={
  263. 1 => {:sp => 10, :gold => 1000 },
  264. 2 => {:sp => 50, :gold => 2500 },
  265. 3 => {:sp => 100, :gold => 5000 },
  266. 4 => {:sp => 500, :gold => 8000 },
  267. 5 => {:sp => 1000, :gold => 14_000 },
  268. 6 => {:sp => 5000, :gold => 20_000 },
  269. 7 => {:sp => 10_000, :gold => 30_000 },
  270. 8 => {:sp => 50_000, :gold => 50_000 },
  271. 9 => {:sp => 100_000, :gold => 100_000 },
  272. } # << Cost_Setup[1]
  273. #-----------------------------------------------------------------------------
  274. # // Cost_Setup[ 2 ]
  275. #-----------------------------------------------------------------------------
  276. Cost_Setup[2]={
  277. 1 => {:sp => 0, :gold => nil },
  278. 2 => {:sp => 0, :gold => nil },
  279. 3 => {:sp => 0, :gold => nil },
  280. 4 => {:sp => 0, :gold => nil },
  281. 5 => {:sp => 100, :gold => nil },
  282. 6 => {:sp => 200, :gold => nil },
  283. 7 => {:sp => 400, :gold => nil },
  284. 8 => {:sp => 800, :gold => nil },
  285. 9 => {:sp => 2000, :gold => 100_000 },
  286. } # << Cost_Setup[2]
  287. #-----------------------------------------------------------------------------
  288. # // Cost_Setup[ 3 ]
  289. #-----------------------------------------------------------------------------
  290. Cost_Setup[3]={
  291. 1 => {:sp => nil, :gold => nil },
  292. 2 => {:sp => nil, :gold => nil },
  293. 3 => {:sp => nil, :gold => nil },
  294. 4 => {:sp => nil, :gold => nil },
  295. 5 => {:sp => 100, :gold => nil },
  296. 6 => {:sp => 200, :gold => nil },
  297. 7 => {:sp => 400, :gold => nil },
  298. 8 => {:sp => 800, :gold => nil },
  299. 9 => {:sp => 1200, :gold => 100_000 },
  300. 10 => {:sp => 1800, :gold => 150_000 },
  301. 11 => {:sp => 2400, :gold => 200_000 },
  302. 12 => {:sp => 3000, :gold => 250_000 },
  303. 13 => {:sp => 3800, :gold => 300_000 },
  304. 14 => {:sp => 4500, :gold => 350_000 },
  305. 15 => {:sp => 5500, :gold => 400_000 },
  306. 16 => {:sp => 6600, :gold => 450_000 },
  307. 17 => {:sp => 7800, :gold => 500_000 },
  308. 18 => {:sp => 9000, :gold => 550_000 },
  309. 19 => {:sp => 15000, :gold => 750_000 },
  310. 20 => {:sp => 25000, :gold => 999_999 },
  311. } # << Cost_Setup[3]
  312. #=============================================================================
  313. # BEGIN SKILL TREE(s)
  314. #-----------------------------------------------------------------------------
  315. # NOTES::
  316. # :skill => the database id of the skill to show in this slot.
  317. # :pos => the position of this skill slot in the upgrade scene.
  318. # :dir => the destination slot that the player is taken when they press the
  319. # relevant key.
  320. # format is. dir: [slot_id, show_arrow]
  321. # eg. l: [1, true], r: [2, true], u: [3, true], d: [4, false]
  322. # this example means that when you are on this skill slot and press
  323. # :l (:LEFT) you will be taken to tree slot 1 and an arrow will be
  324. # also be shown.
  325. #
  326. #-----------------------------------------------------------------------------
  327. # // Skill Tree[ 0 ] Begin
  328. #-----------------------------------------------------------------------------
  329. Tree[0]=[
  330. {# 0
  331. :skill => 36,
  332. :pos => [201,208],
  333. :dir => {l: [1,true], r: [3,true], u: [6,false], d: [nil,false]},
  334. },
  335.  
  336. {# 1
  337. :skill => 12,
  338. :pos => [163,208],
  339. :dir => {l: [nil,true], r: [0,false], u: [2,true], d: [nil,false]},
  340. },
  341. {# 2
  342. :skill => 13,
  343. :pos => [163,170],
  344. :dir => {l: [nil,true], r: [4,false], u: [5,true], d: [1,false]},
  345. },
  346.  
  347. {# 3
  348. :skill => 14,
  349. :pos => [239,208],
  350. :dir => {l: [0,false], r: [nil,false], u: [4,true], d: [nil,false]},
  351. },
  352. {# 4
  353. :skill => 15,
  354. :pos => [239,170],
  355. :dir => {l: [2,false], r: [nil,true], u: [7,true], d: [3,false]},
  356. },
  357.  
  358. {# 5
  359. :skill => 16,
  360. :pos => [163,132],
  361. :dir => {l: [nil,false], r: [6,false], u: [11,false], d: [2,false]},
  362. },
  363. {# 6
  364. :skill => 18,
  365. :pos => [201,132],
  366. :dir => {l: [5,false], r: [7,false], u: [12,false], d: [0,false]},
  367. },
  368. {# 7
  369. :skill => 17,
  370. :pos => [239,132],
  371. :dir => {l: [6,false], r: [nil,false], u: [13,false], d: [4,false]},
  372. },
  373.  
  374.  
  375.  
  376.  
  377. {# 8
  378. :skill => 38,
  379. :pos => [49,94],
  380. :dir => {l: [nil,false], r: [9,false], u: [17,true], d: [nil,false]},
  381. },
  382. {# 9
  383. :skill => 39,
  384. :pos => [87,94],
  385. :dir => {l: [8,false], r: [10,false], u: [18,true], d: [nil,false]},
  386. },
  387. {# 10
  388. :skill => 40,
  389. :pos => [125,94],
  390. :dir => {l: [9,false], r: [11,false], u: [19,true], d: [nil,false]},
  391. },
  392. {# 11
  393. :skill => 41,
  394. :pos => [163,94],
  395. :dir => {l: [10,false], r: [12,false], u: [20,true], d: [5,false]},
  396. },
  397. {# 12
  398. :skill => 37,
  399. :pos => [201,94],
  400. :dir => {l: [11,false], r: [13,false], u: [nil,true], d: [6,false]},
  401. },
  402. {# 13
  403. :skill => 42,
  404. :pos => [239,94],
  405. :dir => {l: [12,false], r: [14,false], u: [21,true], d: [7,false]},
  406. },
  407. {# 14
  408. :skill => 43,
  409. :pos => [277,94],
  410. :dir => {l: [13,false], r: [15,false], u: [22,true], d: [nil,false]},
  411. },
  412. {# 15
  413. :skill => 44,
  414. :pos => [315,94],
  415. :dir => {l: [14,false], r: [16,false], u: [23,true], d: [nil,false]},
  416. },
  417. {# 16
  418. :skill => 45,
  419. :pos => [353,94],
  420. :dir => {l: [15,false], r: [nil,false], u: [24,true], d: [nil,false]},
  421. },
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430. {# 17
  431. :skill => 19,
  432. :pos => [49,56],
  433. :dir => {l: [nil,false], r: [18,false], u: [25,true], d: [8,false]},
  434. },
  435. {# 18
  436. :skill => 21,
  437. :pos => [87,56],
  438. :dir => {l: [17,false], r: [19,false], u: [26,true], d: [9,false]},
  439. },
  440. {# 19
  441. :skill => 23,
  442. :pos => [125,56],
  443. :dir => {l: [18,false], r: [20,false], u: [27,true], d: [10,false]},
  444. },
  445. {# 20
  446. :skill => 25,
  447. :pos => [163,56],
  448. :dir => {l: [19,false], r: [21,false], u: [28,true], d: [11,false]},
  449. },
  450.  
  451. {# 21
  452. :skill => 27,
  453. :pos => [239,56],
  454. :dir => {l: [20,false], r: [22,false], u: [29,true], d: [13,false]},
  455. },
  456. {# 22
  457. :skill => 29,
  458. :pos => [277,56],
  459. :dir => {l: [21,false], r: [23,false], u: [30,true], d: [14,false]},
  460. },
  461. {# 23
  462. :skill => 31,
  463. :pos => [315,56],
  464. :dir => {l: [22,false], r: [24,false], u: [31,true], d: [15,false]},
  465. },
  466. {# 24
  467. :skill => 33,
  468. :pos => [353,56],
  469. :dir => {l: [23,false], r: [nil,false], u: [32,true], d: [16,false]},
  470. },
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477. {# 25
  478. :skill => 20,
  479. :pos => [49,18],
  480. :dir => {l: [nil,false], r: [26,false], u: [nil,true], d: [17,false]},
  481. },
  482. {# 26
  483. :skill => 22,
  484. :pos => [87,18],
  485. :dir => {l: [25,false], r: [27,false], u: [nil,true], d: [18,false]},
  486. },
  487. {# 27
  488. :skill => 24,
  489. :pos => [125,18],
  490. :dir => {l: [26,false], r: [28,false], u: [nil,true], d: [19,false]},
  491. },
  492. {# 28
  493. :skill => 26,
  494. :pos => [163,18],
  495. :dir => {l: [27,false], r: [29,false], u: [nil,true], d: [20,false]},
  496. },
  497.  
  498. {# 29
  499. :skill => 28,
  500. :pos => [239,18],
  501. :dir => {l: [28,false], r: [30,false], u: [nil,true], d: [21,false]},
  502. },
  503. {# 30
  504. :skill => 30,
  505. :pos => [277,18],
  506. :dir => {l: [29,false], r: [31,false], u: [nil,true], d: [22,false]},
  507. },
  508. {# 31
  509. :skill => 32,
  510. :pos => [315,18],
  511. :dir => {l: [30,false], r: [32,false], u: [nil,true], d: [23,false]},
  512. },
  513. {# 32
  514. :skill => 34,
  515. :pos => [353,18],
  516. :dir => {l: [31,false], r: [nil,false], u: [nil,true], d: [24,false]},
  517. },
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524. ]# << Skill Tree [0] END
  525. #=============================================================================
  526. # // You can create more (unlimited) Tree[id]'s below this point.
  527. #=============================================================================
  528. # // Enter your skill Tree(s) Here
  529. # // Enter your skill Tree(s) Here
  530. # // Enter your skill Tree(s) Here
  531. # // Enter your skill Tree(s) Here
  532. #=============================================================================
  533.  
  534. #####################
  535. # CUSTOMISATION END #
  536. end #####################
  537. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  538. # #
  539. # http://dekitarpg.wordpress.com/ #
  540. # #
  541. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  542. #===============================================================================#
  543. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  544. # YES?\.\. #
  545. # OMG, REALLY? \| #
  546. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  547. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  548. #===============================================================================#
  549. module Cache
  550. #===============================================================================
  551. #-----------------------------------------------------------------------------
  552. #
  553. #-----------------------------------------------------------------------------
  554. def self.sd13x_sug(filename, hue = 0)
  555. load_bitmap("Graphics/#{Skill_Upgrade::Folder}", filename, hue)
  556. end
  557.  
  558. end
  559.  
  560. #===============================================================================
  561. module DataManager
  562. #===============================================================================
  563. #-----------------------------------------------------------------------------
  564. #
  565. #-----------------------------------------------------------------------------
  566. class << self
  567. alias :lbd_sug :load_database
  568. end
  569. #-----------------------------------------------------------------------------
  570. #
  571. #-----------------------------------------------------------------------------
  572. def self.load_database
  573. lbd_sug
  574. loa_sug
  575. end
  576. #-----------------------------------------------------------------------------
  577. #
  578. #-----------------------------------------------------------------------------
  579. def self.loa_sug
  580. for o in $data_skills
  581. next if o == nil
  582. o.load_sug
  583. end
  584. end
  585.  
  586. end # DataManager
  587.  
  588. #===============================================================================
  589. module BattleManager
  590. #===============================================================================
  591. #-----------------------------------------------------------------------------
  592. # Alias List
  593. #-----------------------------------------------------------------------------
  594. class << self
  595. alias :gain_sp_exp :gain_exp
  596. end
  597. #-----------------------------------------------------------------------------
  598. # Process Victory
  599. #-----------------------------------------------------------------------------
  600. def self.gain_exp
  601. gain_battle_sp_
  602. gain_sp_exp
  603. end
  604. #-----------------------------------------------------------------------------
  605. # Gain Battle Exp
  606. #-----------------------------------------------------------------------------
  607. def self.gain_battle_sp_
  608. $game_party.battle_members.each do |m|
  609. next unless m != nil
  610. next unless m.hp > 0
  611. m.gain_battle_sp
  612. end
  613. end
  614.  
  615. end
  616.  
  617. #===============================================================================
  618. class RPG::Actor < RPG::BaseItem
  619. #===============================================================================
  620. #-----------------------------------------------------------------------------
  621. #
  622. #-----------------------------------------------------------------------------
  623. def sug_id
  624. if self.note =~ Skill_Upgrade::SUG_Note
  625. return $1.to_i
  626. else
  627. return Skill_Upgrade::Default_Skill_Tree
  628. end
  629. end
  630.  
  631. end
  632.  
  633. #===============================================================================
  634. class RPG::Class < RPG::BaseItem
  635. #===============================================================================
  636. #-----------------------------------------------------------------------------
  637. #
  638. #-----------------------------------------------------------------------------
  639. def sug_id
  640. if self.note =~ Skill_Upgrade::SUG_Note
  641. return $1.to_i
  642. else
  643. return Skill_Upgrade::Default_Skill_Tree
  644. end
  645. end
  646.  
  647. end
  648.  
  649. #===============================================================================
  650. class RPG::Skill < RPG::UsableItem
  651. #===============================================================================
  652. #-----------------------------------------------------------------------------
  653. #
  654. #-----------------------------------------------------------------------------
  655. attr_accessor :sug_cost_id
  656. #-----------------------------------------------------------------------------
  657. #
  658. #-----------------------------------------------------------------------------
  659. def load_sug
  660. @sug_cost_id = Skill_Upgrade::Default_Cost_Setup
  661. check_sug_notetags
  662. end
  663. #-----------------------------------------------------------------------------
  664. #
  665. #-----------------------------------------------------------------------------
  666. def check_sug_notetags
  667. self.note.split(/[\r\n]+/).each do |line|
  668. case line
  669. when Skill_Upgrade::Cost_Note then @sug_cost_id = $1.to_i
  670. end
  671. end
  672. end
  673.  
  674. end # << RPG::BaseItem
  675.  
  676. #===============================================================================
  677. class RPG::UsableItem < RPG::BaseItem
  678. #===============================================================================
  679. #-----------------------------------------------------------------------------
  680. #
  681. #-----------------------------------------------------------------------------
  682. def sp_when_used
  683. if self.note =~ Skill_Upgrade::SP_Use_Note
  684. return $1.to_s
  685. else
  686. return Skill_Upgrade::SP_Settings[:each__use]
  687. end
  688. end
  689.  
  690. end
  691.  
  692. #===============================================================================
  693. class Game_Battler < Game_BattlerBase
  694. #===============================================================================
  695. #-----------------------------------------------------------------------------
  696. # Alias List
  697. #-----------------------------------------------------------------------------
  698. alias :_MDV__spexp :make_damage_value
  699. #-----------------------------------------------------------------------------
  700. # M.D.V
  701. #-----------------------------------------------------------------------------
  702. def make_damage_value(user, item)
  703. check_sp_gain(user,item)
  704. _MDV__spexp(user, item)
  705. end
  706. #-----------------------------------------------------------------------------
  707. # Check sp Gains
  708. #-----------------------------------------------------------------------------
  709. def check_sp_gain(user,item)
  710. return unless user.is_a?(Game_Actor)
  711. if item.is_a?(RPG::Skill)
  712. case item.id
  713. when user.attack_skill_id
  714. user.gain_attack_sp
  715. when user.guard_skill_id
  716. user.gain_guard_sp
  717. else
  718. user.gain_skill_sp
  719. end
  720. else
  721. user.gain_item_sp
  722. end
  723. user.gain_sp_for_use(item)
  724. end
  725.  
  726. end
  727.  
  728. #===============================================================================
  729. class Game_Actor < Game_Battler
  730. #===============================================================================
  731. #-----------------------------------------------------------------------------
  732. #
  733. #-----------------------------------------------------------------------------
  734. attr_accessor :skill_points
  735. #-----------------------------------------------------------------------------
  736. #
  737. #-----------------------------------------------------------------------------
  738. alias :setup_sug_actor :setup
  739. alias :lev_up_sug :level_up
  740. #-----------------------------------------------------------------------------
  741. #
  742. #-----------------------------------------------------------------------------
  743. def setup(actor_id)
  744. setup_sug_actor(actor_id)
  745. setup_sug_shit(actor_id)
  746. end
  747. #-----------------------------------------------------------------------------
  748. #
  749. #-----------------------------------------------------------------------------
  750. def setup_sug_shit(actor_id)
  751. @skill_points = Skill_Upgrade::Starting_SP[actor_id]
  752. end
  753. #-----------------------------------------------------------------------------
  754. #
  755. #-----------------------------------------------------------------------------
  756. def level_up
  757. lev_up_sug
  758. gain_sp_for_level
  759. end
  760. #-----------------------------------------------------------------------------
  761. #
  762. #-----------------------------------------------------------------------------
  763. def class_sug_id
  764. return $data_classes[@class_id].sug_id
  765. end
  766. #-----------------------------------------------------------------------------
  767. #
  768. #-----------------------------------------------------------------------------
  769. def sug_id
  770. defa = Skill_Upgrade::Default_Skill_Tree
  771. defa = class_sug_id if class_sug_id != Skill_Upgrade::Default_Skill_Tree
  772. defa = actor.sug_id if actor.sug_id != Skill_Upgrade::Default_Skill_Tree
  773. return defa
  774. end
  775. #-----------------------------------------------------------------------------
  776. # Get Learning Skill Conditions
  777. #-----------------------------------------------------------------------------
  778. def sug_conditions_met?(learning, mult, gold_fee, sklp_fee, exp_req)
  779. 8.times do |i|
  780. return false if @param_fix_II[i] < (learning.param_req[i] * mult).to_i
  781. end
  782. if $D13x[:Stats_Control]
  783. 10.times do |i|
  784. return false if @xparam_fix_II[i] < (learning.xpars_req[i] * mult).to_f
  785. end
  786. 10.times do |i|
  787. return false if @sparam_fix_II[i] < (learning.spars_req[i] * mult).to_f
  788. end
  789. end
  790. learning.swtch_req.each do |switch|
  791. return false if !$game_switches[ switch ]
  792. end
  793. learning.varis_req.each do |vari|
  794. return false if $game_variables[ vari[0] ] < (vari[1] * mult).to_i
  795. end
  796. learning.evals_req.each do |evl|
  797. return false if eval( evl.to_s )
  798. end
  799. if $D13x[:Elems_Control]
  800. $data_system.elements.size.times do |i|
  801. return false if @def_ele_fix_II[i] < learning.def_ele_req[i]
  802. return false if @atk_ele_fix_II[i] < learning.atk_ele_req[i]
  803. end
  804. end
  805. if $D13x[:Atk_Def_Lvs]
  806. 2.times do |i|
  807. return false if @atl_dfl_prefix[i] < learning.atl_dfl_req[i]
  808. end
  809. end
  810. if $D13x[:ISPDS]
  811. SPDS::Commands.each do |i|
  812. return false if parent_stat(i) < learning.spds_stats_req[i]
  813. end
  814. end
  815. learning.skill_req.each do |skil|
  816. return false if !skills.include?($data_skills[skil[0]])
  817. return false if skills_lv(skil[0]) < skil[1]
  818. end
  819. return false if @level < (learning.level_req * mult).to_i
  820. if Skill_Upgrade::Reqs[:exp]
  821. return false if exp_req > skills_exp(learning.id)
  822. end
  823. if Skill_Upgrade::Reqs[:gold]
  824. return false if $game_party.gold < gold_fee
  825. end
  826. if Skill_Upgrade::Reqs[:sp]
  827. return false if @skill_points < sklp_fee
  828. end
  829. return true
  830. end
  831. #-----------------------------------------------------------------------------
  832. #
  833. #-----------------------------------------------------------------------------
  834. def can_level_skill?(skill)
  835. have = skills.include?(skill)
  836. levz = skills_lv(skill.id) >= skill.max_lv
  837. return false if levz && (have == false)
  838. return true
  839. end
  840. #-----------------------------------------------------------------------------
  841. #
  842. #-----------------------------------------------------------------------------
  843. def sug_sp(type)
  844. return Skill_Upgrade::Sp_Settings[type]
  845. end
  846. #-----------------------------------------------------------------------------
  847. # Gain Battle Sp
  848. #-----------------------------------------------------------------------------
  849. def gain_battle_sp
  850. value = ([eval(sug_sp(:each_battle)), 0].max rescue 0)
  851. @skill_points += value
  852. end
  853. #-----------------------------------------------------------------------------
  854. # Gain Attack Sp
  855. #-----------------------------------------------------------------------------
  856. def gain_attack_sp
  857. value = ([eval(sug_sp(:each_attack)), 0].max rescue 0)
  858. @skill_points += value
  859. end
  860. #-----------------------------------------------------------------------------
  861. # Gain Guard Sp
  862. #-----------------------------------------------------------------------------
  863. def gain_guard_sp
  864. value = ([eval(sug_sp(:each_guard)), 0].max rescue 0)
  865. @skill_points += value
  866. end
  867. #-----------------------------------------------------------------------------
  868. # Gain Skill sp
  869. #-----------------------------------------------------------------------------
  870. def gain_skill_sp
  871. value = ([eval(sug_sp(:each_skill)), 0].max rescue 0)
  872. @skill_points += value
  873. end
  874. #-----------------------------------------------------------------------------
  875. # Gain Item Sp
  876. #-----------------------------------------------------------------------------
  877. def gain_item_sp
  878. value = ([eval(sug_sp(:each_item)), 0].max rescue 0)
  879. @skill_points += value
  880. end
  881. #-----------------------------------------------------------------------------
  882. # Gain Sp For Skill Use
  883. #-----------------------------------------------------------------------------
  884. def gain_sp_for_use(item)
  885. value = ([eval(item.sp_when_used), 0].max rescue 0)
  886. @skill_points += value
  887. end
  888. #-----------------------------------------------------------------------------
  889. # Gain Sp For Level Up
  890. #-----------------------------------------------------------------------------
  891. def gain_sp_for_level
  892. value = ([eval(Skill_Upgrade::SP_Settings[:each_lvl_up]), 0].max rescue 0)
  893. @skill_points += value
  894. end
  895. #-----------------------------------------------------------------------------
  896. # Gain Sp For Skill Use
  897. #-----------------------------------------------------------------------------
  898. def gain_general_sp(eVal)
  899. value = ([eval(eVal), 0].max rescue 0)
  900. @skill_points += value
  901. end
  902.  
  903. end
  904.  
  905. #===============================================================================
  906. class SUG_Sml_Window < Window_Selectable
  907. #===============================================================================
  908. #-----------------------------------------------------------------------------
  909. #
  910. #-----------------------------------------------------------------------------
  911. def initialize(actor,x,y)
  912. w = Graphics.width / 3 + 1
  913. h = fitting_height( 2 )
  914. super(x, y+8, w, h)
  915. @actor = actor
  916. refresh
  917. end
  918. #-----------------------------------------------------------------------------
  919. #
  920. #-----------------------------------------------------------------------------
  921. def standard_padding
  922. return 8
  923. end
  924. #-----------------------------------------------------------------------------
  925. #
  926. #-----------------------------------------------------------------------------
  927. def actor=(actor)
  928. return if @actor == actor
  929. @actor = actor
  930. refresh
  931. end
  932. #-----------------------------------------------------------------------------
  933. #
  934. #-----------------------------------------------------------------------------
  935. def refresh
  936. contents.clear
  937. return unless @actor
  938. reset_font_settings
  939. draw_skill_pts
  940. draw_gold
  941. end
  942. #-----------------------------------------------------------------------------
  943. #
  944. #-----------------------------------------------------------------------------
  945. def reset_font_settings
  946. change_color(normal_color)
  947. self.contents.font.name = General::Fonts
  948. self.contents.font.size = General::Font_Size
  949. self.contents.font.bold = General::Font_Bold
  950. end
  951. #-----------------------------------------------------------------------------
  952. #
  953. #-----------------------------------------------------------------------------
  954. def draw_skill_pts
  955. pts = @actor.skill_points.to_i
  956. contents.fill_rect(0,0,self.width-16,line_height-2,Color.new(0,0,0,64))
  957. draw_text(4, 0, self.width-24, line_height,Skill_Upgrade::SP_Vocab[0],0)
  958. draw_text(0, 0, self.width-20, line_height, pts ,2)
  959. end
  960. #-----------------------------------------------------------------------------
  961. #
  962. #-----------------------------------------------------------------------------
  963. def draw_gold
  964. pts = $game_party.gold
  965. contents.fill_rect(0,24,self.width-16,line_height-2,Color.new(0,0,0,64))
  966. draw_text(4, 24, self.width-24, line_height, "#{Vocab.currency_unit}:",0)
  967. draw_text(0, 24, self.width-20, line_height, pts ,2)
  968. end
  969.  
  970. end
  971.  
  972. #===============================================================================
  973. class SUG_Main_Window < Window_Selectable
  974. #===============================================================================
  975. #-----------------------------------------------------------------------------
  976. #
  977. #-----------------------------------------------------------------------------
  978. def initialize(actor, y)
  979. h = Graphics.height - y
  980. super(0, y, Graphics.width/3*2, h)
  981. @actor = actor
  982. refresh
  983. activate
  984. end
  985. #-----------------------------------------------------------------------------
  986. #
  987. #-----------------------------------------------------------------------------
  988. def actor=(actor)
  989. return if @actor == actor
  990. @actor = actor
  991. refresh
  992. end
  993. #-----------------------------------------------------------------------------
  994. #
  995. #-----------------------------------------------------------------------------
  996. def refresh
  997. contents.clear
  998. end
  999.  
  1000. end
  1001.  
  1002. #===============================================================================
  1003. class SUG_Data_Window < Window_Selectable
  1004. #===============================================================================
  1005. #-----------------------------------------------------------------------------
  1006. #
  1007. #-----------------------------------------------------------------------------
  1008. attr_reader :gotsk
  1009. attr_reader :sk_lv
  1010. attr_reader :skill
  1011. #-----------------------------------------------------------------------------
  1012. #
  1013. #-----------------------------------------------------------------------------
  1014. def initialize(actor,skill,data,y,d)
  1015. x = Graphics.width/3*2
  1016. w = Graphics.width/3+1
  1017. h = Graphics.height-y-d
  1018. super(x, y, w, h)
  1019. @actor = actor
  1020. @skill = skill
  1021. @data = data
  1022. refresh
  1023. activate
  1024. end
  1025. #-----------------------------------------------------------------------------
  1026. #
  1027. #-----------------------------------------------------------------------------
  1028. def standard_padding
  1029. return 4
  1030. end
  1031. #-----------------------------------------------------------------------------
  1032. #
  1033. #-----------------------------------------------------------------------------
  1034. def actor=(actor)
  1035. return if @actor == actor
  1036. @actor = actor
  1037. refresh
  1038. end
  1039. #-----------------------------------------------------------------------------
  1040. #
  1041. #-----------------------------------------------------------------------------
  1042. def skill=(skill)
  1043. return if @skill == skill
  1044. @skill = skill
  1045. refresh
  1046. end
  1047. #-----------------------------------------------------------------------------
  1048. #
  1049. #-----------------------------------------------------------------------------
  1050. def data=(data)
  1051. return if @data == data
  1052. @data = data
  1053. refresh
  1054. end
  1055. #-----------------------------------------------------------------------------
  1056. #
  1057. #-----------------------------------------------------------------------------
  1058. def refresh
  1059. contents.clear
  1060. return unless @actor
  1061. return unless @skill
  1062. return unless @data
  1063. reset_font_settings
  1064. draw_all_sug_info
  1065. end
  1066. #-----------------------------------------------------------------------------
  1067. #
  1068. #-----------------------------------------------------------------------------
  1069. def reset_font_settings
  1070. change_color(normal_color)
  1071. self.contents.font.name = General::Fonts
  1072. self.contents.font.size = General::Font_Size
  1073. self.contents.font.bold = General::Font_Bold
  1074. end
  1075. #-----------------------------------------------------------------------------
  1076. #
  1077. #-----------------------------------------------------------------------------
  1078. def box_color
  1079. return Color.new(0,0,0,64)
  1080. end
  1081. #-----------------------------------------------------------------------------
  1082. #
  1083. #-----------------------------------------------------------------------------
  1084. def draw_all_sug_info
  1085. @de_x = 4
  1086. @de_y = 30
  1087. @gotsk = @actor.skills.include?(@skill)
  1088. @sk_lv = @actor.skills_lv(@skill.id)
  1089. draw_name
  1090. draw_level
  1091. draw_exp_req if Skill_Upgrade::Draw_Exp_Req
  1092. draw_sp_cost if Skill_Upgrade::Draw_SP_Req
  1093. draw_gold_cost if Skill_Upgrade::Draw_Gold_Req
  1094. draw_requirements
  1095. end
  1096. #-----------------------------------------------------------------------------
  1097. #
  1098. #-----------------------------------------------------------------------------
  1099. def skill_maxed?
  1100. return @actor.skills_lv(@skill.id) >= $data_skills[@skill.id].max_lv
  1101. end
  1102. #-----------------------------------------------------------------------------
  1103. #
  1104. #-----------------------------------------------------------------------------
  1105. def draw_name
  1106. contents.fill_rect(@de_x,4,self.width-16,line_height, box_color)
  1107. draw_de_icon(@skill.icon_index,@de_x, 4, hue = 0, enabled = true)
  1108. draw_text(@de_x, 4, self.width-16, line_height, @skill.name,1)
  1109. end
  1110. #-----------------------------------------------------------------------------
  1111. #
  1112. #-----------------------------------------------------------------------------
  1113. def draw_level
  1114. contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
  1115. if skill_maxed?
  1116. text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv][1]
  1117. else
  1118. text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv+1][1]
  1119. end
  1120. text = "Learn" if !@gotsk
  1121. text = "MASTERED" if @gotsk && skill_maxed?
  1122. draw_text(@de_x, 28, self.width-16, line_height, text, 1) if @skill.show_exp_data
  1123. @de_y += 20
  1124. end
  1125. #-----------------------------------------------------------------------------
  1126. #
  1127. #-----------------------------------------------------------------------------
  1128. def draw_exp_req
  1129. contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
  1130. if @gotsk
  1131. draw_text(@de_x+4,@de_y-2,self.width-16,line_height, "Exp Req:")
  1132. if skill_maxed?
  1133. gote = "--"
  1134. need = "--"
  1135. else
  1136. gote = @actor.skills_exp(@skill.id)
  1137. need = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv+1][0]
  1138. end
  1139. draw_text(@de_x,@de_y-2, self.width-20, line_height, "#{gote}/#{need}", 2)
  1140. else
  1141. draw_text(@de_x+4,@de_y-2,self.width-16, line_height, "Exp Req:")
  1142. draw_text(@de_x,@de_y-2,self.width-20, line_height, "--/--", 2)
  1143. end
  1144. @de_y += 20
  1145. end
  1146. #-----------------------------------------------------------------------------
  1147. #
  1148. #-----------------------------------------------------------------------------
  1149. def draw_sp_cost
  1150. contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
  1151. draw_text(@de_x+4,@de_y-2, self.width-16, line_height,Skill_Upgrade::SP_Vocab[1])
  1152. if skill_maxed?
  1153. need = "--"
  1154. else
  1155. need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv+1][:sp]
  1156. need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv][:sp] if !@gotsk
  1157. end
  1158. draw_text(@de_x,@de_y-2, self.width-20, line_height, "#{need}", 2)
  1159. @de_y += 20
  1160. end
  1161. #-----------------------------------------------------------------------------
  1162. #
  1163. #-----------------------------------------------------------------------------
  1164. def draw_gold_cost
  1165. contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
  1166. text = "#{Vocab.currency_unit} Cost:"
  1167. draw_text(@de_x+4,@de_y-2,self.width-16, line_height, text)
  1168. if skill_maxed?
  1169. need = "--"
  1170. else
  1171. need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv+1][:gold]
  1172. need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv][:gold] if !@gotsk
  1173. end
  1174. draw_text(@de_x,@de_y-2,self.width-20,line_height,"#{need}", 2)
  1175. @de_y += 20
  1176. end
  1177. #-----------------------------------------------------------------------------
  1178. #
  1179. #-----------------------------------------------------------------------------
  1180. def draw_requirements
  1181. y = @de_y
  1182. sklv = Skill_Levels::Exp_Set[@skill.exp_set]
  1183. if skill_maxed?
  1184. mult = sklv[@sk_lv ][2]
  1185. else
  1186. mult = sklv[@sk_lv+1][2]
  1187. mult = sklv[@sk_lv ][2] if !@gotsk
  1188. end
  1189. 8.times do |i|
  1190. if (@skill.param_req[i] * mult).to_i != 0
  1191. y = draw_param_req(y,i,mult)
  1192. end
  1193. end
  1194. if $D13x[:Stats_Control]
  1195. 7.times do |i|
  1196. if (@skill.xpars_req[i] * mult).to_i != 0.0
  1197. y = draw_xparam_req(y,i,mult)
  1198. end
  1199. end
  1200. 3.times do |i|
  1201. if (@skill.xpars_req[i+7] * mult).to_f > (-1.0)
  1202. y = draw_xparam_req(y,i+7,mult)
  1203. end
  1204. end
  1205. 10.times do |i|
  1206. if (@skill.spars_req[i] * mult).to_i != 0.0
  1207. y = draw_sparam_req(y,i,mult)
  1208. end
  1209. end
  1210. end
  1211. @skill.swtch_req.each do |switch|
  1212. if !$game_switches[ switch ]
  1213. y = draw_switch_req(y,switch)
  1214. end
  1215. end
  1216. @skill.varis_req.each do |vari|
  1217. if $game_variables[ vari[0] ] < (vari[1] * mult).to_i
  1218. y = draw_var_req(y,vari,mult)
  1219. end
  1220. end
  1221. @skill.evals_req.each do |evl|
  1222. if eval( evl.to_s )
  1223. y = draw_eval_req(y,mult)
  1224. end
  1225. end
  1226. if $D13x[:Elems_Control]
  1227. $data_system.elements.size.times do |i|
  1228. if @skill.atk_ele_req[i]*mult > (-2.0)
  1229. y = draw_atke_req(y,i,mult)
  1230. end
  1231. if @skill.def_ele_req[i]*mult > (-2.0)
  1232. y = draw_defe_req(y,i,mult)
  1233. end
  1234. end
  1235. end
  1236. if $D13x[:Atk_Def_Lvs]
  1237. 2.times do |i|
  1238. if @skill.atl_dfl_req[i]*mult.to_i != 0
  1239. y = draw_atldfl_req(y,i,mult)
  1240. end
  1241. end
  1242. end
  1243. if $D13x[:ISPDS]
  1244. SPDS::Commands.each do |i|
  1245. if @skill.spds_stats_req[i]*mult != 0
  1246. y = draw_ispds_req(y,i,mult)
  1247. end
  1248. end
  1249. end
  1250. @skill.skill_req.each do |skil|
  1251. if @actor.skills_lv(skil[0]) < skil[1]
  1252. y = draw_skill_lv_req(y,$data_skills[skil[0]],skil[1])
  1253. else
  1254. y = draw_skill_req(y,$data_skills[ skil[0] ] )
  1255. end
  1256. end
  1257. y = draw_level_req(y,@skill.level_req)
  1258. end
  1259. #-----------------------------------------------------------------------------
  1260. #
  1261. #-----------------------------------------------------------------------------
  1262. def draw_param_req(y,i,m)
  1263. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1264. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.param(i)}:")
  1265. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.param_req[i]*m).to_i}",2)
  1266. return y += 20
  1267. end
  1268. #-----------------------------------------------------------------------------
  1269. #
  1270. #-----------------------------------------------------------------------------
  1271. def draw_xparam_req(y,i,m)
  1272. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1273. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.x_param(i)}:")
  1274. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.xpars_req[i]*m).to_f}",2)
  1275. return y += 20
  1276. end
  1277. #-----------------------------------------------------------------------------
  1278. #
  1279. #-----------------------------------------------------------------------------
  1280. def draw_sparam_req(y,i,m)
  1281. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1282. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.s_param(i)}:")
  1283. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.spars_req[i]*m).to_f}",2)
  1284. return y += 20
  1285. end
  1286. #-----------------------------------------------------------------------------
  1287. #
  1288. #-----------------------------------------------------------------------------
  1289. def draw_switch_req(y,switch)
  1290. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1291. draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
  1292. return y += 20
  1293. end
  1294. #-----------------------------------------------------------------------------
  1295. #
  1296. #-----------------------------------------------------------------------------
  1297. def draw_var_req(y,var,m)
  1298. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1299. draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
  1300. return y += 20
  1301. end
  1302. #-----------------------------------------------------------------------------
  1303. #
  1304. #-----------------------------------------------------------------------------
  1305. def draw_eval_req(y)
  1306. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1307. draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
  1308. return y += 20
  1309. end
  1310. #-----------------------------------------------------------------------------
  1311. #
  1312. #-----------------------------------------------------------------------------
  1313. def draw_atke_req(y,i,m)
  1314. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1315. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{$data_system.elements[i]}:")
  1316. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.atk_ele_req[i]*m).to_f}",2)
  1317. return y += 20
  1318. end
  1319. #-----------------------------------------------------------------------------
  1320. #
  1321. #-----------------------------------------------------------------------------
  1322. def draw_defe_req(y,i,m)
  1323. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1324. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{$data_system.elements[i]}:")
  1325. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.def_ele_req[i]*m).to_f}",2)
  1326. return y += 20
  1327. end
  1328. #-----------------------------------------------------------------------------
  1329. #
  1330. #-----------------------------------------------------------------------------
  1331. def draw_atldfl_req(y,i,m)
  1332. name = Atl_Dfl::Atl_Name if i == 0
  1333. name = Atl_Dfl::Atl_Name if i == 1
  1334. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1335. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{name}:")
  1336. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.atl_dfl_req[i]*m).to_i}",2)
  1337. return y += 20
  1338. end
  1339. #-----------------------------------------------------------------------------
  1340. #
  1341. #-----------------------------------------------------------------------------
  1342. def draw_ispds_req(y,i,m)
  1343. com = SPDS::Commands[i]
  1344. return y unless @actor.spds_set[com]
  1345. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1346. draw_text(@de_x+4, y-2, self.width-16, line_height, "Req #{@actor.spds_set[com][:name]}:")
  1347. draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.spds_stats_req[i]*m).to_i}",2)
  1348. return y += 20
  1349. end
  1350. #-----------------------------------------------------------------------------
  1351. #
  1352. #-----------------------------------------------------------------------------
  1353. def draw_skill_req(y,skil)
  1354. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1355. draw_text(@de_x+4, y-2, self.width-16, line_height, "#{skil.name}:")
  1356. text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv][1]
  1357. draw_text(@de_x, y-2, self.width-20-(self.width/4), line_height, "#{text}",2)
  1358. return y += 20
  1359. end
  1360. #-----------------------------------------------------------------------------
  1361. #
  1362. #-----------------------------------------------------------------------------
  1363. def draw_skill_lv_req(y,skil,req_lv)
  1364. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1365. draw_text(@de_x+4, y-2, self.width-16, line_height, "Req Skill:")
  1366. text = Skill_Levels::Exp_Set[@skill.exp_set][req_lv][1]
  1367. draw_text(@de_x, y-2, self.width-20, line_height, "#{skil.name} #{text}",2)
  1368. return y += 20
  1369. end
  1370. #-----------------------------------------------------------------------------
  1371. #
  1372. #-----------------------------------------------------------------------------
  1373. def draw_level_req(y,req_lv)
  1374. contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
  1375. draw_text(@de_x+4, y-2, self.width-16, line_height, "Req #{Vocab.level}:")
  1376. draw_text(@de_x, y-2, self.width-20, line_height, "#{req_lv}",2)
  1377. return y += 20
  1378. end
  1379.  
  1380. end
  1381.  
  1382. #===============================================================================
  1383. class Window_SUGCommand < Window_Command
  1384. #===============================================================================
  1385. #-----------------------------------------------------------------------------
  1386. #
  1387. #-----------------------------------------------------------------------------
  1388. def initialize(x, y)
  1389. @can_buy = true
  1390. super(x, y)
  1391. select(-1)
  1392. deactivate
  1393. end
  1394. #-----------------------------------------------------------------------------
  1395. #
  1396. #-----------------------------------------------------------------------------
  1397. def can_buy?
  1398. return @can_buy
  1399. end
  1400. #-----------------------------------------------------------------------------
  1401. #
  1402. #-----------------------------------------------------------------------------
  1403. def change_can_buy(val)
  1404. @can_buy = val
  1405. refresh
  1406. end
  1407. #-----------------------------------------------------------------------------
  1408. #
  1409. #-----------------------------------------------------------------------------
  1410. def alignment
  1411. return 1
  1412. end
  1413. #-----------------------------------------------------------------------------
  1414. #
  1415. #-----------------------------------------------------------------------------
  1416. def window_width
  1417. return Graphics.width / 4
  1418. end
  1419. #-----------------------------------------------------------------------------
  1420. #
  1421. #-----------------------------------------------------------------------------
  1422. def window_height
  1423. return fitting_height(2)
  1424. end
  1425. #-----------------------------------------------------------------------------
  1426. #
  1427. #-----------------------------------------------------------------------------
  1428. def make_command_list
  1429. add_command("Purchase", :buy_skill, can_buy?)
  1430. add_command("Back", :no_buy)
  1431. end
  1432.  
  1433. end
  1434.  
  1435. #===============================================================================
  1436. class SUG_Icon
  1437. #===============================================================================
  1438. #-----------------------------------------------------------------------------
  1439. # Pi Variables
  1440. #-----------------------------------------------------------------------------
  1441. attr_reader :data, :l, :r, :u, :d, :selected
  1442. #-----------------------------------------------------------------------------
  1443. # Initialize
  1444. #-----------------------------------------------------------------------------
  1445. def initialize(data, y, actor)
  1446. @selected = false
  1447. @actor = actor
  1448. @data = data
  1449. @y_val = y
  1450. make_back
  1451. make_icon
  1452. make_dirs
  1453. end
  1454. #-----------------------------------------------------------------------------
  1455. # Dispose
  1456. #-----------------------------------------------------------------------------
  1457. def dispose
  1458. disp_back
  1459. disp_icon
  1460. disp_dirs
  1461. end
  1462. #-----------------------------------------------------------------------------
  1463. # Update
  1464. #-----------------------------------------------------------------------------
  1465. def update
  1466. updt_back
  1467. updt_icon
  1468. updt_dirs
  1469. end
  1470. #-----------------------------------------------------------------------------
  1471. #
  1472. #-----------------------------------------------------------------------------
  1473. def x
  1474. return @data[:pos][0]
  1475. end
  1476. #-----------------------------------------------------------------------------
  1477. #
  1478. #-----------------------------------------------------------------------------
  1479. def y
  1480. return @data[:pos][1]+@y_val
  1481. end
  1482. #-----------------------------------------------------------------------------
  1483. #
  1484. #-----------------------------------------------------------------------------
  1485. def make_back
  1486. @back = Sprite.new
  1487. dat = Skill_Upgrade::Skill_Bx
  1488. @back.bitmap = Cache.sd13x_sug(dat[0],dat[1])
  1489. @back.x = @data[:pos][0]
  1490. @back.y = @data[:pos][1]+@y_val
  1491. @back.z = 200
  1492. end
  1493. #-----------------------------------------------------------------------------
  1494. #
  1495. #-----------------------------------------------------------------------------
  1496. def disp_back
  1497. @back.bitmap.dispose
  1498. @back.dispose
  1499. end
  1500. #-----------------------------------------------------------------------------
  1501. #
  1502. #-----------------------------------------------------------------------------
  1503. def updt_back
  1504. @back.update
  1505. end
  1506. #-----------------------------------------------------------------------------
  1507. #
  1508. #-----------------------------------------------------------------------------
  1509. def make_icon
  1510. i = $data_skills[@data[:skill]].icon_index
  1511. @icon = Sprite.new
  1512. @icon.bitmap = Cache.system(Skill_Upgrade::Iconset)
  1513. rect = Rect.new(i % 16 * 24, i / 16 * 24, 24, 24)
  1514. @icon.bitmap.blt(0, 0, @icon.bitmap, rect)
  1515. @icon.src_rect.set(rect.x, rect.y, 24, 24)
  1516. @icon.x = @back.x+1
  1517. @icon.y = @back.y+1
  1518. @icon.z = @back.z+1
  1519. end
  1520. #-----------------------------------------------------------------------------
  1521. #
  1522. #-----------------------------------------------------------------------------
  1523. def disp_icon
  1524. @icon.bitmap.dispose
  1525. @icon.dispose
  1526. end
  1527. #-----------------------------------------------------------------------------
  1528. #
  1529. #-----------------------------------------------------------------------------
  1530. def updt_icon
  1531. @icon.update
  1532. end
  1533. #-----------------------------------------------------------------------------
  1534. #
  1535. #-----------------------------------------------------------------------------
  1536. def make_dirs
  1537. make_l
  1538. make_r
  1539. make_u
  1540. make_d
  1541. end
  1542. #-----------------------------------------------------------------------------
  1543. #
  1544. #-----------------------------------------------------------------------------
  1545. def arw(dir)
  1546. return Skill_Upgrade::Arrows[dir]
  1547. end
  1548. #-----------------------------------------------------------------------------
  1549. #
  1550. #-----------------------------------------------------------------------------
  1551. def make_l
  1552. if @data[:dir][:l][0] != nil
  1553. @l = true
  1554. return unless @data[:dir][:l][1]
  1555. @ls = Sprite.new
  1556. @ls.bitmap = Cache.sd13x_sug(arw(:L)[0],arw(:L)[1])
  1557. @ls.x = @back.x-(@ls.bitmap.width)+1
  1558. @ls.y = @back.y+2
  1559. @ls.z = @back.z+2
  1560. end
  1561. end
  1562. #-----------------------------------------------------------------------------
  1563. #
  1564. #-----------------------------------------------------------------------------
  1565. def make_r
  1566. if @data[:dir][:r][0] != nil
  1567. @r = true
  1568. return unless @data[:dir][:r][1]
  1569. @rs = Sprite.new
  1570. @rs.bitmap = Cache.sd13x_sug(arw(:R)[0],arw(:R)[1])
  1571. @rs.x = @back.x+@back.width-1
  1572. @rs.y = @back.y+2
  1573. @rs.z = @back.z+2
  1574. end
  1575. end
  1576. #-----------------------------------------------------------------------------
  1577. #
  1578. #-----------------------------------------------------------------------------
  1579. def make_u
  1580. if @data[:dir][:u][0] != nil
  1581. @u = true
  1582. return unless @data[:dir][:u][1]
  1583. @us = Sprite.new
  1584. @us.bitmap = Cache.sd13x_sug(arw(:U)[0],arw(:U)[1])
  1585. @us.x = @back.x+2
  1586. @us.y = @back.y-(@us.bitmap.height)+1
  1587. @us.z = @back.z+2
  1588. end
  1589. end
  1590. #-----------------------------------------------------------------------------
  1591. #
  1592. #-----------------------------------------------------------------------------
  1593. def make_d
  1594. if @data[:dir][:d][0] != nil
  1595. @d = true
  1596. return unless @data[:dir][:d][1]
  1597. @ds = Sprite.new
  1598. @ds.bitmap = Cache.sd13x_sug(arw(:D)[0],arw(:D)[1])
  1599. @ds.x = @back.x+2
  1600. @ds.y = @back.y+@back.height-1
  1601. @ds.z = @back.z+2
  1602. end
  1603. end
  1604. #-----------------------------------------------------------------------------
  1605. #
  1606. #-----------------------------------------------------------------------------
  1607. def disp_dirs
  1608. if @ls
  1609. @ls.bitmap.dispose
  1610. @ls.dispose
  1611. end
  1612. if @rs
  1613. @rs.bitmap.dispose
  1614. @rs.dispose
  1615. end
  1616. if @us
  1617. @us.bitmap.dispose
  1618. @us.dispose
  1619. end
  1620. if @ds
  1621. @ds.bitmap.dispose
  1622. @ds.dispose
  1623. end
  1624. end
  1625. #-----------------------------------------------------------------------------
  1626. #
  1627. #-----------------------------------------------------------------------------
  1628. def updt_dirs
  1629. if @ls
  1630. @ls.update
  1631. end
  1632. if @rs
  1633. @rs.update
  1634. end
  1635. if @ds
  1636. @ds.update
  1637. end
  1638. if @us
  1639. @us.update
  1640. end
  1641. end
  1642. #-----------------------------------------------------------------------------
  1643. #
  1644. #-----------------------------------------------------------------------------
  1645. def select
  1646. return if @selected
  1647. @selected = true
  1648. end
  1649. #-----------------------------------------------------------------------------
  1650. #
  1651. #-----------------------------------------------------------------------------
  1652. def unselect
  1653. return unless @selected
  1654. @selected = false
  1655. end
  1656.  
  1657. end
  1658.  
  1659. #===============================================================================
  1660. class SUG_Window
  1661. #===============================================================================
  1662. #-----------------------------------------------------------------------------
  1663. #
  1664. #-----------------------------------------------------------------------------
  1665. def initialize(actor, y)
  1666. @actor = actor
  1667. @y_val = y
  1668. make_skills
  1669. make_command
  1670. end
  1671. #-----------------------------------------------------------------------------
  1672. #
  1673. #-----------------------------------------------------------------------------
  1674. def actor=(actor)
  1675. return unless @actor != actor
  1676. @actor = actor
  1677. disp_skills
  1678. disp_command
  1679. make_skills
  1680. make_command
  1681. end
  1682. #-----------------------------------------------------------------------------
  1683. #
  1684. #-----------------------------------------------------------------------------
  1685. def dispose
  1686. disp_skills
  1687. disp_command
  1688. end
  1689. #-----------------------------------------------------------------------------
  1690. #
  1691. #-----------------------------------------------------------------------------
  1692. def update
  1693. updt_skills
  1694. updt_command
  1695. updt_inputs
  1696. end
  1697. #-----------------------------------------------------------------------------
  1698. #
  1699. #-----------------------------------------------------------------------------
  1700. def make_skills
  1701. @skills = []
  1702. Skill_Upgrade::Tree[@actor.sug_id].each do |i|
  1703. @skills << SUG_Icon.new(i, @y_val, @actor)
  1704. end
  1705. end
  1706. #-----------------------------------------------------------------------------
  1707. #
  1708. #-----------------------------------------------------------------------------
  1709. def disp_skills
  1710. return unless @skills
  1711. @skills.each do |i|
  1712. i.dispose
  1713. end
  1714. end
  1715. #-----------------------------------------------------------------------------
  1716. #
  1717. #-----------------------------------------------------------------------------
  1718. def updt_skills
  1719. @skills.each do |i|
  1720. i.update
  1721. end
  1722. end
  1723. #-----------------------------------------------------------------------------
  1724. #
  1725. #-----------------------------------------------------------------------------
  1726. def make_command
  1727. @curr_comm = 0
  1728. @comm = Sprite.new
  1729. dat = Skill_Upgrade::Selected
  1730. @comm.bitmap = Cache.sd13x_sug(dat[0],dat[1])
  1731. @comm.x = @skills[@curr_comm].x
  1732. @comm.y = @skills[@curr_comm].y
  1733. @comm.z = 205
  1734. end
  1735. #-----------------------------------------------------------------------------
  1736. #
  1737. #-----------------------------------------------------------------------------
  1738. def disp_command
  1739. return unless @comm
  1740. @comm.bitmap.dispose
  1741. @comm.dispose
  1742. end
  1743. #-----------------------------------------------------------------------------
  1744. #
  1745. #-----------------------------------------------------------------------------
  1746. def updt_command
  1747. return unless @comm
  1748. @comm.update
  1749. end
  1750. #-----------------------------------------------------------------------------
  1751. #
  1752. #-----------------------------------------------------------------------------
  1753. def updt_inputs
  1754. return unless @comm
  1755. if Keys.trigger?(Keys::Key[:UP]) && @skills[@curr_comm].u
  1756. @curr_comm = @skills[@curr_comm].data[:dir][:u][0]
  1757. play_cursor
  1758. end
  1759. if Keys.trigger?(Keys::Key[:DOWN]) && @skills[@curr_comm].d
  1760. @curr_comm = @skills[@curr_comm].data[:dir][:d][0]
  1761. play_cursor
  1762. end
  1763. if Keys.trigger?(Keys::Key[:LEFT]) && @skills[@curr_comm].l
  1764. @curr_comm = @skills[@curr_comm].data[:dir][:l][0]
  1765. play_cursor
  1766. end
  1767. if Keys.trigger?(Keys::Key[:RIGHT]) && @skills[@curr_comm].r
  1768. @curr_comm = @skills[@curr_comm].data[:dir][:r][0]
  1769. play_cursor
  1770. end
  1771. if @comm.x != @skills[@curr_comm].x || @comm.y != @skills[@curr_comm].y
  1772. @comm.x = @skills[@curr_comm].x
  1773. @comm.y = @skills[@curr_comm].y
  1774. end
  1775. end
  1776. #-----------------------------------------------------------------------------
  1777. #
  1778. #-----------------------------------------------------------------------------
  1779. def play_cursor
  1780. RPG::SE.new(Skill_Upgrade::Cursor_Move_Sound).play
  1781. end
  1782. #-----------------------------------------------------------------------------
  1783. #
  1784. #-----------------------------------------------------------------------------
  1785. def skill
  1786. return $data_skills[@skills[@curr_comm].data[:skill]]
  1787. end
  1788. #-----------------------------------------------------------------------------
  1789. #
  1790. #-----------------------------------------------------------------------------
  1791. def data
  1792. return @skills[@curr_comm].data
  1793. end
  1794.  
  1795. end
  1796.  
  1797. #===============================================================================
  1798. class SUG_Scene < Scene_MenuBase
  1799. #===============================================================================
  1800. #-----------------------------------------------------------------------------
  1801. #
  1802. #-----------------------------------------------------------------------------
  1803. def start
  1804. super
  1805. create_help_window
  1806. create_status_window
  1807. create_main_window
  1808. create_SUG_window
  1809. create_small_window
  1810. create_data_window
  1811. create_command_window
  1812. update_can_buy_info(true)
  1813. end
  1814. #-----------------------------------------------------------------------------
  1815. #
  1816. #-----------------------------------------------------------------------------
  1817. def terminate
  1818. super
  1819. @SUG_window.dispose
  1820. end
  1821. #-----------------------------------------------------------------------------
  1822. #
  1823. #-----------------------------------------------------------------------------
  1824. def create_small_window
  1825. x = Graphics.width/3*2
  1826. y = Graphics.height-@help_window.height
  1827. @small_window = SUG_Sml_Window.new(@actor,x,y)
  1828. end
  1829. #-----------------------------------------------------------------------------
  1830. #
  1831. #-----------------------------------------------------------------------------
  1832. def create_help_window
  1833. @help_window = Deki_Help.new
  1834. @help_window.viewport = @viewport
  1835. @help_window.x = Graphics.width / 4
  1836. end
  1837. #-----------------------------------------------------------------------------
  1838. #
  1839. #-----------------------------------------------------------------------------
  1840. def create_status_window
  1841. @status_window = Window_StatusDekita.new(@actor,@help_window.height)
  1842. end
  1843. #-----------------------------------------------------------------------------
  1844. #
  1845. #-----------------------------------------------------------------------------
  1846. def create_main_window
  1847. y = @status_window.y + @status_window.height
  1848. @main_window = SUG_Main_Window.new(@actor, y)
  1849. end
  1850. #-----------------------------------------------------------------------------
  1851. #
  1852. #-----------------------------------------------------------------------------
  1853. def create_SUG_window
  1854. @SUG_window = SUG_Window.new(@actor, @main_window.y)
  1855. @help_window.set_item(@SUG_window.skill)
  1856. end
  1857. #-----------------------------------------------------------------------------
  1858. #
  1859. #-----------------------------------------------------------------------------
  1860. def create_data_window
  1861. skill = @SUG_window.skill
  1862. data = @SUG_window.data
  1863. d = @small_window.height
  1864. @data_window = SUG_Data_Window.new(@actor,skill,data,@main_window.y,d)
  1865. end
  1866. #-----------------------------------------------------------------------------
  1867. #
  1868. #-----------------------------------------------------------------------------
  1869. def create_command_window
  1870. @command_window = Window_SUGCommand.new(0,0)
  1871. @command_window.set_handler(:buy_skill, method(:buy_skill))
  1872. @command_window.set_handler(:no_buy, method(:leave_skill))
  1873. end
  1874. #-----------------------------------------------------------------------------
  1875. #
  1876. #-----------------------------------------------------------------------------
  1877. def update
  1878. super
  1879. @SUG_window.update if !@command_window.active
  1880. @data_window.skill = @SUG_window.skill
  1881. @data_window.data = @SUG_window.data
  1882. update_help
  1883. update_presses
  1884. end
  1885. #-----------------------------------------------------------------------------
  1886. #
  1887. #-----------------------------------------------------------------------------
  1888. def update_help
  1889. if @command_window.active
  1890. skill = @data_window.skill
  1891. sk_lv = @actor.skills_lv(skill.database_id)
  1892. suggg = Skill_Upgrade::Cost_Setup[skill.sug_cost_id]
  1893. need = suggg[sk_lv][:sp]
  1894. gold = suggg[sk_lv][:gold]
  1895. if @data_window.gotsk && !@data_window.skill_maxed?
  1896. need = suggg[sk_lv+1][:sp]
  1897. gold = suggg[sk_lv+1][:gold]
  1898. end
  1899. text = Skill_Upgrade.confirm(@SUG_window.skill)
  1900. @help_window.set_text(text)
  1901. else
  1902. @help_window.set_text(@SUG_window.skill.description)
  1903. end
  1904. end
  1905. #-----------------------------------------------------------------------------
  1906. #
  1907. #-----------------------------------------------------------------------------
  1908. def update_presses
  1909. update_can_buy_info
  1910. update_enter_press
  1911. update_back_press
  1912. end
  1913. #-----------------------------------------------------------------------------
  1914. #
  1915. #-----------------------------------------------------------------------------
  1916. def update_enter_press
  1917. return if @command_window.active
  1918. if Keys.trigger?(Keys::Key[:ENTER])
  1919. Sound.play_ok
  1920. @command_window.activate
  1921. @command_window.select(0)
  1922. end
  1923. end
  1924. #-----------------------------------------------------------------------------
  1925. #
  1926. #-----------------------------------------------------------------------------
  1927. def update_can_buy_info(bypass=false)
  1928. return if @command_window.active unless bypass
  1929. u = Keys.trigger?(Keys::Key[:UP])
  1930. d = Keys.trigger?(Keys::Key[:DOWN])
  1931. l = Keys.trigger?(Keys::Key[:LEFT])
  1932. r = Keys.trigger?(Keys::Key[:RIGHT])
  1933. return unless u || d || l || r || bypass
  1934. a = @actor.skills_lv(@data_window.skill.id)
  1935. b = $data_skills[@data_window.skill.id].max_lv
  1936. h = @actor.skills.include?(@data_window.skill)
  1937. if (a == 1) && (b == 1) && (h == false)
  1938. @command_window.change_can_buy(true)
  1939. else
  1940. @command_window.change_can_buy(a < b)
  1941. end
  1942. end
  1943. #-----------------------------------------------------------------------------
  1944. #
  1945. #-----------------------------------------------------------------------------
  1946. def update_back_press
  1947. e = Keys.trigger?(Keys::Key[:ESC])
  1948. o = Keys.trigger?(Keys::Key[:N_0])
  1949. x = Keys.trigger?(Keys::Key[:X])
  1950. return unless e || o || x
  1951. Sound.play_cancel
  1952. if @command_window.active
  1953. leave_skill
  1954. else
  1955. return_scene
  1956. end
  1957. end
  1958. #-----------------------------------------------------------------------------
  1959. #
  1960. #-----------------------------------------------------------------------------
  1961. def get_all_bgs
  1962. return unless $D13x[:Scene_BGs]
  1963. @bg_set = Skill_Upgrade::BGs
  1964. end
  1965. #-----------------------------------------------------------------------------
  1966. #
  1967. #-----------------------------------------------------------------------------
  1968. def buy_skill
  1969. sk_lv = @data_window.sk_lv
  1970. skill = @data_window.skill
  1971. have = @actor.skill_learn?(skill)
  1972. can = @actor.can_level_skill?(skill)
  1973. if have
  1974. return return_maxed_skill if (can == false)
  1975. gold = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv+1][:gold]
  1976. sklp = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv+1][:sp]
  1977. exp_r = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][0]
  1978. sklna = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][1]
  1979. multi = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][2]
  1980. else
  1981. gold = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv][:gold]
  1982. sklp = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv][:sp]
  1983. exp_r = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][0]
  1984. sklna = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][1]
  1985. multi = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][2]
  1986. end
  1987. can_learn = @actor.sug_conditions_met?(skill,multi,gold,sklp,exp_r)
  1988. if can_learn
  1989. upgrade_skill(skill,have,sklna,gold,sklp)
  1990. else
  1991. return_skill_reqs_fail(sklna)
  1992. end
  1993. leave_skill
  1994. end
  1995. #-----------------------------------------------------------------------------
  1996. #
  1997. #-----------------------------------------------------------------------------
  1998. def return_maxed_skill
  1999. text = Skill_Upgrade.maxxed(@SUG_window.skill)
  2000. @help_window.set_text(text)
  2001. update_required
  2002. leave_skill
  2003. end
  2004. #-----------------------------------------------------------------------------
  2005. #
  2006. #-----------------------------------------------------------------------------
  2007. def return_skill_reqs_fail(lv_name)
  2008. skill = @SUG_window.skill
  2009. text = Skill_Upgrade.fail_buy(skill,lv_name)
  2010. @help_window.set_text(text)
  2011. update_required
  2012. end
  2013. #-----------------------------------------------------------------------------
  2014. #
  2015. #-----------------------------------------------------------------------------
  2016. def upgrade_skill(skill,have,sklna,gold,sklp)
  2017. if have
  2018. @actor.increase_skill_proficiency(skill.database_id, false)
  2019. text = Skill_Upgrade.upgrade(skill,sklna)
  2020. else
  2021. @actor.learn_skill(skill.database_id)
  2022. text = Skill_Upgrade.learn(skill,sklna)
  2023. end
  2024. @help_window.set_text(text)
  2025. update_required
  2026. @actor.skill_points -= sklp if sklp != nil
  2027. $game_party.lose_gold(gold) if gold != nil
  2028. @data_window.refresh
  2029. @small_window.refresh
  2030. @status_window.refresh
  2031. end
  2032. #-----------------------------------------------------------------------------
  2033. #
  2034. #-----------------------------------------------------------------------------
  2035. def update_required(time=60)
  2036. time.times do
  2037. Graphics.update
  2038. if $D13x[:Scene_BGs]
  2039. @bks.each { |i| i.update }
  2040. end # if $D13x[:Scene_BGs]
  2041. end
  2042. end
  2043. #-----------------------------------------------------------------------------
  2044. #
  2045. #-----------------------------------------------------------------------------
  2046. def leave_skill
  2047. @command_window.deactivate
  2048. @command_window.select(-1)
  2049. update_can_buy_info(true)
  2050. end
  2051. #-----------------------------------------------------------------------------
  2052. #
  2053. #-----------------------------------------------------------------------------
  2054. def on_actor_change
  2055. @small_window.actor = @actor
  2056. @main_window.actor = @actor
  2057. @data_window.actor = @actor
  2058. @SUG_window.actor = @actor
  2059. @status_window.actor = @actor
  2060. end
  2061.  
  2062. end
  2063.  
  2064. #==============================================================================#
  2065. # http://dekitarpg.wordpress.com/ #
  2066. #==============================================================================#
  2067. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement