08-04-2014, 04:24 AM
Not sure which is which.... but I'm using Atoa Custom Battle System ver. 3 with his ATB Addon.
I thought of adding the Game OVer script above the Battle Script and it didn't change a thing.
Here's the Battle Status Script:
and here's the ATB Script:
I thought of adding the Game OVer script above the Battle Script and it didn't change a thing.
Here's the Battle Status Script:
Add| Battle Windows
Code:
#==============================================================================
# Add-On: Battle Window
# by Atoa
#==============================================================================
# This Add-On grants the user a high custmization level of the battle windows
# Allowing font change, size and position of the text on the window.
# And also allowing the change of the position, size and opacity of the window.
# If you using any script that changes the HP/SP/EXP display, you must
# add them bellow this one
#==============================================================================
module Atoa
# Exhibition Type (take a look at the 'IMPORTANT WARNING' just bellow)
Display_Type = 1
# If Display_Type = 0 the character attributes will be shown
# on the traditional XPway , horizontaly.
# Ex.:
# Ash Trevor Monique
# HP 741 HP 695 HP 486
# SP 541 SP 591 SP 661
#
# If Display_Type = 1 the character attributes will be shwon
# verticaly.
# Ex.:
# Ash HP 741 SP 541
# Trevor HP 695 SP 591
# Monique HP 486 SP 661
#
# If 'Display_Type = 2', the position will be custom. Adjust the postions below
#
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# ***IMPORTANT WARNING** #
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
#
# If you change the value of 'Display_Type', you must readjust *ALL*
# X/Y coordinates of the texts. The change isn't automatic.
# Stay alert about this.
#
#============================================================================
# Only valid if 'Display_Type = 0', allows the centralization of the status
# windows if the group has less then 4 members
Horizontal_Centralize = false
# Only valid if 'Display_Type = 2', adjust the base position of the attributes
# of each character
Custom_Stat_Position = [[0,0],[8,24],[16,48],[18,72]]
# Configuration of the Attributes Battle Window
# Battle_Window = [Position X, Position Y, Width, Height, Opacity, Trasparent Edge]
Battle_Window = [0 , 320, 640, 160, 0, true]
# Leave the last value true to add the opacity to the edge of the window
# Needed if you wish to make 100% transparent windows
# The text format will be applied to the values in the menu?
Text_Format_in_Menu = false
# true = all format config are applied to the values in the menu
# false = the format configs are valid only in battle
# Battle Window Background image, leave nil or '' for no image
# The file must be on the pictures folder
Battle_Window_Backgroud = 'Battle_Status'
Battle_Font = 'Monotype Corsiva'
Battle_Size = 20
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# CONFIGURATION OF THE WINDOW CONTENT #
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Configuration of the name exhibition
# Name_Config = [Position X, Position Y, Font Name, Font Size, Bold]
Name_Config = [0, -5, Battle_Font, Battle_Size, true]
# Configuration of the HP text exhibition
# HP_Text = [Position X, Position Y, Font Name, Font Size, Bold]
HP_Text = [155, -5, Battle_Font, Battle_Size, false]
# Configuration of the HP digits exhibition
# HP_Number = [Font Name, Font Size, Bold, Show Max HP]
HP_Number = [Battle_Font, Battle_Size, false, true]
# Configuration of the Max HP digits exhibition
# Max_HP_Number = [Font Name, Font Size, Bold]
Max_HP_Number = [Battle_Font, Battle_Size, false]
# Configuration of the SP text exhibition
# SP_Text = [Position X, Position Y, Font Name, Font Size, Bold]
SP_Text = [300, -5, Battle_Font, Battle_Size, false]
# Configuration of the SP digits exhibition
# SP_Number = [Font Name, Font Size, Bold, Show Max HP]
SP_Number = [Battle_Font, Battle_Size, false, true]
# Configuration of the Max SP digits exhibition
# Max_SP_Number = [Font Name, Font Size, Bold]
Max_SP_Number = [Battle_Font, Battle_Size, false]
# Configuration of the States exhibition
# State_Config = [Position X, Position Y]
State_Config = [485, -7]
# Show Level Up Message in status window?
Lvl_Up_Flag = true
# Level Up Message
Lvl_Up_Msg = 'LEVEL UP!'
# The level up message is shown in the same place as the states
# Configuration of the Level exhibition
Draw_Level = true # Show level in status window?
Level_Name = 'Lvl:' # Name of the 'Level' Status shown in the window
# Configuration of the Level text exhibition
# Level_Text = [Position X, Position Y, Font Name, Font Size, Bold]
Level_Text = [90, -5, Battle_Font, Battle_Size, false]
# Configuration of the Level digits exhibition
# Level_Number = [Font Name, Font Size, Bold]
Level_Number = [Battle_Font, Battle_Size, true]
# Configuration of the Exp exhibition:(only in menu when Text_Format_in_Menu = true)
Exp_Name = 'Exp' # Name of the 'Exp' Status shown in the window
# Configuration of the Exp text exhibition
# Exp_Text = [Font Name, Font Size, Bold]
Exp_Text = [Battle_Font, Battle_Size, false]
# Configuration of the Exp digits exhibition
# Exp_Number = [Font Name, Font Size, Bold]
Exp_Number = [Battle_Font, Battle_Size, false]
# Configuration of the Next Exp digits exhibition
# Next_Exp_Number = [Font Name, Font Size, Bold]
Next_Exp_Number = [Battle_Font, Battle_Size, true]
# Configuration of the Face exhibition
# To use faces, you must create an folder named 'Faces' in the Graphics folder
# The face graphic must have the same as the actor character graphic
# Show Faces? true = show / false = don't show
Show_Faces = false
# Face_Config = [Position X, Position Y, Opacity]
Face_Config = [5, 128, 160]
# Extension for Face file name, use if you want the battle faces file names
# to be different from the normal faces
Face_Extension = ''
# The text extension must be add to all faces file names
# E.g.: Face_Extension = '_bt'
# 001-Fighter01_bt
# Use the character hue on the face?
Use_Character_Hue = false
# true = use the hue
# true = dont't use the hue
# Configuration of the Char Graphic exhibition
# Show Char Graphic? true = show / false = don't show
Show_Char = false
# Char_Config = [Posição X, Posição Y, Transparencia, Show only half]
Char_Config = [96, 60, 255, true]
end
#==============================================================================
# ** Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Battle Windows'] = true
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Draw Name
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias battler_window_draw_actor_name draw_actor_name
def draw_actor_name(actor, x, y)
if $game_temp.in_battle or Text_Format_in_Menu
self.contents.font.color = normal_color
self.contents.font.name = Name_Config[2]
self.contents.font.size = Name_Config[3]
self.contents.font.bold = Name_Config[4]
self.contents.draw_text(x, y, 120, 32, actor.name)
set_default_font
else
battler_window_draw_actor_name(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw Level
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias battler_window_draw_actor_level draw_actor_level
def draw_actor_level(actor, x, y)
if $game_temp.in_battle or Text_Format_in_Menu
self.contents.font.color = system_color
self.contents.font.name = Level_Text[2]
self.contents.font.size = Level_Text[3]
self.contents.font.bold = Level_Text[4]
size = contents.text_size(Level_Name).width
self.contents.draw_text(x, y, size + 4, 32, Level_Name)
self.contents.font.color = normal_color
self.contents.font.name = Level_Number[0]
self.contents.font.size = Level_Number[1]
self.contents.font.bold = Level_Number[2]
self.contents.draw_text(x + size, y, 24, 32, actor.level.to_s, 2)
set_default_font
else
battler_window_draw_actor_level(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias battler_window_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
if $game_temp.in_battle or Text_Format_in_Menu
self.contents.font.color = system_color
self.contents.font.name = HP_Text[2]
self.contents.font.size = HP_Text[3]
self.contents.font.bold = HP_Text[4]
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.font.name = HP_Number[0]
self.contents.font.size = HP_Number[1]
self.contents.font.bold = HP_Number[2]
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.font.name = HP_Text[2]
self.contents.font.size = HP_Text[3]
self.contents.font.bold = HP_Text[4]
self.contents.draw_text(hp_x + 48, y, 12, 32, '/', 1)
self.contents.font.name = Max_HP_Number[0]
self.contents.font.size = Max_HP_Number[1]
self.contents.font.bold = Max_HP_Number[2]
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
set_default_font
else
battler_window_draw_actor_hp(actor, x, y, width)
end
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias battler_window_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
if $game_temp.in_battle or Text_Format_in_Menu
self.contents.font.color = system_color
self.contents.font.name = SP_Text[2]
self.contents.font.size = SP_Text[3]
self.contents.font.bold = SP_Text[4]
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.font.name = SP_Number[0]
self.contents.font.size = SP_Number[1]
self.contents.font.bold = SP_Number[2]
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.font.name = SP_Text[2]
self.contents.font.size = SP_Text[3]
self.contents.font.bold = SP_Text[4]
self.contents.draw_text(sp_x + 48, y, 12, 32, '/', 1)
self.contents.font.name = Max_SP_Number[0]
self.contents.font.size = Max_SP_Number[1]
self.contents.font.bold = Max_SP_Number[2]
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
set_default_font
else
battler_window_draw_actor_sp(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw EXP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias battler_window_draw_actor_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
if Text_Format_in_Menu
self.contents.font.color = system_color
self.contents.font.name = Exp_Text[0]
self.contents.font.size = Exp_Text[1]
self.contents.font.bold = Exp_Text[2]
self.contents.draw_text(x, y, 32, 32, Exp_Name)
self.contents.font.color = normal_color
self.contents.font.name = Exp_Number[0]
self.contents.font.size = Exp_Number[1]
self.contents.font.bold = Exp_Number[2]
self.contents.draw_text(x + 12, y, 96, 32, actor.exp_s, 2)
self.contents.font.color = normal_color
self.contents.font.name = Exp_Text[0]
self.contents.font.size = Exp_Text[1]
self.contents.font.bold = Exp_Text[2]
self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
self.contents.font.name = Next_Exp_Number[0]
self.contents.font.size = Next_Exp_Number[1]
self.contents.font.bold = Next_Exp_Number[2]
self.contents.draw_text(x + 120, y, 96, 32, actor.next_exp_s)
set_default_font
else
battler_window_draw_actor_exp(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw Face Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# opacity : face opacity
#--------------------------------------------------------------------------
def draw_actor_battle_face(actor, x, y, opacity = 255)
begin
face_hue = Use_Character_Hue ? actor.character_hue : 0
face = RPG::Cache.faces(actor.character_name + Face_Extension, face_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect, opacity)
rescue
end
end
#--------------------------------------------------------------------------
# * Draw Actor Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# opacity : face opacity
#--------------------------------------------------------------------------
def draw_actor_battle_graphic(actor, x, y, opacity = 255)
begin
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / (Char_Config[3] ? 6 : 4)
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
rescue
end
end
#--------------------------------------------------------------------------
# * Set Default Fonts
#--------------------------------------------------------------------------
def set_default_font
self.contents.font.name = Font.default_name
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(Battle_Window[0], Battle_Window[1], Battle_Window[2], Battle_Window[3])
if Battle_Window_Backgroud != nil and Battle_Window_Backgroud != ''
@background_image = Sprite.new
@background_image.bitmap = RPG::Cache.picture(Battle_Window_Backgroud)
@background_image.x = Battle_Window[0]
@background_image.y = Battle_Window[1]
@background_image.z = 899
end
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = []
for i in 0...$game_party.actors.size
@level_up_flags << false
end
self.z = 900
self.back_opacity = Battle_Window[4]
self.opacity = Battle_Window[4] if Battle_Window[5]
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
self.contents.font.size = 22
hp_w = HP_Number[3] ? 140 : 80
sp_w = SP_Number[3] ? 140 : 80
actor = $game_party.actors[i]
case Display_Type
when 0
wd = (width - 32) / Max_Party
actor_x = Horizontal_Centralize ? ((i * wd) + (wd * (Max_Party - $game_party.actors.size) / 2)) : i * wd
actor_y = 0
when 1
actor_x = 0
actor_y = i * 32
when 2
actor_x = Custom_Stat_Position[i][0]
actor_y = Custom_Stat_Position[i][1]
end
draw_actor_battle_face(actor, actor_x + Face_Config[0], actor_y + Face_Config[1], Face_Config[2]) if Show_Faces
draw_actor_battle_graphic(actor, actor_x + Char_Config[0], actor_y + Char_Config[1], Char_Config[2]) if Show_Char
draw_actor_name(actor, actor_x + Name_Config[0], actor_y + Name_Config[1])
draw_actor_hp(actor, actor_x + HP_Text[0], actor_y + HP_Text[1], hp_w)
draw_actor_sp(actor, actor_x + SP_Text[0], actor_y + SP_Text[1], sp_w)
draw_actor_level(actor, actor_x + Level_Text[0], actor_y + Level_Text[1]) if Draw_Level
self.contents.font.bold = true
if @level_up_flags[i] and Lvl_Up_Flag
self.contents.font.color = crisis_color
self.contents.draw_text(actor_x + State_Config[0], actor_y + State_Config[1], 132, 32, Lvl_Up_Msg )
else
draw_actor_state(actor, actor_x + State_Config[0], actor_y + State_Config[1])
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias battler_window_dispose dispose
def dispose
@background_image.dispose if @background_image != nil
battler_window_dispose
end
end
and here's the ATB Script:
Add | Atoa ATB
Code:
#==============================================================================
# Atoa's Active Time Battle Version
# By Atoa
#==============================================================================
# This Script adds a time bar system to the game
# The configurations are explained below
#==============================================================================
module Atoa
# Do not remove or change these lines
Cast_Time = {}
Cast_Cancel = {}
ATB_Freeze = {}
ATB_Delay = {}
# Do not remove or change these lines
# Waiting Mode
Wait_Mode = 0
# 0 = On Hold Battle: the bar stops to select actions, skills and itens
# 1 = Semi On Hold Battle: the bar stop to select itens and skills.
# 2 = 100% Active Battle: the bar will never stop.
# Pause the bar when a battler is executing an action?
Wait_Act_End = false
# Stop time bar during damage animation?
Pause_if_Damaged = false
# Show individual time bars for the battlers?
Meters = true
# Hide individual meters toghter with the status screen?
Hide_Meters = true
# Show a single bar that indicates the battler's action order?
Bars = false
# Hide singe bar toghter with the status screen?
Hide_Bars = true
# Time Bar Division
Dual_Bars = 0
# if lower than 0, the bar will not be divided, and actions with chanting
# will restart from the begin. If higher than 0, the value will show the %
# of the bar that will be reserved for casting (Like Grandia)
# Battle Speed
Atb_Speed = 0.5
# Initial bar value modifier
Atb_Initial_Value = 0
# Multiplication rate of the initial bar value
Atb_Initial_Rate = 1.0
# ATB's maximum value, only change if you know what you doing.
Max_Atb = 500
# Agility Modifier, The higher this value, the lower is the diference between
# battlers with different agility
Atb_Agi_Modifier = 50
# Makes the bar gorws faster if no actor is active
Faster_if_inactive = false
# Definition of turn shifting.
# This definition must be used for the duration of effects and
# battle event conditions
# This value does not count to enemies actions conditions
Custom_Turn_Count = 1
# 0 = By number of fighters
# 1 = By number of executed actions
# 2 = By time (in frames)
# If 'Custom_Turn_Count = 1', define how many actions are equal to 1 turn
Action_Turn_Count = 1
# If 'Custom_Turn_Count = 2', define how much time (in frames) are equal to 1 turn
Time_Tunr_Count = 1200 # 20 frames is about 1 second
# Set the escape style
Escape_Type = 2
# 0 = Escape options is shown on the character's action menu
# 1 = Keep pressed the key set in Escape_Input to escape
# shows a message on the screen
# 2 = Keep pressed the key set in Escape_Input to escape
# shows an escape bar
# Key that must be pressed to escape
Escape_Input = Input::X
# Key that must be pressed to change the input battler
Next_Input = Input::B
# Key that must be pressed to end battler turn
Cancel_Input = Input::A
# Remember to not leave any equal input
# Input::A = Keyborard:Z
# Input::B = Keyborard:X
# Input::C = Keyborard:C
# Input::X = Keyborard:A
# Input::Y = Keyborard:S
# Input::Z = Keyborard:D
# Input::L = Keyborard:Q
# Input::R = Keyborard:W
# Show the name for the escape option when Escape_Type = 0
Escape_Name = 'Escape'
# Escape message when Escape_Type = 1
Escape_Message = 'Escaping...'
Cant_Escape_Message = "Can't Escape!"
# Time (in frames) needed to escape when Escape_Type > 0
# it is affected by the agility of characters and enemies
Escape_Time = 450
# Name of the graphic file when Escape_Type = 2
Escape_Skin = 'ESCAPEMeter'
# Position of the Fleeing Bar
Escape_Meter_Pos_Type = 0
# 0 = Above the characters
# 1 = Upper-Mid of the screen
# 2 = Custom position
# Custom position of the Fleeing Bar when Escape_Meter_Pos_Type = 2
Escape_Meter_Position = [240,64]
# Time Bar configurations
Meter_Skin = 'ATBMeter' # Graphic file name that represents the bars
# must be on the Graphic/Windowskins folder
# Position of the character's Time Bars
Meter_Pos_Style = 2
# 0 = Horizontal Pattern, not centralized
# 1 = Horizontal Pattern, centralized
# 2 = Vertical Bars
# 3 = Under the characters
# 4 = Above the characters
# 5 = Custom
# Readjust the Time Bar's position on the battle screen
X_Meter = 12 # X position of the Bars
Y_Meter = 350 # Y position of the Bars
# Custom Time Bar position, only valid when Meter_Pos_Style = 4
Meter_Position = [[460,180],[480,210],[500,240],[520,270]]
# Coordinate 'Z' (height) of the Meter image if Meter_Pos_Style = 4
Meter_Height = 250
# Position of the enemie's Time Bars
Enemy_Meter = 0
# 0 = No time bars for the enemies
# 1 = Under the enemy
# 2 = Above the enemy
# 3 = Vertical list on the Side
# Configuration of the Action Bars.
Bar_Skin = 'ATBBar' # Name of the graphic file that represents the bar, must be
# on the Graphics/Windowskins folder
X_Bar = 128 # X position of the Bars
Y_Bar = 70 # Y position of the Bars
# Name of the default graphic Icon for characters
Default_Party_Icon = '050-Skill07'
# Individual character's Icons
# Must be configured on the following way:
# Party_Icon = {'Battler file name' => 'Icon file name',...}
Party_Icon = {
'Leon' => 'Atoa-Icon',
'Zelos' => 'Kahh-Icon',
'Chelsea' => 'DarkLuar-Icon',
'Klarth' => 'Tunicoelp-Icon',
}
# Name of the default graphic Icon for enemies
Default_Enemy_Icon = '046-Skill03'
# Individual icons for enemies
# must be configured on the following way:
# Enemy_Icon => {'Battler file name' => 'Icon file name',...}
Enemy_Icon = {}
# Sound effect played when teh character's turn comes. nil for no sound
Command_Up_SE = '046-Book01'
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# CAST SETTINGS
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Chanting default pose, if nil, no pose is used.
Chanting_Pose = 8
# To add an pose to an skill or item, add this effect to the setting of the
# skill or the item.
# 'Chanting/**'
# ** must be the Pose ID.
# To set an chanting pose for an specific graphic, add this to the graphic setting:
# 'Chanting' => Pose ID.
# Set here the cast time for each item and skill
# By default all items have the cast speed = 0 (that means, no cast).
#
# Cast_Time[Action_Type] = {Action_ID => [Speed, status]}
# Action_Type = 'Skill' for skills, 'Item' for items
# Action_ID = ID of the skill or item
# Speed = cast speed, higher value = faster cast
# recomended values between 500-100
# Status = The status that the cast speed is based
# if nil, the cast will have fixed speed
# the status can be:
# 'hp', 'sp', 'level', 'str', 'dex', 'int', 'agi'
Cast_Time['Skill'] = {114 => [25], 2 => [400,'int'], 3 => [300,'int'],
7 => [500,'int'], 8 => [400,'int'], 9 => [300,'int'], 10 => [500,'int'],
11 => [400,'int'], 12 => [300,'int'], 13 => [500,'int'], 14 => [400,'int'],
15 => [300,'int'], 16 => [500,'int'], 17 => [400,'int'], 18 => [300,'int'],
19 => [500,'int'], 20 => [400,'int'], 21 => [300,'int'], 22 => [500,'int'],
23 => [400,'int'], 24 => [300,'int'], 25 => [500,'int'], 26 => [400,'int'],
27 => [300,'int'], 28 => [500,'int'], 29 => [400,'int'], 30 => [300,'int']}
Cast_Time['Item'] = {}
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# SETTINGS OF ACTIONS THAT CHANGE THE ATB
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Actions that may cause changes on the target ATB
# Chance that all actions have to cancel skill cast of the target.
# This value is used for all actions that don't have individual definition.
Base_Cast_Cancel = 0
# Set here the chance that each action have of canceling the cast of target
#
# Cast_Cancel[Action_Type] = {Action_ID => Rate}
# Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
# Action_ID = ID of the skill, item or weapon
# Rate = chance of calceling cast, increases with damage caused.
#
# Important: if tha action is an physical skill, the weapon cancel chance is
# also applied (the values aren't added, each one are calculated separatedely)
#--------------------------------------------------------------------------
# Pause on the ATB bar when recive damage
# This value is used for all actions that don't have individual definition.
# Time in frames that the ATB bar will be stoped, increases with damage caused.
Base_ATB_Freeze = 0
# Set here the actions that will cause ATB pause
#
# Cast_Cancel[Action_Type] = {Action_ID => Pause}
# Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
# Action_ID = ID of the skill, item or weapon
# Pause = ATB pause time, increases with damage caused.
#
# Important: if tha action is an physical skill, the weapon pause is also calculated
#--------------------------------------------------------------------------
# Delay on the ATB bar when recive damage
# This value is used for all actions that don't have individual definition.
Base_ATB_Delay = 0
# Set here the actions that will cause ATB delay
#
# Cast_Cancel[Action_Type] = {Action_ID => Delay}
# Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
# Action_ID = ID of the skill, item or weapon
# Delay = ATB delay value, increases with damage caused.
#
# Important: if tha action is an physical skill, the weapon delay is also calculated
end
#==============================================================================
# ** Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa ATB'] = true
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# Class that manage skills
#==============================================================================
class RPG::Skill
#----------------------------------------------------------------------------
# * Set action cast speed
# battler : battler
#----------------------------------------------------------------------------
def cast_speed(battler)
if Cast_Time != nil and Cast_Time['Skill'] != nil and Cast_Time['Skill'][@id] != nil
cast1 = Cast_Time['Skill'][@id][0]
if Cast_Time['Skill'][@id][1].nil?
cast2 = 200
else
if Cast_Time['Skill'][@id][1] == 'level'
cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") * 2) + 100
elsif Cast_Time['Skill'][@id][1] == 'hp' or Cast_Time['Skill'][@id][1] == 'sp'
cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") / 50) + 100
else
cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") / 5) + 100
end
end
return (cast1 * cast2).to_i
end
return 0
end
end
#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
# Class that manage items
#==============================================================================
class RPG::Item
#----------------------------------------------------------------------------
# * Set action cast speed
# battler : battler
#----------------------------------------------------------------------------
def cast_speed(battler)
if Cast_Time != nil and Cast_Time['Item'] != nil and Cast_Time['Item'][@id] != nil
cast1 = Cast_Time['Item'][@id][0]
if Cast_Time['Item'][@id][1].nil?
cast2 = 200
else
if Cast_Time['Item'][@id][1] == 'level'
cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") * 2) + 100
elsif Cast_Time['Item'][@id][1] == 'hp' or Cast_Time['Item'][@id][1] == 'sp'
cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") / 50) + 100
else
cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") / 5) + 100
end
end
return cast1 * cast2
end
return 0
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :max_escape_count
attr_accessor :escape_count
attr_accessor :hide_meters
attr_accessor :no_active_battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_atb initialize
def initialize
initialize_atb
@max_escape_count = 0
@escape_count = 0
end
#--------------------------------------------------------------------------
# * Get escape line type
#--------------------------------------------------------------------------
def escape_atb_linetype
return 2 unless @battle_can_escape
return 1 if @battle_can_escape
end
#--------------------------------------------------------------------------
# * Get escap bar value
#--------------------------------------------------------------------------
def escape_atb_lineamount
return 100 * @escape_count / @max_escape_count if @battle_can_escape
return 100 unless @battle_can_escape
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :wait_mode
attr_accessor :action_wait
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_atb initialize
def initialize
initialize_atb
@wait_mode = Wait_Mode
@action_wait = Wait_Act_End
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Get idle pose ID
#--------------------------------------------------------------------------
alias set_idle_pose_atb set_idle_pose
def set_idle_pose
pose = set_idle_pose_atb
unless pose == Dead_Pose or pose == Victory_Pose
if battler.cast_action != nil
action = @battler.cast_action
cast_pose = set_pose_id('Chanting')
ext = check_extension(action, 'CHANTING/')
if ext != nil
ext.slice!('CHANTING/')
cast_pose = ext.to_i
end
end
end
return cast_pose.nil? ? pose : cast_pose
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :atb
attr_accessor :cast_action
attr_accessor :casting
attr_accessor :cast_target
attr_accessor :turn_count
attr_accessor :guarding
attr_accessor :passed
attr_accessor :atb_delay
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_atb initialize
def initialize
initialize_atb
@atb = 0
@cast_skill = 0
@turn_count = 0
@atb_delay = 0
@guarding = false
@passed = false
@casting = false
end
#--------------------------------------------------------------------------
# * Get ATB line type
#--------------------------------------------------------------------------
def atb_linetype
return 4 if self.cast_action != nil and self.atb_full?
return 3 if self.cast_action != nil
return 2 if self.atb_full?
return 1
end
#--------------------------------------------------------------------------
# * Get ATB line value
#--------------------------------------------------------------------------
def atb_lineamount
return 0 if self.dead?
return 100 * self.atb / self.max_atb
end
#--------------------------------------------------------------------------
# * Casting flag
#--------------------------------------------------------------------------
def casting
return false if self.dead?
return @casting
end
#--------------------------------------------------------------------------
# * Get Max ATB
#--------------------------------------------------------------------------
def max_atb
return Max_Atb
end
#--------------------------------------------------------------------------
# * Set current ATB
# n : new atb
#--------------------------------------------------------------------------
def atb=(n)
@atb = [[n.to_i, 0].max, self.max_atb].min
end
#--------------------------------------------------------------------------
# * ATB Preset
#--------------------------------------------------------------------------
def atb_preset
percent = self.max_atb * Atb_Initial_Rate * (rand(64) + 16) * (self.agi + Atb_Agi_Modifier) / total_agi / 1000
self.atb = Atb_Initial_Value + percent
end
#--------------------------------------------------------------------------
# * Battlers total agility
#--------------------------------------------------------------------------
def total_agi
total = 0
for battler in $game_party.actors + $game_troop.enemies
total += battler.agi
end
return total
end
#--------------------------------------------------------------------------
# * ATB full flag
#--------------------------------------------------------------------------
def atb_full?
return @atb == self.max_atb
end
#--------------------------------------------------------------------------
# * Update ATB
#--------------------------------------------------------------------------
def atb_update
if self.cast_action.nil?
self.atb += speed_adjust * 200 * (self.agi + Atb_Agi_Modifier) / total_agi / 100.0
else
cast = cast_action.cast_speed(self)
self.atb += speed_adjust * (cast + Atb_Agi_Modifier) / total_agi / 100.0
end
end
#--------------------------------------------------------------------------
# * Speed adjust
#--------------------------------------------------------------------------
def speed_adjust
return $game_temp.no_active_battler ? Atb_Speed * 3.0 : Atb_Speed
end
#--------------------------------------------------------------------------
# * Final damage setting
# user : user
# action : action
#--------------------------------------------------------------------------
alias set_damage_atb set_damage
def set_damage(user, action = nil)
set_damage_atb(user, action)
set_cast_cancel(user, action)
set_freeze_action(user, action)
set_delay_action(user, action)
end
#--------------------------------------------------------------------------
# * Set cast cancel action
# user : user
# action : action
#--------------------------------------------------------------------------
def set_cast_cancel(user, action)
if action != nil and Cast_Cancel[action.type_name] != nil and
Cast_Cancel[action.type_name][action.id] != nil
cancel_cast(user, Cast_Cancel[action.type_name][action.id], action)
if action.type_name == 'Skill' and not action.magic?
for weapon in weapons
cancel_cast(user, Cast_Cancel['Weapon'][weapon.id], action)
end
end
else
cancel_cast(user, Base_Cast_Cancel, action)
end
end
#--------------------------------------------------------------------------
# * Set ATB freeze action
# user : user
# action : action
#--------------------------------------------------------------------------
def set_freeze_action(user, action)
if action != nil and ATB_Freeze[action.type_name] != nil and
ATB_Freeze[action.type_name][action.id] != nil
freeze_action(user, ATB_Freeze[action.type_name][action.id], action)
if action.type_name == 'Skill' and not action.magic?
for weapon in weapons
freeze_action(user, ATB_Freeze['Weapon'][weapon.id], action)
end
end
else
freeze_action(user, Base_ATB_Freeze, action)
end
end
#--------------------------------------------------------------------------
# * Set ATB delay action
# user : user
# action : action
#--------------------------------------------------------------------------
def set_delay_action(user, action)
if action != nil and ATB_Delay[action.type_name] != nil and
ATB_Delay[action.type_name][action.id] != nil
delay_action(user, ATB_Delay[action.type_name][action.id], action)
if action.type_name == 'Skill' and not action.magic?
for weapon in weapons
delay_action(user, ATB_Delay['Weapon'][weapon.id], action)
end
end
else
delay_action(user, Base_ATB_Delay, action)
end
end
#--------------------------------------------------------------------------
# * No freeze flag
# user : user
# action : action
#--------------------------------------------------------------------------
def cant_cancel(user, action)
return true if check_include(action, "NODAMAGE")
return true if not user.target_damage[self].numeric?
return true if user.target_damage[self] < 0
return false
end
#--------------------------------------------------------------------------
# * Set cast cancel
# user : user
# cast : cancel chance
# action : action
#--------------------------------------------------------------------------
def cancel_cast(user, cast, action)
return if cant_cancel(user, action)
rate = cast + (cast * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
if rate > rand(100) and self.cast_action != nil
self.cast_action = nil
self.atb = 0
end
end
#--------------------------------------------------------------------------
# * Set ATB freeze
# user : user
# delay : delay value
# action : action
#--------------------------------------------------------------------------
def freeze_action(user, delay, action)
return if cant_cancel(user, action)
rate = delay + (delay * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
self.atb_delay += rate.to_i
end
#--------------------------------------------------------------------------
# * Set ATB delay
# user : user
# delay : delay value
# action : action
#--------------------------------------------------------------------------
def delay_action(user, delay, action)
return if cant_cancel(user, action)
rate = delay + (delay * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
self.atb -= rate.to_i
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
# * Decide if Command is Inputable
#--------------------------------------------------------------------------
def inputable?
return (self.atb_full? and super)
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Decide if Action is Possible
#--------------------------------------------------------------------------
def movable?
return (self.atb_full? and super)
end
#--------------------------------------------------------------------------
# * Get Battle Turn
#--------------------------------------------------------------------------
def get_battle_turn
return @turn_count
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias anim_face_initialize initialize
def initialize
@atb_meters = ATB_Meters.new if Meters
@enm_meters = Enemy_Meters.new if Enemy_Meter > 0
@atb_bars = ATB_Bars.new if Bars
@alive_enemies = enemies_alive
@old_party = $game_party.actors
anim_face_initialize
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias atb_battle_status_refresh refresh
def refresh
atb_battle_status_refresh
active_time_update
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
alias visible_atb visible=
def visible=(n)
visible_atb(n)
need_reset
@atb_meters.visible = n if Hide_Meters and @atb_meters != nil
@atb_bars.visible = n if Hide_Bars and @atb_bars != nil
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias atb_battle_status_dispose dispose
def dispose
atb_battle_status_dispose
@atb_meters.dispose if @atb_meters != nil
@enm_meters.dispose if @enm_meters != nil
@atb_bars.dispose if @atb_bars != nil
end
#--------------------------------------------------------------------------
# * Time bar update
#--------------------------------------------------------------------------
def active_time_update
need_reset
@atb_meters.refresh if @atb_meters != nil
@enm_meters.refresh if @enm_meters != nil
@atb_bars.refresh if @atb_bars != nil
end
#--------------------------------------------------------------------------
# * Check if bars need reset
#--------------------------------------------------------------------------
def need_reset
if (@alive_enemies != enemies_alive) or (@old_party != $game_party.actors)
@alive_enemies = enemies_alive
@old_party = $game_party.actors
reset_bars
end
end
#--------------------------------------------------------------------------
# * Get number of alive enemies
#--------------------------------------------------------------------------
def enemies_alive
alive = 0
for i in 0...$game_troop.enemies.size
alive += 1 unless $game_troop.enemies[i].dead?
end
return alive
end
#--------------------------------------------------------------------------
# * Reset time bars
#--------------------------------------------------------------------------
def reset_bars
@atb_meters.dispose if @atb_meters != nil
@enm_meters.dispose if @enm_meters != nil
@atb_bars.dispose if @atb_bars != nil
@atb_meters = ATB_Meters.new if Meters
@enm_meters = Enemy_Meters.new if Enemy_Meter > 0
@atb_bars = ATB_Bars.new if Bars
end
end
#==============================================================================
# ** ATB_Meters
#------------------------------------------------------------------------------
# Class that shows the time meters of actors
#==============================================================================
class ATB_Meters
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :meters
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@meters = []
@skin = RPG::Cache.windowskin(Meter_Skin)
i = 0
for actor in $game_party.actors
@meter = MeterSprite.new(@skin, 5)
refresh_meter(i)
i += 1
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
i = 0
for actor in $game_party.actors
@meters[i].line = actor.atb_linetype
@meters[i].amount = actor.atb_lineamount
@meters[i].refresh
@meters[i].atb_visible = true
i += 1
end
end
#--------------------------------------------------------------------------
# * Update meter
# index : index
#--------------------------------------------------------------------------
def refresh_meter(index)
actor = $game_party.actors[index]
case Meter_Pos_Style
when 0
@meter.x = index * (624 / Max_Party) + 4 + X_Meter
@meter.y = Y_Meter
@meter.z = 1000
when 1
@meter.x = X_Meter + ((624 / Max_Party) * ((4 - $game_party.actors.size)/2.0 + index)).floor
@meter.y = Y_Meter
@meter.z = 1000
when 2
@meter.x = X_Meter
@meter.y = index * 32 + Y_Meter
@meter.z = 1000
when 3
@meter.x = actor.base_x - @skin.width / 2
@meter.y = actor.base_y - @skin.height / 5
@meter.z = 100
when 4
@meter.x = actor.base_x - @skin.width / 2
@meter.y = actor.base_y - @skin.height / 5 - 64
@meter.z = 2500
when 5
base = Meter_Position[index]
@meter.x = base[0]
@meter.y = base[1]
@meter.z = 2500
end
@meters[index] = @meter
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
def visible=(n)
@meters.each{|sprite| sprite.visible = n }
end
#--------------------------------------------------------------------------
# * Window opacity
# n : opacity
#--------------------------------------------------------------------------
def opacity=(n)
@meters.each{|sprite| sprite.opacity = n }
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@meters.each{|sprite| sprite.dispose }
end
end
#==============================================================================
# ** Enemy_Meters
#------------------------------------------------------------------------------
# Class that shows the time meters of enemies
#==============================================================================
class Enemy_Meters
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :meters
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@meters = []
@skin = RPG::Cache.windowskin(Meter_Skin)
i = 0
for enemy in $game_troop.enemies
next if enemy.dead? and not [1,2].include?(Enemy_Meter)
@meter = MeterSprite.new(@skin, 5)
refresh_meter(i)
i += 1
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
i = 0
for enemy in $game_troop.enemies
next if enemy.dead? and not [1,2].include?(Enemy_Meter)
@meters[i].line = enemy.atb_linetype
@meters[i].amount = enemy.atb_lineamount
@meters[i].refresh
@meters[i].atb_visible = (enemy.dead? and [1,2].include?(Enemy_Meter)) ? false : true
@meters[i].visible = (enemy.dead? and [1,2].include?(Enemy_Meter)) ? false : true
i += 1
end
end
#--------------------------------------------------------------------------
# * Update meter
# index : index
#--------------------------------------------------------------------------
def refresh_meter(index)
enemy = $game_troop.enemies[index]
case Enemy_Meter
when 1
@meter.x = enemy.base_x - @skin.width / 2
@meter.y = enemy.base_y - @skin.height / 5
@meter.z = 100
when 2
@meter.x = enemy.base_x - @skin.width / 2
@meter.y = enemy.base_y - @skin.height / 5 - 64
@meter.z = 1000
when 3
@meter.x = 32
@meter.y = 80 + index * 32
@meter.z = 3000
end
@meters[index] = @meter
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
def visible=(n)
@meters.each{|sprite| sprite.visible = n }
end
#--------------------------------------------------------------------------
# * Window opacity
# n : opacity
#--------------------------------------------------------------------------
def opacity=(n)
@meters.each{|sprite| sprite.opacity = n }
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@meters.each{|sprite| sprite.dispose }
end
end
#==============================================================================
# ** Escape_Meters
#------------------------------------------------------------------------------
# Class that shows the escape meters
#==============================================================================
class Escape_Meters
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@skin = RPG::Cache.windowskin(Escape_Skin)
@escape_meter = MeterSprite.new(@skin, 3)
refresh_meter
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@escape_meter.line = $game_temp.escape_atb_linetype
@escape_meter.amount = $game_temp.escape_atb_lineamount
@escape_meter.z = 5000
@escape_meter.refresh
end
#--------------------------------------------------------------------------
# * Update meter
#--------------------------------------------------------------------------
def refresh_meter
case Escape_Meter_Pos_Type
when 0
@escape_meter.x = 608 - @skin.width
@escape_meter.y = 95
when 1
@escape_meter.x = 320 - skin.width
@escape_meter.y = 64
when 2
@escape_meter.x = Escape_Meter_Position[0]
@escape_meter.y = Escape_Meter_Position[1]
end
@escape_meter.z = 5000
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
def visible=(n)
@escape_meter.visible = n
end
#--------------------------------------------------------------------------
# * Window opacity
# n : opacity
#--------------------------------------------------------------------------
def opacity=(n)
@escape_meter.opacity = n
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@escape_meter.dispose
end
end
#==============================================================================
# ** MeterSprite
#------------------------------------------------------------------------------
# Class that draws all bars
#==============================================================================
class MeterSprite < Sprite
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :line
attr_accessor :amount
#--------------------------------------------------------------------------
# * Object Initialization
# skin : bar bitmap
# line_number : line number
#--------------------------------------------------------------------------
def initialize(skin, line_number)
@line_number = line_number
@skin = skin
@width = @skin.width
@height = @skin.height / @line_number
@line = 1
@amount = 0
@atb_visible = false
@base_sprite.dispose if @base_sprite != nil
@base_sprite = Sprite.new
@base_sprite.bitmap = @skin
@base_sprite.src_rect.set(0, 0, @width, @height)
super()
self.bitmap = @skin
self.line = 1
self.opacity = 0 if @line_number == 3
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
def visible=(n)
@base_sprite.visible = n
super
end
#--------------------------------------------------------------------------
# * Window opacity
# n : opacity
#--------------------------------------------------------------------------
def opacity=(n)
@base_sprite.opacity = n
super
end
#--------------------------------------------------------------------------
# * ATB visibility flag
# n : visibility flag
#--------------------------------------------------------------------------
def atb_visible=(n)
@atb_visible = n
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
end
#--------------------------------------------------------------------------
# * Sprite X coordinate
# n : new value
#--------------------------------------------------------------------------
def x=(n)
super
@base_sprite.x = n
end
#--------------------------------------------------------------------------
# * Sprite Y coordinate
# n : new value
#--------------------------------------------------------------------------
def y=(n)
super
@base_sprite.y = n
end
#--------------------------------------------------------------------------
# * Sprite Z coordinate
# n : new value
#--------------------------------------------------------------------------
def z=(n)
super
@base_sprite.z = z - 1
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@base_sprite.dispose
super
end
end
#==============================================================================
# ** ATB_Bars
#------------------------------------------------------------------------------
# Class that shows the bar and icons for battle flow
#==============================================================================
class ATB_Bars
#--------------------------------------------------------------------------
# * Include Settings Module
#--------------------------------------------------------------------------
include Atoa
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
def initialize
@base = Sprite.new
@base.bitmap = RPG::Cache.windowskin(Bar_Skin).dup
@base.x = X_Bar + 8
@base.y = Y_Bar
@base.z = 3000
@width = @base.bitmap.width
@height = @base.bitmap.height
@iconset = {}
@base.opacity = self.opacity = 255
refresh
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def refresh
return @base.opacity = self.opacity = 0 unless Bars
need_refresh = []
for battler in $game_party.actors + $game_troop.enemies
update_icon = false
update_icon |= !@iconset.keys.include?(battler)
for key in @iconset.keys
update_icon |= @iconset[key].last != battler.battler_name
end
need_refresh << battler if update_icon
end
for battler in need_refresh
@iconset[battler] = [Sprite.new, battler.battler_name] if @iconset[battler].nil?
iconname = nil
if battler.is_a?(Game_Actor)
iconname = Party_Icon[battler.battler_name]
else
iconname = Enemy_Icon[battler.battler_name]
end
if iconname.nil?
if battler.is_a?(Game_Actor)
iconname = Default_Party_Icon
else
iconname = Default_Enemy_Icon
end
end
@iconset[battler].first.bitmap = RPG::Cache.icon(iconname).dup
@iconset[battler].first.y = Y_Bar + @height / 2 - 12
end
icons_update
self.visible = $game_temp.hide_windows ? false : true
end
#--------------------------------------------------------------------------
# * Update Icons
#--------------------------------------------------------------------------
def icons_update
for battler in @iconset.keys
unless ($game_party.actors + $game_troop.enemies).include?(battler)
@iconset[battler].first.dispose
@iconset[battler] = nil
@iconset.delete(battler)
next
end
icon = @iconset[battler]
wid = @width - 12
if Dual_Bars > 0
if battler.cast_action != nil
bar1 = (100 - Dual_Bars) * wid / 100.0
bar2 = Dual_Bars * wid / 100.0
icon.first.x = X_Bar + bar1 + (bar2 * battler.atb / battler.max_atb)
else
bar1 = (100 - Dual_Bars) * wid / 100
icon.first.x = X_Bar + (bar1 * battler.atb / battler.max_atb)
end
else
icon.first.x = X_Bar + wid * battler.atb / battler.max_atb
end
icon.first.x = X_Bar + wid if (battler.active? or battler.action?) and
battler.cast_action.nil?
icon.first.z = 3001 + icon.first.x
icon.first.visible = battler.exist?
icon.first.opacity = battler.exist? ? 255 : 0
end
end
#--------------------------------------------------------------------------
# * Window visibility
# n : opacity
#--------------------------------------------------------------------------
def visible=(n)
@base.visible = n
for icon in @iconset.values
icon.first.visible = n
end
end
#--------------------------------------------------------------------------
# * Window opacity
# n : opacity
#--------------------------------------------------------------------------
def opacity=(n)
@base.opacity = n
for icon in @iconset.values
icon.first.opacity = n
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@base.dispose
for icon in @iconset.values
icon.first.dispose
end
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Force Action
#--------------------------------------------------------------------------
def command_339
return true unless $game_temp.in_battle
iterate_battler(@parameters[0], @parameters[1]) do |battler|
if battler.exist?
battler.current_action.kind = @parameters[2]
if battler.current_action.kind == 0
battler.current_action.basic = @parameters[3]
else
battler.current_action.skill_id = @parameters[3]
end
if @parameters[4] == -2
if battler.is_a?(Game_Enemy)
battler.current_action.decide_last_target_for_enemy
else
battler.current_action.decide_last_target_for_actor
end
elsif @parameters[4] == -1
if battler.is_a?(Game_Enemy)
battler.current_action.decide_random_target_for_enemy
else
battler.current_action.decide_random_target_for_actor
end
elsif @parameters[4] >= 0
battler.current_action.target_index = @parameters[4]
end
battler.current_action.forcing = true
if battler.current_action.valid? and @parameters[5] == 1
$game_temp.forcing_battler = battler
@index += 1
return false
end
end
end
return true
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :no_active_battler
#--------------------------------------------------------------------------
# * Main Processing
#------------------------------