#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_va load_database; end
def self.load_database
load_database_va
load_notetags_va
end
#--------------------------------------------------------------------------
# new method: load_notetags_va
#--------------------------------------------------------------------------
def self.load_notetags_va
groups = [$data_actors, $data_classes]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_va
end
end
end
#--------------------------------------------------------------------------
# common cache: load_notetags_va
#--------------------------------------------------------------------------
def load_notetags_va
@win_quotes = [""]
@level_quotes = [""]
@drops_quotes = [""]
@victory_quote_type = nil
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::WIN_QUOTE_ON
@victory_quote_type = :win_quote
when YEA::REGEXP::BASEITEM::WIN_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_ON
@victory_quote_type = :level_quote
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_ON
@victory_quote_type = :drops_quote
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_OFF
@victory_quote_type = nil
#---
when YEA::REGEXP::BASEITEM::NEW_QUOTE
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes.push("")
when :level_quote; @level_quotes.push("")
when :drops_quote; @drops_quotes.push("")
end
#---
else
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes[@win_quotes.size-1] += line.to_s
when :level_quote; @level_quotes[@level_quotes.size-1] += line.to_s
when :drops_quote; @drops_quotes[@drops_quotes.size-1] += line.to_s
end
end
} # self.note.split
#---
return unless self.is_a?(RPG::Class)
quotes = YEA::VICTORY_AFTERMATH::VICTORY_QUOTES
@win_quotes = quotes[:win].clone if @win_quotes == [""]
@level_quotes = quotes[:level].clone if @level_quotes == [""]
@drops_quotes = quotes[:drops].clone if @drops_quotes == [""]
end
#--------------------------------------------------------------------------
# overwrite method: self.process_victory
#--------------------------------------------------------------------------
def self.process_victory
if $imported["YEA-CommandAutobattle"]
SceneManager.scene.close_disable_autobattle_window
end
if Switch.skip_aftermath
skip_aftermath
return
end
play_battle_end_me
gain_jp if $imported["YEA-JPManager"]
display_exp
gain_exp
gain_gold
gain_drop_items
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# new method: self.skip_aftermath
#--------------------------------------------------------------------------
def self.skip_aftermath
$game_party.all_members.each do |actor|
actor.gain_exp($game_troop.exp_total)
end
$game_party.gain_gold($game_troop.gold_total)
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
end
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
end
#--------------------------------------------------------------------------
# new method: self.set_victory_text
#--------------------------------------------------------------------------
def self.set_victory_text(actor, type)
text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
text += actor.victory_quotes(type)[rand(actor.victory_quotes(type).size)]
text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
$game_message.face_name = actor.face_name
$game_message.face_index = actor.face_index
$game_message.add(text)
wait_for_message
end
#--------------------------------------------------------------------------
# overwrite method: self.display_exp
#--------------------------------------------------------------------------
def self.display_exp
SceneManager.scene.show_victory_display_exp
actor = $game_party.random_target
@victory_actor = actor
set_victory_text(@victory_actor, :win)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_exp
#--------------------------------------------------------------------------
def self.gain_exp
$game_party.all_members.each do |actor|
temp_actor = Marshal.load(Marshal.dump(actor))
actor.gain_exp($game_troop.exp_total)
next if actor.level == temp_actor.level
SceneManager.scene.show_victory_level_up(actor, temp_actor)
set_victory_text(actor, :level)
wait_for_message
end
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_gold
#--------------------------------------------------------------------------
def self.gain_gold
$game_party.gain_gold($game_troop.gold_total)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_drop_items
#--------------------------------------------------------------------------
def self.gain_drop_items
drops = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
drops.push(item)
end
SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
set_victory_text(@victory_actor, :drops)
wait_for_message
end
#--------------------------------------------------------------------------
# new method: self.close_windows
#--------------------------------------------------------------------------
def self.close_windows
SceneManager.scene.close_victory_windows
end
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias battle_end_va battle_end; end
def self.battle_end(result)
battle_end_va(result)
return if result == 2
return if YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT <= 0
event_id = YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT
$game_temp.reserve_common_event(event_id)
end
#--------------------------------------------------------------------------
# new method: victory_quotes
#--------------------------------------------------------------------------
def victory_quotes(type)
case type
when :win
return self.actor.win_quotes if self.actor.win_quotes != [""]
return self.class.win_quotes
when :level
return self.actor.level_quotes if self.actor.level_quotes != [""]
return self.class.level_quotes
when :drops
return self.actor.drops_quotes if self.actor.drops_quotes != [""]
return self.class.drops_quotes
else
return ["NOTEXT"]
end
end
#--------------------------------------------------------------------------
# col_max
#--------------------------------------------------------------------------
def col_max; return item_max; end
#--------------------------------------------------------------------------
# spacing
#--------------------------------------------------------------------------
def spacing; return 8; end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return $game_party.battle_members.size; end
#--------------------------------------------------------------------------
# open
#--------------------------------------------------------------------------
def open
@exp_total = $game_troop.exp_total
super
end
#--------------------------------------------------------------------------
# item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = contents.height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
return rect
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
reset_font_settings
draw_actor_name(actor, rect)
draw_exp_gain(actor, rect)
draw_jp_gain(actor, rect)
draw_actor_face(actor, rect)
end
#--------------------------------------------------------------------------
# draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, rect)
name = actor.name
draw_text(rect.x, rect.y+line_height, rect.width, line_height, name, 1)
end
#--------------------------------------------------------------------------
# actor_jp_gain
#--------------------------------------------------------------------------
def actor_jp_gain(actor)
n = actor.battle_jp_earned
if actor.exp + actor_exp_gain(actor) > actor.exp_for_level(actor.level + 1)
n += YEA::JP::LEVEL_UP unless actor.max_level?
end
return n
end
class Window_VictoryEXP_Front < Window_VictoryEXP_Back
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super
self.back_opacity = 0
@ticks = 0
@counter = 30
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
update_tick
end
#--------------------------------------------------------------------------
# complete_ticks?
#--------------------------------------------------------------------------
def complete_ticks?
for actor in $game_party.battle_members
total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
now_exp = actor.exp - actor.current_level_exp + bonus_exp
next_exp = actor.next_level_exp - actor.current_level_exp
rate = now_exp * 1.0 / next_exp
return false if rate < 1.0
end
return true
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
draw_actor_exp(actor, rect)
end
#--------------------------------------------------------------------------
# exp_gauge1
#--------------------------------------------------------------------------
def exp_gauge1; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE1); end
#--------------------------------------------------------------------------
# exp_gauge2
#--------------------------------------------------------------------------
def exp_gauge2; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE2); end
#--------------------------------------------------------------------------
# lvl_gauge1
#--------------------------------------------------------------------------
def lvl_gauge1; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE1); end
#--------------------------------------------------------------------------
# lvl_gauge2
#--------------------------------------------------------------------------
def lvl_gauge2; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE2); end
#--------------------------------------------------------------------------
# draw_param_names
#--------------------------------------------------------------------------
def draw_param_names(actor, dx)
dx += 108
change_color(system_color)
text = Vocab.level
draw_text(dx, 0, contents.width - dx, line_height, text)
dy = 0
for i in 0...8
dy += line_height
text = Vocab.param(i)
draw_text(dx, dy, contents.width - dx, line_height, text)
end
end
#--------------------------------------------------------------------------
# draw_former_stats
#--------------------------------------------------------------------------
def draw_former_stats(actor)
dw = contents.width / 2 - 12
dy = 0
change_color(normal_color)
draw_text(0, dy, dw, line_height, actor.level.group, 2)
for i in 0...8
dy += line_height
draw_text(0, dy, dw, line_height, actor.param(i).group, 2)
end
end
#--------------------------------------------------------------------------
# draw_arrows
#--------------------------------------------------------------------------
def draw_arrows
dx = contents.width / 2 - 12
dy = 0
change_color(system_color)
for i in 0..8
draw_text(dx, dy, 24, line_height, "→", 1)
dy += line_height
end
end
#--------------------------------------------------------------------------
# draw_newer_stats
#--------------------------------------------------------------------------
def draw_newer_stats(actor, temp_actor)
dx = contents.width / 2 + 12
dw = contents.width - dx
dy = 0
change_color(param_change_color(actor.level - temp_actor.level))
draw_text(dx, dy, dw, line_height, actor.level.group, 0)
for i in 0...8
dy += line_height
change_color(param_change_color(actor.param(i) - temp_actor.param(i)))
draw_text(dx, dy, dw, line_height, actor.param(i).group, 0)
end
end
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_va create_all_windows
def create_all_windows
scene_battle_create_all_windows_va
create_victory_aftermath_windows
end