查看: 969|回复: 1

[已经解决] 请帮忙看个脚本……

[复制链接]
梦石
0
星屑
50
在线时间
92 小时
注册时间
2010-6-29
回帖
15
发表于 2014-2-25 22:05:29 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 Sion 于 2014-2-25 22:13 编辑

在使用防御之后读条就会变得很慢,本人只懂一点点脚本,注释的西班牙语又看不懂……
求助关于防御的AT是如何设定的啊……[pre lang="ruby" line="1"]if true
#==============================================================================
# +++ MOG - ATB System  (v 1.0) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de batalha de turnos em tempo real.
#==============================================================================

#==============================================================================
# ● 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
  #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 = 113
  # Ativar a janela de LOG, deixe desativado se desejar uma batalha mais
  # dinâmica.
  WAIT_LOG_WINDOW = true
  # 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
  # Tipo de posicionamento da Hud.
  # 0 - Posição fixa.
  # 1 - Posição baseado no valor X e Y do battler.
  AT_HUD_POSITION_TYPE = 0
  #Posição geral (Inicial) da Hud.
  AT_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   
end

$imported = {} if $imported.nil?
$imported[:mog_atb_system] = true

#==============================================================================
# ■ 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 !@subject.at_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
   attr_accessor :at_action
   
  #--------------------------------------------------------------------------
  # ● 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
       @at_action = nil
   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   
  
  #--------------------------------------------------------------------------
  # ● can AT?
  #--------------------------------------------------------------------------   
  def can_upd_at?
      return false if restriction >= 4
      return false if self.hp == 0
      return false if !self.at_cast.empty?
      return false if self.at_action != nil
      return true
  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

unless $imported[:mog_battle_hud_ex]

#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
  
  attr_accessor :cache_at_meter
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  alias mog_at_meter_initialize initialize
  def initialize
      mog_at_meter_initialize
      cache_atmeter
  end
  
  #--------------------------------------------------------------------------
  # ● Cache ATmeter
  #--------------------------------------------------------------------------      
  def cache_atmeter
      @cache_at_meter = []
      @cache_at_meter.push(Cache.system("Battle_AT_Meter"))
      @cache_at_meter.push(Cache.system("Battle_AT_Layout"))
  end
  
end

#==============================================================================
# ■ AT Meter
#==============================================================================
class AT_Meter
  
  include MOG_AT_SYSTEM
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  def initialize(actor)
      @actor = actor
      @flow_speed = 0
      if AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite?
         @x = AT_HUD_POSITION[0] +  @actor.screen_x rescue 0
         @y = AT_HUD_POSITION[1] +  @actor.screnn_y rescue 0
      else   
         @x = AT_HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)
         @y = AT_HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)        
      end
      pre_cache
      create_layout
      create_at_meter
  end
  
  #--------------------------------------------------------------------------
  # ● Pre Cache
  #--------------------------------------------------------------------------      
  def pre_cache
      @meter = $game_temp.cache_at_meter[0]
      @meter_cw = @meter.width / 3
      @meter_ch = @meter.height / 3
  end
  
  #--------------------------------------------------------------------------
  # ● Create Layout
  #--------------------------------------------------------------------------      
  def create_layout
      @layout = Sprite.new
      @layout.bitmap = $game_temp.cache_at_meter[1]
      @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.dispose
      @layout = nil
      @at_meter.bitmap.dispose
      @at_meter.dispose
  end  
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  def update
      return if @layout == nil
      at_position
      @flow_speed += 1
      if @flow_speed >= AT_METER_FLOW_SPEED
         @flow_speed = 0
         at_flow_update
      end
  end
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------   
  def at_position
      return unless AT_HUD_POSITION_TYPE == 1 and @actor.use_sprite?
      @x = AT_HUD_POSITION[0] +  @actor.screen_x rescue 0
      @y = AT_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 !@actor.at_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     
      @at_meter = []
      for i in $game_party.battle_members
          @at_meter.push(AT_Meter.new(i))
      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 = 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

end

end[/pre] 搜狗截图20140225220313.png
梦石
0
星屑
50
在线时间
444 小时
注册时间
2011-1-3
回帖
150

开拓者

发表于 2014-2-26 11:10:27 | 显示全部楼层
本帖最后由 漫漫人生路 于 2014-2-26 11:16 编辑

请将技能库里2号技能 防御 的速度修正值为0,或者按需求增大。其他技能出现这种缓慢情况的也请修改速度修正。
具体脚本在该脚本的 178行到188行,应该是这里吧.........

点评

谢谢!  发表于 2014-2-26 12:14

评分

参与人数 1星屑 +132 收起 理由
熊喵酱 + 132 认可答案

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部