ERILEX'S PROFILE
Erilex
3452
"This was so bad it SCARred me for life"
#============================================================================== # ** Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # * Frame Update (main phase step 4 : animation for target) #-------------------------------------------------------------------------- def update_phase4_step4 screen_animation = false animation_launched = false if @animation2_id > 0 animation = $data_animations[@animation2_id] screen_animation = animation.position == 3 end # Animation for target for target in @target_battlers target.animation_id = @animation2_id unless screen_animation && animation_launched target.only_flash_animation = false animation_launched = true else target.only_flash_animation = true end target.animation_hit = (target.damage != "Miss") end # Animation has at least 8 frames, regardless of its length @wait_count = 8 # Shift to step 5 @phase4_step = 5 end end #============================================================================== # ** Game_Battler #============================================================================== class Game_Battler attr_accessor :only_flash_animation #-------------------------------------------------------------------------- unless @already_initialised_screen_anim alias initialize_screen_anim initialize @already_initialised_screen_anim = true end #-------------------------------------------------------------------------- def initialize initialize_screen_anim only_flash_animation = false end end #============================================================================== # ** Sprite_Battler #============================================================================== class Sprite_Battler < RPG::Sprite #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # If battler is nil if @battler == nil self.bitmap = nil loop_animation(nil) return end # If file name or hue are different than current ones if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue # Get and set bitmap @battler_name = @battler.battler_name @battler_hue = @battler.battler_hue self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue) @width = bitmap.width @height = bitmap.height self.ox = @width / 2 self.oy = @height # Change opacity level to 0 when dead or hidden if @battler.dead? or @battler.hidden self.opacity = 0 end end # If animation ID is different than current one if @battler.damage == nil and @battler.state_animation_id != @state_animation_id @state_animation_id = @battler.state_animation_id loop_animation($data_animations[@state_animation_id]) end # If actor which should be displayed if @battler.is_a?(Game_Actor) and @battler_visible # Bring opacity level down a bit when not in main phase if $game_temp.battle_main_phase self.opacity += 3 if self.opacity < 255 else self.opacity -= 3 if self.opacity > 207 end end # Blink if @battler.blink blink_on else blink_off end # If invisible unless @battler_visible # Appear if not @battler.hidden and not @battler.dead? and (@battler.damage == nil or @battler.damage_pop) appear @battler_visible = true end end # If visible if @battler_visible # Escape if @battler.hidden $game_system.se_play($data_system.escape_se) escape @battler_visible = false end # White flash if @battler.white_flash whiten @battler.white_flash = false end # Animation if @battler.animation_id != 0 animation = $data_animations[@battler.animation_id] if @battler.only_flash_animation animation_flash(animation, @battler.animation_hit) @battler.only_flash_animation = false else animation(animation, @battler.animation_hit) end @battler.animation_id = 0 end # Damage if @battler.damage_pop damage(@battler.damage, @battler.critical) @battler.damage = nil @battler.critical = false @battler.damage_pop = false end # Collapse if @battler.damage == nil and @battler.dead? if @battler.is_a?(Game_Enemy) $game_system.se_play($data_system.enemy_collapse_se) else $game_system.se_play($data_system.actor_collapse_se) end collapse @battler_visible = false end end # Set sprite coordinates self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end end #============================================================================== # ** RPG::Sprite #============================================================================== module RPG class Sprite < ::Sprite #------------------------------------------------------------------------- unless @already_initialised_screen_anim alias animation_screen_anim animation alias update_animation_screen_anim update_animation @already_initialised_screen_anim = true end #------------------------------------------------------------------------- def animation(animation, hit) @_flash = false animation_screen_anim(animation, hit) end #------------------------------------------------------------------------- def update_animation unless @_flash update_animation_screen_anim else update_animation_flash end end #------------------------------------------------------------------------- def animation_flash(animation, hit) @_flash = true dispose_animation @_animation = animation return if @_animation == nil @_animation_hit = hit @_animation_duration = @_animation.frame_max animation_name = @_animation.animation_name animation_hue = @_animation.animation_hue @_animation_sprites = [] update_animation end #------------------------------------------------------------------------- def update_animation_flash if @_animation_duration > 0 frame_index = @_animation.frame_max - @_animation_duration cell_data = @_animation.frames[frame_index].cell_data position = @_animation.position animation_set_sprites(@_animation_sprites, cell_data, position) for timing in @_animation.timings if timing.frame == frame_index animation_process_timing_flash(timing, @_animation_hit) end end else dispose_animation end end #------------------------------------------------------------------------- def animation_process_timing_flash(timing, hit) if (timing.condition == 0) or (timing.condition == 1 and hit == true) or (timing.condition == 2 and hit == false) case timing.flash_scope when 1 self.flash(timing.flash_color, timing.flash_duration * 2) when 2 if self.viewport != nil self.viewport.flash(timing.flash_color, timing.flash_duration * 2) end when 3 self.flash(nil, timing.flash_duration * 2) end end end end end