자유게시판

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ Active Count Battle 2 - KGC_ActiveCountBattle2 ◆
#_/    ◇ Last update : 2008/08/12 ◇
#_/----------------------------------------------------------------------------
#_/  リアルタイム戦闘システム「Active Count Battle Ver.2 (ACB2)」を導入します。
#_/============================================================================
#_/  ※できるだけ [Main] のすぐ上に導入してください。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
module ACB2
  #   □■ 行動時の待機時間倍率設定【単位:%】 ■□

  # ◆通常攻撃
  ATTACK_WAIT = 100
  # ◆防御
  GUARD_WAIT  = 100
  # ◆スキル
  #  0 以下を指定すると、使用スキルに応じて自動生成。
  SKILL_WAIT  = 0
  # ◆アイテム
  ITEM_WAIT   = 50
  # ◆詠唱後
  #  詠唱が必要なスキルを使用した場合、スキルの待機時間にこの倍率をかける。
  CHANT_WAIT  = 50

  # ◆スキル詠唱
  #  false にすると詠唱無し。
  SKILL_CHANT = true
  # ◆詠唱スキルと見なす「魔力F」の値
  #  「魔力F」がこの値以上のスキルは詠唱が必要。
  CHANT_SKILL_INT_F = 1
  # ◆非詠唱スキルと見なす「攻撃力F」の値
  #  「攻撃力F」がこの値以上のスキルは詠唱しない。
  #  (≪魔法反射≫との併用を考えると、2 以上にするのがベター)
  NOT_CHANT_SKILL_ATK_F = 2
  # ◆詠唱時間倍率
  #  デフォルトの詠唱時間の倍率を百分率で指定。
  #  デフォルトの詠唱時間が 長すぎる or 短すぎる ときに変更。
  CHANT_TIME_REVISE = 100
  # ◆詠唱時間直接指定
  #  指定したIDのスキル詠唱時間を、基本値に対する百分率で指定。
  #  (指定しなかったスキルは自動的に詠唱時間を算出)
  #  直接指定すると、物理スキルを詠唱させることも可能。
  CHANT_TIME = []  # ←この行は消さずに、下に追加してください
  #  CHANT_TIME[10] = 80
  #  <↑例> スキルID:10 の詠唱時間を基本値の 0.8倍(80%) にする。
  # ◆ステートの詠唱時間指定
  #  指定したIDのステートになったときの詠唱時間を、基本値に対する百分率で指定。
  STATE_CHANT_TIME = []
  #  STATE_CHANT_TIME[15] = 25
  #  <↑例> ステートID:15 での詠唱時間を 1/4(25%) にする。


  #   □■ メッセージ・効果音設定 ■□

  # ◆ゲージMAX時 SE
  #  ("SEファイル名", Volume, Pitch)
  GAUGE_MAX_SE = RPG::AudioFile.new("105-Heal01", 100, 150)

  # ◆逃走中メッセージ
  #  nil にすると非表示になります。
  ESCAPE_MESSAGE      = "逃走中……"
  # ◆逃走不可メッセージ
  CANT_ESCAPE_MESSAGE = "逃げられない!!"
  # ◆逃走失敗メッセージ
  #  パーティコマンド用。
  ESCAPE_FAIL_MESSAGE = "回り込まれた!!"


  #   □■ 表示設定 ■□

  # ◆ ACB ゲージ画像
  #  "Graphics/Pictures" から読み込む。
  #  拡張子省略可。
  #  ACB_GAUGE = nil にすると、ゲージ非表示。
  ACB_GAUGE  = "gauge_acb2"

  # ◆ ACB ゲージ位置 [x, y]
  GAUGE_POSITION = [-12, 116]
  # ◆ ACB ゲージ長補正
  GAUGE_LENGTH   = 56

  # ◆ ACB ゲージを流す
  FLOW_GAUGE = true
  # ◆ ACB ゲージが流れる速度
  FLOW_SPEED = 4

  # ◆オーダーバー表示
  SHOW_ORDER_BAR = true
  # ◆オーダーバー描画位置
  #  [X座標, Y座標]
  ORDER_POSITION = [16, 2]
  # ◆オーダーアイコン位置補正
  #  [X座標, Y座標]
  #  X座標は、大きくするほどバーの中心から離れる。
  ORDER_ICON_POSITION = [6, 0]
  # ◆オーダーアイコン相対位置表示
  #  true にすると、バーの最下部が 0 、上部が max に相当。
  #  false にすると、ACBカウントで位置を設定。
  ORDER_ICON_POSITION_RELATIVE = false
  # ◆ウェイトエリア倍率
  #  基準値(100)に対する、ウェイトエリアの幅を百分率で指定。
  #  150 だと、通常の 1.5倍の待機時間までウェイトエリア内に収まる。
  #  ORDER_ICON_POSITION_RELATIVE = false のとき有効。
  WAIT_AREA_SCALE = 200
  # ◆待機時間予測を有効化
  #  コマンド選択時、行動後のウェイトエリア内での位置を予測。
  ORDER_PREDICT = true

  # ◆オーダーバー背景
  #  [フォルダ] Graphics/ACB/
  ORDER_BACK = "acb_order"
  # ◆アクター用オーダーアイコン
  #  【{i}…アクターID】
  ORDER_ICON_ACTOR = "acb_ai{i}"
  # ◆エネミー用オーダーアイコン
  #  【{i}…エネミーINDEX】
  ORDER_ICON_ENEMY = "acb_ei{i}"
  # ◆オーダーアイコン {i} の桁数
  ORDER_ICON_DIGITS = 2
  # ◆待機時間予測アイコン (通常)
  ORDER_ICON_PREDICT_NORMAL = "acb_predict"
  # ◆待機時間予測アイコン (詠唱)
  ORDER_ICON_PREDICT_CHANT  = "acb_predict_chant"


  #   □■ 動作設定 ■□

  # ◆ウェイトモード初期値
  #  0 .. フルアクティブ
  #  1 .. セミアクティブ
  #  2 .. ウェイト
  #  ゲーム中に $game_system.wait_mode で変更可能。
  INITIAL_WAIT_MODE = 0
  # ◆アクションウェイト初期設定
  #  true にすると、行動中は時間が止まる。
  #  ゲーム中に $game_system.action_wait で変更可能。
  INITIAL_ACTION_WAIT = false
  # ◆バトルスピード初期値
  #  10~1000
  #  数値が低いほど高速。
  #  ゲーム中に $game_system.battle_speed で変更可能。
  INITIAL_BATTLE_SPEED = 400
  # ◆アクターの素早さでバトルスピードを調整する
  ADJUST_BATTLE_SPEED = true
  # ◆アクターの素早さ基準値
  #  ADJUST_BATTLE_SPEED = false のときに使用。
  BASE_ACTOR_SPEED = 200

  # ◆ターン進行判定方法
  #  0 .. メンバー数に応じた時間が経過すると進行。
  #  1 .. 一人行動する度に進行。
  #  2 .. 敵味方を合わせて、行動可能者数と同じ回数行動すると進行。
  TURN_METHOD = 0
  # ◆スリップダメージ適用タイミング
  #  0 .. 行動後
  #  1 .. 全体ターン経過後
  SLIP_DAMAGE = 0
  # ◆コマンド入力中はディレイを無効化
  #  コマンド入力中はキャンセル効果を受けなくなる。
  INVALID_DELAY_INPUT = false

  # ◆逃走ボタン
  #  このボタンを押し続けると逃走。
  #  ESCAPE_BUTTON = nil にすると、逃走ボタンなし。
  ESCAPE_BUTTON  = Input::A
  # ◆「フルアクティブ」以外では、逃走ボタンによる逃走を無効化
  #  true にした場合は、パーティコマンド等を使用してください。
  ESCAPE_FA_ONLY = false
  # ◆逃走成功率補正値
  #  逃走に失敗するごとに、逃走成功率に加算。
  ESCAPE_PROB_REVISE = 20

  # ◆パーティコマンド切り替えボタン
  #  コマンド選択中にこのボタンを押すと、パーティコマンドに切り替わる。
  #  (パーティコマンド表示中はポーズ効果あり)
  #  PARTYCOMMAND_BUTTON = nil にすると、パーティコマンドなし。
  PARTYCOMMAND_BUTTON = Input::B

  # ◆入力アクター切り替えボタン
  #  このボタンを押すと、次のアクターにコマンド入力が移る。
  #  (ゲージの蓄積順に移動)
  CHANGE_INPUT_BUTTON = Input::X
  # ◆LR切り替えを使用する
  #  L,Rボタンを押すと、隣のアクターにコマンド入力が移る。
  #  (ゲージの蓄積順は無関係)
  USE_CHANGE_INPUT_NEIGHBOR = true
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["ActiveCountBattle"] = true

if $game_special_elements == nil
  $game_special_elements = {}
  $data_system = load_data("Data/System.rxdata")
end
if $game_special_states == nil
  $game_special_states = {}
  $data_states = load_data("Data/States.rxdata")
end
# ディレイ属性
$game_special_elements["acb_delay"] = /(?:(?:ディレイ)|(?:Delay))(d+)/i
# ディレイ耐性属性
$game_special_elements["acb_delay_resist"] =
  $data_system.elements.index("ディレイ耐性")
if $game_special_elements["acb_delay_resist"] == nil
  $game_special_elements["acb_delay_resist"] =
    $data_system.elements.index("Delay resistance")
end
# 詠唱時間ステート
$game_special_states["chant_time"] = /詠唱時間(d+)(%|%)?/i

#==============================================================================
# ■ Module_Graphics
#==============================================================================

module Graphics
  unless defined?(transition_interrupt_KGC)
  #--------------------------------------------------------------------------
  # ● トランジション実行
  #--------------------------------------------------------------------------
  class << Graphics
    alias transition_interrupt_KGC transition
  end
  def self.transition(duration = 8, filename = "", vague = 40)
    if @_interrupt_transition
      @_transition_duration = duration
      @_transition_filename = filename.dup
      @_transition_vague = vague
      return
    end

    transition_interrupt_KGC(duration, filename, vague)
  end
  #--------------------------------------------------------------------------
  # ● トランジション割り込み開始
  #--------------------------------------------------------------------------
  def self.start_interrupt_transition
    @_interrupt_transition = true
  end
  #--------------------------------------------------------------------------
  # ● トランジション割り込み終了
  #--------------------------------------------------------------------------
  def self.end_interrupt_transition
    if @_interrupt_transition
      @_interrupt_transition = nil
      transition(@_transition_duration, @_transition_filename,
        @_transition_vague)
      @_transition_duration = @_transition_filename = @_transition_vague = nil
    end
  end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Cache
#==============================================================================

module RPG::Cache
  def self.general(directory, filename, hue = 0)
    self.load_bitmap(directory, filename, hue)
  end
  def self.acb(filename, hue = 0)
    self.load_bitmap("Graphics/ACB/", filename, hue)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :base_speed                   # 基準スピード
  attr_accessor :base_acb_count               # 基本ACBカウント
  attr_accessor :turn_acb_count_max           # ターン計算用ACBカウント最大値
  attr_accessor :turn_acb_count_speed         # ターン計算用ACBカウント速度
  attr_accessor :interrupt_transition         # トランジション割り込み
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_ACB initialize
  def initialize
    initialize_KGC_ACB

    @base_speed = 500
    @base_acb_count = 500
    @turn_acb_count_max = 500
    @turn_acb_count_speed = 10
    @interrupt_transition = false
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージ最大量設定
  #--------------------------------------------------------------------------
  def set_turn_acb_count_max(speed)
    unless KGC::ACB2::ADJUST_BATTLE_SPEED
      speed = KGC::ACB2::BASE_ACTOR_SPEED
    end
    @base_speed = speed
    @base_acb_count = speed * $game_system.battle_speed / 4
    @turn_acb_count_max = speed * $game_system.battle_speed
    @turn_acb_count_speed = [speed, @turn_acb_count_max / 250].max
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :wait_mode                # 戦闘ウェイトモード
  attr_accessor :action_wait              # 行動待ち
  attr_accessor :battle_speed             # バトルスピード
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_ACB initialize
  def initialize
    initialize_KGC_ACB

    @wait_mode = KGC::ACB2::INITIAL_WAIT_MODE
    @action_wait = KGC::ACB2::INITIAL_ACTION_WAIT
    @battle_speed = KGC::ACB2::INITIAL_BATTLE_SPEED
  end
  #--------------------------------------------------------------------------
  # ● バトルスピード変更
  #--------------------------------------------------------------------------
  def battle_speed=(speed)
    @battle_speed = [[speed, 10].max, 1000].min
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :acb_gauge                # ACBゲージ蓄積量
  attr_accessor :acb_gauge_max            # ACBゲージ最大量
  attr_accessor :chant                    # 詠唱中フラグ
  attr_accessor :turn_count               # 固有ターン数
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_ACB initialize
  def initialize
    initialize_KGC_ACB

    @acb_gauge = 0
    @acb_gauge_max = 1000
    @chant = false
    @turn_count = 0
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージ操作
  #--------------------------------------------------------------------------
  def acb_gauge=(value)
    @acb_gauge = [[value, 0].max, @acb_gauge_max].min
  end
  #--------------------------------------------------------------------------
  # ● 詠唱中か否か
  #--------------------------------------------------------------------------
  def chant?
    return @chant
  end
  #--------------------------------------------------------------------------
  # ● 待機時間設定
  #--------------------------------------------------------------------------
  def set_acb_count
    n = calc_acb_count(@current_action)
    # ゲージを初期化
    @acb_gauge = 0
    @acb_gauge_max = [n, 1].max
    @chant = false
  end
  #--------------------------------------------------------------------------
  # ● 待機時間計算
  #--------------------------------------------------------------------------
  def calc_acb_count(action)
    n = $game_temp.base_acb_count
    # 行動内容で分岐
    case action.kind
    when 0  # 基本
      case action.basic
      when 0  # 攻撃
        n = n * KGC::ACB2::ATTACK_WAIT / 100
      when 1  # 防御
        n = n * KGC::ACB2::GUARD_WAIT / 100
      end
    when 1  # スキル
      if KGC::ACB2::SKILL_WAIT > 0
        n = n * KGC::ACB2::SKILL_WAIT / 100
      else
        # スキルの設定値から待機時間を算出
        skill = $data_skills[action.skill_id]
        all_f = skill.atk_f + skill.str_f + skill.dex_f +
          skill.agi_f + skill.int_f
        rate = skill.sp_cost + skill.power.abs + all_f / 8
        rate = Math.sqrt(rate) / 20.0 + 1.0
        n = Integer(n * rate)
      end
      # 詠唱判定
      if KGC::ACB2::SKILL_CHANT && self.chant?
        skill = $data_skills[action.skill_id]
        n = n * KGC::ACB2::CHANT_WAIT / 100
      end
    when 2  # アイテム
      n = n * KGC::ACB2::ITEM_WAIT / 100
    end
    return (n / self.agi)
  end
  #--------------------------------------------------------------------------
  # ● 詠唱時間設定
  #--------------------------------------------------------------------------
  def set_chant_count
    n = calc_chant_count(@current_action)
    # ゲージを初期化
    @acb_gauge = 0
    @acb_gauge_max = [n, 1].max
    @chant = true
  end
  #--------------------------------------------------------------------------
  # ● 詠唱時間計算
  #--------------------------------------------------------------------------
  def calc_chant_count(action)
    skill = $data_skills[action.skill_id]
    # 直接指定されている場合
    if KGC::ACB2::CHANT_TIME[skill.id] != nil
      chant_time = KGC::ACB2::CHANT_TIME[skill.id] *
        $game_temp.base_acb_count / (100 * self.int)
      return chant_time
    end

    # 基本詠唱時間
    base_time = 0
    if KGC::ACB2::CHANT_TIME[skill.id] != nil
      base_time = KGC::ACB2::CHANT_TIME[skill.id]
    elsif skill.power != 0
      n = skill.sp_cost + skill.power.abs + skill.int_f
      base_time = Math.sqrt(n) * 3.0
    else
      base_time = Math.sqrt(skill.sp_cost + skill.int_f) * 5.0
    end
    chant_time = (base_time.to_i * $game_temp.base_acb_count *
      KGC::ACB2::CHANT_TIME_REVISE) / (10000 * self.int)
    # 詠唱時間補正
    self.states.compact.each { |state|
      rate = -1
      if KGC::ACB2::STATE_CHANT_TIME[state] != nil
        rate = KGC::ACB2::STATE_CHANT_TIME[state]
      elsif $game_special_states["chant_time"] =~ $data_states[state].name
        rate = $1.to_i
      end
      if rate > 0
        chant_time = chant_time * [rate, 0].max / 100
      end
    }
    return chant_time
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● アクション作成
  #--------------------------------------------------------------------------
  def make_action
    # カレントアクションをクリア
    self.current_action.clear
    # 動けない場合
    return unless self.movable?
    # 現在有効なアクションを抽出
    available_actions = []
    rating_max = 0
    self.actions.each { |action|
      # ターン 条件確認
      n = @turn_count
      a = action.condition_turn_a
      b = action.condition_turn_b
      next if (b == 0 && n != a) || (b > 0 && (n < 1 || n < a || n % b != a % b))
      # HP 条件確認
      next if self.hp * 100.0 / self.maxhp > action.condition_hp
      # レベル 条件確認
      next if $game_party.max_level < action.condition_level
      # スイッチ 条件確認
      switch_id = action.condition_switch_id
      next if switch_id > 0 && $game_switches[switch_id] == false
      # 条件に該当 : このアクションを追加
      available_actions.push(action)
      rating_max = action.rating if action.rating > rating_max
    }
    # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
    ratings_total = 0
    available_actions.each { |action|
      if action.rating > rating_max - 3
        ratings_total += action.rating - (rating_max - 3)
      end
    }
    # レーティングの合計が 0 ではない場合
    if ratings_total > 0
      # 乱数を作成
      value = rand(ratings_total)
      # 作成した乱数に対応するものをカレントアクションに設定
      available_actions.each { |action|
        if action.rating > rating_max - 3
          if value < action.rating - (rating_max - 3)
            self.current_action.kind = action.kind
            self.current_action.basic = action.basic
            self.current_action.skill_id = action.skill_id
            self.current_action.decide_random_target_for_enemy
            return
          else
            value -= action.rating - (rating_max - 3)
          end
        end
      }
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Help
#==============================================================================

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● テキスト設定
  #     text  : ウィンドウに表示する文字列
  #     align : アラインメント (0..左揃え、1..中央揃え、2..右揃え)
  #--------------------------------------------------------------------------
  alias set_text_KGC_ACB set_text
  def set_text(text, align = 0)
    last_actor = @actor

    set_text_KGC_ACB(text, align)

    @actor = last_actor
  end
  #--------------------------------------------------------------------------
  # ● 表示文字列取得
  #--------------------------------------------------------------------------
  def text
    return @text
  end
  #--------------------------------------------------------------------------
  # ● リセット
  #--------------------------------------------------------------------------
  def reset
    @text = nil
    @actor = nil
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Item
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KGC_ACB refresh
  def refresh(itemkind = 0)
    if $imported["ItemGrouping"]
      refresh_KGC_ACB(itemkind)
    else
      refresh_KGC_ACB
    end

    Graphics.frame_reset
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KGC_ACB refresh
  def refresh
    refresh_KGC_ACB

    Graphics.frame_reset
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_ACB initialize
  def initialize
    @_acb_gauge_x = 0
    # ACB ゲージ作成
    create_acb_gauge_sprite
    # オーダーバー作成
    if KGC::ACB2::SHOW_ORDER_BAR
      create_order_bar_sprite
    end

    initialize_KGC_ACB

    @_acb_gauge_sprite.x = self.x
    @_acb_gauge_sprite.y = self.y
    @_acb_gauge_sprite.z = self.z
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージスプライト作成
  #--------------------------------------------------------------------------
  def create_acb_gauge_sprite(viewport = nil)
    if @_acb_gauge_sprite != nil
      sx = @_acb_gauge_sprite.x
      sy = @_acb_gauge_sprite.y
      sz = @_acb_gauge_sprite.z
      @_acb_gauge_sprite.bitmap.dispose
      @_acb_gauge_sprite.dispose
      @_acb_gauge_buffer.dispose
    else
      sx = sy = sz = 0
    end
    @_acb_gauge_sprite = Sprite.new(viewport)
    @_acb_gauge_sprite.bitmap = Bitmap.new(640, 160)
    @_acb_gauge_sprite.x = sx
    @_acb_gauge_sprite.y = sy
    @_acb_gauge_sprite.z = sz

    @_acb_gauge_buffer = Bitmap.new(
      get_parameter_width + KGC::ACB2::GAUGE_LENGTH, 64)
  end
  #--------------------------------------------------------------------------
  # ● オーダーバー作成
  #--------------------------------------------------------------------------
  def create_order_bar_sprite
    @actor_buf = $game_party.actors.dup
    @_order_icon_actor = []
    @_order_icon_enemy = []
    @_order_back_sprite = Sprite.new
    @_order_back_sprite.bitmap = RPG::Cache.acb(KGC::ACB2::ORDER_BACK)
    @_order_back_sprite.x = KGC::ACB2::ORDER_POSITION[0]
    @_order_back_sprite.y = KGC::ACB2::ORDER_POSITION[1]
    @_order_back_sprite.z = 1
    # アクター
    create_order_icon($game_party.actors, @_order_icon_actor,
      KGC::ACB2::ORDER_ICON_ACTOR, 0)
    # エネミー
    create_order_icon($game_troop.enemies, @_order_icon_enemy,
      KGC::ACB2::ORDER_ICON_ENEMY, 1)
    @_wait_area_height = RPG::Cache.acb(KGC::ACB2::ORDER_BACK).height - 32
    # 予測
    @_order_icon_predict = RPG::Sprite.new
    @_order_icon_predict.bitmap =
      RPG::Cache.acb(KGC::ACB2::ORDER_ICON_PREDICT_NORMAL)
    @_order_icon_predict.ox = @_order_icon_actor[0].ox
    @_order_icon_predict.x = @_order_icon_actor[0].x
    @_order_icon_predict.y = KGC::ACB2::ORDER_POSITION[1]
    @_order_icon_predict.z = 50
    @_order_icon_predict.visible = false
    @_order_icon_predict.blink_on
  end
  #--------------------------------------------------------------------------
  # ● オーダーアイコン作成
  #--------------------------------------------------------------------------
  def create_order_icon(battlers, icons, filename, type)
    ix = KGC::ACB2::ORDER_POSITION[0] + @_order_back_sprite.bitmap.width / 2
    case type
    when 0  # アクター
      ix -= KGC::ACB2::ORDER_ICON_POSITION[0]
      index_format = "battler.id"
    when 1  # エネミー
      ix += KGC::ACB2::ORDER_ICON_POSITION[0]
      index_format = "i + 1"
    end
    battlers.each_with_index { |battler, i|
      if battler != nil
        icons[i] = RPG::Sprite.new
        begin
          icons[i].bitmap = RPG::Cache.acb(
            filename.gsub(/{i}/i) {
              sprintf("%0*d", KGC::ACB2::ORDER_ICON_DIGITS, eval(index_format))
            }
          )
        rescue
          icons[i].bitmap = RPG::Cache.acb(filename.gsub(/{i}/i) {""})
        end
        icons[i].x = ix
        icons[i].blink_off
        if type == 0
          icons[i].ox = icons[i].bitmap.width
        else
          icons[i].ox = 0
        end
      else
        icons[i] = nil
      end
    }
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  alias dispose_KGC_ACB dispose
  def dispose
    @_acb_gauge_sprite.bitmap.dispose
    @_acb_gauge_sprite.dispose
    @_acb_gauge_buffer.dispose
    if KGC::ACB2::SHOW_ORDER_BAR
      @_order_back_sprite.bitmap.dispose
      @_order_back_sprite.dispose
      (@_order_icon_actor + @_order_icon_enemy).compact.each { |sprite|
        sprite.bitmap.dispose unless sprite.bitmap.disposed?
        sprite.dispose
      }
      @_order_icon_actor = nil
      @_order_icon_enemy = nil
      @_order_icon_predict.dispose
    end

    dispose_KGC_ACB
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KGC_ACB refresh
  def refresh
    refresh_KGC_ACB

    draw_acb_gauge_buffer(get_parameter_width)
    update_acb_gauge
  end
  #--------------------------------------------------------------------------
  # ● パラメータ表示幅取得
  #--------------------------------------------------------------------------
  unless method_defined?(:get_parameter_width)
  def get_parameter_width
    return 120
  end
  end
  #--------------------------------------------------------------------------
  # ● アクター間隔取得
  #--------------------------------------------------------------------------
  unless method_defined?(:get_actor_space)
  def get_actor_space
    return 160
  end
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージ用バッファ描画
  #--------------------------------------------------------------------------
  def draw_acb_gauge_buffer(width)
    @_acb_gauge_buffer.clear

    gauge = RPG::Cache.acb(KGC::ACB2::ACB_GAUGE)
    dw = width + KGC::ACB2::GAUGE_LENGTH
    draw_acb_gauge_back(@_acb_gauge_buffer, gauge, 0, 0, dw)
    draw_acb_gauge_fore(@_acb_gauge_buffer, gauge, 0, 32, dw)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_ACB update
  def update
    update_KGC_ACB

    # ACBゲージ更新
    if KGC::ACB2::FLOW_GAUGE
      flow_acb_gauge
    end
    update_acb_gauge
    # オーダーバー更新
    if KGC::ACB2::SHOW_ORDER_BAR && $game_temp.in_battle &&
        @_order_icon_actor != nil && @_order_icon_enemy != nil
      update_order_bar
    end
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージ更新
  #--------------------------------------------------------------------------
  def update_acb_gauge
    @_acb_gauge_sprite.bitmap.clear
    pw = get_parameter_width
    (0...$game_party.actors.size).each { |i|
      actor = $game_party.actors[i]
      actor_x = i * get_actor_space + 4
      draw_actor_acb_gauge(actor, actor_x, 0, pw)
    }
  end
  #--------------------------------------------------------------------------
  # ● ACBゲージを流す
  #--------------------------------------------------------------------------
  def flow_acb_gauge
    @_acb_gauge_x -= KGC::ACB2::FLOW_SPEED
    if @_acb_gauge_x < 0
      @_acb_gauge_x += 192
    end
  end
  #--------------------------------------------------------------------------
  # ● 予測アイコン位置設定
  #     wait_count : 予測待機時間
  #     chant      : 詠唱フラグ
  #--------------------------------------------------------------------------
  def set_predict_position(wait_count, chant = false)
    if !KGC::ACB2::SHOW_ORDER_BAR || !KGC::ACB2::ORDER_PREDICT
      return
    end

    if wait_count == nil
      @_order_icon_predict.visible = false
    else
      if chant
        @_order_icon_predict.bitmap =
          RPG::Cache.acb(KGC::ACB2::ORDER_ICON_PREDICT_CHANT)
      else
        @_order_icon_predict.bitmap =
          RPG::Cache.acb(KGC::ACB2::ORDER_ICON_PREDICT_NORMAL)
      end
      @_order_icon_predict.y = calc_order_icon_position_y(0, wait_count)
      @_order_icon_predict.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ● 予測アイコン位置リセット
  #--------------------------------------------------------------------------
  def reset_predict_position
    set_predict_position(nil)
  end
  #--------------------------------------------------------------------------
  # ● オーダーバー更新
  #--------------------------------------------------------------------------
  def update_order_bar
    # オーダーアイコン修復
    if @actor_buf != $game_party.actors
      restore_actor_order_icon
    end
    # アイコン更新
    update_order_bar_icon($game_party.actors, @_order_icon_actor)
    update_order_bar_icon($game_troop.enemies, @_order_icon_enemy)
    @_order_icon_predict.update
  end
  #--------------------------------------------------------------------------
  # ● アクターオーダーアイコン修復
  #--------------------------------------------------------------------------
  def restore_actor_order_icon
    # 破棄
    @_order_icon_actor.each { |icon|
      icon.dispose
    }
    # 再作成
    create_order_icon($game_party.actors, @_order_icon_actor,
      KGC::ACB2::ORDER_ICON_ACTOR, 0)
  end
  #--------------------------------------------------------------------------
  # ● エネミーオーダーアイコン修復
  #--------------------------------------------------------------------------
  def restore_enemy_order_icon
    # 破棄
    @_order_icon_enemy.each { |icon|
      icon.dispose
    }
    # 再作成
    create_order_icon($game_troop.enemies, @_order_icon_enemy,
      KGC::ACB2::ORDER_ICON_ENEMY, 1)
  end
  #--------------------------------------------------------------------------
  # ● オーダーバー アイコン更新
  #--------------------------------------------------------------------------
  def update_order_bar_icon(battlers, icons)
    # ソート
    orders = battlers.dup
    orders.sort! { |a, b|
      a.id - b.id
    }
    orders.sort! { |a, b|
      (a.acb_gauge * 1000 / a.acb_gauge_max) -
        (b.acb_gauge * 1000 / b.acb_gauge_max)
    }
    # 更新
    orders.each_with_index { |battler, i|
      icon = icons[battler.index]
      if icon == nil
        next
      elsif battler.dead?
        icon.visible = false
        next
      else
        icon.visible = true
      end
      icon.y = calc_order_icon_position_y(battler.acb_gauge,
        battler.acb_gauge_max)
      icon.z = i + 2
      if $scene.input_battler == battler
        # コマンド入力中
        icon.blink_on
        icon.y -= 8
        icon.z += 10
      elsif $scene.action_battlers.include?(battler)
        # 行動待機中
        icon.blink_off
        icon.y -= 16 + ($scene.action_battlers.index(battler) << 1)
        icon.z += 20 + $scene.action_battlers.index(battler)
      elsif $scene.action_battler == battler
        # 行動中
        icon.blink_on
        icon.y -= 24
        icon.z += 30
      else
        icon.blink_off
      end
      icon.update
    }
  end
  #--------------------------------------------------------------------------
  # ● オーダーアイコン Y 座標計算
  #--------------------------------------------------------------------------
  def calc_order_icon_position_y(count, count_max)
    n = KGC::ACB2::ORDER_POSITION[1] + KGC::ACB2::ORDER_ICON_POSITION[1] + 32
    temp_n = 0
    temp_y = (count_max - count) * @_wait_area_height
    if KGC::ACB2::ORDER_ICON_POSITION_RELATIVE
      # 相対位置
      temp_n = temp_y / count_max
    else
      # 絶対位置
      temp_n = temp_y / ($game_temp.base_acb_count / $game_temp.base_speed)
      temp_n = temp_n * 100 / KGC::ACB2::WAIT_AREA_SCALE
    end
    temp_n = [[temp_n, 0].max, @_wait_area_height].min
    return (n + temp_n)
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージの描画
  #--------------------------------------------------------------------------
  def draw_actor_acb_gauge(actor, x, y, width)
    if KGC::ACB2::ACB_GAUGE == nil
      return
    end
    bitmap = @_acb_gauge_sprite.bitmap
    gauge = RPG::Cache.acb(KGC::ACB2::ACB_GAUGE)
    nx = x + KGC::ACB2::GAUGE_POSITION[0]
    ny = y + KGC::ACB2::GAUGE_POSITION[1]
    nw = width + KGC::ACB2::GAUGE_LENGTH
    gauge_width = calc_acb_gauge_width(actor, nw)
    bitmap.blt(nx, ny, @_acb_gauge_buffer, Rect.new(0, 0, nw, 32))
    draw_acb_gauge_inside(bitmap, gauge, actor, nx, ny, nw, gauge_width)
    bitmap.blt(nx, ny, @_acb_gauge_buffer, Rect.new(0, 32, nw, 32))
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージ背景の描画
  #     bitmap : 描画先画像
  #     image  : ゲージ画像
  #     width  : ゲージ幅
  #--------------------------------------------------------------------------
  def draw_acb_gauge_back(bitmap, image, x, y, width)
    src_rect = Rect.new(0, 0, 32, 32)
    bitmap.blt(x, y, image, src_rect)
    src_rect.set(32, 0, 96, 32)
    dest_rect = Rect.new(x + 32, y, width - 64, 32)
    bitmap.stretch_blt(dest_rect, image, src_rect)
    src_rect.set(128, 0, 32, 32)
    bitmap.blt(x + width - 32, y, image, src_rect)
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージ内部の描画
  #     bitmap : 描画先画像
  #     image  : ゲージ画像
  #     actro  : アクター
  #     width  : ゲージ幅
  #     gauge_width : ゲージ内部の幅
  #--------------------------------------------------------------------------
  def draw_acb_gauge_inside(bitmap, image, actor, x, y, width, gauge_width)
    src_rect = Rect.new(@_acb_gauge_x, 32, 96, 32)
    if actor.chant?
      src_rect.y = 96
    end
    if gauge_width == width - 64
      src_rect.y = 64
    end
    src_rect.width = gauge_width * 96 / (width - 64)
    dest_rect = Rect.new(x + 32, y, gauge_width, 32)
    bitmap.stretch_blt(dest_rect, image, src_rect)
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージ前景の描画
  #     bitmap : 描画先画像
  #     image  : ゲージ画像
  #     width  : ゲージ幅
  #--------------------------------------------------------------------------
  def draw_acb_gauge_fore(bitmap, image, x, y, width)
    src_rect = Rect.new(160, 0, 32, 32)
    bitmap.blt(x, y, image, src_rect)
    src_rect.set(192, 0, 96, 32)
    dest_rect = Rect.new(x + 32, y, width - 64, 32)
    bitmap.stretch_blt(dest_rect, image, src_rect)
    src_rect.set(288, 0, 32, 32)
    bitmap.blt(x + width - 32, y, image, src_rect)
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージ幅の計算
  #--------------------------------------------------------------------------
  def calc_acb_gauge_width(actor, width)
    gw = actor.acb_gauge * (width - 64) / actor.acb_gauge_max
    return [[gw, 0].max, width - 64].min
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Interpreter (分割定義 4)
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # ● アクターの入れ替え
  #--------------------------------------------------------------------------
  alias command_129_KGC_ACB command_129
  def command_129
    if command_129_KGC_ACB
      # ACBカウント作成
      $game_actors[@parameters[0]].set_acb_count
      return true
    else
      return false
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Interpreter (分割定義 7)
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # ● アクションの強制
  #--------------------------------------------------------------------------
  def command_339
    # 戦闘中でなければ無視
    unless $game_temp.in_battle
      return true
    end
    # イテレータで処理 (便宜的なもので、複数になることはない)
    iterate_battler(@parameters[0], @parameters[1]) { |battler|
      next unless battler.exist?
      # アクションを設定
      battler.current_action.kind = @parameters[2]
      if battler.current_action.kind == 0
        battler.current_action.basic = @parameters[3]
      else
        battler.current_action.skill_id = @parameters[3]
      end
      # 行動対象を設定
      if @parameters[4] == -2
        if battler.is_a?(Game_Enemy)
          battler.current_action.decide_last_target_for_enemy
        else
          battler.current_action.decide_last_target_for_actor
        end
      elsif @parameters[4] == -1
        if battler.is_a?(Game_Enemy)
          battler.current_action.decide_random_target_for_enemy
        else
          battler.current_action.decide_random_target_for_actor
        end
      elsif @parameters[4] >= 0
        battler.current_action.target_index = @parameters[4]
      end
      # 強制フラグを設定
      battler.current_action.forcing = true
      # 強制行動
      battler.acb_gauge -= 1
      if $scene.input_battler == battler
        $scene.cancel_command_input(true)
      end
      $scene.input_battlers.delete(battler)
      $scene.action_battlers.delete(battler)
      # アクションが有効かつ [すぐに実行] の場合
      if battler.current_action.valid? && @parameters[5] == 1
        # ACBゲージ最大
        battler.acb_gauge = battler.acb_gauge_max - 1
        # インデックスを進める
        @index += 1
        # 終了
        return false
      end
    }
    # 継続
    return true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 1)
#==============================================================================

class Scene_Battle
  attr_accessor :input_battler, :action_battler, :input_battlers,
    :action_battlers
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias main_KGC_ACB main
  def main
    # ACB初期化
    initialize_acb
    # トランジション割り込み開始
    Graphics.start_interrupt_transition

    main_KGC_ACB

    @battler_help_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● ACB初期化
  #--------------------------------------------------------------------------
  def initialize_acb
    # トループを準備
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)

    # 基本ACBカウントを計算
    all_speed = 0
    $game_party.actors.each { |battler|
      if $imported["BattlerEffect"]
        battler.effect_reset
      end
      battler.blink = false
      all_speed += battler.agi
    }
    all_speed /= [$game_party.actors.size, 1].max
    $game_temp.set_turn_acb_count_max(all_speed)
    # ACBゲージを設定
    $game_party.actors.each { |battler|
      battler.turn_count = 0
      battler.set_acb_count
      battler.acb_gauge = rand(battler.acb_gauge_max * 2 / 3)
      battler.chant = false
    }
    # ACB各種データを初期化
    @input_battlers = []
    @action_battlers = []
    @input_battler = nil
    @action_battler = nil
    @turn_acb_count = 0
    @escape_count = 0
    @escape_prob_rev = 0
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_ACB update
  def update
    if @phase != 5
      @phase = 0
    end
    if $game_system.battle_interpreter.running?
      @event_running = true
    end

    update_KGC_ACB

    # パーティコマンド表示中は戻る
    if @party_command_window.active
      update_phase2
      return
    end
    # ウェイト中・イベント中は戻る
    if waiting? || $game_system.battle_interpreter.running?
      return
    end
    # リフレッシュ判定
    if @event_running
      @status_window.refresh
      @event_running = false
    end
    # ゲームオーバーの場合
    if $game_temp.gameover
      unless @spriteset.effect?
        # ゲームオーバー画面に切り替え
        $scene = Scene_Gameover.new
      end
      return
    end
    # アフターバトルフェーズの場合
    if @phase == 5
      #update_phase5
      return
    end

    # 逃走判定
    if !KGC::ACB2::ESCAPE_FA_ONLY || $game_system.wait_mode == 0
      update_escape
    end

    # ゲージ加算処理
    acb_add

    # コマンド入力者決定
    if !@input_battlers.empty? && @input_battler == nil && !@wait_on
      set_input_battler
    end
    # コマンド入力処理
    if @input_battler != nil
      @active_battler = @input_battler
      # コマンド入力開始直後はウィンドウ作成
      if @actor_command_window.opacity == 0
        phase3_setup_command_window
      end
      update_phase3
    end

    # 行動者決定
    if !@action_battlers.empty? && @action_battler == nil
      set_action_battler
    end
    # 行動処理
    if @action_battler != nil && !@spriteset.effect?
      @active_battler = @action_battler
      update_phase4
    end
  end
  #--------------------------------------------------------------------------
  # ● ウェイト中判定
  #--------------------------------------------------------------------------
  def waiting?
    action = @action_battler == nil && @wait_count > 0
    bonus = @bonus_wait != nil && @bonus_wait > 0
    preempt = @preempt_wait != nil && @preempt_wait > 0
    return action || bonus || preempt
  end
  #--------------------------------------------------------------------------
  # ● 逃走処理更新
  #--------------------------------------------------------------------------
  def update_escape
    if KGC::ACB2::ESCAPE_BUTTON == nil
      return
    end
    if Input.press?(KGC::ACB2::ESCAPE_BUTTON)
      @escaping = true
      # 逃走可能な場合
      if $game_temp.battle_can_escape && can_escape?
        # 逃走中メッセージを表示
        if !@help_window.visible && KGC::ACB2::ESCAPE_MESSAGE != nil
          @help_window.set_text("")
          @help_window.set_text(KGC::ACB2::ESCAPE_MESSAGE, 1)
        end
        # 逃走カウントを加算
        @escape_count += 1
        # 逃走完了判定
        if @escape_count >= $game_temp.turn_acb_count_max / 600
          @escape_count = 0
          update_phase2_escape
        end
      else
        # 逃走不可能メッセージ表示
        @help_window.set_text(KGC::ACB2::CANT_ESCAPE_MESSAGE, 1)
        @escape_count = 0
      end
    else
      if @escaping
        @escaping = false
        @help_window.set_text("")
        @help_window.visible = false
      end
      # 逃走していない場合はカウントを減らす
      @escape_count = [@escape_count - 1, 0].max
    end
  end
  #--------------------------------------------------------------------------
  # ● 逃走可能判定
  #--------------------------------------------------------------------------
  def can_escape?
    # 一人でも行動可能ならOK
    $game_party.actors.each { |a|
      if a.movable?
        return true
      end
    }
    return false
  end
  #--------------------------------------------------------------------------
  # ● コマンド入力者設定
  #--------------------------------------------------------------------------
  def set_input_battler
    @input_battler = @input_battlers.shift
    # 強制行動の場合
    if @input_battler.current_action.forcing ||
        @input_battler.restriction == 2 || @input_battler.restriction == 3
      if @input_battler.restriction == 2 || @input_battler.restriction == 3
        # アクションに攻撃を設定
        @input_battler.current_action.kind = 0
        @input_battler.current_action.basic = 0
      end
      # 行動バトラーに追加(入力解除)
      @action_battlers << @input_battler
      @input_battler = nil
    # コマンド入力可能判定
    elsif @input_battler.inputable?
      # ゲージMAX SE 演奏
      if KGC::ACB2::GAUGE_MAX_SE.is_a?(RPG::AudioFile)
        $game_system.se_play(KGC::ACB2::GAUGE_MAX_SE)
      else
        Audio.se_play("Audio/SE/" + KGC::ACB2::GAUGE_MAX_SE[0], KGC::ACB2::GAUGE_MAX_SE[1],
          KGC::ACB2::GAUGE_MAX_SE[2])
      end
      # 行動準備
      @actor_index = $game_party.actors.index(@input_battler)
      @input_battler.current_action.clear
      # 明滅エフェクト ON
      @input_battler.blink = true
    else
      # ACBゲージ初期化
      @input_battler.set_acb_count
      # 入力解除
      @input_battler = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 行動者決定処理
  #--------------------------------------------------------------------------
  def set_action_battler
    @action_battler = @action_battlers.shift
    # 行動不可能な場合
    if @action_battler.dead? || !@action_battler.movable?
      # 行動解除
      @action_battler.acb_gauge = 0
      @action_battler = nil
    else
      # アクター入れ替えで外された場合
      if @action_battler.is_a?(Game_Actor) &&
          !$game_party.actors.include?(@action_battler)
        # 行動解除
        @action_battler.set_acb_count
        @action_battler = nil
      else
        # 行動開始
        @active_battler = @action_battler
        start_phase4
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● ACB ゲージ加算
  #--------------------------------------------------------------------------
  def acb_add
    # バトルウェイト判定
    if battle_wait?
      return
    end

    if KGC::ACB2::TURN_METHOD == 0
      # ターン計算用カウント加算
      @turn_acb_count += $game_temp.turn_acb_count_speed
      # ターン進行
      if @turn_acb_count >= $game_temp.turn_acb_count_max
        progress_turn
      end
    end

    ($game_party.actors + $game_troop.enemies).each { |battler|
      # 行動不可能な場合
      if !battler.movable?
        # ACBゲージ初期化
        battler.acb_gauge = 0
        battler.chant = false
        next
      # 連携スキル発動中の場合
      elsif $imported["CooperationSkill"] && cooperation_exec?(battler)
        # ACBゲージ初期化
        battler.set_acb_count
        # 待機リストから削除
        @input_battlers.delete(battler)
        @action_battlers.delete(battler)
        next
      # 連続攻撃中の場合は飛ばす
      elsif $imported["EquipExtension"] && battler.is_a?(Game_Actor) &&
          battler.attack_count > 0
        next
      # 行動中なら飛ばす
      elsif @action_battler == battler
        next
      end
      # ゲージがMAXでない
      if battler.acb_gauge < battler.acb_gauge_max
        # ゲージ加算
        battler.acb_gauge += 1
        # ゲージがMAXになった場合
        if battler.acb_gauge == battler.acb_gauge_max
          # 固有ターン数加算
          battler.turn_count += 1
          # 強制アクションの場合
          if battler.current_action.forcing
            # 行動者リストに追加
            @action_battlers << battler
          else
            # アクション生成
            make_battler_action(battler)
          end
        end  # <- battler.acb_gauge == battler.acb_gauge_max
      end  # <- battler.acb_gauge < battler.acb_gauge_max
    }  # <- each
  end
  #--------------------------------------------------------------------------
  # ● バトルウェイト判定
  #--------------------------------------------------------------------------
  def battle_wait?
    # 「セミアクティブ」で、各種選択ウィンドウが開いている場合
    if $game_system.wait_mode == 1 &&
        (@skill_window != nil || @item_window != nil)
      return true
    # 「ウェイト」で、コマンド入力キャラがいる場合
    elsif $game_system.wait_mode == 2 && @input_battler != nil
      return true
    # 「セミアクティブ」または「ウェイト」で、行動待ちの場合
    elsif $game_system.wait_mode >= 1 && $game_system.action_wait &&
        @action_battler != nil
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ● ターン進行
  #--------------------------------------------------------------------------
  def progress_turn
    # ターン数カウント
    $game_temp.battle_turn += 1
    # バトルイベントの全ページを検索
    $data_troops[@troop_id].pages.each_with_index { |page, index|
      # このページのスパンが [ターン] の場合
      if page.span == 1
        # 実行済みフラグをクリア
        $game_temp.battle_event_flags[index] = false
      end
    }
    # ターン計算用カウントを初期化
    @turn_acb_count = 0
    # ボーナスゲージを導入している場合
    if $imported["BonusGauge"]
      # ボーナスレートを減らす
      $game_temp.bonus_rate -= 10
      $game_temp.bonus_rate = [$game_temp.bonus_rate, 0].max
    end
    ($game_party.actors + $game_troop.enemies).compact.each { |battler|
      # ステート自然解除
      battler.remove_states_auto
      # スリップダメージ
      if KGC::ACB2::SLIP_DAMAGE == 1 && battler.hp > 0 && battler.slip_damage?
        battler.slip_damage_effect
        battler.damage_pop = true
      end
    }
    # ステータスウィンドウをリフレッシュ
    @status_window.refresh if @action_battler == nil
    # バトルイベントをセットアップ
    setup_battle_event
  end
  #--------------------------------------------------------------------------
  # ● アクション生成
  #--------------------------------------------------------------------------
  def make_battler_action(battler)
    if battler.is_a?(Game_Actor)
      make_actor_action(battler)
    else
      make_enemy_action(battler)
    end
  end
  #--------------------------------------------------------------------------
  # ● アクション生成(アクター)
  #--------------------------------------------------------------------------
  def make_actor_action(battler)
    # 詠唱中の場合
    if battler.chant?
      # 行動者リストに追加
      @action_battlers << battler
    # コマンド入力可能な場合
    elsif battler.inputable?
      # コマンド入力リストに追加
      @input_battlers << battler
    else
      if battler.restriction == 2 || battler.restriction == 3
        # アクションに攻撃を設定
        battler.current_action.kind = 0
        battler.current_action.basic = 0
      end
      # 行動者リストに追加
      @action_battlers << battler
    end
  end
  #--------------------------------------------------------------------------
  # ● アクション生成(エネミー)
  #--------------------------------------------------------------------------
  def make_enemy_action(battler)
    # 詠唱中なら即行動
    if battler.chant?
      @action_battlers << battler
      return
    end

    i = 0
    loop {
      # アクション生成
      battler.make_action
      # 3回アクション生成に失敗した場合は無理矢理通常攻撃にする
      if i == 2
        battler.current_action.kind = 0
        battler.current_action.basic = 0
      end
      # アクションを実行不可能な場合
      if battler.current_action.kind == 1 &&
          !battler.skill_can_use?(battler.current_action.skill_id)
        i += 1
        # アクションを再生成
        next
      end
      break
    }
    if KGC::ACB2::SKILL_CHANT
      # 詠唱時間セット
      judge_chant(battler)
    else
      # 行動者リストに追加
      @action_battlers << battler
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 2)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias start_phase1_KGC_ACB start_phase1
  def start_phase1
    # バトラーヘルプウィンドウを作成
    @battler_help_window = Window_Help.new
    @battler_help_window.y = 256
    @battler_help_window.back_opacity = 160
    @battler_help_window.visible = false
    # エネミーのACBゲージを初期化
    $game_troop.enemies.each { |battler|
      battler.set_acb_count
      battler.acb_gauge = rand(battler.acb_gauge_max / 2)
      battler.chant = false
    }

    $game_temp.battle_main_phase = true
    @actor_command_window.opacity = 0
    if KGC::ACB2::SHOW_ORDER_BAR
      @status_window.restore_actor_order_icon
      @status_window.restore_enemy_order_icon
      @status_window.update_order_bar
    end

    @status_window.create_acb_gauge_sprite(@spriteset.viewport2)
    @status_window.refresh

    # トランジション割り込み終了
    Graphics.end_interrupt_transition

    start_phase1_KGC_ACB
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (パーティコマンドフェーズ)
  #--------------------------------------------------------------------------
  alias update_phase2_KGC_ACB update_phase2
  def update_phase2
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # パーティコマンドウィンドウのカーソル位置で分岐
      case @party_command_window.index
      when 0  # 戦う
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # アクターコマンドに戻す
        @party_command_window.active = false
        @party_command_window.visible = false
        @actor_command_window.active = true
        return
      when 1  # 逃げる
        # 逃走可能ではない場合
        unless $game_temp.battle_can_escape
          # ブザー SE を演奏
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # アクターコマンドに戻す
        @party_command_window.active = false
        @party_command_window.visible = false
        @actor_command_window.active = true
        # 逃走処理
        update_phase2_escape
        # 逃走失敗の場合
        if @escape_failed
          escape_fail_effect
        end
        return
      end
    end

    update_phase2_KGC_ACB
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  #--------------------------------------------------------------------------
  alias update_phase2_escape_KGC_ACB update_phase2_escape
  def update_phase2_escape(skill = nil)
    # 逃走スキルの場合は元の処理を実行
    if skill != nil
      update_phase2_escape_KGC_ACB(skill)
      return
    end

    @escape_failed = false
    # 素早さ平均値を計算
    enemies_agi = calc_agi_average($game_troop.enemies)
    actors_agi = calc_agi_average($game_party.actors)
    # 逃走判定
    prob = 50 * actors_agi / [enemies_agi, 1].max + @escape_prob_rev
    if rand(100) < prob
      # コマンド入力中のアクターがいる場合
      if @input_battler != nil
        dispose_actor_window
        disable_actor_command_window
        # アクターの明滅エフェクト OFF
        @input_battler.blink = false
      end
      # ヘルプウィンドウ消去
      @help_window.visible = false
      if @help_window2 != nil
        @help_window2.visible = false
      end
      # 逃走 SE を演奏
      $game_system.se_play($data_system.escape_se)
      # バトル開始前の BGM に戻す
      $game_system.bgm_play($game_temp.map_bgm)
      # バトル終了
      battle_end(1)
      return
    # 逃走失敗の場合
    else
      @escape_prob_rev += KGC::ACB2::ESCAPE_PROB_REVISE
      @escape_failed = true
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 平均素早さ計算
  #--------------------------------------------------------------------------
  def calc_agi_average(battlers)
    agi = n = 0
    battlers.each { |battler|
      if battler.exist?
        agi += battler.agi
        n += 1
      end
    }
    if n > 0
      agi /= n
    end
    return agi
  end
  #--------------------------------------------------------------------------
  # ● 逃走失敗効果
  #--------------------------------------------------------------------------
  def escape_fail_effect
    $game_party.actors.each { |actor|
      @input_battlers.delete(actor)
      @action_battlers.delete(actor)
      actor.current_action.clear
      actor.set_acb_count
    }
    cancel_command_input
    @help_window.set_text(KGC::ACB2::ESCAPE_FAIL_MESSAGE, 1)
  end
  #--------------------------------------------------------------------------
  # ● アクター用ウィンドウ解放
  #--------------------------------------------------------------------------
  def dispose_actor_window
    # エネミーアロー解放
    if @enemy_arrow != nil
      @enemy_arrow.dispose
      @enemy_arrow = nil
    end
    # アクターアロー解放
    if @actor_arrow != nil
      @actor_arrow.dispose
      @actor_arrow = nil
    end
    # スキルウィンドウ解放
    if @skill_window != nil
      @skill_window.dispose
      @skill_window = nil
    end
    # スキル分類ウィンドウ解放
    if @skill_group_window != nil
      @skill_group_window.dispose
      @skill_group_window = nil
    end
    # アイテムウィンドウ解放
    if @item_window != nil
      @item_window.dispose
      @item_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウ無効化
  #--------------------------------------------------------------------------
  def disable_actor_command_window
    if @actor_command_window != nil
      @actor_command_window.active = false
      @actor_command_window.visible = false
      @actor_command_window.opacity = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● アフターバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias start_phase5_KGC_ACB start_phase5
  def start_phase5
    # コマンド入力中のアクターがいる場合
    if @input_battler != nil
      dispose_actor_window
      disable_actor_command_window
      # アクターの明滅エフェクト OFF
      @input_battler.blink = false if @input_battler != nil
    end
    # ヘルプウィンドウ消去
    @help_window.visible = false
    @help_window2.visible = false if @help_window2 != nil

    if @phase == 5
      return
    end

    start_phase5_KGC_ACB
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 3)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 次のアクターのコマンド入力へ
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # 詠唱を行う場合
    if KGC::ACB2::SKILL_CHANT
      judge_chant(@active_battler)
    else
      # 行動者に追加
      @action_battlers << @active_battler
    end
    # アクターの明滅エフェクト OFF
    @active_battler.blink = false
    # アクターコマンドウィンドウを無効化
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @actor_command_window.opacity = 0
    # 初期化
    @input_battler = nil
    @actor_index = nil
    @active_battler = nil
    # 予測位置をリセット
    @status_window.reset_predict_position
  end
  #--------------------------------------------------------------------------
  # ● 詠唱判定
  #     battler : 判定するバトラー
  #--------------------------------------------------------------------------
  def judge_chant(battler)
    skill = nil
    if battler.current_action.kind == 1 && !battler.chant?
      skill = $data_skills[battler.current_action.skill_id]
    end
    # 詠唱が必要なスキルの場合
    if skill != nil && need_chant?(battler.current_action)
      # 詠唱時間設定
      battler.set_chant_count
    else
      # 行動者に追加
      @action_battlers << battler
    end
  end
  #--------------------------------------------------------------------------
  # ● 詠唱判定
  #     action : 判定するアクション
  #--------------------------------------------------------------------------
  def need_chant?(action)
    skill = $data_skills[action.skill_id]
    # 詠唱判定
    if action.kind == 1
      return (skill.int_f >= KGC::ACB2::CHANT_SKILL_INT_F &&
        skill.atk_f < KGC::ACB2::NOT_CHANT_SKILL_ATK_F)
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ● 前のアクターのコマンド入力へ
  #--------------------------------------------------------------------------
  def phase3_prior_actor
    # 何もしない
  end
  #--------------------------------------------------------------------------
  # ● コマンド入力状態解除
  #     delay : ディレイ効果で解除
  #--------------------------------------------------------------------------
  def cancel_command_input(delay = false)
    dispose_actor_window
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    if $imported["HelpExtension"]
      @help_window2.visible = false
    end
    # バトラーヘルプウィンドウを隠す
    @battler_help_window.reset
    @battler_help_window.visible = false
    # アクターコマンドウィンドウを無効化
    disable_actor_command_window
    # アクターの明滅エフェクト OFF
    @input_battler.blink = false
    # ACBゲージ初期化
    unless delay
      @input_battler.set_acb_count
    end
    # コマンド入力解除
    @input_battler = nil
    # 予測位置をリセット
    @status_window.reset_predict_position
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウのセットアップ
  #--------------------------------------------------------------------------
  unless $imported["SeparationCommand"]
  def phase3_setup_command_window
    # パーティコマンドウィンドウを無効化
    @party_command_window.active = false
    @party_command_window.visible = false
    # アクターコマンドウィンドウを解放
    if @actor_command_window != nil
      @actor_command_window.dispose
    end
    # アクターコマンドウィンドウを作成
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    # アクターコマンドウィンドウを有効化
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # アクターコマンドウィンドウの位置を設定
    @actor_command_window.x =
      [@active_battler.screen_x - 80,
      640 - @actor_command_window.width].min
    # インデックスを 0 に設定
    @actor_command_window.index = 0
  end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ)
  #--------------------------------------------------------------------------
  alias update_phase3_KGC_ACB update_phase3
  def update_phase3
    # 行動不可能になったらコマンド入力解除
    if @active_battler.current_action.forcing ||
        !@active_battler.inputable? ||
        @active_battler.restriction == 2 ||
        @active_battler.restriction == 3 ||
        !$game_party.actors.include?(@active_battler)
      # 強制行動ならば行動者に追加
      if @active_battler.current_action.forcing ||
          @active_battler.restriction == 2 ||
          @active_battler.restriction == 3
        if @active_battler.restriction == 2 || @active_battler.restriction == 3
          # アクションに攻撃を設定
          @active_battler.current_action.kind = 0
          @active_battler.current_action.basic = 0
        end
        @action_battlers << @active_battler
      end
      cancel_command_input
      return
    end

    update_phase3_KGC_ACB

    update_phase3_predict_acb_count
  end
  #--------------------------------------------------------------------------
  # ● 待機時間予測を更新
  #--------------------------------------------------------------------------
  def update_phase3_predict_acb_count
    if @active_battler == nil
      return
    end

    action = get_selecting_action
    if action.kind != 1 || action.skill_id > 0
      # 待機時間を算出
      n = 0
      chant_flag = need_chant?(action)
      if chant_flag
        n = @active_battler.calc_chant_count(action)
      else
        n = @active_battler.calc_acb_count(action)
      end
      @status_window.set_predict_position(n, chant_flag)
    else
      # 待機時間を予測できない場合はリセット
      @status_window.reset_predict_position
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  #--------------------------------------------------------------------------
  alias update_phase3_basic_command_KGC_ACB update_phase3_basic_command
  def update_phase3_basic_command
    # パーティコマンドボタンが押された場合
    if KGC::ACB2::PARTYCOMMAND_BUTTON != nil &&
        Input.trigger?(KGC::ACB2::PARTYCOMMAND_BUTTON)
      # パーティコマンドに切り替え
      @party_command_window.active = true
      @party_command_window.visible = true
      @actor_command_window.active = false
      return
    end
    # 切り替えボタンが押された場合
    if Input.trigger?(KGC::ACB2::CHANGE_INPUT_BUTTON)
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # コマンド入力者に追加
      @input_battlers << @active_battler
      # アクターの明滅エフェクト OFF
      @active_battler.blink = false
      # アクターコマンドウィンドウを無効化
      disable_actor_command_window
      # コマンド入力解除
      @input_battler = nil
      @actor_index = nil
      @active_battler = nil
      return
    end
    if KGC::ACB2::USE_CHANGE_INPUT_NEIGHBOR
      # L,R ボタンが押された場合
      if Input.trigger?(Input::L) || Input.trigger?(Input::R)
        # 隣のアクターへ移動
        $game_system.se_play($data_system.decision_se)
        battler = @active_battler
        @input_battlers << @active_battler
        @active_battler.blink = false
        disable_actor_command_window
        @input_battler = nil
        @actor_index = nil
        @active_battler = nil
        input_next_actor(battler, Input.trigger?(Input::L) ? -1 : 1)
        return
      end
    end

    update_phase3_basic_command_KGC_ACB
  end
  #--------------------------------------------------------------------------
  # ● 選択中のアクションを取得
  #--------------------------------------------------------------------------
  unless method_defined?(:get_selecting_action)
  def get_selecting_action(battler = @active_battler)
    action = Game_BattleAction.new
    case @actor_command_window.index
    when 0  # 攻撃
      action.kind = 0
      action.basic = 0
    when 1  # スキル
      action.kind = 1
      if @skill_window != nil && @skill_window.active
        skill = @skill_window.skill
        if skill != nil
          action.skill_id = skill.id
        end
      end
    when 2  # 防御
      action.kind = 0
      action.basic = 1
    when 3  # アイテム
      action.kind = 2
    end
    return action
  end
  end
  #--------------------------------------------------------------------------
  # ● 入力者を隣のアクターへ移動
  #--------------------------------------------------------------------------
  def input_next_actor(target, shift)
    # 隣のアクターを調べる
    index = $game_party.actors.index(target) + shift
    size = $game_party.actors.size
    if index < 0
      index += size
    elsif index >= size
      index -= size
    end
    next_battler = $game_party.actors[index]
    # 隣のアクターを優先指定
    if @input_battlers.include?(next_battler)
      @input_battlers.delete(next_battler)
      @input_battlers.unshift(next_battler)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  #--------------------------------------------------------------------------
  alias update_phase3_enemy_select_KGC_ACB update_phase3_enemy_select
  def update_phase3_enemy_select
    # 敵が存在しなくなった場合
    if enemy_none?
      # エネミーの選択を終了
      end_enemy_select
      return
    end

    update_phase3_enemy_select_KGC_ACB
  end
  #--------------------------------------------------------------------------
  # ● エネミー選択開始
  #--------------------------------------------------------------------------
  alias start_enemy_select_KGC_ACB start_enemy_select
  def start_enemy_select
    # 敵が存在しなくなった場合
    if enemy_none?
      # ブザー SE を演奏
      $game_system.se_play($data_system.buzzer_se)
      return
    end

    start_enemy_select_KGC_ACB

    # ヘルプウィンドウを設定
    @help_window.visible = false
    @enemy_arrow.help_window = @battler_help_window
  end
  #--------------------------------------------------------------------------
  # ● エネミー残存判定
  #--------------------------------------------------------------------------
  def enemy_none?
    $game_troop.enemies.each { |enemy|
      # 生存エネミーが存在
      unless enemy.dead?
        return false
      end
    }
    return true
  end
  #--------------------------------------------------------------------------
  # ● エネミー選択終了
  #--------------------------------------------------------------------------
  alias end_enemy_select_KGC_ACB end_enemy_select
  def end_enemy_select
    end_enemy_select_KGC_ACB

    # バトラーヘルプウィンドウを隠す
    @battler_help_window.reset
    @battler_help_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● アクター選択開始
  #--------------------------------------------------------------------------
  alias start_actor_select_KGC_ACB start_actor_select
  def start_actor_select
    start_actor_select_KGC_ACB

    # ヘルプウィンドウを設定
    @help_window.visible = false
    @actor_arrow.help_window = @battler_help_window
  end
  #--------------------------------------------------------------------------
  # ● アクター選択終了
  #--------------------------------------------------------------------------
  alias end_actor_select_KGC_ACB end_actor_select
  def end_actor_select
    end_actor_select_KGC_ACB

    # バトラーヘルプウィンドウを隠す
    @battler_help_window.reset
    @battler_help_window.visible = false
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 4)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メインフェーズ開始
  #--------------------------------------------------------------------------
  def start_phase4
    # ステップ 1 に移行
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # ヘルプウィンドウを隠す
    @help_window.visible = false
    # 勝利または敗北の場合 : メソッド終了
    return if judge
    # アニメーション ID およびコモンイベント ID を初期化
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # スリップダメージ
    if KGC::ACB2::SLIP_DAMAGE == 0 && @active_battler.hp > 0 &&
        @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
    if $imported["DelaySkill"] && @active_battler != nil
      # 遅延スキル処理
      for i in 0...@active_battler.delay_skills.size
        # 発動までのターン数を減らす
        @active_battler.delay_skills[i].turn_count -= 1
      end
    end
    # 何もしない場合
    if @active_battler.current_action.kind == 0 &&
        @active_battler.current_action.basic == 3
      # ステップ 6 に移行
      @phase4_step = 6
    else
      # ステップ 2 に移行
      @phase4_step = 2
    end
  end
  #--------------------------------------------------------------------------
  # ● 基本アクション 結果作成
  #--------------------------------------------------------------------------
  alias make_basic_action_result_KGC_ACB make_basic_action_result
  def make_basic_action_result
    make_basic_action_result_KGC_ACB

    # 攻撃の場合
    if @active_battler.current_action.basic == 0
      delay = calc_delay_damage(@active_battler.element_set)
      if delay > 0
        # ディレイ適用
        apply_delay_effect(delay)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● ディレイダメージ算出
  #--------------------------------------------------------------------------
  def calc_delay_damage(elements)
    delay = 0
    elements.each { |i|
      if $data_system.elements[i] =~ $game_special_elements["acb_delay"]
        delay += $1.to_i
      end
    }
    return delay
  end
  #--------------------------------------------------------------------------
  # ● ディレイ効果適用
  #--------------------------------------------------------------------------
  def apply_delay_effect(delay)
    @target_battlers.each { |target|
      # ダメージを与えていなければ次へ
      if !target.damage.is_a?(Numeric) || target.damage <= 0
        next
      end

      # ディレイ効果を計算
      acb_dmg = $game_temp.base_acb_count / target.agi
      if $game_special_elements["acb_delay_resist"] != nil
        acb_dmg =
          acb_dmg * target.element_rate(
          $game_special_elements["acb_delay_resist"]) / 100
      end
      acb_dmg = [acb_dmg * delay / 100, 0].max
      target.acb_gauge -= acb_dmg
      # コマンド入力キャンセル
      if !KGC::ACB2::INVALID_DELAY_INPUT && target.is_a?(Game_Actor) &&
          target == @input_battler && target.acb_gauge < target.acb_gauge_max
        cancel_command_input(true)
      end
      @input_battlers.delete(target)
      @action_battlers.delete(target)
    }
  end
  #--------------------------------------------------------------------------
  # ● スキルアクション 結果作成
  #--------------------------------------------------------------------------
  alias make_skill_action_result_KGC_ACB make_skill_action_result
  def make_skill_action_result
    # スキルを発動できない場合は通常攻撃に変更
    skill_id = @active_battler.current_action.skill_id
    unless @active_battler.skill_can_use?(skill_id)
      @active_battler.current_action.kind = 0
      @active_battler.current_action.basic = 0
      make_basic_action_result
      @skill_action_canceled = true
      return
    end

    make_skill_action_result_KGC_ACB

    delay = calc_delay_damage(@skill.element_set)
    if delay > 0
      # ディレイ適用
      apply_delay_effect(delay)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias update_phase4_step6_KGC_ACB update_phase4_step6
  def update_phase4_step6
    @help_window.reset

    update_phase4_step6_KGC_ACB

    if !($imported["CooperationSkill"] && @cooperation_skill_exec) &&
        !@additional_action_execute
      # バトルイベントをセットアップ
      setup_battle_event
      # ACBゲージ初期化
      @action_battler.set_acb_count
      # 行動解除
      @action_battler.current_action.forcing = false
      @action_battler = nil
      case KGC::ACB2::TURN_METHOD
      when 1
        # ターン進行
        progress_turn
      when 2
        # ターン進行判定
        @turn_acb_count += 1
        if @turn_acb_count >= movable_battler_count
          progress_turn
        end
      end
      # 戦闘終了判定
      judge
    end
  end
  #--------------------------------------------------------------------------
  # ● 行動可能者数取得
  #--------------------------------------------------------------------------
  def movable_battler_count
    n = 0
    # 行動可能者数を計算
    ($game_party.actors + $game_troop.enemies).each { |battler|
      if battler.movable?
        n += 1
      end
    }
    return n
  end
end

TAG •

Who's 라이네크

?

작품연대기

XP - 아인 스토리 (만들다가 어려워서 포기)

VX - 타르타로스 -운명의검- (모든것을 쏟아부엇지만 아버님이 삭제하셔서 멸망)

2003 - 타르타로스 -운명의검- Again (다시 2003으로 도전하지만 몇달만에 컴터를다시키니 자료증발)

XP - 엘티어즈 ~고대의병기~ (현재만드는중 이건 완성한다 ... 젠장..)

 

으으 자료복구할방법은 업는겝니까 ㅠㅠ

지금만드는건 완성시킨다 젠장

Comment '1'
  • ?
    Zero_Som 2009.08.14 18:55

    이분은 컴퓨터행성 루비나라에서 오신 ATB2세 라는 분입니다. 좀 유명하신분이죠 여기와서 이런 질문을 남기고 가네요.

     

    " 여기에 이런글을 쓰면 스크롤먹는 뻘글이라고 취급받나요? "


  1. 아방스 게시물 · 댓글 작성 규칙 (최근 수정일 2015.11.25)

    Date2012.07.17 Category공지 By완폐남™ Views41176
    read more
  2. AfreecaTV대정령의 "형 어디있냐고" 시청후기

    Date2013.06.21 Category잡담 Bysudoxe Views1375
    Read More
  3. Adblock Plus 좋군요.

    Date2013.12.30 Category막장 ByAlkaid Views608
    Read More
  4. ACE로 작업한 것 동영상으로 모아봄.

    Date2012.02.19 Category잡담 By지론아모스 Views2048
    Read More
  5. ace는 언제 풀릴까요ㄷㄷ

    Date2011.12.16 Category잡담 By첫번째굿바이 Views1592
    Read More
  6. ACE) 새로운 상점 스크립트를 만들어 봤어요

    Date2012.09.29 Category제작 영상 By77이알 Views929
    Read More
  7. ACE 출시 하루전!

    Date2011.12.14 Category잡담 By레오 Views1666
    Read More
  8. ACE 정품을 질렀습니다

    Date2014.02.26 Category잡담 ByYJSoft Views733
    Read More
  9. ace 와 함깨 돌이온 무리군

    Date2011.12.15 By무리군 Views1605
    Read More
  10. ACE 안녕... XP 안녕?

    Date2012.07.26 Category제작 스샷 By칸타모 Views2432
    Read More
  11. ACE 마을 좀 만들어 주실분~!!

    Date2012.02.18 By비비드 Views1530
    Read More
  12. ACB2 질문'ㅁ'

    Date2009.08.14 By라이네크 Views983
    Read More
  13. AAA로고 좋네여!

    Date2011.08.22 By엘리카 Views1034
    Read More
  14. A.V.A(아바)동영상을 글로제작

    Date2010.02.07 Category잡담 ByAssault Meteoric Star Views604
    Read More
  15. @_@;; VX가 노트북에만안되네?!

    Date2009.02.14 Category가입 By*PS인간 Views879
    Read More
  16. @_@

    Date2010.11.01 Category막장 By허걱 Views499
    Read More
  17. @'-'@

    Date2010.12.28 Category잡담 By휘파람개비 Views306
    Read More
  18. ?님

    Date2010.02.12 Category잡담 By아오키 Views669
    Read More
  19. ??? 무슨문제지....

    Date2009.07.25 By푸른에나 Views887
    Read More
  20. ?!!! 아방스짱.cafe24.com

    Date2012.08.23 Category잡담 By하늘바라KSND Views818
    Read More
  21. ?!

    Date2012.08.16 Category잡담 ByAssault_Meteoric_Star Views767
    Read More
목록
Board Pagination Prev 1 ... 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 ... 755 Next
/ 755