Screaming Darkness
Member
I am using the side view battler system created by Minkoff and i notice the hp bars dont change when a character takes damage, can anyone help me fix this?
# Skill Casting Time Counter Ver 1.00
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
class Scene_Battle
#--------------------------------------------------------------------------
# * Skill Casting Time Counter
#--------------------------------------------------------------------------
def recite_time(battler)
# Controls how long it takes to fill the ATB bar while the chosen battler
# uses a skill. The higher the value, the longer it takes to fill the ATB.
# Each case compares the skill in use (based on the name in the database),
# and applyies the it related value as the duration it takes to use.
#
# IE: With the current script, the "Heal" spell takes only 30 RTP ticks to
# use, while the "Spiral Blade" skill attack takes a whole 120 RTP ticks.
case $data_skills[battler.current_action.skill_id].name
when "Heal"
battler.rtp = 60
when "Fire"
battler.rtp = 60
when "Ice"
battler.rtp = 60
when "Thunder"
battler.rtp = 60
when "Wind"
battler.rtp = 60
when "Water"
battler.rtp = 60
when "Greater Water"
battler.rtp = 100
when "Cross Cut"
battler.rtp = 60
when "Leg Sweep"
battler.rtp = 60
when "Hurricane"
battler.rtp = 80
when "Thunder Pierce"
battler.rtp = 80
when "Spiral Blade"
battler.rtp = 120
when "Screw Thrust"
battler.rtp = 120
when "Poison Edge"
battler.rtp = 120
when "Summon Fire Maiden"
battler.rtp = 200
when "Summon Earth Maiden"
battler.rtp = 200
when "Summon Wind Maiden"
battler.rtp = 200
when "Summon Water Maiden"
battler.rtp = 200
else
battler.rtp = 60
end
battler.rtp *= @max / 100
end
end
#==============================================================================
# ** RTAB - Stretched Background Removal ver 1.1
#------------------------------------------------------------------------------
# by Minkoff
#
#-------------------------------------------------------------------------------
# Originally designed for use with 'Animated Battlers' in mind, this script
# disables the stretched or pixellated effect caused by RTAB's camera system.
# However as this system disables the 'stretching' effect, it also removes the
# camera's ability to pan and zoom on the enemy battlers after RTAB's initial
# setup.
#
# Understandable, really. The camera system requires a stretched background
# so it can zoom in on the enemy battlers (and thus on the background). So,
# this script assumes that you are not using RTAB's camera system.
#
# The only addition to this script for use with 'RTAB' alone was the inclusion
# of the [ @base_zoom = 1.0 ] statement in line 41.
#
#==============================================================================
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# Stretched Background Removal
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Setting of battle background
#--------------------------------------------------------------------------
def make_battleback
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.zoom_x = 640.0 / @battleback_sprite.bitmap.width
@battleback_sprite.zoom_y = 480.0 / @battleback_sprite.bitmap.height
@base_zoom = 1.0
end
end
# HP/SP/EXP Gauge Script v1.00
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw HP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's HP and HP Max
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# Determine the gauge's width & fill based on the actor's HP
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw SP process
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Determine the rate of fill based on the actor's SP and SP Max
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's SP
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw HP process
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw EXP Gauge
#--------------------------------------------------------------------------
# Modification of the original Draw HP process
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
# Determine the rate of fill based on the actor's EXP and Next EXP
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# Determine the gauge's width & fill based on the actor's Next EXP
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# Drawing of gauge
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# Call the original Draw EXP process
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# Framework Drawing
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
#===============================================================================
# ** BattleStatus Modification (RTAB Version) Credits
# by DerVVulfman
# Version 2.1
# 02-18-07
#
#-------------------------------------------------------------------------------
# ** A MODIFICATION OF
# ** Real time active battle (RTAB) Ver 1.12-1.16
# ** RTAB engine available at...
# ** http://members.jcom.home.ne.jp/cogwheel/
#-------------------------------------------------------------------------------
# This script is a response to a friend who wanted the battle status window to
# display the hero(s) information in a different manner. Instead of displaying
# each hero's information directly underneath of them, it displays it along a
# single horizontal line in the style of the Final Fantasy games.
#
# EX: ARSHES HP 204 / SP 199 [Normal ] [=========]
# BASIL HP 184 / SP 49 [Knockout] [=========]
# GLORIA HP 234 / SP 299 [Normal ] [=========]
# HILDA HP 214 / SP 129 [Normal ] [=========]
#
# As a bonus, the system can Right-Justify the display and set the transparency
# of the status window. The only caveat of this is that it doesn't highlight
# the name of the hero in action. But, I have altered the battle command window
# to change its height to appear just over the name (or atb bar) of the current
# hero in action (instead of moving left to right).
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Configuration Section
# Behavior Controls
$bstat_align = 1 # Left/Right alignment of text (either 0 or 1)
$bstat_cmnd = 0 # Type of Command Window (0 = Original / 1 = New)
$bstat_min_size = 6 # Minimum # of slots in the window
# Positioning System
$bstat_cmnd_ht = 180 # Height of the default 'Command' window 180
$bstat_top = 480 # Bottom most position of the window (480 is default)
$bstat_dist = 40 # Vertical distance between actors (24 is tight)
$bstat_marg = 12 # Margin distance from top (12 is pretty tight)
# Opacity settings
$bstat_opa = 190 # Opacity of the window's border
$bstat_b_opa = 190 # Opacity of the window's background
$bcmnd_opa = 205 # Opacity of the Command window's border
$bcmnd_b_opa = 205 # Opacity of the Command window's background
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Name (battler)
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_battler_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name, 2)
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the party member in the
# battle picture.
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@oldsize = $game_party.actors.size
y = $game_party.actors.size * (64 - $bstat_dist)
height = ($game_party.actors.size * (64 - $bstat_dist))
if $bstat_min_size > $game_party.actors.size
y = $bstat_min_size * (64 - $bstat_dist)
height = ($bstat_min_size * (64 - $bstat_dist))
end
super(0, $bstat_top - y, 640, height)
self.back_opacity = $bstat_b_opa
self.opacity = $bstat_opa
@actor_window = []
offset = $bstat_top - height - $bstat_marg
for i in 0...$game_party.actors.size
@actor_window.push(Window_ActorStatus.new(i, (i * (64-$bstat_dist)) + offset ))
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for window in @actor_window
window.dispose
end
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(number = 0)
if number == 0
cnt = 0
for window in @actor_window
window.refresh(@level_up_flags[cnt])
cnt += 1
end
else
@actor_window[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# * AT gauge refreshment
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @actor_window
window.at_refresh
end
else
@actor_window[number - 1].at_refresh
end
end
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
super
# Establish if using a set window size, or expandable
checkvalue = $game_party.actors.size
if $bstat_min_size > $game_party.actors.size
checkvalue = $bstat_min_size
end
# See if the window size is altered
if self.y != $bstat_top - (checkvalue * (64 - $bstat_dist)) or
$game_party.actors.size != @oldsize
self.y = $bstat_top - (checkvalue * (64 - $bstat_dist))
self.height = (checkvalue * (64 - $bstat_dist))
for window in @actor_window
window.dispose
end
@actor_window = []
for i in 0...$game_party.actors.size
@actor_window.push(Window_ActorStatus.new(i, y + i * (64 - $bstat_dist)- $bstat_marg))
end
@oldsize = $game_party.actors.size
refresh
end
for window in @actor_window
window.update
end
end
end
#==============================================================================
# ** Window_ActorStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the party member respectively
# in the battle picture.
#==============================================================================
class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(id, y)
@actor_num = id
super(0, $bstat_top - y, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.back_opacity = 0
actor = $game_party.actors[@actor_num]
@actor_nm = actor.name
@actor_mhp = actor.maxhp
@actor_msp = actor.maxsp
@actor_hp = actor.hp
@actor_sp = actor.sp
@actor_st = make_battler_state_text(actor, 120, true)
@status_window = []
for i in 0...5
@status_window.push(Window_DetailsStatus.new(actor, i, y))
end
refresh(false)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...5
@status_window[i].dispose
end
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@actor_num]
@status_window[0].refresh(actor) if @actor_nm != actor.name
@status_window[1].refresh(actor) if
@actor_mhp != actor.maxhp or @actor_hp != actor.hp
@status_window[2].refresh(actor) if
@actor_msp != actor.maxsp or @actor_sp != actor.sp
@status_window[3].refresh(actor, level_up_flags) if
@actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
@actor_nm = actor.name
@actor_mhp = actor.maxhp
@actor_msp = actor.maxsp
@actor_hp = actor.hp
@actor_sp = actor.sp
@actor_st = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# * AT gauge refreshment
#--------------------------------------------------------------------------
def at_refresh
@status_window[4].refresh($game_party.actors[@actor_num])
end
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
for window in @status_window
window.update
end
end
end
#==============================================================================
# ** Window_DetailsStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the actor in individually in the battle picture.
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor, id, y)
@status_id = id
super(0 , y , 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
if $bstat_align == 0
# Draw Name/Hp etc left to right
case @status_id
when 0
draw_actor_name(actor, 4, -8)
when 1
draw_actor_hp(actor, 152, -8, 80)
when 2
draw_actor_sp(actor, 248, -8, 80)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(344, -8, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, 344, -8)
end
when 4
draw_actor_atg(actor, 488, -8, 120)
end
else
# Draw Name/Hp etc right to left
case @status_id
when 0
draw_battler_name(actor, 488, -8)
when 1
draw_actor_hp(actor, 296, -8, 80)
when 2
draw_actor_sp(actor, 392, -8, 80)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(160, -8, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, 160, -8)
end
when 4
draw_actor_atg(actor, 0, -8, 120)
end
end
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
def update
#At the time of main phase opacity is lowered a little
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
#==============================================================================
# ** Scene_Battle (Division definition 3)
#------------------------------------------------------------------------------
# * It is the class which processes the battle picture.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Setup of actor command window
#--------------------------------------------------------------------------
def phase3_setup_command_window
offset = $bstat_top - ($game_party.actors.size * 64)
# Nullifying the party command window
@party_command_window.active = false
@party_command_window.visible = false
# Enabling the actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
if $bstat_cmnd == 0
# Get relative position of window in percentages
x_perc = ((@actor_index +1) * 100) / $game_party.actors.size
# Apply position to 640 width of screen
xpos = ((640 * x_perc) / 100)
# Get window width difference in percentages
wperc = (($game_party.actors.size - 1) * 100) / $game_party.actors.size
# Get amount of window to remove
wperc2 = @actor_command_window.width
if $game_party.actors.size > 4
wperc2 = (@actor_command_window.width * wperc) / 100
end
if xpos - wperc2 <0
wperc2 = xpos
end
if xpos - wperc2 > (640 - @actor_command_window.width)
wperc2 = @actor_command_window.width
end
# Apply command window difference
xpos = xpos - wperc2
#(@actor_command_window.width)
# Set position
@actor_command_window.x = xpos
@actor_command_window.y = $bstat_cmnd_ht
#print wperc
else
@actor_command_window.x = 0
if $bstat_align != 0
@actor_command_window.x = 640 - @actor_command_window.width
end
checkvalue = ($game_party.actors.size * (64 - $bstat_dist))
if $bstat_min_size > $game_party.actors.size
checkvalue = $bstat_min_size * (64 - $bstat_dist)
end
@actor_command_window.y = ($bstat_top - (checkvalue)) -
(@actor_command_window.height - (@actor_index * (64 - $bstat_dist)))
end
@actor_command_window.back_opacity = $bcmnd_b_opa
@actor_command_window.opacity = $bcmnd_opa
@actor_command_window.z = 125
@actor_command_window.index = 0
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# Animated Battlers by Minkoff, Updated by DerVVulfman
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize(viewport, battler = nil)
# Configuration
@speed = 4 # Framerate speed of the battlers
@frames = 4 # Number of frames in each pose
@poses = 11 # Number of poses (stances) in the template
@mirror_enemies = true # Enemy battlers use reversed image
@stationary_enemies = false # If the enemies don't move while attacking
@stationary_actors = false # If the actors don't move while attacking
@calculate_speed = true # System calculates a mean/average speed
@phasing = false # Characters fade in/out while attacking
@default_collapse = false # Restores the old 'red fade' effect to enemies
# Array that holds the id # of weapons that forces the hero to be stationary
@stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
@frame, @pose = 0, 0
@last_time = 0
@last_move_time = 0
cbs_initialize(viewport, battler)
# self.mirror = !!battler and @mirror_enemies
viewport.z = 99
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias cbs_update update
def update
return unless @battler
# Regular Update
cbs_update
# Start Routine
unless @started
@pose = state
@width = @width / @frames
@height = @height / @poses
@display_x = @battler.screen_x
@display_y = @battler.screen_y
@destination_x = @display_x
@destination_y = @display_y
@started = true
end
# Cut Out Frame
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
# Position Sprite
self.x = @display_x
self.y = @display_y
self.z = @display_y
self.ox = @width / 2
self.oy = @height
# Setup Animation
time = Graphics.frame_count / (Graphics.frame_rate / @speed)
if @last_time < time
@frame = (@frame + 1) % @frames
if @frame == 0
if @freeze
@frame = @frames - 1
return
end
@pose = state
end
end
@last_time = time
# Move It
move if moving
end
#--------------------------------------------------------------------------
# * Current State
#--------------------------------------------------------------------------
def state
# Damage State
if [nil,{}].include?(@battler.damage)
# Battler Fine
@state = 0
# Battler Wounded
@state = 2 if @battler.hp < @battler.maxhp / 4
if @default_collapse
# Battler Dead (Red-Out Collapse)
if @battler.dead? and @battler.is_a?(Game_Actor)
@state = 10
# Fix Opacity
self.opacity = 255
end
else
# Battler Dead (Pose-Type Collapse)
if @battler.dead?
@state = 10
# Fix Opacity
self.opacity = 255
end
end
end
# Guarding State
@state = 3 if @battler.guarding?
# Moving State
if moving
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = 5 if moving.eql?(0)
# Battler Moving Right
@state = 4 if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = 4 if moving.eql?(0)
# Battler Moving Right
@state = 5 if moving.eql?(1)
end
end
# Return State
return @state
end
#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def move
time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
if @last_move_time < time
# Pause for Animation
return if @pose != state
# Phasing
if @phasing
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [255 - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
# Calculate Difference
difference_x = (@display_x - @destination_x).abs
difference_y = (@display_y - @destination_y).abs
# Done? Reset, Stop
if [difference_x, difference_y].max.between?(0, 8)
@display_x = @destination_x
@display_y = @destination_y
@pose = state
return
end
# Calculate Movement Increments
increment_x = increment_y = 1
if difference_x < difference_y
increment_x = 1.0 / (difference_y.to_f / difference_x)
elsif difference_y < difference_x
increment_y = 1.0 / (difference_x.to_f / difference_y)
end
# Calculate Movement Speed
if @calculate_speed
total = 0; $game_party.actors.each{ |actor| total += actor.agi }
speed = @battler.agi.to_f / (total / $game_party.actors.size)
increment_x *= speed
increment_y *= speed
end
# Multiply and Move
multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8)
multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8)
@display_x += (increment_x * multiplier_x).to_i
@display_y += (increment_y * multiplier_y).to_i
end
@last_move_time = time
end
#--------------------------------------------------------------------------
# * Set Movement
#--------------------------------------------------------------------------
def setmove(destination_x, destination_y)
unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
(@battler.is_a?(Game_Actor) and @stationary_actors)
unless @stationary_weapons.include?(@battler.weapon_id)
@original_x = @display_x
@original_y = @display_y
@destination_x = destination_x
@destination_y = destination_y
end
end
end
#--------------------------------------------------------------------------
# * Movement Check
#--------------------------------------------------------------------------
def moving
if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
return (@display_x > @destination_x ? 0 : 1)
end
end
#--------------------------------------------------------------------------
# * Set Pose
#--------------------------------------------------------------------------
def pose=(pose)
@pose = pose
@frame = 0
end
#--------------------------------------------------------------------------
# * Freeze
#--------------------------------------------------------------------------
def freeze
@freeze = true
end
#--------------------------------------------------------------------------
# * Fallen Pose
#--------------------------------------------------------------------------
alias cbs_collapse collapse
def collapse
if @default_collapse
cbs_collapse if @battler.is_a?(Game_Enemy)
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Actor X Coordinate
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
return self.index * 45 + 450
else
return 0
end
end
#--------------------------------------------------------------------------
# * Actor Y Coordinate
#--------------------------------------------------------------------------
def screen_y
return self.index * 35 + 200
end
#--------------------------------------------------------------------------
# * Actor Z Coordinate
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Action Animation, Movement
#--------------------------------------------------------------------------
alias cbs_update_phase4_step3 update_phase4_step3
def update_phase4_step3(battler = @active_battler)
@rtab = !@target_battlers
target = (@rtab ? battler.target : @target_battlers)[0]
@moved = {} unless @moved
return if @spriteset.battler(battler).moving
case battler.current_action.kind
when 0 # Attack
if not (@moved[battler] or battler.guarding?)
offset = (battler.is_a?(Game_Actor) ? 40 : -40)
@spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y)
@moved[battler] = true
return
elsif not battler.guarding?
@spriteset.battler(battler).pose = 6 + rand(2)
@spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
end
when 1 # Skill
@spriteset.battler(battler).pose = 8
when 2 # Item
@spriteset.battler(battler).pose = 8
end
@moved[battler] = false
@rtab ? cbs_update_phase4_step3(battler) : cbs_update_phase4_step3
end
#--------------------------------------------------------------------------
# * Hit Animation
#--------------------------------------------------------------------------
alias cbs_update_phase4_step4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
for target in (@rtab ? battler.target : @target_battlers)
damage = (@rtab ? target.damage[battler] : target.damage)
if damage.is_a?(Numeric) and damage > 0
@spriteset.battler(target).pose = 1
end
end
@rtab ? cbs_update_phase4_step4(battler) : cbs_update_phase4_step4
end
#--------------------------------------------------------------------------
# * Victory Animation
#--------------------------------------------------------------------------
alias cbs_start_phase5 start_phase5
def start_phase5
for actor in $game_party.actors
return if @spriteset.battler(actor).moving
end
for actor in $game_party.actors
unless actor.dead?
@spriteset.battler(actor).pose = 9
@spriteset.battler(actor).freeze
end
end
cbs_start_phase5
end
#--------------------------------------------------------------------------
# * Change Arrow Viewport
#--------------------------------------------------------------------------
alias cbs_start_enemy_select start_enemy_select
def start_enemy_select
cbs_start_enemy_select
@enemy_arrow.dispose
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
@enemy_arrow.help_window = @help_window
end
end
#==============================================================================
# ** Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize
cbs_initialize
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
end
end
#--------------------------------------------------------------------------
# * Find Sprite From Battler Handle
#--------------------------------------------------------------------------
def battler(handle)
for sprite in @actor_sprites + @enemy_sprites
return sprite if sprite.battler == handle
end
end
end
#==============================================================================
# ** Arrow_Base
#==============================================================================
class Arrow_Base < Sprite
#--------------------------------------------------------------------------
# * Reposition Arrows
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize(viewport)
cbs_initialize(viewport)
self.ox = 14
self.oy = 10
end
end