#==============================================================================
# +++ MOG VX - Battler L Effects (v1.0) +++
#==============================================================================
# By Moghunter
# [url]http://www.atelier-rgss.com/[/url] 把静态战斗图做出动态的效果
#==============================================================================
# Adiciona alguns efeitos de animação no sprite do Battler.
# - Efeito de respirar.
# - Efeito de flutuar.
# - Efeito de mover-se para os lados.
#==============================================================================
module MOG_BATTLER_L_EFFECTS
#Velocidade da respiração(de 1 a 9)
BREATH_SPEED = 1
#Definição dos inimigos que terão o efeito de respiração
#呼吸式动作
BREATH_EFFECT_ENEMY_ID = [1,2,4,5,7,24,28]
#Definição dos battlers que terão o efeito flutuar.
#上下小幅度移动
FLOAT_EFFECT_ENEMY_ID = [1]
#Definição dos battlers que terão o efeito movimentar se para os lados.
#左右小幅度移动
MOVESIDE_EFFECT_ENEMY_ID = [26]
#Condições que cancelam os efeito do sprite. (Exp - Stop / Paralyze)
#打不到???
STATES_CANCEL_EFFECT = [60]
end
#===============================================================================
# ■ Game_Battler
#===============================================================================
class Game_Battler
include MOG_BATTLER_L_EFFECTS
#--------------------------------------------------------------------------
# ● Add State
#--------------------------------------------------------------------------
alias breath_effect_add_state add_state
def add_state(state_id)
breath_effect_add_state(state_id)
if self.is_a?(Game_Enemy)
for i in STATES_CANCEL_EFFECT
if @states.include?(i)
@breath_effect = false
@float_effect = false
@moveside_effect = false
end
end
end
end
#--------------------------------------------------------------------------
# ● Remove_State
#--------------------------------------------------------------------------
alias breath_effect_remove_state remove_state
def remove_state(state_id)
breath_effect_remove_state(state_id)
if self.is_a?(Game_Enemy)
sce = false
for i in STATES_CANCEL_EFFECT
sce = true if @states.include?(i)
end
if sce == false
@breath_effect = true if BREATH_EFFECT_ENEMY_ID.include?(@enemy_id)
@float_effect = true if FLOAT_EFFECT_ENEMY_ID.include?(@enemy_id)
@moveside_effect = true if MOVESIDE_EFFECT_ENEMY_ID.include?(@enemy_id)
end
end
end
end
#===============================================================================
# ■ Game_Enemy
#===============================================================================
class Game_Enemy < Game_Battler
include MOG_BATTLER_L_EFFECTS
attr_accessor :breath_effect
attr_accessor :float_effect
attr_accessor :moveside_effect
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias breath_effect_initialize initialize
def initialize(index, enemy_id)
breath_effect_initialize(index, enemy_id)
@breath_effect = false
@float_effect = false
@moveside_effect = false
@breath_effect = true if BREATH_EFFECT_ENEMY_ID.include?(@enemy_id)
@float_effect = true if FLOAT_EFFECT_ENEMY_ID.include?(@enemy_id)
@moveside_effect = true if MOVESIDE_EFFECT_ENEMY_ID.include?(@enemy_id)
end
end
#===============================================================================
# ■ Sprite_Battler
#===============================================================================
class Sprite_Battler < Sprite_Base
include MOG_BATTLER_L_EFFECTS
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias breath_effect_initialize initialize
def initialize(viewport, battler = nil)
breath_effect_initialize(viewport, battler )
breath_effect_setup(battler)
float_effect_setup(battler)
modeside_effect_setup(battler)
end
#--------------------------------------------------------------------------
# ● Moveside Effect
#--------------------------------------------------------------------------
def modeside_effect_setup(battler)
@moveside_duration = rand(30)
@moveside_speed = 0
end
#--------------------------------------------------------------------------
# ● Float Effect Setup
#--------------------------------------------------------------------------
def float_effect_setup(battler)
@float_duration = rand(40)
@float_speed = rand(3)
end
#--------------------------------------------------------------------------
# ● Breath Effect Setup
#--------------------------------------------------------------------------
def breath_effect_setup(battler)
@breath_phase = 0
@breath_effect = false
@breath_effect_speed = 0
if @battler.is_a?(Game_Enemy) and @battler.breath_effect
initial_breath = 1.00 + (@battler.screen_x * 0.001) - (@battler.screen_y * 0.001)
initial_breath = 1.1 if initial_breath > 1.1
initial_breath = 0.9 if initial_breath < 0.9
self.zoom_y = initial_breath
ex_speed = [[BREATH_SPEED, 1].max, 9].min
speed = ex_speed * 0.001
@breath_effect_speed = speed + (rand(99) * 0.00001)
end
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias breath_effect_update update
def update
breath_effect_update
if @battler.is_a?(Game_Enemy)
update_breath_effect
update_float_effect
update_move_side_effect
end
end
#--------------------------------------------------------------------------
# ● Update Moveside Effect
#--------------------------------------------------------------------------
def update_move_side_effect
return if @battler == nil
return unless @battler.moveside_effect
@moveside_speed += 1
return if @moveside_speed < 4
@moveside_speed = 0
@moveside_duration += 1
case @moveside_duration
when 0..10
self.ox += 2
when 11..15
self.ox += 1
when 16..25
self.ox -= 2
when 26..30
self.ox -= 1
else
@moveside_duration = 0
end
end
#--------------------------------------------------------------------------
# ● Update Float Effect
#--------------------------------------------------------------------------
def update_float_effect
return if @battler == nil
return unless @battler.float_effect
@float_speed += 1
return if @float_speed < 2
@float_speed = 0
@float_duration += 1
case @float_duration
when 0..15
self.oy += 2
when 16..20
self.oy += 1
when 21..35
self.oy -= 2
when 36..40
self.oy -= 1
else
@float_duration = 0
end
end
#--------------------------------------------------------------------------
# ● Update Breaht Effect
#--------------------------------------------------------------------------
def update_breath_effect
return if @battler == nil
return unless @battler.breath_effect
if @breath_effect_speed == 0
ex_speed = [[BREATH_SPEED, 1].max, 9].min
speed = ex_speed * 0.001
@breath_effect_speed = speed + (rand(99) * 0.00001)
self.zoom_y = 1 + rand(10) * 0.01
end
if @breath_phase == 0
self.zoom_y += @breath_effect_speed
@breath_phase = 1 if self.zoom_y >= 1.05
else
self.zoom_y -= @breath_effect_speed
@breath_phase = 0 if self.zoom_y <= 1.01
end
end
end
$mog_rgss2_battler_l_effects = true