#================================================= =============================
# +++ MOG XP - Battler L Effects (v1.0) +++
#================================================= =============================
# By Moghunter
#
http://www.atelier-rgss.com/
#================================================= =============================
# 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 = 2
#Definição dos battlers que terão o efeito de respiração
BREATH_EFFECT_ENEMY_ID = [1,5,7,32]
BREATH_EFFECT_ACTOR_ID = [1,7]
#Definição dos battlers que terão o efeito flutuar.
FLOAT_EFFECT_ENEMY_ID = [2,4]
FLOAT_EFFECT_ACTOR_ID = [2]
#Definição dos battlers que terão o efeito movimentar se para os lados.
MOVESIDE_EFFECT_ENEMY_ID = [6,9]
MOVESIDE_EFFECT_ACTOR_ID = [8]
#Condições que cancelam os efeito do sprite. (Exp - Stop / Paralyze)
STATES_CANCEL_EFFECT = [8,50,54,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, force = false)
breath_effect_add_state(state_id, force)
check_breath = false
if self.is_a?(Game_Enemy)
check_breath = true if BREATH_EFFECT_ENEMY_ID.include?(self.id)
check_breath = true if FLOAT_EFFECT_ENEMY_ID.include?(self.id)
check_breath = true if MOVESIDE_EFFECT_ENEMY_ID.include?(self.id)
else
check_breath = true if BREATH_EFFECT_ACTOR_ID.include?(self.id)
check_breath = true if FLOAT_EFFECT_ACTOR_ID.include?(self.id)
check_breath = true if MOVESIDE_EFFECT_ACTOR_ID.include?(self.id)
end
if check_breath
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, force = false)
breath_effect_remove_state(state_id, force)
sce = false
for i in STATES_CANCEL_EFFECT
sce = true if @states.include?(i)
end
if sce == false
if self.is_a?(Game_Enemy)
@breath_effect = true if BREATH_EFFECT_ENEMY_ID.include?(self.id)
@float_effect = true if FLOAT_EFFECT_ENEMY_ID.include?(self.id)
@moveside_effect = true if MOVESIDE_EFFECT_ENEMY_ID.include?(self.id)
else
@breath_effect = true if BREATH_EFFECT_ACTOR_ID.include?(self.id)
@float_effect = true if FLOAT_EFFECT_ACTOR_ID.include?(self.id)
@moveside_effect = true if MOVESIDE_EFFECT_ACTOR_ID.include?(self.id)
end
end
end
end
#================================================= ==============================
# ■ Game_Actor
#================================================= ==============================
class Game_Actor < Game_Battler
include MOG_BATTLER_L_EFFECTS
attr_accessor :breath_effect
attr_accessor :float_effect
attr_accessor :moveside_effect
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias breath_effect_setup setup
def setup(actor_id)
@breath_effect = true if BREATH_EFFECT_ACTOR_ID.include?(actor_id)
@float_effect = true if FLOAT_EFFECT_ACTOR_ID.include?(actor_id)
@moveside_effect = true if MOVESIDE_EFFECT_ACTOR_ID.include?(actor_id)
breath_effect_setup(actor_id)
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(troop_id, member_index)
breath_effect_initialize(troop_id, member_index)
@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 < RPG::Sprite
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
update_breath_effect
update_float_effect
update_move_side_effect
end
#--------------------------------------------------------------------------
# ● Update Moveside Effect
#--------------------------------------------------------------------------
def update_move_side_effect
return if @battler == nil
return unless @battler.moveside_effect
return if @_collapse_duration > 0
@moveside_speed += 1
return if @moveside_speed < 3
@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
return if @_collapse_duration > 0
@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
return if @_collapse_duration > 0
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_rgss_battler_l_effects = true
Социальные закладки