• [THÔNG BÁO] CẢNH BÁO LỪA ĐẢO MẠO DANH QUẢN TRỊ VIÊN
    Chào các thành viên GameVN,
    Dạo gần đây tình trạng lừa đảo scamming và phishing đang gia tăng. Ban quản trị GameVN xin lưu ý toàn bộ thành viên:
    KHÔNG/ ĐỪNG / CẤM cho bất kỳ ai tự xưng là quản trị viên của server vay tiền.
    Mọi hành vi lân la làm quen, tự tiện nhắn tin trên Discord, Facebook, Zalo hoặc các nền tảng mạng xã hội khác,
    núp bóng dưới danh nghĩa sinh hoạt của quản trị viên, đều có tỉ lệ rất, rất cao là lừa đảo.
    Nếu có tài khoản lạ add friend hoặc nhắn tin xin tiền dưới danh nghĩa admin:
    Block ngay
    Report ngay
    Không chuyển khoản, không cung cấp thông tin cá nhân


    Quản trị viên của forum và Discord server GameVN không có nhu cầu vay tiền thành viên.
    Không có lý do nào để admin chủ động kết bạn rồi xin tiền.
    Mọi thông báo chính thức chỉ được đăng trên kênh thông báo của server và topic chính thức trên forum.
    Tin nhắn riêng từ tài khoản lạ không phải thông báo của ban quản trị.
    Cảm ơn các bạn đã chú ý và cùng giữ cộng đồng an toàn.
    — Ban quản trị GameVN

    Tắt thông báo bằng nút X bên góc phải của bảng thông báo*

ABS (Action Battle system)

Nguyen_Kain

Quậy hết mình
Moderator
Tham gia ngày
28/5/04
Bài viết
1,299
Reaction score
0
Tạo một script có tên XRXS System và ABS đưa 2 cái này vào

Sưu tầm bởi "dude666" in Japanese Web

Mã:
#==============================================================================
# ■ XRXS.RGSS
#------------------------------------------------------------------------------
# Created by 桜雅 在土
#==============================================================================

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
 class Game_Battler
  # 「乗算属性修正」
  # ("特殊効果詰め合わせ"使用時は true にする必要があります。falseだと「最高倍率」)
  ELEMENT_CORRECT_BY_MULTI = true   
end
class Game_Actor < Game_Battler
  # 「スキル使用可能条件をスキルを習得しているか否かに依存しない」(falseだと依存)
  INDEPEND_SKILL_USABLE_ON_LEARNED = true
end
class Window_Skill < Window_Selectable
  # 「消費SP0を隠す」(falseにすると、"スキル名    : 0"とゼロを表示します)
  HIDE_ZERO_SP_COST = true
end
#==============================================================================
=begin
 前書き
    これはRGSSをXMS.RPGツクールXPスクリプトシェルフを
        より開発しやすくする為に作られた修正の詰め合わせです。
 コピー場所
    「Scene_Debugより下でMainより上。
     スクリプトシェルフ等を利用している場合はそれら全てより上。」
        ※Scene_Debug以上を書き換えている場合、
          それらの変更が無効になってしまう場合があります。
  修正内容---------------------------------------------------------------------
  
    修正/追加 部分
      Game_Battler         属性修正の計算「乗算属性修正」への対応
      Game_Actor           「スキル使用可能条件」への対応
                           オートステートの更新
    Window_Item          @column_maxへの対応
    Window_SKill         @column_maxへの対応
                           SP消費 0 を表示させない機能を搭載。
    Window_EquipItem     @column_maxへの対応
    Window_ShopSell      @column_maxへの対応
     Scene_Map            戦闘開始時のBGM停止を削除
                           同じBGMの場合は引き続きの演奏が出来る様に修正。
      Scene_Battle         バトルメッセージ処理軽減。
                           バトル終了時にMEをフェードアウト後に停止予約
      
    リファクタリング 部分
      Game_Actor           X位置のシフト値
      Window_Item          武器などの@dataへのプッシュ
      Window_MenuStatus    draw_actor_menu_status
      Window_EquipItem     武器などの@dataへのプッシュ
      Window_ShopSell      武器などの@dataへのプッシュ
      Window_BattleStatus  draw_actor_battle_status
      Scene_Equip          装備変更後のパラメータを取得 1~4
                           実際に装着
                           (追加)refresh軽量化
      Scene_Battle         make_basic_action_target_set
                           battle_exp
                           battle_gold
      
    追加モジュール
      XRXS_Check_ElementName_Set 属性名判定
      
  -------------------------------------------------------------修正内容ここまで
=end
#------------------------------------------------------------------------------
#
#
# ▽ 修正/追加 部分
#
#
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 属性修正の計算 + 倍率計算式
  #--------------------------------------------------------------------------
  alias xrxs_rgss_amendcustomize_elements_correct elements_correct
  def elements_correct(element_set)
    if ELEMENT_CORRECT_BY_MULTI
      # 無属性の場合 100 を返す
      return 100 if element_set == []
      # 与えられた属性のレートを全て乗算
      result = 100
      for i in element_set
        result *= self.element_rate(i) / 100.0
      end
      return result.to_i
    else
      return xrxs_rgss_amendcustomize_elements_correct
    end
  end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● スキルの使用可能判定 + 習得判定無効化設定可
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    # INDEPEND_SKILL_USABLE_ON_LEARNED が true であればスキル習得判定を飛ばす
    if not skill_learn?(skill_id) and not INDEPEND_SKILL_USABLE_ON_LEARNED
      return false
    end
    return super
  end
  #--------------------------------------------------------------------------
  # ● オートステートの更新
  #     old_armor : 外した防具
  #     new_armor : 装備した防具
  #--------------------------------------------------------------------------
  def update_auto_state(old_armor, new_armor)
    # 外した防具のオートステートを強制解除
    if old_armor != nil and old_armor.auto_state_id != 0
      # 外す防具のオートステートが、
      # 他の装備中の防具のオートステートと一致する場合、解除を行わない
      bool = armors_auto_state_include?(old_armor)
      unless bool
        remove_state(old_armor.auto_state_id, true)
      end
    end
    # 装備した防具のオートステートを強制付加
    if new_armor != nil and new_armor.auto_state_id != 0
      add_state(new_armor.auto_state_id, true)
    end
  end
  #--------------------------------------------------------------------------
  # ● 指定の防具のオートステートが現在装備中の防具のオートステートに含まれるか?
  #--------------------------------------------------------------------------
  def armors_auto_state_include?(old_armor)
    return false if old_armor.nil?
    bool  = false
    # 現在装備中の防具を取得
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    # 外された箇所を特定
    case old_armor
    when armor1
      current_armor = armor1
    when armor2
      current_armor = armor2
    when armor3
      current_armor = armor3
    when armor4
      current_armor = armor4
    end
    # 判定
    if current_armor != armor1 and !armor1.nil?
      bool |= (old_armor.auto_state_id == armor1.auto_state_id)
    end
    if current_armor != armor2 and !armor2.nil?
      bool |= (old_armor.auto_state_id == armor2.auto_state_id)
    end
    if current_armor != armor3 and !armor3.nil?
      bool |= (old_armor.auto_state_id == armor3.auto_state_id)
    end
    if current_armor != armor4 and !armor4.nil?
      bool |= (old_armor.auto_state_id == armor4.auto_state_id)
    end
    return bool
  end
end
#==============================================================================
# ■ Window_Item
#==============================================================================
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画 + @column_maxへの対応
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end
#==============================================================================
# ■ Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画 + @column_maxへの対応
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end
#==============================================================================
# ■ Window_ShopSell
#==============================================================================
class Window_ShopSell < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    # 売却可能なら通常文字色に、そうでないなら無効文字色に設定
    if item.price > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # ● バトルの呼び出し + 同BGM連続再生
  #--------------------------------------------------------------------------
  def call_battle
    # バトル呼び出しフラグをクリア
    $game_temp.battle_calling = false
    # メニュー呼び出しフラグをクリア
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    # エンカウント カウントを作成
    $game_player.make_encounter_count
    # マップ BGM を記憶し、BGM を停止
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # バトル開始 SE を演奏
    $game_system.se_play($data_system.battle_start_se)
    # バトル BGM を演奏
    $game_system.bgm_play($game_system.battle_bgm)
    # プレイヤーの姿勢を矯正
    $game_player.straighten
    # バトル画面に切り替え
    $scene = Scene_Battle.new
  end
end
    #$game_system.bgm_stop #←ココをコメントアウトしました
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● フレーム更新 + バトルメッセージ表示軽量化
  #--------------------------------------------------------------------------
  def update
    # バトルイベント実行中の場合
    if $game_system.battle_interpreter.running?
      # インタプリタを更新
      $game_system.battle_interpreter.update
      # アクションを強制されているバトラーが存在しない場合
      if $game_temp.forcing_battler == nil
        # バトルイベントの実行が終わった場合
        unless $game_system.battle_interpreter.running?
          # 戦闘継続の場合、バトルイベントのセットアップを再実行
          unless judge
            setup_battle_event
          end
        end
        # アフターバトルフェーズでなければ
        if @phase != 5 and (not $game_temp.message_window_showing) # ←ココ
          # ステータスウィンドウをリフレッシュ
          @status_window.refresh
        end
      end
    end
    # システム (タイマー)、画面を更新
    $game_system.update
    $game_screen.update
    # タイマーが 0 になった場合
    if $game_system.timer_working and $game_system.timer == 0
      # バトル中断
      $game_temp.battle_abort = true
    end
    # ウィンドウを更新
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # スプライトセットを更新
    @spriteset.update
    # トランジション処理中の場合
    if $game_temp.transition_processing
      # トランジション処理中フラグをクリア
      $game_temp.transition_processing = false
      # トランジション実行
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # メッセージウィンドウ表示中の場合
    if $game_temp.message_window_showing
      return
    end
    # エフェクト表示中の場合
    if @spriteset.effect?
      return
    end
    # ゲームオーバーの場合
    if $game_temp.gameover
      # ゲームオーバー画面に切り替え
      $scene = Scene_Gameover.new
      return
    end
    # タイトル画面に戻す場合
    if $game_temp.to_title
      # タイトル画面に切り替え
      $scene = Scene_Title.new
      return
    end
    # バトル中断の場合
    if $game_temp.battle_abort
      # バトル開始前の BGM に戻す
      $game_system.bgm_play($game_temp.map_bgm)
      # バトル終了
      battle_end(1)
      return
    end
    # ウェイト中の場合
    if @wait_count > 0
      # ウェイトカウントを減らす
      @wait_count -= 1
      return
    end
    # アクションを強制されているバトラーが存在せず、
    # かつバトルイベントが実行中の場合
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    # フェーズによって分岐
    case @phase
    when 1  # プレバトルフェーズ
      update_phase1
    when 2  # パーティコマンドフェーズ
      update_phase2
    when 3  # アクターコマンドフェーズ
      update_phase3
    when 4  # メインフェーズ
      update_phase4
    when 5  # アフターバトルフェーズ
      update_phase5
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル終了 + 戦闘勝利MEフェードアウト
  #--------------------------------------------------------------------------
  def battle_end(result)
    # 戦闘中フラグをクリア
    $game_temp.in_battle = false
    # パーティ全員のアクションをクリア
    $game_party.clear_actions
    # バトル用ステートを解除
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    # エネミーをクリア
    $game_troop.enemies.clear
    # バトル コールバックを呼ぶ
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
    # MEの停止
    Audio.me_fade(1000)
    # ここからスレッド
    @me_fade_thread = Thread.new do
      sleep(0.25)
      Audio.me_stop
      @me_fade_thread.kill
    end
    # ここまでスレッド    
    # マップ画面に切り替え
    $scene = Scene_Map.new
  end
end



#------------------------------------------------------------------------------
#
#
# ▽ リファクタリング 部分
#
#
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 防御の効果適用
  #--------------------------------------------------------------------------
  def guarding_effect(damage)
    return damage / 2
  end
  #--------------------------------------------------------------------------
  # ● 通常攻撃の効果適用
  #     attacker : 攻撃者 (バトラー)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # クリティカルフラグをクリア
    self.critical = false
    # 第一命中判定
    hit_result = (rand(100) < attacker.hit)
    # 命中の場合
    if hit_result == true
      # 基本ダメージを計算
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      # 属性修正
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # ダメージの符号が正の場合
      if self.damage > 0
        # クリティカル修正
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        # 防御修正
        if self.guarding?
          self.damage = guarding_effect(self.damage)
        end
      end
      # 分散
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # 命中の場合
    if hit_result == true
      # ステート衝撃解除
      remove_states_shock
      # HP からダメージを減算
      self.hp -= self.damage
      # ステート変化
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage = "Miss"
      # クリティカルフラグをクリア
      self.critical = false
    end
    # メソッド終了
    return true
  end
  #--------------------------------------------------------------------------
  # ● スキルの基本ダメージ計算
  #--------------------------------------------------------------------------
  def cals_skill_damage(user, skill)
    # 威力を計算
    power = skill.power + user.atk * skill.atk_f / 100
    if power > 0
      power -= self.pdef * skill.pdef_f / 200
      power -= self.mdef * skill.mdef_f / 200
      power = [power, 0].max
    end
    # 倍率を計算
    rate = 20
    rate += (user.str * skill.str_f / 100)
    rate += (user.dex * skill.dex_f / 100)
    rate += (user.agi * skill.agi_f / 100)
    rate += (user.int * skill.int_f / 100)
    # 基本ダメージを計算
    return power * rate / 20    
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # クリティカルフラグをクリア
    self.critical = false
    # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
    # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # メソッド終了
      return false
    end
    # 有効フラグをクリア
    effective = false
    # コモンイベント ID が有効の場合は有効フラグをセット
    effective |= skill.common_event_id > 0
    # 第一命中判定
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # 不確実なスキルの場合は有効フラグをセット
    effective |= hit < 100
    # 命中の場合
    if hit_result == true
      # スキルの基本ダメージの計算
      self.damage = cals_skill_damage(user, skill)
      # 属性修正
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # ダメージの符号が正の場合
      if self.damage > 0
        # 防御修正
        if self.guarding?
          self.damage = guarding_effect(self.damage)
        end
      end
      # 分散
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # 不確実なスキルの場合は有効フラグをセット
      effective |= hit < 100
    end
    # 命中の場合
    if hit_result == true
      # 威力 0 以外の物理攻撃の場合
      if skill.power != 0 and skill.atk_f > 0
        # ステート衝撃解除
        remove_states_shock
        # 有効フラグをセット
        effective = true
      end
      # HP からダメージを減算
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      # ステート変化
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      # 威力が 0 の場合
      if skill.power == 0
        # ダメージに空文字列を設定
        self.damage = ""
        # ステートに変化がない場合
        unless @state_changed
          # ダメージに "Miss" を設定
          self.damage = "Miss"
        end
      end
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage = "Miss"
    end
    # 戦闘中でない場合
    unless $game_temp.in_battle
      # ダメージに nil を設定
      self.damage = nil
    end
    # メソッド終了
    return effective
  end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得
  #--------------------------------------------------------------------------
  def screen_x
    # パーティ内の並び順から X 座標を計算して返す
    if self.index != nil
      return self.index * screen_x_shift + 80
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標のパーティ人数によるシフトの量
  #--------------------------------------------------------------------------
  def screen_x_shift
    return 160
  end
end
#==============================================================================
# ■ Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # ● 一行の高さ
  #--------------------------------------------------------------------------
  def row_height
    return 32
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の取得
  #--------------------------------------------------------------------------
  def top_row
    # ウィンドウ内容の転送元 Y 座標を、1 行の高さで割る
    return self.oy / row_height
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の設定
  #     row : 先頭に表示する行
  #--------------------------------------------------------------------------
  def top_row=(row)
    # row が 0 未満の場合は 0 に修正
    if row < 0
      row = 0
    end
    # row が row_max - 1 超の場合は row_max - 1 に修正
    if row > row_max - 1
      row = row_max - 1
    end
    # row に 1 行の高さを掛け、ウィンドウ内容の転送元 Y 座標とする
    self.oy = row * row_height
  end
end
#==============================================================================
# ■ Window_MenuStatus
#==============================================================================
class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 一行の高さ
  #--------------------------------------------------------------------------
  def row_height
    return 116
  end
  #--------------------------------------------------------------------------
  # ● 一人当たりの描写部分のサイズ
  #--------------------------------------------------------------------------
  def drawable_box_size
    return 96
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * row_height
      actor = $game_party.actors[i]
      draw_actor_menu_status(actor, x, y)
    end
  end
  #--------------------------------------------------------------------------
  # ● メニューステータス用アクターステータスの描写
  #--------------------------------------------------------------------------
  def draw_actor_menu_status(actor, x, y)
    # 描写可能なサイズを取得
    size = drawable_box_size
    # 描写
    draw_actor_graphic(actor, x - 40, y + size*5/6)
    draw_actor_name(actor, x, y)
    draw_actor_class(actor, x + 144, y)
    draw_actor_level(actor, x, y + size/2 - 16)
    draw_actor_state(actor, x + 90, y + size/2 - 16)
    draw_actor_exp(actor, x, y + size*5/6 - 16)
    draw_actor_hp(actor, x + 236, y + size/2 - 16)
    draw_actor_sp(actor, x + 236, y + size*5/6 - 16)
  end
  #--------------------------------------------------------------------------
  # ● カーソルの矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * row_height, self.width - 32, drawable_box_size)
    end
  end
end
#==============================================================================
# ■ Window_Item
#==============================================================================
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    get_data_of_draw_items
    # 項目数が 0 でなければビットマップを作成し、全項目を描画
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 描写するアイテム@dataの取得
  #--------------------------------------------------------------------------
  def get_data_of_draw_items
    # アイテムを追加
    set_own_item_data
    # 戦闘中以外なら武器と防具も追加
    unless $game_temp.in_battle
      set_own_weapon_data
      set_own_armor_data
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上のアイテムを @data に返す
  #--------------------------------------------------------------------------
  def set_own_item_data
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上の武器を @data に返す
  #--------------------------------------------------------------------------
  def set_own_weapon_data
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        @data.push($data_weapons[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上の防具を @data に返す
  #--------------------------------------------------------------------------
  def set_own_armor_data
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        @data.push($data_armors[i])
      end
    end
  end
end
#==============================================================================
# ■ Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 項目の描画 + @column_maxへの対応 + 「SP消費0を隠す」 + リファクタリング
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    sp_cost = get_sp_cost(skill)
    if sp_cost > 0 or !HIDE_ZERO_SP_COST
      self.contents.draw_text(x + 232, y, 48, 32, sp_cost.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● スキルの消費SPの値の取得
  #--------------------------------------------------------------------------
  def get_sp_cost(skill)
    return skill.sp_cost
  end
end
#==============================================================================
# ■ Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # 装備可能な武器を追加
    if @equip_type == 0
      set_equipable_weapon_data(@actor.class_id)
    end
    # 装備可能な防具を追加
    if @equip_type != 0
      set_equipable_armor_data(@actor.class_id)
    end
    # 空白を追加
    @data.push(nil)
    # ビットマップを作成し、全項目を描画
    @item_max = @data.size
    self.contents = Bitmap.new(width - 32, row_max * 32)
    for i in 0...@item_max-1
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 指定クラスが装備可能、かつ所有している武器を @data に返す
  #--------------------------------------------------------------------------
  def set_equipable_weapon_data(class_id)
    weapon_set = $data_classes[class_id].weapon_set
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
        @data.push($data_weapons[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 指定クラスが装備可能、かつ所有している防具を @data に返す
  #--------------------------------------------------------------------------
  def set_equipable_armor_data(class_id)
    armor_set = $data_classes[class_id].armor_set
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0 and armor_set.include?(i)
        if $data_armors[i].kind == @equip_type-1
          @data.push($data_armors[i])
        end
      end
    end
  end
end
#==============================================================================
# ■ Window_ShopSell
#==============================================================================
class Window_ShopSell < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    set_own_item_data
    set_own_weapon_data
    set_own_armor_data
    # 項目数が 0 でなければビットマップを作成し、全項目を描画
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上のアイテムを @data に返す
  #--------------------------------------------------------------------------
  def set_own_item_data
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上の武器を @data に返す
  #--------------------------------------------------------------------------
  def set_own_weapon_data
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        @data.push($data_weapons[i])
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 所有数が 1 以上の防具を @data に返す
  #--------------------------------------------------------------------------
  def set_own_armor_data
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        @data.push($data_armors[i])
      end
    end
  end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      x = i * drawable_x_shift + 4
      y = 0
      draw_actor_battle_status(actor, x, y, @level_up_flags[i])
    end
  end
  #--------------------------------------------------------------------------
  # ● 一人当たりの描写スペース
  #--------------------------------------------------------------------------
  def drawable_space
    return 120
  end
  #--------------------------------------------------------------------------
  # ● 一人当たりの描写間隔
  #--------------------------------------------------------------------------
  def drawable_x_shift
    return 160
  end
  #--------------------------------------------------------------------------
  # ● バトルステータス用アクターステータスの描写
  #--------------------------------------------------------------------------
  def draw_actor_battle_status(actor, x, y, level_up_flag = false)
    max_width = drawable_space
    draw_actor_name(actor, x, y)
    draw_actor_hp(actor, x, y + 32, max_width)
    draw_actor_sp(actor, x, y + 64, max_width)
    if level_up_flag
      self.contents.font.color = normal_color
      self.contents.draw_text(x, y + 96, max_width, 32, "LEVEL UP!")
    else
      draw_actor_state(actor, x, y + 96)
    end
  end
end
#==============================================================================
# ■ Scene_Equip
#==============================================================================
class Scene_Equip
  #--------------------------------------------------------------------------
  # ● リフレッシュ + 軽量化処理
  #--------------------------------------------------------------------------
  def refresh
    # アイテムウィンドウの可視状態設定
    @item_window1.visible = (@right_window.index == 0)
    @item_window2.visible = (@right_window.index == 1)
    @item_window3.visible = (@right_window.index == 2)
    @item_window4.visible = (@right_window.index == 3)
    @item_window5.visible = (@right_window.index == 4)
    # 現在装備中のアイテムを取得
    item1 = @right_window.item
    # 現在のアイテムウィンドウを @item_window に設定
    case @right_window.index
    when 0
      @item_window = @item_window1
    when 1
      @item_window = @item_window2
    when 2
      @item_window = @item_window3
    when 3
      @item_window = @item_window4
    when 4
      @item_window = @item_window5
    end
    # ライトウィンドウがアクティブの場合
    if @right_window.active
      # 装備変更後のパラメータを消去
      @left_window.set_new_parameters(nil, nil, nil)
    end
    # アイテムウィンドウがアクティブの場合
    if @item_window.active
      # カーソル位置が変わっていなければリターン
      return if @item_window_cursor == @item_window.index
      @item_window_cursor = @item_window.index
      after_equip_parameter # ▽ 装備変更後のパラメータを取得 1~2へ。
    end
  end
  #--------------------------------------------------------------------------
  # ● 装備変更後のパラメータを取得 1~4
  #--------------------------------------------------------------------------
  def after_equip_parameter
    # 現在選択中のアイテムを取得
    item2 = @item_window.item
    # 装備を変更
    last_hp = @actor.hp
    last_sp = @actor.sp
    @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
    # 装備変更後のパラメータを取得
    after_equip_parameter_phase2
    # 現在装備中のアイテムを取得
    item1 = @right_window.item
    # 装備を戻す
    @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
    @actor.hp = last_hp
    @actor.sp = last_sp
    # レフトウィンドウに描画
    after_equip_parameter_phase4
  end
  def after_equip_parameter_phase2
    # 装備変更後のパラメータを取得
    @new_atk = @actor.atk
    @new_pdef = @actor.pdef
    @new_mdef = @actor.mdef
  end
  def after_equip_parameter_phase4
    # レフトウィンドウに描画
    @left_window.set_new_parameters(@new_atk, @new_pdef, @new_mdef)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_item
    # B ボタンが押された場合
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      # ライトウィンドウをアクティブ化
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    end
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # 装備 SE を演奏
      $game_system.se_play($data_system.equip_se)
      # 実際に装着
      update_item_do_equip
      # ライトウィンドウをアクティブ化
      @right_window.active = true
      @item_window.active = false
      @item_window.index = -1
      # ライトウィンドウ、アイテムウィンドウの内容を再作成
      @right_window.refresh
      @item_window.refresh
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 実際に装着
  #--------------------------------------------------------------------------
  def update_item_do_equip
    # アイテムウィンドウで現在選択されているデータを取得
    item = @item_window.item
    # 装備を変更
    @actor.equip(@right_window.index, item == nil ? 0 : item.id)    
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウのセットアップ
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # パーティコマンドウィンドウを無効化
    @party_command_window.active = false
    @party_command_window.visible = false
    # アクターコマンドウィンドウを有効化
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # アクターコマンドウィンドウの位置を設定
    @actor_command_window.x = [@actor_index * phase3_setup_command_window_x_shift, 640-@actor_command_window.width].min
    # インデックスを 0 に設定
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウのXシフト量
  #--------------------------------------------------------------------------
  def phase3_setup_command_window_x_shift
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 基本アクション 結果作成
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # 攻撃の場合
    if @active_battler.current_action.basic == 0
      # アニメーション ID を設定
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # ターゲット配列の取得
      make_basic_action_target_set
      # 通常攻撃の効果を適用
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end
    # 防御の場合
    if @active_battler.current_action.basic == 1
      # ヘルプウィンドウに "防御" を表示
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # 逃げるの場合
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # ヘルプウィンドウに "逃げる" を表示
      @help_window.set_text("逃げる", 1)
      # 逃げる
      @active_battler.escape
      return
    end
    # 何もしないの場合
    if @active_battler.current_action.basic == 3
      # アクション強制対象のバトラーをクリア
      $game_temp.forcing_battler = nil
      # ステップ 1 に移行
      @phase4_step = 1
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 基本アクションのターゲット配列作成
  #--------------------------------------------------------------------------
  def make_basic_action_target_set
    # 行動側バトラーがエネミーの場合
    if @active_battler.is_a?(Game_Enemy)
      if @active_battler.restriction == 3
        target = $game_troop.random_target_enemy
      elsif @active_battler.restriction == 2
        target = $game_party.random_target_actor
      else
        index = @active_battler.current_action.target_index
        target = $game_party.smooth_target_actor(index)
      end
    end
    # 行動側バトラーがアクターの場合
    if @active_battler.is_a?(Game_Actor)
      if @active_battler.restriction == 3
        target = $game_party.random_target_actor
      elsif @active_battler.restriction == 2
        target = $game_troop.random_target_enemy
      else
        index = @active_battler.current_action.target_index
        target = $game_troop.smooth_target_enemy(index)
      end
    end
    # 対象側バトラーの配列を設定
    @target_battlers =  [target]
  end
  #--------------------------------------------------------------------------
  # ● スキルアクション 結果作成
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # スキルを取得
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # 強制アクションでなければ
    unless @active_battler.current_action.forcing
      # SP 切れなどで使用できなくなった場合
      unless @active_battler.skill_can_use?(@skill.id)
        # アクション強制対象のバトラーをクリア
        $game_temp.forcing_battler = nil
        # ステップ 1 に移行
        @phase4_step = 1
        return
      end
    end
    # SP 消費
    sp_cost = get_sp_cost(@skill)
    @active_battler.sp -= sp_cost
    # ステータスウィンドウをリフレッシュ
    @status_window.refresh
    # ヘルプウィンドウにスキル名を表示
    @help_window.set_text(@skill.name, 1)
    # アニメーション ID を設定
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # コモンイベント ID を設定
    @common_event_id = @skill.common_event_id
    # 対象側バトラーを設定
    set_target_battlers(@skill.scope)
    # スキルの効果を適用
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
  #--------------------------------------------------------------------------
  # ● スキルの消費SPの値の取得
  #--------------------------------------------------------------------------
  def get_sp_cost(skill)
    return skill.sp_cost
  end
  #--------------------------------------------------------------------------
  # ● アフターバトルフェーズ開始
  #--------------------------------------------------------------------------
  def start_phase5
    # フェーズ 5 に移行
    @phase = 5
    # バトル終了 ME を演奏
    $game_system.me_play($game_system.battle_end_me)
    # バトル開始前の BGM に戻す
    $game_system.bgm_play($game_temp.map_bgm)
    # EXP、ゴールド、トレジャーを初期化
    exp = 0
    gold = 0
    treasures = []
    # 獲得EXPを追加
    exp += battle_exp
    # 獲得ゴールドを追加
    gold += battle_gold
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # トレジャー出現判定
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # トレジャーの数を 6 個までに限定
    treasures = treasures[0..5]
    # EXP 獲得
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # ゴールド獲得
    $game_party.gain_gold(gold)
    # トレジャー獲得
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # バトルリザルトウィンドウを作成
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # ウェイトカウントを設定
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # ● 獲得する戦闘経験値の取得
  #--------------------------------------------------------------------------
  def battle_exp
    bexp = 0
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # 獲得を追加
        bexp += enemy.exp
      end
    end
    return bexp
  end
  #--------------------------------------------------------------------------
  # ● 獲得する戦闘金の取得
  #--------------------------------------------------------------------------
  def battle_gold
    bgold = 0
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # 獲得を追加
        bgold += enemy.gold
      end
    end
    return bgold
  end
end



#------------------------------------------------------------------------------
#
#
# ▽ 追加モジュール
#
#
#==============================================================================
# ◇ 付加属性名称判定モジュール
#==============================================================================
module XRXS_Check_ElementName_Set
  #--------------------------------------------------------------------------
  # ● スキルが指定名の属性を持つか判定
  #--------------------------------------------------------------------------
  def skill_element_include?(skill, element_name)
    return [false, 0, 0] unless skill.is_a?(RPG::Skill)
    returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
    for i in skill.element_set
      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
        returnar[0] = true
        if $2 == nil
          returnar[1] += $1.to_i
        else
          returnar[2] += $1.to_i
        end
      end
    end
    return returnar
  end
  #--------------------------------------------------------------------------
  # ● アイテムが指定名の属性を持つか判定
  #--------------------------------------------------------------------------
  def item_element_include?(item, element_name)
    return [false, 0, 0] unless item.is_a?(RPG::Item)
    returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
    for i in item.element_set
      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
        returnar[0] = true
        if $2 == nil
          returnar[1] += $1.to_i
        else
          returnar[2] += $1.to_i
        end
      end
    end
    return returnar
  end
  #--------------------------------------------------------------------------
  # ● 指定IDの武器が指定名の属性を持つか判定
  #--------------------------------------------------------------------------
  def weapon_id_element_include?(weapon_id, element_name)
    return [false, 0, 0] if weapon_id == nil or weapon_id <= 0
    returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
    for i in $data_weapons[weapon_id].element_set
      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
        returnar[0] = true
        if $2 == nil
          returnar[1] += $1.to_i
        else
          returnar[2] += $1.to_i
        end
      end
    end
    return returnar
  end
  #--------------------------------------------------------------------------
  # ● 防具が指定名の属性を持つか判定
  #--------------------------------------------------------------------------
  def armor_element_include?(armor, element_name)
    returnar = [false, 0, 0] # 存在したか?, 固定値の合計、%値の合計
    return returnar unless armor.is_a?(RPG::Armor)
    for i in armor.guard_element_set
      if $data_system.elements[i] =~ /#{element_name}([+-]?[0-9]+)?(%)?/
        returnar[0] = true
        if $2 == nil
          returnar[1] += $1.to_i
        else
          returnar[2] += $1.to_i
        end
      end
    end
    return returnar
  end
  #--------------------------------------------------------------------------
  # ● 防具が指定名の属性を持つ場合その後に付く接尾テキストを取得
  #--------------------------------------------------------------------------
  def armor_element_suftext(armor, element_name)
    return nil unless armor.is_a?(RPG::Armor)
    for i in armor.guard_element_set
      if $data_system.elements[i] =~ /#{element_name}(.*)/
        return $1
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # ● アクターが指定名の属性を持つ武器を装備しているかか判定
  #--------------------------------------------------------------------------
  def equip_weapon_element_include?(actor, element_name)
    return [false, 0, 0] unless actor.is_a?(Game_Actor)
    return [false, 0, 0] if actor.weapon_id == nil or actor.weapon_id <= 0
    bool = false
    one_total = two_total = 0
    # ここでもdup補正
    current_weapon = $data_weapons[actor.weapon_id].dup
    # ウェポンプロパティXC.が導入されている場合
    if $xrxs24_weapon_property_system_work
      for i in [PROPERTY_ELEMENT_GRANT_1st, PROPERTY_ELEMENT_GRANT_2nd,
                PROPERTY_ELEMENT_GRANT_3rd, PROPERTY_ELEMENT_GRANT_4th]
        current_weapon.element_set.push(i) if i != 0
      end
    end
    # 判定
    for i in current_weapon.element_set
      if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
        if $2 == nil
          one_total += $1.to_i
        else
          two_total += $1.to_i          
        end
        bool = true
      end
    end
    # ウェポンプロパティXC.が導入されている場合
    if $xrxs24_weapon_property_system_work
      for i in [PROPERTY_ELEMENT_GRANT_1st, PROPERTY_ELEMENT_GRANT_2nd,
                PROPERTY_ELEMENT_GRANT_3rd, PROPERTY_ELEMENT_GRANT_4th]
        if $data_system.elements[actor.weapon_property[i]] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
          if $2 == nil
            one_total += $1.to_i
          else
            two_total += $1.to_i
          end
          bool =  true
        end
      end
    end
    # 存在したか、%無き数値の合計、%有る数値の合計 を返す
    return [bool, one_total, two_total]
  end
  #--------------------------------------------------------------------------
  # ● アクターが指定名の属性を持つ武器/防具を装備中か判定 数値の合計も保持
  #--------------------------------------------------------------------------
  def actor_element_equip?(actor, element_name)
    return [false, 0, 0] unless actor.is_a?(Game_Actor)
    weapon = $data_weapons[actor.weapon_id]
    armor1 = $data_armors[actor.armor1_id]
    armor2 = $data_armors[actor.armor2_id]
    armor3 = $data_armors[actor.armor3_id]
    armor4 = $data_armors[actor.armor4_id]
    bool = false
    one_total = two_total = 0
    # 武器
    returnar = equip_weapon_element_include?(actor, element_name)
    bool |= returnar[0]
    one_total += returnar[1].to_i
    two_total += returnar[2].to_i
    # 盾
    returnar = armor_element_include?(armor1, element_name)
    bool |= returnar[0]
    one_total += returnar[1].to_i
    two_total += returnar[2].to_i
    # 頭防具
    returnar = armor_element_include?(armor2, element_name)
    bool |= returnar[0]
    one_total += returnar[1].to_i
    two_total += returnar[2].to_i
    # 身体防具
    returnar = armor_element_include?(armor3, element_name)
    bool |= returnar[0]
    one_total += returnar[1].to_i
    two_total += returnar[2].to_i
    # 装飾品
    returnar = armor_element_include?(armor4, element_name)
    bool |= returnar[0]
    one_total += returnar[1].to_i
    two_total += returnar[2].to_i
    # 存在したか、%無き数値の合計、%有る数値の合計 を返す
    return [bool, one_total, two_total]
  end
end

Mã:
#==============================================================================
# ■ Action Battle System
#------------------------------------------------------------------------------
# Originally by 桜雅 在土
# Edited and translated by Minkoff
#------------------------------------------------------------------------------
# This script may be a bit buggy, but it should work :)
# And if you use this, please give both 桜雅 在土 and Minkoff a little credit.
#
# Also, keep in mind that if you are editing skills and classes, you have to 
# edit this too. If you don't know how to edit this, leave the existing 
# database entires alone. It will save you alot of trouble.
#
# ~Minkoff
#==============================================================================

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
 class Scene_Battle
  # 「レクトラインウィンドウを稼動」
  ENABLE_RECTLINE_WINDOW = false
end
class Game_Battler
  #--------------------------------------------------------------------------
  # ● アクターの運動能力の設定
  #--------------------------------------------------------------------------
  def setup_actor_reflexes(actor_id)
    # 共通項目の設定
    @max_jumps            =   2     # 「最大ジャンプ回数」
    @weight               = 100     # 「重さ」
    @body_rect = Rect.new(-18, -96, 36, 96) # くらい判定(Rect)
    # アクター個別の設定
    case actor_id
    when 1 # ID 1のアクター
      # 運動能力
      @air_x_resistance     =  0.09  # 「空中X空気抵抗」
      @air_x_velocity       =  2.0   # 「空中X加速度」
      @air_x_maximum        =  6.4   # 「空中X最大速度」
      @air_y_velocity       =  1.6   # 「落下Y加速度」
      @dash_x_speed         =  9.6   # 「走行X速度」
      @walk_x_speed         =  3.2   # 「歩行X速度」
      @jump_y_init_velocity = 24.0   # 「ジャンプY初速度」
      @char_width           = 18     # 「キャラ幅/2」
      #@body_rect = Rect.new(-0, -96, 48, 96) # くらい判定(Rect)
      # 戦技モーション設定---
      # 弱攻撃
      @motion_time_jub_attack = 16
      @rectan_plan_jub_attack[2]  = Rect.new(16,-71, 28, 34)
      @skl_id_plan_jub_attack[2]  = 1
      @skl_id_plan_jub_attack[6]  = 0
      # 前強攻撃
      @motion_time_front_attack = 24
      @rectan_plan_front_attack[2]  = Rect.new(33,-93, 47, 89)
      @skl_id_plan_front_attack[2]  = 2
      @skl_id_plan_front_attack[14] = 0
      # 上強攻撃
      @motion_time_upper_attack = 26
      @rectan_plan_upper_attack[2]  = Rect.new(32,-96, 48, 94)
      @skl_id_plan_upper_attack[2]  = 3
      @skl_id_plan_upper_attack[22] = 0
      # 下強攻撃
      @motion_time_lower_attack = 12
      @rectan_plan_lower_attack[3]  = Rect.new(20,-42, 54, 38)
      @skl_id_plan_lower_attack[3]  = 4
      @skl_id_plan_lower_attack[10] = 0
      # 空中ニュートラル攻撃
      @motion_time_air_neutral_attack = 40
      @rectan_plan_air_neutral_attack[2]  = Rect.new(-23,-43, 67, 34)
      @skl_id_plan_air_neutral_attack[2]  = 5
      @skl_id_plan_air_neutral_attack[36] = 0    
      # 空中前攻撃
      @motion_time_air_front_attack = 20
      @rectan_plan_air_front_attack[2]  = Rect.new(33,-93, 47, 89)
      @skl_id_plan_air_front_attack[2]  = 6
      @skl_id_plan_air_front_attack[18] = 0    
      # 空中上攻撃
      @motion_time_air_upper_attack = 16
      @rectan_plan_air_upper_attack[2]  = Rect.new(32,-96, 48, 94)
      @skl_id_plan_air_upper_attack[2]  = 7
      @skl_id_plan_air_upper_attack[14] = 0    
      # 空中下攻撃
      @motion_time_air_lower_attack = 36
      @rectan_plan_air_lower_attack[2]  = Rect.new(-31,-42, 52, 42)
      @skl_id_plan_air_lower_attack[2]  = 8
      @skl_id_plan_air_lower_attack[36] = 0    
      # 空中後攻撃
      @motion_time_air_arear_attack = 40
      @rectan_plan_air_arear_attack[2]  = Rect.new(-14,-92, 54, 88)
      @skl_id_plan_air_arear_attack[2]  = 9
      @skl_id_plan_air_arear_attack[36] = 0
    when 2 # ID 1のアクター
      # 運動能力
      @air_x_resistance     =  0.09  # 「空中X空気抵抗」
      @air_x_velocity       =  4.0   # 「空中X加速度」
      @air_x_maximum        =  9.6   # 「空中X最大速度」
      @air_y_velocity       =  1.8   # 「落下Y加速度」
      @dash_x_speed         =  9.6   # 「走行X速度」
      @walk_x_speed         =  3.2   # 「歩行X速度」
      @jump_y_init_velocity = 24.0   # 「ジャンプY初速度」
      @char_width           = 48     # 「キャラ幅/2」
      #@body_rect = Rect.new(-24, -96, 48, 96) # くらい判定(Rect)
      # 戦技モーション設定---
      # 弱攻撃
      @motion_time_jub_attack = 16
      @rectan_plan_jub_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_jub_attack[2]  = 1
      @skl_id_plan_jub_attack[6]  = 0
      # 前強攻撃
      @motion_time_front_attack = 24
      @rectan_plan_front_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_front_attack[2]  = 2
      @skl_id_plan_front_attack[14] = 0
      # 上強攻撃
      @motion_time_upper_attack = 16
      @rectan_plan_upper_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_upper_attack[2]  = 3
      @skl_id_plan_upper_attack[14] = 0
      # 下強攻撃
      @motion_time_lower_attack = 24
      @rectan_plan_lower_attack[2]  = Rect.new(0,-32, 96, 32)
      @skl_id_plan_lower_attack[2]  = 4
      @skl_id_plan_lower_attack[14] = 0
      # 空中ニュートラル攻撃
      @motion_time_air_neutral_attack = 40
      @rectan_plan_air_neutral_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_neutral_attack[2]  = 5
      @skl_id_plan_air_neutral_attack[36] = 0    
      # 空中前攻撃
      @motion_time_air_front_attack = 20
      @rectan_plan_air_front_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_front_attack[2]  = 6
      @skl_id_plan_air_front_attack[18] = 0    
      # 空中上攻撃
      @motion_time_air_upper_attack = 20
      @rectan_plan_air_upper_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_upper_attack[2]  = 7
      @skl_id_plan_air_upper_attack[24] = 0    
      # 空中下攻撃
      @motion_time_air_lower_attack = 36
      @rectan_plan_air_lower_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_lower_attack[2]  = 8
      @skl_id_plan_air_lower_attack[36] = 0    
      # 空中後攻撃
      @motion_time_air_arear_attack = 40
      @rectan_plan_air_arear_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_arear_attack[2]  = 9
      @skl_id_plan_air_arear_attack[36] = 0
    when 3 # ID 3のアクター
      @air_x_resistance     =  0.08  # 「空中X空気抵抗」
      @air_x_velocity       =  4.0   # 「空中X加速度」
      @air_x_maximum        = 12.8   # 「空中X最大速度」
      @air_y_velocity       =  2.4   # 「落下Y加速度」
      @dash_x_speed         =  9.6   # 「走行X速度」
      @walk_x_speed         =  2.8   # 「歩行X速度」
      @jump_y_init_velocity = 28.2   # 「ジャンプY初速度」
      @char_width           = 48     # 「キャラ幅/2」
      #@body_rect = Rect.new(-48, -96, 96, 96) # くらい判定(Rect)
      # 戦技モーション設定---
      # 弱攻撃
      @motion_time_jub_attack = 16
      @rectan_plan_jub_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_jub_attack[2]  = 1
      @skl_id_plan_jub_attack[6]  = 0
      # 前強攻撃
      @motion_time_front_attack = 24
      @rectan_plan_front_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_front_attack[2]  = 2
      @skl_id_plan_front_attack[14] = 0
      # 上強攻撃
      @motion_time_upper_attack = 24
      @rectan_plan_upper_attack[2]  = Rect.new(0,-96, 96, 96)
      @skl_id_plan_upper_attack[2]  = 3
      @skl_id_plan_upper_attack[14] = 0
      # 下強攻撃
      @motion_time_lower_attack = 24
      @rectan_plan_lower_attack[2]  = Rect.new(0,-32, 96, 32)
      @skl_id_plan_lower_attack[2]  = 4
      @skl_id_plan_lower_attack[14] = 0
      # 空中ニュートラル攻撃
      @motion_time_air_neutral_attack = 40
      @rectan_plan_air_neutral_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_neutral_attack[2]  = 5
      @skl_id_plan_air_neutral_attack[36] = 0    
      # 空中前攻撃
      @motion_time_air_front_attack = 20
      @rectan_plan_air_front_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_front_attack[2]  = 6
      @skl_id_plan_air_front_attack[18] = 0    
      # 空中上攻撃
      @motion_time_air_upper_attack = 26
      @rectan_plan_air_upper_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_upper_attack[2]  = 7
      @skl_id_plan_air_upper_attack[24] = 0    
      # 空中下攻撃
      @motion_time_air_lower_attack = 36
      @rectan_plan_air_lower_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_lower_attack[2]  = 8
      @skl_id_plan_air_lower_attack[36] = 0    
      # 空中後攻撃
      @motion_time_air_arear_attack = 40
      @rectan_plan_air_arear_attack[2]  = Rect.new(-48,-48, 96, 48)
      @skl_id_plan_air_arear_attack[2]  = 9
      @skl_id_plan_air_arear_attack[36] = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● エネミーの運動能力の設定
  #--------------------------------------------------------------------------
  def setup_enemy_reflexes(enemy_id)
    # 共通項目
    @max_jumps            =   2     # 「最大ジャンプ回数」
    @weight               = 100     # 「重さ」
    # エネミー個別設定
    case enemy_id
    when 1 # ID 1のアクター
      setup_actor_reflexes(1)
    end
  end
  #--------------------------------------------------------------------------
  # ● スキルの基本ダメージ計算
  #--------------------------------------------------------------------------
  def cals_skill_damage(user, skill)
    # 基本ダメージを計算
    return skill.power * user.str * user.atk / self.pdef / 10
  end
end
# スキルモーションの設定---
class Game_Motion
  def forte_motion_database(skill_id)
    # 初期化
    @action_duration = 0
    @attack_motion_plan.clear
    @attack_rectan_plan.clear
    @attack_skl_id_plan.clear
    # 各種設定
    @handling_priority = 1
    case skill_id
    # スキルモーションの設定説明
   #when xx (xxはスキルのID)
   #  @action_duration    = (数字) : そのアクションの長さ(単位:F)
   #  @attack_motion_plan = (配列) : 実行時のキャラのフォーム
   #  @attack_rectan_plan = (配列[(Rect)]) : 攻撃範囲、Rectで指定。
   #  @attack_skl_id_plan = (配列) : スキルのモーションプラン。
   #                                 スキルIDを指定、 0 の部分で終了する。
    when 57 # ID 13 のスキル
      @action_duration    = 24
      @attack_motion_plan = [121,nil,nil,nil,131]
      @attack_rectan_plan = [Rect.new(0,-96, 96, 96)]
      @attack_skl_id_plan = [13,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,0]
    when 58
      @action_duration    = 24
      @attack_motion_plan = [151,nil,nil,141]
      @attack_rectan_plan = [nil,nil,nil,Rect.new(0,-96, 96, 96)]
      @attack_skl_id_plan = [nil,nil,nil,14,nil,nil,nil,nil,nil,nil,nil,nil,0]
    when 59
      @action_duration    = 24
      @attack_motion_plan = [131]
      @attack_rectan_plan = [Rect.new(0,-96, 96, 96)]
      @attack_skl_id_plan = [15,nil,nil,nil,nil,nil,nil,nil,nil,0]
    when 60
      @action_duration    = 24
      @attack_motion_plan = [131]
      @attack_rectan_plan = [Rect.new(0,-96, 96, 96)]
      @attack_skl_id_plan = [16,nil,nil,nil,nil,nil,nil,nil,nil,0]
    else 
      # 例外処理
      @handling_priority = 0
    end
  end
end
#------------------------------------------------- カスタマイズポイント End ---

#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------  
  attr_accessor :now_x_speed              # 現在X速度        (Numeric)
  attr_accessor :now_y_speed              # 現在Y速度        (Numeric)
  attr_accessor :now_jumps                # 現在ジャンプ回数 (Numeric)
  attr_accessor :direction                # 向き             (Numeric) (1が右向き、-1が左向き)
  attr_accessor :dashing                  # ダッシュ中       (true/false)
  attr_accessor :guarding                 # ガード中         (true/false)
  attr_accessor :motion                   # モーション       (Game_Motion)
  attr_reader   :air_x_resistance         # 「空中X空気抵抗」(Numeric)
  attr_reader   :air_x_velocity           # 「空中X加速度」  (Numeric)
  attr_reader   :air_x_maximum            # 「空中X最大速度」(Numeric)
  attr_reader   :air_y_velocity           # 「落下Y加速度」  (Numeric)
  attr_reader   :dash_x_speed             # 「歩行X速度」    (Numeric)
  attr_reader   :walk_x_speed             # 「歩行X速度」    (Numeric)
  attr_reader   :weight                   # 「重さ」         (Numeric)
  attr_reader   :jump_y_init_velocity     # 「ジャンプY初速度」
  attr_reader   :max_jumps                # 「最大ジャンプ回数」
  attr_reader   :char_width               # 「キャラ幅/2」
  attr_reader   :body_rect                # 「ダメージを受ける範囲」(rect)
  #---------------------------------------#
  attr_accessor :motion_time_jub_attack
  attr_accessor :motion_plan_jub_attack
  attr_accessor :rectan_plan_jub_attack
  attr_accessor :skl_id_plan_jub_attack
  attr_accessor :motion_time_front_attack
  attr_accessor :motion_plan_front_attack
  attr_accessor :rectan_plan_front_attack
  attr_accessor :skl_id_plan_front_attack
  attr_accessor :motion_time_upper_attack
  attr_accessor :motion_plan_upper_attack
  attr_accessor :rectan_plan_upper_attack
  attr_accessor :skl_id_plan_upper_attack
  attr_accessor :motion_time_lower_attack
  attr_accessor :motion_plan_lower_attack
  attr_accessor :rectan_plan_lower_attack
  attr_accessor :skl_id_plan_lower_attack
  attr_accessor :motion_time_air_neutral_attack
  attr_accessor :motion_plan_air_neutral_attack
  attr_accessor :rectan_plan_air_neutral_attack
  attr_accessor :skl_id_plan_air_neutral_attack
  attr_accessor :motion_time_air_front_attack
  attr_accessor :motion_plan_air_front_attack
  attr_accessor :rectan_plan_air_front_attack
  attr_accessor :skl_id_plan_air_front_attack
  attr_accessor :motion_time_air_upper_attack
  attr_accessor :motion_plan_air_upper_attack
  attr_accessor :rectan_plan_air_upper_attack
  attr_accessor :skl_id_plan_air_upper_attack
  attr_accessor :motion_time_air_lower_attack
  attr_accessor :motion_plan_air_lower_attack
  attr_accessor :rectan_plan_air_lower_attack
  attr_accessor :skl_id_plan_air_lower_attack
  attr_accessor :motion_time_air_arear_attack
  attr_accessor :motion_plan_air_arear_attack
  attr_accessor :rectan_plan_air_arear_attack
  attr_accessor :skl_id_plan_air_arear_attack
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bs1_battler_initialize initialize
  def initialize
    #-----
    xrxs_bs1_battler_initialize
    @now_x_speed          =  0     # 現在X速度
    @now_y_speed          =  0     # 現在Y速度
    @now_jumps            =  0     # 現在ジャンプ回数
    if self.is_a?(Game_Actor)      # 向き
      @direction          =  1
    else
      @direction          = -1
    end
    @dashing              = false
    @guarding             = false
    @motion               = Game_Motion.new(self)
    #-----
  end
  def setup_default_reflexes
    # 初期化
    @motion_plan_jub_attack = [111]
    @rectan_plan_jub_attack = []
    @skl_id_plan_jub_attack = []
    @motion_plan_front_attack = [121]
    @rectan_plan_front_attack = []
    @skl_id_plan_front_attack = []
    @motion_plan_upper_attack = [131]
    @rectan_plan_upper_attack = []
    @skl_id_plan_upper_attack = []
    @motion_plan_lower_attack = [141]
    @rectan_plan_lower_attack = []
    @skl_id_plan_lower_attack = []
    @motion_plan_air_neutral_attack = [151]
    @rectan_plan_air_neutral_attack = []
    @skl_id_plan_air_neutral_attack = []
    @motion_plan_air_front_attack = [161]
    @rectan_plan_air_front_attack = []
    @skl_id_plan_air_front_attack = []
    @motion_plan_air_upper_attack = [171]
    @rectan_plan_air_upper_attack = []
    @skl_id_plan_air_upper_attack = []
    @motion_plan_air_lower_attack = [181]
    @rectan_plan_air_lower_attack = []
    @skl_id_plan_air_lower_attack = []
    @motion_plan_air_arear_attack = [191]
    @rectan_plan_air_arear_attack = []
    @skl_id_plan_air_arear_attack = []    
  end
  #--------------------------------------------------------------------------
  # ● 防御中判定
  #--------------------------------------------------------------------------
  def guarding?
    return @guarding
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #--------------------------------------------------------------------------
  alias xrxs_bs1_skill_effect skill_effect
  def skill_effect(user, skill)
    bool = xrxs_bs1_skill_effect(user, skill)
    # 攻撃成功時のみ
    if bool and self.damage != "Miss" and !self.guarding?
      # ふっとび値
      blow = 1.0 * (self.maxhp - self.hp) / self.maxhp * (skill.power + 4) * self.weight / 280000 * skill.atk_f + skill.eva_f
      # ふっとびベクトル向き
      radian = skill.variance * Math::PI / 50.0
      dir = user.x_pos < self.x_pos ? 1 : -1
      self.now_x_speed = blow * Math.cos(radian) / 2.2 * dir
      self.now_y_speed = blow * Math.sin(radian) / 2.2
      self.now_jumps = 1 if self.now_y_speed > 0
      # ダメージモーション
      self.motion.clear # まずはクリア
      self.motion.do_damage
      self.motion.knock_back_duration =  skill.power #(blow/ 2).floor
      self.motion.hit_stop_duration   = 2 # [(blow/10).floor, 8].min
      #user.motion.hit_stop_duration   = [(blow/10).floor, 8].min
      # ダメージによる向き反転
      self.direction = user.direction * -1
    end
    return bool
  end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias xrxs_bs1_setup setup
  def setup(actor_id)
    xrxs_bs1_setup(actor_id)
    setup_reflexes(actor_id)
  end
  #--------------------------------------------------------------------------
  # ● 運動能力の設定
  #--------------------------------------------------------------------------
  def setup_reflexes(actor_id)
    # 初期化
    setup_default_reflexes
    # アクターの運動能力の設定
    setup_actor_reflexes(actor_id)
  end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bs1_enemy_initialize initialize
  def initialize(troop_id, member_index)
    super()
    xrxs_bs1_enemy_initialize(troop_id, member_index)
    setup_reflexes(@enemy_id)
  end
  #--------------------------------------------------------------------------
  # ● 運動能力の設定
  #--------------------------------------------------------------------------
  def setup_reflexes(enemy_id)
    # 初期化
    setup_default_reflexes
    # エネミーの運動能力の設定
    setup_enemy_reflexes(enemy_id)
  end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bs1_update update
  def update
    # 呼び戻す
    xrxs_bs1_update
    # バトラーが nil の場合
    if @battler == nil
      return
    end
    # 向きに応じて反転・w・この機能マジ燃え(素
    if @battler.direction == 1
      self.mirror = false
    else
      self.mirror = true
    end
  end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● エフェクト表示中判定
  #--------------------------------------------------------------------------
  def effect?
    return false
  end  
end
#==============================================================================
# ■ Window_RectLine
#==============================================================================
class Window_RectLine < Window_Base
  def initialize
    super(-16, -16, 672, 512)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 64
    self.back_opacity = 64
  end
  def clear
    self.contents.clear
  end
  def write_rect(rect, color)
    rect.x = 320 + rect.x - $xcam_x
    rect.y += 304 + $xcam_y
    self.contents.draw_rect(rect, color)
  end
end
#==============================================================================
# ■ Window_ActiveMenu
#==============================================================================
class Window_ActiveMenu < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 160, 160, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    refresh
    @item_max = 2
    @index = 0
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    bitmap = RPG::Cache.icon("021-Potion01")
    self.contents.blt( 0,  4, bitmap, Rect.new(0, 0, 24, 24))
    bitmap = RPG::Cache.icon("020-Accessory05")
    self.contents.blt( 0, 36, bitmap, Rect.new(0, 0, 24, 24))
  end
  #--------------------------------------------------------------------------
  # ● カーソルの矩形更新
  #--------------------------------------------------------------------------
  #def update_cursor_rect
  #  self.cursor_rect.set(0, @index * 24, 24, 24)
  #end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias xrxs_bs1_main main
  def main
    xrxs_bs1_main
    if ENABLE_RECTLINE_WINDOW
      @window_rectline.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bs1_start_phase1 start_phase1
  def start_phase1
    xrxs_bs1_start_phase1
    # 初期化
    @handle_battler = $game_party.actors[0]
    @now_attack_frame = false
    @trigger_duration_key_left = 0
    @trigger_duration_key_right= 0
    @trigger_duration_key_down = 0
    @xcam_watch_battler = @handle_battler
    # スクリーンバックウィンドウを作成
    @window_screenback = Window_Base.new(-4, -4, 648, 488)
    @window_screenback.back_opacity = 48
    @window_screenback.visible = false
    @window_screenback.z = 301
    # レクトライン表示ON
    if ENABLE_RECTLINE_WINDOW
      @window_rectline = Window_RectLine.new
    end
    # アクティヴメニューウィンドウを作成
    @window_activemenu = Window_ActiveMenu.new
    @window_activemenu.active = false
    @window_activemenu.visible = false
    @window_activemenu.z = 302
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bs1_update update
  def update
    # @wait_countを設定して本来の処理を行わないようにする
    @wait_count = 1    
    @wait_count_motion = 1 if @phase == 3
    # 呼び戻す
    xrxs_bs1_update
    # フェーズによって分岐
    case @phase
    when 1  # ハンドルフェーズ
      update_coordinates
      update_phase1
      update_motions
    when 3  # アクティヴメニューフェーズ
      update_phase3
    when 4  # アタックフェーズ
      update_phase4
    when 5  # アフターバトルフェーズ
      update_coordinates
      update_motions
      update_phase5
    end
  end
  #--------------------------------------------------------------------------
  # ● 次のアクターのコマンド入力へ
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # 無効化
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (バトラーモーション)
  #--------------------------------------------------------------------------
  def update_motions
    for battler in $game_party.actors + $game_troop.enemies
      battler.motion.update
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ)
  #--------------------------------------------------------------------------
  alias xrxs_bs1_update_phase3 update_phase3
  def update_phase3
    # アクティヴメニューがアクティヴの場合
    if @window_activemenu.active
      update_phase3_activemenu
      return
    end
    # 他
    xrxs_bs1_update_phase3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクティヴメニュー)
  #--------------------------------------------------------------------------
  def update_phase3_activemenu
    @window_activemenu.update
    if Input.trigger?(Input::B)
      # キャンセル SE を演奏
      $game_system.se_play($data_system.cancel_se)
      @xcam_z_destination = 185
      @window_activemenu.active = false
      @window_activemenu.visible = false
      @window_screenback.visible = false
      @phase = 1
    end
    if Input.trigger?(Input::C)
      case @window_activemenu.index
      when 0 # アイテム
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        @window_activemenu.visible = false
        @window_activemenu.active  = false
        # アイテム選択開始
        @active_battler = @handle_battler
        @actor_index = 0
        start_item_select
        @item_window.z = 303
      when 1 # 逃走
        
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  #--------------------------------------------------------------------------
  alias xrxs_bs1_update_phase3_actor_select update_phase3_actor_select
  def update_phase3_actor_select
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # アイテムウィンドウ表示中の場合
      if @item_window != nil
        # 行動実行
        @handle_battler.motion.do_use_item
        @active_battler = @handle_battler
        # アクションを設定
        @active_battler.current_action.kind = 2
        @active_battler.current_action.target_index = @actor_arrow.index
        index = @active_battler.current_action.target_index
        @target_battlers = [$game_party.smooth_target_actor(index)]
        # アイテムアクション結果作成
        make_item_action_result
        # フェイズ4へ移行
        end_actor_select
        @xcam_z_destination = 185
        @window_screenback.visible = false
        @phase = 4
        @phase4_step = 4
        return
      end
    end
    # 呼び戻す
    xrxs_bs1_update_phase3_actor_select
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択終了
  #--------------------------------------------------------------------------
  alias xrxs_bs1_end_item_select end_item_select
  def end_item_select
    xrxs_bs1_end_item_select
    @actor_command_window.active  = false
    @actor_command_window.visible = false
    # アクティヴメニューを有効化
    @window_activemenu.active  = true
    @window_activemenu.visible = true
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (プレバトルフェーズ)再定義
  #--------------------------------------------------------------------------
  def update_phase1
    # 勝敗判定
    if judge
      # 勝利または敗北の場合 : メソッド終了
      return
    end
    # フレーム更新 (バトラー操作) 
    update_handling
    # フレーム更新 (AI操作) 
    for battler in  $game_party.actors + $game_troop.enemies
      update_ai_handle(battler) if battler != @handle_battler
    end
    # フレーム更新 (攻撃系更新)
    update_attack_set
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (座標系更新) 
  #--------------------------------------------------------------------------
  def update_rectline
    return unless ENABLE_RECTLINE_WINDOW
    @window_rectline.clear
    for battler in $game_party.actors + $game_troop.enemies
      battler_rect    = battler.body_rect.dup
      battler_rect.x += battler.x_pos
      battler_rect.y -= battler.y_pos
      @window_rectline.write_rect(battler_rect, Color.new(255, 255, 255, 255))
      battler_rect    = battler.motion.attack_rect.dup
      if battler.direction == -1
        # 逆向きの場合
        battler_rect.x = -1 * battler_rect.x - battler_rect.width
      end
      battler_rect.x += battler.x_pos
      battler_rect.y -= battler.y_pos
      @window_rectline.write_rect(battler_rect, Color.new(255, 128, 128, 255))
    end
  end
  def update_coordinates
    # レクトライン描写
    update_rectline
    # 初期化
    battlers_x_min =  512
    battlers_x_max = -512
    # バトラー位置更新
    for battler in $game_party.actors + $game_troop.enemies
      # 最大値
      battlers_x_min = [battler.x_pos, battlers_x_min].min
      battlers_x_max = [battler.x_pos, battlers_x_max].max
      # ヒットストップ中の場合は座標移動を行わない
      next if battler.motion.hit_stop_duration > 0
      # ---X---
      # X空気抵抗による更新
      battler.now_x_speed = battler.now_x_speed * (1.0 - battler.air_x_resistance)
      # X移動
      battler.x_pos += battler.now_x_speed
      # ぬるり
      # 攻撃側の範囲を設定
      battler_rect    = battler.body_rect.dup
      battler_rect.x += battler.x_pos
      battler_rect.y -= battler.y_pos
      for target in $game_party.actors + $game_troop.enemies
        # 自分は除外
        next if target == battler
        # 重なり判定
        target_rect     = target.body_rect.dup
        target_rect.x  += target.x_pos
        target_rect.y  -= target.y_pos
        if rects_over?(battler_rect.dup, target_rect.dup)
          # ぬるり発生
          if battler.x_pos < target.x_pos
            battler.x_pos -= 2
            target.x_pos  += 2
          else
            battler.x_pos += 2
            target.x_pos  -= 2
          end
        end
      end        
      # X範囲
      battler.x_pos = [[battler.x_pos, -512+battler.char_width].max, 512-battler.char_width].min
      
      # ---Y---
      # 落下Y加速度による更新
      battler.now_y_speed -= battler.air_y_velocity
      # Y移動
      battler.y_pos = [battler.y_pos + battler.now_y_speed, 0].max
      # 着地判定
      if battler.now_jumps > 0 and battler.y_pos == 0
        # 着地ッ!!
        battler.now_jumps = 0
        battler.now_x_speed = 0
        battler.motion.do_landing_step
      end
    end
    # カメラも移動
    #@handle_battler.sp = (battlers_x_min - battlers_x_max).abs.floor
    #@xcam_x_destination = @handle_battler.x_pos
    #@xcam_y_destination = @handle_battler.y_pos
    #@xcam_z_destination = [[((battlers_x_min - battlers_x_max).abs * 185.0 / 640).floor, 148].max, 296].min
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (攻撃系更新) 
  #--------------------------------------------------------------------------
  def update_attack_set
    # 攻撃判定
    for attacker in $game_party.actors + $game_troop.enemies
      next if attacker.motion.attack_rect.width == 0
      next if attacker.motion.attack_skl_id == nil
      # 攻撃側の範囲を設定
      attacker_rect   = attacker.motion.attack_rect.dup
      if attacker.direction == -1
        # 逆向きの場合
        attacker_rect.x = -1 * attacker_rect.x - attacker_rect.width
      end
      attacker_rect.x += attacker.x_pos
      attacker_rect.y -= attacker.y_pos
      # 対象となるバトラーの配列を作成
      if attacker.is_a?(Game_Actor)
        targets = $game_troop.enemies
      elsif attacker.is_a?(Game_Enemy)
        targets = $game_party.actors
      else
        next
      end
      @target_battlers = []
      for target in targets
        next if attacker.motion.attack_hit_targets.include?(target)
        # 対象側の範囲を設定
        target_rect    = target.body_rect.dup
        target_rect.x += target.x_pos
        target_rect.y -= target.y_pos
        if rects_over?(attacker_rect, target_rect)
          # 攻撃命中!!
          @target_battlers.push(target)
          attacker.motion.attack_hit_targets.push(target)
        end
      end
      # 攻撃の実行
      if @target_battlers.size > 0
        # 設定
        @active_battler = attacker
        @active_battler.current_action.skill_id = attacker.motion.attack_skl_id
        # スキルアクション 結果作成
        make_skill_action_result
        # フェイズ4へ移行
        @phase = 4
        @phase4_step = 4
      end
    end    
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (バトラー操作) 
  #--------------------------------------------------------------------------
  def update_handling
    # フレーム更新
    @trigger_duration_key_left -= 1
    @trigger_duration_key_right-= 1
    @trigger_duration_key_down -= 1
    @handle_battler.guarding = false
    # 操作
    if @handle_battler.motion.handling_priority <= 0
      if Input.trigger?(Input::Z)
        # メニュー
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        @xcam_z_destination = 111
        @window_activemenu.active  = true
        @window_activemenu.visible = true
        @window_screenback.visible = true
        # フェーズ 3 に移行
        @phase = 3
        return
      elsif Input.trigger?(Input::C)
        # アタック
        if @handle_battler.now_jumps >= 1
          # 空中
          if (@handle_battler.direction == 1 and Input.press?(Input::RIGHT)) or 
             (@handle_battler.direction ==-1 and Input.press?(Input::LEFT))
            @handle_battler.motion.do_air_front_attack
          elsif Input.press?(Input::UP)
            @handle_battler.motion.do_air_upper_attack
          elsif Input.press?(Input::DOWN)
            @handle_battler.motion.do_air_lower_attack
          elsif (@handle_battler.direction ==-1 and Input.press?(Input::RIGHT)) or 
                (@handle_battler.direction == 1 and Input.press?(Input::LEFT))
            @handle_battler.motion.do_air_arear_attack
          else
            @handle_battler.motion.do_air_neutral_attack
          end
        else
          # 地上
          if (@handle_battler.direction == 1 and Input.press?(Input::RIGHT)) or 
             (@handle_battler.direction ==-1 and Input.press?(Input::LEFT))
            @handle_battler.motion.do_front_attack
          elsif Input.press?(Input::UP)
            @handle_battler.motion.do_upper_attack
          elsif Input.press?(Input::DOWN)
            @handle_battler.motion.do_lower_attack
          else
            @handle_battler.motion.do_jub_attack
          end
        end
      elsif Input.trigger?(Input::B)
        # フォート
        if Input.press?(Input::RIGHT) or Input.press?(Input::LEFT)
          @handle_battler.motion.do_forte(@handle_battler.skills[3])
        elsif Input.press?(Input::UP)
          @handle_battler.motion.do_forte(@handle_battler.skills[1])
        elsif Input.press?(Input::DOWN)
          @handle_battler.motion.do_forte(@handle_battler.skills[2])
        else
          @handle_battler.motion.do_forte(@handle_battler.skills[0])
        end
      elsif Input.press?(Input::Y)
        # ガード
        if @handle_battler.now_jumps < @handle_battler.max_jumps and 
          ((@handle_battler.direction == 1 and Input.trigger?(Input::RIGHT)) or 
           (@handle_battler.direction ==-1 and Input.trigger?(Input::LEFT)))
          # フロントステップ
          @handle_battler.motion.do_frontstep
        elsif @handle_battler.now_jumps < @handle_battler.max_jumps and 
             ((@handle_battler.direction ==-1 and Input.trigger?(Input::RIGHT)) or 
              (@handle_battler.direction == 1 and Input.trigger?(Input::LEFT)))
          # バックステップ
          @handle_battler.motion.do_backstep
        else
          # ガード
          @handle_battler.motion.do_guard
        end
      elsif Input.trigger?(Input::X)
        # ジャンプ
        if @handle_battler.now_jumps < @handle_battler.max_jumps
          if (@handle_battler.direction == 1 and Input.press?(Input::RIGHT)) or
             (@handle_battler.direction ==-1 and Input.press?(Input::LEFT))
            @handle_battler.motion.act_derive = "front_jump"
          elsif (@handle_battler.direction == 1 and Input.press?(Input::LEFT)) or
                (@handle_battler.direction ==-1 and Input.press?(Input::RIGHT))
            @handle_battler.motion.act_derive = "back_jump"
          else
            @handle_battler.motion.act_derive = "jump"
          end
          @handle_battler.motion.do_crouch_to_jump
        end
      elsif @handle_battler.now_jumps >= 1
        # 空中
        if Input.trigger?(Input::UP)
          if @handle_battler.now_jumps < @handle_battler.max_jumps
            @handle_battler.motion.act_derive = "jump"
            @handle_battler.motion.do_crouch_to_jump
          end
        elsif Input.press?(Input::RIGHT)
          # →
          @handle_battler.now_x_speed += @handle_battler.air_x_velocity
        elsif Input.press?(Input::LEFT)
          # ←
          @handle_battler.now_x_speed -= @handle_battler.air_x_velocity
        end
        # 範囲
        @handle_battler.now_x_speed = [[@handle_battler.now_x_speed, @handle_battler.air_x_maximum].min, -@handle_battler.air_x_maximum].max
      else
        # 地上
        if Input.trigger?(Input::RIGHT)
          if @trigger_duration_key_right > 1
            @handle_battler.dashing = true
          else
            @trigger_duration_key_right = 28
          end
        elsif Input.trigger?(Input::LEFT)
          if @trigger_duration_key_left > 1
            @handle_battler.dashing = true
          else
            @trigger_duration_key_left = 28
          end        
        end
        if Input.trigger?(Input::UP)
          if @handle_battler.now_jumps < @handle_battler.max_jumps
            @handle_battler.motion.act_derive = "jump"
            @handle_battler.motion.do_crouch_to_jump
          end
        elsif Input.press?(Input::RIGHT)
          # →歩行
          @handle_battler.direction = 1
          if @handle_battler.dashing
            @handle_battler.x_pos += @handle_battler.dash_x_speed
          else
            @handle_battler.x_pos += @handle_battler.walk_x_speed
          end
          @handle_battler.motion.do_walk
        elsif Input.press?(Input::LEFT)
          # ←歩行
          @handle_battler.direction =-1
          if @handle_battler.dashing
            @handle_battler.x_pos -= @handle_battler.dash_x_speed
          else
            @handle_battler.x_pos -= @handle_battler.walk_x_speed
          end
          @handle_battler.motion.do_walk
        elsif Input.press?(Input::DOWN)
          # しゃがみ
          @handle_battler.motion.do_crouch
        else
          # 待機
          @handle_battler.dashing = false
          @handle_battler.motion.do_stand
        end
      end
    end
    #---
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (AI操作) 
  #--------------------------------------------------------------------------
  def update_ai_handle(battler)
    # 初期化
    battler.guarding = false
    # AI待機
    @ai_duration = 0 if @ai_duration == nil
    @ai_duration -= 1
    return if @ai_duration > 0
    # 操作
    if battler.motion.handling_priority <= 0
      # ターゲットを取得
      target = @handle_battler
      # ターゲットが自分の位置から考えてどのあたりにいるかを計算
      x_diff = target.x_pos - battler.x_pos
      y_diff = target.y_pos - battler.y_pos
      # 位置による判断
      case x_diff.abs
      when 0..96 # 近距離
        # アタック
        if battler.now_jumps >= 1
          # 空中
          case y_diff
          when -23..76
            battler.motion.do_air_neutral_attack
          when 33..80
            case y_diff
            when 0..96
              battler.motion.do_air_upper_attack
            else
              battler.motion.do_air_front_attack
            end
          when -96...-48
            battler.motion.do_air_lower_attack
          else
            battler.motion.do_air_arear_attack
          end
        else
          # 地上
          case y_diff
          when -48...48
            battler.motion.do_front_attack
          when 48...128
            battler.motion.do_upper_attack
          when -96...48
            battler.motion.do_lower_attack
          else
            battler.motion.do_jub_attack
          end
        end
        @ai_duration = 36
      else # 遠距離
        if battler.now_jumps >= 1
          # 空中
          if Input.press?(Input::RIGHT)
            # →
            battler.now_x_speed += battler.air_x_velocity
          elsif Input.press?(Input::LEFT)
            # ←
            battler.now_x_speed -= battler.air_x_velocity
          end
          # 範囲
          battler.now_x_speed = [[battler.now_x_speed, battler.air_x_maximum].min, -@handle_battler.air_x_maximum].max
        else
          # 地上
          if battler.x_pos < target.x_pos
            # →歩行
            battler.direction = 1
            battler.x_pos += battler.walk_x_speed
            battler.motion.do_walk
          elsif battler.x_pos > target.x_pos
            # ←歩行
            battler.direction =-1
            battler.x_pos -= battler.walk_x_speed
            battler.motion.do_walk
          else
            # 待機
            battler.motion.do_stand
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● スキルまたはアイテムの対象側バトラー設定
  #--------------------------------------------------------------------------
  def set_target_battlers(scope)
    # 無効化
  end
  #--------------------------------------------------------------------------
  # ● スキルアクション 結果作成
  #--------------------------------------------------------------------------
  alias xrxs_bs1_make_skill_action_result make_skill_action_result
  def make_skill_action_result
    xrxs_bs1_make_skill_action_result
    # ヘルプウィンドウを隠す
    @help_window.visible = false
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  #--------------------------------------------------------------------------
  alias xrxs_bs1_update_phase4_step5 update_phase4_step5
  def update_phase4_step5
    xrxs_bs1_update_phase4_step5
    @phase = 1
  end
  #--------------------------------------------------------------------------
  # ● 二つの rect の共通部分があるかを判別
  #--------------------------------------------------------------------------
  def rects_over?(rect1, rect2)
    x_bool = false
    y_bool = false
    # Xの重なりを検出
    if (rect1.x <= rect2.x and rect2.x <= rect1.x + rect1.width) or
       (rect2.x <= rect1.x and rect1.x <= rect2.x + rect2.width) or
       (rect1.x <= rect2.x + rect2.width and rect2.x + rect2.width <= rect1.x + rect1.width) or
       (rect2.x <= rect1.x + rect1.width and rect1.x + rect1.width <= rect2.x + rect2.width)
      x_bool = true
    end
    # Yの重なりを検出
    if (rect1.y <= rect2.y and rect2.y <= rect1.y + rect1.height) or
       (rect2.y <= rect1.y and rect1.y <= rect2.y + rect2.height) or
       (rect1.y <= rect2.y + rect2.height and rect2.y + rect2.height <= rect1.y + rect1.height) or
       (rect2.y <= rect1.y + rect1.height and rect1.y + rect1.height <= rect2.y + rect2.height)
      y_bool = true
    end
    # return
    return (x_bool and y_bool)
  end
end



#------------------------------------------------------------------------------
#
#
# ▽ 新規
#
#
#==============================================================================
# ■ Game_Motion
#------------------------------------------------------------------------------
#  モーション (戦闘中の行動のフォーム) を扱うクラスです。
# このクラスは Game_Battler クラスの内部で使用されます。
#==============================================================================

class Game_Motion
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------  
  attr_reader   :handling_priority        # 現在の行動の操作に対する優先度
  attr_accessor :knock_back_duration      # のけぞり残りフレーム数
  attr_accessor :hit_stop_duration        # ヒットストップフレーム数
  attr_accessor :action_duration          # 行動  残りフレーム数
  attr_reader   :attack_rect              # 攻撃範囲 (Rect)
  attr_reader   :attack_skl_id            # 攻撃スキルID (Numeric)
  attr_accessor :attack_hit_targets       # 攻撃ヒットターゲット
  attr_accessor :act_derive               # 行動派生予定
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(battler)
    @battler = battler
    @attack_rect         = Rect.new(0,0,0,0)
    @attack_rectan_plan  = []
    @attack_skl_id_plan  = []
    @attack_motion_plan  = []
    @attack_hit_targets  = []
    @act_derive          = ""
    clear
  end
  #--------------------------------------------------------------------------
  # ● クリア
  #--------------------------------------------------------------------------
  def clear
    @attack_rect         = Rect.new(0,0,0,0)
    @attack_rectan_plan.clear
    @attack_skl_id_plan.clear
    @attack_motion_plan.clear
    @attack_hit_targets.clear
    @handling_priority   = 0
    @knock_back_duration = 0
    @hit_stop_duration   = 0
    @action_duration     = 0
    @attack_skl_id       = 0
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # アクション/のけぞり/ヒットストップ、の残りフレーム数更新    
    @hit_stop_duration   -= 1
    return if @hit_stop_duration > 0
    @action_duration     -= 1
    @knock_back_duration -= 1
    #
    # アクションが終了した場合
    if @action_duration == 0 or @knock_back_duration == 0
      # クリア
      clear
      # 行動派生
      case @act_derive
      when ""
        @battler.transgraphic(1)
      when "jump"
        do_jump
      when "front_jump"
        do_front_jump
      when "back_jump"
        do_back_jump
      end
      @act_derive = ""
    end
    # モーション予約の更新
    if @attack_motion_plan.size > 0
      am = @attack_motion_plan.shift
      if !am.nil? and @battler.now_form_id/10 != am/10
        @battler.transgraphic(am)
      end
    end
    # 攻撃予約の更新
    if @attack_skl_id_plan.size > 0
      as_id = @attack_skl_id_plan.shift
      @attack_skl_id = as_id unless as_id.nil?
      # スキルIDが 0 と指定された場合攻撃範囲をしまう
      ar = @attack_rectan_plan.shift
      if as_id == 0
        @attack_rect = Rect.new(0,0,0,0) 
        @attack_hit_targets.clear
      else
        @attack_rect = ar if ar.is_a?(Rect)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ◇ 待機
  #--------------------------------------------------------------------------
  def do_stand
    @attack_motion_plan = [1]
  end
  #--------------------------------------------------------------------------
  # ◇ ダメージのけぞり
  #--------------------------------------------------------------------------
  def do_damage
    @handling_priority = 1
    @attack_motion_plan = [71]
  end
  #--------------------------------------------------------------------------
  # ◇ 歩く
  #--------------------------------------------------------------------------
  def do_walk
    if @battler.dashing
      do_dash
    else
      @attack_motion_plan = [11]
    end
  end
  #--------------------------------------------------------------------------
  # ◇ 走る
  #--------------------------------------------------------------------------
  def do_dash
    @attack_motion_plan = [21]
  end
  #--------------------------------------------------------------------------
  # ◇ しゃがむ
  #--------------------------------------------------------------------------
  def do_crouch
    @attack_motion_plan = [31]
  end
  #--------------------------------------------------------------------------
  # ◇ ジャンプ
  #--------------------------------------------------------------------------
  def do_jump
    @battler.now_jumps += 1
    @attack_motion_plan = [41]
    @battler.now_x_speed = 0
    @battler.now_y_speed = @battler.jump_y_init_velocity
  end
  #--------------------------------------------------------------------------
  # ◇ 前ジャンプ
  #--------------------------------------------------------------------------
  def do_front_jump
    @battler.now_jumps += 1
    @attack_motion_plan = [41]
    @battler.now_x_speed = @battler.direction * @battler.air_x_maximum
    @battler.now_y_speed = @battler.jump_y_init_velocity * 0.9
  end
  #--------------------------------------------------------------------------
  # ◇ 後ジャンプ
  #--------------------------------------------------------------------------
  def do_back_jump
    @battler.now_jumps += 1
    @attack_motion_plan = [51]
    @battler.now_x_speed = -1 * @battler.direction * @battler.air_x_maximum
    @battler.now_y_speed = @battler.jump_y_init_velocity * 0.9
  end
  #--------------------------------------------------------------------------
  # ◇ 着地隙
  #--------------------------------------------------------------------------
  def do_landing_step
    @action_duration = 3
    @handling_priority = 1
    @attack_motion_plan = [31]
    @attack_skl_id_plan.clear
    @attack_rectan_plan.clear
    @attack_hit_targets.clear
    @attack_rect = Rect.new(0,0,0,0) 
  end
  #--------------------------------------------------------------------------
  # ◇ ガード
  #--------------------------------------------------------------------------
  def do_guard
    @attack_motion_plan = [61]
    @battler.guarding = true
  end
  #--------------------------------------------------------------------------
  # ◇ ジャンプ隙
  #--------------------------------------------------------------------------
  def do_crouch_to_jump
    @handling_priority = 1
    if @battler.now_jumps <= 0
      @action_duration = 3
      @attack_motion_plan = [31]
    else
      @action_duration = 1
    end
  end
  #--------------------------------------------------------------------------
  # ◇ フロントステップ
  #--------------------------------------------------------------------------
  def do_frontstep
    @action_duration = 10
    @handling_priority = 1
    @battler.now_jumps += 1
    @battler.now_x_speed = 18 * @battler.direction
    @battler.now_y_speed = @battler.jump_y_init_velocity / 3
    @attack_motion_plan = [51]
  end
  #--------------------------------------------------------------------------
  # ◇ バックステップ
  #--------------------------------------------------------------------------
  def do_backstep
    @action_duration = 20
    @handling_priority = 1
    @battler.now_jumps += 1
    @battler.now_x_speed = -18 * @battler.direction
    @battler.now_y_speed = @battler.jump_y_init_velocity / 2
    @attack_motion_plan = [51]
  end
  #--------------------------------------------------------------------------
  # ◇ 弱攻撃
  #--------------------------------------------------------------------------
  def do_jub_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_jub_attack
    @attack_motion_plan = @battler.motion_plan_jub_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_jub_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_jub_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 前強攻撃
  #--------------------------------------------------------------------------
  def do_front_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_front_attack
    @attack_motion_plan = @battler.motion_plan_front_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_front_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_front_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 上強攻撃
  #--------------------------------------------------------------------------
  def do_upper_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_upper_attack
    @attack_motion_plan = @battler.motion_plan_upper_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_upper_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_upper_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 下強攻撃
  #--------------------------------------------------------------------------
  def do_lower_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_lower_attack
    @attack_motion_plan = @battler.motion_plan_lower_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_lower_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_lower_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 空中ニュートラル攻撃
  #--------------------------------------------------------------------------
  def do_air_neutral_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_air_neutral_attack
    @attack_motion_plan = @battler.motion_plan_air_neutral_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_air_neutral_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_air_neutral_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 空中前攻撃
  #--------------------------------------------------------------------------
  def do_air_front_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_air_front_attack
    @attack_motion_plan = @battler.motion_plan_air_front_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_air_front_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_air_front_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 空中上攻撃
  #--------------------------------------------------------------------------
  def do_air_upper_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_air_upper_attack
    @attack_motion_plan = @battler.motion_plan_air_upper_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_air_upper_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_air_upper_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 空中下攻撃
  #--------------------------------------------------------------------------
  def do_air_lower_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_air_lower_attack
    @attack_motion_plan = @battler.motion_plan_air_lower_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_air_lower_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_air_lower_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ 空中後攻撃
  #--------------------------------------------------------------------------
  def do_air_arear_attack
    @handling_priority = 1
    # 設定
    @action_duration    = @battler.motion_time_air_arear_attack
    @attack_motion_plan = @battler.motion_plan_air_arear_attack.dup
    @attack_rectan_plan = @battler.rectan_plan_air_arear_attack.dup
    @attack_skl_id_plan = @battler.skl_id_plan_air_arear_attack.dup
  end
  #--------------------------------------------------------------------------
  # ◇ アイテム使用硬直
  #--------------------------------------------------------------------------
  def do_use_item
    @handling_priority  =  1
    @action_duration    = 20
    @attack_motion_plan = [241]    
  end
  #--------------------------------------------------------------------------
  # ◇ アイテム受け硬直
  #--------------------------------------------------------------------------
  def do_receive_item
    @handling_priority  =  1
    @action_duration    = 40
    @attack_motion_plan = [251]
  end
  #--------------------------------------------------------------------------
  # ◇ フォート(スキル使用)
  #--------------------------------------------------------------------------
  def do_forte(forte_id)
    if forte_id != nil and forte_id > 0
      # 設定
      forte_motion_database(forte_id)
    else
      # フォート未設定
      # ブザー SE を演奏
      $game_system.se_play($data_system.buzzer_se)      
    end
  end
end

# ▼▲▼ XRXL 1. ライン・図形描写 ▼▲▼
# by 桜雅 在土, 和希, fukuyama

#==============================================================================
# ◇ 外部ライブラリ
#==============================================================================
class Bitmap
  #--------------------------------------------------------------------------
  # ● ライン描画 by 桜雅 在土
  #--------------------------------------------------------------------------
  def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
    # 描写距離の計算。大きめに直角時の長さ。
    distance = (start_x - end_x).abs + (start_y - end_y).abs
    # 描写開始
    if end_color == start_color
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        if width == 1
          self.set_pixel(x, y, start_color) 
        else
          self.fill_rect(x, y, width, width, start_color) 
        end
      end
    else
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
        b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
        if width == 1
          self.set_pixel(x, y, Color.new(r, g, b, a))
        else
          self.fill_rect(x, y, width, width, Color.new(r, g, b, a)) 
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 多角形の描画(塗りつぶしなし) by 和希
  #    peaks    : 頂点座標の配列 [[x1,y1],[x2,y2],[x3,y3], ... ]
  #    color    : 線の色
  #    width    : 線の幅
  #--------------------------------------------------------------------------
  def draw_polygon(peaks, color, width = 1)
    # 辺(=頂点)の個数分だけ辺を描く
    for i in 0 ... (peaks.size - 1)
      # 頂点同士を線で結ぶ
      draw_line( peaks[i][0], peaks[i][1], peaks[i+1][0], peaks[i+1][1], color, width )
    end
    # 最後の頂点と最初の頂点を結ぶ
    draw_line( peaks[peaks.size - 1][0], peaks[peaks.size - 1][1], peaks[0][0], peaks[0][1], color, width )
  end
  #--------------------------------------------------------------------------
  # ● Rectの描画(draw_polygonを利用)
  #--------------------------------------------------------------------------
  def draw_rect(rect, color = Color.new(255, 255, 255, 255))
    self.draw_polygon([
      [rect.x             , rect.y              ],
      [rect.x + rect.width, rect.y              ],
      [rect.x + rect.width, rect.y + rect.height],
      [rect.x             , rect.y + rect.height]
    ],
    color, 1)
  end
end

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor   :update_cp_only                   # CPメーターのみの更新
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp7_initialize initialize
  def initialize
    xrxs_bp7_initialize
    # ↓Full-Viewの場合は下二行の # を消してください。
    self.opacity = 0
    self.back_opacity = 0
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias xrxs_bp7_refresh refresh
  def refresh
    if @update_cp_only
      xrxs_bp7_refresh
      return
    end
    # 描写を禁止しながら戻す
    @draw_ban = true
    xrxs_bp7_refresh
    # 描写の禁止を解除
    @draw_ban = false
    # 描写を開始
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 21
      # 歩行キャラグラフィックの描写
      draw_actor_graphic(actor, actor_x - 9, 116)
      # HP/SPメーターの描写
      draw_actor_hp_meter_line(actor, actor_x,  72, 96, 12)
      draw_actor_sp_meter_line(actor, actor_x, 104, 96, 12)
      # HP数値の描写
      self.contents.font.size = 24            # HP/SP数値の文字の大きさ
      self.contents.font.color = actor.hp == 0 ? knockout_color :
        actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      draw_shadow_text(actor_x-2, 58, 96, 24, actor.hp.to_s, 2)
      # SP数値の描写
      self.contents.font.color = actor.sp == 0 ? knockout_color :
        actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      draw_shadow_text(actor_x-2, 90, 96, 24, actor.sp.to_s, 2)
      # 用語「HP」と用語「SP」の描写
      self.contents.font.size = 12            # 用語「HP/SP」の文字の大きさ
      self.contents.font.color = system_color # 用語「HP/SP」の文字の色
      draw_shadow_text(actor_x, 60, 96, 12, $data_system.words.hp)
      draw_shadow_text(actor_x, 92, 96, 12, $data_system.words.sp)
      
      draw_actor_state(actor, actor_x, 100)
    end
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● HPメーター の描画
  #--------------------------------------------------------------------------
  def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.hp / actor.maxhp
    hp_color_1 = Color.new(255,   0,   0, 192)
    hp_color_2 = Color.new(255, 255,   0, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  end
  #--------------------------------------------------------------------------
  # ● SPメーター の描画
  #--------------------------------------------------------------------------
  def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.sp / actor.maxsp
    hp_color_1 = Color.new(  0,   0, 255, 192)
    hp_color_2 = Color.new(  0, 255, 255, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  end
  #--------------------------------------------------------------------------
  # ● 名前の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_name draw_actor_name
  def draw_actor_name(actor, x, y)
    xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● ステートの描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_state draw_actor_state
  def draw_actor_state(actor, x, y, width = 120)
    xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● HP の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_hp draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● SP の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_sp draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  end
end
#==============================================================================
# ◇ 外部ライブラリ
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  # ● ライン描画 by 桜雅 在土
  #--------------------------------------------------------------------------
  def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
    # 描写距離の計算。大きめに直角時の長さ。
    distance = (start_x - end_x).abs + (start_y - end_y).abs
    # 描写開始
    if end_color == start_color
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        self.contents.fill_rect(x, y, width, width, start_color) 
      end
    else
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
        b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
        self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a)) 
      end
    end
  end

  #--------------------------------------------------------------------------
  # ● 影文字描画 by TOMY
  #--------------------------------------------------------------------------
  def draw_shadow_text(x, y, width, height, string, align = 0)
    # 元の色を保存しておく
    color = self.contents.font.color.dup
    # 黒字で影描画
    self.contents.font.color = Color.new(0, 0, 0)
    self.contents.draw_text(x + 2, y + 2, width, height, string, align)
    # 元の色に戻して描画
    self.contents.font.color = color
    self.contents.draw_text(x, y, width, height, string, align)
  end
end

#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :x_pos                    # バトルフィールド 横 位置(+が右 )
  attr_accessor :y_pos                    # バトルフィールド 高さ 位置(+が上 )
  attr_accessor :z_pos                    # バトルフィールド奥行き位置(+が手前)
  attr_accessor :zoom                     # 現在のズーム倍率
  attr_accessor :x_destination            # X 目的地
  attr_accessor :y_blow                   # 現在Y 吹っ飛び速度
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :actor_in_battlefield     # アクターもフィールドに
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias xrxs_bp8_setup setup
  def setup(actor_id)
    xrxs_bp8_setup(actor_id)
    # 機能"アクターもフィールドに"
    # trueを優先する
    @actor_in_battlefield = false if @actor_in_battlefield != true
  end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :actor_in_battlefield     # アクターもフィールドに
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize(troop_id, member_index)
    @actor_in_battlefield = false
    @x_pos          =   $data_troops[troop_id].members[member_index].x - 320
    @y_pos          = -($data_troops[troop_id].members[member_index].y - 304)
    @field_x_offset = -192
    @field_y_offset = -144
    @z_pos          =    0
    @zoom           = 1.00
    xrxs_bp8_initialize(troop_id, member_index)
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得
  #--------------------------------------------------------------------------
  def screen_x
    return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x.to_i) * @zoom
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Y 座標の取得
  #--------------------------------------------------------------------------
  def screen_y
    return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y.to_i) * @zoom
  end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # 初期化
    @z_offset = 0
    # 戻す
    xrxs_bp8_update
    # バトラーが nil の場合戻る
    return if @battler == nil
    # 敵のみにカメラが影響。
    # 見方もバトルフィールドにいる場合ここの if を外す。
    if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
      # ズーム率
      zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
      self.zoom_x = zoom
      self.zoom_y = zoom
      @battler.zoom = zoom
      # スプライトの座標を設定
      self.x = @battler.screen_x
      self.y = @battler.screen_y
      self.z = @battler.screen_z
    end
  end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize
    # 初期化
    @now_bg_x = 0
    @now_bg_y = 0
    @now_bg_z = 185
    # 通常時の実行
    xrxs_bp8_initialize
    # ビューポートを作成
    @viewport1 = Viewport.new(-192, -144, 1024, 768)
    # バトルバックスプライトを作成
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_name = ""
    # エネミースプライトを作成
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
    # 天候を作成
    @weather = RPG::Weather.new(@viewport1)
    # フレーム更新
    update
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # バトルバックのファイル名が現在のものと違う場合
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      if @battleback_sprite.bitmap != nil
        @battleback_sprite.bitmap.dispose
      end
      bg_bitmap = RPG::Cache.battleback(@battleback_name)
      bg_bitmap_stretch = Bitmap.new(1024, 768)
      bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
      @battleback_sprite.bitmap = bg_bitmap_stretch
    end
    # カメラ位置が動いた場合
    if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
      # ズーム率
      zoom = 1.00 * 185 / $xcam_z
      @battleback_sprite.zoom_x = zoom
      @battleback_sprite.zoom_y = zoom
      # カメラzによる位置の修正
      maximum = 192 * (296 - $xcam_z) / 111
      $xcam_x = [[$xcam_x, -maximum].max, maximum].min
      # 背景位置更新
      @battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
      @battleback_sprite.y =  $xcam_y * zoom - 384 * (zoom - 1)
      # 値更新
      @now_bg_x = $xcam_x
      @now_bg_y = $xcam_y
      @now_bg_z = $xcam_z
    end
    # 戻す
    xrxs_bp8_update
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias xrxs_bp8_main main
  def main
    # カメラ初期位置決定
    $xcam_x = 0
    $xcam_y = 0
    $xcam_z = 295
    # カメラの最初の目的値
    @xcam_x_destination = 0
    @xcam_y_destination = 0
    @xcam_z_destination = 185
    # 今、注目バトラーは無し。
    @xcam_watch_battler = nil
    # 初期化
    @wait_count_xcam = 0
    # 戻す
    xrxs_bp8_main
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # カメラ位置の更新。
    if @wait_count_xcam > 0
      # ウェイトカウントを減らす
      @wait_count_xcam -= 1
    else
      if $xcam_z != @xcam_z_destination
        if $xcam_z < @xcam_z_destination
          distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
        else
          distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
        end
        $xcam_z = [[$xcam_z + distance, 74].max, 296].min
      end
      if @xcam_watch_battler != nil
        if $xcam_x != @xcam_watch_battler.x_pos
          if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
            distance = @xcam_watch_battler.x_pos - $xcam_x
          elsif $xcam_x < @xcam_watch_battler.x_pos
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
          else
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
          end
          maximum = 192 * (296 - $xcam_z) / 111
          $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
        end
      elsif $xcam_x != @xcam_x_destination
        if ($xcam_x - @xcam_x_destination).abs < 8
          distance = @xcam_x_destination - $xcam_x
        elsif $xcam_x < @xcam_x_destination
          distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
        else
          distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
        end
        maximum = 192 * (296 - $xcam_z) / 111
        $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
      end
      if @xcam_watch_battler != nil
        if $xcam_y != @xcam_watch_battler.y_pos
          if ($xcam_y - @xcam_watch_battler.y_pos).abs < 8
            distance = @xcam_watch_battler.y_pos - $xcam_y
          elsif $xcam_y < @xcam_watch_battler.y_pos
            distance = [(@xcam_watch_battler.y_pos - $xcam_y)/8, 8].max
          else
            distance = [(@xcam_watch_battler.y_pos - $xcam_y)/8, -8].min
          end
          maximum = 144 * (296 - $xcam_z) / 111
          $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min          
        end
      elsif $xcam_y != @xcam_y_destination
        if $xcam_y < @xcam_y_destination
          distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
        else
          distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
        end
        maximum = 164 * (296 - $xcam_z) / 111
        $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
      end
    end
    # 通常実行
    xrxs_bp8_update
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンドフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase2 start_phase2
  def start_phase2
    # カメラ:センタリング
    @xcam_watch_battler = nil
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 戻す
    xrxs_bp8_start_phase2
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3 update_phase3
  def update_phase3
    # カメラをキャラ位置へ
    if @active_battler != nil and @active_battler.actor_in_battlefield
      @xcam_x_destination = @active_battler.x_pos
      #@xcam_z_destination = 175
    end
    xrxs_bp8_update_phase3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  def update_phase3_enemy_select
    # カメラ:敵ターゲットをズームアップ
    @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
    @xcam_z_destination = 175
    # 戻す
    xrxs_bp8_update_phase3_enemy_select
  end
  #--------------------------------------------------------------------------
  # ● エネミー選択終了
  #--------------------------------------------------------------------------
  alias xrxs_bp8_end_enemy_select end_enemy_select
  def end_enemy_select
    # カメラ:中心へ
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 戻す
    xrxs_bp8_end_enemy_select
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step2 update_phase4_step2
  def update_phase4_step2
    # 戻す
    xrxs_bp8_update_phase4_step2
    # ステップ 3 に移行する場合
    if @phase4_step == 3
      if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
        # カメラ:行動バトラーへのズームアップを予約
        @xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
        @xcam_z_destination = 175
      end
      # 最低 20 フレーム待つ
      @wait_count = 20
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # 戻す
    xrxs_bp8_update_phase4_step3
    if @target_battlers.size > 0 and
      (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
      # カメラ:ターゲットへのズームアップを予約
      @xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
      @xcam_z_destination = 185
      # もし対象アニメが「位置:画面」のものの場合
      if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
        # カメラをセンタリング
        @xcam_x_destination = 0
        # ズームアウトまでやっちゃう・w・
        @xcam_z_destination = 222
      end
    end
    # 最低 20 フレーム待つ
    @wait_count = 20
  end
  #--------------------------------------------------------------------------
  # ● アフターバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase5 start_phase5
  def start_phase5
    @xcam_z_destination = 185
    xrxs_bp8_start_phase5
  end
end
#==============================================================================
# ◇ RPG::再定義「戦闘中の"画面"アニメの位置修正」
#==============================================================================
module RPG
  class Sprite < ::Sprite
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            if $scene.is_a?(Scene_Battle)
              sprite.x = self.viewport.rect.width / 2
              sprite.y = 304
            else
              sprite.x = self.viewport.rect.width / 2
              sprite.y = self.viewport.rect.height - 160
            end
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x - self.ox + self.src_rect.width / 2
          sprite.y = self.y - self.oy + self.src_rect.height / 2
          sprite.y -= self.src_rect.height / 4 if position == 0
          sprite.y += self.src_rect.height / 4 if position == 2
        end
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end

#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :x_pos                    # バトルフィールド 横 位置(+が右 )
  attr_accessor :y_pos                    # バトルフィールド 高さ 位置(+が上 )
  attr_accessor :z_pos                    # バトルフィールド奥行き位置(+が手前)
  attr_accessor :zoom                     # 現在のズーム倍率
  attr_accessor :x_destination            # X 目的地
  attr_accessor :y_blow                   # 現在Y 吹っ飛び速度
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :actor_in_battlefield     # アクターもフィールドに
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias xrxs_bp12_setup setup
  def setup(actor_id)
    xrxs_bp12_setup(actor_id)
    # 機能"アクターもフィールドに"
    # ここを true にすると、 ↓「アクターもフィールドに」が有効になる。
    @actor_in_battlefield = true
    @x_pos          =    0
    @y_pos          =    0
    @field_x_offset = -224
    @field_y_offset = -144
    @z_pos          =    0
    @zoom           = 1.00
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得
  #--------------------------------------------------------------------------
  alias xrxs_bp12_screen_x screen_x
  def screen_x
    # パーティ内の並び順から X 座標を計算して返す
    if self.index != nil
      if @actor_in_battlefield
        return  96 - @field_x_offset + (@x_pos.to_i - $xcam_x.to_i) * @zoom
      else
        return xrxs_bp12_screen_x
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Y 座標の取得
  #--------------------------------------------------------------------------
  def screen_y
    if @actor_in_battlefield
      return  96 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y.to_i) * @zoom
    else
      return 464
    end
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias xrxs_bp12_main main
  def main
    # バトラー位置
    for battler in $game_party.actors
      case battler.index
      when 0 # パーティ1人目の位置
        battler.x_pos  = -304
        battler.z_pos  = -24
      when 1 # パーティ2人目の位置
        battler.x_pos  = -240
        battler.z_pos  = 0
      when 2 # パーティ3人目の位置
        battler.x_pos  = -192
        battler.z_pos  = -24
      when 3 # パーティ4人目の位置
        battler.x_pos  = -128
        battler.z_pos  = 0
      end
      battler.x_destination = battler.x_pos
      battler.y_blow = 0
      battler.y_pos  = 0
    end
    # 戻す
    xrxs_bp12_main
  end
end

#==============================================================================
# □ カスタマイズポイント
#==============================================================================
class Scene_Battle
  # 「状況に応じたフォーム変化を行う」
  #    (基本的に true で使用しますが、"待機アニメ"だけ使用したいとき、または
  #     Full-Move Battle Systemを使用する場合、false に設定して下さい。)
  DO_FORM_UPDATE = true
  # "バッドステート"であると判断するステートのIDの配列
  BAD_STATE_IDS = [1, 2, 3, 4, 5, 6, 7, 8]
  # 「自動アニメ」稼動
  AUTO_UPDATE_DECPLACE = true
end
#==============================================================================
# □ 固定値の設定
#==============================================================================
class Scene_Battle
  # フォームIDリスト
  FORM_ID_BASIC        =   1              # 待機:基本(1に固定)
  FORM_ID_BAD_STATE    =  31              # 待機:バッドステート
  FORM_ID_STEP3_ATTACK =   1              # 通常攻撃   :行動側アニメ時
  FORM_ID_STEP4_ATTACK = 121              # 通常攻撃   :対象側アニメ時
  FORM_ID_STEP3_GUARD  =  61              # 防御選択   :行動側アニメ時
  FORM_ID_STEP4_GUARD  =  61              # 防御選択   :対象側アニメ時
  FORM_ID_STEP3_ESCAPE =  51              # 逃げる    :行動側アニメ時
  FORM_ID_STEP4_ESCAPE =  51              # 逃げる    :対象側アニメ時
  FORM_ID_STEP3_NOMOVE =   1              # なにもしない :行動側アニメ時
  FORM_ID_STEP4_NOMOVE =   1              # なにもしない :対象側アニメ時
  FORM_ID_STEP3_SKILL  = 201              # スキル(非魔法):行動側アニメ時
  FORM_ID_STEP4_SKILL  = 211              # スキル(非魔法):対象側アニメ時
  FORM_ID_STEP3_MAGIC  = 221              # スキル( 魔法 ):行動側アニメ時
  FORM_ID_STEP4_MAGIC  = 231              # スキル( 魔法 ):対象側アニメ時
  FORM_ID_STEP3_ITEM   = 241              # アイテム使用 :行動側アニメ時
  FORM_ID_STEP4_ITEM   = 251              # アイテム使用 :対象側アニメ時
  FORM_ID_STEP4_DAMAGE =  71              # ダメージ受け
  FORM_ID_STEP4_GUARD  =  61              # 攻撃を防御時
  FORM_ID_STEP4_HEALED = 251              # 非ダメージ受け時(回復等)
  FORM_ID_STEP4_AVOID  =  51              # 回避時
  FORM_ID_WIN_ACTION   = 991              # 戦闘勝利時
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 追加・公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :now_form_id              # フォームID
  attr_accessor :battler_name_basic_form  # バトラーの基本バトラーグラフィック
  #--------------------------------------------------------------------------
  # ● フォームID
  #--------------------------------------------------------------------------
  def now_form_id
    if @now_form_id != nil
      return @now_form_id
    else
      return 1
    end
  end
  #--------------------------------------------------------------------------
  # ● バトラーグラフィックの変更
  #    form_id : 変更後のフォームのID
  #--------------------------------------------------------------------------
  def transgraphic(form_id)
    # now_form_id の更新。
    @now_form_id = form_id
    # 0 が指定された場合、グラフィックを消す
    if form_id == 0
      @battler_name = ""
      return
    end
    # 0の付加
    form_id_s = ""
    if form_id < 100
      form_id_s += "0"
    end
    if form_id < 10
      form_id_s += "0"
    end
    form_id_s += form_id.to_s
    battler_form_name = @battler_name_basic_form.to_s + "_" + form_id_s.to_s
    if FileTest.exist?("Graphics/Battlers/" + battler_form_name + ".png")
      @battler_name = battler_form_name
    elsif form_id == 1
      if FileTest.exist?("Graphics/Battlers/" + @battler_name_basic_form.to_s + ".png")
        @battler_name = @battler_name_basic_form.to_s
      end
    end
    if FileTest.exist?("Audio/SE/" + battler_form_name + ".wav")
      Audio.se_play("Audio/SE/" + battler_form_name)
    end
  end
end

#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :battler_name_basic_form      # バトラー ファイル名:基本
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias xrxs_bp11_setup setup
  def setup(actor_id)
    xrxs_bp11_setup(actor_id)
    @battler_name_basic_form = @battler_name
  end
  #--------------------------------------------------------------------------
  # ● グラフィックの変更
  #--------------------------------------------------------------------------
  alias xrxs_bp11_set_graphic set_graphic
  def set_graphic(character_name, character_hue, battler_name, battler_hue)
    xrxs_bp11_set_graphic(character_name, character_hue, battler_name, battler_hue)
    @battler_name_basic_form = @battler_name
  end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp11_initialize initialize
  def initialize(troop_id, member_index)
    xrxs_bp11_initialize(troop_id, member_index)
    @battler_name_basic_form = @battler_name
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理
  #--------------------------------------------------------------------------
  alias xrxs_bp11_main main
  def main
    @wait_count_motion = 0
    xrxs_bp11_main
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias xrxs_bp11_update update
  def update
    xrxs_bp11_update
    # バトラーグラフィック表示更新
    if @wait_count_motion > 0
      # ウェイトカウントを減らす
      @wait_count_motion -= 1
    elsif AUTO_UPDATE_DECPLACE
      for battler in $game_party.actors + $game_troop.enemies
        # バトラー待機グラフィックの更新
        trance_id = battler.now_form_id
        # 一つ進める
        trance_id += 1
        # 循環
        trance_id -= 8 if trance_id%10 == 9
        battler.transgraphic(trance_id)
      end
      @wait_count_motion = 2
    end
  end
  #--------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp11_start_phase1 start_phase1
  def start_phase1
    xrxs_bp11_start_phase1
    # モーションをリセット
    actors_motion_reset
  end
  #--------------------------------------------------------------------------
  # ● アクター達のモーションをリセット
  #--------------------------------------------------------------------------
  def actors_motion_reset
    for actor in $game_party.actors
      form_id = FORM_ID_BASIC
      for state in actor.states
        form_id = FORM_ID_BAD_STATE if BAD_STATE_IDS.include?(state.id)
      end
      actor.transgraphic(form_id)
    end
  end
  #DO_FORM_UPDATE---
  if DO_FORM_UPDATE
  #--------------------------------------------------------------------------
  # ● 勝敗判定
  #--------------------------------------------------------------------------
  alias xrxs_bp11_judge judge
  def judge
    bool = xrxs_bp11_judge
    if bool
      for battler in $game_party.actors
        if battler.dead? == false
          battler.transgraphic(FORM_ID_WIN_ACTION)
        end
      end
    end
    return bool
  end
  #--------------------------------------------------------------------------
  # ● バトル終了
  #--------------------------------------------------------------------------
  alias xrxs_bp11_battle_end battle_end
  def battle_end(result)
    # モーションを基本に戻す
    for actor in $game_party.actors
      actor.set_graphic(actor.character_name, actor.character_hue, actor.battler_name_basic_form, actor.battler_hue)
    end
    # 呼び戻す
    xrxs_bp11_battle_end(result)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  #--------------------------------------------------------------------------
  alias xrxs_bp11_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # モーション:行動側のモーション
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0  # 基本
      # 攻撃の場合
      if @active_battler.current_action.basic == 0
        @active_battler.transgraphic(FORM_ID_STEP3_ATTACK)
      end
      # 防御の場合
      if @active_battler.current_action.basic == 1
        @active_battler.transgraphic(FORM_ID_STEP3_GUARD)
      end
      # 逃げるの場合
      if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
        @active_battler.transgraphic(FORM_ID_STEP3_ESCAPE)
      end
      # 何もしないの場合
      if @active_battler.current_action.basic == 3
        @active_battler.transgraphic(FORM_ID_STEP3_NOMOVE)
      end
    when 1  # スキル時、魔法判別
      if skill_is_a_magic?(@skill)
        @active_battler.transgraphic(FORM_ID_STEP3_MAGIC)
      else
        @active_battler.transgraphic(FORM_ID_STEP3_SKILL)
      end
    when 2  # アイテム
      @active_battler.transgraphic(FORM_ID_STEP3_ITEM)
    end
    # 戻す
    xrxs_bp11_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  #--------------------------------------------------------------------------
  alias xrxs_bp11_update_phase4_step4 update_phase4_step4
  def update_phase4_step4
    # モーション:行動側のモーション
    # アクションの種別で分岐
    case @active_battler.current_action.kind
    when 0  # 基本
      # 攻撃の場合
      if @active_battler.current_action.basic == 0
        @active_battler.transgraphic(FORM_ID_STEP4_ATTACK)
      end
      # 防御の場合
      if @active_battler.current_action.basic == 1
        @active_battler.transgraphic(FORM_ID_STEP4_GUARD)
      end
      # 逃げるの場合
      if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
        @active_battler.transgraphic(FORM_ID_STEP4_ESCAPE)
      end
      # 何もしないの場合
      if @active_battler.current_action.basic == 3
        @active_battler.transgraphic(FORM_ID_STEP4_NOMOVE)
      end
    when 1  # スキル時、魔法判別
      if skill_is_a_magic?(@skill)
        @active_battler.transgraphic(FORM_ID_STEP4_MAGIC)
      else
        @active_battler.transgraphic(FORM_ID_STEP4_SKILL)
      end
    when 2  # アイテム
      @active_battler.transgraphic(FORM_ID_STEP4_ITEM)
    end
    # モーション:対象側のダメージ
    for target in @target_battlers
      if target.damage == "Miss"
        target.transgraphic(FORM_ID_STEP4_AVOID)
      elsif target.damage.is_a?(Numeric) and target.damage > 0
        if target.guarding?
          target.transgraphic(FORM_ID_STEP4_GUARD)
        else
          target.transgraphic(FORM_ID_STEP4_DAMAGE)
        end
      else
        target.transgraphic(FORM_ID_STEP4_HEALED)
      end
    end
    # 戻す
    xrxs_bp11_update_phase4_step4
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias xrxs_bp11_update_phase4_step6 update_phase4_step6
  def update_phase4_step6
    # 行動者のモーションのリセット
    form_id = FORM_ID_BASIC
    for state in @active_battler.states
      form_id = FORM_ID_BAD_STATE if BAD_STATE_IDS.include?(state.id)
    end
    @active_battler.transgraphic(form_id)
    # 対象のモーションリセット
    if @target_battlers != nil
      for target in @target_battlers
        form_id = FORM_ID_BASIC
        for state in target.states
          form_id = FORM_ID_BAD_STATE if BAD_STATE_IDS.include?(state.id)
        end
        target.transgraphic(form_id)
      end
    end
    xrxs_bp11_update_phase4_step6
  end
  end #---DO_FORM_UPDATE
  #--------------------------------------------------------------------------
  # ● スキルが魔法スキルがどうか判別
  #--------------------------------------------------------------------------
  def skill_is_a_magic?(skill)
    return false if skill == nil
    return true if skill.str_f < skill.int_f
    return false
  end
end
 
Hay quá ,bạn có thể cho tên của trang web đó ko ? đó là 1 bước tiến đó , rpg maker xp có thể dùng để làm cả game [RPG]Action , quá hay !
 
Ừm cái script này tốt lém đó.Nhưng mình không chuyên thể loại RPG chứ không dùng action

http://s15.yousendit.com/d.aspx?id=374SDY1DZFQZU3IWYYE0AIRQKM

Cái đó là mẫu . Cái này xuất xứ bến JP tui hông rõ nó nữa, chỉ biết thằng viết ra cái này cũng có 1 trang web riêng .Lúc trước tui post hình trong cái topic "download soure" + trailer đó tự làm hết , viết nhạc ...... đến giờ cũng chưa có Demo chính thức và chỉ có tin tức thông báo bình thường (bằng tiếng JP) ....

=> Ông đó giỏi thật !!
 
Ai có thì up ảnh demo lên cho xem dzới , chứ ko bít gì mà đem êề xài thử mệt lém
 
Ken à , ông cũng cho lại cái link đi nha , cái link kia die lâu roài . Tiện thể nếu được thì giới thiệu luôn chút :D
 
Back
Top