Advertisement
SSTrihan

HorrorVale victory aftermath extended

Apr 10th, 2022 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.13 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Don't remove this header!
  3. #-------------------------------------------------------------------------------
  4. # Victory Aftermath extension
  5. # by Trihan
  6. #
  7. # Version : 1.2
  8. #
  9. # This script is commissioned by Batworks Software.
  10. #-------------------------------------------------------------------------------
  11.  
  12. #-------------------------------------------------------------------------------
  13. # Version History
  14. #-------------------------------------------------------------------------------
  15. # 1.2 - Fixed a bug where new abilities weren't appearing in the correct column.
  16. # 1.1 - Fixed a bug where the new abilities display was incorrectly positioned
  17. #       for 1-3 party members.
  18. # 1.0 - Initial script.
  19. #-------------------------------------------------------------------------------
  20.  
  21. #-------------------------------------------------------------------------------
  22. # This script modifies the victory aftermath screen to show a unified exp
  23. # gain/percentage for the party as a whole, and removes the individual level
  24. # up screens and replaces them with a party-wide display of new skills.
  25. #
  26. # Plug and play, no configuration required.
  27. #-------------------------------------------------------------------------------
  28. module BattleManager
  29.   def self.gain_exp
  30.     actor = $game_party.random_target
  31.     temp_actor = Marshal.load(Marshal.dump(actor))
  32.     temp_party = $game_party.battle_members.map { |member| Marshal.load(Marshal.dump(member)) }
  33.     $game_party.all_members.each do |actor|
  34.       actor.gain_exp($game_troop.exp_total)
  35.     end
  36.     if $game_party.leader.level > temp_actor.level
  37.       SceneManager.scene.show_victory_level_up(actor, temp_party)
  38.       set_victory_text(actor, :level)
  39.       wait_for_message
  40.     end
  41.   end
  42. end
  43.  
  44. class Window_VictoryEXP_Back < Window_Selectable
  45.   def draw_item(index)
  46.     actor = $game_party.battle_members[index]
  47.     return if actor.nil?
  48.     rect = item_rect(index)
  49.     reset_font_settings
  50.     draw_actor_name(actor, rect)
  51.     change_color(system_color)
  52.     contents.font.size -= 6
  53.     rw = [rect.width, 96].min
  54.     rx = (rect.width - rw) / 2 + rect.x
  55.     draw_text(rx, rect.y + line_height * 2, rect.width, rect.height, "New Abilities") if !SceneManager.scene.victory_exp_window_front.visible
  56.     draw_actor_face(actor, rect)
  57.   end
  58.  
  59.   alias :tlb_victoryexp_refresh :refresh
  60.   def refresh
  61.     tlb_victoryexp_refresh
  62.     fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP
  63.     text = sprintf(fmt, actor_exp_gain($game_party.leader).group)
  64.     rect = Rect.new(0, item_height, contents.width, contents.height)
  65.     draw_exp_gain($game_party.leader, rect) if SceneManager.scene.victory_exp_window_front.visible
  66.   end
  67. end
  68.  
  69. class Window_VictoryEXP_Front < Window_VictoryEXP_Back
  70.   def refresh
  71.     contents.clear
  72.     rect = Rect.new(0, item_height, contents.width, contents.height)
  73.     draw_actor_exp($game_party.leader, rect)
  74.   end
  75. end
  76.  
  77. class Window_VictoryLevelUp < Window_Base
  78.   alias :tlb_victorylevelup_initialize :initialize
  79.   def initialize
  80.     tlb_victorylevelup_initialize
  81.     self.back_opacity = 0
  82.   end
  83.  
  84.   def refresh
  85.     contents.clear
  86.     reset_font_settings
  87.     YEA::VICTORY_AFTERMATH::LEVEL_SOUND.play
  88.     text = "LEVEL #{$game_party.leader.level}"
  89.     change_color(text_color(0))
  90.     draw_text(0, contents.height - line_height, contents.width, line_height, text, 1)
  91.   end
  92. end
  93.  
  94. class Window_VictorySkills < Window_Selectable
  95.   def initialize
  96.     dy = fitting_height(1) + 14 + line_height * 6
  97.     dh = Graphics.height - fitting_height(4) - fitting_height(1)
  98.     super(0, dy, Graphics.width, dh)
  99.     self.opacity = 0
  100.     self.z = 200
  101.     hide
  102.   end
  103.  
  104.   def item_max; return $game_party.members.size; end
  105.    
  106.   def col_max; return item_max; end
  107.  
  108.   def refresh(temp_party)
  109.     contents.clear
  110.     create_contents
  111.     $game_party.battle_members.each_with_index do |actor, index|
  112.       @data = actor.skills - temp_party[index].skills
  113.       @data.each_with_index do |skill, idx|
  114.         draw_item(idx, index)
  115.       end
  116.     end
  117.   end
  118.  
  119.   def draw_item(index, column)
  120.     rect = item_rect(1)
  121.     skill = @data[index]
  122.     return if skill.nil?
  123.     rect.width -= 4
  124.     self.contents.font.size -= 8
  125.     rw = [rect.width, 96].min
  126.     if $game_party.members.size == 3
  127.       rx = rect.x * column + 25 - 8 * column
  128.     elsif $game_party.members.size == 2
  129.       rx = rect.x * column + 70 - 10 * column
  130.     else
  131.       rx = rect.x * column + 200
  132.       rect.y -= line_height
  133.     end
  134.     draw_item_name(skill, rx, rect.y + line_height * index - 5 * index, true)
  135.     self.contents.font.size += 8
  136.   end
  137. end
  138.  
  139. class Scene_Battle < Scene_Base
  140.   attr_reader :victory_exp_window_front
  141.   def show_victory_level_up(actor, temp_party)
  142.     @victory_exp_window_front.hide
  143.     @victory_exp_window_back.refresh
  144.     #---
  145.     fmt = YEA::VICTORY_AFTERMATH::TOP_LEVEL_UP
  146.     text = sprintf(fmt, $game_party.name)
  147.     @victory_title_window.refresh(text)
  148.     #---
  149.     @victory_level_window.show
  150.     @victory_level_window.refresh
  151.     @victory_level_skills.show
  152.     @victory_level_skills.refresh(temp_party)
  153.   end
  154. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement