Advertisement
roninator2

Yanfly Victory Aftermath - No Message Window

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