#=============================================================================
#
# ** AnTBS/CRLS Bridge/Plugin
#
#-----------------------------------------------------------------------------
#
# By Ryex
# V 1.1
#
#-----------------------------------------------------------------------------
#
# Features
#
# * New lay out for the DBS
# * Easy to use battler animation for actors and enemies
# * Animated windows
# * New staus bar with Hp/Sp bars
#
#-----------------------------------------------------------------------------
#
# Instructions
#
# Place in a new script above main but below both AnTBS AND CRLS
# note that CRLS should be below AnTBS
#
#=============================================================================
if $crls == nil
p "The AnTBS-CRLS Brige/Plugin is installed but CRLS is not. Install CRLS."
end
class Sprite
#----------------------------------------------------------------------------
# draw_actor_sr
# actor - the actor
# x - x-coordinate
# y - y-coordinate
# width - maximal allowed width
# This method draws the SR attribute.
#----------------------------------------------------------------------------
def draw_actor_sr_shaded(actor, x, y, w = 144)
w = 120 if !$scene.is_a?(Scene_Menu) && !BlizzCFG::RTAB_ACTIVE
self.bitmap.font.color = Color.new(0, 0, 0, 255)
self.bitmap.draw_text(x-1, y-16-1, w, 64, BlizzCFG::SR_NAME)
self.bitmap.draw_text(x+1, y-16-1, w, 64, BlizzCFG::SR_NAME)
self.bitmap.draw_text(x-1, y-16+1, w, 64, BlizzCFG::SR_NAME)
self.bitmap.draw_text(x+1, y-16+1, w, 64, BlizzCFG::SR_NAME)
self.bitmap.draw_text(x-1, y-1, w, 32, actor.sr_text, 2)
self.bitmap.draw_text(x+1, y-1, w, 32, actor.sr_text, 2)
self.bitmap.draw_text(x-1, y+1, w, 32, actor.sr_text, 2)
self.bitmap.draw_text(x+1, y+1, w, 32, actor.sr_text, 2)
self.bitmap.font.color = system_color
self.bitmap.draw_text(x, y-16, w, 64, BlizzCFG::SR_NAME)
self.bitmap.font.color = normal_color
self.bitmap.draw_text(x, y, w, 32, actor.sr_text, 2)
end
#----------------------------------------------------------------------------
# draw_actor_sr_with_bar
# actor - the actor
# x - x-coordinate
# y - y-coordinate
# width - maximal allowed width
# This method draws the bar of the SR attribute.
#----------------------------------------------------------------------------
def draw_actor_sr_with_bar(actor, x, y, w = 148)
rate = actor.sr.to_f / 1000
# SR bar colors
c = Color.new(130, 0, 130)
self.bitmap.draw_bar_ryex(x, y + 10, w, 12, rate, c)
# draw the text
if $scene.is_a?(Scene_Battle)
draw_actor_sr_shaded(actor, x, y, w)
else
draw_actor_sr_shaded(actor, x, y)
end
end
end
class Sprite_BattleStatus_Ryex_AnTeBS < RPG::Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, actor_id, recreate_flag = false)
super(nil)
self.x = x
self.y = y
self.y -= 14 unless recreate_flag
self.bitmap = Bitmap.new(150, 88)
@level_up_flag = false
@actor = $game_party.actors[actor_id]
@box_number = actor_id
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
draw_background
self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_NAMES_FONT, 22
self.bitmap.font.italic, self.bitmap.font.bold = true, true
draw_actor_name(@actor, 15, 0)
self.bitmap.font.italic, self.bitmap.font.bold = false, false
self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_HP_SP_FONT, 20
draw_actor_hp_bar_ryex(15, 24, 120, @actor)
draw_actor_hp_Ryex(@actor, 15, 14, 120)
draw_actor_sp_bar_ryex(15, 38, 120, @actor)
draw_actor_sp_Ryex(@actor, 15, 28, 120)
# if using SR
if BlizzCFG::DRAW_SR && BlizzCFG::SR_ENABLED.include?(@actor.id)
draw_actor_sr_with_bar(@actor, 15, 42, 120)
end
if @level_up_flag
self.bitmap.font.color = normal_color
self.bitmap.draw_text(15, 56, 120, 32, 'LEVEL UP!')
else
draw_actor_state(@actor, 15, 56)
end
self.bitmap.font.name, self.bitmap.font.size = 'Arial', 22
end
#--------------------------------------------------------------------------
# * Draw Background
#--------------------------------------------------------------------------
def draw_background
back_color = Color.new(75, 75, 75)
88.times do |i|
bcr = back_color.red * i / 88
bcg = back_color.green * i / 88
bcb = back_color.blue * i / 88
self.bitmap.fill_rect(0, 88 - i - 1, 150, 1, Color.new(bcr, bcg, bcb, 200))
end
case @box_number
when 0
self.bitmap.fill_rect(0, 0, 1, 88, Color.new(0, 0, 0, 200))
when ($game_party.actors.size - 1)
self.bitmap.fill_rect(149, 0, 1, 88, Color.new(0, 0, 0, 200))
end
self.bitmap.fill_rect(0, 0, 150, 1, Color.new(0, 0, 0, 200))
self.bitmap.fill_rect(0, 87, 150, 1, Color.new(0, 0, 0, 200))
end
end
#==============================================================================
# Window_HCommand_WI_Battle
#------------------------------------------------------------------------------
# This class was modified to support the slide-from-the-right feature for
# CDS, SRS and SLS.
#==============================================================================
class Window_HCommand_WI_Battle < Window_Selectable
attr_accessor :commands
attr_reader :actor
#----------------------------------------------------------------------------
# override initialize
#----------------------------------------------------------------------------
alias initialize_crls_later initialize
def initialize(width, commands)
initialize_crls_later(width, commands)
@commands2 = [@commands[0][1], BlizzCFG::SRS_NAME, BlizzCFG::CDS_NAME]
end
#----------------------------------------------------------------------------
# set_player_command
# new_actor - the new actor
# This method updates the actor in the window and all connected displays and
# data.
#----------------------------------------------------------------------------
def set_player_command(new_actor)
# if old actor exists and command is limit
if @actor != nil && @commands[0][1] == @actor.limit_name
# put back old command
@commands[0][1] = @commands2[0]
end
# set command to new actor's command
@commands2[0] = new_actor.limit_name
# store actor
@actor = new_actor
refresh
end
#----------------------------------------------------------------------------
# swap_commands
# index - at which position
# This method changes the command in the window.
#----------------------------------------------------------------------------
def swap_commands(index)
@commands[index][1], @commands2[index] = @commands2[index], @commands[index][1]
refresh
end
#----------------------------------------------------------------------------
# override refresh
# This method was completely modified to support the faster animated cursor
# and the moving animation.
#----------------------------------------------------------------------------
alias refresh_crls_later refresh
def refresh
# fotn fix
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
# if actor exists
if @actor != nil
# if SLS usable and already command active
if BlizzCFG::SLS_ACTIVE && BlizzCFG::SL_USERS.include?(@actor.id) &&
@actor.sl_can_use?
if self.index != 0 || @commands[0][1] != @actor.limit_name
# draw the normal command
self.contents.fill_rect(0, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(0, normal_color)
# draw arrows
self.contents.draw_text(-2, 0, 152, 32, '››', 2)
elsif @commands[0][1] == @actor.limit_name
# get color
self.contents.font.color = BlizzCFG::LIMIT_COLOR
# move the command in 6 steps
(0..6).each {|j|
x = self.index * 152
# remove display
self.contents.fill_rect(x, 0, 152, 32, Color.new(0, 0, 0, 0))
rect = Rect.new(x, -36 + j * 6, 152, 32)
# draw command
self.contents.draw_text(rect, @commands[0][1], 1)
Graphics.update}
end
else
self.contents.fill_rect(0, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(0, normal_color)
end
# if SRS usable and already command active
if BlizzCFG::SRS_ACTIVE && BlizzCFG::SR_USERS.include?(@actor.id)
if self.index != 1 || @commands[1][1] != BlizzCFG::SRS_NAME
# draw the normal command
self.contents.fill_rect(152, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(1, normal_color)
# draw arrows
self.contents.draw_text(150, 0, 152, 32, '››', 2)
elsif @commands[1][1] == BlizzCFG::SRS_NAME
# get color
self.contents.font.color = BlizzCFG::RAGE_COLOR
# move the command in 6 steps
(0..6).each {|j|
x = self.index * 152
# remove display
self.contents.fill_rect(x, 0, 152, 32, Color.new(0, 0, 0, 0))
rect = Rect.new(x, -36 + j * 6, 152, 32)
# draw command
self.contents.draw_text(rect, @commands[1][1], 1)
Graphics.update}
end
else
self.contents.fill_rect(152, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(1, normal_color)
end
# if CDS usable and already command active
if BlizzCFG::CDS_ACTIVE && BlizzCFG::CD_USERS.include?(@actor.id)
if self.index != 2 || @commands[2][1] != BlizzCFG::CDS_NAME
# draw the normal command
self.contents.fill_rect(152 * 2, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(2, normal_color)
# draw arrows
self.contents.draw_text(151 * 2, 0, 152, 32, '››', 2)
elsif @commands[2][1] == BlizzCFG::CDS_NAME
# move the command in 6 steps
(0..6).each {|j|
x = self.index * 152
# remove display
self.contents.fill_rect(x, 0, 152, 32, Color.new(0, 0, 0, 0))
rect = Rect.new(x, -36 + j * 6, 152, 32)
# if already CD actor
if @actor.states.include?(BlizzCFG::CD_ID)
# show Revert command
self.contents.font.color = BlizzCFG::REVERT_COLOR
self.contents.draw_text(rect, BlizzCFG::REVERT_NAME, 1)
else
# get color
if @actor.cd_can_use?
self.contents.font.color = BlizzCFG::CHAOS_COLOR
else
self.contents.font.color = disabled_color
end
# draw command
self.contents.draw_text(rect, @commands[2][1], 1)
end
Graphics.update}
end
else
self.contents.fill_rect(152 * 2, 0, 152, 32, Color.new(0, 0, 0, 0))
draw_item(2, normal_color)
end
else
refresh_crls_later
end
end
#----------------------------------------------------------------------------
# test_limit
# This method serves for quick testing if SL is available.
#----------------------------------------------------------------------------
def test_limit
return (@actor != nil && @actor.sl_can_use? && @index == 0)
end
#----------------------------------------------------------------------------
# limit
# This method serves for SL name retrieval.
#----------------------------------------------------------------------------
def limit
return (@actor != nil ? @actor.limit_name : '')
end
end
#==============================================================================
# Scene_Battle
#------------------------------------------------------------------------------
# This class was modified to allow the processing of CDS, SRS and SLS during
# battle.
#==============================================================================
class Scene_Battle
#----------------------------------------------------------------------------
# start_rage_select
# This method creates a CD window and sets it active.
#----------------------------------------------------------------------------
def start_chaos_select
# RTAB compatibility
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
# create and set up window
@chaos_window = Window_ChaosDrive.new(battler)
@chaos_window.help_window = @help_window
@chaos_window.z = 300
@chaos_window.y = 160
@actor_command_window.active = false
@actor_command_window.move(@actor_command_window.x, 481)
end
#----------------------------------------------------------------------------
# start_rage_select
# This method creates an SR window and sets it active.
#----------------------------------------------------------------------------
def start_rage_select
# RTAB compatibility
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
# create and set up window
@rage_window = Window_SoulRage.new(battler)
@rage_window.help_window = @help_window
@rage_window.z = 300
@rage_window.y = 160
@actor_command_window.active = false
@actor_command_window.move(@actor_command_window.x, 481)
end
#----------------------------------------------------------------------------
# end_rage_select_plus
# This method triggers the SR window and the other windows visible.
#----------------------------------------------------------------------------
def end_rage_select_plus
# if SR window exists
if @rage_window != nil
if @rage_window.visible
# set command window to active
@actor_command_window.active = @actor_command_window.visible = true
@actor_command_window.move(@actor_command_window.x, 416)
@help_window.move(@help_window.x, 481)
else
# set SR window to active and make visible
@rage_window.active = @rage_window.visible = true
end
end
end
#----------------------------------------------------------------------------
# end_rage_select
# This method removes the SR window and returns to the command menu.
#----------------------------------------------------------------------------
def end_rage_select
end_rage_select_plus
@actor_command_window.swap_commands(1)
@rage_window.dispose
@rage_window = nil
@help_window.move(@help_window.x, 481)
end
# end_rage_select_plus
# This method triggers the CD window and the other windows visible.
#----------------------------------------------------------------------------
def end_chaos_select_plus
# if SR window exists
if @chaos_window != nil
if @chaos_window.visible
# set command window to active
@actor_command_window.active = @actor_command_window.visible = true
@actor_command_window.move(@actor_command_window.x, 416)
@help_window.move(@help_window.x, 481)
else
# set CD window to active and make visible
@chaos_window.active = @chaos_window.visible = true
end
end
end
#----------------------------------------------------------------------------
# end_chaos_select
# This method removes the CD window and returns to the command menu.
#----------------------------------------------------------------------------
def end_chaos_select
end_chaos_select_plus
@actor_command_window.swap_commands(2)
@chaos_window.dispose
@chaos_window = nil
@help_window.move(@help_window.x, 481)
end
#----------------------------------------------------------------------------
# override update_phase3_basic_command
# This method was enhanced with advanced selection control of the
# slide-from-the-right commands.
#----------------------------------------------------------------------------
#alias update_phase3_basic_command_crls_later update_phase3_basic_command
def update_phase3_basic_command
# RTAB compatibility
battler = (BlizzCFG::RTAB_ACTIVE ? @active_actor : @active_battler)
# restore commands
restore_commands(battler)
# stop if SLS activated
return if update_sls_input(battler)
# stop if SRS activated
return if update_srs_input(battler)
# stop if CDS activated
return if update_cds_input(battler)
# RTAB left pressing limitation
if !BlizzCFG::RTAB_ACTIVE || !Input.press?(Input::DOWN) && !Input.press?(Input::UP)
# call original method
update_phase3_basic_command_crls_later
end
end
#----------------------------------------------------------------------------
# restore_commands
# battler - the currently active battler
# Sets up the commands displayed.
#----------------------------------------------------------------------------
def restore_commands(battler)
# if able to use SLS, but not selected
if BlizzCFG::SLS_ACTIVE && BlizzCFG::SL_USERS.include?(battler.id) &&
@actor_command_window.index != 0 &&
@actor_command_window.commands[0][1] == @actor_command_window.limit
# reset command
@actor_command_window.swap_commands(0)
@help_window.set_text('', 1)
@help_window.move(@help_window.x, 481)
end
# if able to use SRS, but not selected
if BlizzCFG::SRS_ACTIVE && BlizzCFG::SR_USERS.include?(battler.id) &&
@actor_command_window.index != 1 &&
@actor_command_window.commands[1][1] == BlizzCFG::SRS_NAME
# reset command
@actor_command_window.swap_commands(1)
end
# if able to use CDS, but not selected
if BlizzCFG::CDS_ACTIVE && BlizzCFG::CD_USERS.include?(battler.id) &&
@actor_command_window.index != 2 &&
@actor_command_window.commands[2] == BlizzCFG::CDS_NAME
# reset command
@actor_command_window.swap_commands(2)
end
end
#----------------------------------------------------------------------------
# update_sls_input
# battler - the currently active battler
# Sets up the command window data.
#----------------------------------------------------------------------------
def update_sls_input(battler)
# if able to use SLS
if BlizzCFG::SLS_ACTIVE && BlizzCFG::SL_USERS.include?(battler.id)
# if able to use SL and RIGHT is being hold
if @actor_command_window.test_limit && Input.press?(Input::UP)
# if command not visible
if @actor_command_window.commands[0][1] != @actor_command_window.limit
# make it visible
$game_system.se_play($data_system.decision_se)
skill = $data_skills[@actor_command_window.actor.limit_id]
@help_window.set_text(skill.description, 1)
@help_window.move(@help_window.x, 352)
@actor_command_window.swap_commands(0)
end
# prevent going crazy when pressing UP or DOWN
if !Input.press?(Input::RIGHT) && !Input.press?(Input::LEFT)
@actor_command_window.update
end
# RTAB fix
abort = true
# if command visible
elsif @actor_command_window.commands[0][1] == @actor_command_window.limit
# change back
$game_system.se_play($data_system.cancel_se)
@actor_command_window.swap_commands(0)
@help_window.set_text('', 1)
@help_window.move(@help_window.x, 481)
end
# if command visible and C is being pressed
if @actor_command_window.commands[0][1] == @actor_command_window.limit &&
Input.trigger?(Input::C)
# execute SL use setup
$game_system.se_play($data_system.decision_se)
battler.current_action.kind = BlizzCFG::SL_KIND
battler.current_action.skill_id = @actor_command_window.actor.limit_id
@skill = $data_skills[battler.current_action.skill_id]
@help_window.move(@help_window.x, 481)
# depending on the skill specsifications, allow target selection
if @skill.scope == 1
start_enemy_select
@actor_command_window.swap_commands(0)
elsif [3, 5].include?(@skill.scope)
start_actor_select
@actor_command_window.swap_commands(0)
else
@actor_command_window.swap_commands(0)
phase3_next_actor
end
return true
end
# abort if RTAB to prevent character change
return true if abort
end
end
#----------------------------------------------------------------------------
# update_srs_input
# battler - the currently active battler
# Sets up the command window data.
#----------------------------------------------------------------------------
def update_srs_input(battler)
# if able to use SRS
if BlizzCFG::SRS_ACTIVE && BlizzCFG::SR_USERS.include?(battler.id)
# if able to use SR and RIGHT is being hold
if @actor_command_window.index == 1 && Input.press?(Input::UP)
# if command not visible
if @actor_command_window.commands[1][1] != BlizzCFG::SRS_NAME
# make it visible
$game_system.se_play($data_system.decision_se)
@actor_command_window.swap_commands(1)
end
# prevent going crazy when pressing UP or DOWN
if !Input.press?(Input::RIGHT) && !Input.press?(Input::LEFT)
@actor_command_window.update
end
# RTAB fix
abort = true
# if command visible
elsif @actor_command_window.commands[1][1] == BlizzCFG::SRS_NAME
# change back
$game_system.se_play($data_system.cancel_se)
@actor_command_window.swap_commands(1)
end
# if command visible and C is being pressed
if @actor_command_window.commands[1][1] == BlizzCFG::SRS_NAME &&
Input.trigger?(Input::C)
# execute SR use setup
$game_system.se_play($data_system.decision_se)
battler.current_action.kind = BlizzCFG::SR_KIND
start_rage_select
return true
end
# abort if RTAB to prevent character change
return true if abort
end
end
#----------------------------------------------------------------------------
# update_cds_input
# battler - the currently active battler
# Sets up the command window data.
#----------------------------------------------------------------------------
def update_cds_input(battler)
# if able to use CDS
if BlizzCFG::CDS_ACTIVE && BlizzCFG::CD_USERS.include?(battler.id)
# if able to use CD and RIGHT is being hold
if @actor_command_window.index == 2 && Input.press?(Input::UP)
# if command not visible
if @actor_command_window.commands[2][1] != BlizzCFG::CDS_NAME
# make it visible
$game_system.se_play($data_system.decision_se)
@actor_command_window.swap_commands(2)
end
# prevent going crazy when pressing UP or DOWN
if !Input.press?(Input::RIGHT) && !Input.press?(Input::LEFT)
@actor_command_window.update
end
# RTAB fix
abort = true
# if command visible
elsif @actor_command_window.commands[2][1] == BlizzCFG::CDS_NAME
# change back
$game_system.se_play($data_system.cancel_se)
@actor_command_window.swap_commands(2)
end
# if command visible and C is being pressed
if @actor_command_window.commands[2][1] == BlizzCFG::CDS_NAME &&
Input.trigger?(Input::C)
unless @actor_command_window.actor.states.include?(BlizzCFG::CD_ID)
# if can use CD
if @actor_command_window.actor.cd_can_use?
# execute CD use setup
$game_system.se_play($data_system.decision_se)
battler.current_action.kind = BlizzCFG::CD_KIND
start_chaos_select
else
$game_system.se_play($data_system.buzzer_se)
end
else
# execute CD revert setup
$game_system.se_play($data_system.decision_se)
battler.current_action.kind = BlizzCFG::CD_KIND
battler.chaos_action = 2
@actor_command_window.swap_commands(2)
phase3_next_actor
end
return true
end
# abort if RTAB to prevent character change
return true if abort
end
end
end