Advertisement
Guest User

Menu script (RPG Maker XP) by Xk8

a guest
Jul 11th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 51.06 KB | None | 0 0
  1. #==========================================================================#
  2. #2nd CMS 'X Menu' by Xk8===================================================#
  3. #extra credits: Darkzero for location plugin, Squall for real time plugin==#
  4. #some unknown japanese person for the gradient bars========================#
  5. #==========================================================================#
  6. #notes: the gradient bars were defaulted to also work during battles, but==#
  7. #I disabled that feature, since this is just a cms. Note2: If you are======#
  8. #going to use this, please give credit...==================================#
  9. #==========================================================================#
  10. #This script is designed for use with non-animated battlers...=============#
  11. #Installation notes: Just replace Scene_Menu with this script==============#
  12. #==========================================================================#
  13.  
  14. class Scene_Menu
  15.  
  16. def initialize(menu_index = 0)
  17. @menu_index = menu_index
  18. end
  19.  
  20. def main
  21. @spriteset = Spriteset_Map.new
  22. s1 = $data_system.words.item
  23. s2 = $data_system.words.skill
  24. s3 = $data_system.words.equip
  25. s4 = "Statut"
  26. s5 = "Sauvegarder"
  27. s6 = "Quitter"
  28. @command_window = Xcommand.new(640, [s1, s2, s3, s4, s5, s6])
  29. @command_window.index = @menu_index
  30. @command_window.x = -640
  31. @command_window.opacity = 220
  32. if $game_party.actors.size == 0
  33.  
  34. @command_window.disable_item(0)
  35. @command_window.disable_item(1)
  36. @command_window.disable_item(2)
  37. @command_window.disable_item(3)
  38. end
  39.  
  40. if $game_system.save_disabled
  41. @command_window.disable_item(4)
  42. end
  43.  
  44. @playtime_window = XPlayTime.new
  45. @playtime_window.x = 640
  46. @playtime_window.y = 64
  47. @playtime_window.opacity = 220
  48.  
  49. @gold_window = XGold.new
  50. @gold_window.x = 640
  51. @gold_window.y = 320
  52. @gold_window.opacity = 220
  53.  
  54. @location_window = Xlocation.new
  55. @location_window.x = 640
  56. @location_window.y = 160
  57. @location_window.opacity = 220
  58.  
  59. @status_window = Xstatus.new
  60. @status_window.x = -400
  61. @status_window.y = 64
  62. @status_window.opacity = 220
  63.  
  64. @realtime_window = Xtime.new
  65. @realtime_window.x = 640
  66. @realtime_window.y = 224
  67. @realtime_window.opacity = 220
  68.  
  69. @title_window = Xtitle.new
  70. @title_window.x = 640
  71. @title_window.y = 384
  72. @title_window.opacity = 220
  73.  
  74. Graphics.transition
  75.  
  76. loop do
  77. Graphics.update
  78. Input.update
  79. update
  80.  
  81. if $scene != self
  82. break
  83. end
  84. end
  85.  
  86. Graphics.freeze
  87. @command_window.dispose
  88. @playtime_window.dispose
  89. @gold_window.dispose
  90. @status_window.dispose
  91. @location_window.dispose
  92. @realtime_window.dispose
  93. @spriteset.dispose
  94. @title_window.dispose
  95. end
  96.  
  97. def update
  98. @command_window.update
  99. if @command_window.x < 0
  100. @command_window.x += 40
  101. end
  102. @playtime_window.update
  103. if @playtime_window.x > 400
  104. @playtime_window.x -= 40
  105. end
  106. @gold_window.update
  107. if @realtime_window.x == 400
  108. if @gold_window.x > 400
  109. @gold_window.x -= 40
  110. end
  111. end
  112. @status_window.update
  113. if @status_window.x < 0
  114. @status_window.x += 20
  115. end
  116. @location_window.update
  117. if @playtime_window.x == 400
  118. if @location_window.x > 400
  119. @location_window.x -= 40
  120. end
  121. end
  122. @realtime_window.update
  123. if @location_window.x == 400
  124. if @realtime_window.x > 400
  125. @realtime_window.x -= 40
  126. end
  127. end
  128. @title_window.update
  129. if @gold_window.x == 400
  130. if @title_window.x > 400
  131. @title_window.x -= 40
  132. end
  133. end
  134. if @title_window.x == 400
  135. if @command_window.opacity > 180
  136. @command_window.opacity -= 20
  137. end
  138. if @playtime_window.opacity > 180
  139. @playtime_window.opacity -= 20
  140. end
  141. if @location_window.opacity > 180
  142. @location_window.opacity -= 20
  143. end
  144. if @realtime_window.opacity > 180
  145. @realtime_window.opacity -= 20
  146. end
  147. if @gold_window.opacity > 180
  148. @gold_window.opacity -= 20
  149. end
  150. if @title_window.opacity > 180
  151. @title_window.opacity -= 20
  152. end
  153. if @status_window.opacity > 180
  154. @status_window.opacity -= 20
  155. end
  156. end
  157. if @command_window.active
  158. update_command
  159. return
  160. end
  161.  
  162. if @status_window.active
  163. update_status
  164. return
  165. end
  166. end
  167.  
  168. def update_command
  169.  
  170. if Input.trigger?(Input::B)
  171.  
  172. $game_system.se_play($data_system.cancel_se)
  173. $scene = Scene_Map.new
  174. return
  175. end
  176.  
  177. if Input.trigger?(Input::C)
  178. if $game_party.actors.size == 0 and @command_window.index < 4
  179. $game_system.se_play($data_system.buzzer_se)
  180. return
  181. end
  182.  
  183. case @command_window.index
  184. when 0
  185. $game_system.se_play($data_system.decision_se)
  186. $scene = Scene_Item2.new
  187. when 1
  188. $game_system.se_play($data_system.decision_se)
  189. @command_window.active = false
  190. @status_window.active = true
  191. @status_window.index = 0
  192. when 2
  193. $game_system.se_play($data_system.decision_se)
  194. @command_window.active = false
  195. @status_window.active = true
  196. @status_window.index = 0
  197. when 3
  198. $game_system.se_play($data_system.decision_se)
  199. @command_window.active = false
  200. @status_window.active = true
  201. @status_window.index = 0
  202. when 4
  203. if $game_system.save_disabled
  204. $game_system.se_play($data_system.buzzer_se)
  205. return
  206. end
  207. $game_system.se_play($data_system.decision_se)
  208. $scene = Scene_Save.new
  209. when 5
  210. $game_system.se_play($data_system.decision_se)
  211. $scene = Scene_End2.new
  212. end
  213. return
  214. end
  215. end
  216.  
  217. def update_status
  218. if Input.trigger?(Input::B)
  219. $game_system.se_play($data_system.cancel_se)
  220. @command_window.active = true
  221. @status_window.active = false
  222. @status_window.index = -1
  223. return
  224. end
  225.  
  226. if Input.trigger?(Input::C)
  227. case @command_window.index
  228. when 1
  229. if $game_party.actors[@status_window.index].restriction >= 2
  230. $game_system.se_play($data_system.buzzer_se)
  231. return
  232. end
  233. $game_system.se_play($data_system.decision_se)
  234. $scene = XskillScene.new(@status_window.index)
  235. when 2
  236. $game_system.se_play($data_system.decision_se)
  237. $scene = Scene_Equip2.new(@status_window.index)
  238. when 3
  239. $game_system.se_play($data_system.decision_se)
  240. $scene = Scene_Status2.new(@status_window.index)
  241. end
  242. return
  243. end
  244. end
  245. end
  246.  
  247. class XPlayTime < Window_Base
  248.  
  249. def initialize
  250. super(0, 0, 240, 96)
  251. self.contents = Bitmap.new(width - 32, height - 32)
  252. self.contents.font.name = $fontface
  253. self.contents.font.size = $fontsize
  254. refresh
  255. end
  256.  
  257. def refresh
  258. self.contents.clear
  259. self.contents.font.color = system_color
  260. self.contents.draw_text(4, 0, 120, 32, "Temps")
  261. @total_sec = Graphics.frame_count / Graphics.frame_rate
  262. hour = @total_sec / 60 / 60
  263. min = @total_sec / 60 % 60
  264. sec = @total_sec % 60
  265. text = sprintf("%02d:%02d:%02d", hour, min, sec)
  266. self.contents.font.color = normal_color
  267. self.contents.draw_text(4, 32, 120, 32, text, 2)
  268. end
  269.  
  270. def update
  271. super
  272. if Graphics.frame_count / Graphics.frame_rate != @total_sec
  273. refresh
  274. end
  275. end
  276. end
  277.  
  278.  
  279. class XGold < Window_Base
  280.  
  281. def initialize
  282. super(0, 0, 240, 64)
  283. self.contents = Bitmap.new(width - 32, height - 32)
  284. self.contents.font.name = $fontface
  285. self.contents.font.size = $fontsize
  286. refresh
  287. end
  288.  
  289. def refresh
  290. self.contents.clear
  291. cx = contents.text_size($data_system.words.gold).width
  292. self.contents.font.color = normal_color
  293. self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
  294. self.contents.font.color = system_color
  295. self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  296. end
  297. end
  298.  
  299.  
  300. class Xtitle < Window_Base
  301.  
  302. def initialize
  303. super(0, 0, 240, 96)
  304. self.contents = Bitmap.new(width - 32, height - 32)
  305. self.contents.font.name = "Times New Roman"
  306. self.contents.font.size = 30
  307. refresh
  308. end
  309.  
  310. def refresh
  311. self.contents.clear
  312. self.contents.font.name = "Times New Roman"
  313. self.contents.font.color = normal_color
  314. self.contents.font.size = 30
  315. self.contents.draw_text(4, 0, 120, 32, "Ton titre ici")
  316. self.contents.font.name = $fontface
  317. self.contents.font.color = system_color
  318. self.contents.font.size = 14
  319. self.contents.draw_text(4, 0, 120, 100, "Appuiez que [Echap]")
  320. end
  321.  
  322. def update
  323. super
  324. refresh
  325. end
  326. end
  327.  
  328. class Xtime < Window_Base
  329.  
  330. def initialize
  331. super(0, 0, 240, 96)
  332. self.contents = Bitmap.new(width - 32, height - 32)
  333. self.contents.font.name = $fontface
  334. self.contents.font.size = $fontsize
  335. refresh
  336. end
  337.  
  338. def refresh
  339. self.contents.clear
  340. self.contents.font.color = system_color
  341. self.contents.font.size = $fontsize
  342. self.contents.draw_text(4, 0, 120, 32, "Temps réel")
  343.  
  344. @time_string = Time.now
  345.  
  346. text = @time_string.strftime("%A %H:%M:%S")
  347. self.contents.font.size = 18
  348. self.contents.font.color = normal_color
  349. self.contents.draw_text(4, 32, 120, 32, text, 2)
  350. end
  351. def update
  352. super
  353. refresh
  354. end
  355. end
  356.  
  357. class Xlocation < Window_Base
  358.  
  359. def initialize
  360. super(0, 0, 240, 64)
  361. self.contents = Bitmap.new(width - 32, height - 32)
  362. refresh
  363. end
  364.  
  365. def refresh
  366. self.contents.font.name = $fontface
  367. self.contents.font.size = $fontsize
  368. self.contents.clear
  369. self.contents.font.color = system_color
  370. self.contents.font.color = normal_color
  371. $maps = load_data("Data/MapInfos.rxdata")
  372. @map_id = $game_map.map_id
  373. @currmap = $maps[@map_id].name
  374. self.contents.font.size = 16
  375. self.contents.draw_text(4, 0, 64, 32, @currmap)
  376. end
  377. end
  378.  
  379. class Xcursor < Window_Base
  380.  
  381. attr_reader :index
  382. attr_reader :help_window
  383.  
  384. def initialize(x, y, width, height)
  385. super(x, y, width, height)
  386. @item_max = 1
  387. @column_max = 1
  388. @index = -1
  389. end
  390.  
  391. def index=(index)
  392. @index = index
  393.  
  394. if self.active and @help_window != nil
  395. update_help
  396. end
  397.  
  398. update_cursor_rect
  399. end
  400.  
  401. def help_window=(help_window)
  402. @help_window = help_window
  403.  
  404. if self.active and @help_window != nil
  405. update_help
  406. end
  407. end
  408.  
  409. def update_cursor_rect
  410.  
  411. row = @index / @column_max
  412. cursor_width = 26
  413. x = @index / @column_max * 90 - self.ox
  414. y = 2
  415. self.cursor_rect.set(x, y, cursor_width, 26)
  416. end
  417.  
  418. def update
  419. super
  420.  
  421. if self.active and @item_max > 0 and @index >= 0
  422.  
  423. if Input.repeat?(Input::RIGHT)
  424. if (@row_max == 1 and Input.trigger?(Input::RIGHT)) or
  425. @index < @item_max - @column_max
  426. $game_system.se_play($data_system.cursor_se)
  427. @index = (@index + @column_max) % @item_max
  428. end
  429. end
  430.  
  431. if Input.repeat?(Input::LEFT)
  432. if (@row_max == 1 and Input.trigger?(Input::LEFT)) or
  433. @index >= @column_max
  434. $game_system.se_play($data_system.cursor_se)
  435. @index = (@index - @column_max + @item_max) % @item_max
  436. end
  437. end
  438. if Input.repeat?(Input::DOWN)
  439. if @column_max >= 2 and @index < @item_max - 1
  440. $game_system.se_play($data_system.cursor_se)
  441. @index += 1
  442. end
  443. end
  444.  
  445. if Input.repeat?(Input::UP)
  446. if @column_max >= 2 and @index > 0
  447. $game_system.se_play($data_system.cursor_se)
  448. @index -= 1
  449. end
  450. end
  451.  
  452. if Input.repeat?(Input::R)
  453. if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  454. $game_system.se_play($data_system.cursor_se)
  455. @index = [@index + self.page_item_max, @item_max - 1].min
  456. self.top_row += self.page_row_max
  457. end
  458. end
  459.  
  460. if Input.repeat?(Input::L)
  461. if self.top_row > 0
  462. $game_system.se_play($data_system.cursor_se)
  463. @index = [@index - self.page_item_max, 0].max
  464. self.top_row -= self.page_row_max
  465. end
  466. end
  467. end
  468.  
  469. if self.active and @help_window != nil
  470. update_help
  471. end
  472.  
  473. update_cursor_rect
  474. end
  475. end
  476.  
  477. class Xcommand < Xcursor
  478.  
  479. def initialize(width, commands)
  480.  
  481. super(0, 0, width, 64)
  482. @item_max = commands.size
  483. @commands = commands
  484. row_max = 1
  485. column_max = 7
  486. self.contents = Bitmap.new(width - 32, @item_max - 32)
  487. self.contents.font.name = $fontface
  488. self.contents.font.size = 12
  489. refresh
  490. self.index = 0
  491. end
  492.  
  493. def refresh
  494. self.contents.clear
  495. for i in 0...@item_max
  496. draw_item(i, normal_color)
  497. end
  498. end
  499.  
  500. def draw_item(index, color)
  501. self.contents.font.color = color
  502. rect = Rect.new(90 * index + 29, -2, self.contents.width - 8, 30)
  503. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  504. bitmap1 = RPG::Cache.icon('034-Item03')
  505. bitmap2 = RPG::Cache.icon('045-Skill02')
  506. bitmap3 = RPG::Cache.icon('013-Body01')
  507. bitmap4 = RPG::Cache.icon('040-Item09')
  508. bitmap5 = RPG::Cache.icon('038-Item07')
  509. bitmap6 = RPG::Cache.icon('048-Skill05')
  510. self.contents.blt(0, 2, bitmap1, Rect.new(0, 0, 24, 24), opacity)
  511. self.contents.blt(90, 2, bitmap2, Rect.new(0, 0, 24, 24), opacity)
  512. self.contents.blt(180, 2, bitmap3, Rect.new(0, 0, 24, 24), opacity)
  513. self.contents.blt(270, 2, bitmap4, Rect.new(0, 0, 24, 24), opacity)
  514. self.contents.blt(360, 2, bitmap5, Rect.new(0, 0, 24, 24), opacity)
  515. self.contents.blt(450, 2, bitmap6, Rect.new(0, 0, 24, 24), opacity)
  516. self.contents.draw_text(rect, @commands[index])
  517. end
  518.  
  519. def disable_item(index)
  520. draw_item(index, disabled_color)
  521. end
  522. end
  523.  
  524. class Game_Actor < Game_Battler
  525. def now_exp
  526. return @exp - @exp_list[@level]
  527. end
  528. def next_exp
  529. return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  530. end
  531. end
  532.  
  533. class Window_BaseX < Window_Base
  534.  
  535. alias :draw_actor_hp_original :draw_actor_hp
  536. def draw_actor_hp(actor, x, y, width = 144)
  537. if actor.maxhp != 0
  538. rate = actor.hp.to_f / actor.maxhp
  539. else
  540. rate = 0
  541. end
  542.  
  543. plus_x = 0
  544. rate_x = 0
  545. plus_y = 25
  546. plus_width = 0
  547. rate_width = 100
  548. height = 10
  549. align1 = 1
  550. align2 = 2
  551. align3 = 0
  552. grade1 = 1
  553. grade2 = 0
  554. color1 = Color.new(0, 0, 0, 192)
  555. color2 = Color.new(255, 255, 192, 192)
  556. color3 = Color.new(0, 0, 0, 192)
  557. color4 = Color.new(64, 0, 0, 192)
  558. color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
  559. color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
  560.  
  561. if actor.maxhp != 0
  562. hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
  563. else
  564. hp = 0
  565. end
  566.  
  567. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  568. width, plus_width + width * rate_width / 100,
  569. height, hp, align1, align2, align3,
  570. color1, color2, color3, color4, color5, color6, grade1, grade2)
  571. draw_actor_hp_original(actor, x, y, width)
  572. end
  573.  
  574. alias :draw_actor_sp_original :draw_actor_sp
  575. def draw_actor_sp(actor, x, y, width = 144)
  576.  
  577. if actor.maxsp != 0
  578. rate = actor.sp.to_f / actor.maxsp
  579. else
  580. rate = 1
  581. end
  582.  
  583. plus_x = 0
  584. rate_x = 0
  585. plus_y = 25
  586. plus_width = 0
  587. rate_width = 100
  588. height = 10
  589. align1 = 1
  590. align2 = 2
  591. align3 = 0
  592. grade1 = 1
  593. grade2 = 0
  594. color1 = Color.new(0, 0, 0, 192)
  595. color2 = Color.new(255, 255, 192, 192)
  596. color3 = Color.new(0, 0, 0, 192)
  597. color4 = Color.new(0, 64, 0, 192)
  598. color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
  599. color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  600.  
  601. if actor.maxsp != 0
  602. sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
  603. else
  604. sp = (width + plus_width) * rate_width / 100
  605. end
  606.  
  607. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  608. width, plus_width + width * rate_width / 100,
  609. height, sp, align1, align2, align3,
  610. color1, color2, color3, color4, color5, color6, grade1, grade2)
  611. draw_actor_sp_original(actor, x, y, width)
  612. end
  613.  
  614. alias :draw_actor_exp_original :draw_actor_exp
  615. def draw_actor_exp(actor, x, y, width = 204)
  616.  
  617. if actor.next_exp != 0
  618. rate = actor.now_exp.to_f / actor.next_exp
  619. else
  620. rate = 1
  621. end
  622.  
  623. plus_x = 0
  624. rate_x = 0
  625. plus_y = 25
  626. plus_width = 0
  627. rate_width = 100
  628. height = 10
  629. align1 = 1
  630. align2 = 2
  631. align3 = 0
  632. grade1 = 1
  633. grade2 = 0
  634.  
  635. color1 = Color.new(0, 0, 0, 192)
  636. color2 = Color.new(255, 255, 192, 192)
  637. color3 = Color.new(0, 0, 0, 192)
  638. color4 = Color.new(64, 0, 0, 192)
  639. color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  640. color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  641.  
  642. if actor.next_exp != 0
  643. exp = (width + plus_width) * actor.now_exp * rate_width /
  644. 100 / actor.next_exp
  645. else
  646. exp = (width + plus_width) * rate_width / 100
  647. end
  648.  
  649. gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  650. width, plus_width + width * rate_width / 100,
  651. height, exp, align1, align2, align3,
  652. color1, color2, color3, color4, color5, color6, grade1, grade2)
  653. draw_actor_exp_original(actor, x, y)
  654. end
  655.  
  656. def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
  657. color1, color2, color3, color4, color5, color6, grade1, grade2)
  658. case align1
  659. when 1
  660. x += (rect_width - width) / 2
  661. when 2
  662. x += rect_width - width
  663. end
  664. case align2
  665. when 1
  666. y -= height / 2
  667. when 2
  668. y -= height
  669. end
  670.  
  671. self.contents.fill_rect(x, y, width, height, color1)
  672. self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  673. if align3 == 0
  674. if grade1 == 2
  675. grade1 = 3
  676. end
  677. if grade2 == 2
  678. grade2 = 3
  679. end
  680. end
  681. if (align3 == 1 and grade1 == 0) or grade1 > 0
  682. color = color3
  683. color3 = color4
  684. color4 = color
  685. end
  686. if (align3 == 1 and grade2 == 0) or grade2 > 0
  687. color = color5
  688. color5 = color6
  689. color6 = color
  690. end
  691.  
  692. self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
  693. color3, color4, grade1)
  694. if align3 == 1
  695. x += width - gauge
  696. end
  697.  
  698. self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
  699. color5, color6, grade2)
  700. end
  701. end
  702.  
  703. class Bitmap
  704.  
  705. def gradation_rect(x, y, width, height, color1, color2, align = 0)
  706. if align == 0
  707. for i in x...x + width
  708. red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  709. green = color1.green +
  710. (color2.green - color1.green) * (i - x) / (width - 1)
  711. blue = color1.blue +
  712. (color2.blue - color1.blue) * (i - x) / (width - 1)
  713. alpha = color1.alpha +
  714. (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  715. color = Color.new(red, green, blue, alpha)
  716. fill_rect(i, y, 1, height, color)
  717. end
  718. elsif align == 1
  719. for i in y...y + height
  720. red = color1.red +
  721. (color2.red - color1.red) * (i - y) / (height - 1)
  722. green = color1.green +
  723. (color2.green - color1.green) * (i - y) / (height - 1)
  724. blue = color1.blue +
  725. (color2.blue - color1.blue) * (i - y) / (height - 1)
  726. alpha = color1.alpha +
  727. (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  728. color = Color.new(red, green, blue, alpha)
  729. fill_rect(x, i, width, 1, color)
  730. end
  731.  
  732. elsif align == 2
  733. for i in x...x + width
  734. for j in y...y + height
  735. red = color1.red + (color2.red - color1.red) *
  736. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  737. green = color1.green + (color2.green - color1.green) *
  738. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  739. blue = color1.blue + (color2.blue - color1.blue) *
  740. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  741. alpha = color1.alpha + (color2.alpha - color1.alpha) *
  742. ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  743. color = Color.new(red, green, blue, alpha)
  744. set_pixel(i, j, color)
  745. end
  746. end
  747.  
  748. elsif align == 3
  749. for i in x...x + width
  750. for j in y...y + height
  751. red = color1.red + (color2.red - color1.red) *
  752. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  753. green = color1.green + (color2.green - color1.green) *
  754. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  755. blue = color1.blue + (color2.blue - color1.blue) *
  756. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  757. alpha = color1.alpha + (color2.alpha - color1.alpha) *
  758. ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  759. color = Color.new(red, green, blue, alpha)
  760. set_pixel(i, j, color)
  761. end
  762. end
  763. end
  764. end
  765. end
  766.  
  767. module RPG
  768. class Sprite < ::Sprite
  769. def damage(value, critical)
  770. dispose_damage
  771. if value.is_a?(Numeric)
  772. damage_string = value.abs.to_s
  773. else
  774. damage_string = value.to_s
  775. end
  776.  
  777. bitmap = Bitmap.new(160, 48)
  778. bitmap.font.name = "Arial Black"
  779. bitmap.font.size = 32
  780. bitmap.font.color.set(0, 0, 0)
  781. bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  782. bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  783. bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  784. bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  785.  
  786. if value.is_a?(Numeric) and value < 0
  787. bitmap.font.color.set(176, 255, 144)
  788. else
  789. bitmap.font.color.set(255, 255, 255)
  790. end
  791. bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  792. if critical
  793. bitmap.font.size = 20
  794. bitmap.font.color.set(0, 0, 0)
  795. bitmap.draw_text(-1, -1, 160, 20, "CRITIQUE", 1)
  796. bitmap.draw_text(+1, -1, 160, 20, "CRITIQUE", 1)
  797. bitmap.draw_text(-1, +1, 160, 20, "CRITIQUE", 1)
  798. bitmap.draw_text(+1, +1, 160, 20, "CRITIQUE", 1)
  799. bitmap.font.color.set(255, 255, 255)
  800. bitmap.draw_text(0, 0, 160, 20, "CRITIQUE", 1)
  801. end
  802. @_damage_sprite = ::Sprite.new
  803. @_damage_sprite.bitmap = bitmap
  804. @_damage_sprite.ox = 80 + self.viewport.ox
  805. @_damage_sprite.oy = 20 + self.viewport.oy
  806. @_damage_sprite.x = self.x + self.viewport.rect.x
  807. @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  808. @_damage_sprite.z = 3000
  809. @_damage_duration = 40
  810. end
  811. def animation(animation, hit)
  812. dispose_animation
  813. @_animation = animation
  814. return if @_animation == nil
  815. @_animation_hit = hit
  816. @_animation_duration = @_animation.frame_max
  817. animation_name = @_animation.animation_name
  818. animation_hue = @_animation.animation_hue
  819. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  820. if @@_reference_count.include?(bitmap)
  821. @@_reference_count[bitmap] += 1
  822. else
  823. @@_reference_count[bitmap] = 1
  824. end
  825. @_animation_sprites = []
  826. if @_animation.position != 3 or not @@_animations.include?(animation)
  827. for i in 0..15
  828. sprite = ::Sprite.new
  829. sprite.bitmap = bitmap
  830. sprite.visible = false
  831. @_animation_sprites.push(sprite)
  832. end
  833. unless @@_animations.include?(animation)
  834. @@_animations.push(animation)
  835. end
  836. end
  837. update_animation
  838. end
  839. def loop_animation(animation)
  840. return if animation == @_loop_animation
  841. dispose_loop_animation
  842. @_loop_animation = animation
  843. return if @_loop_animation == nil
  844. @_loop_animation_index = 0
  845. animation_name = @_loop_animation.animation_name
  846. animation_hue = @_loop_animation.animation_hue
  847. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  848. if @@_reference_count.include?(bitmap)
  849. @@_reference_count[bitmap] += 1
  850. else
  851. @@_reference_count[bitmap] = 1
  852. end
  853. @_loop_animation_sprites = []
  854. for i in 0..15
  855. sprite = ::Sprite.new
  856. sprite.bitmap = bitmap
  857. sprite.visible = false
  858. @_loop_animation_sprites.push(sprite)
  859. end
  860. update_loop_animation
  861. end
  862. def animation_set_sprites(sprites, cell_data, position)
  863. for i in 0..15
  864. sprite = sprites
  865. pattern = cell_data[i, 0]
  866. if sprite == nil or pattern == nil or pattern == -1
  867. sprite.visible = false if sprite != nil
  868. next
  869. end
  870.  
  871. sprite.visible = true
  872. sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  873. if position == 3
  874. if self.viewport != nil
  875. sprite.x = self.viewport.rect.width / 2
  876. sprite.y = self.viewport.rect.height - 160
  877. else
  878. sprite.x = 320
  879. sprite.y = 240
  880. end
  881. else
  882.  
  883. sprite.x = self.x + self.viewport.rect.x -
  884. self.ox + self.src_rect.width / 2
  885. sprite.y = self.y + self.viewport.rect.y -
  886. self.oy + self.src_rect.height / 2
  887. sprite.y -= self.src_rect.height / 4 if position == 0
  888. sprite.y += self.src_rect.height / 4 if position == 2
  889. end
  890.  
  891. sprite.x += cell_data[i, 1]
  892. sprite.y += cell_data[i, 2]
  893. sprite.z = 2000
  894. sprite.ox = 96
  895. sprite.oy = 96
  896. sprite.zoom_x = cell_data[i, 3] / 100.0
  897. sprite.zoom_y = cell_data[i, 3] / 100.0
  898. sprite.angle = cell_data[i, 4]
  899. sprite.mirror = (cell_data[i, 5] == 1)
  900. sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  901. sprite.blend_type = cell_data[i, 7]
  902. end
  903. end
  904. end
  905. end
  906.  
  907. class Xstatusselect < Window_BaseX
  908. attr_reader :index
  909. attr_reader :help_window
  910.  
  911. def initialize(x, y, width, height)
  912. super(x, y, width, height)
  913. @item_max = 1
  914. @column_max = 1
  915. @index = -1
  916. end
  917.  
  918. def index=(index)
  919. @index = index
  920.  
  921. if self.active and @help_window != nil
  922. update_help
  923. end
  924. update_cursor_rect
  925. end
  926.  
  927. def row_max
  928. return (@item_max + @column_max - 1) / @column_max
  929. end
  930.  
  931. def top_row
  932.  
  933. return self.oy / 32
  934. end
  935.  
  936. def top_row=(row)
  937.  
  938. if row < 0
  939. row = 0
  940. end
  941.  
  942. if row > row_max - 1
  943. row = row_max - 1
  944. end
  945.  
  946. self.oy = row * 32
  947. end
  948.  
  949. def page_row_max
  950.  
  951. return (self.height - 32) / 32
  952. end
  953.  
  954. def page_item_max
  955.  
  956. return page_row_max * @column_max
  957. end
  958.  
  959. def help_window=(help_window)
  960. @help_window = help_window
  961.  
  962. if self.active and @help_window != nil
  963. update_help
  964. end
  965. end
  966.  
  967. def update_cursor_rect
  968.  
  969. if @index < 0
  970. self.cursor_rect.empty
  971. return
  972. end
  973.  
  974. row = @index / @column_max
  975.  
  976. if row < self.top_row
  977. self.top_row = row
  978. end
  979.  
  980. if row > self.top_row + (self.page_row_max - 1)
  981. self.top_row = row - (self.page_row_max - 1)
  982. end
  983.  
  984. cursor_width = 32
  985. x = @index % @column_max * (cursor_width + 32)
  986. y = @index / @column_max * 32 - self.oy
  987. self.cursor_rect.set(x, y, cursor_width, 32)
  988. end
  989.  
  990. def update
  991. super
  992.  
  993. if self.active and @item_max > 0 and @index >= 0
  994. if Input.repeat?(Input::DOWN)
  995. if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  996. @index < @item_max - @column_max
  997. $game_system.se_play($data_system.cursor_se)
  998. @index = (@index + @column_max) % @item_max
  999. end
  1000. end
  1001.  
  1002. if Input.repeat?(Input::UP)
  1003.  
  1004. if (@column_max == 1 and Input.trigger?(Input::UP)) or
  1005. @index >= @column_max
  1006. $game_system.se_play($data_system.cursor_se)
  1007. @index = (@index - @column_max + @item_max) % @item_max
  1008. end
  1009. end
  1010.  
  1011. if Input.repeat?(Input::RIGHT)
  1012. if @column_max >= 2 and @index < @item_max - 1
  1013. $game_system.se_play($data_system.cursor_se)
  1014. @index += 1
  1015. end
  1016. end
  1017.  
  1018. if Input.repeat?(Input::LEFT)
  1019.  
  1020. if @column_max >= 2 and @index > 0
  1021. $game_system.se_play($data_system.cursor_se)
  1022. @index -= 1
  1023. end
  1024. end
  1025.  
  1026. if Input.repeat?(Input::R)
  1027. if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  1028. $game_system.se_play($data_system.cursor_se)
  1029. @index = [@index + self.page_item_max, @item_max - 1].min
  1030. self.top_row += self.page_row_max
  1031. end
  1032. end
  1033.  
  1034. if Input.repeat?(Input::L)
  1035. if self.top_row > 0
  1036. $game_system.se_play($data_system.cursor_se)
  1037. @index = [@index - self.page_item_max, 0].max
  1038. self.top_row -= self.page_row_max
  1039. end
  1040. end
  1041. end
  1042.  
  1043. if self.active and @help_window != nil
  1044. update_help
  1045. end
  1046.  
  1047. update_cursor_rect
  1048. end
  1049. end
  1050.  
  1051. class Xstatus < Xstatusselect
  1052.  
  1053. def initialize
  1054. super(0, 0, 400, 416)
  1055. self.contents = Bitmap.new(width - 32, height - 32)
  1056. self.contents.font.name = $fontface
  1057. self.contents.font.size = $fontsize
  1058. refresh
  1059. self.active = false
  1060. self.index = -1
  1061. end
  1062.  
  1063. def refresh
  1064. self.contents.clear
  1065. @item_max = $game_party.actors.size
  1066. for i in 0...$game_party.actors.size
  1067. x = 64
  1068. y = i * 90
  1069. actor = $game_party.actors
  1070. draw_actor_face(actor, x + 200, y + 79)
  1071. draw_actor_graphic(actor, x - 50, y + 80)
  1072. self.contents.font.size = 18
  1073. draw_actor_name(actor, x - 60, y + 4)
  1074. self.contents.font.color = system_color
  1075. self.contents.draw_text(x - 5, y + 2, 120, 32, '-')
  1076. self.contents.font.color = normal_color
  1077. draw_actor_class(actor, x + 75, y + 4)
  1078. draw_actor_level(actor, x + 5, y + 4)
  1079. draw_actor_state(actor, x + 135, y + 4)
  1080. draw_actor_exp(actor, x - 35, y + 54)
  1081. draw_actor_hp(actor, x - 35, y + 32)
  1082. draw_actor_sp(actor, x + 115, y + 32)
  1083. end
  1084. end
  1085.  
  1086. def update_cursor_rect
  1087. if @index < 0
  1088. self.cursor_rect.empty
  1089. else
  1090. self.cursor_rect.set(1, @index * 90 + 33, 26, 48)
  1091. end
  1092. end
  1093.  
  1094. def draw_actor_face(actor, x, y)
  1095. face = RPG::Cache.battler(actor.character_name, actor.character_hue)
  1096. fw = face.width
  1097. fh = 90
  1098. src_rect = Rect.new(3, -1, fw, fh)
  1099. opacity = 180
  1100. self.contents.blt(x - fw / 23, y - fh, face, src_rect, opacity)
  1101. end
  1102. end
  1103.  
  1104. class Window_HelpItemSkill < Window_Base
  1105.  
  1106. def initialize
  1107. super(0, 0, 320, 64)
  1108. self.contents = Bitmap.new(width - 32, height - 32)
  1109. self.contents.font.name = $fontface
  1110. self.contents.font.size = $fontsize
  1111. end
  1112.  
  1113. def set_text(text, align = 0)
  1114.  
  1115. if text != @text or align != @align
  1116.  
  1117. self.contents.clear
  1118. self.contents.font.color = normal_color
  1119. self.contents.font.size = 18
  1120. self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  1121. @text = text
  1122. @align = align
  1123. @actor = nil
  1124. end
  1125. self.visible = true
  1126. end
  1127.  
  1128. def set_actor(actor)
  1129. if actor != @actor
  1130. self.contents.clear
  1131. draw_actor_name(actor, 4, 0)
  1132. draw_actor_state(actor, 140, 0)
  1133. draw_actor_hp(actor, 284, 0)
  1134. draw_actor_sp(actor, 460, 0)
  1135. @actor = actor
  1136. @text = nil
  1137. self.visible = true
  1138. end
  1139. end
  1140.  
  1141. def set_enemy(enemy)
  1142. text = enemy.name
  1143. state_text = make_battler_state_text(enemy, 112, false)
  1144. if state_text != ""
  1145. text += " " + state_text
  1146. end
  1147. set_text(text, 1)
  1148. end
  1149. end
  1150.  
  1151. class Xskill < Window_Selectable
  1152.  
  1153. def initialize(actor)
  1154. super(0, 128, 320, 352)
  1155. @actor = actor
  1156. @column_max = 1
  1157. refresh
  1158. self.index = 0
  1159.  
  1160. if $game_temp.in_battle
  1161. self.y = 64
  1162. self.height = 256
  1163. self.back_opacity = 160
  1164. end
  1165. end
  1166.  
  1167. def skill
  1168. return @data[self.index]
  1169. end
  1170.  
  1171. def refresh
  1172. if self.contents != nil
  1173. self.contents.dispose
  1174. self.contents = nil
  1175. end
  1176. @data = []
  1177. for i in 0...@actor.skills.size
  1178. skill = $data_skills[@actor.skills]
  1179. if skill != nil
  1180. @data.push(skill)
  1181. end
  1182. end
  1183.  
  1184. @item_max = @data.size
  1185. if @item_max > 0
  1186. self.contents = Bitmap.new(width - 32, row_max * 32)
  1187. self.contents.font.name = $fontface
  1188. self.contents.font.size = $fontsize
  1189. for i in 0...@item_max
  1190. draw_item(i)
  1191. end
  1192. end
  1193. end
  1194.  
  1195. def draw_item(index)
  1196. skill = @data[index]
  1197. if @actor.skill_can_use?(skill.id)
  1198. self.contents.font.color = normal_color
  1199. else
  1200. self.contents.font.color = disabled_color
  1201. end
  1202. x = 4 + index % 1 * (288 + 32)
  1203. y = index / 1 * 32
  1204. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1205. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1206. bitmap = RPG::Cache.icon(skill.icon_name)
  1207. opacity = self.contents.font.color == normal_color ? 255 : 128
  1208. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1209. self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  1210. self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  1211. end
  1212.  
  1213. def update_help
  1214. @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  1215. end
  1216. end
  1217.  
  1218. class Window_SkillStatus2 < Window_Base
  1219.  
  1220. def initialize(actor)
  1221. super(0, 64, 320, 64)
  1222. self.contents = Bitmap.new(width - 32, height - 32)
  1223. self.contents.font.name = $fontface
  1224. self.contents.font.size = 18
  1225. @actor = actor
  1226. refresh
  1227. end
  1228.  
  1229. def refresh
  1230. self.contents.clear
  1231. draw_actor_name(@actor, 4, 0)
  1232. draw_actor_state(@actor, 60, 0)
  1233. draw_actor_sp(@actor, 130, 0)
  1234. end
  1235. end
  1236.  
  1237. class Window_Item2 < Window_Selectable
  1238.  
  1239. def initialize
  1240. super(0, 64, 320, 416)
  1241. @column_max = 1
  1242. refresh
  1243. self.index = 0
  1244.  
  1245. if $game_temp.in_battle
  1246. self.y = 64
  1247. self.height = 256
  1248. self.back_opacity = 160
  1249. end
  1250. end
  1251.  
  1252. def item
  1253. return @data[self.index]
  1254. end
  1255.  
  1256. def refresh
  1257. if self.contents != nil
  1258. self.contents.dispose
  1259. self.contents = nil
  1260. end
  1261. @data = []
  1262.  
  1263. for i in 1...$data_items.size
  1264. if $game_party.item_number(i) > 0
  1265. @data.push($data_items)
  1266. end
  1267. end
  1268.  
  1269. unless $game_temp.in_battle
  1270. for i in 1...$data_weapons.size
  1271. if $game_party.weapon_number(i) > 0
  1272. @data.push($data_weapons)
  1273. end
  1274. end
  1275.  
  1276. for i in 1...$data_armors.size
  1277. if $game_party.armor_number(i) > 0
  1278. @data.push($data_armors)
  1279. end
  1280. end
  1281. end
  1282.  
  1283. @item_max = @data.size
  1284. if @item_max > 0
  1285. self.contents = Bitmap.new(width - 32, row_max * 32)
  1286. self.contents.font.name = $fontface
  1287. self.contents.font.size = $fontsize
  1288. for i in 0...@item_max
  1289. draw_item(i)
  1290. end
  1291. end
  1292. end
  1293.  
  1294. def draw_item(index)
  1295. item = @data[index]
  1296. case item
  1297. when RPG::Item
  1298. number = $game_party.item_number(item.id)
  1299. when RPG::Weapon
  1300. number = $game_party.weapon_number(item.id)
  1301. when RPG::Armor
  1302. number = $game_party.armor_number(item.id)
  1303. end
  1304.  
  1305. if item.is_a?(RPG::Item) and
  1306. $game_party.item_can_use?(item.id)
  1307. self.contents.font.color = normal_color
  1308. else
  1309. self.contents.font.color = disabled_color
  1310. end
  1311. x = 4 + index % 1 * (288 + 32)
  1312. y = index / 1 * 32
  1313. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1314. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1315. bitmap = RPG::Cache.icon(item.icon_name)
  1316. opacity = self.contents.font.color == normal_color ? 255 : 128
  1317. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1318. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1319. self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  1320. self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  1321. end
  1322.  
  1323. def update_help
  1324. @help_window.set_text(self.item == nil ? "" : self.item.description)
  1325. end
  1326. end
  1327.  
  1328. class XskillScene
  1329.  
  1330. def initialize(actor_index = 0, equip_index = 0)
  1331. @actor_index = actor_index
  1332. end
  1333.  
  1334. def main
  1335. @spriteset = Spriteset_Map.new
  1336.  
  1337. @actor = $game_party.actors[@actor_index]
  1338. @help_window = Window_HelpItemSkill.new
  1339. @help_window.back_opacity = 160
  1340. @help_window.x = -320
  1341. @status_window = Window_SkillStatus2.new(@actor)
  1342. @status_window.back_opacity = 160
  1343. @status_window.x = -320
  1344. @skill_window = Xskill.new(@actor)
  1345. @skill_window.back_opacity = 160
  1346. @skill_window.help_window = @help_window
  1347. @skill_window.x = -320
  1348. @target_window = Window_Target2.new
  1349. @target_window.visible = false
  1350. @target_window.active = false
  1351. @target_window.back_opacity = 160
  1352. @target_window.y = 480
  1353.  
  1354. Graphics.transition
  1355.  
  1356. loop do
  1357. Graphics.update
  1358. Input.update
  1359. update
  1360. if $scene != self
  1361. break
  1362. end
  1363. end
  1364.  
  1365. Graphics.freeze
  1366. @help_window.dispose
  1367. @status_window.dispose
  1368. @skill_window.dispose
  1369. @target_window.dispose
  1370. @spriteset.dispose
  1371. end
  1372.  
  1373. def update
  1374. @help_window.update
  1375. if @help_window.x < 0
  1376. @help_window.x += 10
  1377. end
  1378. @status_window.update
  1379. if @status_window.x < 0
  1380. @status_window.x += 10
  1381. end
  1382. @skill_window.update
  1383. if @skill_window.x < 0
  1384. @skill_window.x += 10
  1385. end
  1386. @target_window.update
  1387. if @target_window.y > 0
  1388. @target_window.y -= 15
  1389. end
  1390. if @skill_window.active
  1391. update_skill
  1392. return
  1393. end
  1394.  
  1395. if @target_window.active
  1396. update_target
  1397. return
  1398. end
  1399. end
  1400.  
  1401. def update_skill
  1402. if Input.trigger?(Input::B)
  1403. $game_system.se_play($data_system.cancel_se)
  1404. $scene = Scene_Menu.new(1)
  1405. return
  1406. end
  1407.  
  1408. if Input.trigger?(Input::C)
  1409. @skill = @skill_window.skill
  1410. if @skill == nil or not @actor.skill_can_use?(@skill.id)
  1411. $game_system.se_play($data_system.buzzer_se)
  1412. return
  1413. end
  1414.  
  1415. $game_system.se_play($data_system.decision_se)
  1416. if @skill.scope >= 3
  1417. @skill_window.active = false
  1418. @target_window.x = 320
  1419. @target_window.y = 480
  1420. @target_window.visible = true
  1421. @target_window.active = true
  1422.  
  1423. if @skill.scope == 4 || @skill.scope == 6
  1424. @target_window.index = -1
  1425. elsif @skill.scope == 7
  1426. @target_window.index = @actor_index - 10
  1427. else
  1428. @target_window.index = 0
  1429. end
  1430. else
  1431. if @skill.common_event_id > 0
  1432. $game_temp.common_event_id = @skill.common_event_id
  1433. $game_system.se_play(@skill.menu_se)
  1434. @actor.sp -= @skill.sp_cost
  1435. @status_window.refresh
  1436. @skill_window.refresh
  1437. @target_window.refresh
  1438. $scene = Scene_Map.new
  1439. return
  1440. end
  1441. end
  1442. return
  1443. end
  1444.  
  1445. if Input.trigger?(Input::R)
  1446. $game_system.se_play($data_system.cursor_se)
  1447. @actor_index += 1
  1448. @actor_index %= $game_party.actors.size
  1449. $scene = Scene_Skill.new(@actor_index)
  1450. return
  1451. end
  1452.  
  1453. if Input.trigger?(Input::L)
  1454. $game_system.se_play($data_system.cursor_se)
  1455. @actor_index += $game_party.actors.size - 1
  1456. @actor_index %= $game_party.actors.size
  1457. $scene = Scene_Skill.new(@actor_index)
  1458. return
  1459. end
  1460. end
  1461.  
  1462. def update_target
  1463. if Input.trigger?(Input::B)
  1464. $game_system.se_play($data_system.cancel_se)
  1465. @skill_window.active = true
  1466. @target_window.visible = false
  1467. @target_window.active = false
  1468. if @skill_window.active = true
  1469. @target_window.y = 480
  1470. end
  1471. return
  1472. end
  1473.  
  1474. if Input.trigger?(Input::C)
  1475. unless @actor.skill_can_use?(@skill.id)
  1476. $game_system.se_play($data_system.buzzer_se)
  1477. return
  1478. end
  1479.  
  1480. if @target_window.index == -1
  1481. used = false
  1482. for i in $game_party.actors
  1483. used |= i.skill_effect(@actor, @skill)
  1484. end
  1485. end
  1486.  
  1487. if @target_window.index <= -2
  1488. target = $game_party.actors[@target_window.index + 10]
  1489. used = target.skill_effect(@actor, @skill)
  1490. end
  1491.  
  1492. if @target_window.index >= 0
  1493. target = $game_party.actors[@target_window.index]
  1494. used = target.skill_effect(@actor, @skill)
  1495. end
  1496.  
  1497. if used
  1498. $game_system.se_play(@skill.menu_se)
  1499. @actor.sp -= @skill.sp_cost
  1500. @status_window.refresh
  1501. @skill_window.refresh
  1502. @target_window.refresh
  1503.  
  1504. if $game_party.all_dead?
  1505. $scene = Scene_Gameover.new
  1506. return
  1507. end
  1508.  
  1509. if @skill.common_event_id > 0
  1510. $game_temp.common_event_id = @skill.common_event_id
  1511. $scene = Scene_Map.new
  1512. return
  1513. end
  1514. end
  1515.  
  1516. unless used
  1517. $game_system.se_play($data_system.buzzer_se)
  1518. end
  1519. return
  1520. end
  1521. end
  1522. end
  1523.  
  1524. class Window_Target2 < Window_Selectable
  1525.  
  1526. def initialize
  1527. super(0, 0, 320, 400)
  1528. self.contents = Bitmap.new(width - 32, height - 32)
  1529. self.contents.font.name = $fontface
  1530. self.contents.font.size = 18
  1531. self.z += 10
  1532. @item_max = $game_party.actors.size
  1533. refresh
  1534. end
  1535.  
  1536. def refresh
  1537. self.contents.clear
  1538. for i in 0...$game_party.actors.size
  1539. x = 4
  1540. y = i * 90
  1541. actor = $game_party.actors
  1542. draw_actor_face(actor, x, y + 70)
  1543. draw_actor_face2(actor, x + 200, y + 95)
  1544. draw_actor_name(actor, x + 40, y)
  1545. draw_actor_class(actor, x + 200, y + 32)
  1546. draw_actor_level(actor, x + 200, y + 64)
  1547. draw_actor_state(actor, x + 100, y)
  1548. draw_actor_hp(actor, x + 40, y + 32)
  1549. draw_actor_sp(actor, x + 40, y + 64)
  1550. end
  1551. end
  1552.  
  1553. def draw_actor_face(actor, x, y)
  1554. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  1555. cw = bitmap.rect.width / 4
  1556. ch = bitmap.rect.height / 4
  1557. src_rect = Rect.new(0, 0, cw, ch)
  1558. self.contents.blt(x - cw / 23, y - ch, bitmap, src_rect)
  1559. end
  1560.  
  1561. def draw_actor_face2(actor, x, y)
  1562. face = RPG::Cache.battler(actor.character_name, actor.character_hue)
  1563. fw = face.width
  1564. fh = 90
  1565. src_rect = Rect.new(3, -1, fw, fh)
  1566. opacity = 160
  1567. self.contents.blt(x - fw / 23, y - fh, face, src_rect, opacity)
  1568. end
  1569.  
  1570. def update_cursor_rect
  1571.  
  1572. if @index <= -2
  1573. self.cursor_rect.set(0, (@index + 10) * 90, self.width - 32, 96)
  1574. elsif @index == -1
  1575. self.cursor_rect.set(0, 0, self.width - 32, @item_max * 90 - 20)
  1576. else
  1577. self.cursor_rect.set(0, @index * 90 + 5, self.width - 32, 90)
  1578. end
  1579. end
  1580. end
  1581.  
  1582. class Scene_Item2
  1583.  
  1584. def main
  1585. @spriteset = Spriteset_Map.new
  1586. @help_window = Window_HelpItemSkill.new
  1587. @help_window.back_opacity = 160
  1588. @help_window.x = -320
  1589. @item_window = Window_Item2.new
  1590. @item_window.back_opacity = 160
  1591. @item_window.help_window = @help_window
  1592. @item_window.x = -320
  1593. @target_window = Window_Target2.new
  1594. @target_window.visible = false
  1595. @target_window.active = false
  1596. @target_window.back_opacity = 160
  1597. @target_window.y = 480
  1598.  
  1599. Graphics.transition
  1600. loop do
  1601. Graphics.update
  1602. Input.update
  1603. update
  1604. if $scene != self
  1605. break
  1606. end
  1607. end
  1608.  
  1609. Graphics.freeze
  1610. @help_window.dispose
  1611. @item_window.dispose
  1612. @target_window.dispose
  1613. @spriteset.dispose
  1614. end
  1615.  
  1616. def update
  1617. @help_window.update
  1618. if @help_window.x < 0
  1619. @help_window.x +=10
  1620. end
  1621. @item_window.update
  1622. if @item_window.x < 0
  1623. @item_window.x +=10
  1624. end
  1625. @target_window.update
  1626. if @target_window.y > 0
  1627. @target_window.y -= 15
  1628. end
  1629. if @item_window.active
  1630. update_item
  1631. return
  1632. end
  1633.  
  1634. if @target_window.active
  1635. update_target
  1636. return
  1637. end
  1638. end
  1639.  
  1640. def update_item
  1641.  
  1642. if Input.trigger?(Input::B)
  1643. $game_system.se_play($data_system.cancel_se)
  1644. $scene = Scene_Menu.new(0)
  1645. return
  1646. end
  1647.  
  1648. if Input.trigger?(Input::C)
  1649. @item = @item_window.item
  1650. unless @item.is_a?(RPG::Item)
  1651. $game_system.se_play($data_system.buzzer_se)
  1652. return
  1653. end
  1654.  
  1655. unless $game_party.item_can_use?(@item.id)
  1656. $game_system.se_play($data_system.buzzer_se)
  1657. return
  1658. end
  1659. $game_system.se_play($data_system.decision_se)
  1660. if @item.scope >= 3
  1661. @item_window.active = false
  1662. @target_window.x = 320
  1663. @target_window.y = 480
  1664. @target_window.visible = true
  1665. @target_window.active = true
  1666.  
  1667. if @item.scope == 4 || @item.scope == 6
  1668. @target_window.index = -1
  1669. else
  1670. @target_window.index = 0
  1671. end
  1672. else
  1673.  
  1674. if @item.common_event_id > 0
  1675. $game_temp.common_event_id = @item.common_event_id
  1676. $game_system.se_play(@item.menu_se)
  1677.  
  1678. if @item.consumable
  1679. $game_party.lose_item(@item.id, 1)
  1680. @item_window.draw_item(@item_window.index)
  1681. end
  1682.  
  1683. $scene = Scene_Map.new
  1684. return
  1685. end
  1686. end
  1687. return
  1688. end
  1689. end
  1690.  
  1691. def update_target
  1692.  
  1693. if Input.trigger?(Input::B)
  1694. $game_system.se_play($data_system.cancel_se)
  1695. unless $game_party.item_can_use?(@item.id)
  1696. @item_window.refresh
  1697. end
  1698.  
  1699. @item_window.active = true
  1700. @target_window.visible = false
  1701. @target_window.active = false
  1702. @target_window.y = 480
  1703. return
  1704. end
  1705.  
  1706. if Input.trigger?(Input::C)
  1707. if $game_party.item_number(@item.id) == 0
  1708. $game_system.se_play($data_system.buzzer_se)
  1709. return
  1710. end
  1711. if @target_window.index == -1
  1712. used = false
  1713. for i in $game_party.actors
  1714. used |= i.item_effect(@item)
  1715. end
  1716. end
  1717.  
  1718. if @target_window.index >= 0
  1719. target = $game_party.actors[@target_window.index]
  1720. used = target.item_effect(@item)
  1721. end
  1722.  
  1723. if used
  1724. $game_system.se_play(@item.menu_se)
  1725. if @item.consumable
  1726. $game_party.lose_item(@item.id, 1)
  1727. @item_window.draw_item(@item_window.index)
  1728. end
  1729.  
  1730. @target_window.refresh
  1731. if $game_party.all_dead?
  1732. $scene = Scene_Gameover.new
  1733. return
  1734. end
  1735. if @item.common_event_id > 0
  1736. $game_temp.common_event_id = @item.common_event_id
  1737. $scene = Scene_Map.new
  1738. return
  1739. end
  1740. end
  1741.  
  1742. unless used
  1743. $game_system.se_play($data_system.buzzer_se)
  1744. end
  1745. return
  1746. end
  1747. end
  1748. end
  1749.  
  1750. class Window_Status2 < Window_Base
  1751.  
  1752. def initialize(actor)
  1753. super(0, 0, 430, 370)
  1754. self.contents = Bitmap.new(width - 32, height - 32)
  1755. self.contents.font.name = $fontface
  1756. self.contents.font.size = $fontsize
  1757. @actor = actor
  1758. refresh
  1759. end
  1760.  
  1761. def refresh
  1762. self.contents.clear
  1763. draw_actor_graphic(@actor, 20, 45)
  1764. draw_actor_face(@actor, 270, 250)
  1765. draw_actor_name(@actor, 4 + 40, 10)
  1766. draw_actor_class(@actor, 4 + 160 + 40, 10)
  1767. draw_actor_level(@actor, 96 + 40, 10)
  1768. draw_actor_state(@actor, 244+ 40, 10)
  1769. self.contents.font.size = 18
  1770. draw_actor_hp(@actor, 0, 100, 172)
  1771. draw_actor_sp(@actor, 0, 116, 172)
  1772. draw_actor_parameter(@actor, 0, 160, 0)
  1773. draw_actor_parameter(@actor, 0, 224 - 32, 1)
  1774. draw_actor_parameter(@actor, 0, 256 - 32, 2)
  1775. draw_actor_parameter(@actor, 0, 304 - 32, 3)
  1776. draw_actor_parameter(@actor, 0, 336 - 32, 4)
  1777. draw_actor_parameter(@actor, 0 + 200, 304 - 32, 5)
  1778. draw_actor_parameter(@actor, 0 + 200, 336 - 32, 6)
  1779.  
  1780. self.contents.font.color = system_color
  1781. self.contents.draw_text(0, 48, 80, 32, "EXP")
  1782. self.contents.draw_text(0, 64, 80, 32, "NEXT")
  1783. self.contents.font.color = normal_color
  1784. self.contents.draw_text(0 + 80, 48, 84, 32, @actor.exp_s, 2)
  1785. self.contents.draw_text(0 + 80, 64, 84, 32, @actor.next_rest_exp_s, 2)
  1786. self.contents.font.color = system_color
  1787. self.contents.draw_text(200, 48, 96, 32, "Equipment")
  1788. draw_item_name($data_weapons[@actor.weapon_id], 200 + 4, 80)
  1789. draw_item_name($data_armors[@actor.armor1_id], 200 + 4, 128)
  1790. draw_item_name($data_armors[@actor.armor2_id], 200 + 4, 304 - 128)
  1791. draw_item_name($data_armors[@actor.armor3_id], 200 + 4, 352 - 128)
  1792. draw_item_name($data_armors[@actor.armor4_id], 200 + 4, 400 - 128)
  1793. end
  1794.  
  1795. def draw_actor_face(actor, x, y)
  1796. face = RPG::Cache.battler(actor.character_name, actor.character_hue)
  1797. fw = face.width
  1798. fh = face.height
  1799. src_rect = Rect.new(3, -1, fw, fh)
  1800. opacity = 120
  1801. self.contents.blt(x - fw / 23, y - fh, face, src_rect, opacity)
  1802. end
  1803. end
  1804.  
  1805. class Scene_Status2
  1806. def initialize(actor_index = 0, equip_index = 0)
  1807. @actor_index = actor_index
  1808. end
  1809.  
  1810. def main
  1811. @spriteset = Spriteset_Map.new
  1812. @actor = $game_party.actors[@actor_index]
  1813. @status_window = Window_Status2.new(@actor)
  1814. @status_window.back_opacity = 160
  1815. @status_window.x = -430
  1816. Graphics.transition
  1817. loop do
  1818. Graphics.update
  1819. Input.update
  1820. update
  1821.  
  1822. if $scene != self
  1823. break
  1824. end
  1825. end
  1826.  
  1827. Graphics.freeze
  1828. @status_window.dispose
  1829. @spriteset.dispose
  1830. end
  1831.  
  1832. def update
  1833. if @status_window.x < 0
  1834. @status_window.x +=10
  1835. end
  1836. if Input.trigger?(Input::B)
  1837. $game_system.se_play($data_system.cancel_se)
  1838. $scene = Scene_Menu.new(3)
  1839. return
  1840. end
  1841.  
  1842. if Input.trigger?(Input::R)
  1843. $game_system.se_play($data_system.cursor_se)
  1844. @actor_index += 1
  1845. @actor_index %= $game_party.actors.size
  1846. $scene = Scene_Status.new(@actor_index)
  1847. return
  1848. end
  1849.  
  1850. if Input.trigger?(Input::L)
  1851. $game_system.se_play($data_system.cursor_se)
  1852. @actor_index += $game_party.actors.size - 1
  1853. @actor_index %= $game_party.actors.size
  1854. $scene = Scene_Status.new(@actor_index)
  1855. return
  1856. end
  1857. end
  1858. end
  1859.  
  1860. class Scene_End2
  1861.  
  1862. def main
  1863. @spriteset = Spriteset_Map.new
  1864. s1 = "To Title"
  1865. s2 = "Shutdown"
  1866. s3 = "Cancel"
  1867. @command_window2 = Window_Command.new(192, [s1, s2, s3])
  1868. @command_window2.x = -192
  1869. @command_window2.y = 240 - @command_window2.height / 2
  1870. @command_window2.back_opacity = 160
  1871. Graphics.transition
  1872. loop do
  1873. Graphics.update
  1874. Input.update
  1875. update
  1876. if $scene != self
  1877. break
  1878. end
  1879. end
  1880. Graphics.freeze
  1881. @command_window2.dispose
  1882. @spriteset.dispose
  1883. if $scene.is_a?(Scene_Title)
  1884. Graphics.transition
  1885. Graphics.freeze
  1886. end
  1887. end
  1888.  
  1889. def update
  1890. @command_window2.update
  1891.  
  1892. if@command_window2.x < 320 - @command_window2.width / 2
  1893. @command_window2.x += 10
  1894. end
  1895.  
  1896. if Input.trigger?(Input::B)
  1897. $game_system.se_play($data_system.cancel_se)
  1898. $scene = Scene_Menu.new(8)
  1899. return
  1900. end
  1901. if Input.trigger?(Input::C)
  1902. case @command_window2.index
  1903. when 0
  1904. $game_system.se_play($data_system.decision_se)
  1905. Audio.bgm_fade(800)
  1906. Audio.bgs_fade(800)
  1907. Audio.me_fade(800)
  1908. $scene = Scene_Title.new
  1909. when 1
  1910. $game_system.se_play($data_system.decision_se)
  1911. Audio.bgm_fade(800)
  1912. Audio.bgs_fade(800)
  1913. Audio.me_fade(800)
  1914. $scene = nil
  1915. when 2
  1916. $game_system.se_play($data_system.decision_se)
  1917. $scene = Scene_Menu.new(8)
  1918. end
  1919. return
  1920. end
  1921. end
  1922. end
  1923.  
  1924. class Window_EquipLeft2 < Window_Base
  1925.  
  1926. def initialize(actor)
  1927. super(0, 64, 272, 416)
  1928. self.contents = Bitmap.new(width - 32, height - 32)
  1929. self.contents.font.name = $fontface
  1930. self.contents.font.size = $fontsize
  1931. @actor = actor
  1932. refresh
  1933. end
  1934.  
  1935. def refresh
  1936. self.contents.clear
  1937. draw_actor_graphic(@actor, 20, 58)
  1938. draw_actor_face(@actor, 136, 360)
  1939. draw_actor_name(@actor, 52, 0)
  1940. draw_actor_level(@actor, 52, 32)
  1941. draw_actor_parameter(@actor, 4, 64, 0)
  1942. draw_actor_parameter(@actor, 4, 96, 1)
  1943. draw_actor_parameter(@actor, 4, 128, 2)
  1944. if @new_atk != nil
  1945. self.contents.font.name = "Arial"
  1946. self.contents.font.color = system_color
  1947. self.contents.draw_text(160, 64, 40, 32, "»", 1)
  1948. self.contents.font.color = normal_color
  1949. self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  1950. end
  1951.  
  1952. if @new_pdef != nil
  1953. self.contents.font.color = system_color
  1954. self.contents.draw_text(160, 96, 40, 32, "»", 1)
  1955. self.contents.font.color = normal_color
  1956. self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  1957. end
  1958. if @new_mdef != nil
  1959. self.contents.font.color = system_color
  1960. self.contents.draw_text(160, 128, 40, 32, "»", 1)
  1961. self.contents.font.color = normal_color
  1962. self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  1963. end
  1964. end
  1965.  
  1966. def set_new_parameters(new_atk, new_pdef, new_mdef)
  1967. self.contents.font.name = $fontface
  1968. if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
  1969. @new_atk = new_atk
  1970. @new_pdef = new_pdef
  1971. @new_mdef = new_mdef
  1972. refresh
  1973. end
  1974. end
  1975.  
  1976. def draw_actor_face(actor, x, y)
  1977. face = RPG::Cache.battler(actor.character_name, actor.character_hue)
  1978. fw = face.width
  1979. fh = face.height
  1980. src_rect = Rect.new(3, -1, fw, fh)
  1981. self.contents.blt(x - fw / 23, y - fh, face, src_rect)
  1982. end
  1983. end
  1984.  
  1985. class Window_EquipRight2 < Window_Selectable
  1986.  
  1987. def initialize(actor)
  1988. super(272, 64, 368, 192)
  1989. self.contents = Bitmap.new(width - 32, height - 32)
  1990. self.contents.font.name = $fontface
  1991. self.contents.font.size = $fontsize
  1992. @actor = actor
  1993. refresh
  1994.  
  1995. self.index = 0
  1996. end
  1997.  
  1998. def item
  1999. return @data[self.index]
  2000. end
  2001.  
  2002. def refresh
  2003. self.contents.clear
  2004. @data = []
  2005. @data.push($data_weapons[@actor.weapon_id])
  2006. @data.push($data_armors[@actor.armor1_id])
  2007. @data.push($data_armors[@actor.armor2_id])
  2008. @data.push($data_armors[@actor.armor3_id])
  2009. @data.push($data_armors[@actor.armor4_id])
  2010. @item_max = @data.size
  2011. self.contents.font.color = system_color
  2012. self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  2013. self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  2014. self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  2015. self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  2016. self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  2017. draw_item_name(@data[0], 92, 32 * 0)
  2018. draw_item_name(@data[1], 92, 32 * 1)
  2019. draw_item_name(@data[2], 92, 32 * 2)
  2020. draw_item_name(@data[3], 92, 32 * 3)
  2021. draw_item_name(@data[4], 92, 32 * 4)
  2022. end
  2023.  
  2024. def update_help
  2025. @help_window.set_text(self.item == nil ? "" : self.item.description)
  2026. end
  2027. end
  2028.  
  2029. class Window_EquipItem2 < Window_Selectable
  2030.  
  2031. def initialize(actor, equip_type)
  2032. super(272, 256, 368, 224)
  2033. @actor = actor
  2034. @equip_type = equip_type
  2035. @column_max = 1
  2036. refresh
  2037. self.active = false
  2038. self.index = -1
  2039. end
  2040.  
  2041. def item
  2042. return @data[self.index]
  2043. end
  2044.  
  2045. def refresh
  2046. if self.contents != nil
  2047. self.contents.dispose
  2048. self.contents = nil
  2049. end
  2050. @data = []
  2051.  
  2052. if @equip_type == 0
  2053. weapon_set = $data_classes[@actor.class_id].weapon_set
  2054. for i in 1...$data_weapons.size
  2055. if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  2056. @data.push($data_weapons)
  2057. end
  2058. end
  2059. end
  2060.  
  2061. if @equip_type != 0
  2062. armor_set = $data_classes[@actor.class_id].armor_set
  2063. for i in 1...$data_armors.size
  2064. if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  2065. if $data_armors.kind == @equip_type-1
  2066. @data.push($data_armors)
  2067. end
  2068. end
  2069. end
  2070. end
  2071.  
  2072. @data.push(nil)
  2073.  
  2074. @item_max = @data.size
  2075. self.contents = Bitmap.new(width - 32, row_max * 32)
  2076. self.contents.font.name = $fontface
  2077. self.contents.font.size = $fontsize
  2078. for i in 0...@item_max-1
  2079. draw_item(i)
  2080. end
  2081. end
  2082.  
  2083. def draw_item(index)
  2084. item = @data[index]
  2085. x = 4 + index % 2 * (288 + 32)
  2086. y = index / 2 * 32
  2087. case item
  2088. when RPG::Weapon
  2089. number = $game_party.weapon_number(item.id)
  2090. when RPG::Armor
  2091. number = $game_party.armor_number(item.id)
  2092. end
  2093. bitmap = RPG::Cache.icon(item.icon_name)
  2094. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  2095. self.contents.font.color = normal_color
  2096. self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  2097. self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  2098. self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  2099. end
  2100.  
  2101. def update_help
  2102. @help_window.set_text(self.item == nil ? "" : self.item.description)
  2103. end
  2104. end
  2105.  
  2106. class Scene_Equip2
  2107.  
  2108. def initialize(actor_index = 0, equip_index = 0)
  2109. @actor_index = actor_index
  2110. @equip_index = equip_index
  2111. end
  2112.  
  2113. def main
  2114. @spriteset = Spriteset_Map.new
  2115. @actor = $game_party.actors[@actor_index]
  2116. @help_window = Window_Help.new
  2117. @help_window.back_opacity = 160
  2118. @help_window.y = -100
  2119. @left_window = Window_EquipLeft2.new(@actor)
  2120. @left_window.back_opacity = 160
  2121. @left_window.x = -280
  2122. @right_window = Window_EquipRight2.new(@actor)
  2123. @right_window.back_opacity = 160
  2124. @right_window.x = 642
  2125. @item_window1 = Window_EquipItem2.new(@actor, 0)
  2126. @item_window1.back_opacity = 160
  2127. @item_window1.y = 486
  2128. @item_window2 = Window_EquipItem2.new(@actor, 1)
  2129. @item_window2.back_opacity = 160
  2130. @item_window2.y = 486
  2131. @item_window3 = Window_EquipItem2.new(@actor, 2)
  2132. @item_window3.back_opacity = 160
  2133. @item_window3.y = 486
  2134. @item_window4 = Window_EquipItem2.new(@actor, 3)
  2135. @item_window4.back_opacity = 160
  2136. @item_window4.y = 486
  2137. @item_window5 = Window_EquipItem2.new(@actor, 4)
  2138. @item_window5.back_opacity = 160
  2139. @item_window5.y = 486
  2140. @right_window.help_window = @help_window
  2141. @item_window1.help_window = @help_window
  2142. @item_window2.help_window = @help_window
  2143. @item_window3.help_window = @help_window
  2144. @item_window4.help_window = @help_window
  2145. @item_window5.help_window = @help_window
  2146. @right_window.index = @equip_index
  2147.  
  2148. refresh
  2149. Graphics.transition
  2150. loop do
  2151. Graphics.update
  2152. Input.update
  2153.  
  2154. update
  2155. if $scene != self
  2156. break
  2157. end
  2158. end
  2159.  
  2160. Graphics.freeze
  2161. @help_window.dispose
  2162. @left_window.dispose
  2163. @right_window.dispose
  2164. @item_window1.dispose
  2165. @item_window2.dispose
  2166. @item_window3.dispose
  2167. @item_window4.dispose
  2168. @item_window5.dispose
  2169. @spriteset.dispose
  2170. end
  2171.  
  2172. def refresh
  2173. @item_window1.visible = (@right_window.index == 0)
  2174. @item_window2.visible = (@right_window.index == 1)
  2175. @item_window3.visible = (@right_window.index == 2)
  2176. @item_window4.visible = (@right_window.index == 3)
  2177. @item_window5.visible = (@right_window.index == 4)
  2178.  
  2179. item1 = @right_window.item
  2180.  
  2181. case @right_window.index
  2182. when 0
  2183. @item_window = @item_window1
  2184. when 1
  2185. @item_window = @item_window2
  2186. when 2
  2187. @item_window = @item_window3
  2188. when 3
  2189. @item_window = @item_window4
  2190. when 4
  2191. @item_window = @item_window5
  2192. end
  2193.  
  2194. if @right_window.active
  2195.  
  2196. @left_window.set_new_parameters(nil, nil, nil)
  2197. end
  2198.  
  2199. if @item_window.active
  2200. item2 = @item_window.item
  2201. last_hp = @actor.hp
  2202. last_sp = @actor.sp
  2203. @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  2204. new_atk = @actor.atk
  2205. new_pdef = @actor.pdef
  2206. new_mdef = @actor.mdef
  2207. @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  2208. @actor.hp = last_hp
  2209. @actor.sp = last_sp
  2210. @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  2211. end
  2212. end
  2213.  
  2214. def update
  2215. if @help_window.y < 0
  2216. @help_window.y += 10
  2217. end
  2218. @left_window.update
  2219. if @left_window.x < 0
  2220. @left_window.x += 10
  2221. end
  2222. @right_window.update
  2223. if @right_window.x > 272
  2224. @right_window.x -= 10
  2225. end
  2226. @item_window.update
  2227. if @item_window1.y > 256
  2228. @item_window1.y -= 10
  2229. end
  2230. if @item_window2.y > 256
  2231. @item_window2.y -= 10
  2232. end
  2233. if @item_window3.y > 256
  2234. @item_window3.y -= 10
  2235. end
  2236. if @item_window4.y > 256
  2237. @item_window4.y -= 10
  2238. end
  2239. if @item_window5.y > 256
  2240. @item_window5.y -= 10
  2241. end
  2242. refresh
  2243.  
  2244. if @right_window.active
  2245. update_right
  2246. return
  2247. end
  2248.  
  2249. if @item_window.active
  2250. update_item
  2251. return
  2252. end
  2253. end
  2254.  
  2255. def update_right
  2256.  
  2257. if Input.trigger?(Input::B)
  2258. $game_system.se_play($data_system.cancel_se)
  2259. $scene = Scene_Menu.new(2)
  2260. end
  2261. end
  2262. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement