pigu_6

Yanfly|- Victory Aftermath

Nov 24th, 2012
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.58 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Victory Aftermath v1.01
  4. # -- Last Updated: 2011.12.16
  5. # -- Level: Easy, Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-VictoryAftermath"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.26 - Compatibility Update: Command Autobattle
  17. # 2011.12.16 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # At the end of each battle, RPG Maker VX Ace by default shows text saying that
  23. # the party has gained so-and-so EXP while this person leveled up and your
  24. # party happened to find these drops. This script changes that text into
  25. # something more visual for your players to see. Active battle members will be
  26. # seen gaining EXP, any kind of level up changes, and a list of the items
  27. # obtained through drops.
  28. #
  29. #==============================================================================
  30. # ▼ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Actor Notetags - These notetags go in the actors notebox in the database.
  37. # -----------------------------------------------------------------------------
  38. # <win quotes>
  39. # string
  40. # string
  41. # </win quotes>
  42. # Sets the win quote for the actor. The strings are continuous and can use
  43. # text codes. Use \n for a line break. Type in what you want the actor to say
  44. # for the particular win quote. Use [New Quote] in between the two tags to
  45. # start up a new quote.
  46. #
  47. # <level quotes>
  48. # string
  49. # string
  50. # </level quotes>
  51. # Sets the level up quote for the actor. The strings are continuous and can use
  52. # text codes. Use \n for a line break. Type in what you want the actor to say
  53. # for the particular win quote. Use [New Quote] in between the two tags to
  54. # start up a new quote.
  55. #
  56. # <drops quotes>
  57. # string
  58. # string
  59. # </drops quotes>
  60. # Sets the drops quote for the actor. The strings are continuous and can use
  61. # text codes. Use \n for a line break. Type in what you want the actor to say
  62. # for the particular win quote. Use [New Quote] in between the two tags to
  63. # start up a new quote.
  64. #
  65. # -----------------------------------------------------------------------------
  66. # Class Notetags - These notetags go in the class notebox in the database.
  67. # -----------------------------------------------------------------------------
  68. # <win quotes>
  69. # string
  70. # string
  71. # </win quotes>
  72. # Sets the win quote for the class. The strings are continuous and can use
  73. # text codes. Use \n for a line break. Type in what you want the actor to say
  74. # for the particular win quote. Use [New Quote] in between the two tags to
  75. # start up a new quote.
  76. #
  77. # <level quotes>
  78. # string
  79. # string
  80. # </level quotes>
  81. # Sets the level up quote for the class. The strings are continuous and can use
  82. # text codes. Use \n for a line break. Type in what you want the actor to say
  83. # for the particular win quote. Use [New Quote] in between the two tags to
  84. # start up a new quote.
  85. #
  86. # <drops quotes>
  87. # string
  88. # string
  89. # </drops quotes>
  90. # Sets the drops quote for the class. The strings are continuous and can use
  91. # text codes. Use \n for a line break. Type in what you want the actor to say
  92. # for the particular win quote. Use [New Quote] in between the two tags to
  93. # start up a new quote.
  94. #
  95. #==============================================================================
  96. # ▼ Compatibility
  97. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  98. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  99. # it will run with RPG Maker VX without adjusting.
  100. #
  101. #==============================================================================
  102.  
  103. module YEA
  104. module VICTORY_AFTERMATH
  105.  
  106. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  107. # - General Settings -
  108. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  109. # These are various settings that are used throughout the Victory Aftermath
  110. # portion of a battle. Adjust them as you see fit.
  111. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  112. VICTORY_BGM = RPG::BGM.new("Field1", 100, 100) # Victory BGM
  113. VICTORY_TICK = RPG::SE.new("Decision1", 100, 150) # EXP ticking SFX
  114. LEVEL_SOUND = RPG::SE.new("Up4", 80, 150) # Level Up SFX
  115. SKILLS_TEXT = "New Skills" # New skills text title.
  116.  
  117. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  118. # - Important Settings -
  119. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  120. # These are some important settings so please set them up properly. This
  121. # section includes a switch that allows you to skip the victory aftermath
  122. # phase (for those back to back battles and making them seamless) and it
  123. # also allows you to declare a common event to run after each battle. If
  124. # you do not wish to use either of these features, set them to 0. The
  125. # common event will run regardless of win or escape.
  126. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  127. SKIP_AFTERMATH_SWITCH = 0 # If switch on, skip aftermath. 0 to disable.
  128. AFTERMATH_COMMON_EVENT = 0 # Runs common event after battle. 0 to disable.
  129.  
  130. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131. # - Top Text Settings -
  132. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133. # Here, you can adjust the various text that appears in the window that
  134. # appears at the top of the screen.
  135. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136. TOP_TEAM = "%s's team" # Team name used.
  137. TOP_VICTORY_TEXT = "%s is victorious!" # Text used to display victory.
  138. TOP_LEVEL_UP = "%s has leveled up!" # Text used to display level up.
  139. TOP_SPOILS = "Victory Spoils!" # Text used for spoils.
  140.  
  141. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  142. # - EXP Gauge Settings -
  143. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  144. # Adjust how the EXP Gauge appears for the Victory Aftermath here. This
  145. # includes the text display, the font size, the colour of the gauges, and
  146. # more. Adjust it all here.
  147. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148. VICTORY_EXP = "+%sEXP" # Text used to display EXP.
  149. EXP_PERCENT = "%1.2f%%" # The way EXP percentage will be displayed.
  150. LEVELUP_TEXT = "LEVEL UP!" # Text to replace percentage when leveled.
  151. MAX_LVL_TEXT = "MAX LEVEL" # Text to replace percentage when max level.
  152. FONTSIZE_EXP = 20 # Font size used for EXP.
  153. EXP_TICKS = 15 # Ticks to full EXP
  154. EXP_GAUGE1 = 12 # "Window" skin text colour for gauge.
  155. EXP_GAUGE2 = 4 # "Window" skin text colour for gauge.
  156. LEVEL_GAUGE1 = 13 # "Window" skin text colour for leveling.
  157. LEVEL_GAUGE2 = 5 # "Window" skin text colour for leveling.
  158.  
  159. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  160. # - Victory Messages -
  161. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  162. # In the Victory Aftermath, actors can say unique things. This is the pool
  163. # of quotes used for actors without any custom victory quotes. Note that
  164. # actors with custom quotes will take priority over classes with custom
  165. # quotes, which will take priority over these default quotes. Use \n for
  166. # a line break in the quotes.
  167. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  168. HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\n" # Always at start of messages.
  169. FOOTER_TEXT = "" # Always at end of messages.
  170.  
  171. # Win Quotes are what the actors say when a battle is won.
  172. VICTORY_QUOTES ={
  173. # :type => Quotes
  174. #------------------------------------------------------------------------
  175. :win => [ # Occurs as initial victory quote.
  176. '"We won! What an exciting fight!"',
  177. '"I didn\'t even break a sweat."',
  178. '"That wasn\'t so tough."',
  179. '"Let\'s fight something harder!"',
  180. ],# Do not remove this.
  181. #------------------------------------------------------------------------
  182. :level => [ # Occurs as initial victory quote.
  183. '"Yes! Level up!"',
  184. '"I\'ve gotten stronger!"',
  185. '"Try to keep up with me!"',
  186. '"I\'ve grown again!"',
  187. ],# Do not remove this.
  188. #------------------------------------------------------------------------
  189. :drops => [ # Occurs as initial victory quote.
  190. '"I\'ll be taking these."',
  191. '"To the victor goes the spoils."',
  192. '"The enemies dropped something!"',
  193. '"Hey, what\'s this?"',
  194. ],# Do not remove this.
  195. #------------------------------------------------------------------------
  196. } # Do not remove this.
  197.  
  198. end # VICTORY_AFTERMATH
  199. end # YEA
  200.  
  201. #==============================================================================
  202. # ▼ Editting anything past this point may potentially result in causing
  203. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  204. # halitosis so edit at your own risk.
  205. #==============================================================================
  206.  
  207. module YEA
  208. module REGEXP
  209. module BASEITEM
  210.  
  211. NEW_QUOTE = /\[(?:NEW_QUOTE|new quote)\]/i
  212.  
  213. WIN_QUOTE_ON = /<(?:WIN_QUOTES|win quote)>/i
  214. WIN_QUOTE_OFF = /<\/(?:WIN_QUOTES|win quote)>/i
  215. LEVEL_QUOTE_ON = /<(?:LEVEL_QUOTES|level quote)>/i
  216. LEVEL_QUOTE_OFF = /<\/(?:LEVEL_QUOTES|level quote)>/i
  217. DROPS_QUOTE_ON = /<(?:DROPS_QUOTES|drops quote)>/i
  218. DROPS_QUOTE_OFF = /<\/(?:DROPS_QUOTES|drops quote)>/i
  219.  
  220. end # BASEITEM
  221. end # REGEXP
  222. end # YEA
  223.  
  224. #==============================================================================
  225. # ■ Switch
  226. #==============================================================================
  227.  
  228. module Switch
  229.  
  230. #--------------------------------------------------------------------------
  231. # self.skip_aftermath
  232. #--------------------------------------------------------------------------
  233. def self.skip_aftermath
  234. return false if YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH <= 0
  235. return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH]
  236. end
  237.  
  238. end # Switch
  239.  
  240. #==============================================================================
  241. # ■ Numeric
  242. #==============================================================================
  243.  
  244. class Numeric
  245.  
  246. #--------------------------------------------------------------------------
  247. # new method: group_digits
  248. #--------------------------------------------------------------------------
  249. unless $imported["YEA-CoreEngine"]
  250. def group; return self.to_s; end
  251. end # $imported["YEA-CoreEngine"]
  252.  
  253. end # Numeric
  254.  
  255. #==============================================================================
  256. # ■ DataManager
  257. #==============================================================================
  258.  
  259. module DataManager
  260.  
  261. #--------------------------------------------------------------------------
  262. # alias method: load_database
  263. #--------------------------------------------------------------------------
  264. class <<self; alias load_database_va load_database; end
  265. def self.load_database
  266. load_database_va
  267. load_notetags_va
  268. end
  269.  
  270. #--------------------------------------------------------------------------
  271. # new method: load_notetags_va
  272. #--------------------------------------------------------------------------
  273. def self.load_notetags_va
  274. groups = [$data_actors, $data_classes]
  275. for group in groups
  276. for obj in group
  277. next if obj.nil?
  278. obj.load_notetags_va
  279. end
  280. end
  281. end
  282.  
  283. end # DataManager
  284.  
  285. #==============================================================================
  286. # ■ RPG::BaseItem
  287. #==============================================================================
  288.  
  289. class RPG::BaseItem
  290.  
  291. #--------------------------------------------------------------------------
  292. # public instance variables
  293. #--------------------------------------------------------------------------
  294. attr_accessor :win_quotes
  295. attr_accessor :level_quotes
  296. attr_accessor :drops_quotes
  297.  
  298. #--------------------------------------------------------------------------
  299. # common cache: load_notetags_va
  300. #--------------------------------------------------------------------------
  301. def load_notetags_va
  302. @win_quotes = [""]
  303. @level_quotes = [""]
  304. @drops_quotes = [""]
  305. @victory_quote_type = nil
  306. #---
  307. self.note.split(/[\r\n]+/).each { |line|
  308. case line
  309. #---
  310. when YEA::REGEXP::BASEITEM::WIN_QUOTE_ON
  311. @victory_quote_type = :win_quote
  312. when YEA::REGEXP::BASEITEM::WIN_QUOTE_OFF
  313. @victory_quote_type = nil
  314. when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_ON
  315. @victory_quote_type = :level_quote
  316. when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_OFF
  317. @victory_quote_type = nil
  318. when YEA::REGEXP::BASEITEM::DROPS_QUOTE_ON
  319. @victory_quote_type = :drops_quote
  320. when YEA::REGEXP::BASEITEM::DROPS_QUOTE_OFF
  321. @victory_quote_type = nil
  322. #---
  323. when YEA::REGEXP::BASEITEM::NEW_QUOTE
  324. case @victory_quote_type
  325. when nil; next
  326. when :win_quote; @win_quotes.push("")
  327. when :level_quote; @level_quotes.push("")
  328. when :drops_quote; @drops_quotes.push("")
  329. end
  330. #---
  331. else
  332. case @victory_quote_type
  333. when nil; next
  334. when :win_quote; @win_quotes[@win_quotes.size-1] += line.to_s
  335. when :level_quote; @level_quotes[@level_quotes.size-1] += line.to_s
  336. when :drops_quote; @drops_quotes[@drops_quotes.size-1] += line.to_s
  337. end
  338. end
  339. } # self.note.split
  340. #---
  341. return unless self.is_a?(RPG::Class)
  342. quotes = YEA::VICTORY_AFTERMATH::VICTORY_QUOTES
  343. @win_quotes = quotes[:win].clone if @win_quotes == [""]
  344. @level_quotes = quotes[:level].clone if @level_quotes == [""]
  345. @drops_quotes = quotes[:drops].clone if @drops_quotes == [""]
  346. end
  347.  
  348. end # RPG::BaseItem
  349.  
  350. #==============================================================================
  351. # ■ BattleManager
  352. #==============================================================================
  353.  
  354. module BattleManager
  355.  
  356. #--------------------------------------------------------------------------
  357. # overwrite method: self.process_victory
  358. #--------------------------------------------------------------------------
  359. def self.process_victory
  360. if $imported["YEA-CommandAutobattle"]
  361. SceneManager.scene.close_disable_autobattle_window
  362. end
  363. if Switch.skip_aftermath
  364. skip_aftermath
  365. return
  366. end
  367. play_battle_end_me
  368. display_exp
  369. gain_exp
  370. gain_gold
  371. gain_drop_items
  372. close_windows
  373. SceneManager.return
  374. replay_bgm_and_bgs
  375. battle_end(0)
  376. return true
  377. end
  378.  
  379. #--------------------------------------------------------------------------
  380. # new method: self.skip_aftermath
  381. #--------------------------------------------------------------------------
  382. def self.skip_aftermath
  383. $game_party.all_members.each do |actor|
  384. actor.gain_exp($game_troop.exp_total)
  385. end
  386. $game_party.gain_gold($game_troop.gold_total)
  387. $game_troop.make_drop_items.each do |item|
  388. $game_party.gain_item(item, 1)
  389. end
  390. close_windows
  391. SceneManager.return
  392. replay_bgm_and_bgs
  393. battle_end(0)
  394. end
  395.  
  396. #--------------------------------------------------------------------------
  397. # overwrite method: self.play_battle_end_me
  398. #--------------------------------------------------------------------------
  399. def self.play_battle_end_me
  400. $game_system.battle_end_me.play
  401. YEA::VICTORY_AFTERMATH::VICTORY_BGM.play
  402. end
  403.  
  404. #--------------------------------------------------------------------------
  405. # new method: self.set_victory_text
  406. #--------------------------------------------------------------------------
  407. def self.set_victory_text(actor, type)
  408. text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
  409. text += actor.victory_quotes(type)[rand(actor.victory_quotes(type).size)]
  410. text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
  411. $game_message.face_name = actor.face_name
  412. $game_message.face_index = actor.face_index
  413. $game_message.add(text)
  414. wait_for_message
  415. end
  416.  
  417. #--------------------------------------------------------------------------
  418. # overwrite method: self.display_exp
  419. #--------------------------------------------------------------------------
  420. def self.display_exp
  421. SceneManager.scene.show_victory_display_exp
  422. actor = $game_party.random_target
  423. @victory_actor = actor
  424. set_victory_text(@victory_actor, :win)
  425. end
  426.  
  427. #--------------------------------------------------------------------------
  428. # overwrite method: self.gain_exp
  429. #--------------------------------------------------------------------------
  430. def self.gain_exp
  431. $game_party.all_members.each do |actor|
  432. temp_actor = Marshal.load(Marshal.dump(actor))
  433. actor.gain_exp($game_troop.exp_total)
  434. next if actor.level == temp_actor.level
  435. SceneManager.scene.show_victory_level_up(actor, temp_actor)
  436. set_victory_text(actor, :level)
  437. wait_for_message
  438. end
  439. end
  440.  
  441. #--------------------------------------------------------------------------
  442. # overwrite method: self.gain_gold
  443. #--------------------------------------------------------------------------
  444. def self.gain_gold
  445. $game_party.gain_gold($game_troop.gold_total)
  446. end
  447.  
  448. #--------------------------------------------------------------------------
  449. # overwrite method: self.gain_drop_items
  450. #--------------------------------------------------------------------------
  451. def self.gain_drop_items
  452. drops = []
  453. $game_troop.make_drop_items.each do |item|
  454. $game_party.gain_item(item, 1)
  455. drops.push(item)
  456. end
  457. SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
  458. set_victory_text(@victory_actor, :drops)
  459. wait_for_message
  460. end
  461.  
  462. #--------------------------------------------------------------------------
  463. # new method: self.close_windows
  464. #--------------------------------------------------------------------------
  465. def self.close_windows
  466. SceneManager.scene.close_victory_windows
  467. end
  468.  
  469. #--------------------------------------------------------------------------
  470. # alias method: load_database
  471. #--------------------------------------------------------------------------
  472. class <<self; alias battle_end_va battle_end; end
  473. def self.battle_end(result)
  474. battle_end_va(result)
  475. return if result == 2
  476. return if YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT <= 0
  477. event_id = YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT
  478. $game_temp.reserve_common_event(event_id)
  479. end
  480.  
  481. end # BattleManager
  482.  
  483. #==============================================================================
  484. # ■ Game_Actor
  485. #==============================================================================
  486.  
  487. class Game_Actor < Game_Battler
  488.  
  489. #--------------------------------------------------------------------------
  490. # overwrite method: gain_exp
  491. #--------------------------------------------------------------------------
  492. def gain_exp(exp)
  493. enabled = !SceneManager.scene_is?(Scene_Battle)
  494. change_exp(self.exp + (exp * final_exp_rate).to_i, enabled)
  495. end
  496.  
  497. #--------------------------------------------------------------------------
  498. # new method: victory_quotes
  499. #--------------------------------------------------------------------------
  500. def victory_quotes(type)
  501. case type
  502. when :win
  503. return self.actor.win_quotes if self.actor.win_quotes != [""]
  504. return self.class.win_quotes
  505. when :level
  506. return self.actor.level_quotes if self.actor.level_quotes != [""]
  507. return self.class.level_quotes
  508. when :drops
  509. return self.actor.drops_quotes if self.actor.drops_quotes != [""]
  510. return self.class.drops_quotes
  511. else
  512. return ["NOTEXT"]
  513. end
  514. end
  515.  
  516. end # Game_Actor
  517.  
  518. #==============================================================================
  519. # ■ Window_VictoryTitle
  520. #==============================================================================
  521.  
  522. class Window_VictoryTitle < Window_Base
  523.  
  524. #--------------------------------------------------------------------------
  525. # initialize
  526. #--------------------------------------------------------------------------
  527. def initialize
  528. super(0, 0, Graphics.width, fitting_height(1))
  529. self.z = 200
  530. self.openness = 0
  531. end
  532.  
  533. #--------------------------------------------------------------------------
  534. # refresh
  535. #--------------------------------------------------------------------------
  536. def refresh(message = "")
  537. contents.clear
  538. draw_text(0, 0, contents.width, line_height, message, 1)
  539. end
  540.  
  541. end # Window_VictoryTitle
  542.  
  543. #==============================================================================
  544. # ■ Window_VictoryEXP_Back
  545. #==============================================================================
  546.  
  547. class Window_VictoryEXP_Back < Window_Selectable
  548.  
  549. #--------------------------------------------------------------------------
  550. # initialize
  551. #--------------------------------------------------------------------------
  552. def initialize
  553. super(0, fitting_height(1), Graphics.width, window_height)
  554. self.z = 200
  555. self.openness = 0
  556. end
  557.  
  558. #--------------------------------------------------------------------------
  559. # window_height
  560. #--------------------------------------------------------------------------
  561. def window_height
  562. return Graphics.height - fitting_height(4) - fitting_height(1)
  563. end
  564.  
  565. #--------------------------------------------------------------------------
  566. # col_max
  567. #--------------------------------------------------------------------------
  568. def col_max; return item_max; end
  569.  
  570. #--------------------------------------------------------------------------
  571. # spacing
  572. #--------------------------------------------------------------------------
  573. def spacing; return 8; end
  574.  
  575. #--------------------------------------------------------------------------
  576. # item_max
  577. #--------------------------------------------------------------------------
  578. def item_max; return $game_party.battle_members.size; end
  579.  
  580. #--------------------------------------------------------------------------
  581. # open
  582. #--------------------------------------------------------------------------
  583. def open
  584. @exp_total = $game_troop.exp_total
  585. super
  586. end
  587.  
  588. #--------------------------------------------------------------------------
  589. # item_rect
  590. #--------------------------------------------------------------------------
  591. def item_rect(index)
  592. rect = Rect.new
  593. rect.width = item_width
  594. rect.height = contents.height
  595. rect.x = index % col_max * (item_width + spacing)
  596. rect.y = index / col_max * item_height
  597. return rect
  598. end
  599.  
  600. #--------------------------------------------------------------------------
  601. # draw_item
  602. #--------------------------------------------------------------------------
  603. def draw_item(index)
  604. actor = $game_party.battle_members[index]
  605. return if actor.nil?
  606. rect = item_rect(index)
  607. reset_font_settings
  608. draw_actor_name(actor, rect)
  609. draw_exp_gain(actor, rect)
  610. draw_actor_face(actor, rect)
  611. end
  612.  
  613. #--------------------------------------------------------------------------
  614. # draw_actor_name
  615. #--------------------------------------------------------------------------
  616. def draw_actor_name(actor, rect)
  617. name = actor.name
  618. draw_text(rect.x, rect.y+line_height, rect.width, line_height, name, 1)
  619. end
  620.  
  621. #--------------------------------------------------------------------------
  622. # draw_actor_face
  623. #--------------------------------------------------------------------------
  624. def draw_actor_face(actor, rect)
  625. face_name = actor.face_name
  626. face_index = actor.face_index
  627. bitmap = Cache.face(face_name)
  628. rw = [rect.width, 96].min
  629. face_rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, rw, 96)
  630. rx = (rect.width - rw) / 2 + rect.x
  631. contents.blt(rx, rect.y + line_height * 2, bitmap, face_rect, 255)
  632. end
  633.  
  634. #--------------------------------------------------------------------------
  635. # draw_exp_gain
  636. #--------------------------------------------------------------------------
  637. def draw_exp_gain(actor, rect)
  638. dw = rect.width - (rect.width - [rect.width, 96].min) / 2
  639. dy = rect.y + line_height * 3 + 96
  640. fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP
  641. text = sprintf(fmt, actor_exp_gain(actor).group)
  642. contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
  643. change_color(power_up_color)
  644. draw_text(rect.x, dy, dw, line_height, text, 2)
  645. end
  646.  
  647. #--------------------------------------------------------------------------
  648. # actor_exp_gain
  649. #--------------------------------------------------------------------------
  650. def actor_exp_gain(actor)
  651. n = @exp_total * actor.final_exp_rate
  652. return n.to_i
  653. end
  654.  
  655. end # Window_VictoryEXP_Back
  656.  
  657. #==============================================================================
  658. # ■ Window_VictoryEXP_Front
  659. #==============================================================================
  660.  
  661. class Window_VictoryEXP_Front < Window_VictoryEXP_Back
  662.  
  663. #--------------------------------------------------------------------------
  664. # initialize
  665. #--------------------------------------------------------------------------
  666. def initialize
  667. super
  668. self.back_opacity = 0
  669. @ticks = 0
  670. @counter = 30
  671. contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
  672. end
  673.  
  674. #--------------------------------------------------------------------------
  675. # update
  676. #--------------------------------------------------------------------------
  677. def update
  678. super
  679. update_tick
  680. end
  681.  
  682. #--------------------------------------------------------------------------
  683. # update_tick
  684. #--------------------------------------------------------------------------
  685. def update_tick
  686. return unless self.openness >= 255
  687. return unless self.visible
  688. return if complete_ticks?
  689. @counter -= 1
  690. return unless @counter <= 0
  691. return if @ticks >= YEA::VICTORY_AFTERMATH::EXP_TICKS
  692. YEA::VICTORY_AFTERMATH::VICTORY_TICK.play
  693. @counter = 4
  694. @ticks += 1
  695. refresh
  696. end
  697.  
  698. #--------------------------------------------------------------------------
  699. # complete_ticks?
  700. #--------------------------------------------------------------------------
  701. def complete_ticks?
  702. for actor in $game_party.battle_members
  703. total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
  704. bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
  705. now_exp = actor.exp - actor.current_level_exp + bonus_exp
  706. next_exp = actor.next_level_exp - actor.current_level_exp
  707. rate = now_exp * 1.0 / next_exp
  708. return false if rate < 1.0
  709. end
  710. return true
  711. end
  712.  
  713. #--------------------------------------------------------------------------
  714. # draw_item
  715. #--------------------------------------------------------------------------
  716. def draw_item(index)
  717. actor = $game_party.battle_members[index]
  718. return if actor.nil?
  719. rect = item_rect(index)
  720. draw_actor_exp(actor, rect)
  721. end
  722.  
  723. #--------------------------------------------------------------------------
  724. # exp_gauge1
  725. #--------------------------------------------------------------------------
  726. def exp_gauge1; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE1); end
  727.  
  728. #--------------------------------------------------------------------------
  729. # exp_gauge2
  730. #--------------------------------------------------------------------------
  731. def exp_gauge2; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE2); end
  732.  
  733. #--------------------------------------------------------------------------
  734. # lvl_gauge1
  735. #--------------------------------------------------------------------------
  736. def lvl_gauge1; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE1); end
  737.  
  738. #--------------------------------------------------------------------------
  739. # lvl_gauge2
  740. #--------------------------------------------------------------------------
  741. def lvl_gauge2; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE2); end
  742.  
  743. #--------------------------------------------------------------------------
  744. # draw_actor_exp
  745. #--------------------------------------------------------------------------
  746. def draw_actor_exp(actor, rect)
  747. if actor.max_level?
  748. draw_exp_gauge(actor, rect, 1.0)
  749. return
  750. end
  751. total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
  752. bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
  753. now_exp = actor.exp - actor.current_level_exp + bonus_exp
  754. next_exp = actor.next_level_exp - actor.current_level_exp
  755. rate = now_exp * 1.0 / next_exp
  756. draw_exp_gauge(actor, rect, rate)
  757. end
  758.  
  759. #--------------------------------------------------------------------------
  760. # draw_exp_gauge
  761. #--------------------------------------------------------------------------
  762. def draw_exp_gauge(actor, rect, rate)
  763. dx = (rect.width - [rect.width, 96].min) / 2 + rect.x
  764. dy = rect.y + line_height * 2 + 96
  765. dw = [rect.width, 96].min
  766. colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1
  767. colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2
  768. draw_gauge(dx, dy, dw, rate, colour1, colour2)
  769. fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT
  770. text = sprintf(fmt, [rate * 100, 100.00].min)
  771. if [rate * 100, 100.00].min == 100.00
  772. text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT
  773. text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.max_level?
  774. end
  775. draw_text(dx, dy, dw, line_height, text, 1)
  776. end
  777.  
  778. end # Window_VictoryEXP_Front
  779.  
  780. #==============================================================================
  781. # ■ Window_VictoryLevelUp
  782. #==============================================================================
  783.  
  784. class Window_VictoryLevelUp < Window_Base
  785.  
  786. #--------------------------------------------------------------------------
  787. # initialize
  788. #--------------------------------------------------------------------------
  789. def initialize
  790. super(0, fitting_height(1), Graphics.width, window_height)
  791. self.z = 200
  792. hide
  793. end
  794.  
  795. #--------------------------------------------------------------------------
  796. # window_height
  797. #--------------------------------------------------------------------------
  798. def window_height
  799. return Graphics.height - fitting_height(4) - fitting_height(1)
  800. end
  801.  
  802. #--------------------------------------------------------------------------
  803. # refresh
  804. #--------------------------------------------------------------------------
  805. def refresh(actor, temp_actor)
  806. contents.clear
  807. reset_font_settings
  808. YEA::VICTORY_AFTERMATH::LEVEL_SOUND.play
  809. draw_actor_changes(actor, temp_actor)
  810. end
  811.  
  812. #--------------------------------------------------------------------------
  813. # draw_actor_changes
  814. #--------------------------------------------------------------------------
  815. def draw_actor_changes(actor, temp_actor)
  816. dx = contents.width / 16
  817. draw_actor_image(actor, temp_actor, dx)
  818. draw_param_names(actor, dx)
  819. draw_former_stats(temp_actor)
  820. draw_arrows
  821. draw_newer_stats(actor, temp_actor)
  822. draw_new_skills(actor, temp_actor)
  823. end
  824.  
  825. #--------------------------------------------------------------------------
  826. # draw_actor_image
  827. #--------------------------------------------------------------------------
  828. def draw_actor_image(actor, temp_actor, dx)
  829. draw_text(dx, line_height, 96, line_height, actor.name, 1)
  830. draw_actor_face(actor, dx, line_height * 2)
  831. exp = actor.exp - temp_actor.exp
  832. text = sprintf(YEA::VICTORY_AFTERMATH::VICTORY_EXP, exp.group)
  833. change_color(power_up_color)
  834. contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
  835. draw_text(0, line_height * 2 + 96, dx + 96, line_height, text, 2)
  836. reset_font_settings
  837. end
  838.  
  839. #--------------------------------------------------------------------------
  840. # draw_param_names
  841. #--------------------------------------------------------------------------
  842. def draw_param_names(actor, dx)
  843. dx += 108
  844. change_color(system_color)
  845. text = Vocab.level
  846. draw_text(dx, 0, contents.width - dx, line_height, text)
  847. dy = 0
  848. for i in 0...8
  849. dy += line_height
  850. text = Vocab.param(i)
  851. draw_text(dx, dy, contents.width - dx, line_height, text)
  852. end
  853. end
  854.  
  855. #--------------------------------------------------------------------------
  856. # draw_former_stats
  857. #--------------------------------------------------------------------------
  858. def draw_former_stats(actor)
  859. dw = contents.width / 2 - 12
  860. dy = 0
  861. change_color(normal_color)
  862. draw_text(0, dy, dw, line_height, actor.level.group, 2)
  863. for i in 0...8
  864. dy += line_height
  865. draw_text(0, dy, dw, line_height, actor.param(i).group, 2)
  866. end
  867. end
  868.  
  869. #--------------------------------------------------------------------------
  870. # draw_arrows
  871. #--------------------------------------------------------------------------
  872. def draw_arrows
  873. dx = contents.width / 2 - 12
  874. dy = 0
  875. change_color(system_color)
  876. for i in 0..8
  877. draw_text(dx, dy, 24, line_height, "→", 1)
  878. dy += line_height
  879. end
  880. end
  881.  
  882. #--------------------------------------------------------------------------
  883. # draw_newer_stats
  884. #--------------------------------------------------------------------------
  885. def draw_newer_stats(actor, temp_actor)
  886. dx = contents.width / 2 + 12
  887. dw = contents.width - dx
  888. dy = 0
  889. change_color(param_change_color(actor.level - temp_actor.level))
  890. draw_text(dx, dy, dw, line_height, actor.level.group, 0)
  891. for i in 0...8
  892. dy += line_height
  893. change_color(param_change_color(actor.param(i) - temp_actor.param(i)))
  894. draw_text(dx, dy, dw, line_height, actor.param(i).group, 0)
  895. end
  896. end
  897.  
  898. #--------------------------------------------------------------------------
  899. # draw_new_skills
  900. #--------------------------------------------------------------------------
  901. def draw_new_skills(actor, temp_actor)
  902. return if temp_actor.skills.size == actor.skills.size
  903. dw = 172 + 24
  904. dx = contents.width - dw
  905. change_color(system_color)
  906. text = YEA::VICTORY_AFTERMATH::SKILLS_TEXT
  907. draw_text(dx, 0, dw, line_height, text, 0)
  908. end
  909.  
  910. end # Window_VictoryLevelUp
  911.  
  912. #==============================================================================
  913. # ■ Window_VictorySkills
  914. #==============================================================================
  915.  
  916. class Window_VictorySkills < Window_Selectable
  917.  
  918. #--------------------------------------------------------------------------
  919. # initialize
  920. #--------------------------------------------------------------------------
  921. def initialize
  922. dy = fitting_height(1) + 24
  923. dw = 172 + 24 + 24
  924. dh = Graphics.height - fitting_height(4) - fitting_height(1) - 24
  925. super(Graphics.width - dw, dy, dw, dh)
  926. self.opacity = 0
  927. self.z = 200
  928. hide
  929. end
  930.  
  931. #--------------------------------------------------------------------------
  932. # item_max
  933. #--------------------------------------------------------------------------
  934. def item_max; return @data.nil? ? 0 : @data.size; end
  935.  
  936. #--------------------------------------------------------------------------
  937. # refresh
  938. #--------------------------------------------------------------------------
  939. def refresh(actor, temp_actor)
  940. contents.clear
  941. if actor.skills.size == temp_actor.skills.size
  942. unselect
  943. @data = []
  944. create_contents
  945. return
  946. end
  947. @data = actor.skills - temp_actor.skills
  948. if @data.size > 8
  949. select(0)
  950. activate
  951. else
  952. unselect
  953. deactivate
  954. end
  955. create_contents
  956. draw_all_items
  957. end
  958.  
  959. #--------------------------------------------------------------------------
  960. # refresh
  961. #--------------------------------------------------------------------------
  962. def draw_item(index)
  963. rect = item_rect(index)
  964. skill = @data[index]
  965. return if skill.nil?
  966. rect.width -= 4
  967. draw_item_name(skill, rect.x, rect.y, true)
  968. end
  969.  
  970. end # Window_VictorySkills
  971.  
  972. #==============================================================================
  973. # ■ Window_VictorySpoils
  974. #==============================================================================
  975.  
  976. class Window_VictorySpoils < Window_ItemList
  977.  
  978. #--------------------------------------------------------------------------
  979. # initialize
  980. #--------------------------------------------------------------------------
  981. def initialize
  982. super(0, fitting_height(1), Graphics.width, window_height)
  983. self.z = 200
  984. hide
  985. end
  986.  
  987. #--------------------------------------------------------------------------
  988. # window_height
  989. #--------------------------------------------------------------------------
  990. def window_height
  991. return Graphics.height - fitting_height(4) - fitting_height(1)
  992. end
  993.  
  994. #--------------------------------------------------------------------------
  995. # spacing
  996. #--------------------------------------------------------------------------
  997. def spacing; return 32; end
  998.  
  999. #--------------------------------------------------------------------------
  1000. # make
  1001. #--------------------------------------------------------------------------
  1002. def make(gold, drops)
  1003. @gold = gold
  1004. @drops = drops
  1005. refresh
  1006. select(0)
  1007. activate
  1008. end
  1009.  
  1010. #--------------------------------------------------------------------------
  1011. # make_item_list
  1012. #--------------------------------------------------------------------------
  1013. def make_item_list
  1014. @data = [nil]
  1015. items = {}
  1016. weapons = {}
  1017. armours = {}
  1018. @goods = {}
  1019. for item in @drops
  1020. case item
  1021. when RPG::Item
  1022. items[item] = 0 if items[item].nil?
  1023. items[item] += 1
  1024. when RPG::Weapon
  1025. weapons[item] = 0 if weapons[item].nil?
  1026. weapons[item] += 1
  1027. when RPG::Armor
  1028. armours[item] = 0 if armours[item].nil?
  1029. armours[item] += 1
  1030. end
  1031. end
  1032. items = items.sort { |a,b| a[0].id <=> b[0].id }
  1033. weapons = weapons.sort { |a,b| a[0].id <=> b[0].id }
  1034. armours = armours.sort { |a,b| a[0].id <=> b[0].id }
  1035. for key in items; @goods[key[0]] = key[1]; @data.push(key[0]); end
  1036. for key in weapons; @goods[key[0]] = key[1]; @data.push(key[0]); end
  1037. for key in armours; @goods[key[0]] = key[1]; @data.push(key[0]); end
  1038. end
  1039.  
  1040. #--------------------------------------------------------------------------
  1041. # draw_item
  1042. #--------------------------------------------------------------------------
  1043. def draw_item(index)
  1044. item = @data[index]
  1045. rect = item_rect(index)
  1046. reset_font_settings
  1047. if item.nil?
  1048. draw_gold(rect)
  1049. return
  1050. end
  1051. rect.width -= 4
  1052. draw_item_name(item, rect.x, rect.y, true, rect.width - 24)
  1053. draw_item_number(rect, item)
  1054. end
  1055.  
  1056. #--------------------------------------------------------------------------
  1057. # draw_gold
  1058. #--------------------------------------------------------------------------
  1059. def draw_gold(rect)
  1060. text = Vocab.currency_unit
  1061. draw_currency_value(@gold, text, rect.x, rect.y, rect.width)
  1062. end
  1063.  
  1064. #--------------------------------------------------------------------------
  1065. # draw_item_number
  1066. #--------------------------------------------------------------------------
  1067. def draw_item_number(rect, item)
  1068. number = @goods[item].group
  1069. if $imported["YEA-AdjustLimits"]
  1070. contents.font.size = YEA::LIMIT::ITEM_FONT
  1071. text = sprintf(YEA::LIMIT::ITEM_PREFIX, number)
  1072. draw_text(rect, text, 2)
  1073. else
  1074. draw_text(rect, sprintf(":%s", number), 2)
  1075. end
  1076. end
  1077.  
  1078. end # Window_VictorySpoils
  1079.  
  1080. #==============================================================================
  1081. # ■ Scene_Battle
  1082. #==============================================================================
  1083.  
  1084. class Scene_Battle < Scene_Base
  1085.  
  1086. #--------------------------------------------------------------------------
  1087. # alias method: create_all_windows
  1088. #--------------------------------------------------------------------------
  1089. alias scene_battle_create_all_windows_va create_all_windows
  1090. def create_all_windows
  1091. scene_battle_create_all_windows_va
  1092. create_victory_aftermath_windows
  1093. end
  1094.  
  1095. #--------------------------------------------------------------------------
  1096. # new method: create_victory_aftermath_windows
  1097. #--------------------------------------------------------------------------
  1098. def create_victory_aftermath_windows
  1099. @victory_title_window = Window_VictoryTitle.new
  1100. @victory_exp_window_back = Window_VictoryEXP_Back.new
  1101. @victory_exp_window_front = Window_VictoryEXP_Front.new
  1102. @victory_level_window = Window_VictoryLevelUp.new
  1103. @victory_level_skills = Window_VictorySkills.new
  1104. @victory_spoils_window = Window_VictorySpoils.new
  1105. end
  1106.  
  1107. #--------------------------------------------------------------------------
  1108. # new method: show_victory_display_exp
  1109. #--------------------------------------------------------------------------
  1110. def show_victory_display_exp
  1111. @victory_title_window.open
  1112. name = $game_party.battle_members[0].name
  1113. fmt = YEA::VICTORY_AFTERMATH::TOP_TEAM
  1114. name = sprintf(fmt, name) if $game_party.battle_members.size > 1
  1115. fmt = YEA::VICTORY_AFTERMATH::TOP_VICTORY_TEXT
  1116. text = sprintf(fmt, name)
  1117. @victory_title_window.refresh(text)
  1118. #---
  1119. @victory_exp_window_back.open
  1120. @victory_exp_window_back.refresh
  1121. @victory_exp_window_front.open
  1122. @victory_exp_window_front.refresh
  1123. end
  1124.  
  1125. #--------------------------------------------------------------------------
  1126. # new method: show_victory_level_up
  1127. #--------------------------------------------------------------------------
  1128. def show_victory_level_up(actor, temp_actor)
  1129. @victory_exp_window_back.hide
  1130. @victory_exp_window_front.hide
  1131. #---
  1132. fmt = YEA::VICTORY_AFTERMATH::TOP_LEVEL_UP
  1133. text = sprintf(fmt, actor.name)
  1134. @victory_title_window.refresh(text)
  1135. #---
  1136. @victory_level_window.show
  1137. @victory_level_window.refresh(actor, temp_actor)
  1138. @victory_level_skills.show
  1139. @victory_level_skills.refresh(actor, temp_actor)
  1140. end
  1141.  
  1142. #--------------------------------------------------------------------------
  1143. # new method: show_victory_spoils
  1144. #--------------------------------------------------------------------------
  1145. def show_victory_spoils(gold, drops)
  1146. @victory_exp_window_back.hide
  1147. @victory_exp_window_front.hide
  1148. @victory_level_window.hide
  1149. @victory_level_skills.hide
  1150. #---
  1151. text = YEA::VICTORY_AFTERMATH::TOP_SPOILS
  1152. @victory_title_window.refresh(text)
  1153. #---
  1154. @victory_spoils_window.show
  1155. @victory_spoils_window.make(gold, drops)
  1156. end
  1157.  
  1158. #--------------------------------------------------------------------------
  1159. # new method: close_victory_windows
  1160. #--------------------------------------------------------------------------
  1161. def close_victory_windows
  1162. @victory_title_window.close
  1163. @victory_exp_window_back.close
  1164. @victory_exp_window_front.close
  1165. @victory_level_window.close
  1166. @victory_level_skills.close
  1167. @victory_spoils_window.close
  1168. wait(16)
  1169. end
  1170.  
  1171. end # Scene_Battle
  1172.  
  1173. #==============================================================================
  1174. #
  1175. # ▼ End of File
  1176. #
  1177. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment