#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_System
attr_accessor :bar_style
attr_reader :bar_opacity
#----------------------------------------------------------------------------
# initialize
# Added bar style variables.
#----------------------------------------------------------------------------
alias init_blizzart_later initialize
def initialize
init_blizzart_later
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#
# Configure this part manually if you have no "Options" controller for the
# styles and the opacity. (style: 0~6, opacity: 0~255)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@bar_style = 2
self.bar_opacity = 255
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#----------------------------------------------------------------------------
# bar_opacity=
# alpha - opacity
# Encapsulation and range limitation of opacity.
#----------------------------------------------------------------------------
def bar_opacity=(alpha)
@bar_opacity = [[alpha, 0].max, 255].min
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor
#----------------------------------------------------------------------------
# now_exp
# Returns the EXP collected in this level.
#----------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#----------------------------------------------------------------------------
# next_exp
# Returns the EXP needed to level up as number.
#----------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
#----------------------------------------------------------------------------
# gradient_bar
# x - x coordinate
# y - y coordinate
# w - width of the bar to be drawn
# color1 - primary color
# color2 - secondary color
# color3 - back color
# rate - fill rate
# This special method is able to draw one out of 7 styles.
#----------------------------------------------------------------------------
def gradient_bar(x, y, w, color1, color2, color3, rate, flag = true)
# stop if not active or out of range
return unless flag
return if $game_system.bar_style < 0 || $game_system.bar_style > 6
# styles with "vertical" black borders
styles = [1, 3, 4, 5, 6]
# setup of coordinates and offsets depending on style
offs = 5
x += offs
y += 26
if styles.include?($game_system.bar_style)
offs += 2
y -= 1
[5, 6].include?($game_system.bar_style) ? y -= 2 : x += 1
# quantizes the width so it looks better (remove it and see what happens)
w = w / 8 * 8
end
# temporary variable
a = $game_system.bar_opacity
if $game_system.bar_style < 5
# draw black slanted back
(0...(offs+3)).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
# draw white slanted back onto black, but let black borders stay
(0...(offs+1)).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
if $game_system.bar_style < 2
# iterate through each vertical bar
(0...w+offs).each {|i|
# calculate color
r = color3.red * i / (w+offs)
g = color3.green * i / (w+offs)
b = color3.blue * i / (w+offs)
# special offset calculation
oy = i < offs ? offs-i : 0
off = i < offs ? i : i > w ? w+offs-i : offs
# draw this part of the bar
fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
# if slanted bar is out of critical area
if (w*rate).to_i >= offs
# draw the little triangular part on the left
(0...((w*rate).to_i+offs)).each {|i|
r = color1.red + (color2.red-color1.red)*i / ((w+offs)*rate)
g = color1.green + (color2.green-color1.green)*i / ((w+offs)*rate)
b = color1.blue + (color2.blue-color1.blue)*i / ((w+offs)*rate)
oy = i < offs ? offs-i : 0
off = i < offs ? i : i > w*rate ? (w*rate).to_i+offs-i : offs
fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
else
# draw the little triangular part on the left using special method
(0...(w * rate).to_i).each {|i| (0...offs).each {|j|
r = color1.red + (color2.red-color1.red)*i / (w*rate)
g = color1.green + (color2.green-color1.green)*i / (w*rate)
b = color1.blue + (color2.blue-color1.blue)*i / (w*rate)
set_pixel(x+i-j+1, y+j-1, Color.new(r, g, b, a))}}
end
else
# iterate through all horizontal lines
(0...offs).each {|i|
# calculate colors
r = color3.red * i / offs
g = color3.green * i / offs
b = color3.blue * i / offs
# draw background line
fill_rect(x-i+1, y+i-1, w, 1, Color.new(r, g, b, a))}
if $game_system.bar_style == 4
# iterate through half of all horizontal lines
(0...offs/2+1).each {|i|
# calculate colors
r = color2.red * (i+1) / (offs/2)
g = color2.green * (i+1) / (offs/2)
b = color2.blue * (i+1) / (offs/2)
# draw bar line
fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))
# draw bar line mirrored vertically
fill_rect(x-offs+i+2, y+offs-i-2, w*rate, 1, Color.new(r, g, b, a))}
else
# iterate through all horizontal lines
(0...offs).each {|i|
# calculate colors
r = color1.red + (color2.red-color1.red)*i / offs
g = color1.green + (color2.green-color1.green)*i / offs
b = color1.blue + (color2.blue-color1.blue)*i / offs
# draw bar line
fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))}
end
end
# if style with black vertical slanted intersections
if styles.include?($game_system.bar_style)
# add black bars on 1st and 8th column every 8 pixels
(0...w).each {|i| (0...offs).each {|j|
if styles.include?($game_system.bar_style) && i % 8 < 2
set_pixel(x+i-j+1, y+j-1, Color.new(0, 0, 0, a))
end}}
end
else
# fill white background
fill_rect(x+1, y-3, w+2, 12, Color.new(255, 255, 255, a))
# iterate through each of 6 lines
(1...6).each {|i|
# calculate background color
color = Color.new(color3.red*i/5, color3.green*i/5, color3.blue*i/5, a)
# draw background
fill_rect(x+2, y+i-3, w, 12-i*2, color)
# calculate bar color
color = Color.new(color2.red*i/5, color2.green*i/5, color2.blue*i/5, a)
# draw bar
fill_rect(x+2, y+i-3, w*rate, 12-i*2, color)}
# if style 5 (with vertical borders)
if $game_system.bar_style == 5
# add black bars on 1st and 8th column every 8 pixels
(0...w/8).each {|i|
fill_rect(x+2+i*8, y-2, 1, 10, Color.new(0, 0, 0, a))
fill_rect(x+2+(i+1)*8-1, y-2, 1, 10, Color.new(0, 0, 0, a))}
end
end
end
end
#==============================================================================
# Hud
#------------------------------------------------------------------------------
# This class was modified to support SR display and modify the number of
# skills left to use.
#==============================================================================
class Hud < Sprite
#----------------------------------------------------------------------------
# Initialization
# viewport - the viewport for the sprite
#----------------------------------------------------------------------------
def initialize(viewport = nil)
# call superclass method
super
@name = @level = @hp = @maxhp = @sp = @maxsp = @now_exp = @next_exp = @sprite = Array.new
# create ids
create_ids
# get height
h = BlizzABS::Config::DIRECT_HOTKEYS ? @hud_height - 28 : @hud_height
# create bitmap
self.bitmap = Bitmap.new(@hud_width, h)
# set font
self.bitmap.font.name = 'Times New Roman'
# set font to bold
self.bitmap.font.bold = true
# set x, y id
self.x, self.y = 0, 0
# set z coordinate
self.z = 1000
# update
update
end
#----------------------------------------------------------------------------
# create_ids
# Sets drawing ids. This method can be aliased and the ids
# modified to create a different HUD.
#----------------------------------------------------------------------------
def create_ids
@original_width = @hud_width = 250
@original_height = @hud_height = 480
@name1_x, @name1_y, @level1_x, @level1_y = 150, 1, 105, 1
@hp1_x, @hp1_y, @sp1_x, @sp1_y, @exp1_x, @exp1_y = 130, 13, 105, 33, 5, 100
@hot_x, @hot_y, @left_x, @left_y = 4, 49, 8, 63
@face1_x, @face1_y = 5, 5
@name_x, @name_y, @level_x, @level_y = 120, 1, 50, 1
@hp_x, @hp_y, @sp_x, @sp_y, @exp_x, @exp_y = 80, 13, 70, 33, 5, 50
@hot_x, @hot_y, @left_x, @left_y = 4, 49, 8, 63
@face_x, @face_y = 5, 5
end
#----------------------------------------------------------------------------
# draw_empty
# Draws the HP and SP display when actor doesn't exist.
#----------------------------------------------------------------------------
def draw_empty
# draw empty bars
self.bitmap.gradient_bar_hud(@hp1_x+32, @hp1_y+3, 114, 0, 'hud_green_bar', 1)
# draw empty bars
self.bitmap.gradient_bar_hud(@sp1_x+32, @sp1_y+3, 114, 0, 'hud_blue_bar', 2)
# set font color
self.bitmap.font.color = disabled_color
# draw empty HP
self.bitmap.draw_text_full(@hp1_x+38, @hp1_y, 48, 20, '0', 2)
self.bitmap.draw_text_full(@hp1_x+86, @hp1_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@hp1_x+98, @hp1_y, 48, 20, '0')
# draw empty SP
self.bitmap.draw_text_full(@sp1_x+38, @sp1_y, 48, 20, '0', 2)
self.bitmap.draw_text_full(@sp1_x+86, @sp1_y, 12, 20, '/', 1)
self.bitmap.draw_text_full(@sp1_x+98, @sp1_y, 48, 20, '0')
# reset all flag variables
@name = @level = @hp = @sp = @maxhp = @maxsp = @exp = @states = @skill =
@skills_left = @item = @items_left = @gold = nil
end
#----------------------------------------------------------------------------
# draw_name
# Draws the name display.
#----------------------------------------------------------------------------
def draw_name1
# set current variable
@name1 = actor.name
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# draw actor's name
self.bitmap.draw_text_full(@name1_x, @name1_y, 104, 20, @name1)
end
#----------------------------------------------------------------------------
# draw_face
# Draws the face display.
#----------------------------------------------------------------------------
def draw_face1
# set current variable
@sprite1 = Sprite.new
# draw actor's face
@sprite1.bitmap = RPG::Cache.picture(actor.name + '_f')
@sprite1.x, @sprite1.y = @face1_x, @face1_y
@sprite1.mirror = true
end
#----------------------------------------------------------------------------
# draw_level
# Draws the level display.
#----------------------------------------------------------------------------
def draw_level1
# set current variable
@level1 = actor.level
# set font color
self.bitmap.font.color = normal_color
# draw actor's level
self.bitmap.draw_text_full(@level1_x+20, @level1_y, 20, 20, @level1.to_s, 2)
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@level1_x, @level1_y, 20, 20, 'LV',2)
end
#----------------------------------------------------------------------------
# draw_hp
# Draws the HP display.
#----------------------------------------------------------------------------
def draw_hp1
# set current variables
@hp1, @maxhp1 = actor.hp, actor.maxhp
# set fill rate
rate = (@maxhp1 > 0 ? @hp1.to_f / @maxhp1 : 0)
# create color
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
elsif rate > 0.2 && rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@hp1_x,@hp1_y - 10,114,color1,color2,color3,rate)
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@hp1_x, @hp1_y, 32, 32, $data_system.words.hp)
# set font color depending on how many HP left
# set colors and draw values
self.bitmap.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@hp1_x, @hp1_y, 48, 32, actor.hp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@hp1_x + 48, @hp1_y, 12, 32, '/', 1)
self.bitmap.draw_text_full(@hp1_x + 60, @hp1_y, 48, 32, actor.maxhp.to_s)
self.bitmap.font.color.alpha = 255
end
#----------------------------------------------------------------------------
# draw_sp
# Draws the SP display.
#----------------------------------------------------------------------------
def draw_sp1
# set current variables
@sp1, @maxsp1 = actor.sp, actor.maxsp
# set fill rate
rate = (@maxsp1 > 0 ? @sp1.to_f / @maxsp1 : 0)
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@sp1_x,@sp1_y-10,114,color1, color2, color3, rate)
# set font color depending on how many SP left
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@sp1_x, @sp1_y, 32, 32, $data_system.words.sp)
# set offset
# set colors and draw values
self.bitmap.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxhp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@sp1_x, @sp1_y, 48, 32, actor.sp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@sp1_x + 48, @sp1_y, 12, 32, '/', 1)
self.bitmap.draw_text_full(@sp1_x + 60, @sp1_y, 48, 32, actor.maxsp.to_s)
end
#----------------------------------------------------------------------------
# draw_exp
# Draws the exp display.
#----------------------------------------------------------------------------
def draw_exp1
# set current variables
@now_exp1, @next_exp1 = actor.now_exp, actor.next_exp
# set fill rate
rate = (@next_exp1 != 0 ? @now_exp1.to_f / @next_exp1 : 1)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@exp1_x,@exp1_y-10,114/2,color1, color2, color3, rate)
# set font color depending on how many SP left
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@exp1_x, @exp1_y, 32, 32, 'EXP')
end
#----------------------------------------------------------------------------
# draw_name
# Draws the name display.
#----------------------------------------------------------------------------
def draw_name(id)
actors = $game_party.actors[id]
# set current variable
@name[id] = actors.name
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# draw actor's name
self.bitmap.draw_text_full(@name_x, @name_y+@all_y, 104, 20, @name[id])
end
#----------------------------------------------------------------------------
# draw_face
# Draws the face display.
#----------------------------------------------------------------------------
def draw_face(id)
actors = $game_party.actors[id]
# set current variable
@sprite[id] = Sprite.new
# draw actor's face
@sprite[id].bitmap = RPG::Cache.picture(actors.name + '_f')
@sprite[id].x, @sprite[id].y = @face_x, @face_y+@all_y
@sprite[id].zoom_x, @sprite[id].zoom_y = @sprite[id].zoom_x / 2 ,@sprite[id].zoom_y / 2
@sprite[id].mirror = true
end
#----------------------------------------------------------------------------
# draw_level
# Draws the level display.
#----------------------------------------------------------------------------
def draw_level(id)
actors = $game_party.actors[id]
# set current variable
@level[id] = actors.level
# set font color
self.bitmap.font.color = normal_color
# draw actor's level
self.bitmap.draw_text_full(@level_x+20, @level_y+@all_y, 20, 20, @level[id].to_s, 2)
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@level_x, @level_y+@all_y, 20, 20, 'LV',2)
end
#----------------------------------------------------------------------------
# draw_hp
# Draws the HP display.
#----------------------------------------------------------------------------
def draw_hp(id)
actors = $game_party.actors[id]
# set current variables
@hp[id], @maxhp[id] = actors.hp, actors.maxhp
# set fill rate
rate = (@maxhp[id] > 0 ? @hp[id].to_f / @maxhp[id] : 0)
# create color
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
elsif rate > 0.2 && rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@hp_x,@hp_y+@all_y - 10,114/2,color1,color2,color3,rate)
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@hp_x, @hp_y+@all_y, 32, 32, $data_system.words.hp)
# set font color depending on how many HP left
# set colors and draw values
self.bitmap.font.color = actors.hp == 0 ? knockout_color :
actors.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@hp_x, @hp_y+@all_y, 48, 32, actors.hp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@hp_x + 18, @hp_y+@all_y, 12, 32, '/', 1)
self.bitmap.draw_text_full(@hp_x + 20, @hp_y+@all_y, 48, 32, actors.maxhp.to_s)
self.bitmap.font.color.alpha = 255
end
#----------------------------------------------------------------------------
# draw_sp
# Draws the SP display.
#----------------------------------------------------------------------------
def draw_sp(id)
actors = $game_party.actors[id]
# set current variables
@sp[id], @maxsp[id] = actors.sp, actors.maxsp
# set fill rate
rate = (@maxsp[id] > 0 ? @sp[id].to_f / @maxsp[id] : 0)
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@sp_x,@sp_y-10+@all_y,114/2,color1, color2, color3, rate)
# set font color depending on how many SP left
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@sp_x, @sp_y+@all_y, 32, 32, $data_system.words.sp)
# set offset
# set colors and draw values
self.bitmap.font.color = actors.sp == 0 ? knockout_color :
actors.sp <= actors.maxhp / 4 ? crisis_color : normal_color
self.bitmap.draw_text_full(@sp_x, @sp_y+@all_y, 48, 32, actors.sp.to_s, 2)
self.bitmap.font.color = normal_color
self.bitmap.draw_text_full(@sp_x + 18, @sp_y+@all_y, 12, 32, '/', 1)
self.bitmap.draw_text_full(@sp_x + 20, @sp_y+@all_y, 48, 32, actors.maxsp.to_s)
end
#----------------------------------------------------------------------------
# draw_exp
# Draws the exp display.
#----------------------------------------------------------------------------
def draw_exp(id)
actors = $game_party.actors[id]
# set current variables
@now_exp[id], @next_exp[id] = actors.now_exp, actors.next_exp
# set fill rate
rate = (@next_exp[id] != 0 ? @now_exp[id].to_f / @next_exp[id] : 1)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(0, 80, 0, 192)
# draw gradient bar
self.bitmap.gradient_bar(@exp_x,@exp_y-10+@all_y,114/4,color1, color2, color3, rate)
# set font color depending on how many SP left
self.bitmap.font.color = system_color
self.bitmap.draw_text_full(@exp_x, @exp_y+@all_y, 32, 32, 'EXP')
end
#----------------------------------------------------------------------------
# draw_hskill
# Draws the hot skill display.
#----------------------------------------------------------------------------
def draw_hskill
# set current variable
@skill = actor.skill
# if skill hot skill exists
if @skill != 0
# load bitmap
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
# draw bitmap
self.bitmap.blt(@hot_x+48, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
# removes skills left to use display
draw_lskill
end
#----------------------------------------------------------------------------
# draw_lskill
# Draws the skills left to use display.
#----------------------------------------------------------------------------
def draw_lskill
# get the number of skills left
@skills_left = get_skills_left
# if hot skill exists
if @skill != nil && @skill > 0
# if normal SP cost
if @skills_left >= 0
# if not enough sp to use
if @skills_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if enough SP for 5 or less skill uses
elsif @skills_left <= 5
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size -= 2
# draw number how many skills left to use
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, @skills_left.to_s, 1)
# increase font size
self.bitmap.font.size += 2
# if infinite skills left
elsif @skills_left == -1
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 4
# draw "∞" skill uses left
self.bitmap.draw_text_full(@left_x, @left_y, 24, 20, '∞', 1)
# decrease font size
self.bitmap.font.size -= 4
end
end
end
#----------------------------------------------------------------------------
# get_skills_left
# Gets the number of skill usages left.
#----------------------------------------------------------------------------
def get_skills_left
# if skill hot skill exists
if @skill != nil && @skill > 0
# if SP cost is zero
if $data_skills[@skill].sp_cost > 0
# get basic SP cost
sp_cost = $data_skills[@skill].sp_cost
# if using SP Cost Mod Status
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
# get modified cost
sp_cost = BlizzCFG.get_cost_mod(actor.states, sp_cost)
end
# infinite
return -1 if sp_cost == 0
# calculate skills left to use
return @sp / sp_cost
end
# set flag
return -1
end
# set flag
return -2
end
#----------------------------------------------------------------------------
# draw_hitem
# Draws the hot item display.
#----------------------------------------------------------------------------
def draw_hitem
# set current variable
@item = actor.item
# if hot item exists
if @item != 0
# load bitmap
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
# draw bitmap
self.bitmap.blt(@hot_x+124, @hot_y+4, bitmap, Rect.new(0, 0, 24, 24))
end
# removes items left to use display
draw_litem
end
#----------------------------------------------------------------------------
# draw_litem
# Draws the items left to use display.
#----------------------------------------------------------------------------
def draw_litem
# set current variable
@items_left = $game_party.item_number(@item)
# if hot item exists
if @item != nil && @item > 0
# if item exists and cannot be consumed
if $data_items[@item] != nil && !$data_items[@item].consumable
# set font color
self.bitmap.font.color = Color.new(0, 255, 0)
# increase font size
self.bitmap.font.size += 4
# draw "∞" items left
self.bitmap.draw_text_full(@left_x+76, @left_y, 24, 20, '∞', 1)
# decrease font size
self.bitmap.font.size -= 4
else
# if no items left
if @items_left == 0
# set font color
self.bitmap.font.color = Color.new(255, 0, 0)
# if equal or less items left
elsif @items_left <= 10
# set font color
self.bitmap.font.color = Color.new(255, 255, 0)
else
# set font color
self.bitmap.font.color = normal_color
end
# decrease font color
self.bitmap.font.size -= 2
# draw number how many items left to use
self.bitmap.draw_text_full(@left_x+76, @left_y, 24, 20, @items_left.to_s, 1)
# increase font size
self.bitmap.font.size += 2
end
end
end
#----------------------------------------------------------------------------
# update
# Checks if HUD needs refreshing.
#----------------------------------------------------------------------------
def update
# if actor doesn't exist
if actor == nil
# unless already drawn empty HUD
unless @empty_hud_drawn
# draw HUD template
draw_basic
# draw empty HP, SP and EXP bars
draw_empty
# empty HUD was drawn
@empty_hud_drawn = true
end
else
# if HUD needs refresh
if $game_temp.hud_refresh
# draw all data about actor
draw_name1
draw_level1
draw_hp1
draw_sp1
draw_exp1
draw_face1
for i in 1..$game_party.actors.size - 1
draw_name(i)
draw_level(i)
draw_hp(i)
draw_sp(i)
draw_exp(i)
draw_face(i)
end
unless BlizzABS::Config::DIRECT_HOTKEYS
draw_hskill
draw_lskill
draw_hitem
draw_litem
end
# remove flag
$game_temp.hud_refresh = nil
else
# draw data that needs to ve updated
self.bitmap.font.size = 16
test_name1
test_level1
test_hp1
test_sp1
test_exp1
test_face1
for i in 1..$game_party.actors.size - 1
self.bitmap.font.size = 10
@all_y = 60 + i *70
test_name(i)
test_level(i)
test_hp(i)
test_sp(i)
test_exp(i)
test_face(i)
end
unless BlizzABS::Config::DIRECT_HOTKEYS
test_hskill
test_lskill
test_hitem
test_litem
end
end
# empty HUD wasn't drawn
@empty_hud_drawn = false
end
end
#----------------------------------------------------------------------------
# test_name
# Tests and draws the name.
#----------------------------------------------------------------------------
def test_name1
# draw new name if name has changed
draw_name1 if actor.name != @name1
end
#----------------------------------------------------------------------------
# test_face
# Tests and draws the face.
#----------------------------------------------------------------------------
def test_face1
# draw new name if name has changed
draw_face1
end
#----------------------------------------------------------------------------
# test_level
# Tests and draws the level.
#----------------------------------------------------------------------------
def test_level1
# draw new level if level has changed
draw_level1 if actor.level != @level1
end
#----------------------------------------------------------------------------
# test_hp
# Tests and draws the HP.
#----------------------------------------------------------------------------
def test_hp1
# draw new HP if HP or max HP have changed
draw_hp1 if actor.hp != @hp1 || actor.maxhp != @maxhp1
end
#----------------------------------------------------------------------------
# test_sp
# Tests and draws the SP.
#----------------------------------------------------------------------------
def test_sp1
# draw new SP if SP or max SP have changed
draw_sp1 if actor.sp != @sp1 || actor.maxsp != @maxsp1
end
#----------------------------------------------------------------------------
# test_exp
# Tests and draws the EXP.
#----------------------------------------------------------------------------
def test_exp1
# draw new SP if SP or max SP have changed
draw_exp1 if actor.now_exp != @now_exp1
end
#----------------------------------------------------------------------------
# test_name
# Tests and draws the name.
#----------------------------------------------------------------------------
def test_name(id)
actors = $game_party.actors[id]
# draw new name if name has changed
draw_name(id) if actors.name != @name[id]
end
#----------------------------------------------------------------------------
# test_face
# Tests and draws the face.
#----------------------------------------------------------------------------
def test_face(id)
# draw new name if name has changed
draw_face(id)
end
#----------------------------------------------------------------------------
# test_level
# Tests and draws the level.
#----------------------------------------------------------------------------
def test_level(id)
actors = $game_party.actors[id]
# draw new level if level has changed
draw_level(id) if actors.level != @level[id]
end
#----------------------------------------------------------------------------
# test_hp
# Tests and draws the HP.
#----------------------------------------------------------------------------
def test_hp(id)
actors = $game_party.actors[id]
# draw new HP if HP or max HP have changed
draw_hp(id) if actors.hp != @hp[id] || actors.maxhp != @maxhp[id]
end
#----------------------------------------------------------------------------
# test_sp
# Tests and draws the SP.
#----------------------------------------------------------------------------
def test_sp(id)
actors = $game_party.actors[id]
# draw new SP if SP or max SP have changed
draw_sp(id) if actors.sp != @sp[id] || actors.maxsp != @maxsp[id]
end
#----------------------------------------------------------------------------
# test_exp
# Tests and draws the EXP.
#----------------------------------------------------------------------------
def test_exp(id)
actors = $game_party.actors[id]
# draw new EXP if EXP was changed
draw_exp(id) if actor.now_exp != @now_exp[id]
end
#----------------------------------------------------------------------------
# test_hskill
# Tests and draws the hskill.
#----------------------------------------------------------------------------
def test_hskill
# draw new skill icon if assigned skill has changed
draw_hskill if actor.skill != @skill
end
#----------------------------------------------------------------------------
# test_lskill
# Tests and draws the lskill.
#----------------------------------------------------------------------------
def test_lskill
# draw how many skills left to use if this number has changed
draw_lskill if get_skills_left != @skills_left
end
#----------------------------------------------------------------------------
# test_hitem
# Tests and draws the hitem.
#----------------------------------------------------------------------------
def test_hitem
# draw new item icon if assigned item has changed
draw_hitem if actor.item != @item
end
#----------------------------------------------------------------------------
# test_litem
# Tests and draws the litem.
#----------------------------------------------------------------------------
def test_litem
# draw how many items left to use if this number has changed
draw_litem if $game_party.item_number(@item) != @items_left
end
#----------------------------------------------------------------------------
# actor
# Returns the party leader's battler for easier reference.
#----------------------------------------------------------------------------
def actor
return $game_player.battler
end
end