| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 3 |  
| 经验 | 20303 |  
| 最后登录 | 2024-2-3 |  
| 在线时间 | 398 小时 |  
 Lv2.观梦者 
	梦石0 星屑293 在线时间398 小时注册时间2011-5-20帖子128 | 
| 
本帖最后由 893299399 于 2013-7-20 12:33 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
  因为AT脚本是一套的战斗脚本里弄出来的,所以位置变成了那样,请问怎么把AT条的位置移动到红圈里? 复制代码#==============================================================================
# +++ MOG - AT System  (v0.7 Beta) +++
#==============================================================================
# By Moghunter 
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de batalha de turnos em tempo real.
#==============================================================================
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 0.7 - Melhoria na performance.
# v 0.6 - Corrigido o bug de ações forçadas consecutivas.
#       - Corrigido o bug de contagem de turnos das condições. (Stop / Sleep)
#       - Corrigido o bug de resetar o AT quando o battler recebe qualquer
#         tipo de status que não tenham o  efeito Stop / Sleep.
# v 0.5 - Corrigido o bug da contagem de turnos nas condições. (States)
# v 0.4 - Corrigido o bug de crash randômico. (relativo a dispose de imagem.)
#       - Corrigido o bug de crash randômico. (relativo ao turno.)
#       - Corrigido o bug de travar a tela na execução da mensagem de batalha.
# v 0.3 - Corrigido o Bug da janela de comando ao apertar a tecla Cancel.
#       - Corrigido o Bug de não apresentar a janela de status no começo.
#       - Melhor codificação para aumentar a compatibilidade.
#       - Opção de definir a posição do medidor de AT pelo X&Y do battler. 
# v 0.2 - Corrigido o bug da seleção do alvo para ações de cast time.
# v 0.1 - Primeiro lançamento.
#==============================================================================
#==============================================================================
# ● Imagens Necessárias
#==============================================================================
# Serão necessários as imagens:
#
# Battle_AT_Layout.png
# Battle_AT_Meter.png
#
# Na pasta GRAPHICS/SYSTEM/
#
#==============================================================================
# ● AT SYSTEM
#==============================================================================
# A velocidade de AT é baseaddo na agilidade do Battler.
# Em caso de batalhas preventivas (Preemptive) os aliados começarão com AT em
# 80% e os inimigos começarão com AT em 0 (Zero)
# Em batalhas surpresas (Surprise) é o inverso das batalhas preventivas.
# Em batalhas normais todos os battlers começarão com AT em 40%.
#==============================================================================
# ● CAST TIME
#==============================================================================
# Para definir uma habilidade ou item com a função de Cast Time basta definir
# o valor da velocidade (Speed) diferente de 0 (Zero).
#
# NOTA - Não é possível ativar 2 ou mais habilidades com a função Cast Time no
# mesmo turno. (Caso você esteja usando características de Multi Action em
# seu projeto.)
#==============================================================================
module MOG_AT_SYSTEM
  # Tipo de posicionamento da Hud.
  # 0 - Posição fixa.
  # 1 - Posição baseado no valor X e Y do battler.
  HUD_POSITION_TYPE = 0
  #Posição geral (Inicial) da Hud.
  HUD_POSITION = [25,400]
  #Posição do medidor de AT
  AT_METER_POSITION = [29,1]
  #Definição da posição do espaço da HUD entre os membros do grupo.
  #
  #MEMBERS_SPACE = [Horizontal ,Vertical]
  #
  MEMBERS_SPACE = [136,0]
  #Velocidade de animação do medidor de at, defina 0 se não quiser a animação.
  AT_METER_FLOW_SPEED = 3
  #Prioridade da Hud.
  BATTLE_HUD_Z = 0
  #Som quando o sistema AT estiver no maximo
  SE_ACTIVE = "Decision2"
  #Definição do valor de AT para ativar a ação.(Gauge Meter).
  AT_GAUGE_METER = 5000
  # Definição do tipo de duração (Contagem/formula) de um turno.
  # Essa definição influência na ativação dos eventos de batalha.
  # (BATTLE EVENTS)
  #
  # 0 - Duração de um turno é um valor fixo.
  # 1 - Duração de um turno é multiplicado pela quantidade de batllers.
  # 2 - Duração de um turno é baseado na média de agilidade dos battlers.
  #
  TURN_DURATION_TYPE = 1
  # Definição de valor usado para calcular a duração de um turno.
  TURN_DURATION = 60
  # Definição da animação quando o battler usa habilidades de carregamento.
  CAST_ANIMATION = 49
  # Ativar a janela de LOG, deixe desativado se desejar uma batalha mais
  # dinâmica.
  WAIT_LOG_WINDOW = false
  # Ativar a mensagem inicial com os nomes dos inimigos.
  MESSAGE_ENEMY_APPEAR = false
  # Definição da posição da janela de mensagem.
  # 0 - Superior
  # 1 - Centro
  # 2 - Inferior  
  MESSAGE_POSITION = 0
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
  
  attr_accessor :at_max
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------         
  alias mog_at_system_initialize initialize
  def initialize
      @at_max = [[MOG_AT_SYSTEM::AT_GAUGE_METER, 999999].min, 100].max
      mog_at_system_initialize
  end
  
end 
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
  
  #--------------------------------------------------------------------------
  # ● Battle Start
  #--------------------------------------------------------------------------  
  def self.battle_start
      $game_system.battle_count += 1
      $game_party.on_battle_start
      $game_troop.on_battle_start
      if MOG_AT_SYSTEM::MESSAGE_ENEMY_APPEAR
         $game_troop.enemy_names.each do |name|
         $game_message.add(sprintf(Vocab::Emerge, name))
         end
      end
      if @preemptive
         $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
      elsif @surprise
         $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
      end
      wait_for_message
  end
  
  #--------------------------------------------------------------------------
  # ● Input Start
  #--------------------------------------------------------------------------
  def self.input_start_at(battler)
      if @phase != :input
         @phase = :input
         battler.make_actions
         clear_actor
      end
      return !@surprise && battler.inputable?
  end
 
  #--------------------------------------------------------------------------
  # ● Turn Start
  #--------------------------------------------------------------------------
  def self.turn_start
      @phase = :turn
      clear_actor
      make_action_orders
  end  
  
  #--------------------------------------------------------------------------
  # ● Preemtive Attack
  #--------------------------------------------------------------------------  
  def self.preemptive_attack
      @preemptive
  end  
  
  #--------------------------------------------------------------------------
  # ● Suprise Attack
  #--------------------------------------------------------------------------    
  def self.surprise_attack
      @surprise
  end    
  
end  
#==============================================================================
# ■ Game Action
#==============================================================================
class Game_Action  
 
  #--------------------------------------------------------------------------
  # ● Prepare
  #--------------------------------------------------------------------------             
  alias mog_at_system_prepare prepare
  def prepare
      mog_at_system_prepare
      set_cast_action
  end
  
  #--------------------------------------------------------------------------
  # ● Set Cast Action
  #--------------------------------------------------------------------------               
  def set_cast_action
      return if forcing
      if @item.object != nil and @item.object.speed != 0 and @subject.at_cast.empty?
         @subject.at_cast = [@item.object,@item.object.speed.abs,@target_index] 
         @item.object = nil
         @subject.animation_id = MOG_AT_SYSTEM::CAST_ANIMATION
         @subject.at = 0
         BattleManager.turn_end if @subject.auto_battle?
      elsif [email protected]_cast.empty?
         if @subject.at_cast[1] == 0
            @item.object = @subject.at_cast[0]
            @target_index = @subject.at_cast[2]            
            @subject.at_cast.clear
         else   
            @item.object = nil
         end
      end  
  end  
  
end
#==============================================================================
# ■ Game Battler Base
#==============================================================================
class Game_BattlerBase  
  #--------------------------------------------------------------------------
  # ● Inputable?
  #--------------------------------------------------------------------------             
  def inputable?
      normal? && !auto_battle? && self.at == $game_system.at_max
  end
  
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  
   attr_accessor :at
   attr_accessor :at_cast
   attr_accessor :at_turn_duration
   
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------       
   alias mog_at_system_initialize initialize
   def initialize
       mog_at_system_initialize
       @at = 0
       @at_cast = []
       @at_cast_selectable = true
       @at_turn_duration = 0
   end
     
  #--------------------------------------------------------------------------
  # ● At
  #--------------------------------------------------------------------------          
   def at
       n = at_active? ? $game_system.at_max : 0
       return [[@at, n].min, 0].max
   end  
   
  #--------------------------------------------------------------------------
  # ● At Active
  #--------------------------------------------------------------------------             
   def at_active?
       return false if restriction >= 4
       return false if self.hp == 0 
       return true
   end  
   
  #--------------------------------------------------------------------------
  # ● Added New State
  #--------------------------------------------------------------------------  
  alias mog_at_system_add_new_state add_new_state
  def add_new_state(state_id)
      mog_at_system_add_new_state(state_id)
      if restriction >= 4
         self.at_cast.clear
         self.at = 0 
      end   
  end   
  
end
#==============================================================================
# ■ Game Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  
  #--------------------------------------------------------------------------
  # ● Tranform
  #--------------------------------------------------------------------------  
   alias mog_at_system_transform transform
   def transform(enemy_id)
       mog_at_system_transform(enemy_id)
       self.at = 0
       self.at_cast.clear
   end
end   
 
if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW
#==============================================================================
# ■ BattleManager
#==============================================================================
class Window_BattleLog < Window_Selectable
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------    
  def refresh
  end  
  #--------------------------------------------------------------------------
  # ● Message Speed
  #--------------------------------------------------------------------------    
  def message_speed
      return 5
  end
end
end
#==============================================================================
# ■ Scene Battle
#==============================================================================
class Scene_Battle < Scene_Base
  include MOG_AT_SYSTEM
  
  #--------------------------------------------------------------------------
  # ● AT Wait
  #--------------------------------------------------------------------------         
  alias mog_at_system_start start
  def start
      reset_at_parameter  
      mog_at_system_start
  end  
    
  #--------------------------------------------------------------------------
  # ● Battle Start
  #--------------------------------------------------------------------------
  def battle_start
      BattleManager.battle_start
      process_event
      set_turn_duration
  end 
    
  #--------------------------------------------------------------------------
  # ● Reset AT Parameter
  #--------------------------------------------------------------------------  
  def reset_at_parameter
      return if @at_phase != nil
      @at_phase = 0
      n_at = $game_system.at_max * 40 / 100
      p_at = $game_system.at_max * 90 / 100
      s_at = 0
      all_battle_members.each do |battler|
          if BattleManager.preemptive_attack
             battler.at = p_at if battler.is_a?(Game_Actor)
             battler.at = s_at if battler.is_a?(Game_Enemy)
          elsif BattleManager.surprise_attack   
             battler.at = p_at if battler.is_a?(Game_Enemy)
             battler.at = s_at if battler.is_a?(Game_Actor)
          else   
             battler.at = n_at
          end
          if battler.at >= $game_system.at_max 
             battler.at = $game_system.at_max - 1 
          end
          battler.at = 0 if battler.at < 0  
          battler.at_cast.clear
        end
  end
  #--------------------------------------------------------------------------
  # ● Set Turn Duration
  #--------------------------------------------------------------------------
  def set_turn_duration
      max_battlers = all_battle_members.size > 0 ? all_battle_members.size : 1
      case TURN_DURATION_TYPE
        when 1
           n  = TURN_DURATION * max_battlers
        when 2
           turn_sp = 0
           all_battle_members.each do |battler|
               turn_sp += battler.agi
           end  
           n = TURN_DURATION + (turn_sp / max_battlers) 
        else
           n = TURN_DURATION
      end
      turn_time_max = [[n, 9999].min, 120].max
      @turn_duration = [0, turn_time_max]
      if @status_window != nil
         @status_window.open
      end   
  end   
  
  #--------------------------------------------------------------------------
  # ● Turn End
  #--------------------------------------------------------------------------
  def turn_end
      @at_phase = 0
      all_battle_members.each do |battler|
         if battler.at >= $game_system.at_max
            battler.at = 0
            refresh_status
            @log_window.display_auto_affected_status(battler)
            @log_window.wait_and_clear
         end
      end
      BattleManager.turn_end
  end
    
  #--------------------------------------------------------------------------
  # ● Update Turn Duration
  #--------------------------------------------------------------------------             
  def update_turn_duration
      return if @turn_duration == nil or @turn_duration[0] == nil
      @turn_duration[0] += 1
      if @turn_duration[0] >= @turn_duration[1]
         @turn_duration[0] = 0
         $game_troop.increase_turn
         process_event
         check_states_effect_turn
      end  
  end
  
  #--------------------------------------------------------------------------
  # ● Check States Effect Turn
  #--------------------------------------------------------------------------               
  def check_states_effect_turn
      all_battle_members.each do |battler|  
          battler.on_turn_end if battler.restriction >= 4
      end  
  end  
  
  #--------------------------------------------------------------------------
  # ● Update AT System
  #--------------------------------------------------------------------------           
  def update_at_system      
      reset_at_parameter if @at_phase == nil
      set_turn_duration if @turn_duration == nil
      return if !can_update_at?
      update_turn_duration
      all_battle_members.each do |battler|
          update_battler_turn_duration(battler)
          if !battler.at_cast.empty?
             battler.at_cast[1] -= 1
             if battler.at_cast[1] <= 0
                execute_at_cast(battler)
                break
             end
          else
             battler.at += battler.agi
          end    
          if battler.at >= $game_system.at_max
             battler.on_turn_end
             update_at_actor(battler)
             update_at_enemy(battler)
             battler.current_action.prepare if battler.current_action
             if battler.at_cast.empty?
                @at_phase = 1
                turn_start if battler.is_a?(Game_Enemy)
             end             
             break
          end   
      end  
  end
    
  #--------------------------------------------------------------------------
  # ● Update Battler Turn Duration
  #--------------------------------------------------------------------------             
  def update_battler_turn_duration(battler)
      if battler.restriction >= 4
         battler.at_turn_duration += 1
         if battler.at_turn_duration >= $game_system.at_max
            battler.on_turn_end 
            battler.at_turn_duration = 0
         end   
      else   
         battler.at_turn_duration = 0
      end  
  end  
  
  #--------------------------------------------------------------------------
  # ● Execute AT CAST
  #--------------------------------------------------------------------------             
  def execute_at_cast(battler)
      @subject = battler
      battler.make_actions  
      turn_start 
  end  
  
  #--------------------------------------------------------------------------
  # ● Update AT Actor 
  #--------------------------------------------------------------------------             
  def update_at_actor(battler)    
      return if !battler.is_a?(Game_Actor)
      Audio.se_play("Audio/SE/" + SE_ACTIVE,100,100)  
      start_party_command_selection_at(battler)
  end 
  
  #--------------------------------------------------------------------------
  # ● Update AT Enemy
  #--------------------------------------------------------------------------             
  def update_at_enemy(battler)    
      return if !battler.is_a?(Game_Enemy)
      battler.make_actions
  end    
  
  #--------------------------------------------------------------------------
  # ● Can Update AT
  #--------------------------------------------------------------------------             
  def can_update_at?
      return false if $game_troop.interpreter.running?
      return false if BattleManager.action_forced?
      return false if @at_phase != 0
      return false if $game_message.visible 
      return false if BattleManager.in_turn?
      return true
  end    
  
  #--------------------------------------------------------------------------
  # ● Star Party Command Selection at
  #--------------------------------------------------------------------------
  def start_party_command_selection_at(battler)
      unless scene_changing?
         refresh_status
         @status_window.unselect
         @status_window.open
         if BattleManager.input_start_at(battler)
            @actor_command_window.close
            next_command
         else
           turn_start
         end
      end
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Basic
  #--------------------------------------------------------------------------        
  alias mog_at_system_update_basic update_basic
  def update_basic
      mog_at_system_update_basic
      update_at_system
      update_party_command
      $game_message.position = MESSAGE_POSITION
  end
  
  #--------------------------------------------------------------------------
  # ● Update Party Command
  #--------------------------------------------------------------------------      
  def update_party_command
      return if !@party_command_window.active
      return if !@actor_command_window.visible
      return if $game_message.visible
      if Input.trigger?(:B)
         next_command
         Sound.play_cancel
         @party_command_window.active = false
      end  
  end 
     
end
#==============================================================================
# ■ AT Meter
#==============================================================================
class AT_Meter
  
  include MOG_AT_SYSTEM
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------    
  def initialize(actor)
      dispose 
      [url=home.php?mod=space&uid=95897]@actor[/url] = actor
      if HUD_POSITION_TYPE == 1 and @actor.use_sprite?
         @x = HUD_POSITION[0] +  @actor.screen_x rescue 0
         @y = HUD_POSITION[1] +  @actor.screnn_y rescue 0
      else   
         @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
         @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)        
      end
      pre_cache
      create_layout
      create_at_meter
  end
  
  #--------------------------------------------------------------------------
  # ● Pre Cache
  #--------------------------------------------------------------------------      
  def pre_cache
      @meter = Cache.system("Battle_AT_Meter")   
      @meter_cw = @meter.width / 3
      @meter_ch = @meter.height / 3
  end
  
  #--------------------------------------------------------------------------
  # ● Create Layout
  #--------------------------------------------------------------------------      
  def create_layout
      @layout = Sprite.new
      @layout.bitmap = Cache.system("Battle_AT_Layout")
      @layout.z = BATTLE_HUD_Z
      @layout.x = @x
      @layout.y = @y
  end
  
  #--------------------------------------------------------------------------
  # ● Create AT Meter
  #--------------------------------------------------------------------------      
  def create_at_meter
      @at_meter = Sprite.new
      @at_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
      @at_meter.z =  BATTLE_HUD_Z + 50
      @at_meter.x = @x + AT_METER_POSITION[0]
      @at_meter.y = @y + AT_METER_POSITION[1] 
      @at_flow = rand(@meter_cw * 2)
      at_flow_update
  end  
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------    
  def dispose
      return if @layout == nil
      @layout.bitmap.dispose
      @layout.dispose
      @layout = nil
      @at_meter.bitmap.dispose
      @at_meter.dispose
  end  
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  def update
      return if @layout == nil
      at_position
      at_flow_update
  end
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------    
  def at_position
      return unless HUD_POSITION_TYPE == 1 and @actor.use_sprite?
      @x = HUD_POSITION[0] +  @actor.screen_x rescue 0
      @y = HUD_POSITION[1] +  @actor.screnn_y rescue 0
      @layout.x = @x
      @layout.y = @y
      @at_meter.x = @x + AT_METER_POSITION[0]
      @at_meter.y = @y + AT_METER_POSITION[1]
  end
    
  #--------------------------------------------------------------------------
  # ● AT Flow Update
  #--------------------------------------------------------------------------
  def at_flow_update
      @at_meter.bitmap.clear
      if [email protected]_cast.empty?
         max_cast = @actor.at_cast[0].speed.abs != 0 ? @actor.at_cast[0].speed.abs : 1
         at_width = @meter_cw * @actor.at_cast[1] / max_cast
         ch = @meter_ch * 2
      else 
         at_width = @meter_cw * @actor.at / $game_system.at_max
         ch = @actor.at < $game_system.at_max ? 0 : @meter_ch
      end  
      src_rect = Rect.new(@at_flow, ch,at_width, @meter_ch)
      @at_meter.bitmap.blt(0,0, @meter, src_rect)
      @at_flow += AT_METER_FLOW_SPEED
      @at_flow = 0 if @at_flow >=  @meter_cw * 2      
  end   
  
end  
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------           
  alias mog_at_system_initialize initialize
  def initialize
      mog_at_system_initialize 
      create_at_meter
  end  
  
  #--------------------------------------------------------------------------
  # ● Create AT Meter
  #--------------------------------------------------------------------------             
  def create_at_meter
      dispose_at_meter
      @at_meter = []
      index = 0
      for i in $game_party.members
          @at_meter.push(AT_Meter.new(i))
          index += 1
          break if index >= $game_party.max_battle_members
      end      
  end  
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------      
  alias mog_at_system_dispose dispose
  def dispose
      mog_at_system_dispose
      dispose_at_meter
  end
    
  #--------------------------------------------------------------------------
  # ● Dispose AT Meter
  #--------------------------------------------------------------------------        
  def dispose_at_meter
      return if @at_meter == nil
      @at_meter.each {|sprite| sprite.dispose }
      @at_meter.clear
      @at_meter = nil
  end  
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------        
  alias mog_at_system_update update
  def update
      mog_at_system_update
      update_at_meter
  end  
  
  #--------------------------------------------------------------------------
  # ● Update AT Meter
  #--------------------------------------------------------------------------          
  def update_at_meter
      return if @at_meter == nil 
      @at_meter.each {|sprite| sprite.update }
  end  
  
end
$mog_rgss3_at_system = true
    | 
 |