Screen issues with Yanfly Core Engine v1.09 and MGC Map Zoom Ace v1.6

● ARCHIVED · READ-ONLY
Started by Stedar 1 posts View original ↗
  1. Hi guys, I'm having a strange issue in VX Ace with Yanfly's Core Engine v1.09 and MGC's Map Zoom Ace v1.6.

    The Core Engine v1.0 WORKS with Map Zoom v1.6 and does not have any issues.

    However with v1.09 of Core Engine, the player can walk offscreen to the left and to the right. Basically the screen doesn't pan all the way and the character can walk offscreen. I realize that there is a functionality present to change the screen resolution but I am having the issue even with default screen sizes in both versions of the scripts. Example: 

    Picture here

    (There are actually a few more tiles to the right that you can't see)

    I'm not much of a scripter but it probably has to do with the viewport script update that occurred between v1.0 and v1.09. Can anyone help me to figure out what is causing this problem? V1.09 has a lot of bug fixes for the maker and general fixes I would like to have.

    Core Engine v1.09

    https://github.com/Archeia/YEARepo/blob/master/Core/Ace_Core_Engine.rbMap Zoom Ace v1.6 (Needs MGC Tilemap Ace to run too)

    Spoiler
    #====================================================================# Map Zoom Ace

    # v.1.6

    # Auteur : MGC

    #

    # Ce script pour RMVX Ace permet de jouer avec une carte zoomée.

    # Le coefficient de zoom peut aller de 1/8 à 8

    #

    # Nécessite :

    # - le script "MGC Tilemap Ace" du même auteur en V.1.4 minimum, placé

    #   directement au-dessus de ce script

    #

    # Utilisation :

    # - pour une carte utilisant la tilemap du script "MGC Tilemap Ace" (cf.

    #   ce script pour savoir comment obtenir une telle carte), deux

    #   commandes en script sont utilisables :

    #         - MGC.map_zoom=(nouvelle valeur de zoom)

    #         - MGC.to_map_zoom(nouvelle valeur de zoom, durée de la transition)

    #

    # Configuration :

    # - PARALLAX_ZOOM : alimenté à true ou false

    #         - true : le panorama subi le même zoom que la carte. Désactivé

    #                 par défaut car il semble que cela introduit du lag, et

    #                 je n'ai pas envie de réécrire la gestion du zoom de la

    #                 classe Plane pour remplacer ce que nous a écrit Enterbrain

    #         - false : le panorama est insensible au zoom de la carte

    # - DEFAULT_ZOOM : valeur de zoom par défaut qui s'applique à chaque entrée

    #         dans une carte supportant le zoom. Compris entre 0.125 et 8.0.

    #

    # Vous pouvez ajouter une commande dans le nom des cartes pour forcer le

    # la valeur du zoom à l'entrée dans cette carte. Cela est prioritaire par

    # rapport à DEFAULT_ZOOM.

    # - [Zx], où x est un décimal entre 0.125 et 8.0 : zoom de la carte

    # Exemple : My Worldmap[Z0.5]

    #====================================================================

    module MGC

      #--------------------------------------------------------------------------

      # * CONFIGURATION

      #--------------------------------------------------------------------------

      PARALLAX_ZOOM = false

      DEFAULT_ZOOM = 1.0 # [1.4]

      #--------------------------------------------------------------------------

      # * Initialisation

      #--------------------------------------------------------------------------

      @zoom = 1.0

      #--------------------------------------------------------------------------

      # * Aliased methods [1.4]

      #--------------------------------------------------------------------------

      class << self

        unless @already_aliased_mgc_zoom

          alias end_new_tilemap_mgc_zoom end_new_tilemap

          alias update_new_tilemap_mgc_zoom update_new_tilemap

          alias new_tilemap_effect_mgc_zoom? new_tilemap_effect?

          @already_aliased_mgc_zoom = true

        end

      end

      #--------------------------------------------------------------------------

      # * Fin de la nouvelle tilemap [1.4]

      #--------------------------------------------------------------------------

      def self.end_new_tilemap

        self.end_new_tilemap_mgc_zoom

        self.to_map_zoom(1.0, 1)

      end

      #--------------------------------------------------------------------------

      # * Initialisation de la valeur de zoom [1.4]-MOD

      #--------------------------------------------------------------------------

      def self.initialize_map_zoom

        @zoom = $game_system.map_zoom ? $game_system.map_zoom :

        $game_map.get_default_zoom

        @map_zoom_incr = Math.log(@zoom) / Math.log(2)

        @map_zoom_duration = 0

      end

      #--------------------------------------------------------------------------

      # * Change Map [1.4]

      #--------------------------------------------------------------------------

      def self.start_change_map_new_zoom

        @zoom = $game_map.get_default_zoom

        @map_zoom_incr = Math.log(@zoom) / Math.log(2)

        @map_zoom_duration = 0

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut zoom

      #--------------------------------------------------------------------------

      def self.map_zoom

        return @zoom

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut zoom

      #--------------------------------------------------------------------------

      def self.map_zoom=(zoom_value)

        unless map_zoom == zoom_value

          if zoom_value < 0.125 || zoom_value > 8.0 then return end

          @zoom = zoom_value

          $game_system.map_zoom = @zoom

          $game_player.center($game_player.x, $game_player.y)

        end

      end

      #--------------------------------------------------------------------------

      # * Incrémentation de la valeur du zoom

      #--------------------------------------------------------------------------

      def self.incr_map_zoom(val = 0.02)

        @map_zoom_incr += val

        new_zoom = 2 ** @map_zoom_incr

        self.map_zoom = new_zoom

      end

      #--------------------------------------------------------------------------

      # * Pour aller progressivement vers une nouvelle valeur de zoom

      #--------------------------------------------------------------------------

      def self.to_map_zoom(new_zoom, duration)

        unless map_zoom == new_zoom

          if new_zoom < 0.125 || new_zoom > 8.0 then return end

          @map_zoom_duration = duration

          target_zoom_incr = Math.log(new_zoom) / Math.log(2)

          @map_zoom_step = (target_zoom_incr - @map_zoom_incr) / duration

          @target_map_zoom = new_zoom

        end

      end

      #--------------------------------------------------------------------------

      # * Mise à jour de la nouvelle tilemap [1.4]

      #--------------------------------------------------------------------------

      def self.update_new_tilemap

        if @new_tilemap_active && @map_zoom_duration > 0

          @map_zoom_duration -= 1

          if @map_zoom_duration == 0

            self.map_zoom = @target_map_zoom

          else

            self.incr_map_zoom(@map_zoom_step)

          end

        end

        update_new_tilemap_mgc_zoom

      end

      #--------------------------------------------------------------------------

      # * Vérifie si un effet est en cours

      #--------------------------------------------------------------------------

      def self.new_tilemap_effect?

        return new_tilemap_effect_mgc_zoom? ||

        @new_tilemap_active && @map_zoom_duration > 0

      end

    end

     

    #==============================================================================

    # ** Game_System [1.4]

    #==============================================================================

    class Game_System

      #--------------------------------------------------------------------------

      # * Attributs

      #--------------------------------------------------------------------------

      attr_accessor :map_zoom

    end

     

    #==============================================================================

    # ** Viewport

    #==============================================================================

    class Viewport

      #--------------------------------------------------------------------------

      # * Attributs

      #--------------------------------------------------------------------------

      attr_reader :zoom

      attr_accessor :contains_zoomable_map

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias initialize_mgc_zoom initialize

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Initialisation

      #--------------------------------------------------------------------------

      def initialize(*args)

        initialize_mgc_zoom(*args)

        self.zoom = 1.0

        @contains_zoomable_map = false

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut zoom

      #--------------------------------------------------------------------------

      def zoom=(new_zoom)

        unless zoom == new_zoom

          if new_zoom < 0.125 || new_zoom > 8.0 then return end

          @zoom = new_zoom

        end

      end

      #--------------------------------------------------------------------------

      # * Mise à jour du zoom

      #--------------------------------------------------------------------------

      def update_zoom

        if contains_zoomable_map

          self.zoom = MGC.map_zoom

        end

      end

    end

     

    #==============================================================================

    # ** MGC::Tilemap

    #==============================================================================

    module MGC

      class Tilemap

        #--------------------------------------------------------------------------

        # * Aliased methods

        #--------------------------------------------------------------------------

        unless @already_aliased_mgc_zoom

          alias initialize_mgc_zoom initialize

          alias update_mgc_zoom update

          @already_aliased_mgc_zoom = true

        end

        #--------------------------------------------------------------------------

        # * Initialisation

        #--------------------------------------------------------------------------

        def initialize(viewport)

          initialize_mgc_zoom(viewport)

          @sprite_render.no_viewport_zoom = true

          @sprite_render_layer2.no_viewport_zoom = true

          viewport.contains_zoomable_map = true

        end

        #--------------------------------------------------------------------------

        # * Mise à jour, appelée normalement à chaque frame

        #--------------------------------------------------------------------------

        def update

          if @visible

            self.zoom = viewport.zoom

          end

          update_mgc_zoom

        end

      end

    end

     

    #==============================================================================

    # ** Plane

    #==============================================================================

    class Plane

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias initialize_mgc_zoom initialize

        alias ox_mgc_zoom= ox=

        alias oy_mgc_zoom= oy=

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Initialisation

      #--------------------------------------------------------------------------

      def initialize(*args)

        initialize_mgc_zoom(*args)

        @phase_viewport_zoom = false

        self.ox = 0

        self.oy = 0

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut ox

      #--------------------------------------------------------------------------

      def ox=(new_ox)

        unless @phase_viewport_zoom

          @base_ox = new_ox

        end

        self.ox_mgc_zoom = new_ox

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut ox

      #--------------------------------------------------------------------------

      def ox

        return @base_ox

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut oy

      #--------------------------------------------------------------------------

      def oy=(new_oy)

        unless @phase_viewport_zoom

          @base_oy = new_oy

        end

        self.oy_mgc_zoom = new_oy

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut oy

      #--------------------------------------------------------------------------

      def oy

        return @base_oy

      end

      #--------------------------------------------------------------------------

      # * Mise à jour du zoom en fonction du zoom du viewport

      #--------------------------------------------------------------------------

      def update_viewport_zoom

        if MGC::pARALLAX_ZOOM

          unless viewport.nil? || !viewport.contains_zoomable_map

            @phase_viewport_zoom = true

            self.zoom_x = viewport.zoom

            self.zoom_y = viewport.zoom

            self.ox = - ((Graphics.width >> 1) +

            (ox - (Graphics.width >> 1)) * viewport.zoom).to_i

            self.oy = - ((Graphics.height >> 1) +

            (oy - (Graphics.height >> 1)) * viewport.zoom).to_i

            @phase_viewport_zoom = false

          end

        end

      end

    end

     

    #==============================================================================

    # ** Spriteset_Map

    #==============================================================================

    class Spriteset_Map

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias start_new_tilemap_mgc_zoom start_new_tilemap

        alias update_parallax_mgc_zoom update_parallax

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Active la nouvelle tilemap [1.4]

      #--------------------------------------------------------------------------

      def start_new_tilemap

        unless @tilemap_new

          MGC.initialize_map_zoom

        end

        start_new_tilemap_mgc_zoom

      end

      #--------------------------------------------------------------------------

      # * Update [1.4]-MOD

      #--------------------------------------------------------------------------

      def update

        MGC.update_new_tilemap

        if $game_map.start_new_tilemap

          start_new_tilemap

          $game_map.start_new_tilemap = false

        elsif $game_map.end_new_tilemap

          end_new_tilemap

          $game_map.end_new_tilemap = false

        end

        update_viewports_zoom

        update_mgc_tilemap

      end

      #--------------------------------------------------------------------------

      # * Update Parallax

      #--------------------------------------------------------------------------

      def update_parallax

        update_parallax_mgc_zoom

        @parallax.update_viewport_zoom

      end

      #--------------------------------------------------------------------------

      # * Update Viewports Zoom

      #--------------------------------------------------------------------------

      def update_viewports_zoom

        @viewport1.update_zoom

      end

    end

     

    #==============================================================================

    # ** Sprite

    #==============================================================================

    class Sprite

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias initialize_mgc_zoom initialize

        alias x_mgc_zoom= x=

        alias y_mgc_zoom= y=

        alias zoom_x_mgc_zoom= zoom_x=

        alias zoom_y_mgc_zoom= zoom_y=

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Attributs

      #--------------------------------------------------------------------------

      attr_accessor :no_viewport_zoom

      #--------------------------------------------------------------------------

      # * Initialisation

      #--------------------------------------------------------------------------

      def initialize(*args)

        initialize_mgc_zoom(*args)

        @phase_viewport_zoom = false

        self.x = 0

        self.y = 0

        self.zoom_x = 1.0

        self.zoom_y = 1.0

        self.no_viewport_zoom = false

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut x

      #--------------------------------------------------------------------------

      def x=(new_x)

        unless @phase_viewport_zoom

          @base_x = new_x

        end

        self.x_mgc_zoom = new_x

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut y

      #--------------------------------------------------------------------------

      def y=(new_y)

        unless @phase_viewport_zoom

          @base_y = new_y

        end

        self.y_mgc_zoom = new_y

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut x

      #--------------------------------------------------------------------------

      def x

        return @base_x

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut y

      #--------------------------------------------------------------------------

      def y

        return @base_y 

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut zoom_x

      #--------------------------------------------------------------------------

      def zoom_x=(new_zoom_x)

        unless @phase_viewport_zoom

          @base_zoom_x = new_zoom_x

        end

        self.zoom_x_mgc_zoom = new_zoom_x

      end

      #--------------------------------------------------------------------------

      # * Setter pour l'attribut zoom_y

      #--------------------------------------------------------------------------

      def zoom_y=(new_zoom_y)

        unless @phase_viewport_zoom

          @base_zoom_y = new_zoom_y

        end

        self.zoom_y_mgc_zoom = new_zoom_y

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut zoom_x

      #--------------------------------------------------------------------------

      def zoom_x

        return @base_zoom_x

      end

      #--------------------------------------------------------------------------

      # * Getter pour l'attribut zoom_y

      #--------------------------------------------------------------------------

      def zoom_y

        return @base_zoom_y 

      end

      #--------------------------------------------------------------------------

      # * Valeur réelle du zoom_x en prenant en compte le zoom de la carte

      #--------------------------------------------------------------------------

      def zoom_x_global

        return @zoom_x

      end

      #--------------------------------------------------------------------------

      # * Valeur réelle du zoom_y en prenant en compte le zoom de la carte

      #--------------------------------------------------------------------------

      def zoom_y_global

        return @zoom_y 

      end

    end

     

    #==============================================================================

    # ** Sprite and all its subclasses [1.4]-MOD

    #==============================================================================

    [:Sprite, :Sprite_Base, :Sprite_Character, :Sprite_Battler, :Sprite_Picture,

    :Sprite_Timer].each {|classname|

      parent = eval("#{classname}.superclass")

      eval(

      "class #{classname} < #{parent}

        unless @already_aliased_mgc_zoom_#{classname}

          alias update_mgc_zoom_#{classname} update

          @already_aliased_mgc_zoom_#{classname} = true

        end

        def update

          update_mgc_zoom_#{classname}

          if self.instance_of?(#{classname})

            if MGC.new_tilemap_active && viewport && !no_viewport_zoom &&

              viewport.contains_zoomable_map

              @phase_viewport_zoom = true

              self.zoom_x = @base_zoom_x * viewport.zoom

              self.zoom_y = @base_zoom_y * viewport.zoom

              self.x = ((Graphics.width >> 1) +

              (x - (Graphics.width >> 1)) * viewport.zoom).to_i

              self.y = ((Graphics.height >> 1) +

              (y - (Graphics.height >> 1)) * viewport.zoom).to_i

              @phase_viewport_zoom = false

              @in_new_tilemap_zoom = true

            elsif @in_new_tilemap_zoom

              self.zoom_x = @base_zoom_x

              self.zoom_y = @base_zoom_y

              @in_new_tilemap_zoom = false

            end

          end

        end

      end")

    }

     

    #==============================================================================

    # ** Sprite_Character

    #==============================================================================

    class Sprite_Character < Sprite_Base

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias update_balloon_mgc_zoom update_balloon

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Update Balloon Icon

      #--------------------------------------------------------------------------

      def update_balloon

        update_balloon_mgc_zoom

        if @balloon_sprite then @balloon_sprite.update end

      end

    end

     

    #==============================================================================

    # ** Sprite_Base

    #==============================================================================

    class Sprite_Base < Sprite

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias animation_set_sprites_mgc_zoom animation_set_sprites

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Set Animation Sprite

      #     frame : Frame data (RPG::Animation::Frame)

      #--------------------------------------------------------------------------

      def animation_set_sprites(frame)

        animation_set_sprites_mgc_zoom(frame)

        @ani_sprites.each {|sprite| sprite.update}

      end

    end

     

    #==============================================================================

    # ** Game_Map

    #==============================================================================

    class Game_Map

      #--------------------------------------------------------------------------

      # * Aliased methods

      #--------------------------------------------------------------------------

      unless @already_aliased_mgc_zoom

        alias set_display_pos_mgc_zoom set_display_pos

        alias scroll_down_mgc_zoom scroll_down

        alias scroll_left_mgc_zoom scroll_left

        alias scroll_right_mgc_zoom scroll_right

        alias scroll_up_mgc_zoom scroll_up

        @already_aliased_mgc_zoom = true

      end

      #--------------------------------------------------------------------------

      # * Setup [1.4]

      #--------------------------------------------------------------------------

      def setup(map_id)

        setup_mgc_tilemap(map_id)

        if use_new_tilemap?

          if MGC.new_tilemap_active

            MGC.start_change_map_new_zoom

          end

          self.start_new_tilemap = true

        else

          self.end_new_tilemap = true

        end

      end

      #--------------------------------------------------------------------------

      # * Get default zoom [1.4]

      #--------------------------------------------------------------------------

      def get_default_zoom

        if $data_mapinfos[@map_id].full_name[/\[Z(\d+(?:\.\d+)*)\]/]

          return [[$1.to_f, 0.125].max, 8.0].min

        else

          return MGC::DEFAULT_ZOOM

        end

      end

      #--------------------------------------------------------------------------

      # * Set Display Position

      #--------------------------------------------------------------------------

      def set_display_pos(x, y)

        if MGC.new_tilemap_active && $game_map.use_new_tilemap? # [1.4]

          if loop_horizontal?

            @display_x = (x + width) % width

          else

            if width * MGC.map_zoom < screen_tile_x

              @display_x = (width - screen_tile_x).abs / 2

            else

              x_min = screen_tile_x * (1.0 / MGC.map_zoom - 1.0) / 2

              x_max = width + screen_tile_x * ((1.0 - 1.0 / MGC.map_zoom) / 2 - 1)

              x = [x_min, [x, x_max].min].max

              @display_x = x

            end

          end

          if loop_vertical?

            @display_y = (y + height) % height

          else

            if height * MGC.map_zoom < screen_tile_y

              @display_y = (height - screen_tile_y).abs / 2

            else

              y_min = screen_tile_y * (1.0 / MGC.map_zoom - 1.0) / 2

              y_max = height + screen_tile_y * ((1.0 - 1.0 / MGC.map_zoom) / 2 - 1)

              y = [y_min, [y, y_max].min].max

              @display_y = y

            end

          end

          @parallax_x = x

          @parallax_y = y

        else

          set_display_pos_mgc_zoom(x, y)

        end

      end

      #--------------------------------------------------------------------------

      # * Scroll Down

      #--------------------------------------------------------------------------

      def scroll_down(distance)

        if MGC.new_tilemap_active # [1.4]

          if loop_vertical?

            @display_y += distance

            @display_y %= @map.height

            @parallax_y += distance if @parallax_loop_y

          else

            last_y = @display_y

            if height * MGC.map_zoom < screen_tile_y

              @display_y = (height - screen_tile_y).abs / 2

            else

              max = height + screen_tile_y * ((1.0 - 1.0 / MGC.map_zoom) / 2 - 1)

              @display_y = [@display_y + distance, max].min

            end

            @parallax_y += @display_y - last_y

          end

        else

          scroll_down_mgc_zoom(distance)

        end

      end

      #--------------------------------------------------------------------------

      # * Scroll Left

      #--------------------------------------------------------------------------

      def scroll_left(distance)

        if MGC.new_tilemap_active # [1.4]

          if loop_horizontal?

            @display_x += @map.width - distance

            @display_x %= @map.width 

            @parallax_x -= distance if @parallax_loop_x

          else

            last_x = @display_x

            if width * MGC.map_zoom < screen_tile_x

              @display_x = (width - screen_tile_x).abs / 2

            else

              min = screen_tile_x * (1.0 / MGC.map_zoom - 1.0) / 2

              @display_x = [@display_x - distance, min].max

            end

            @parallax_x += @display_x - last_x

          end

        else

          scroll_left_mgc_zoom(distance)

        end

      end

      #--------------------------------------------------------------------------

      # * Scroll Right

      #--------------------------------------------------------------------------

      def scroll_right(distance)

        if MGC.new_tilemap_active # [1.4]

          if loop_horizontal?

            @display_x += distance

            @display_x %= @map.width

            @parallax_x += distance if @parallax_loop_x

          else

            last_x = @display_x

            if width * MGC.map_zoom < screen_tile_x

              @display_x = (width - screen_tile_x).abs / 2

            else

              max = width + screen_tile_x * ((1.0 - 1.0 / MGC.map_zoom) / 2 - 1)

              @display_x = [@display_x + distance, max].min

            end

            @parallax_x += @display_x - last_x

          end

        else

          scroll_right_mgc_zoom(distance)

        end

      end

      #--------------------------------------------------------------------------

      # * Scroll Up

      #--------------------------------------------------------------------------

      def scroll_up(distance)

        if MGC.new_tilemap_active # [1.4]

          if loop_vertical?

            @display_y += @map.height - distance

            @display_y %= @map.height

            @parallax_y -= distance if @parallax_loop_y

          else

            last_y = @display_y

            if height * MGC.map_zoom < screen_tile_y

              @display_y = (height - screen_tile_y).abs / 2

            else

              min = screen_tile_y * (1.0 / MGC.map_zoom - 1.0) / 2

              @display_y = [@display_y - distance, min].max

            end

            @parallax_y += @display_y - last_y

          end

        else

          scroll_up_mgc_zoom(distance)

        end

      end

    end

     

    #============================================================================

    # ** RPG::MapInfo

    #============================================================================

    class RPG::MapInfo

      # defines the map name as the name without anything within brackets,

      # including brackets

      def name

        return @name.gsub(/\[.*\]/) {''}

      end

      #--------------------------------------------------------------------------

      # the original name with the codes

      def full_name

        return @name

      end

    end


    Core Engine v1.00 (Works with Map Zoom. Unfortunately I only have a foreign version, but the code is obviously the same)

    Spoiler
    #==============================================================================

    # ▼ Yanfly Engine Ace - Ace Core Engine v1.00 - Versão Traduzida

    # -- Última Atualização: 01.12.2011

    # -- Nível: Fácil, Normal

    # -- Requer: n/a

    # -- Data da Última Tradução: 04.12.2011

    # -- Tradutor: http://makercafe.blogspot.com/

    # *O que está entre colchetes [] foi adicionado pelo tradutor para facilitar

    # a compreensão da linha de script ou fazer um comentário.

    #==============================================================================

     

    $imported = {} if $imported.nil?

    $imported["YEA-CoreEngine"] = true

    puts "Load: Yanfly Engine Ace - Ace Core Engine v1.00"

     

    #==============================================================================

    # ▼ Atualizações

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # 01.12.2011 - Script Iniciado e Acabado.



    #==============================================================================

    # ▼ Introdução

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # Este é o mecanismo central para a Yanfly Engine Ace, feito para RPG Maker VX 

    # Ace. Este script fornece várias alterações feitas no mecanismo central, 

    # incluindo correções de erros e atualizações da GUI (Interface Gráfica do 

    # Usuário).

    #

    # -----------------------------------------------------------------------------

    # Correção de Erro: Sobreposição da Animação

    # -----------------------------------------------------------------------------

    # - É o mesmo erro do VX. Quando uma animação de tela inteira é reproduzida 

    # contra um grupo de inimigos, o bitmap da animação é na verdade reproduzido

    # várias vezes, causando uma extrema sobreposição quando há muitos inimigos na 

    # tela.

    # Essa correção fará com que a animação se reproduza apenas uma vez.



    # -----------------------------------------------------------------------------

    # Correção de Erro: Correção da Ordem do Turno da Batalha

    # -----------------------------------------------------------------------------

    # - Mesmo erro do VX. Para aqueles que usam o sistema de batalha padrão, uma vez

    # que um turno começou, a ordem de ação se configura e é inalterada durante o 

    # restante do turno. Quaisquer alterações na AGI do combatente não serão feitas, 

    # mesmo que o combatente receba um acréscimo ou decréscimo na AGI.

    # Essa correção faz com que a AGI seja atualizada corretamente a cada ação.

    #

    # -----------------------------------------------------------------------------

    # Correção de Erro: Correção da Sobreposição dos Medidores

    # -----------------------------------------------------------------------------

    # - Mesmo erro do VX. Quando algumas variáveis excedem determinados valores, os 

    # medidores podem extrapolar a largura para a qual eles foram originalmente 

    # projetados. Essa correção irá evitar que os medidores passem da largura 

    # máxima.

    #

    # -----------------------------------------------------------------------------

    # Correção de Erro: Rolagem do Menu Segurando L e R

    # -----------------------------------------------------------------------------

    # - Antes, no VX, você podia navegar através de menus rapidamente pressionando

    # os botões L e R (Q e W no teclado). Essa correção recupera a capacidade de 

    # percorrer os menus dessa forma. Desative-a no module, se desejar.

    #

    # -----------------------------------------------------------------------------

    # Nova Funcionalidade: Tamanho da Resolução da Tela

    # -----------------------------------------------------------------------------

    # - A tela agora pode ser redimensionada, alterando o tamanho de 544x416 com 

    # facilidade, e ainda suporta mapas menores que 544x416 que são centrados na

    # tela sem ter sprites pulando em todo lugar.



    # -----------------------------------------------------------------------------

    # Nova Funcionalidade: Ajustar Velocidade da Animação

    # -----------------------------------------------------------------------------

    # - Por definição, o RPG Maker VX Ace reproduz animações a uma taxa de 15 FPS. 

    # Acelere as animações alterando uma simples constante no module.



    # -----------------------------------------------------------------------------

    # Nova Funcionalidade: Modificações da GUI

    # -----------------------------------------------------------------------------

    # - Há um monte de modificações diferentes que você pode fazer para a GUI.

    # Esta inclui a adição de contornos aos seus medidores, mudando as cores de cada 

    # aspecto individual da fonte, e muito mais. Além disso, aqui você pode mudar a 

    # configuração padrão da fonte para seus jogos.

    #

    # -----------------------------------------------------------------------------

    # Nova Funcionalidade: Agrupamento de Dígitos Numéricos

    # -----------------------------------------------------------------------------

    # Isto irá mudar várias cenas para exibir números em grupos onde são separados 

    # por uma vírgula a cada três dígitos. Assim, um número como 1234567 irá 

    # aparecer como 1,234,567. Isso permite aos jogadores lerem os números mais 

    # rápido.

    #

    # E isso é tudo para as funcionalidades e correções de erros!



    #==============================================================================

    # ▼ Instruções

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # Para instalar este script, abra seu editor de scripts copie e cole este script

    # em um slot aberto abaixo de ▼Materials/素材, mas acima de Main. Lembre-se de 

    # salvar.

    #

    #==============================================================================

    # ▼ Compatibilidade

    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    # Este script é feito estritamente para o RPG Maker VX Ace. É improvável que 

    # seja executado com o RPG Maker VX sem que precise de ajustes.

    #

    #==============================================================================

     

    module YEA

      module CORE

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Tamanho da Resolução da Tela -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # O RPG Maker VX Ace oferece a opção de ter maior largura e altura para seus 

        # jogos. Redimensionar a largura e altura terá estas alterações:

        #            Padrão  Redimensionada  Padrão Mín de Tiles  Novo Mín de Tiles

        #  Largura     544        640                17                  20

        #   Altura     416        480                13                  15

        # 

        # * Nota: a largura máxima é de 640, enquanto a altura máxima é de 480.

        #         A largura mínima é de 110, enquanto a altura mínima* é de 10.

        #         Estes são limitações impostas pela engine do RPG Maker VX Ace.

        # 

        # Ao selecionar "redimensionar", todos os menus padrão terão suas janelas

        # ajustadas, mas scripts fornecidos por outras fontes (não-Yanfly Engine)

        # podem ou não se ajustar adequadamente.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        RESIZE_WIDTH  = 544 # [Redimensiona a largura]

        RESIZE_HEIGHT = 416 # [Redimensiona a altura]

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Ajustar Velocidade da Animação -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Por padrão, a velocidade da animação reproduzida em batalhas opera a 

        # 15 FPS (frames por segundo). Para aqueles que gostariam de acelerar, basta

        # mudar esta constante para um dos seguintes valores:

        #   TAXA   Velocidade

        #     4      15 fps

        #     3      20 fps

        #     2      30 fps

        #     1      60 fps

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        ANIMATION_RATE = 3

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Agrupamento de Dígitos -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Ajustando isto para true fará com que os números sejam agrupados quando

        # são maiores do que mil. Por exemplo, 12345 será exibido como 12,345.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#--------------------------------------------------------------------------

        GROUP_DIGITS = true

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Configurações da Fonte -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Ajuste as configurações da fonte padrão para o seu jogo aqui. As várias 

        # configurações serão explicadas a seguir.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        FONT_NAME = ["VL Gothic", "Verdan", "Arial", "Courier"]

        # Isto ajusta as fontes usadas para o seu jogo. Se a fonte no início da

        # matriz não existe no computador do jogador, a próxima será utilizada.

        FONT_SIZE = 24       # Ajusta o tamanho da fonte. Padrão: 24

        FONT_BOLD = false    # Fonte em Negrito. Padrão: false

        FONT_ITALIC = false  # Fonte em Itálico. Padrão: false

        FONT_SHADOW = false  # Adiciona uma sombra à fonte. Padrão: false

        FONT_OUTLINE = true  # Adiciona um contorno à fonte.  Padrão: true

        FONT_COLOUR = Color.new(255, 255, 255, 255)   # Padrão: 255, 255, 255, 255

        #[Cor da fonte]

        FONT_OUTLINE_COLOUR = Color.new(0, 0, 0, 128) # Padrão:   0,   0,   0, 128

        #[Cor do contorno]

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Configurações da Aparência dos Medidores -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Você pode modificar a maneira como seus medidores aparecem no jogo. Se

        # você deseja que eles tenham um contorno, é possível. Você também pode 

        # ajustar a altura dos medidores.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        GAUGE_OUTLINE = true #[Contorno dos medidores]

        GAUGE_HEIGHT = 12 #[Altura dos medidores]

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # -  Rolagem do Menu Segurando L e R -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # O VX deu a capacidade de percorrer menus rapidamente segurando os botões 

        # L e R (Q e W no teclado). O VX Ace desativou essa funcionalidade. Agora, 

        # você pode reativá-la definindo esta constante como true. Para desativá-la,

        # defina a constante como false.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        QUICK_SCROLLING = true

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Cores dos Textos do Sistema -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Às vezes, as cores de texto do sistema são chatos apenas como laranja para 

        # HP, azul para MP, e verde para TP. Altere os valores aqui. Cada número 

        # corresponde ao índice da cor da skin da Window.png encontrada em

        # Graphics\System.

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        COLOURS ={

        # :texto      => ID

          :normal     =>  0,   # Padrão:   0

          :system     => 16,   # Padrão:  16

          :crisis     => 17,   # Padrão:  17

          :knockout   => 18,   # Padrão:  18

          :gauge_back => 19,   # Padrão:  19

          :hp_gauge1  => 28,   # Padrão:  20

          :hp_gauge2  => 29,   # Padrão:  21

          :mp_gauge1  => 22,   # Padrão:  22

          :mp_gauge2  => 23,   # Padrão:  23

          :mp_cost    => 23,   # Padrão:  23

          :power_up   => 24,   # Padrão:  24

          :power_down => 25,   # Padrão:  25

          :tp_gauge1  => 10,   # Padrão:  28

          :tp_gauge2  =>  2,   # Padrão:  29

          :tp_cost    =>  2,   # Padrão:  29

        } # Não remova isso.

        

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # - Opções dos Textos do Sistema -

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        # Aqui, você pode ajustar a transparência usada para itens desativados, o %

        # necessário para o HP e MP entrarem no modo "crisis".

        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        TRANSPARENCY = 160   # Ajusta a transparência dos itens desativados. 

        # Padrão: 160

        HP_CRISIS = 0.25     # Quando o HP é considerado crítico. Padrão: 0,25

        MP_CRISIS = 0.25     # Quando o MP é considerado crítico. Padrão: 0,25

        ITEM_AMOUNT = "×%s"  # O prefixo usado para as quantidades dos itens.

        

      end # CORE

    end # YEA

     

    #==============================================================================

    # ▼ Não edite nada além deste ponto. [Os termos encontrados em inglês abaixo

    # deste ponto fazem parte da linguagem de programação. Traduzi-los pode causar

    # dúvidas aos programadores.]

    #==============================================================================

     

    Graphics.resize_screen(YEA::CORE::RESIZE_WIDTH, YEA::CORE::RESIZE_HEIGHT)

    Font.default_name = YEA::CORE::FONT_NAME

    Font.default_size = YEA::CORE::FONT_SIZE

    Font.default_bold = YEA::CORE::FONT_BOLD

    Font.default_italic = YEA::CORE::FONT_ITALIC

    Font.default_shadow = YEA::CORE::FONT_SHADOW

    Font.default_outline = YEA::CORE::FONT_OUTLINE

    Font.default_color = YEA::CORE::FONT_COLOUR

    Font.default_out_color = YEA::CORE::FONT_OUTLINE_COLOUR

     

    #==============================================================================

    # ■ Numeric

    #==============================================================================

     

    class Numeric

      

      #--------------------------------------------------------------------------

      # new method: group_digits

      #--------------------------------------------------------------------------

      def group(decimal = 2)

        return self unless YEA::CORE::GROUP_DIGITS

        n1 = self.abs

        string = ""

        n4 = n1 - n1.to_i

        n2 = (n1.to_i.to_s.size - 1) / 3

        n2.times do

          n3 = n1 % 1000

          n1 /= 1000

          string = sprintf(",%03d%s", n3, string)

        end

        string = sprintf("%d%s", n1, string)

        if n4 > 0 or self.is_a?(Float)

          sp = "%." + decimal.to_s + "f"

          n4 = sprintf(sp, n4)

          n4.gsub!("0.", "")

          string = sprintf("%s.%s", string, n4)

        end

        string = "-" + string if self < 0

        return string

      end

        

    end # Numeric

     

    #==============================================================================

    # ■ BattleManager

    #==============================================================================

     

    module BattleManager

      

      #--------------------------------------------------------------------------

      # overwrite method: turn_start

      #--------------------------------------------------------------------------

      def self.turn_start

        @phase = :turn

        clear_actor

        $game_troop.increase_turn

        @performed_battlers = []

        make_action_orders

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: next_subject

      #--------------------------------------------------------------------------

      def self.next_subject

        @performed_battlers = [] if @performed_battlers.nil?

        loop do

          @action_battlers -= @performed_battlers

          battler = @action_battlers.shift

          return nil unless battler

          next unless battler.index && battler.alive?

          return battler

        end

      end

      

    end # BattleManager

     

    #==============================================================================

    # ■ Game_Battler

    #==============================================================================

     

    class Game_Battler < Game_BattlerBase

      

      #--------------------------------------------------------------------------

      # public instance variables

      #--------------------------------------------------------------------------

      attr_accessor :pseudo_ani_id

      

      #--------------------------------------------------------------------------

      # alias method: clear_sprite_effects

      #--------------------------------------------------------------------------

      alias game_battler_clear_sprite_effects_ace clear_sprite_effects

      def clear_sprite_effects

        game_battler_clear_sprite_effects_ace

        @pseudo_ani_id = 0

      end

      

    end # Game_Battler

     

    #==============================================================================

    # ■ Game_Troop

    #==============================================================================

     

    class Game_Troop < Game_Unit

      

      #--------------------------------------------------------------------------

      # overwrite method: setup

      #--------------------------------------------------------------------------

      def setup(troop_id)

        clear

        @troop_id = troop_id

        @enemies = []

        troop.members.each do |member|

          next unless $data_enemies[member.enemy_id]

          enemy = Game_Enemy.new(@enemies.size, member.enemy_id)

          enemy.hide if member.hidden

          enemy.screen_x = member.x + (Graphics.width - 544)/2

          enemy.screen_y = member.y + (Graphics.height - 416)

          @enemies.push(enemy)

        end

        init_screen_tone

        make_unique_names

      end

      

    end # Game_Troop

     

    #==============================================================================

    # ■ Game_Map

    #==============================================================================

     

    class Game_Map

      

      #--------------------------------------------------------------------------

      # overwrite method: scroll_down

      #--------------------------------------------------------------------------

      def scroll_down(distance)

        if loop_vertical?

          @display_y += distance

          @display_y %= @map.height * 256

          @parallax_y += distance

        else

          last_y = @display_y

          dh = Graphics.height > height * 32 ? height : (Graphics.height / 32)

          @display_y = [@display_y + distance, (height - dh) * 256].min

          @parallax_y += @display_y - last_y

        end

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: scroll_right

      #--------------------------------------------------------------------------

      def scroll_right(distance)

        if loop_horizontal?

          @display_x += distance

          @display_x %= @map.width * 256

          @parallax_x += distance

        else

          last_x = @display_x

          dw = Graphics.width > width * 32 ? width : (Graphics.width / 32)

          @display_x = [@display_x + distance, (width - dw) * 256].min

          @parallax_x += @display_x - last_x

        end

      end

      

    end # Game_Map

     

    #==============================================================================

    # ■ Game_Event

    #==============================================================================

     

    class Game_Event < Game_Character

      

      #--------------------------------------------------------------------------

      # overwrite method: near_the_screen?

      #--------------------------------------------------------------------------

      def near_the_screen?(dx = nil, dy = nil)

        dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?

        dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?

        ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32

        ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32

        ax >= -dx && ax <= dx && ay >= -dy && ay <= dy

      end

      

    end # Game_Event

     

    #==============================================================================

    # ■ Sprite_Base

    #==============================================================================

     

    class Sprite_Base < Sprite

      

      #--------------------------------------------------------------------------

      # overwrite method: set_animation_rate

      #--------------------------------------------------------------------------

      def set_animation_rate

        @ani_rate = YEA::CORE::ANIMATION_RATE

      end

      

      #--------------------------------------------------------------------------

      # new method: start_pseudo_animation

      #--------------------------------------------------------------------------

      def start_pseudo_animation(animation, mirror = false)

        dispose_animation

        @animation = animation

        return if @animation.nil?

        @ani_mirror = mirror

        set_animation_rate

        @ani_duration = @animation.frame_max * @ani_rate + 1

        @ani_sprites = []

      end

      

    end # Sprite_Base

     

    #==============================================================================

    # ■ Sprite_Battler

    #==============================================================================

     

    class Sprite_Battler < Sprite_Base

      

      #--------------------------------------------------------------------------

      # alias method: setup_new_animation

      #--------------------------------------------------------------------------

      alias sprite_battler_setup_new_animation_ace setup_new_animation

      def setup_new_animation

        sprite_battler_setup_new_animation_ace

        return if @battler.pseudo_ani_id <= 0

        animation = $data_animations[@battler.pseudo_ani_id]

        mirror = @battler.animation_mirror

        start_pseudo_animation(animation, mirror)

        @battler.pseudo_ani_id = 0

      end

      

    end # Sprite_Battler

     

    #==============================================================================

    # ■ Spriteset_Map

    #==============================================================================

     

    class Spriteset_Map

      

      #--------------------------------------------------------------------------

      # overwrite method: create_viewports

      #--------------------------------------------------------------------------

      def create_viewports

        if Graphics.width > $game_map.width * 32 and !$game_map.loop_horizontal?

          dx = (Graphics.width - $game_map.width * 32) / 2

        else

          dx = 0

        end

        dw = [Graphics.width, $game_map.width * 32].min

        dw = Graphics.width if $game_map.loop_horizontal?

        if Graphics.height > $game_map.height * 32 and !$game_map.loop_vertical?

          dy = (Graphics.height - $game_map.height * 32) / 2

        else

          dy = 0

        end

        dh = [Graphics.height, $game_map.height * 32].min

        dh = Graphics.height if $game_map.loop_vertical?

        @viewport1 = Viewport.new(dx, dy, dw, dh)

        @viewport2 = Viewport.new(dx, dy, dw, dh)

        @viewport3 = Viewport.new(dx, dy, dw, dh)

        @viewport2.z = 50

        @viewport3.z = 100

      end

      

    end # Spriteset_Map

     

    #==============================================================================

    # ■ Window_Base

    #==============================================================================

     

    class Window_Base < Window

      

      #--------------------------------------------------------------------------

      # overwrite methods: color

      #--------------------------------------------------------------------------

      def normal_color;      text_color(YEA::CORE::COLOURS[:normal]);      end;

      def system_color;      text_color(YEA::CORE::COLOURS[:system]);      end;

      def crisis_color;      text_color(YEA::CORE::COLOURS[:crisis]);      end;

      def knockout_color;    text_color(YEA::CORE::COLOURS[:knockout]);    end;

      def gauge_back_color;  text_color(YEA::CORE::COLOURS[:gauge_back]);  end;

      def hp_gauge_color1;   text_color(YEA::CORE::COLOURS[:hp_gauge1]);   end;

      def hp_gauge_color2;   text_color(YEA::CORE::COLOURS[:hp_gauge2]);   end;

      def mp_gauge_color1;   text_color(YEA::CORE::COLOURS[:mp_gauge1]);   end;

      def mp_gauge_color2;   text_color(YEA::CORE::COLOURS[:mp_gauge2]);   end;

      def mp_cost_color;     text_color(YEA::CORE::COLOURS[:mp_cost]);     end;

      def power_up_color;    text_color(YEA::CORE::COLOURS[:power_up]);    end;

      def power_down_color;  text_color(YEA::CORE::COLOURS[:power_down]);  end;

      def tp_gauge_color1;   text_color(YEA::CORE::COLOURS[:tp_gauge1]);   end;

      def tp_gauge_color2;   text_color(YEA::CORE::COLOURS[:tp_gauge2]);   end;

      def tp_cost_color;     text_color(YEA::CORE::COLOURS[:tp_cost]);     end;

      

      #--------------------------------------------------------------------------

      # overwrite method: translucent_alpha

      #--------------------------------------------------------------------------

      def translucent_alpha

        return YEA::CORE::TRANSPARENCY

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: hp_color

      #--------------------------------------------------------------------------

      def hp_color(actor)

        return knockout_color if actor.hp == 0

        return crisis_color if actor.hp < actor.mhp * YEA::CORE::HP_CRISIS

        return normal_color

      end

      #--------------------------------------------------------------------------

      # overwrite method: mp_color

      #--------------------------------------------------------------------------

      def mp_color(actor)

        return crisis_color if actor.mp < actor.mmp * YEA::CORE::MP_CRISIS

        return normal_color

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_gauge

      #--------------------------------------------------------------------------

      def draw_gauge(dx, dy, dw, rate, color1, color2)

        dw -= 2 if YEA::CORE::GAUGE_OUTLINE

        fill_w = [(dw * rate).to_i, dw].min

        gauge_h = YEA::CORE::GAUGE_HEIGHT

        gauge_y = dy + line_height - 2 - gauge_h

        if YEA::CORE::GAUGE_OUTLINE

          outline_colour = gauge_back_color

          outline_colour.alpha = translucent_alpha

          contents.fill_rect(dx, gauge_y-1, dw+2, gauge_h+2, outline_colour)

          dx += 1

        end

        contents.fill_rect(dx, gauge_y, dw, gauge_h, gauge_back_color)

        contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_actor_level

      #--------------------------------------------------------------------------

      def draw_actor_level(actor, dx, dy)

        change_color(system_color)

        draw_text(dx, dy, 32, line_height, Vocab::level_a)

        change_color(normal_color)

        draw_text(dx + 32, dy, 24, line_height, actor.level.group, 2)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_current_and_max_values

      #--------------------------------------------------------------------------

      def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)

        total = current.group + "/" + max.group

        if dw < text_size(total).width + text_size(Vocab.hp).width

          change_color(color1)

          draw_text(dx, dy, dw, line_height, current.group, 2)

        else

          xr = dx + text_size(Vocab.hp).width

          dw -= text_size(Vocab.hp).width

          change_color(color2)

          text = "/" + max.group

          draw_text(xr, dy, dw, line_height, text, 2)

          dw -= text_size(text).width

          change_color(color1)

          draw_text(xr, dy, dw, line_height, current.group, 2)

        end

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_actor_tp

      #--------------------------------------------------------------------------

      def draw_actor_tp(actor, x, y, width = 124)

        draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)

        change_color(system_color)

        draw_text(x, y, 30, line_height, Vocab::tp_a)

        change_color(tp_color(actor))

        draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i.group, 2)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_actor_param

      #--------------------------------------------------------------------------

      def draw_actor_param(actor, x, y, param_id)

        change_color(system_color)

        draw_text(x, y, 120, line_height, Vocab::param(param_id))

        change_color(normal_color)

        draw_text(x + 120, y, 36, line_height, actor.param(param_id).group, 2)

      end

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_currency_value

      #--------------------------------------------------------------------------

      def draw_currency_value(value, unit, x, y, width)

        cx = text_size(unit).width

        change_color(normal_color)

        draw_text(x, y, width - cx - 2, line_height, value.group, 2)

        change_color(system_color)

        draw_text(x, y, width, line_height, unit, 2)

      end

      

    end # Window_Base

     

    #==============================================================================

    # ■ Window_ItemList

    #==============================================================================

     

    class Window_ItemList < Window_Selectable

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_item_number

      #--------------------------------------------------------------------------

      def draw_item_number(rect, item)

        text = sprintf(YEA::CORE::ITEM_AMOUNT, $game_party.item_number(item).group)

        draw_text(rect, text, 2)

      end

      

    end # Window_ItemList

     

    #==============================================================================

    # ■ Window_Selectable

    #==============================================================================

     

    class Window_Selectable < Window_Base

      

      #--------------------------------------------------------------------------

      # overwrite method: process_cursor_move

      #--------------------------------------------------------------------------

      if YEA::CORE::QUICK_SCROLLING

      def process_cursor_move

        return unless cursor_movable?

        last_index = @index

        cursor_down (Input.trigger?:)DOWN))  if Input.repeat?:)DOWN)

        cursor_up   (Input.trigger?:)UP))    if Input.repeat?:)UP)

        cursor_right(Input.trigger?:)RIGHT)) if Input.repeat?:)RIGHT)

        cursor_left (Input.trigger?:)LEFT))  if Input.repeat?:)LEFT)

        cursor_pagedown   if !handle?:)pagedown) && Input.repeat?:)R)

        cursor_pageup     if !handle?:)pageup)   && Input.repeat?:)L)

        Sound.play_cursor if @index != last_index

      end

      end # YEA::CORE::QUICK_SCROLLING

      

    end # Window_Selectable

     

    #==============================================================================

    # ■ Window_MenuStatus

    #==============================================================================

     

    class Window_MenuStatus < Window_Selectable

      

      #--------------------------------------------------------------------------

      # new method: draw_actor_simple_status

      #--------------------------------------------------------------------------

      def draw_actor_simple_status(actor, dx, dy)

        draw_actor_name(actor, dx, dy)

        draw_actor_level(actor, dx, dy + line_height * 1)

        draw_actor_icons(actor, dx, dy + line_height * 2)

        draw_actor_class(actor, dx + 120, dy)

        dw = contents.width - dx - 124

        draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)

        draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)

      end

      

    end # Window_MenuStatus

     

    #==============================================================================

    # ■ Window_Status

    #==============================================================================

     

    class Window_Status < Window_Selectable

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_exp_info

      #--------------------------------------------------------------------------

      def draw_exp_info(x, y)

        s1 = @actor.max_level? ? "-------" : @actor.exp

        s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp

        s_next = sprintf(Vocab::ExpNext, Vocab::level)

        change_color(system_color)

        draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)

        draw_text(x, y + line_height * 2, 180, line_height, s_next)

        change_color(normal_color)

        s1 = s1.group if s1.is_a?(Integer)

        s2 = s2.group if s2.is_a?(Integer)

        draw_text(x, y + line_height * 1, 180, line_height, s1, 2)

        draw_text(x, y + line_height * 3, 180, line_height, s2, 2)

      end

      

    end # Window_Status

     

    #==============================================================================

    # ■ Window_ShopBuy

    #==============================================================================

     

    class Window_ShopBuy < Window_Selectable

      

      #--------------------------------------------------------------------------

      # overwrite method: draw_item

      #--------------------------------------------------------------------------

      def draw_item(index)

        item = @data[index]

        rect = item_rect(index)

        draw_item_name(item, rect.x, rect.y, enable?(item))

        rect.width -= 4

        draw_text(rect, price(item).group, 2)

      end

      

    end # Window_ShopBuy

     

    #==============================================================================

    # ■ Scene_Battle

    #==============================================================================

     

    class Scene_Battle < Scene_Base

      

      #--------------------------------------------------------------------------

      # public instance variables

      #--------------------------------------------------------------------------

      attr_accessor :spriteset

      

      #--------------------------------------------------------------------------

      # overwrite method: show_normal_animation

      #--------------------------------------------------------------------------

      def show_normal_animation(targets, animation_id, mirror = false)

        animation = $data_animations[animation_id]

        return if animation.nil?

        ani_check = false

        targets.each do |target|

          if ani_check

            target.pseudo_ani_id = animation_id

          else

            target.animation_id = animation_id

          end

          target.animation_mirror = mirror

          abs_wait_short unless animation.to_screen?

          ani_check = true if animation.to_screen?

        end

        abs_wait_short if animation.to_screen?

      end

      

    end # Scene_Battle

     

    #==============================================================================



    # ▼ Fim do Arquivo



    #==============================================================================