#==============================================================================
# +++ MOG - ACTOR PICTURE CM (v1.1) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Apresenta a imagem do personagem durante a seleção de comandos, com efeitos
# animados.
#==============================================================================
# ● Definindo o nome das imagens dos battlers.
#==============================================================================
# 1 - As imagens devem ser gravadas na pasta
#
# GRAPHICS/PICTURES
#
# 2 - Nomeie os arquivos de imagens da seguinte forma.
#
#
# ACTOR + ID
#
# EG
#
# ACTOR1.png
#
#==============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.1 - Correção do bug de não apagar a imagem quando o battler usa
# ações de que acertam todos os alvos.
#==============================================================================
module MOG_ACTOR_PICTURE_CM
#Posição da imagem do battler. (Para fazer ajustes)
PICTURE_POSITION = [0, 0]
#Definição da opacidade da imagem.
PICTURE_OPACITY = 255
#Velocidade de deslize
SLIDE_SPEED = 30
#Ativar o efeito da imagem respirando.
BREATH_EFFECT = true
#Definição da prioridade da imagem na tela.
PICTURE_PRIORITY_Z = 101
end
#===============================================================================
# ■ Sprite_Battler_CM
#===============================================================================
class Sprite_Battler_CM < Sprite
include MOG_ACTOR_PICTURE_CM
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
super
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
update_slide
end
#--------------------------------------------------------------------------
# ● Active Battler
#--------------------------------------------------------------------------
def active_battler(battler_id)
@active = @battler_id == battler_id ? true : false
self.visible = true if @active
@cm_visible = false if !@active
end
#--------------------------------------------------------------------------
# ● Refresh Battler CM
#--------------------------------------------------------------------------
def refresh_battler(cm_visible, battler_index)
@cm_visible = cm_visible
active_battler(battler_index)
end
#--------------------------------------------------------------------------
# ● Update Slide
#--------------------------------------------------------------------------
def update_slide
if !@cm_visible
self.x -= SLIDE_SPEED if self.x > -@size[0]
self.opacity -= 25
if self.x <= -@size[0] or self.opacity == 0
self.visible = false
self.opacity = 0
self.x = -@size[0]
end
else
self.x += SLIDE_SPEED if self.x < @size[1]
self.x = @size[1] if self.x > @size[1]
self.opacity += 10 if self.opacity < PICTURE_OPACITY
self.opacity = PICTURE_OPACITY if self.opacity > PICTURE_OPACITY
update_breath_effect
end
end
#--------------------------------------------------------------------------
# ● Update Breath Effect
#--------------------------------------------------------------------------
def update_breath_effect
return if !BREATH_EFFECT
@breach_effect[1] += 1
case @breach_effect[1]
when 0..30
@breach_effect[0] += 0.0004
when 31..50
@breach_effect[0] -= 0.0004
else
@breach_effect[1] = 0
@breach_effect[0] = 1.truncate
end
self.zoom_y = @breach_effect[0]
end
end
#===============================================================================
# ■ Spriteset_Battle
#===============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Create Actors
#--------------------------------------------------------------------------
alias mog_battler_cm_create_actors create_actors
def create_actors
mog_battler_cm_create_actors
create_battler_pictures
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battler_cm_dispose dispose
def dispose
mog_battler_cm_dispose
dispose_battler_cm
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battler_cm_update update
def update
mog_battler_cm_update
update_battler_cm
end
#--------------------------------------------------------------------------
# ● Create Battler Pictures
#--------------------------------------------------------------------------
def create_battler_pictures
size = 0
@battler_pictures = []
for i in $game_party.members
@battler_pictures.push(Sprite_Battler_CM.new(@viewport1,i.id))
size += 1
break if size > 3
end
end
#--------------------------------------------------------------------------
# ● Dispose Battler CM
#--------------------------------------------------------------------------
def dispose_battler_cm
return if @battler_pictures == nil
@battler_pictures.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● Update Battler CM
#--------------------------------------------------------------------------
def update_battler_cm
return if @battler_pictures == nil
@battler_pictures.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# ● Update CM Pictures
#--------------------------------------------------------------------------
def update_cm_picture(cm_visible, battler_index)
return if @battler_pictures == nil
@battler_pictures.each {|sprite| sprite.refresh_battler(cm_visible, battler_index) }
end
end
#===============================================================================
# ■ Scene_Battle
#===============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_cm_picture_update update
def update
mog_cm_picture_update
update_picture_visible
end
#--------------------------------------------------------------------------
# ● Update Battler CM Active
#--------------------------------------------------------------------------
def update_picture_visible
return if @actor_command_window == nil
cm_visible = can_cm_picture_visible?
cm_id = BattleManager.actor.id rescue -1
@spriteset.update_cm_picture(cm_visible, cm_id)
end
#--------------------------------------------------------------------------
# ● Can CM Picture Visible
#--------------------------------------------------------------------------
def can_cm_picture_visible?
return false if (@actor_window.active or @enemy_window.active) rescue return
return false if BattleManager.actor == nil
return true
end
#--------------------------------------------------------------------------
# ● Execute Action
#--------------------------------------------------------------------------
alias mog_cm_picture_execute_action execute_action
def execute_action
@spriteset.update_cm_picture(false, -1) if @spriteset != nil
mog_cm_picture_execute_action
end