# Enhanced by giver (datecode 2017-03-16)
#
# Original versions List
# 1.x: "3-man Victory Screen", by Prexus
# 2.x: Remake by Walkingman
# 3.0: "Revised Victory Screen", by an Unknown "Spanish" guy (Tio,
# who posted it in his website, didn"t tell neither the game"s
# Title nor the Name of its Author, and I haven"t found
# informations on this variant of the script elsewhere)
# You can find this variant posted at RPG2S:
# http://www.rpg2s.net/forum/index.php/topic/1498-schermata-di-vittoria-dopo-la-battaglia/
# IMPORTANT NOTE: There is a script that looks almost identical to v3.0
# of this script, titled FF8 Battle Report. I'm not an expert of that videogame series,
# so I can't tell if they are related in some way.
#
# This version (3.5) CHANGELOG:
# * Converted for the Default BS with up to 4 party members
# * Rewritten most of the code, without changing the overall layout
# * Added a Configuration Section (see module VictoryScreen)
# * Can use the Troop name in the DataBase as Heading
# * Gained Gold and Owned Gold are shown separately
# * Added a Mugshot of each PC (from default Battler or a Picture) and
# a Level Up icon in the EXP summary windows
# * Added an Empty Treasure Slot (BG) graphics in Result window, and the
# Treasure Names are centered in each line
# * Possible use of an alternate WindowSkin
# * Added an Animation where the Party Members walk in a shrinked
# version of the BattleBack graphics
#
module VictoryScreen
# Write something inside the quotes if You want a FIXED heading
# for the Victory Screen in all Battles. If You leave them empty,
# the Name of the Battle in the DataBase will be used instead
HEADING = ""
# The NAME and SIZE of the Font used to write the Heading content
HEADING_FONT = "Tahoma"
HEADING_FSIZE = 24
# The PREFIX will be added before the Battle Name for the battles not
# listed in the BOSS array. Leave both empty to show only the battle
# name or if You want an IDENTICAL Heading content for all battles
MOOK_PREFIX = "Encounter with "
# Battle IDs in the DataBase, separated by a comma (e.g. [23, 56, ...])
BOSS = [
]
# To use a different windowskin for the Victory Screen windows
# It won"t be used if You set a BG image for the Screen
WSKIN = ""
# A 640x480 image to be put in the Titles folder. All windows opacity
# will be automatically set to 0, hiding their windowskin
BG = ""
# To draw the mugshot from a Picture instead of a default Battler
BATTLER_IS_PICTURE = false
# An icon (24x24) used to show if the PC has Leveled Up
LEVEL_UP_ICON = "048-Skill05"
# Labels used before the experience data values
BATTLE_EXP_LABEL = "Battle Exp."
CURRENT_EXP_LABEL = "Current Exp."
LEVEL_UP_EXP_LABEL = "Next Level Exp."
# Color of the Labels content. (255,255,128) is dark yellow
EXP_LABELS_COLOR = Color.new(255, 255, 128)
# The icon drawn at the side of the gold summary
GOLD_ICON = "034-Item03"
# An image used for each of the 6 treasure slots. It will be drawn even
# when there is no treasure dropped in that slot. 256x32 in size,
# to be put in the Windowskins folder. If You include the slots
# directly in the BG image, You can leave the quotes empty
SLOT_BG = "treasure_slot"
# A game_switch set ON (true) each time the Party wins, to allow the
# Triggering of Map Events (Remember to set it OFF after the Event)
V_SWC = 0
# The base "layer" value (z "axis") for the graphics of the screen
WIN_Z = 5000
#
end
class Window_EXPTitle < Window_Base
def initialize
super(0, 0, 640, 64)
if VictoryScreen::BG == "" and VictoryScreen::WSKIN != ""
self.windowskin = RPG::Cache.windowskin(VictoryScreen::WSKIN)
elsif VictoryScreen::BG != ""
self.opacity = 0
end
self.z = VictoryScreen::WIN_Z
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = VictoryScreen::HEADING_FONT
self.contents.font.size = VictoryScreen::HEADING_FSIZE
self.visible = false
refresh
end
def refresh
self.contents.clear
trooid = $game_temp.battle_troop_id
unless VictoryScreen::HEADING != ""
text = VictoryScreen::BOSS.include?(trooid) ? "" : VictoryScreen::MOOK_PREFIX
text += $data_troops[trooid].name
else
text = VictoryScreen::HEADING
end
self.contents.draw_text(4, 0, 600, 32, text, 1)
end
end
class Window_PCExp < Window_Base
def initialize(actor, exp)
@actor = actor
@exp = exp
super(0, 64, 320, 104)
if VictoryScreen::BG == "" and VictoryScreen::WSKIN != ""
self.windowskin = RPG::Cache.windowskin(VictoryScreen::WSKIN)
elsif VictoryScreen::BG != ""
self.opacity = 0
end
self.contents = Bitmap.new(width - 32, height - 32)
self.z = VictoryScreen::WIN_Z
self.visible = false
refresh
end
def refresh
self.contents.clear
draw_actor_mugshot
self.contents.font.bold = true
draw_actor_name(@actor, 4, -4)
if $scene.level_up_flags[@actor.index]
icon = RPG::Cache.icon(VictoryScreen::LEVEL_UP_ICON)
self.contents.blt(52, 36, icon, Rect.new(0, 0, 24, 24))
end
draw_actor_level(@actor, 20, 44)
self.contents.font.bold = false
self.contents.font.size = 17
draw_actor_rcvexp(@actor, 116, 0)
draw_actor_curexp(@actor, 116, 22)
draw_actor_nxtexp(@actor, 116, 44)
end
def draw_actor_rcvexp(actor,x,y)
self.contents.font.color = VictoryScreen::EXP_LABELS_COLOR
self.contents.draw_text(x,y,288,32,VictoryScreen::BATTLE_EXP_LABEL)
text = actor.cant_get_exp? ? "0" : @exp.to_s
self.contents.font.color = normal_color
self.contents.draw_text(x+60,y,104,32,text,2)
end
def draw_actor_curexp(actor,x,y)
self.contents.font.color = VictoryScreen::EXP_LABELS_COLOR
self.contents.draw_text(x,y,288,32,VictoryScreen::CURRENT_EXP_LABEL)
self.contents.font.color = normal_color
self.contents.draw_text(x+60,y,104,32,actor.exp_s,2)
end
def draw_actor_nxtexp(actor,x,y)
self.contents.font.color = VictoryScreen::EXP_LABELS_COLOR
self.contents.draw_text(x,y,288,32,VictoryScreen::LEVEL_UP_EXP_LABEL)
self.contents.font.color = normal_color
self.contents.draw_text(x+60,y,104,32,actor.next_exp_s,2)
end
#
def draw_actor_mugshot
unless VictoryScreen::BATTLER_IS_PICTURE
bitmap = RPG::Cache.battler(@actor.battler_name, @actor.battler_hue)
else
bitmap = RPG::Cache.picture(@actor.battler_name)
end
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
opacity = (@actor.dead?) ? 80 : 160
self.contents.blt(0, 0, bitmap, src_rect, opacity)
end
end
class Window_BlankExp < Window_Base
def initialize
super(0, 168, 320, 104)
if VictoryScreen::BG == "" and VictoryScreen::WSKIN != ""
self.windowskin = RPG::Cache.windowskin(VictoryScreen::WSKIN)
elsif VictoryScreen::BG != ""
self.opacity = 0
end
self.contents = Bitmap.new(width - 32, height - 32)
self.z = VictoryScreen::WIN_Z
self.visible = false
end
end
class Window_Background < Window_Base
def initialize
super(-16,-16, 672, 512)
self.z = VictoryScreen::WIN_Z - 3
self.visible = false
if VictoryScreen::BG != ""
self.contents = RPG::Cache.title(VictoryScreen::BG)
end
end
end
class Window_BattleStatus < Window_Base
unless $@
alias giverdesignontiorip_winv_winbstats_init initialize
end
def initialize
giverdesignontiorip_winv_winbstats_init
$scene.level_up_flags = @level_up_flags
end
end
class Scene_Battle
attr_accessor :exp
attr_accessor :level_up_flags
unless $@
alias giverdesignontiorip_winv_scnbatl_main main
end
def main
giverdesignontiorip_winv_scnbatl_main
if @titleresult_window != nil
@titleresult_window.dispose
for exp_win in @pc_exp_windows
exp_win.dispose
end
@background_window.dispose
end
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
unless $@
alias giverdesignontiorip_winv_scnbatl_sph5 start_phase5
end
def start_phase5
giverdesignontiorip_winv_scnbatl_sph5
@titleresult_window = Window_EXPTitle.new
@pc_exp_windows = []
for i in 0..3
actor = $game_party.actors[i]
unless actor.nil?
@pc_exp_windows.push(Window_PCExp.new(actor, $scene.exp))
else
@pc_exp_windows.push(Window_BlankExp.new)
end
end
@pc_exp_windows[1].y = 168
@pc_exp_windows[2].y = 272
@pc_exp_windows[3].y = 376
@background_window = Window_Background.new
@phase5_wait_count = 60
end
unless $@
alias giverdesignontiorip_winv_scnbatl_updtph5 update_phase5
end
def update_phase5
intercept_old = giverdesignontiorip_winv_scnbatl_updtph5
if @phase5_wait_count > 0
return
end
if (@phase5_wait_count == 0) and (@result_show == nil)
@titleresult_window.visible = true
for exp_win in @pc_exp_windows
exp_win.visible = true
end
@background_window.visible = true
@result_show = true
return
end
@result_window.update
if Input.trigger?(Input::C)
$game_switches[VictoryScreen::V_SWC] = true
battle_end(0)
end
end
end
class Window_BattleResult < Window_Base
def initialize(exp, gold, treasures)
$scene.exp = exp
@gold = gold
@treasures = treasures
super(320, 64, 320, 416)
if VictoryScreen::BG == "" and VictoryScreen::WSKIN != ""
self.windowskin = RPG::Cache.windowskin(VictoryScreen::WSKIN)
elsif VictoryScreen::BG != ""
self.opacity = 0
end
self.contents = Bitmap.new(width - 32, height - 32)
self.z = VictoryScreen::WIN_Z
self.visible = false
@frame = 0
refresh
end
def refresh
self.contents.clear
draw_gold_and_party
y = 136
for i in 0..5
draw_treasure(@treasures[i], 16, y)
y += 40
end
end
#
def draw_treasure(item, x, y)
ibg = RPG::Cache.windowskin(VictoryScreen::SLOT_BG)
self.contents.blt(x, y, ibg, Rect.new(0, 0, 256, 32))
return if item.nil?
inw = self.contents.text_size(item.name).width
nox = (212 - inw) / 2 + 8
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x + nox, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + nox + 28, y, inw, 32, item.name)
end
#
def draw_gold_and_party
self.contents.fill_rect(0, 0, 288, 128, Color.new(0,0,0,0))
mbback = RPG::Cache.battleback($game_temp.battleback_name)
self.contents.stretch_blt(Rect.new(0, 16, 288, 112), mbback, mbback.rect)
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
uframe = (actor.dead?) ? 0 : @frame
x = 144 - ($game_party.actors.size - 1) * 20 + i * 40
name = actor.character_name
hue = actor.character_hue
draw_walking_character(x, 120, name, hue, uframe)
end
gico = RPG::Cache.icon(VictoryScreen::GOLD_ICON)
self.contents.blt(264, 4, gico, Rect.new(0, 0, 24, 24))
gold_name = $data_system.words.gold
cx = contents.text_size(gold_name).width + 4
self.contents.font.color = system_color
self.contents.draw_text(272 - cx, 0, cx, 32, gold_name, 2)
party_gold = $game_party.gold - @gold
gold_text = party_gold.to_s + " + " + @gold.to_s
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 268 - cx, 32, gold_text, 2)
end
#
def draw_walking_character(x, y, name, hue, frame)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(cw * frame, ch, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#
def update
super
if self.visible
if (Graphics.frame_count % 8) == 0
@frame = (@frame + 1) % 4
draw_gold_and_party
end
end
end
#
end
#=============================================================================
# REVISED VICTORY SCREEN
#=============================================================================