SHARE
TWEET

YEA - Victory Aftermath

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