#==============================================================================
# +++ MOG - Ayesha AT Gauge (ver 1.6) +++
#==============================================================================
# By Moghunter
# [url=http://www.atelier-rgss.com]http://www.atelier-rgss.com[/url]
#==============================================================================
# Adiciona um medidor animado de AT, incluindo os ícones dos respectivos
# battlers.
#==============================================================================
# Arquivos necessários.
#
# ATB_Layout.png
# ATB_Enemy.png
# ATB_Actor.png
#
# Coloque as imagens na pasta
#
# /Graphics/Ayesha_ATB/
#
#==============================================================================
# Opcional - Ícones específicos dos battlers.
#==============================================================================
# Nomeie os arquivos das seguinte forma.
#
# Actor_ + ID.png
# Enemy_ + ID.png
#
#==============================================================================
# Compatível com :
#
# - MOG ATB System (v 1.0)
# - Victor's Active Time Battle (1.05)
# - C Winter's Active Time Battle (1.62)
#
#==============================================================================
# Histórico
#==============================================================================
# v1.6 - Correção de não apresentar o ícone ao reviver o battler inimigo.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_ayesha_at_gauge] = true
module AYESHA_ATB_GAUGE
#Definição do tipo de medidor. (Nota - A imagem original deve ser na vertical)
# 0 - Vertical / 1 - Horizontal
GAUGE_TYPE = 1
#Posição geral do medidor
LAYOUT_POS = [560,0]
#Posição do Ícones dos battlers.
POINT_POS = [2,50]
#Posição do Ícone quando o battler estiver ativo.
CENTER_POS = [11,9]
#Tamanho do medidor. [Altura e largura]
GAUGE_SIZE = [170,31]
#Posição Z do sprite.
SPRITE_Z = 51
#Definir a posição z do sprite baseado na altura.
Z_FIX = false
end
#==============================================================================
# ■ Cache
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# * Hud
#--------------------------------------------------------------------------
def self.ayesha_atb(filename)
load_bitmap("Graphics/Ayesha_ATB/", filename)
end
end
#==============================================================================
# ■ Game BattlerBase
#==============================================================================
class Game_BattlerBase
attr_accessor :hidden
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :ay_gauge_data
attr_accessor :battle_end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_ayesha_gauge_initialize initialize
def initialize
@ay_gauge_data = [false,false,[0,0]] ; @battle_end = false
mog_ayesha_gauge_initialize
end
end
#==============================================================================
# ■ Game System
#==============================================================================
class Game_System
attr_accessor :ay_gauge_type
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_ayesha_gauge_sys_initialize initialize
def initialize
@ay_gauge_type = AYESHA_ATB_GAUGE::GAUGE_TYPE
mog_ayesha_gauge_sys_initialize
end
end
#===============================================================================
# ■ Spriteset_Battle
#===============================================================================
class Spriteset_Battle
include AYESHA_ATB_GAUGE
#--------------------------------------------------------------------------
# ● Update Battle Start
#--------------------------------------------------------------------------
alias mog_ayesha_atb_initialize initialize
def initialize
mog_ayesha_atb_initialize
create_ayesha_atb
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_ayesha_atb_dispose dispose
def dispose
dispose_ayesha_atb
mog_ayesha_atb_dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_ayesha_atb_update update
def update
mog_ayesha_atb_update
update_ayesha_atb
end
#--------------------------------------------------------------------------
# ● Create Ayesha ATB
#--------------------------------------------------------------------------
def create_ayesha_atb
return if @schala_atb != nil
view = Z_FIX ? @viewport1 : nil
@ayesha_atb = Ayesha_ATB_Gauge.new(view)
end
#--------------------------------------------------------------------------
# ● Dispose ayesha ATB
#--------------------------------------------------------------------------
def dispose_ayesha_atb
return if @ayesha_atb == nil
@ayesha_atb.dispose ; @ayesha_atb = nil
end
#--------------------------------------------------------------------------
# ● Update Schala ATB
#--------------------------------------------------------------------------
def update_ayesha_atb
return if @ayesha_atb == nil
@ayesha_atb.update
end
end
#==============================================================================
# ** Game Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● Command_129
#--------------------------------------------------------------------------
alias mog_ayesha_gauge_command_129 command_129
def command_129
mog_ayesha_gauge_command_129
$game_temp.ay_gauge_data[1] = true if SceneManager.scene_is?(Scene_Battle)
end
#--------------------------------------------------------------------------
# ● Command 335
#--------------------------------------------------------------------------
alias mog_ayesha_at_command_335 command_335
def command_335
mog_ayesha_at_command_335
$game_temp.ay_gauge_data[1] = true if SceneManager.scene_is?(Scene_Battle)
end
end
#==============================================================================
# ■ Ayesha ATB Gauge
#==============================================================================
class Ayesha_ATB_Gauge
include AYESHA_ATB_GAUGE
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil)
$game_temp.ay_gauge_data[0] = false ; @faces = [] ; create_sprites(viewport)
end
#--------------------------------------------------------------------------
# ● Create Sprites
#--------------------------------------------------------------------------
def create_sprites(viewport = nil)
return if $game_party.members.size == 0 or $game_troop.members.size == 0
@layout = Sprite.new ; @layout.bitmap = Cache.ayesha_atb("ATB_Layout")
@layout.z = SPRITE_Z ; @layout.opacity = 0 ; @layout.viewport = viewport
$game_temp.ay_gauge_data[2] = [@layout.bitmap.width, @layout.height]
@layout.x = LAYOUT_POS[0] + @layout.ox
@layout.y = LAYOUT_POS[1] + @layout.oy
(@layout.angle = 270 ; @layout.x += @layout.bitmap.width) if $game_system.ay_gauge_type == 1
battlers.each do |i| @faces.push(Ayesha_Sprite_Icon.new(viewport,i)) end
end
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def battlers
return $game_troop.members + $game_party.battle_members
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
@faces.each {|sprite| sprite.dipose_schala_point }
return if @layout == nil
@layout.bitmap.dispose ; @layout.dispose ; @layout = nil
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
return if @layout == nil
@faces.each {|sprite| sprite.update_schala_point }
@layout.opacity += !sprite_visible? ? - 10 : 10
@layout.visible = !$game_message.visible
refresh_ayesha_gauge if $game_temp.ay_gauge_data[1]
end
#--------------------------------------------------------------------------
# ● Sprite Visible
#--------------------------------------------------------------------------
def sprite_visible?
return false if $game_temp.ay_gauge_data[0]
return false if $game_message.visible
return false if $game_temp.battle_end
return true
end
#--------------------------------------------------------------------------
# ● Refresh Ayesha Gauge
#--------------------------------------------------------------------------
def refresh_ayesha_gauge
$game_temp.ay_gauge_data[1] = false ; dispose ; create_sprites(nil)
end
end
#=============================================================================
# ■ Ayesha Sprite Icon
#==============================================================================
class Ayesha_Sprite_Icon < Sprite
include AYESHA_ATB_GAUGE
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil,battler)
super(viewport)
@target = battler ; @gauge_size = GAUGE_SIZE[0]
return if @target == nil
create_bitmap
self.ox = @cw / 2 ; self.oy = @ch / 2 ; self.x = 0 ; self.y = 0
self.z = @sz ; self.opacity = 0 ; @pos_y = 0
@gy = $game_temp.ay_gauge_data[2][0] - self.oy
if $game_system.ay_gauge_type == 1
@x2 = self.ox + LAYOUT_POS[0] + POINT_POS[0] - (@gauge_size + 5)
@y2 = self.oy + LAYOUT_POS[1] + POINT_POS[1] - @gy
@y2 += GAUGE_SIZE[1] if @target.is_a?(Game_Enemy)
else
@x2 = self.ox + LAYOUT_POS[0] + POINT_POS[0]
@y2 = self.oy + LAYOUT_POS[1] + POINT_POS[1] + @gauge_size
@x2 += GAUGE_SIZE[1] if @target.is_a?(Game_Enemy)
end
@x = 0 ; @y = 0 ; @cast_time = [false,0] ; @wait_fade = 2
@center = [LAYOUT_POS[0] + self.ox + 11,LAYOUT_POS[1] + self.oy + 9]
catb = ATB::MAX_AP rescue nil ; @ccwinter_atb = true if catb != nil
@atb = actor_at ; create_charge
end
#--------------------------------------------------------------------------
# ● Create Charge
#--------------------------------------------------------------------------
def create_charge
@charge = Sprite.new ; @charge.bitmap = Cache.ayesha_atb("Cast") rescue nil
update_charge
end
#--------------------------------------------------------------------------
# ● Update Charge
#--------------------------------------------------------------------------
def update_charge
@charge.z = self.z ; @charge.x = self.x ; @charge.y = self.y
@charge.opacity = self.opacity
end
#--------------------------------------------------------------------------
# ● Create Bitmap
#--------------------------------------------------------------------------
def create_bitmap
@face_index = [0,0] ; @s_bitmap = []
b_nm = @target.is_a?(Game_Actor) ? "Actor" : "Enemy"
b_id = @target.is_a?(Game_Actor) ? @target.id : @target.enemy_id
@s_bitmap.push(Cache.ayesha_atb(b_nm.to_s + "_" + b_id.to_s)) rescue nil
@s_bitmap.push(Cache.ayesha_atb(b_nm.to_s + "_ATB")) if @s_bitmap[0] == nil rescue nil
@s_bitmap[0] = Bitmap.new(32,32) if @s_bitmap[0] == nil
@s_bitmap.push(Cache.ayesha_atb(b_nm.to_s + "_" + b_id.to_s + "B")) rescue nil
@cw = @s_bitmap[0].width ; @ch = @s_bitmap[0].height ; @sz = SPRITE_Z + 1
self.bitmap = @s_bitmap[0] ; refresh_bitmap
end
#--------------------------------------------------------------------------
# ● Refresh Bitmap
#--------------------------------------------------------------------------
def refresh_bitmap
@face_index[1] = @face_index[0] ; self.bitmap = @s_bitmap[@face_index[0]]
self.zoom_x = 1.00
@center = [LAYOUT_POS[0] + self.ox + CENTER_POS[0],LAYOUT_POS[1] + self.oy + CENTER_POS[1]]
if self.bitmap == nil
self.bitmap = @s_bitmap[0] ; self.zoom_x = 1.4
@center = [LAYOUT_POS[0] + self.ox + CENTER_POS[0] + 6,LAYOUT_POS[1] + self.oy + CENTER_POS[1] + 7]
end
end
#--------------------------------------------------------------------------
# ● Dispose Schala Point
#--------------------------------------------------------------------------
def dipose_schala_point
return if self.bitmap == nil or self.bitmap.disposed?
self.bitmap.dispose ; self.bitmap = nil ; dispose_charge
end
#--------------------------------------------------------------------------
# ● Dispose Charge
#--------------------------------------------------------------------------
def dispose_charge
@charge.bitmap.dispose if @charge.bitmap != nil
@charge.dispose
end
#--------------------------------------------------------------------------
# ● Update Schala Point
#--------------------------------------------------------------------------
def update_schala_point
return if self.bitmap == nil or self.bitmap.disposed? or !self.visible
if can_update_atb?
self.opacity += 10 unless @wait_fade > 0; update_atb
else
self.opacity -= 10 # ; check_all_dead? if self.opacity == 0
self.zoom_x = 1.00 ; @cast_time[0] = false ; @wait_fade = 2
end
execute_move(0,self.x,@x) ; execute_move(1,self.y,@y)
self.zoom_y = self.zoom_x ; self.opacity = 0 if sprite_visible?
update_charge ; @wait_fade -= 1 if @wait_fade > 0
end
#--------------------------------------------------------------------------
# ● Sprite Visible
#--------------------------------------------------------------------------
def sprite_visible?
return true if $game_message.visible
return true if $game_temp.battle_end
return false
end
#--------------------------------------------------------------------------
# ● Check All Dead?
#--------------------------------------------------------------------------
def check_all_dead?
return if !@target.is_a?(Game_Enemy)
self.visible = false ; $game_temp.ay_gauge_data[0] = true
$game_troop.members.each {|b| $game_temp.ay_gauge_data[0] = false if !b.dead?}
end
#--------------------------------------------------------------------------
# ● Can Update ATB
#--------------------------------------------------------------------------
def can_update_atb?
return false if @target == nil or @target.dead? or @target.hidden
return false if $game_temp.ay_gauge_data[0]
return true
end
#--------------------------------------------------------------------------
# ● Update ATB
#--------------------------------------------------------------------------
def update_atb
update_atb_type
if atb_max?
@x = @center[0]; @y = @center[1] ; @face_index[0] = 1
else
if $game_system.ay_gauge_type == 1
if actor_cast?
@x = @x2 + gauge_cast - (@gauge_size * @atb / @atb_max) ; @y = @y2
else
@x = @x2 + @gauge_size * @atb / @atb_max ; @y = @y2
end
self.z = @sz + @x if Z_FIX
else
if actor_cast?
@y = @y2 - gauge_cast + (@gauge_size * @atb / @atb_max) ; @x = @x2
else
@y = @y2 - @gauge_size * @atb / @atb_max ; @x = @x2
end
self.z = @sz + (@gauge_size - @y) if Z_FIX
end
@face_index[0] = 0 ; self.zoom_x = 1.00
end
refresh_bitmap if @face_index[0] != @face_index[1]
end
#--------------------------------------------------------------------------
# ● ATB Max
#--------------------------------------------------------------------------
def atb_max?
if @atb.abs >= @atb_max.abs
if $imported[:mog_atb_system]
return true if BattleManager.battler_in_turn?(@target)
else
return true
end
end
return true if @cast_time[1] > 0
return false
end
#--------------------------------------------------------------------------
# ● Update ATB Type
#--------------------------------------------------------------------------
def update_atb_type
if actor_cast?
@atb_max = actor_max_cast ; @atb = actor_cast ; @cast_time = [true,0]
@charge.visible = true
else
@atb_max = actor_max_at ; @atb = actor_at
@cast_time[1] = cast_wait_time if @cast_time[0] ; @cast_time[1] -= 1 if @cast_time[1] > 0
@cast_time[0] = false ; @charge.visible = false unless @cast_time[1] > 55
end
@atb_max = 1 if @atb_max == 0
end
#--------------------------------------------------------------------------
# ● Execute Move
#--------------------------------------------------------------------------
def execute_move(type,cp,np)
sp = 5 + ((cp - np).abs / 20)
if cp > np
cp -= sp ; cp = np if cp < np
elsif cp < np
cp += sp ; cp = np if cp > np
end
self.x = cp if type == 0 ; self.y = cp if type == 1
end
#--------------------------------------------------------------------------
# * AT
#--------------------------------------------------------------------------
def actor_at
return @target.atb if $imported[:mog_atb_system]
return @target.atb if $imported[:ve_active_time_battle]
return @target.catb_value if $imported["YSA-CATB"]
return @target.ap if @ccwinter_atb != nil
return 0
end
#--------------------------------------------------------------------------
# * Max AT
#--------------------------------------------------------------------------
def actor_max_at
return @target.atb_max if $imported[:mog_atb_system]
return @target.max_atb if $imported[:ve_active_time_battle]
return @target.max_atb if $imported["YSA-CATB"]
return ATB::MAX_AP if @ccwinter_atb != nil
return 1
end
#--------------------------------------------------------------------------
# ● Actor Cast
#--------------------------------------------------------------------------
def actor_cast
return @target.atb_cast[1] rescue nil if $imported[:mog_atb_system]
return [url=mailto:-@target.atb]-@target.atb[/url] if $imported[:ve_active_time_battle]
return @target.chant_count rescue 0 if @ccwinter_atb != nil
return 0
end
#--------------------------------------------------------------------------
# ● Actor Max Cast
#--------------------------------------------------------------------------
def actor_max_cast
if $imported[:mog_atb_system]
return @target.atb_cast[2] if @target.atb_cast[2] != 0
return @target.atb_cast[0].speed.abs
end
return @target.max_atb if $imported[:ve_active_time_battle]
return [url=mailto:-@target.max_chant_count]-@target.max_chant_count[/url] rescue 1 if @ccwinter_atb != nil
return 1
end
#--------------------------------------------------------------------------
# ● Actor Max Cast
#--------------------------------------------------------------------------
def gauge_cast
return @gauge_size if $imported[:mog_atb_system]
return 0
end
#--------------------------------------------------------------------------
# ● Actor Cast?
#--------------------------------------------------------------------------
def actor_cast?
if $imported[:mog_atb_system]
return true if !@target.atb_cast.empty? rescue false
end
if $imported[:ve_active_time_battle]
return true if @target.cast_action? rescue false
end
if @ccwinter_atb
return true if @target.chanting? rescue false
end
return false
end
#--------------------------------------------------------------------------
# ● Cast Wait Time
#--------------------------------------------------------------------------
def cast_wait_time
return 10 if @ccwinter_atb
return 60
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
attr_accessor :chant_count
attr_accessor :max_chant_count
end