#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# RTAB BattleStatus Blizz-Art Hack by Blizzard
# Version: 1.5
# Date: 4.7.2007
# Date v1.1b: 17.3.2008
# Date v1.2b: 17.3.2008
# Date v1.3b: 19.3.2008
# Date v1.4b: 13.7.2008
# Date v1.5: 23.3.2019
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is licensed under BSD License 2.0:
#
# #----------------------------------------------------------------------------
# #
# # Copyright (c) Boris "Blizzard" Mikić
# # All rights reserved.
# #
# # Redistribution and use in source and binary forms, with or without
# # modification, are permitted provided that the following conditions are met:
# #
# # 1. Redistributions of source code must retain the above copyright notice,
# # this list of conditions and the following disclaimer.
# #
# # 2. Redistributions in binary form must reproduce the above copyright
# # notice, this list of conditions and the following disclaimer in the
# # documentation and/or other materials provided with the distribution.
# #
# # 3. Neither the name of the copyright holder nor the names of its
# # contributors may be used to endorse or promote products derived from
# # this software without specific prior written permission.
# #
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# # POSSIBILITY OF SUCH DAMAGE.
# #
# #----------------------------------------------------------------------------
#
# You may use this script for both non-commercial and commercial products
# without limitations as long as you fulfill the conditions presented by the
# above license. The "complete" way to give credit is to include the license
# somewhere in your product (e.g. in the credits screen), but a "simple" way
# is also acceptable. The "simple" way to give credit is as follows:
#
# RTAB BattleStatus Blizz-Art Hack licensed under BSD License 2.0
# Copyright (c) Boris "Blizzard" Mikić
#
# Alternatively, if your font doesn't support diacritic characters, you may
# use this variant:
#
# RTAB BattleStatus Blizz-Art Hack licensed under BSD License 2.0
# Copyright (c) Boris "Blizzard" Mikic
#
# In general other similar variants are allowed as long as it is clear who
# the creator is (e.g. "RTAB BattleStatus Blizz-Art Hack created by Blizzard" is
# acceptable). But if possible, prefer to use one of the two variants listed
# above.
#
# If you fail to give credit and/or claim that this work was created by you,
# this may result in legal action and/or payment of damages even though this
# work is free of charge to use normally.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Explanation:
#
# This script will hack into RTAB's code and mod the battle status display
# and make it lag MUCH less.
#
#
# Features:
#
# - uses "Super Lagless Bar" code
# - overrides SephirothSpawn's slant bars and DerVVulfman's BattleStatus mod
# - possiblity to use original bar style from "Gradient Bar Styler"
# - can mod the text in the status window without affecting the rest of the
# game
# - fixes the command window position, size and opacity
# - the currently selected actor has his AT Bar color changed to red instead
# of yellow
# - AT Bar is blinking when at 100%
# - overrides the stupid refresh interruption when somebody is attacking so
# the bars keep blinking no matter what
# - adds HP/SP/EXP bars as well
# - supports any number of party members
#
# new in v1.1b:
# - blinking bars now optional
# - highly optimized
#
# new in v1.2b:
# - displays now a red bar for the selected actor even if using non-blinking
# bars
#
# new in v1.3b:
# - fixed glitch where bar would not refresh upon actor action and would stay
# full in some cases
#
# new in v1.4b:
# - now supporting any number of party members
#
# new in v1.5:
# - added new license
# - added usage and crediting instructions
#
#
# Instructions:
#
# To apply this code, put it UNDER ALL of the RTAB codes.
#
#
# If you have any problems, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 0 - normal, 1 - shadowed, 2 - outlined
# Tons of Add-ons will automatically shadow it if you are using the Shaded text
# add-on, so set it to 0 in that case
TEXTTYPE = 1
# how many party members you have
MAX_PARTY = 4
# color of shadow/outline
BACK_COLOR = Color.new(0, 0, 0, 192)
# true changes the bar display to the original gradient style
ORIGINAL = false
# AT Bar text (note that too long strings WILL cause lag)
ATB_TEXT = 'ATB'
# AT Bar should blink when at 100%
BLINKING_ATB = false
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
# RTAB updates the AT bar constantly. Without an extremely optimized code
# imense lag would occur. The code has a complexity of just n (instead of n^2
# like usual bar scripts) and instead of coloring each pixel, it treats the
# slant bar like a normal gradient bar but creates an optical illusion of a
# totally slanted bar.
def super_lagless_bar(x, y, w, color1, color2, color3, rate)
offset = 8
height = 16
x += offset
y += height
(0...offset+3).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
if ORIGINAL
(0...offset+1).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
end
(0...offset).each {|i|
red = color3.red * i / offset
green = color3.green * i / offset
blue = color3.blue * i / offset
fill_rect(x-i+1, y+i-1, w, 1, Color.new(red, green, blue))}
if (w*rate).to_i >= offset
(0...(w*rate).to_i+offset).each {|i|
red = color1.red + (color2.red-color1.red)*i / ((w+offset)*rate)
green = color1.green + (color2.green-color1.green)*i / ((w+offset)*rate)
blue = color1.blue + (color2.blue-color1.blue)*i / ((w+offset)*rate)
oy = i < offset ? offset-i : 0
off = i < offset ? i : i > w*rate ? (w*rate).to_i+offset-i : offset
fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
else
(0...(w * rate).to_i).each {|i| (0...offset).each {|j|
red = color1.red + (color2.red-color1.red)*i / (w*rate)
green = color1.green + (color2.green-color1.green)*i / (w*rate)
blue = color1.blue + (color2.blue-color1.blue)*i / (w*rate)
set_pixel(x+i-j+1, y+j-1, Color.new(red, green, blue))}}
end
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
# byebye, Seph's slutty slant bars :)
def draw_slant_bar(a, b, c, d, e = 0, f = 0, g = nil, h = nil)
end
# adds bar wherever HP are displayed
alias draw_actor_hp_blizzart_gradient_later draw_actor_hp
def draw_actor_hp(actor, x, y, w = 148)
w -= 12
rate = actor.hp.to_f / actor.maxhp
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6))
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6))
elsif rate > 0.2 and rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0)
color2 = Color.new(240, 600 * (rate-0.2), 0)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0)
color2 = Color.new(240, 0, 0)
end
color3 = Color.new(0, 80, 0)
self.contents.super_lagless_bar(x, y, w, color1, color2, color3, rate)
draw_actor_hp_blizzart_gradient_later(actor, x, y)
end
# adds bar wherever SP are displayed
alias draw_actor_sp_blizzart_gradient_later draw_actor_sp
def draw_actor_sp(actor, x, y, w = 148)
w -= 12
rate = (actor.maxsp > 0 ? actor.sp.to_f / actor.maxsp : 0)
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate)
end
color3 = Color.new(0, 0, 80, 192)
self.contents.super_lagless_bar(x, y, w, color1, color2, color3, rate)
draw_actor_sp_blizzart_gradient_later(actor, x, y)
end
# adds bar wherever EXP are displayed
alias draw_actor_exp_blizzart_gradient_later draw_actor_exp
def draw_actor_exp(actor, x, y, w = 180)
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80)
color2 = Color.new(60 * rate, 180, 240)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240)
end
color3 = Color.new(80, 80, 80)
self.contents.super_lagless_bar(x, y, w, color1, color2, color3, rate)
draw_actor_exp_blizzart_gradient_later(actor, x, y)
end
end
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus
# initialization
def initialize
h = MAX_PARTY * 32 + 32
super(160, 480-h, 480, h)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.bold = true
self.contents.font.name = "Arial"
self.contents.font.size = 22
@level_up_flags, @glow_flags = [], []
MAX_PARTY.times {@level_up_flags.push(false); @glow_flags.push(false)}
@name, @hp, @sp, @atp, @actors = [], [], [], [], []
(0...$game_party.actors.size).each {|i| norm_refresh(i)}
end
# necessary to override RTAB method.
def refresh(num = 0)
norm_refresh(num-1) if num != 0
end
# necessary to override RTAB method.
def at_refresh(num = 0)
xat_refresh(num-1) if num != 0
end
# refreshes the whole status for actor with index i
def norm_refresh(i)
draw_name($game_party.actors[i], i) if @name[i] != $game_party.actors[i].name
draw_hp($game_party.actors[i], i) if @hp[i] != $game_party.actors[i].hp
draw_sp($game_party.actors[i], i) if @sp[i] != $game_party.actors[i].sp
@name[i] = $game_party.actors[i].name
@hp[i] = $game_party.actors[i].hp
@sp[i] = $game_party.actors[i].sp
xat_refresh(i)
end
# refreshes the AT Bar for actor with index i
def xat_refresh(i)
if BLINKING_ATB
if @atp[i] == $game_party.actors[i].atp &&
$game_party.actors[i].atp != 100
return
end
elsif (@atp[i] == $game_party.actors[i].atp ||
$game_party.actors[i].atp == 100) &&
@actors[i] == ($game_party.actors[i] == $scene.active_actor)
return
end
self.contents.font.size -= 4
self.contents.font.italic = true
self.contents.fill_rect(349, i*32, 98, 32, Color.new(0, 0, 0, 0))
draw_actor_atb($game_party.actors[i], 349, i*32, 84)
draw_text_special(358, -1+i*32, 96, 32, ATB_TEXT)
self.contents.font.size += 4
self.contents.font.italic = false
@atp[i] = $game_party.actors[i].atp
@actors[i] = ($game_party.actors[i] == $scene.active_actor)
end
# draws name
def draw_name(actor, i)
self.contents.fill_rect(0, i*32, 90, 40, Color.new(0, 0, 0, 0))
draw_text_special(4, i*32, 84, 32, actor.name)
end
# draws HP and bar
def draw_hp(actor, i)
self.contents.fill_rect(90, i*32, 140, 40, Color.new(0, 0, 0, 0))
rate = actor.hp.to_f / actor.maxhp
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6))
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6))
elsif rate > 0.2 && rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0)
color2 = Color.new(240, 600 * (rate-0.2), 0)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0)
color2 = Color.new(240, 0, 0)
end
color3 = Color.new(0, 80, 0)
self.contents.super_lagless_bar(124, i*32, 86, color1, color2, color3, rate)
self.contents.font.italic = true
self.contents.font.color = system_color
draw_text_special(94, i*32, 100, 32, $data_system.words.hp)
self.contents.font.italic = false
self.contents.font.size -= 4
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
draw_text_special(86, i*32, 80, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
draw_text_special(74, i*32, 100, 32, "/", 2)
draw_text_special(178, i*32, 80, 32, actor.maxhp.to_s)
self.contents.font.size += 4
end
# draws SP and bar
def draw_sp(actor, i)
self.contents.fill_rect(230, i*32, 129, 40, Color.new(0, 0, 0, 0))
rate = (actor.maxsp > 0 ? actor.sp.to_f / actor.maxsp : 0)
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate)
end
color3 = Color.new(0, 0, 80, 192)
self.contents.super_lagless_bar(260, i*32, 72, color1, color2, color3, rate)
self.contents.font.italic = true
self.contents.font.color = system_color
draw_text_special(230, i*32, 100, 32, $data_system.words.sp)
self.contents.font.italic = false
self.contents.font.size -= 4
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
draw_text_special(216, i*32, 80, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
draw_text_special(204, i*32, 100, 32, "/", 2)
draw_text_special(308, i*32, 80, 32, actor.maxsp.to_s)
self.contents.font.size += 4
end
# draws the AT bar
def draw_actor_atb(actor, x, y, w = 120)
if actor.rtp != 0
rate = 1 - actor.rt.to_f / actor.rtp
color1 = Color.new(0, 48, 64)
color2 = Color.new(0, 192, 255)
else
rate = actor.atp.to_f / 100
if BLINKING_ATB
frame = Graphics.frame_count % Graphics.frame_rate
glow = (frame < 6 ? frame / 5.0 : frame < 12 ? (11-frame) / 5.0 : 0)
if rate == 1
@glow_flags[actor.index] = false if glow == 0
else
@glow_flags[actor.index] = (glow != 0)
end
glow = 0 if @glow_flags[actor.index]
if actor == $scene.active_actor
color1 = Color.new(64 + glow*191, glow*255, glow*255)
color2 = Color.new(255, glow*255, glow*255)
else
color1 = Color.new(64 + glow*191, 64 + glow*191, glow*255)
color2 = Color.new(255, 255, glow*255)
end
elsif actor == $scene.active_actor
color1 = Color.new(64, 0, 0)
color2 = Color.new(255, 0, 0)
else
color1 = Color.new(64, 64, 0)
color2 = Color.new(255, 255, 0)
end
end
color3 = Color.new(80, 80, 80)
self.contents.super_lagless_bar(x, y, w, color1, color2, color3, rate)
end
# mods the status window text
def draw_text_special(x2, y2, w2 = 0, h2 = 0, text2 = "", a2 = 0)
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
save_color = self.contents.font.color.clone
self.contents.font.color = BACK_COLOR
if TEXTTYPE > 0
self.contents.draw_text(x+1, y+1, w, h, text, a)
if TEXTTYPE == 2
self.contents.draw_text(x-1, y+1, w, h, text, a)
self.contents.draw_text(x+1, y-1, w, h, text, a)
self.contents.draw_text(x-1, y-1, w, h, text, a)
end
end
self.contents.font.color = save_color
self.contents.draw_text(x, y, w, h, text, a)
end
# pointless, but necessary to override RTAB method
def update
super
end
# pointless, but necessary to override RTAB method
def dispose
super
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
attr_reader :active_actor
# fixes the command window position, size and opacity
alias ph3_scw_rtab_battlestatus_hack_later phase3_setup_command_window
def phase3_setup_command_window
ph3_scw_rtab_battlestatus_hack_later
@actor_command_window.height = @status_window.height
@actor_command_window.x = 0
@actor_command_window.y = 480 - @actor_command_window.height
@actor_command_window.back_opacity = @actor_command_window.opacity = 255
end
# overrides the stupid refresh interruption when somebody is attacking
alias upd_ph0_rtab_battlestatus_hack_later update_phase0
def update_phase0
(0...$game_party.actors.size).each {|i| @status_window.xat_refresh(i)}
upd_ph0_rtab_battlestatus_hack_later
end
end