- #============================================================================== 
- # Mother3 Visuals 
- # Author Ramiro 
- # Version, 1.3 
- #------------------------------------------------------------------------------ 
- # Shows Mother 3 visual, battle system. 
- #============================================================================== 
-   
- $imported = {} if $imported.nil? 
- $imported['Ramiro-Mother3Visual'] = true 
-   
- module BattleConfig 
-   
-   # tone of the window when dead and when the hp is below 1/4 
-   Window_DeadTone      = Tone.new(200, 0, 0) 
-   Window_CriticalTone  = Tone.new(200, 120, 10) 
-   # Chech if the message window is always on the top of the screen. 
-   AlwaysOnTop          = false 
-   
-   # animations used on magic reflection and counterattack, set to 0 if you 
-   # wish to disable 
-   Reflex_AnimationID        = 0 
-   Counterattack_AnimationID = 0 
-   
-   PanoramicCamera  = false 
-   PanoramicCameraH = 160 
-   
-   DisapearWhenNoSelection = false 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Scene_Base 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   attr_reader :info_viewport 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- module BattleManager 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   class << self 
-     alias ramiro_m3_process_victory process_victory 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def self.phase 
-     return @phase 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def self.process_victory   
-     SceneManager.scene.wait(1) 
-     $game_party.members.each do |i| 
-       i.sprite.battle_show if i.alive? 
-     end 
-     SceneManager.scene.wait(1) 
-     ramiro_m3_process_victory 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ?Game_Message 
- #============================================================================== 
-   
- class Game_Message 
-   
-   alias ramiro_m3_position position 
-   
-   def position 
-     return 0 if BattleConfig::AlwaysOnTop && SceneManager.scene_is?(Scene_Battle) 
-     ramiro_m3_position 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Window_BattleStatusPart < Window_Base 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def initialize(actor_index) 
-     @shake_time = 0 
-     @actor_index = actor_index 
-     @move_time = 0 
-     @x_position = x_at(actor_index) 
-     @x_destination = @x_position 
-     @y_position = 20 
-     @y_destination = 20 
-     super(0, 0, window_width, window_height) 
-     update_screen_position 
-     refresh 
-     hide_actor_quickly 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def x_at(actor_index) 
-     128 + (total_draw_area - window_width * window_count) / 2 + window_width * actor_index 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_tone 
-     if actor.dead? 
-       self.tone.set(BattleConfig::Window_DeadTone) 
-     elsif actor.hp < actor.mhp / 4 
-       self.tone.set(BattleConfig::Window_CriticalTone) 
-     else 
-       super 
-     end 
-   end     
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def total_draw_area 
-     Graphics.width - 128 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def window_count 
-     $game_party.members.size 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def max_window_count 
-     $game_party.max_battle_members 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def window_width 
-     total_draw_area / max_window_count 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def window_height 
-     fitting_height(visible_line_number) - 20 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def screen_x 
-     @x_position 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def screen_y 
-     return @y_position 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def visible_line_number 
-     return 4 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update 
-     super 
-     if @move_time > 0 
-       @x_position = (@x_position * (@move_time - 1) + @x_destination) / @move_time 
-       @y_position = (@y_position * (@move_time - 1) + @y_destination) / @move_time 
-       @move_time -= 1 
-     end   
-     update_screen_position 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def move_to_index(actor_index) 
-     @x_destination = x_at(actor_index) 
-     @move_time = 1 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def return_to_origin 
-     @x_destination = x_at(actor.index) 
-     @y_destination = 20 
-     @move_time = 1     
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def move_down 
-     @y_destination = self.height - line_height - standard_padding 
-     @move_time = 1 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def update_screen_position 
-     self.x = screen_x + shake_amp 
-     self.y = screen_y 
-     self.z = self.y 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------      
-   def shake_amp 
-     if @shake_time > 0 
-       @shake_time -= 1 
-       return @shake_time % 2 * 4 - 2 
-     else 
-       return 0 
-     end   
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def refresh 
-     self.contents.clear 
-     draw_actor_status if actor 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ? 
-   #-------------------------------------------------------------------------- 
-   def line_color 
-     color = normal_color 
-     color.alpha = 48 
-     color 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def draw_horz_line(y) 
-     line_y = y - 1 
-     contents.fill_rect(0, line_y, contents_width - 24, 2, line_color) 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def draw_actor_status 
-     self.contents.font.size = 16 
-     draw_actor_name(actor, 0, 0, contents.width - 24) 
-     draw_horz_line(line_height) 
-     self.contents.font.size = 16 
-     draw_actor_hp(actor, 2, line_height, contents.width - 4) 
-     if $data_system.opt_display_tp 
-       draw_actor_mp(actor, 2, line_height * 2, contents.width / 2 - 6) 
-       draw_actor_tp(actor, 4 + contents.width / 2, line_height * 2, contents.width / 2 - 6) 
-     else 
-       draw_actor_mp(actor, 2, line_height * 2, contents.width - 4) 
-     end   
-     draw_actor_icons(actor, contents.width - 24, 0, 24) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def show_actor 
-     actor.sprite.battle_show 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def hide_actor 
-     actor.sprite.battle_hide 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def hide_actor_quickly 
-     actor.sprite.opacity = 0 
-   end   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def index 
-     @actor_index 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def actor 
-     $game_party.members[@actor_index] 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def shake 
-     @shake_time = 20 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Window_BattleStatusPatner < Window_BattleStatusPart 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   attr_accessor :actor_index 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def window_width 
-     128 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def screen_x 
-     0 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def show 
-     return if $imported["YEA-BattleEngine"] 
-     super 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def screen_y 
-     Graphics.height - window_height - 20 
-   end   
-   
- end 
-   
- #============================================================================== 
- # ?Window_BattleStatus 
- #============================================================================== 
- class Window_BattleStatusMultiple < Window_BattleStatus 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   attr_accessor :viewport 
-   attr_accessor :wait_method 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def initialize 
-     super 
-     @status_windows = [] 
-     @viewport = nil 
-     @wait_method = 1 
-     self.visible = false 
-     self.windowskin = Cache.system('') 
-     @index = -1 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ? ?????????? 
-   #-------------------------------------------------------------------------- 
-   def create_contents 
-     self.contents.dispose if self.contents && !self.contents.disposed? 
-     self.contents = Bitmap.new(1, 1) 
-   end   
-   #-------------------------------------------------------------------------- 
-   # ? ?????????? 
-   #--------------------------------------------------------------------------   
-   def draw_item(index) 
-     return if index.nil? 
-     return unless $game_party.members[index] 
-     @status_windows = [] unless @status_windows 
-     return unless @status_windows[index] 
-     @status_windows[index].refresh 
-   end   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def window_width 
-     Graphics.width - 128 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def window_height 
-     fitting_height(visible_line_number) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def visible_line_number 
-     return 4 
-   end     
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def refresh 
-         @status_windows = [] if !@status_windows 
-     @status_windows.each do |i| 
-       i.refresh 
-     end   
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update 
-     super 
-         @status_windows = [] if !@status_windows 
-     need_wait = false 
-     self.visible = false 
-     $game_party.members.each do |actor| 
-       if !@status_windows.any? { |i| i.index == actor.index} 
-         window = Window_BattleStatusPart.new(actor.index) 
-         window.viewport = self.viewport 
-         @status_windows << window 
-         actor.sprite.update 
-         window.x = window.screen_x 
-         window.update 
-         window.viewport.update 
-         window.update 
-         need_wait = false 
-       end   
-     end   
-     @status_windows.each do |i| 
-       if $game_party.members.include?(i.actor) 
-         i.update 
-         i.viewport = self.viewport 
-       else 
-         @status_windows.delete(i) 
-         i.dispose 
-       end   
-     end 
-     SceneManager.scene.wait(1) if need_wait 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def dispose 
-     super 
-     @status_windows = [] if !@status_windows 
-     @status_windows.each do |i| 
-       i.dispose 
-     end     
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def show_actor(index) 
-     @status_windows = [] if !@status_windows 
-     @status_windows.sort! { |a, b| a.index <=> b.index} 
-     @status_windows[index].show_actor if index >= 0 && @status_windows[index] 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def hide_actor(index) 
-     @status_windows = [] if !@status_windows 
-     @status_windows.sort! { |a, b| a.index <=> b.index} 
-     @status_windows[index].hide_actor if index >= 0 && @status_windows[index] 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def select(index=0) 
-     hide_actor(@index) if index > @index || BattleConfig::DisapearWhenNoSelection 
-     wait_show 
-     @index = index 
-     show_actor(@index) 
-     wait_show 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------  
-   def wait_show 
-     return unless @wait_method 
-     @wait_method.call(1) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def unselect 
-     #hide_actor(@index) 
-     @index = -1 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def shake_window(index) 
-         @status_windows = [] if !@status_windows 
-     @status_windows.sort! { |a, b| a.index <=> b.index} 
-     @status_windows[index].shake 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def window_at(index) 
-         @status_windows = [] if !@status_windows 
-     @status_windows.sort! { |a, b| a.index <=> b.index} 
-     @status_windows[index] 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def show 
-         @status_windows = [] if !@status_windows 
-     @status_windows.each do |i| 
-       i.show 
-     end 
-     super 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def hide 
-         @status_windows = [] if !@status_windows 
-     @status_windows.each do |i| 
-       i.hide 
-     end 
-     super 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def make_window_return(index) 
-         @status_windows = [] if !@status_windows 
-     @status_windows.sort! { |a, b| a.index <=> b.index} 
-     @status_windows[index].return_to_origin 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def substitute(target_index, substitute_index)   
-         @status_windows = [] if !@status_windows 
-     @status_windows[substitute_index].move_to_index(target_index) 
-     @status_windows[target_index].move_down 
-   end   
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Game_Enemy < Game_Battler 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def sprite 
-     SceneManager.scene.spriteset.enemy_sprites.reverse[self.index] 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def atk_animation_id1 
-     return self.enemy.note[/<ATK ANI 1 ID:(\d+)>/mi] ? $1.to_i : 1 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def atk_animation_id2 
-     return self.enemy.note[/<ATK ANI 2 ID:(\d+)>/mi] ? $1.to_i : 0 
-   end   
-   
-   def no_panoramic 
-     return self.enemy.note[/<NO PANORAMIC>/mi] ? true : false 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Game_Actor < Game_Battler 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   alias ramiro_m3_setup setup 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   attr_accessor :extra_y 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def setup(actor_id) 
-     ramiro_m3_setup(actor_id) 
-     @extra_y = 0 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def use_sprite? 
-     return true 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def sprite 
-     return if !SceneManager.scene 
-     SceneManager.scene.spriteset.actor_sprites[self.index] 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def status_window 
-     return nil if !SceneManager.scene_is?(Scene_Battle) 
-     return nil if !SceneManager.scene.status_window 
-     SceneManager.scene.status_window.window_at(self.index) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def screen_y 
-     return Graphics.height - 100# + @extra_y 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------     
-   def screen_x 
-     return 0 if !self.index     
-     return -1000 if !SceneManager.scene 
-     return -1000 if !status_window 
-     sw = status_window 
-     sw.screen_x + sw.width / 2 - sw.viewport.ox + sw.viewport.rect.x 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def screen_z 
-     return -1000 if !self.index     
-     return -1000 if !SceneManager.scene     
-     100 
-   end   
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Sprite_Battler < Sprite_Base 
-   
-   FRONTAL = false 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   alias ramiro_m3_initialize initialize 
-   alias ramiro_m3_start_effect start_effect 
-   alias ramiro_m3_update_effect update_effect 
-   alias ramiro_m3_setup_new_animation setup_new_animation 
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def initialize(viewport, battler=nil) 
-     ramiro_m3_initialize(viewport, battler) 
-     if battler && battler.actor? 
-       self.visible = false 
-       self.opacity = 0 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def battle_show 
-     return if !@battler || @battler.enemy? 
-     start_effect(:go_up) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def battle_hide 
-     return if !@battler || @battler.enemy? 
-     start_effect(:go_down)    
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def start_effect(effect_type) 
-     @effect_type = effect_type     
-     case effect_type 
-     when :go_up 
-       revert_to_normal 
-       @effect_duration = 5 
-     when :go_down 
-       revert_to_normal 
-       @effect_duration = 5 
-     else   
-       ramiro_m3_start_effect(effect_type) 
-     end   
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_effect 
-     if @effect_duration > 0  
-       @effect_duration -= 1 
-       case @effect_type 
-       when :go_up 
-         update_go_up_effect 
-       when :go_down 
-         update_go_down_effect 
-       end   
-       @effect_duration += 1 
-     end   
-     ramiro_m3_update_effect 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update_go_up_effect 
-     self.opacity = (self.opacity * @effect_duration + 255 ) / (@effect_duration + 1) 
- #    @battler.extra_y = (@battler.extra_y * @effect_duration) / (@effect_duration + 1) 
-     self.visible = (self.opacity > 50) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update_go_down_effect 
-     self.opacity = (self.opacity * @effect_duration) / (@effect_duration + 1) 
- #    @battler.extra_y = (@battler.extra_y * @effect_duration + 60) / (@effect_duration + 1)     
-     self.visible = (self.opacity > 50) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_bitmap 
-     if @battler.enemy? 
-       new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue) 
-     else 
-       new_bitmap = Cache.character(@battler.character_name) 
-     end   
-     if bitmap != new_bitmap 
-       self.bitmap = new_bitmap 
-       init_visibility 
-       update_rect if self.bitmap && @battler.actor? 
-     end 
-     self.opacity = 0 if @battler.actor? && @battler.extra_y == 60 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_blink 
-   
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # * Initialize Visibility 
-   #-------------------------------------------------------------------------- 
-   def init_visibility 
-     return @battler_visible = true if @battler.actor?  
-     @battler_visible = @battler.alive? 
-     self.opacity = 0 unless @battler_visible 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def setup_new_effect 
-     if !@battler_visible && @battler.alive? && @battler.enemy? 
-       start_effect(:appear) 
-     elsif @battler_visible && @battler.hidden? && @battler.enemy? 
-       start_effect(:disappear) 
-     elsif @battler.alive? && @was_dead 
-       @was_dead = false 
-       start_effect(:appear) 
-     end 
-     if @battler_visible && @battler.sprite_effect_type 
-       start_effect(@battler.sprite_effect_type) 
-       @battler.sprite_effect_type = nil 
-     end 
-     setup_popups if $imported["YEA-BattleEngine"] 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def revert_to_normal 
-     self.blend_type = 0 
-     self.color.set(0, 0, 0, 0) 
-     self.opacity = 255 
-     self.ox = bitmap.width / 2 if bitmap 
-     if @battler.enemy? 
-       self.src_rect.y = 0 
-     else   
-       update_rect 
-     end   
-   end   
-   
-   alias ramiro_m3_revert_to_normal revert_to_normal 
-   
-   #-------------------------------------------------------------------------- 
-   # * Revert to Normal Settings 
-   #-------------------------------------------------------------------------- 
-   def revert_to_normal 
-     ramiro_m3_revert_to_normal 
-     if self.battler.actor? 
-       update_rect 
-       update_origin 
-     end 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update_rect 
-     sign = @battler.character_name[/^[\!\$]./] 
-     if sign && sign.include?('$') 
-       i = 0 
-       j = 0 
-       w = self.bitmap.width / 3 
-       h = self.bitmap.height / 4 
-     else 
-       i = @battler.character_index % 4 
-       j = @battler.character_index / 4 
-       w = self.bitmap.width / 12 
-       h = self.bitmap.height / 8       
-     end 
-     k = FRONTAL ? 3 : 0 
-     self.src_rect.set(w + i * w * 3, j * h * 4 + k, w, h * 3 / 4) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_origin 
-     if bitmap 
-       self.ox = self.width / 2 
-       self.oy = self.height 
-     end 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def animation_set_sprites(frame) 
-     cell_data = frame.cell_data 
-     @ani_sprites.each_with_index do |sprite, i| 
-       next unless sprite 
-       pattern = cell_data[i, 0] 
-       if !pattern || pattern < 0 
-         sprite.visible = false 
-         next 
-       end 
-       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2 
-       sprite.visible = true 
-       sprite.src_rect.set(pattern % 5 * 192, 
-         pattern % 100 / 5 * 192, 192, 192) 
-       if @ani_mirror 
-         sprite.x = @ani_ox - cell_data[i, 1] 
-         sprite.y = @ani_oy + cell_data[i, 2] 
-         sprite.angle = (360 - cell_data[i, 4]) 
-         sprite.mirror = (cell_data[i, 5] == 0) 
-       else 
-         sprite.x = @ani_ox + cell_data[i, 1] 
-         sprite.y = @ani_oy + cell_data[i, 2] 
-         sprite.angle = cell_data[i, 4] 
-         sprite.mirror = (cell_data[i, 5] == 1) 
-       end 
-       sprite.z = self.z + 300 + i 
-       sprite.ox = 96 
-       sprite.oy = 96 
-       sprite.zoom_x = cell_data[i, 3] / 100.0 
-       sprite.zoom_y = cell_data[i, 3] / 100.0 
-       sprite.opacity = cell_data[i, 6] 
-       sprite.blend_type = cell_data[i, 7] 
-     end 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def setup_new_animation 
-     return if @battler.actor? 
-     ramiro_m3_setup_new_animation 
-   end   
-   
-   alias ramiro_m3_update update 
-   
-   def update 
-     ramiro_m3_update 
-     return unless BattleConfig::PanoramicCamera 
-     return unless self.battler 
-     return if self.battler.enemy? && self.battler.no_panoramic 
-      self.zoom_x = self.zoom_y = ((self.y - BattleConfig::PanoramicCameraH * 130 / 100) * 0.005 + 1.0) if self.battler.enemy? 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Spriteset_Battle 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------  
-   alias ramiro_m3_create_viewports create_viewports 
-   alias ramiro_m3_update_viewports update_viewports 
-   alias ramiro_m3_dispose_viewports dispose_viewports 
-   alias ramiro_m3_create_actors create_actors 
-   alias ramiro_m3_dispose_actors dispose_actors 
-   alias ramiro_m3_update_actors update_actors 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   attr_reader :actor_sprites 
-   attr_reader :enemy_sprites 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def create_viewports 
-     @viewport4 = Viewport.new 
-     @viewport4.z = 200 
-     ramiro_m3_create_viewports 
-     @viewportPopups.z = 500 if @viewportPopups 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update_viewports 
-     ramiro_m3_update_viewports 
-     @viewport4.update 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def dispose_viewports 
-     ramiro_m3_dispose_viewports 
-     @viewport4.dispose 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def create_actors 
-     ramiro_m3_create_actors 
-     @actor_animation = Array.new(4) {Sprite_ActorAnimation.new(@viewport4)} 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def dispose_actors 
-     ramiro_m3_dispose_actors 
-     @actor_animation.each do |i| 
-       i.dispose 
-     end   
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def update_actors 
-     ramiro_m3_update_actors 
-      @actor_animation.each_with_index do |sprite, i| 
-       sprite.update 
-       sprite.actor = $game_party.members[i] 
-     end    
-   end   
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Sprite_ActorAnimation < Sprite_Base 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   attr_accessor :actor 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def initialize(viewport, actor=nil) 
-     super(viewport) 
-     @actor = actor 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def update 
-     super 
-     return unless @actor 
-     if @actor.animation_id != 0 
-       animation = $data_animations[@actor.animation_id] 
-       mirror = @actor.animation_mirror 
-       start_animation(animation, mirror)       
-       @actor.animation_id = 0 
-     end   
-     self.x = @actor.screen_x 
-     self.y = @actor.screen_y 
-   end 
-   
- end 
-   
- #============================================================================== 
- # ? 
- #============================================================================== 
- class Scene_Battle < Scene_Base 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   alias ramiro_m3_next_command next_command 
-   alias ramiro_m3_prior_command prior_command 
-   alias ramiro_m3_apply_item_effects apply_item_effects 
-   alias ramiro_m3_create_all_windows create_all_windows 
-   alias ramiro_m3_on_actor_ok on_actor_ok 
-   alias ramiro_m3_on_actor_cancel on_actor_cancel 
-   alias ramiro_m3_select_actor_selection select_actor_selection   
-   alias ramiro_m3_invoke_item invoke_item 
-   alias ramiro_m3_apply_substitute apply_substitute 
-   alias ramiro_m3_invoke_counter_attack invoke_counter_attack 
-   alias ramiro_m3_invoke_magic_reflection invoke_magic_reflection 
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   attr_reader :spriteset 
-   attr_reader :status_window 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def apply_item_effects(target, item) 
-     @status_window.shake_window(target.index) if target.actor? && !item.damage.none? && !item.damage.recover? 
-     ramiro_m3_apply_item_effects(target, item) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def create_status_window 
-     @status_window = Window_BattleStatusMultiple.new 
-     @status_window.wait_method = method( :wait )  
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def show_attack_animation(targets) 
-     show_normal_animation(targets, @subject.atk_animation_id1, false) 
-     show_normal_animation(targets, @subject.atk_animation_id2, true) 
-   end   
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def next_command 
-     ramiro_m3_next_command 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def prior_command 
-     ramiro_m3_prior_command 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def create_all_windows 
-     ramiro_m3_create_all_windows 
-     create_actor_selection_partner_window 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def create_actor_selection_partner_window 
-     @actor_selection_patner = Window_BattleStatusPatner.new(0) 
-     @actor_selection_patner.z = 9999 
-     @actor_selection_patner.hide 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def set_patner_info(index) 
-     @actor_selection_patner.actor_index = index 
-     @actor_selection_patner.refresh 
-     @actor_selection_patner.show 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def execute_action 
-     @subject.sprite.battle_show if @subject.actor? 
-     @invoked_targets = [@subject] 
-     wait(1) 
-     use_item 
-     @log_window.wait_and_clear 
-     unless $game_troop.all_dead? 
-       @invoked_targets.each do |actor| 
-         next unless actor.actor? && actor.exist? 
-         actor.sprite.battle_hide 
-       end 
-     end   
-     wait(1) 
-   end    
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def on_actor_ok 
-     @actor_selection_patner.hide 
-     ramiro_m3_on_actor_ok 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def on_actor_cancel 
-     @actor_selection_patner.hide 
-     ramiro_m3_on_actor_cancel 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def select_actor_selection 
-     set_patner_info(BattleManager.actor.index) 
-     ramiro_m3_select_actor_selection 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------    
-   def invoke_item(target, item) 
-     ramiro_m3_invoke_item(target, item) 
-     wait(1) 
-     $game_party.members.each do |actor| 
-       @status_window.make_window_return(actor.index) 
-     end 
-     wait(1)      
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #--------------------------------------------------------------------------   
-   def invoke_counter_attack(target, item) 
-     @invoked_targets.push << target     
-     target.sprite.battle_show if target.actor? 
-     target.animation_id = BattleConfig::Counterattack_AnimationID    
-     ramiro_m3_invoke_counter_attack(target, item) 
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ?  
-   #-------------------------------------------------------------------------- 
-   def invoke_magic_reflection(target, item)   
-     @invoked_targets.push << target    
-     target.sprite.battle_show if target.actor? 
-     target.animation_id = BattleConfig::Reflex_AnimationID 
-     ramiro_m3_invoke_magic_reflection(target, item)   
-   end 
-   
-   #-------------------------------------------------------------------------- 
-   # ? 
-   #-------------------------------------------------------------------------- 
-   def apply_substitute(target, item) 
-     new_target = ramiro_m3_apply_substitute(target, item) 
-     if new_target != target && target.actor? && new_target.actor? 
-       @status_window.substitute(target.index, new_target.index) 
-       wait(1) 
-     end  
-     new_target 
-   end   
-   
-   alias ramiro_m3_start_party_command_selection start_party_command_selection 
-   
-   def start_party_command_selection 
-     for battler in $game_party.members 
-       battler.sprite_effect_type = $game_troop.turn_count > 0 ? :go_up : :appear  
-     end   
-     wait(1)  
-     ramiro_m3_start_party_command_selection 
-   end   
-   
-   alias ramiro_m3_command_escape command_escape 
-   
-   def command_escape 
-     for battler in $game_party.members 
-       battler.sprite_effect_type = :go_down  
-     end   
-     wait(1)  
-     ramiro_m3_command_escape 
-   end     
-   
-   alias ramiro_m3_turn_start turn_start 
-   
-   def turn_start 
-     wait(1) 
-     @info_viewport.ox = 0 
-     for battler in $game_party.members 
-       battler.status_window.viewport = @info_viewport if battler.status_window 
-       battler.sprite_effect_type = :go_down  
-     end   
-     wait(1)  
-     ramiro_m3_turn_start 
-   end      
-   
- end