查看: 4227|回复: 3

[已经解决] 如何在战斗中更换装备?

[复制链接]
梦石
0
星屑
50
在线时间
90 小时
注册时间
2006-5-22
回帖
52
发表于 2013-2-9 12:19:09 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 jiangjie81 于 2013-2-10 21:19 编辑

找了几天,都没找到合适的脚本。

求教各位前辈,是否有战斗中更换装备、更换队友;

或能调出主菜单更换装备、队友也行。

就像FF12那样。

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

发表于 2013-2-9 14:14:23 | 显示全部楼层
本帖最后由 hcm 于 2013-2-9 20:43 编辑

http://rpg.blue/thread-247817-1-1.html
这里的脚本有。

整队脚本先放一个上来
[pre lang="ruby" line="1"]
# ===========================================================================
# ◆ A1 Scripts ◆
#    A1共通処理(RGSS2/RGSS3共用)
#
# バージョン   : 4.50 (2012/01/26)
# 作者         : A1
# URL     : http://a1tktk.web.fc2.com/
# ---------------------------------------------------------------------------
# 更新履歴   :2011/11/11 Ver1.00 新規作成
#        :2011/12/22 Ver2.00 RGSS3用と同様の処理に変更
#        :2011/12/30 Ver2.10 RGSS3用メソッドを追加
#        :2011/12/30 Ver3.00 RGSS3用共通処理と統合
#        :2011/12/31 Ver3.10 マップチップサーチの仕様を変更
#        :2011/12/31 Ver3.10 拡張通行判定を追加
#        :2012/01/01 Ver3.11 クラス名の取得処理を追加
#              :2012/01/02 Ver3.20 配列を考慮したsplit処理を追加
#              :2012/01/02 Ver3.20 配列の全ての要素を整数にする処理を追加
#              :2012/01/02 Ver3.30 注釈の処理の仕様を変更
#              :2012/01/02 Ver3.40 「前のイベントコマンドの取得」を追加
#              :2012/01/03 Ver3.50 「フレーム更新」を追加
#              :2012/01/04 Ver3.60 「指定のウィンドウが開いている間ウェイト」追加
#              :2012/01/04 Ver3.70 RGSS2用処理見直し
#              :2012/01/05 Ver3.80 注釈文字列にエスケープコマンド対応
#              :2012/01/05 Ver3.80 多次元配列を考慮したsplit処理を追加
#              :2012/01/05 Ver3.80 注釈にスクリプト処理機能を追加
#              :2012/01/10 Ver3.90 文字縁取り描画を追加
#              :2012/01/11 Ver4.00 テキストビットマップのキャッシュを追加
#              :2012/01/13 Ver4.01 「タイルセットの変更」ができなくなる不具合を修正
#              :2012/01/14 Ver4.10 split処理を強化
#              :2012/01/14 Ver4.20 空白を含む注釈コマンドに対応
#              :2012/01/14 Ver4.21 split処理の不具合を修正
#              :2012/01/21 Ver4.30 メモの内容を取得する関数を追加
#              :2012/01/24 Ver4.40 メモの内容を取得する関数を追加
#              :2012/01/24 Ver4.50 メモの内容を取得する関数を追加
# ---------------------------------------------------------------------------
# 設置場所      
#  なるべく上の方
#
# 必要スクリプト
#    なし
#==============================================================================
$imported = {} if $imported == nil
$imported["A1_Common_Script"] = 4.50
#==============================================================================
# ■ Kernel
#==============================================================================
module Kernel
  #--------------------------------------------------------------------------
  # ○ RGSSのバージョン取得
  #--------------------------------------------------------------------------
  def rgss_version
    return 3 if defined? Graphics.play_movie
    return 2 if defined? Graphics.resize_screen
    return 1
  end
  #--------------------------------------------------------------------------
  # ○ コモンスクリプトのバージョン取得
  #--------------------------------------------------------------------------
  def common_version
    $imported["A1_Common_Script"]
  end
  #--------------------------------------------------------------------------
  # ○ コモンスクリプトのバージョンが古い
  #--------------------------------------------------------------------------
  def old_common_script(script_name, version)
    msgbox("#{script_name}にはA1共通スクリプトVer#{version}以上が必要です")
  end
end
#==============================================================================
# ■ A1_System
#==============================================================================
module A1_System
end
#==============================================================================
# ■ A1_System::CommonModule
#==============================================================================

class A1_System::CommonModule
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  TWOBYTE_LIST = {
                  " " => " ",
                  "=" => "=",
                  ":" => ":"
                  }
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    define_command
  end
  #--------------------------------------------------------------------------
  # ○ 変換対象の全角文字を半角に置換
  #--------------------------------------------------------------------------
  def replace_twobyte(str)
    for key in TWOBYTE_LIST.keys
      str.gsub!(key) {TWOBYTE_LIST[key]}
    end
    return str
  end
  #--------------------------------------------------------------------------
  # ○ マイナスが含まれている文字列を数値にする
  #--------------------------------------------------------------------------
  def minus_to_i(s)
    if s[0,0] == "-"
      s.gsub!("-","")
      return s.to_i * -1
    else
      return s.to_i
    end
  end
  #--------------------------------------------------------------------------
  # ○ ミリ秒単位の現在時間
  #--------------------------------------------------------------------------
  def now_usec
    now = Time.now
    hour = now.hour * 60 * 60
    min  = now.min * 60
    sec  = now.sec
    msec = (now.usec / 1000.0).round
    return (hour + min + sec) * 1000 + msec
  end
  #--------------------------------------------------------------------------
  # ○ イベントリストの作成
  #--------------------------------------------------------------------------
  def create_event_list(code, indent, parameters)
    list = RPG::EventCommand.new
    list.code       = code
    list.indent     = indent
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ メソッド呼び出し
  #--------------------------------------------------------------------------
  def send_method(method_name)
    return send(method_name) if respond_to?(method_name)
  end
  #--------------------------------------------------------------------------
  # ○ オブジェクトの型を判断してStringならエンコード
  #--------------------------------------------------------------------------
  def encoding_string(obj)
    obj.force_encoding("UTF-8") if obj.is_a?(String)
    return obj
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から必要な情報を取得
  #--------------------------------------------------------------------------
  def note_data(note, key)
    result = []
    note.each_line {|line|
      next unless line =~ /<#{key}[ ]?(.*)>/
      return true if $1.empty?
      data = $a1_common.replace_twobyte($1).split(" ")
      for st in data
        result.push(st)
      end
    }
    return false if result.empty?
    return result
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からハッシュを作成
  #--------------------------------------------------------------------------
  def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
    list = note_data_split(note, key)
    return default if list.empty?
    list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの多元配列を取得
  #--------------------------------------------------------------------------
  def note_data_split(note, key, default = [], ret = [])
    data = note_data(note, key)
    return default unless data.is_a?(Array)
    data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 配列の内容から数値があれば変換
  #--------------------------------------------------------------------------
  def convert_integer_from_array(data, ret = [])
    data.each {|str| ret.push(convert_integer(str))}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 数値があれば変換
  #--------------------------------------------------------------------------
  def convert_integer(str)
    return $1.to_i if str =~ /(^[-]?[0-9]+$)/
    str.is_a?(Array) ? convert_integer_from_array(str) : str
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から単項目の数値を取得
  #--------------------------------------------------------------------------
  def note_data_one_value(note, key, default)
    data = note_data(note, key)
    return data[0].to_i if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容から単項目を取得
  #--------------------------------------------------------------------------
  def note_data_one(note, key, default)
    data = note_data(note, key)
    return data[0] if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの文字列を取得
  #--------------------------------------------------------------------------
  def note_data_array_str(note, key, default)
    data = note_data(note, key)
    return data[0].split(",") if data.is_a?(Array)
    return default
  end
  #--------------------------------------------------------------------------
  # ○ メモの内容からカンマ区切りの数値を取得
  #--------------------------------------------------------------------------
  def note_data_array_value(note, key, default)
    data = note_data(note, key)
    return default unless data.is_a?(Array)
    return convert_integer_from_array(split_array(data[0]))
  end
  #--------------------------------------------------------------------------
  # ○ カンマ区切りの文字列メモを変換
  #--------------------------------------------------------------------------
  def note_data_array(note, key, type, default = nil, through = true)
    ret = []
    default.each {|dat| ret.push(dat)} if default != nil
   
    data = note_data(note, key)
    return ret unless data.is_a?(Array)
   
    data = data[0].split(",")
    for d in data
      next if ret.include?(d) if through
      ret.push(d.to_i) if type.is_a?(Integer)
      ret.push(d)      if type.is_a?(String)
    end
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ ディレクトリの作成
  #--------------------------------------------------------------------------
  def make_directory(dir_name)
    Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  end
  #--------------------------------------------------------------------------
  # ○ コマンドリスト
  #--------------------------------------------------------------------------
  def make_command(command, src = "", dect = "")
    src.gsub!("/","\\")
    dect.gsub!("/","\\")
    cmd = "#{command} \"#{src}\" \"#{dect}\""
    return cmd
  end
  #--------------------------------------------------------------------------
  # ○ 素材の拡張子を取得
  #--------------------------------------------------------------------------
  def material_ext(directory, file, direct = false)
    exts = []
    exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
    exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
   
    find_file = sprintf("%s%s", directory, file) unless direct
    find_file = file if direct
   
    for ext in exts
      return ext if File.exist?(sprintf("%s%s", find_file, ext))
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # ○ 素材が存在するかチェック
  #--------------------------------------------------------------------------
  def material_exist?(directory, file, direct = false)
    return false if material_ext(directory, file, direct) == nil
    return true
  end
  #--------------------------------------------------------------------------
  # ○ ファイルコピー
  #--------------------------------------------------------------------------
  def copy_file(src, dest)
    srcFile = File.open( src, "rb" )
    dstFile = File.open( dest, "wb" )
    dstFile.write( srcFile.read )
    srcFile.close
    dstFile.close
  end
  #--------------------------------------------------------------------------
  # ○ ファイルの存在を確認してファイルコピー
  #--------------------------------------------------------------------------
  def material_copy(src, dest, directory)
    ext = material_ext(directory, src, true)
    copy_file( src + ext, dest + ext ) if ext != nil
  end
  #--------------------------------------------------------------------------
  # ○ 配列からAudioを作成
  #--------------------------------------------------------------------------
  def set_audio(sound, kind)
    case kind
    when "BGM"; audio = RPG::BGM.new
    when "BGS"; audio = RPG::BGS.new
    when "ME";  audio = RPG::ME.new
    when "SE";  audio = RPG::SE.new
    end
    audio.name   = sound[0]
    audio.volume = sound[1]
    audio.pitch  = sound[2]
    return audio
  end
  #--------------------------------------------------------------------------
  # ○ 既に準拠識別子を持っているかチェック
  #--------------------------------------------------------------------------
  def chk_rtp(file_name, default)
    return "" if file_name =~ /^VX_.*/
    return "" if file_name =~ /^XP_.*/
    return "" if file_name =~ /^2000_.*/
    return "" if file_name =~ /^2003_.*/
    return default
  end
  #--------------------------------------------------------------------------
  # ○ 先頭の $ を切り出す
  #--------------------------------------------------------------------------
  def one_character(file_name)
    return file_name unless file_name[0] == "$"
    tmp = file_name.clone
    tmp[0] = ""
    return tmp
  end
  #--------------------------------------------------------------------------
  # ○ 配列を入れ替える
  #--------------------------------------------------------------------------
  def change_array(array, index1, index2)
    tmp = array[index1]
    array[index1] = array[index2]
    array[index2] = tmp
    return array
  end
  #--------------------------------------------------------------------------
  # ○ 移動ルートの作成
  #--------------------------------------------------------------------------
  def create_move_route(repeat, skippable, wait, list)
    move_route = RPG::MoveRoute.new
    move_route.repeat    = repeat
    move_route.skippable = skippable
    move_route.wait      = wait
    move_route.list      = list
    return move_route
  end
  #--------------------------------------------------------------------------
  # ○ 移動ルートコマンドの作成
  #--------------------------------------------------------------------------
  def create_move_command(code, parameters)
    list = RPG::MoveCommand.new
    list.code       = code
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ インタプリタ起動用リストの作成
  #--------------------------------------------------------------------------
  def create_list(code, indent, parameters)
    list            = RPG::EventCommand.new
    list.code       = code
    list.indent     = indent
    list.parameters = parameters
    return list
  end
  #--------------------------------------------------------------------------
  # ○ クラス名の取得
  #--------------------------------------------------------------------------
  def class_name(class_instance)
    return class_instance.to_s.split(":")[0].gsub("#<","")
  end
  #--------------------------------------------------------------------------
  # ○ 配列を考慮したsplit
  #--------------------------------------------------------------------------
  def split_array(str)
    str = convert_escape_characters(str)
   
    ret       = []
    tmp_array = str.split(",")
   
    return strip_array_str(tmp_array) unless str.include?("[")
    tmp_str   = ""
    tmp_array.each {|s|
      if char_in_str(s, "[", "]") && tmp_str.empty?
        ret.push(s) unless s =~ /^\[/
        ret.push([s[1...s.size-1]]) if s =~ /^\[/
      else
        tmp_str = "#{tmp_str}#{s},"
        if char_in_str(tmp_str, "[", "]")
          unless tmp_str =~ /^\[/
            ret.push(tmp_str[0...tmp_str.size-1])
            tmp_str = ""
          else
            tmp_str = tmp_str[1...tmp_str.size-2]
            tmp_str = split_array(tmp_str) if tmp_str.include?("[")
            tmp_str = tmp_str.split(",") if tmp_str.include?(",")
            ret.push(tmp_str)   if tmp_str.is_a?(Array)
            ret.push([tmp_str]) if !tmp_str.is_a?(Array)
            tmp_str = ""
          end
        end
      end
    }
    return strip_array_str(ret)
  end
  #--------------------------------------------------------------------------
  # ○ 配列の中の文字列の先頭と末尾の空白を除去
  #--------------------------------------------------------------------------
  def strip_array_str(array, ret = [])
    array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  #--------------------------------------------------------------------------
  def char_in_str(str, c1, c2)
    num1 = 0
    num2 = 0
    (0...str.size).each {|i| num1 += 1 if str == c1; num2 += 1 if str == c2 }
    return num1 == num2
  end
  #--------------------------------------------------------------------------
  # ○ 制御文字の変換
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    result = text.to_s.clone
    result.gsub!(/\\/)                           { "\e" }
    result.gsub!(/\e\e/)                         { "\\" }
    result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
    result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
    result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
    result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
    result.gsub!(/\eG/i)                         { Vocab::currency_unit }
    loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
    result
  end
  #--------------------------------------------------------------------------
  # ○ アクター n 番の名前を取得
  #--------------------------------------------------------------------------
  def actor_name(n)
    actor = n >= 1 ? $game_actors[n] : nil
    actor ? actor.name : ""
  end
  #--------------------------------------------------------------------------
  # ○ パーティメンバー n 番の名前を取得
  #--------------------------------------------------------------------------
  def party_member_name(n)
    actor = n >= 1 ? $game_party.members[n - 1] : nil
    actor ? actor.name : ""
  end
  #--------------------------------------------------------------------------
  # ○ 配列を全て整数にする
  #--------------------------------------------------------------------------
  def params_to_i(params)
    ret = []
    params.each {|param| ret.push(param.to_i)}
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ 注釈コマンド定義
  #--------------------------------------------------------------------------
  def define_command
    @cmd_108 = {}
  end
  #--------------------------------------------------------------------------
  # ○ 注釈コマンド定義取得
  #--------------------------------------------------------------------------
  def cmd_108
    @cmd_108
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
  end
  #--------------------------------------------------------------------------
  # ○ 文字の幅と高さを取得
  #--------------------------------------------------------------------------
  def text_size(font, size, text)
    bitmap = Cache.system("")
    bitmap.font.name = font
    bitmap.font.size = size
    tw = bitmap.text_size(text).width
    th = bitmap.text_size(text).height
    bitmap.dispose
    return [tw, th]
  end
  #--------------------------------------------------------------------------
  # ○ 文字の幅を取得
  #--------------------------------------------------------------------------
  def text_width(font, text)
    texts = text.split("\n")
    @max_width = 0
    texts.each {|text|
      width = text_size(font.name, font.size, text)[0]
      @max_width = @max_width < width ? width : @max_width
    }
    return @max_width
  end
end
#==============================================================================
# ◆ RGSS3用処理
#==============================================================================
if rgss_version == 3
#==============================================================================
# ■ RPG::Tileset
#==============================================================================

class RPG::Tileset
  #--------------------------------------------------------------------------
  # ○ 拡張通行判定
  #--------------------------------------------------------------------------
  def ex_flags
    @ex_flags ||= Table.new(8192)
    return @ex_flags
  end
  #--------------------------------------------------------------------------
  # ○ 拡張通行判定初期化
  #--------------------------------------------------------------------------
  def init_ex_flags
    @ex_flags = Table.new(8192)
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #     depth : ネストの深さ
  #--------------------------------------------------------------------------
  alias a1_common_gi_rgss3_initialize initialize
  def initialize(depth = 0, sub_interpreter = false)
    @sub_interpreter = sub_interpreter
    a1_common_gi_rgss3_initialize(depth)
  end
  #--------------------------------------------------------------------------
  # ☆ メッセージ表示がビジー状態の間ウェイト
  #--------------------------------------------------------------------------
  alias a1_common_gi_wait_for_message wait_for_message
  def wait_for_message
    return if @sub_interpreter
    a1_common_gi_wait_for_message
  end
end
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
#  文章表示に使うメッセージウィンドウです。
#==============================================================================

class Window_Message < Window_Base
  #--------------------------------------------------------------------------
  # ☆ 通常文字の処理
  #--------------------------------------------------------------------------
  alias a1_common_wm_process_normal_character process_normal_character
  def process_normal_character(c, pos)
    wait_for_one_character_before
    a1_common_wm_process_normal_character(c, pos)
  end
  #--------------------------------------------------------------------------
  # ○ 一文字出力前のウェイト
  #--------------------------------------------------------------------------
  def wait_for_one_character_before
  end
end
#==============================================================================
# ■ RPG::Map
#==============================================================================

class RPG::Map
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return true if $a1_common.note_data(self.note, "マップチップサーチ")
    return false
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ☆ セットアップ
  #--------------------------------------------------------------------------
  alias a1_common_gm_setup setup
  def setup(map_id)
    a1_common_gm_setup(map_id)
    setup_tileset
    map_chip_search if search_map_chip?
  end
  #--------------------------------------------------------------------------
  # ★ タイルセットの取得
  #--------------------------------------------------------------------------
  def tileset
    setup_tileset unless @tileset && @now_tileset_id == @tileset_id
    return @tileset
  end
  #--------------------------------------------------------------------------
  # ○ タイルセットのセットアップ
  #--------------------------------------------------------------------------
  def setup_tileset
    @tileset        = $data_tilesets[@tileset_id].clone
    @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
    @now_tileset_id = @tileset_id
  end
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return @map.search_map_chip?
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  #--------------------------------------------------------------------------
  def all_tiles_flag?(x, y, bit)
    all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  #--------------------------------------------------------------------------
  def all_tiles_flag_ex?(x, y, bit)
    all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標の全レイヤーの拡張フラグ判定
  #--------------------------------------------------------------------------
  def layered_tiles_flag_ex?(x, y, bit)
    layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  end
  #--------------------------------------------------------------------------
  # ○ 地形タグの取得(イベント含む)
  #--------------------------------------------------------------------------
  def terrain_tag_all_tailes(x, y)
    return 0 unless valid?(x, y)
    all_tiles(x, y).each do |tile_id|
      tag = tileset.flags[tile_id] >> 12
      return tag if tag > 0
    end
    return 0
  end
end
#==============================================================================
# ■ DataManager
#------------------------------------------------------------------------------
#  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
# ほぼ全てのグローバル変数はこのモジュールで初期化されます。
#==============================================================================

module DataManager
  #--------------------------------------------------------------------------
  # ○ エイリアス用特異メソッド
  #--------------------------------------------------------------------------
  class << self
    alias :a1_common_create_game_objects :create_game_objects
  end
  #--------------------------------------------------------------------------
  # ☆ 各種ゲームオブジェクトの作成
  #--------------------------------------------------------------------------
  def self.create_game_objects
    $a1_common ||= A1_System::CommonModule.new
    a1_common_create_game_objects
  end
end
#==============================================================================
# ■ Scene_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのシーンのスーパークラスです。
#==============================================================================

class Scene_Base
  #--------------------------------------------------------------------------
  # ☆ フレーム更新(基本)
  #--------------------------------------------------------------------------
  alias a1_common_sb_update_basic update_basic
  def update_basic
    a1_common_sb_update_basic
    $a1_common.update
  end
  #--------------------------------------------------------------------------
  # ○ 指定のウィンドウが開いている間ウェイト
  #--------------------------------------------------------------------------
  def wait_for_window_open(window)
    update_basic until window.openness == 0
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ★ 制御文字の事前変換
  #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  #    文字「\」はエスケープ文字(\e)に変換。
  #--------------------------------------------------------------------------
  def convert_escape_characters(text)
    return $a1_common.convert_escape_characters(text)
  end
end
#==============================================================================
# ◆ RGSS2用処理
#==============================================================================
elsif rgss_version == 2
#==============================================================================
# ■ Window
#==============================================================================

class Window
  #--------------------------------------------------------------------------
  # ○ ウィンドウが開いている?
  #--------------------------------------------------------------------------
  def open?
    return self.openness == 255
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウが閉じている?
  #--------------------------------------------------------------------------
  def close?
    return self.openness == 0
  end
end
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
# です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
# のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
# を返すようになっています。
#==============================================================================

module Cache
  #--------------------------------------------------------------------------
  # ○ キャッシュ存在チェック
  #--------------------------------------------------------------------------
  def self.include?(key)
    @cache[key] && !@cache[key].disposed?
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ 注釈
  #--------------------------------------------------------------------------
  def command_108
    @comments = [@params[0]]
    while next_event_code == 408
      @index += 1
      @comments.push(@list[@index].parameters[0])
    end
  end
  #--------------------------------------------------------------------------
  # ★ イベントコマンドの実行
  #--------------------------------------------------------------------------
  def execute_command
    return rgss3_execute_command unless @index >= @list.size-1
    command_end
    return true
  end
  #--------------------------------------------------------------------------
  # ○ RGSS3風「イベントコマンドの実行」
  #--------------------------------------------------------------------------
  def rgss3_execute_command
    command = @list[@index]
    @params = command.parameters
    @indent = command.indent
    method_name = "command_#{command.code}"
    send(method_name) if respond_to?(method_name)
  end
  #--------------------------------------------------------------------------
  # ○ 次のイベントコマンドのコードを取得
  #--------------------------------------------------------------------------
  def next_event_code
    @list[@index + 1].code
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ○ マップチップを調べるか判定する
  #--------------------------------------------------------------------------
  def search_map_chip?
    return $data_map_infos[@map_id].name =~ /\[サーチ\]/
  end
  #--------------------------------------------------------------------------
  # ○ 指定座標に存在するタイル扱いイベント(すり抜け以外)の配列取得
  #--------------------------------------------------------------------------
  def tile_events_xy(x, y)
    @tile_events.select {|event| event.pos_nt?(x, y) }
  end
  #--------------------------------------------------------------------------
  # ○ タイル扱いイベントの配列をリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_tile_events
    @tile_events = @events.values.select {|event| event.tile? }
  end
end
#==============================================================================
# ■ Game_Character
#------------------------------------------------------------------------------
#  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
# クラスのスーパークラスとして使用されます。
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # ○ タイル判定
  #--------------------------------------------------------------------------
  def tile?
    @tile_id > 0 && @priority_type == 0
  end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  タイトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ☆ データベースのロード
  #--------------------------------------------------------------------------
  alias a1_common_st_load_database load_database
  def load_database
    a1_common_st_load_database
    $data_map_infos = load_data("Data/MapInfos.rvdata")
  end
  #--------------------------------------------------------------------------
  # ☆ 各種ゲームオブジェクトの作成
  #--------------------------------------------------------------------------
  alias a1_common_st_create_game_objects create_game_objects
  def create_game_objects
    $a1_common ||= A1_System::CommonModule.new
    a1_common_st_create_game_objects
  end
end
#==============================================================================
# ◆ RGSS用処理
#==============================================================================
elsif rgss_version == 1
end
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
# です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
# のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
# を返すようになっています。
#==============================================================================

module Cache
  #--------------------------------------------------------------------------
  # ○ 拡大縮小したビットマップのロード
  #--------------------------------------------------------------------------
  def self.load_resize_bitmap(load_path, key, resize = nil)
    @cache ||= {}
    key = load_path if key == nil
    return @cache[key] if include?(key)
   
    @cache[key] = Bitmap.new(load_path)
    return @cache[key] if resize == nil
    return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
   
    info = calc_size(resize, key)
    return resize_bitmap(@cache[key], info[0], info[1], key)
  end
  #--------------------------------------------------------------------------
  # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  #--------------------------------------------------------------------------
  def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
    key = [path, hue]
    return @cache[key] if include?(key)
   
    @cache[key] = load_resize_bitmap(load_path, path, resize).clone
    @cache[key].hue_change(hue)
    return @cache[key]
  end
  #--------------------------------------------------------------------------
  # ○ リサイズするサイズを取得
  #--------------------------------------------------------------------------
  def self.calc_size(resize, key)
    width  = resize[0]
    width  = @cache[key].width * width.abs if width < 0
    height = resize[1]
    height = @cache[key].height * height.abs if height < 0
    height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
    return [width, height]
  end
  #--------------------------------------------------------------------------
  # ○ ビットマップの拡大縮小
  #--------------------------------------------------------------------------
  def self.resize_bitmap(bitmap, width, height, key)
    resize = Bitmap.new(width, height)
    resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
    @cache[key] = resize
    return resize
  end
  #--------------------------------------------------------------------------
  # ○ テキストビットマップの取得
  #--------------------------------------------------------------------------
  def self.text_picture(text, font)
    load_text_bitmap(text, font)
  end
  #--------------------------------------------------------------------------
  # ○ フォントのキーを作成
  #--------------------------------------------------------------------------
  def self.make_font_key(text, font)
    [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  end
  #--------------------------------------------------------------------------
  # ○ テキストビットマップの作成
  #--------------------------------------------------------------------------
  def self.load_text_bitmap(text, font)
    @cache ||= {}
    key = make_font_key(text, font)
    return @cache[key] if include?(key)
   
    # 計算用ダミービットマップ
    bitmap = Cache.system("")
    bitmap.font = font
    tw = bitmap.text_size(text).width + 8
   
    # ビットマップ作成
    bitmap = Bitmap.new(tw, bitmap.font.size + 4)
    bitmap.font = font
    bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
   
    @cache[key] = bitmap
    return @cache[key]
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # ○ 注釈
  #--------------------------------------------------------------------------
  alias a1_common_command_108 command_108
  def command_108
    a1_common_command_108
    proc_comment(@comments)
  end
  #--------------------------------------------------------------------------
  # ○ 注釈の処理
  #--------------------------------------------------------------------------
  def proc_comment(comments)
    param = ""
    comments.each {|comment| param += comment }
    params = param.sub(/^(\S+)/, "")
    command = $1
    comment_parameters = $a1_common.split_array(params) if params
    proc_comment_command(command, comment_parameters)
  end
  #--------------------------------------------------------------------------
  # ○ 注釈の実行
  #--------------------------------------------------------------------------
  def proc_comment_command(command, params)
    cmd_108 = $a1_common.cmd_108[command]
    method(cmd_108).call(params) if cmd_108 != nil
  end
  #--------------------------------------------------------------------------
  # ○ 前のイベントコマンドを取得
  #--------------------------------------------------------------------------
  def prev_event
    @list[@index - 1]
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
# このクラスのインスタンスは $game_map で参照されます。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ○ 全マップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search
    tileset.init_ex_flags
    (0...@map.data.xsize).each {|x| map_chip_search_y(x) }
  end
  #--------------------------------------------------------------------------
  # ○ x座標にあるy座標のマップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search_y(x)
    (0...@map.data.ysize).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  end
  #--------------------------------------------------------------------------
  # ○ x,y座標にあるz座標のマップチップを調べる
  #--------------------------------------------------------------------------
  def map_chip_search_z(x, y)
    (0...@map.data.zsize).each {|z| map_chip_proc(x, y, z) }
    tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  end
  #--------------------------------------------------------------------------
  # ○ 座標に対して処理を行う
  #--------------------------------------------------------------------------
  def map_pos_proc(x, y)
  end
  #--------------------------------------------------------------------------
  # ○ マップチップに対して処理を行う
  #--------------------------------------------------------------------------
  def map_chip_proc(x, y, z)
  end
  #--------------------------------------------------------------------------
  # ○ タイルのイベントに対して処理を行う
  #--------------------------------------------------------------------------
  def tile_event_proc(tile_id)
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ 入力を受け付けるか?
  #--------------------------------------------------------------------------
  def can_input?
    @can_input
  end
  #--------------------------------------------------------------------------
  # ○ 入力受け付け設定
  #--------------------------------------------------------------------------
  def can_input=(flag)
    @can_input = flag
  end
end
#==============================================================================
# ■ Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # ○ 文字縁取り描画
  #--------------------------------------------------------------------------
  def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
    shadow = self.font.shadow
    b_color = self.font.color.dup
    font.shadow = false
    font.color = color
    draw_text(x + 1, y, width, height, str, align)
    draw_text(x - 1, y, width, height, str, align)
    draw_text(x, y + 1, width, height, str, align)
    draw_text(x, y - 1, width, height, str, align)
    font.color = b_color
    draw_text(x, y, width, height, str, align)
    font.shadow = shadow
  end
  #--------------------------------------------------------------------------
  # ○ 文字縁取り描画の矩形を取得
  #--------------------------------------------------------------------------
  def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
    draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  end
end
[/pre]
[pre lang="ruby" line="1"]
# ===========================================================================
# ◆ A1 Scripts ◆
#    A1バトル共通スクリプト(RGSS3)
#
# バージョン   : 1.23 (2012/01/27)
# 作者         : A1
# URL     : http://a1tktk.web.fc2.com/
# ---------------------------------------------------------------------------
# 更新履歴   :2012/01/18 Ver1.00 リリース
#                2012/01/21 Ver1.10 装備拡張対応
#                2012/01/21 Ver1.10 メンバー加入時の不具合を修正
#                2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正
#                2012/01/24 Ver1.20 スキル拡張対応
#                2012/01/24 Ver1.21 Window_BattleActorの不具合を修正
#                2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正
#                2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正
# ---------------------------------------------------------------------------
# 設置場所      
#  A1共通スクリプトより下
#    一部再定義メソッドがあるため、なるべく上の方
#
# 必要スクリプト
#    A1共通スクリプトVer4.30以上
#==============================================================================
$imported = {} if $imported == nil
if $imported["A1_Common_Script"]
$imported["A1_BattleCommonScript"] = true
old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ メソッドの定義
  #--------------------------------------------------------------------------
  def define_method(method, symbol)
    @method ||= {}
    @method[symbol] = method
  end
  #--------------------------------------------------------------------------
  # ○ メソッドのコール
  #--------------------------------------------------------------------------
  def call_method(symbol, *args)
    @method ||= {}
    @method[symbol].call(*args) if @method[symbol]
  end
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの描画(解放なし)
  #--------------------------------------------------------------------------
  def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)
    bitmap = Cache.face(face_name)
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  end
  #--------------------------------------------------------------------------
  # ○ 背景の描画
  #--------------------------------------------------------------------------
  def draw_background(rect)
    temp_rect = rect.clone
    temp_rect.width /= 2
    contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
    temp_rect.x = temp_rect.width
    contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  end
  #--------------------------------------------------------------------------
  # ○ 背景色 1 の取得
  #--------------------------------------------------------------------------
  def back_color1
    Color.new(0, 0, 0, 192)
  end
  #--------------------------------------------------------------------------
  # ○ 背景色 2 の取得
  #--------------------------------------------------------------------------
  def back_color2
    Color.new(0, 0, 0, 0)
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
#==============================================================================

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # ○ センターにテキストを描画
  #--------------------------------------------------------------------------
  def draw_center_text(text)
    contents.clear
    draw_text(0, 0, contents.width, line_height, text, 1)
  end
end
#==============================================================================
# ■ Window_BattleActor
#------------------------------------------------------------------------------
#  バトル画面で、行動対象のアクターを選択するウィンドウです。
#==============================================================================

class Window_BattleActor < Window_BattleStatus
  #--------------------------------------------------------------------------
  # ★ ウィンドウの表示
  #--------------------------------------------------------------------------
  def show
    setup_remain if @info_viewport
    self.visible = true
    refresh
    open
    self
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide
    close
    @info_viewport.rect.width = Graphics.width if @info_viewport
    call_method(:select_actor_end)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    return update_basic unless self.visible
    super
    self.visible = false if self.openness == 0
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新(基本)
  #--------------------------------------------------------------------------
  def update_basic
    process_cursor_move
    process_handling
  end
  #--------------------------------------------------------------------------
  # ○ 項目の選択
  #--------------------------------------------------------------------------
  def select(index)
    super
    call_method(:select_actor, index)
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウの調整
  #--------------------------------------------------------------------------
  def setup_remain
    width_remain = Graphics.width - width
    self.x = width_remain
    @info_viewport.rect.width = width_remain
    select(0)
  end
end
#==============================================================================
# ■ Window_BattleEnemy
#------------------------------------------------------------------------------
#  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
#==============================================================================

class Window_BattleEnemy < Window_Selectable
  #--------------------------------------------------------------------------
  # ★ ウィンドウの表示
  #--------------------------------------------------------------------------
  def show
    setup_remain if @info_viewport
    self.visible = true
    open
    self
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide
    close
    @info_viewport.rect.width = Graphics.width if @info_viewport
    call_method(:select_enemy_end)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    return update_basic unless self.visible
    super
    self.visible = false if self.openness == 0
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新(基本)
  #--------------------------------------------------------------------------
  def update_basic
    process_cursor_move
    process_handling
  end
  #--------------------------------------------------------------------------
  # ○ 項目の選択
  #--------------------------------------------------------------------------
  def select(index)
    super
    call_method(:select_enemy, index)
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウの調整
  #--------------------------------------------------------------------------
  def setup_remain
    width_remain = Graphics.width - width
    self.x = width_remain
    @info_viewport.rect.width = width_remain
    select(0)
  end
end
#==============================================================================
# ■ Window_BattleSkill
#------------------------------------------------------------------------------
#  バトル画面で、使用するスキルを選択するウィンドウです。
#==============================================================================

class Window_BattleSkill < Window_SkillList
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #     info_viewport : 情報表示用ビューポート
  #--------------------------------------------------------------------------
  alias a1_psw_wbs_initialize initialize
  def initialize(help_window, info_viewport)
    a1_psw_wbs_initialize(help_window, info_viewport)
    self.openness = 0
    self.visible  = true
    @help_window.openness = 0
    @help_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ○ 高さを変える
  #--------------------------------------------------------------------------
  def resize_height(base_y)
    self.height = base_y - self.y
    create_contents
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの表示
  #--------------------------------------------------------------------------
  def show
    self.visible = true
    @help_window.visible = true
    select_last
    open
    @help_window.open
    self
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide
    close
    @help_window.close
    @info_viewport.rect.width = Graphics.width if @info_viewport
    call_method(:skill_item_window_hide)
  end
  #--------------------------------------------------------------------------
  # ○ オープン
  #--------------------------------------------------------------------------
  def open
    self.visible = true
    call_method(:skill_item_window_show)
    super
  end
  #--------------------------------------------------------------------------
  # ○ アクティブ化
  #--------------------------------------------------------------------------
  def activate
    open
    @help_window.open
    super
  end
end
#==============================================================================
# ■ Window_BattleItem
#------------------------------------------------------------------------------
#  バトル画面で、使用するアイテムを選択するウィンドウです。
#==============================================================================

class Window_BattleItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #     info_viewport : 情報表示用ビューポート
  #--------------------------------------------------------------------------
  alias a1_battle_common_wbi_initialize initialize
  def initialize(help_window, info_viewport)
    a1_battle_common_wbi_initialize(help_window, info_viewport)
    self.openness = 0
    self.visible  = true
    @help_window.openness = 0
    @help_window.visible = true
  end
  #--------------------------------------------------------------------------
  # ○ 高さを変える
  #--------------------------------------------------------------------------
  def resize_height(base_y)
    self.height = base_y - self.y
    create_contents
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの表示
  #--------------------------------------------------------------------------
  def show
    self.visible = true
    @help_window.visible = true
    select_last
    open
    @help_window.open
    self
  end
  #--------------------------------------------------------------------------
  # ★ ウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide
    close
    @help_window.close
    call_method(:skill_item_window_hide)
  end
  #--------------------------------------------------------------------------
  # ○ オープン
  #--------------------------------------------------------------------------
  def open
    self.visible = true
    call_method(:skill_item_window_show)
    super
  end
  #--------------------------------------------------------------------------
  # ○ アクティブ化
  #--------------------------------------------------------------------------
  def activate
    open
    @help_window.open
    super
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    return unless self.visible
    super
    self.visible = false if self.openness == 0
  end
end
#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
#  バトル画面で、アクターの行動を選択するウィンドウです。
#==============================================================================

class Window_ActorCommand < Window_Command
  #--------------------------------------------------------------------------
  # ☆ セットアップ
  #--------------------------------------------------------------------------
  alias a1_battle_common_wac_setup setup
  def setup(actor)
    call_method(:actor_command_setup, actor)
    a1_battle_common_wac_setup(actor)
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウのアクティブ化
  #--------------------------------------------------------------------------
  def activate
    open
    super
  end
  #--------------------------------------------------------------------------
  # ○ オープン
  #--------------------------------------------------------------------------
  def open
    call_method(:actor_command_open)
    super
  end
  #--------------------------------------------------------------------------
  # ○ クローズ
  #--------------------------------------------------------------------------
  def close
    call_method(:actor_command_close)
    super
  end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
#==============================================================================

class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ☆ リフレッシュ
  #--------------------------------------------------------------------------
  alias a1_battle_common_wbs_refresh refresh
  def refresh
    call_method(:refresh_statsu_window)
    return unless self.visible
    a1_battle_common_wbs_refresh
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウを開く
  #--------------------------------------------------------------------------
  def open
    super
    call_method(:open_status_window)
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウを閉じる
  #--------------------------------------------------------------------------
  def close
    super
    call_method(:close_status_window)
  end
  #--------------------------------------------------------------------------
  # ○ 項目の選択
  #--------------------------------------------------------------------------
  def select(index)
    super
    call_method(:select_status_window, index)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    call_method(:update_status_window)
    return unless self.visible
    super
  end
  #--------------------------------------------------------------------------
  # ○ 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    call_method(:dispose_status_window)
  end
end
#==============================================================================
# ■ Window_PersonalStatus
#==============================================================================

class Window_PersonalStatus < Window_Base
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, opacity = 0)
    super(x, y, Graphics.width / 2, 120)
    self.opacity  = opacity
    self.openness = 0
    @actor = nil
  end
  #--------------------------------------------------------------------------
  # ○ アクターの設定
  #--------------------------------------------------------------------------
  def actor=(actor)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_face(@actor.face_name, @actor.face_index, 0, 0)
    draw_text(116, line_height * 0, contents.width, line_height, @actor.name)
    draw_actor_level(@actor, 116, 0 + line_height * 1)
    draw_actor_icons(@actor, 180, 0 + line_height * 1)
    draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)
    draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)
    draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    return unless self.visible
    super
    self.visible = false if self.openness == 0
  end
  #--------------------------------------------------------------------------
  # ○ オープン
  #--------------------------------------------------------------------------
  def open
    self.visible = true
    super
  end
  #--------------------------------------------------------------------------
  # ○ 顔グラフィックの描画
  #--------------------------------------------------------------------------
  def draw_face(face_name, face_index, x, y, enabled = true)
    draw_face_no_dispose(face_name, face_index, x, y, enabled)
  end
end
#==============================================================================
# ■ RPG::Enemy
#==============================================================================

class RPG::Enemy < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ 初期装備
  #--------------------------------------------------------------------------
  def equips
    @equips ||= [0,0,0,0,0]
    @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0)
    return @equips
  end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
#  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の
# 内部で使用されます。
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ☆ オブジェクト初期化
  #--------------------------------------------------------------------------
  alias a1_battle_common_ge_initialize initialize
  def initialize(index, enemy_id)
    @equips = []
    a1_battle_common_ge_initialize(index, enemy_id)
    init_equips(enemy.equips)
  end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
# の内部で使用され、Game_Party クラス($game_party)からも参照されます。
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ★ 装備品の初期化
  #     equips : 初期装備の配列
  #--------------------------------------------------------------------------
  def init_equips(equips)
    super
  end
  #--------------------------------------------------------------------------
  # ★ 装備タイプからスロット ID に変換(空きを優先)
  #--------------------------------------------------------------------------
  def empty_slot(etype_id)
    super
  end
  #--------------------------------------------------------------------------
  # ★ 装備タイプからスロット ID のリストに変換
  #--------------------------------------------------------------------------
  def slot_list(etype_id)
    super
  end
  #--------------------------------------------------------------------------
  # ★ エディタで設定されたインデックスを装備タイプ ID に変換
  #--------------------------------------------------------------------------
  def index_to_etype_id(index)
    super
  end
  #--------------------------------------------------------------------------
  # ★ 装備スロットの配列を取得
  #--------------------------------------------------------------------------
  def equip_slots
    super
  end
  #--------------------------------------------------------------------------
  # ★ 装備品オブジェクトの配列取得
  #--------------------------------------------------------------------------
  def equips
    super
  end
  #--------------------------------------------------------------------------
  # ★ 武器オブジェクトの配列取得
  #--------------------------------------------------------------------------
  def weapons
    super
  end
  #--------------------------------------------------------------------------
  # ★ 通常能力値の加算値取得
  #--------------------------------------------------------------------------
  def param_plus(param_id)
    super
  end
  #--------------------------------------------------------------------------
  # ☆ 通常攻撃 アニメーション ID の取得
  #--------------------------------------------------------------------------
  alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1
  def atk_animation_id1
    return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)
    @current_weapon.animation_id
  end
  #--------------------------------------------------------------------------
  # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  #--------------------------------------------------------------------------
  alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2
  def atk_animation_id2
    return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)
    @current_weapon.animation_id
  end
  #--------------------------------------------------------------------------
  # ○ 装備タイプ名を取得
  #--------------------------------------------------------------------------
  def e_type_name(item)
    return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)
    return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)
  end
end
#==============================================================================
# ■ Game_BattlerBase
#------------------------------------------------------------------------------
#  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
# のクラスは Game_Battler クラスのスーパークラスとして使用されます。
#==============================================================================

class Game_BattlerBase
  #--------------------------------------------------------------------------
  # ○ 二刀流?
  #--------------------------------------------------------------------------
  def two_sword_style?
    weapons[0] && weapons[1]
  end
  #--------------------------------------------------------------------------
  # ○ バトラーオブジェクト取得
  #--------------------------------------------------------------------------
  def battler
    return actor if self.actor?
    return enemy
  end
end
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
#  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
# は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
#==============================================================================

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # ○ 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :current_weapon
  attr_accessor :current_main
  #--------------------------------------------------------------------------
  # ○ 装備品の初期化
  #     equips : 初期装備の配列
  #--------------------------------------------------------------------------
  def init_equips(equips)
    @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
    equips.each_with_index do |item_id, i|
      etype_id = index_to_etype_id(i)
      slot_id = empty_slot(etype_id)
      @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
    end
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 装備タイプからスロット ID に変換(空きを優先)
  #--------------------------------------------------------------------------
  def empty_slot(etype_id)
    list = slot_list(etype_id)
    list.find {|i| @equips.is_nil? } || list[0]
  end
  #--------------------------------------------------------------------------
  # ○ 装備タイプからスロット ID のリストに変換
  #--------------------------------------------------------------------------
  def slot_list(etype_id)
    result = []
    equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
    result
  end
  #--------------------------------------------------------------------------
  # ○ エディタで設定されたインデックスを装備タイプ ID に変換
  #--------------------------------------------------------------------------
  def index_to_etype_id(index)
    index == 1 && dual_wield? ? 0 : index
  end
  #--------------------------------------------------------------------------
  # ○ 装備スロットの配列を取得
  #--------------------------------------------------------------------------
  def equip_slots
    return [0,0,2,3,4] if dual_wield?       # 二刀流
    return [0,1,2,3,4]                      # 通常
  end
  #--------------------------------------------------------------------------
  # ○ 装備品オブジェクトの配列取得
  #--------------------------------------------------------------------------
  def equips
    @equips.collect {|item| item.object }
  end
  #--------------------------------------------------------------------------
  # ○ 武器オブジェクトの配列取得
  #--------------------------------------------------------------------------
  def weapons
    @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
  end
  #--------------------------------------------------------------------------
  # ○ 通常能力値の加算値取得
  #--------------------------------------------------------------------------
  def param_plus(param_id)
    equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }
  end
  #--------------------------------------------------------------------------
  # ○ アイテムにかける追加要素
  #--------------------------------------------------------------------------
  def ex_item_params(item, param_id)
    return 0
  end
  #--------------------------------------------------------------------------
  # ○ スキルを取得
  #--------------------------------------------------------------------------
  def skill(skill_id)
    $data_skills[skill_id]
  end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
#  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
# スのインスタンスは $game_party で参照されます。
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # ☆ アクターを加える
  #--------------------------------------------------------------------------
  alias a1_battle_common_gp_add_actor add_actor
  def add_actor(actor_id)
    return a1_battle_common_gp_add_actor(actor_id) unless in_battle
    return if @actors.include?(actor_id)
    prev_add_actor(battle_members)
    insert_actor(actor_id)
    post_add_actor($game_actors[actor_id])
  end
  #--------------------------------------------------------------------------
  # ○ アクターを加える
  #--------------------------------------------------------------------------
  def insert_actor(actor_id)
    @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size
    @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)
    $game_player.refresh
    $game_map.need_refresh = true
    return unless @remove_member_index
    @remove_member_index.delete_at(0)
    @remove_member_index = nil if @remove_member_index.empty?
  end
  #--------------------------------------------------------------------------
  # ○ アクターを加えたIndexを取得
  #--------------------------------------------------------------------------
  def new_index
    @new_index
  end
  #--------------------------------------------------------------------------
  # ○ アクターを加える前処理
  #--------------------------------------------------------------------------
  def prev_add_actor(members)
    BattleManager.call_method(:prev_add_battler, members)
  end
  #--------------------------------------------------------------------------
  # ○ アクターを加えた後処理
  #--------------------------------------------------------------------------
  def post_add_actor(member)
    BattleManager.call_method(:post_add_battler, member)
  end
  #--------------------------------------------------------------------------
  # ☆ アクターを外す
  #--------------------------------------------------------------------------
  alias a1_battle_common_gp_remove_actor remove_actor
  def remove_actor(actor_id)
    prev_remove_actor($game_actors[actor_id]) if in_battle
    a1_battle_common_gp_remove_actor(actor_id)
    post_remove_actor if in_battle
  end
  #--------------------------------------------------------------------------
  # ○ アクターを外す前処理
  #--------------------------------------------------------------------------
  def prev_remove_actor(member)
    @remove_member_index ||= []
    @remove_member_index.push(member.index)
    BattleManager.call_method(:prev_remove_battler, member)
  end
  #--------------------------------------------------------------------------
  # ○ アクターを外した後処理
  #--------------------------------------------------------------------------
  def post_remove_actor
    BattleManager.call_method(:post_remove_battler)
  end
end
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
#  戦闘の進行を管理するモジュールです。
#==============================================================================

module BattleManager
  #--------------------------------------------------------------------------
  # ○ エイリアス用特異メソッド
  #--------------------------------------------------------------------------
  class << self
    alias :a1_battle_common_bm_turn_end :turn_end
    alias :a1_battle_common_bm_turn_start :turn_start
    alias :a1_battle_common_bm_battle_end :battle_end
  end
  #--------------------------------------------------------------------------
  # ☆ ターン開始
  #--------------------------------------------------------------------------
  def self.turn_start
    @turn_end_wait = 0
    a1_battle_common_bm_turn_start
  end
  #--------------------------------------------------------------------------
  # ☆ ターン終了
  #--------------------------------------------------------------------------
  def self.turn_end
    call_method(:wait, @turn_end_wait) if @turn_end_wait > 0
    @turn_end_wait = 0
    a1_battle_common_bm_turn_end
  end
  #--------------------------------------------------------------------------
  # ○ メソッドの設定
  #--------------------------------------------------------------------------
  def self.define_method(method, symbol)
    @method ||= {}
    @method[symbol] = method
  end
  #--------------------------------------------------------------------------
  # ○ メソッドのコール
  #--------------------------------------------------------------------------
  def self.call_method(symbol, *args)
    @method[symbol].call(*args) if @method[symbol]
  end
  #--------------------------------------------------------------------------
  # ○ ターン終了後ウェイト設定
  #--------------------------------------------------------------------------
  def self.turn_end_wait=(flame)
    @turn_end_wait = flame if @turn_end_wait < flame || flame == 0
  end
  #--------------------------------------------------------------------------
  # ☆ 戦闘終了
  #     result : 結果(0:勝利 1:逃走 2:敗北)
  #--------------------------------------------------------------------------
  def self.battle_end(result)
    call_method(:battle_end, result)
    a1_battle_common_bm_battle_end(result)
  end
end
#==============================================================================
# ■ Game_Action
#------------------------------------------------------------------------------
#  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
# ます。
#==============================================================================

class Game_Action
  #--------------------------------------------------------------------------
  # ☆ ターゲットの配列作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_gac_make_targets make_targets
  def make_targets
    @targets ||= pre_make_targets
    return @targets
  end
  #--------------------------------------------------------------------------
  # ○ ターゲットの配列先行作成
  #--------------------------------------------------------------------------
  def pre_make_targets
    @targets = a1_battle_common_gac_make_targets
  end
  #--------------------------------------------------------------------------
  # ○ ターゲットの配列を取得
  #--------------------------------------------------------------------------
  def targets
    @targets.compact
  end
  #--------------------------------------------------------------------------
  # ○ ターゲットの配列をクリア
  #--------------------------------------------------------------------------
  def clear_targets
    @targets = nil
  end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ☆ 開始処理
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_start start
  def start
    a1_battle_common_sb_start
    define_battle_manager_method
  end
  #--------------------------------------------------------------------------
  # ○ バトルマネージャメソッドの定義
  #--------------------------------------------------------------------------
  def define_battle_manager_method
    BattleManager.define_method(method(:wait), :wait)
    BattleManager.define_method(method(:post_add_battler),       :post_add_battler)
    BattleManager.define_method(method(:post_remove_battler),    :post_remove_battler)
    BattleManager.define_method(method(:prev_remove_battler),    :prev_remove_battler)
    BattleManager.define_method(method(:prev_add_battler),       :prev_add_battler)
    BattleManager.define_method(method(:process_victory),        :process_victory)
    BattleManager.define_method(method(:battle_end),             :battle_end)
  end
  #--------------------------------------------------------------------------
  # ☆ ステータスウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_status_window create_status_window
  def create_status_window
    a1_battle_common_sb_create_status_window
    post_create_status_window
    define_status_window_method
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_status_window
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_status_window_method
    @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)
    @status_window.define_method(method(:close_status_window),   :close_status_window)
    @status_window.define_method(method(:open_status_window),    :open_status_window)
    @status_window.define_method(method(:select_status_window),  :select_status_window)
    @status_window.define_method(method(:update_status_window),  :update_status_window)
    @status_window.define_method(method(:dispose_status_window), :dispose_status_window)
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウがリフレッシュされた時の処理
  #--------------------------------------------------------------------------
  def refresh_statsu_window
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウがクローズされた時の処理
  #--------------------------------------------------------------------------
  def close_status_window
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウがオープンされた時の処理
  #--------------------------------------------------------------------------
  def open_status_window
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウがセレクトされた時の処理
  #--------------------------------------------------------------------------
  def select_status_window(index)
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウが更新された時の処理
  #--------------------------------------------------------------------------
  def update_status_window
  end
  #--------------------------------------------------------------------------
  # ○ ステータスウィンドウが解放された時の処理
  #--------------------------------------------------------------------------
  def dispose_status_window
  end
  #--------------------------------------------------------------------------
  # ☆ 情報表示ビューポートの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_info_viewport create_info_viewport
  def create_info_viewport
    a1_battle_common_sb_create_info_viewport
    post_create_info_viewport
  end
  #--------------------------------------------------------------------------
  # ○ 情報表示ビューポート作成の後処理
  #--------------------------------------------------------------------------
  def post_create_info_viewport
  end
  #--------------------------------------------------------------------------
  # ☆ スキルウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_skill_window create_skill_window
  def create_skill_window
    a1_battle_common_sb_create_skill_window
    post_create_skill_window
    define_skill_window_method
  end
  #--------------------------------------------------------------------------
  # ○ スキルウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_skill_window
  end
  #--------------------------------------------------------------------------
  # ○ スキルウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_skill_window_method
    @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
    @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  end
  #--------------------------------------------------------------------------
  # ☆ アイテムウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_item_window create_item_window
  def create_item_window
    a1_battle_common_sb_create_item_window
    post_create_item_window
    define_item_window_method
  end
  #--------------------------------------------------------------------------
  # ○ アイテムウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_item_window
  end
  #--------------------------------------------------------------------------
  # ○ アイテムウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_item_window_method
    @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
    @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  end
  #--------------------------------------------------------------------------
  # ○ スキル/アイテムウィンドウが表示された時の処理
  #--------------------------------------------------------------------------
  def skill_item_window_show
  end
  #--------------------------------------------------------------------------
  # ○ スキル/アイテムウィンドウが非表示になった時の処理
  #--------------------------------------------------------------------------
  def skill_item_window_hide
  end
  #--------------------------------------------------------------------------
  # ☆ パーティコマンドウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_party_command_window create_party_command_window
  def create_party_command_window
    a1_battle_common_sb_create_party_command_window
    post_create_party_command_window
    define_party_command_window_method
    define_party_command_window_handle
  end
  #--------------------------------------------------------------------------
  # ○ パーティコマンドウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_party_command_window
  end
  #--------------------------------------------------------------------------
  # ○ パーティコマンドウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_party_command_window_method
  end
  #--------------------------------------------------------------------------
  # ○ パーティコマンドウィンドウハンドルの定義
  #--------------------------------------------------------------------------
  def define_party_command_window_handle
  end
  #--------------------------------------------------------------------------
  # ☆ アクターウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_actor_window create_actor_window
  def create_actor_window
    a1_battle_common_sb_create_actor_window
    post_create_actor_window
    define_actor_window_method
  end
  #--------------------------------------------------------------------------
  # ○ アクターウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_actor_window
  end
  #--------------------------------------------------------------------------
  # ○ アクターウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_actor_window_method
    @actor_window.define_method(method(:select_actor),     :select_actor)
    @actor_window.define_method(method(:select_actor_end), :select_actor_end)
  end
  #--------------------------------------------------------------------------
  # ○ アクターウィンドウをセレクトした時の処理
  #--------------------------------------------------------------------------
  def select_actor(index)
  end
  #--------------------------------------------------------------------------
  # ○ アクターウィンドウをセレクト終了した時の処理
  #--------------------------------------------------------------------------
  def select_actor_end
  end
  #--------------------------------------------------------------------------
  # ☆ 敵キャラウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_create_enemy_window create_enemy_window
  def create_enemy_window
    a1_battle_common_sb_create_enemy_window
    post_create_enemy_window
    define_enemy_window_method
  end
  #--------------------------------------------------------------------------
  # ○ 敵キャラウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_enemy_window
  end
  #--------------------------------------------------------------------------
  # ○ 敵キャラウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_enemy_window_method
    @enemy_window.define_method(method(:select_enemy),     :select_enemy)
    @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)
  end
  #--------------------------------------------------------------------------
  # ○ 敵キャラウィンドウをセレクトした時の処理
  #--------------------------------------------------------------------------
  def select_enemy(index)
  end
  #--------------------------------------------------------------------------
  # ○ 敵キャラウィンドウをセレクト終了した時の処理
  #--------------------------------------------------------------------------
  def select_enemy_end
  end
  #--------------------------------------------------------------------------
  # ☆ アクターコマンドウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window
  def create_actor_command_window
    a1_battle_common_sb_start_create_actor_command_window
    post_create_actor_command_window
    define_actor_command_handle
    define_actor_command_window
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウ作成の後処理
  #--------------------------------------------------------------------------
  def post_create_actor_command_window
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウメソッドの定義
  #--------------------------------------------------------------------------
  def define_actor_command_window
    @actor_command_window.define_method(method(:actor_command_open),  :actor_command_open)
    @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)
    @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウハンドルの定義
  #--------------------------------------------------------------------------
  def define_actor_command_handle
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウがオープンした時の処理
  #--------------------------------------------------------------------------
  def actor_command_open
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウがクローズした時の処理
  #--------------------------------------------------------------------------
  def actor_command_close
  end
  #--------------------------------------------------------------------------
  # ○ アクターコマンドウィンドウのセットアップ時の処理
  #--------------------------------------------------------------------------
  def actor_command_setup(actor)
  end
  #--------------------------------------------------------------------------
  # ☆ パーティコマンド選択の開始
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_start_party_command_selection start_party_command_selection
  def start_party_command_selection
    prev_start_party_command_selection
    a1_battle_common_sb_start_party_command_selection
    post_start_party_command_selection
  end
  #--------------------------------------------------------------------------
  # ○ パーティコマンド選択の開始の前処理
  #--------------------------------------------------------------------------
  def prev_start_party_command_selection
  end
  #--------------------------------------------------------------------------
  # ○ パーティコマンド選択の開始の後処理
  #--------------------------------------------------------------------------
  def post_start_party_command_selection
  end
  #--------------------------------------------------------------------------
  # ☆ 次のコマンド入力へ
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_next_command next_command
  def next_command
    prev_next_command
    a1_battle_common_sb_next_command
    post_next_command
  end
  #--------------------------------------------------------------------------
  # ○ 次のコマンド入力への前処理
  #--------------------------------------------------------------------------
  def prev_next_command
  end
  #--------------------------------------------------------------------------
  # ○ 次のコマンド入力への後処理
  #--------------------------------------------------------------------------
  def post_next_command
  end
  #--------------------------------------------------------------------------
  # ☆ 前のコマンド入力へ
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_prior_command prior_command
  def prior_command
    prev_prior_command
    a1_battle_common_sb_prior_command
    post_prior_command
  end
  #--------------------------------------------------------------------------
  # ○ 前のコマンド入力への前処理
  #--------------------------------------------------------------------------
  def prev_prior_command
  end
  #--------------------------------------------------------------------------
  # ○ 前のコマンド入力への後処理
  #--------------------------------------------------------------------------
  def post_prior_command
  end
  #--------------------------------------------------------------------------
  # ☆ ターン開始
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_turn_start turn_start
  def turn_start
    prev_turn_start
    a1_battle_common_sb_turn_start
    post_turn_start
  end
  #--------------------------------------------------------------------------
  # ○ ターン開始の前処理
  #--------------------------------------------------------------------------
  def prev_turn_start
  end
  #--------------------------------------------------------------------------
  # ○ ターン開始の後処理
  #--------------------------------------------------------------------------
  def post_turn_start
  end
  #--------------------------------------------------------------------------
  # ☆ ターン終了
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_turn_end turn_end
  def turn_end
    prev_turn_end
    a1_battle_common_sb_turn_end
    post_turn_end
  end
  #--------------------------------------------------------------------------
  # ○ ターン終了の前処理
  #--------------------------------------------------------------------------
  def prev_turn_end
  end
  #--------------------------------------------------------------------------
  # ○ ターン終了の後処理
  #--------------------------------------------------------------------------
  def post_turn_end
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウが閉じるまでウェイト
  #--------------------------------------------------------------------------
  def wait_fot_window_close(window)
    update_basic while window.close?
  end
  #--------------------------------------------------------------------------
  # ○ アクターのバトルメンバー取得
  #--------------------------------------------------------------------------
  def battle_members
    @party_battle_members ||= $game_party.battle_members
    return @party_battle_members
  end
  #--------------------------------------------------------------------------
  # ○ バトルメンバーの追加の前処理
  #--------------------------------------------------------------------------
  def prev_add_battler(members)
  end
  #--------------------------------------------------------------------------
  # ○ バトルメンバーの追加後の処理
  #--------------------------------------------------------------------------
  def post_add_battler(member)
    @party_battle_members = $game_party.battle_members
  end
  #--------------------------------------------------------------------------
  # ○ バトルメンバー削除の前処理
  #--------------------------------------------------------------------------
  def prev_remove_battler(member)
  end
  #--------------------------------------------------------------------------
  # ○ バトルメンバーの削除後の処理
  #--------------------------------------------------------------------------
  def post_remove_battler
    @party_battle_members = $game_party.battle_members
  end
  #--------------------------------------------------------------------------
  # ☆ 戦闘行動の実行
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_execute_action execute_action
  def execute_action
    prev_execute_action
    a1_battle_common_sb_execute_action
    post_execute_action
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘行動の実行の前処理
  #--------------------------------------------------------------------------
  def prev_execute_action
    @subject.current_action.pre_make_targets
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘行動の実行の後処理
  #--------------------------------------------------------------------------
  def post_execute_action
    @subject.current_action.clear_targets if @subject.current_action
  end
  #--------------------------------------------------------------------------
  # ☆ スキル/アイテムの使用
  #--------------------------------------------------------------------------
  alias a1_battle_common_sb_use_item use_item
  def use_item
    prev_use_item
    a1_battle_common_sb_use_item
    post_use_item
  end
  #--------------------------------------------------------------------------
  # ○ スキル/アイテムの使用の前処理
  #--------------------------------------------------------------------------
  def prev_use_item
  end
  #--------------------------------------------------------------------------
  # ○ スキル/アイテムの使用の後処理
  #--------------------------------------------------------------------------
  def post_use_item
  end
  #--------------------------------------------------------------------------
  # ○ 勝利の処理
  #--------------------------------------------------------------------------
  def process_victory
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘終了
  #--------------------------------------------------------------------------
  def battle_end(result)
    $game_party.all_members.each {|member| init_member_battle_end(member) }
  end
  #--------------------------------------------------------------------------
  # ○ 戦闘終了時のメンバー初期化
  #--------------------------------------------------------------------------
  def init_member_battle_end(member)
    member.current_weapon = nil
    member.current_main   = nil
  end
end
end
[/pre]
[pre lang="ruby" line="1"]
#===========================================================================
# ◆ A1 Scripts ◆
#    戦闘中入れ替え(RGSS3)
#
# バージョン   : 1.00 (2012/01/18)
# 作者         : A1
# URL     : http://a1tktk.web.fc2.com/
#---------------------------------------------------------------------------
# 機能:
# ・戦闘中にメンバーを入れ替えます
#---------------------------------------------------------------------------
# 更新履歴   :2012/01/18 Ver1.00 リリース
#---------------------------------------------------------------------------
# 設置場所      
#    A1バトル共通スクリプト以下
#
# 必要スクリプト
#    A1バトル共通スクリプト
#---------------------------------------------------------------------------
# 使い方
#   導入することで適用されます
#==============================================================================
$imported ||= {}
if $imported["A1_BattleCommonScript"]
$imported["A1_ChangeMember"] = true
old_common_script("戦闘中入れ替え", "3.90") if common_version < 3.90
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================

class Window_MemberChange < Window_Selectable
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)
    @to_actor_window   = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)
    setup_members
    width              = @battle_members.size * 48 + standard_padding * 2
    height             = (@all_members.size / @battle_members.size.to_f).ceil * 48 + standard_padding * 2 + 36
    super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)
    self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height
    self.index = 0
    @from_actor = -1
    self.openness = 0
  end
  #--------------------------------------------------------------------------
  # ○ アクティブ化
  #--------------------------------------------------------------------------
  def activate
    super
    refresh
    @form_actor_window.actor = @all_members[self.index]
  end
  #--------------------------------------------------------------------------
  # ○ メンバーのセットアップ
  #--------------------------------------------------------------------------
  def setup_members
    @all_members    = $game_party.all_members
    @battle_members = $game_party.battle_members
  end
  #--------------------------------------------------------------------------
  # ○ 項目の選択
  #--------------------------------------------------------------------------
  def select(index)
    super
    @form_actor_window.actor = @all_members[self.index] if @from_actor == -1
    @to_actor_window.actor   = @all_members[self.index] if @from_actor >= 0
  end
  #--------------------------------------------------------------------------
  # ○ 項目数の取得
  #--------------------------------------------------------------------------
  def item_max
    @all_members.size
  end
  #--------------------------------------------------------------------------
  # ○ 桁数の取得
  #--------------------------------------------------------------------------
  def col_max
    @battle_members.size
  end
  #--------------------------------------------------------------------------
  # ○ リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    super
    draw_horz_line(52)
  end
  #--------------------------------------------------------------------------
  # ○ 水平線の描画
  #--------------------------------------------------------------------------
  def draw_horz_line(y)
    line_y = y + line_height / 2 - 1
    contents.fill_rect(0, line_y, contents_width, 2, line_color)
  end
  #--------------------------------------------------------------------------
  # ○ 水平線の色を取得
  #--------------------------------------------------------------------------
  def line_color
    color = normal_color
    color.alpha = 128
    color
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #--------------------------------------------------------------------------
  def draw_item(index)
    c_name  = member(index).character_name
    c_index = member(index).character_index
    rect    = item_rect(index)
    draw_character(c_name, c_index, rect.x + 24, rect.y + 40)
  end
  #--------------------------------------------------------------------------
  # ○ 項目を描画する矩形の取得
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width
    rect.height = item_height
    rect.x = index % col_max * item_width
    rect.y = index / col_max * item_height
    rect.y += 24 if index > @battle_members.size - 1
    rect
  end
  #--------------------------------------------------------------------------
  # ○ 項目の幅を取得
  #--------------------------------------------------------------------------
  def item_width
    return 48
  end
  #--------------------------------------------------------------------------
  # ○ 項目の高さを取得
  #--------------------------------------------------------------------------
  def item_height
    return 48
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ内容の高さを計算
  #--------------------------------------------------------------------------
  def contents_height
    row_max * item_height + 24
  end
  #--------------------------------------------------------------------------
  # ○ 下端パディングの更新
  #--------------------------------------------------------------------------
  def update_padding_bottom
    surplus = (height - standard_padding * 2) % item_height - 24
    self.padding_bottom = padding + surplus
  end
  #--------------------------------------------------------------------------
  # ○ メンバーの取得
  #--------------------------------------------------------------------------
  def member(index)
    @all_members[index]
  end
  #--------------------------------------------------------------------------
  # ○ 決定処理の有効状態を取得
  #--------------------------------------------------------------------------
  def ok_enabled?
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 決定ボタンが押されたときの処理
  #--------------------------------------------------------------------------
  def process_ok
    Sound.play_ok
    Input.update
    return select_start_to_actor if @from_actor == -1
    return call_cancel_handler if @from_actor == self.index
    change_member if @from_actor >= 0
    post_change_member
  end
  #--------------------------------------------------------------------------
  # ○ メンバー入れ替え
  #--------------------------------------------------------------------------
  def change_member
    $game_party.swap_order(@from_actor, self.index)
  end
  #--------------------------------------------------------------------------
  # ○ メンバー入れ替え後の処理
  #--------------------------------------------------------------------------
  def post_change_member
    setup_members
    self.index  = @from_actor
    @form_actor_window.actor = @all_members[self.index]
    @from_actor = -1
    @to_actor_window.close
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 入れ替え先のアクター選択開始
  #--------------------------------------------------------------------------
  def select_start_to_actor
    @from_actor = self.index
    @to_actor_window.open
    self.index = self.index < @battle_members.size ? @battle_members.size : 0
    @to_actor_window.actor = @all_members[self.index]
  end
  #--------------------------------------------------------------------------
  # ○ 入れ替え元のアクター
  #--------------------------------------------------------------------------
  def from_actor
    @from_actor
  end
  #--------------------------------------------------------------------------
  # ○ オープン
  #--------------------------------------------------------------------------
  def open
    super
    @form_actor_window.open
  end
  #--------------------------------------------------------------------------
  # ○ キャンセルハンドラの呼び出し
  #--------------------------------------------------------------------------
  def call_cancel_handler
    super if @from_actor == -1
    @from_actor = -1
    @to_actor_window.close
    @form_actor_window.actor = @all_members[self.index]
    activate
  end
  #--------------------------------------------------------------------------
  # ○ クローズ
  #--------------------------------------------------------------------------
  def close
    super
    @form_actor_window.close
    @to_actor_window.close
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    @form_actor_window.update
    @to_actor_window.update
  end
  #--------------------------------------------------------------------------
  # ○ 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    @form_actor_window.dispose
    @to_actor_window.dispose
  end
end
#==============================================================================
# ■ Window_PartyCommand
#------------------------------------------------------------------------------
#  バトル画面で、戦うか逃げるかを選択するウィンドウです。
#==============================================================================

class Window_PartyCommand < Window_Command
  #--------------------------------------------------------------------------
  # ☆ コマンドリストの作成
  #--------------------------------------------------------------------------
  alias a1_cbm_wpc_make_command_list make_command_list
  def make_command_list
    a1_cbm_wpc_make_command_list
    add_command("入れ替え", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
  end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ☆ 全ウィンドウの作成
  #--------------------------------------------------------------------------
  alias a1_cbm_wpc_create_all_windows create_all_windows
  def create_all_windows
    a1_cbm_wpc_create_all_windows
    create_member_change_window
  end
  #--------------------------------------------------------------------------
  # ○ 入れ替えウィンドウの作成
  #--------------------------------------------------------------------------
  def create_member_change_window
    @window_member_change = Window_MemberChange.new
    @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
  end
  #--------------------------------------------------------------------------
  # ☆ パーティコマンドウィンドウハンドルの定義
  #--------------------------------------------------------------------------
  alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
  def define_party_command_window_handle
    a1_cbm_sb_define_party_command_window_handle
    @party_command_window.set_handler(:member_change,  method(:command_member_change))
  end
  #--------------------------------------------------------------------------
  # ○ 入れ替え
  #--------------------------------------------------------------------------
  def command_member_change
    @prev_battle_members = $game_party.battle_members
    @status_window.close
    @party_command_window.close
    @window_member_change.open
    @window_member_change.activate
  end
  #--------------------------------------------------------------------------
  # ○ 変更したメンバーを取得
  #--------------------------------------------------------------------------
  def change_diss_members(ret = [])
    $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members }
    return ret
  end
  #--------------------------------------------------------------------------
  # ○ メンバーチェンジ[キャンセル]
  #--------------------------------------------------------------------------
  def on_member_change_cancel
    @party_command_window.activate
    @status_window.refresh
    @status_window.open
    @party_command_window.open
    @window_member_change.close
    change_diss_members.each {|member| member.make_actions }
    @party_battle_members = $game_party.battle_members
  end
end
end
[/pre]
回复

使用道具 举报

梦石
0
星屑
50
在线时间
90 小时
注册时间
2006-5-22
回帖
52
 楼主| 发表于 2013-2-10 20:25:44 | 显示全部楼层
请问版主,您的脚本,在大整合包里,是哪个脚本?大概叫什么名字?很难找啊

点评

LBQ
目测是Yanfly的脚本。。。  发表于 2013-2-10 20:49
回复

使用道具 举报

唯一的信徒

梦石
0
星屑
1697
在线时间
1359 小时
注册时间
2013-1-29
回帖
1537
发表于 2013-2-10 20:53:54 | 显示全部楼层
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Command Equip v1.01
  4. # -- Last Updated: 2012.01.10
  5. # -- Level: Easy, Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-CommandEquip"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.10 - Compatibility Update: Ace Battle Engine v1.15+
  15. # 2011.12.13 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # This command allows your actors to be able to change equipment in the middle
  21. # of battle by directly accessing the equip scene in the middle of battle, and
  22. # returning back to the battle scene exactly as it was. Furthermore, you can
  23. # limit how frequently your player can switch equipment for each of the actors.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. #==============================================================================
  32. # ▼ Compatibility
  33. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  35. # it will run with RPG Maker VX without adjusting.
  36. #
  37. #==============================================================================

  38. module YEA
  39.   module COMMAND_EQUIP
  40.    
  41.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  42.     # - Battle Equip Settings -
  43.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.     # This is just how the text appears visually in battle for your actors and
  45.     # how often they can change equips in battle.
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     COMMAND_TEXT   = "Equip"      # Text used for the command.
  48.     EQUIP_COOLDOWN = 2            # Turns to wait before re-equipping.
  49.    
  50.   end # COMMAND_EQUIP
  51. end # YEA

  52. #==============================================================================
  53. # ▼ Editting anything past this point may potentially result in causing
  54. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  55. # halitosis so edit at your own risk.
  56. #==============================================================================

  57. #==============================================================================
  58. # ■ SceneManager
  59. #==============================================================================

  60. module SceneManager
  61.   
  62.   #--------------------------------------------------------------------------
  63.   # new method: self.force_recall
  64.   #--------------------------------------------------------------------------
  65.   def self.force_recall(scene_class)
  66.     @scene = scene_class
  67.   end
  68.   
  69. end # SceneManager

  70. #==============================================================================
  71. # ■ Game_Battler
  72. #==============================================================================

  73. class Game_Battler < Game_BattlerBase
  74.   
  75.   #--------------------------------------------------------------------------
  76.   # alias method: on_battle_start
  77.   #--------------------------------------------------------------------------
  78.   alias game_battler_on_battle_start_ceq on_battle_start
  79.   def on_battle_start
  80.     game_battler_on_battle_start_ceq
  81.     reset_equip_cooldown
  82.   end
  83.   
  84.   #--------------------------------------------------------------------------
  85.   # new method: reset_equip_cooldown
  86.   #--------------------------------------------------------------------------
  87.   def reset_equip_cooldown
  88.     @equip_cooldown = 0
  89.   end
  90.   
  91.   #--------------------------------------------------------------------------
  92.   # alias method: on_turn_end
  93.   #--------------------------------------------------------------------------
  94.   alias game_battler_on_turn_end_ceq on_turn_end
  95.   def on_turn_end
  96.     game_battler_on_turn_end_ceq
  97.     update_equip_cooldown
  98.   end
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # new method: update_equip_cooldown
  102.   #--------------------------------------------------------------------------
  103.   def update_equip_cooldown
  104.     reset_equip_cooldown if @equip_cooldown.nil?
  105.     @equip_cooldown = [@equip_cooldown - 1, 0].max
  106.   end
  107.   
  108.   #--------------------------------------------------------------------------
  109.   # new method: battle_equippable?
  110.   #--------------------------------------------------------------------------
  111.   def battle_equippable?
  112.     reset_equip_cooldown if @equip_cooldown.nil?
  113.     return @equip_cooldown <= 0
  114.   end
  115.   
  116.   #--------------------------------------------------------------------------
  117.   # new method: set_equip_cooldown
  118.   #--------------------------------------------------------------------------
  119.   def set_equip_cooldown
  120.     @equip_cooldown = YEA::COMMAND_EQUIP::EQUIP_COOLDOWN
  121.   end
  122.   
  123.   #--------------------------------------------------------------------------
  124.   # alias method: on_battle_end
  125.   #--------------------------------------------------------------------------
  126.   alias game_battler_on_battle_end_ceq on_battle_end
  127.   def on_battle_end
  128.     game_battler_on_battle_end_ceq
  129.     reset_equip_cooldown
  130.   end
  131.   
  132. end # Game_Battler

  133. #==============================================================================
  134. # ■ Window_EquipCommand
  135. #==============================================================================

  136. class Window_EquipCommand < Window_HorzCommand
  137.   
  138.   #--------------------------------------------------------------------------
  139.   # overwrite method: handle?
  140.   #--------------------------------------------------------------------------
  141.   def handle?(symbol)
  142.     if [:pageup, :pagedown].include?(symbol) && $game_party.in_battle
  143.       return false
  144.     end
  145.     return super(symbol)
  146.   end
  147.   
  148. end # Window_EquipCommand

  149. #==============================================================================
  150. # ■ Window_ActorCommand
  151. #==============================================================================

  152. class Window_ActorCommand < Window_Command
  153.   
  154.   #--------------------------------------------------------------------------
  155.   # alias method: make_command_list
  156.   #--------------------------------------------------------------------------
  157.   alias window_actorcommand_make_command_list_ceq make_command_list
  158.   def make_command_list
  159.     window_actorcommand_make_command_list_ceq
  160.     return unless @actor
  161.     return if $imported["YEA-BattleCommandList"]
  162.     add_equip_command
  163.   end
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # new method: add_equip_command
  167.   #--------------------------------------------------------------------------
  168.   def add_equip_command
  169.     text = YEA::COMMAND_EQUIP::COMMAND_TEXT
  170.     add_command(text, :equip, @actor.battle_equippable?)
  171.   end
  172.   
  173. end # Window_ActorCommand

  174. #==============================================================================
  175. # ■ Scene_Battle
  176. #==============================================================================

  177. class Scene_Battle < Scene_Base
  178.   
  179.   #--------------------------------------------------------------------------
  180.   # alias method: create_actor_command_window
  181.   #--------------------------------------------------------------------------
  182.   alias create_actor_command_window_ceq create_actor_command_window
  183.   def create_actor_command_window
  184.     create_actor_command_window_ceq
  185.     @actor_command_window.set_handler(:equip, method(:command_equip))
  186.   end
  187.   
  188.   #--------------------------------------------------------------------------
  189.   # new method: command_equip
  190.   #--------------------------------------------------------------------------
  191.   def command_equip
  192.     Graphics.freeze
  193.     @info_viewport.visible = false
  194.     hide_extra_gauges if $imported["YEA-BattleEngine"]
  195.     SceneManager.snapshot_for_background
  196.     actor = $game_party.battle_members[@status_window.index]
  197.     $game_party.menu_actor = actor
  198.     previous_equips = actor.equips.clone
  199.     index = @actor_command_window.index
  200.     oy = @actor_command_window.oy
  201.     #---
  202.     SceneManager.call(Scene_Equip)
  203.     SceneManager.scene.main
  204.     SceneManager.force_recall(self)
  205.     #---
  206.     show_extra_gauges if $imported["YEA-BattleEngine"]
  207.     actor.set_equip_cooldown if previous_equips != actor.equips
  208.     @info_viewport.visible = true
  209.     @status_window.refresh
  210.     @actor_command_window.setup(actor)
  211.     @actor_command_window.select(index)
  212.     @actor_command_window.oy = oy
  213.     perform_transition
  214.   end
  215.   
  216. end # Scene_Battle

  217. #==============================================================================
  218. #
  219. # ▼ End of File
  220. #
  221. #==============================================================================
复制代码
接下来2个脚本:第一个是基础脚本 第二个是加强脚本 第二个才是战斗中换人 但是第二个需要第一个才能运行
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System v1.08
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-PartySystem"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Bug fixed: Party members are now rearranged when newly added.
  15. # 2012.01.14 - New Feature: Maximum Battle Members Variable added.
  16. # 2012.01.07 - Bug fixed: Error with removing members.
  17. # 2012.01.05 - Bug fixed: Escape skill/item effects no longer counts as death.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.17 - Updated Spriteset_Battle to have updated sprite counts.
  20. # 2011.12.13 - Updated to provide better visual display when more than 5 pieces
  21. #              of equipment are equipped on an actor at a time.
  22. # 2011.12.05 - Added functionality to display faces in the Party Select Window.
  23. #            - Fixed bug that doesn't refresh the caterpillar when new members
  24. #              join the party.
  25. # 2011.12.04 - Started Script and Finished.
  26. #
  27. #==============================================================================
  28. # ▼ Introduction
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # RPG Maker VX Ace comes with a very nice party system. However, changing the
  31. # maximum number of members isn't possible without the aid of a script. This
  32. # script enables you the ability to change the maximum number of party members,
  33. # change EXP rates, and/or open up a separate party menu (if desired). In
  34. # addition to that, you can lock the position of actors within a party and
  35. # require other actors to be in the active party before continuing.
  36. #
  37. #==============================================================================
  38. # ▼ Instructions
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  42. #
  43. # -----------------------------------------------------------------------------
  44. # Script Calls - These commands are used with script calls.
  45. # -----------------------------------------------------------------------------
  46. # *IMPORTANT* These script calls require the new party menu to be enabled to
  47. # use them. Otherwise, nothing will happen.
  48. #
  49. # lock_actor(x)
  50. # unlock_actor(x)
  51. # This will lock actor x in its current position in the party if the actor is
  52. # in the current party. The actor is unable to switch position and must remain
  53. # in that position until the lock is removed. Use the unlock script call to
  54. # remove the locked status. This script requires the actor to have joined and
  55. # in the current party before the script call will work.
  56. #
  57. # require_actor(x)
  58. # unrequire_actor(x)
  59. # This will cause the party to require actor x in order to continue. If the
  60. # actor isn't in the current party but is in the reserve party, the party menu
  61. # will open up and prompt the player to add the required actor into the party
  62. # before being able to continue. This script call will not function unless the
  63. # specific actor has joined the party, whether it is in the current or reserve.
  64. #
  65. # call_party_menu
  66. # This will open up the party menu. This script call requires for the party
  67. # menu to be enabled to use.
  68. #
  69. #==============================================================================
  70. # ▼ Compatibility
  71. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  73. # it will run with RPG Maker VX without adjusting.
  74. #
  75. #==============================================================================

  76. module YEA
  77.   module PARTY
  78.    
  79.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.     # - General Party Settings -
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # In this section, you can adjust the general party settings for your game
  83.     # such as the maximum amount of members and whatnot, the EXP rate for
  84.     # party members in the reserve, etc.
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     MAX_BATTLE_MEMBERS   = 5      # Maximum party members. Default: 4
  87.     SPLIT_EXP            = false  # Splits EXP with more members in the party.
  88.     RESERVE_EXP_RATE     = 0.50   # Reserve EXP Rate. Default: 1.00
  89.    
  90.     # If you wish to be able to change the maximum number of battle members
  91.     # during the middle of your game, set this constant to a variable ID. If
  92.     # that variable ID is a number greater than 0, that variable will determine
  93.     # the current maximum number of battle members. Be cautious about using
  94.     # this during battle.
  95.     MAX_MEMBERS_VARIABLE = 0
  96.    
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     # - Party Menu Settings -
  99.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100.     # This section contains various menu settings for those who wish to use a
  101.     # menu separate for the party system. Here, adjust the menu command order,
  102.     # icons used, and other settings.
  103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104.     ENABLE_MENU = true   # Enables party menu. Default: false
  105.     COMMANDS =[          # The order at which the menu items are shown.
  106.     # [:command,  "Display"],
  107.       [ :change,  "Change",],
  108.       [ :remove,  "Remove",],
  109.       [ :revert,  "Revert",],
  110.       [ :finish,  "Finish",],
  111.     ] # Do not remove this.
  112.     COMMAND_ALIGN    = 1     # 0:Left Align, 1:Center Align, 2:Right Align
  113.    
  114.     # These settings here are used for the upper right window: the Party Select
  115.     # window where the player selects a member to swap out or remove.
  116.     PARTY_FONT_SIZE  = 20    # Font size used for party member names.
  117.     LOCK_FIRST_ACTOR = false # Lock the first actor by default?
  118.     LOCKED_ICON      = 125   # Icon used for locked members.
  119.     REQUIRED_ICON    = 126   # Icon used for required members.
  120.     EMPTY_TEXT = "-Empty-"   # Text used when a member isn't present.
  121.     DISPLAY_FACE     = false # Display faces instead of sprites?
  122.    
  123.     # These settings here are used for the lower left window: the Party List
  124.     # window where the player selects a member to replace.
  125.     REMOVE_ICON      = 185          # Icon used for removing members.
  126.     REMOVE_TEXT      = "-Remove-"   # Text used for remove member command.
  127.     ACTOR_Y_BUFFER   = 12           # Amount the actor graphic be adjusted by.
  128.    
  129.     # These settings here are used for the lower right window: the Party Status
  130.     # window where info about a selected actor is shown.
  131.     NO_DATA         = "- No Data -" # Text used for when no actor is shown.
  132.     IN_PARTY_COLOUR = 6             # Text colour used for in party members.
  133.     STAT_FONT_SIZE  = 20            # Font size used for stats.
  134.     EQUIP_TEXT      = "Equipment"   # Text used to display equipment.
  135.    
  136.   end # PARTY
  137. end # YEA

  138. #==============================================================================
  139. # ▼ Editting anything past this point may potentially result in causing
  140. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  141. # halitosis so edit at your own risk.
  142. #==============================================================================

  143. #==============================================================================
  144. # ■ Icon
  145. #==============================================================================

  146. module Icon
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # self.locked_party
  150.   #--------------------------------------------------------------------------
  151.   def self.locked_party; return YEA::PARTY::LOCKED_ICON; end
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # self.required_party
  155.   #--------------------------------------------------------------------------
  156.   def self.required_party; return YEA::PARTY::REQUIRED_ICON; end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # self.remove_party
  160.   #--------------------------------------------------------------------------
  161.   def self.remove_party; return YEA::PARTY::REMOVE_ICON; end
  162.    
  163. end # Icon

  164. #==============================================================================
  165. # ■ Variable
  166. #==============================================================================

  167. module Variable
  168.   
  169.   #--------------------------------------------------------------------------
  170.   # self.max_battle_members
  171.   #--------------------------------------------------------------------------
  172.   def self.max_battle_members
  173.     default = YEA::PARTY::MAX_BATTLE_MEMBERS
  174.     return default if YEA::PARTY::MAX_MEMBERS_VARIABLE <= 0
  175.     return default if $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE] <= 0
  176.     return $game_variables[YEA::PARTY::MAX_MEMBERS_VARIABLE]
  177.   end
  178.   
  179. end # Variable

  180. #==============================================================================
  181. # ■ Numeric
  182. #==============================================================================

  183. class Numeric
  184.   
  185.   #--------------------------------------------------------------------------
  186.   # new method: group_digits
  187.   #--------------------------------------------------------------------------
  188.   unless $imported["YEA-CoreEngine"]
  189.   def group; return self.to_s; end
  190.   end # $imported["YEA-CoreEngine"]
  191.    
  192. end # Numeric

  193. #==============================================================================
  194. # ■ Game_Actor
  195. #==============================================================================

  196. class Game_Actor < Game_Battler
  197.   
  198.   #--------------------------------------------------------------------------
  199.   # public instance variables
  200.   #--------------------------------------------------------------------------
  201.   attr_accessor :locked
  202.   attr_accessor :required
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # alias method: setup
  206.   #--------------------------------------------------------------------------
  207.   alias game_actor_setup_ps setup
  208.   def setup(actor_id)
  209.     game_actor_setup_ps(actor_id)
  210.     @locked = false
  211.     @required = false
  212.   end
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # overwrite method: final_exp_rate
  216.   #--------------------------------------------------------------------------
  217.   def final_exp_rate
  218.     n = exr * (battle_member? ? 1 : reserve_members_exp_rate)
  219.     if $game_party.in_battle
  220.       n /= [$game_party.battle_members.size, 1].max if YEA::PARTY::SPLIT_EXP
  221.     end
  222.     return n
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # overwrite method: reserve_members_exp_rate
  227.   #--------------------------------------------------------------------------
  228.   def reserve_members_exp_rate
  229.     $data_system.opt_extra_exp ? YEA::PARTY::RESERVE_EXP_RATE : 0
  230.   end
  231.   
  232. end # Game_Actor

  233. #==============================================================================
  234. # ■ Game_Party
  235. #==============================================================================

  236. class Game_Party < Game_Unit
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # public instance variables
  240.   #--------------------------------------------------------------------------
  241.   attr_accessor :battle_members_array
  242.   
  243.   #--------------------------------------------------------------------------
  244.   # alias method: initialize
  245.   #--------------------------------------------------------------------------
  246.   alias game_party_initialize_ps initialize
  247.   def initialize
  248.     game_party_initialize_ps
  249.     @battle_members_array = nil
  250.   end
  251.   
  252.   #--------------------------------------------------------------------------
  253.   # overwrite method: max_battle_members
  254.   #--------------------------------------------------------------------------
  255.   def max_battle_members; return Variable.max_battle_members; end
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # alias method: setup_starting_members
  259.   #--------------------------------------------------------------------------
  260.   alias setup_starting_members_ps setup_starting_members
  261.   def setup_starting_members
  262.     setup_starting_members_ps
  263.     initialize_battle_members
  264.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  265.     return if members[0].nil?
  266.     members[0].locked = true
  267.   end
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # alias method: setup_battle_test_members
  271.   #--------------------------------------------------------------------------
  272.   alias setup_battle_test_members_ps setup_battle_test_members
  273.   def setup_battle_test_members
  274.     setup_battle_test_members_ps
  275.     return unless YEA::PARTY::LOCK_FIRST_ACTOR
  276.     return if members[0].nil?
  277.     members[0].locked = true
  278.   end
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # overwrite method: battle_members
  282.   #--------------------------------------------------------------------------
  283.   def battle_members
  284.     initialize_battle_members if initialize_battle_members?
  285.     array = []
  286.     for actor_id in @battle_members_array
  287.       break if array.size > max_battle_members
  288.       next if actor_id.nil?
  289.       next if $game_actors[actor_id].nil?
  290.       next unless $game_actors[actor_id].exist?
  291.       array.push($game_actors[actor_id])
  292.     end
  293.     return array
  294.   end
  295.   
  296.   #--------------------------------------------------------------------------
  297.   # new method: initialize_battle_members?
  298.   #--------------------------------------------------------------------------
  299.   def initialize_battle_members?
  300.     return true if @battle_members_array.nil?
  301.     return @battle_members_array.size != max_battle_members
  302.   end
  303.   
  304.   #--------------------------------------------------------------------------
  305.   # new method: initialize_battle_members
  306.   #--------------------------------------------------------------------------
  307.   def initialize_battle_members
  308.     @battle_members_array = []
  309.     for i in 0...max_battle_members
  310.       @battle_members_array.push(@actors[i]) unless @actors[i].nil?
  311.       @battle_members_array.push(0) if @actors[i].nil?
  312.     end
  313.     $game_player.refresh
  314.   end
  315.   
  316.   #--------------------------------------------------------------------------
  317.   # alias method: add_actor
  318.   #--------------------------------------------------------------------------
  319.   alias game_party_add_actor_ps add_actor
  320.   def add_actor(actor_id)
  321.     game_party_add_actor_ps(actor_id)
  322.     return if @battle_members_array.include?(actor_id)
  323.     return unless @battle_members_array.include?(0)
  324.     index = @battle_members_array.index(0)
  325.     @battle_members_array[index] = actor_id
  326.     $game_player.refresh
  327.     $game_map.need_refresh = true
  328.     rearrange_actors
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # alias method: remove_actor
  333.   #--------------------------------------------------------------------------
  334.   alias game_party_remove_actor_ps remove_actor
  335.   def remove_actor(actor_id)
  336.     game_party_remove_actor_ps(actor_id)
  337.     return unless @battle_members_array.include?(actor_id)
  338.     index = @battle_members_array.index(actor_id)
  339.     @battle_members_array[index] = 0
  340.     $game_player.refresh
  341.     $game_map.need_refresh = true
  342.     rearrange_actors
  343.   end
  344.   
  345.   #--------------------------------------------------------------------------
  346.   # new method: rearrange_actors
  347.   #--------------------------------------------------------------------------
  348.   def rearrange_actors
  349.     initialize_battle_members if @battle_members_array.nil?
  350.     array = []
  351.     for actor_id in @battle_members_array
  352.       next if [0, nil].include?(actor_id)
  353.       next if $game_actors[actor_id].nil?
  354.       array.push(actor_id)
  355.     end
  356.     for actor_id in @actors
  357.       next if array.include?(actor_id)
  358.       next if $game_actors[actor_id].nil?
  359.       array.push(actor_id)
  360.     end
  361.     @actors = array
  362.   end
  363.   
  364. end # Game_Party

  365. #==============================================================================
  366. # ■ Game_Interpreter
  367. #==============================================================================

  368. class Game_Interpreter
  369.   
  370.   #--------------------------------------------------------------------------
  371.   # new method: lock_actor
  372.   #--------------------------------------------------------------------------
  373.   def lock_actor(actor_id)
  374.     return unless YEA::PARTY::ENABLE_MENU
  375.     actor = $game_actors[actor_id]
  376.     return unless $game_party.battle_members.include?(actor.id)
  377.     actor.locked = true
  378.   end
  379.   
  380.   #--------------------------------------------------------------------------
  381.   # new method: unlock_actor
  382.   #--------------------------------------------------------------------------
  383.   def unlock_actor(actor_id)
  384.     return unless YEA::PARTY::ENABLE_MENU
  385.     actor = $game_actors[actor_id]
  386.     return unless $game_party.battle_members.include?(actor.id)
  387.     actor.locked = false
  388.   end
  389.   
  390.   #--------------------------------------------------------------------------
  391.   # new method: require_actor
  392.   #--------------------------------------------------------------------------
  393.   def require_actor(actor_id)
  394.     return unless YEA::PARTY::ENABLE_MENU
  395.     return if $game_system.formation_disabled
  396.     actor = $game_actors[actor_id]
  397.     return unless $game_party.all_members.include?(actor)
  398.     actor.required = true
  399.     call_party_menu unless $game_party.battle_members.include?(actor)
  400.   end
  401.   
  402.   #--------------------------------------------------------------------------
  403.   # new method: unrequire_actor
  404.   #--------------------------------------------------------------------------
  405.   def unrequire_actor(actor_id)
  406.     return unless YEA::PARTY::ENABLE_MENU
  407.     return if $game_system.formation_disabled
  408.     actor = $game_actors[actor_id]
  409.     return unless $game_party.all_members.include?(actor)
  410.     actor.required = false
  411.     call_party_menu unless $game_party.battle_members.include?(actor)
  412.   end
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # new method: call_party_menu
  416.   #--------------------------------------------------------------------------
  417.   def call_party_menu
  418.     return unless YEA::PARTY::ENABLE_MENU
  419.     return if $game_system.formation_disabled
  420.     SceneManager.call(Scene_Party)
  421.   end
  422.   
  423. end # Game_Interpreter

  424. #==============================================================================
  425. # ■ Spriteset_Battle
  426. #==============================================================================

  427. class Spriteset_Battle
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # overwrite method: create_actors
  431.   #--------------------------------------------------------------------------
  432.   def create_actors
  433.     total = $game_party.max_battle_members
  434.     @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
  435.   end
  436.   
  437. end # Spriteset_Battle

  438. #==============================================================================
  439. # ■ Window_PartyMenuCommand
  440. #==============================================================================

  441. class Window_PartyMenuCommand < Window_Command
  442.   
  443.   #--------------------------------------------------------------------------
  444.   # window_width
  445.   #--------------------------------------------------------------------------
  446.   def window_width; return 160; end
  447.   
  448.   #--------------------------------------------------------------------------
  449.   # visible_line_number
  450.   #--------------------------------------------------------------------------
  451.   def visible_line_number; 4; end
  452.   
  453.   #--------------------------------------------------------------------------
  454.   # alignment
  455.   #--------------------------------------------------------------------------
  456.   def alignment
  457.     return Menu.command_window_align if $imported["YEA-AceMenuEngine"]
  458.     return YEA::PARTY::COMMAND_ALIGN
  459.   end
  460.   
  461.   #--------------------------------------------------------------------------
  462.   # scene
  463.   #--------------------------------------------------------------------------
  464.   def scene; return SceneManager.scene; end
  465.   
  466.   #--------------------------------------------------------------------------
  467.   # make_command_list
  468.   #--------------------------------------------------------------------------
  469.   def make_command_list
  470.     for command in YEA::PARTY::COMMANDS
  471.       case command[0]
  472.       when :change, :remove, :revert
  473.         add_command(command[1], command[0])
  474.       when :finish
  475.         add_command(command[1], command[0], enable_cancel?)
  476.       else; next
  477.       end
  478.     end
  479.   end
  480.   
  481.   #--------------------------------------------------------------------------
  482.   # process_cancel
  483.   #--------------------------------------------------------------------------
  484.   def process_cancel
  485.     unless enable_cancel?
  486.       Sound.play_buzzer
  487.       return
  488.     end
  489.     super
  490.   end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # in_party?
  494.   #--------------------------------------------------------------------------
  495.   def in_party?(actor)
  496.     return $game_party.battle_members.include?(actor)
  497.   end
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # enable_cancel?
  501.   #--------------------------------------------------------------------------
  502.   def enable_cancel?
  503.     return false if $game_party.battle_members.size <= 0
  504.     for actor in $game_party.all_members
  505.       next if in_party?(actor)
  506.       return false if actor.required
  507.       return false if actor.locked
  508.     end
  509.     return true
  510.   end
  511.   
  512. end # Window_PartyMenuCommand

  513. #==============================================================================
  514. # ■ Window_PartySelect
  515. #==============================================================================

  516. class Window_PartySelect < Window_Selectable
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # initialize
  520.   #-------------------------------------------------------------------------
  521.   def initialize(command_window)
  522.     @command_window = command_window
  523.     super(160, 0, window_width, fitting_height(visible_line_number))
  524.     select(0)
  525.     deactivate
  526.     refresh
  527.   end
  528.   
  529.   #--------------------------------------------------------------------------
  530.   # col_max
  531.   #--------------------------------------------------------------------------
  532.   def col_max; return $game_party.max_battle_members; end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # item_max
  536.   #--------------------------------------------------------------------------
  537.   def item_max; return $game_party.max_battle_members; end
  538.   
  539.   #--------------------------------------------------------------------------
  540.   # window_width
  541.   #--------------------------------------------------------------------------
  542.   def window_width; return Graphics.width - 160; end
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # visible_line_number
  546.   #--------------------------------------------------------------------------
  547.   def visible_line_number; 4; end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # item_rect
  551.   #--------------------------------------------------------------------------
  552.   def item_rect(index)
  553.     rect = Rect.new
  554.     rect.width = contents.width / item_max
  555.     rect.height = contents.height
  556.     rect.x = index * rect.width
  557.     rect.y = 0
  558.     return rect
  559.   end
  560.   
  561.   #--------------------------------------------------------------------------
  562.   # refresh
  563.   #--------------------------------------------------------------------------
  564.   def refresh
  565.     make_item_list
  566.     create_contents
  567.     draw_all_items
  568.   end
  569.   
  570.   #--------------------------------------------------------------------------
  571.   # make_item_list
  572.   #--------------------------------------------------------------------------
  573.   def make_item_list
  574.     @data = $game_party.battle_members_array.clone
  575.   end
  576.   
  577.   #--------------------------------------------------------------------------
  578.   # draw_item
  579.   #--------------------------------------------------------------------------
  580.   def draw_item(index)
  581.     actor = $game_actors[@data[index]]
  582.     rect = item_rect(index)
  583.     if actor.nil?
  584.       draw_empty(rect.clone)
  585.       return
  586.     end
  587.     dx = rect.width / 2
  588.     dy = rect.height - 16
  589.     draw_actor_face(actor, rect.x, rect.y) if display_face?
  590.     draw_actor_graphic(actor, rect.x + dx, rect.y + dy) unless display_face?
  591.     draw_actor_name(actor, rect)
  592.     draw_locked_icon(actor, rect)
  593.     draw_required_icon(actor, rect)
  594.   end
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # display_face?
  598.   #--------------------------------------------------------------------------
  599.   def display_face?
  600.     return YEA::PARTY::DISPLAY_FAC
复制代码
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Party System Add-On: Command Party v1.01
  4. # -- Last Updated: 2012.01.10
  5. # -- Level: Easy, Normal
  6. # -- Requires: YEA - Party System v1.00+
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-CommandParty"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.10 - Compatibility Update: Ace Battle Engine v1.15+
  15. # 2011.12.13 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # An add-on to the Yanfly Engine Ace - Party System script. This script allows
  21. # the player to change party members during the middle of battle from the
  22. # Party Command Window (the Fight/Escape window).
  23. #
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # Note, if you do not give your player access to the party formation menu
  31. # available in the Party System script, this script will disable itself.
  32. #
  33. #==============================================================================
  34. # ▼ Compatibility
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  37. # it will run with RPG Maker VX without adjusting.
  38. #
  39. # This script requires Yanfly Engine Ace - Party System v1.00+.
  40. #
  41. #==============================================================================

  42. module YEA
  43.   module COMMAND_PARTY
  44.    
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.     # - Command Party Settings -
  47.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48.     # This is just how the text appears visually in battle for your party and
  49.     # how often the can change party in battle. Furthermore, there's two
  50.     # switches that may be enabled or disabled to add the command to the
  51.     # game. Adjust it as you see fit. Set the switches to 0 to not use them.
  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  53.     COMMAND_TEXT   = "Party"    # Text used for the command.
  54.     PARTY_COOLDOWN = 2          # Turns that must pass between each change.
  55.     SHOW_SWITCH    = 0          # If switch is on, show command. 0 to disable.
  56.     ENABLE_SWITCH  = 0          # If switch is on, enable command. 0 to disable.
  57.    
  58.   end # COMMAND_PARTY
  59. end # YEA

  60. #==============================================================================
  61. # ▼ Editting anything past this point may potentially result in causing
  62. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  63. # halitosis so edit at your own risk.
  64. #==============================================================================

  65. if $imported["YEA-PartySystem"]

  66. #==============================================================================
  67. # ■ SceneManager
  68. #==============================================================================

  69. module SceneManager
  70.   
  71.   #--------------------------------------------------------------------------
  72.   # new method: self.force_recall
  73.   #--------------------------------------------------------------------------
  74.   def self.force_recall(scene_class)
  75.     @scene = scene_class
  76.   end
  77.   
  78. end # SceneManager

  79. #==============================================================================
  80. # ■ Game_Unit
  81. #==============================================================================

  82. class Game_Unit
  83.   
  84.   #--------------------------------------------------------------------------
  85.   # alias method: on_battle_start
  86.   #--------------------------------------------------------------------------
  87.   alias game_unit_on_battle_start_cpt on_battle_start
  88.   def on_battle_start
  89.     game_unit_on_battle_start_cpt
  90.     reset_party_cooldown
  91.   end
  92.   
  93.   #--------------------------------------------------------------------------
  94.   # new method: reset_party_cooldown
  95.   #--------------------------------------------------------------------------
  96.   def reset_party_cooldown
  97.     @party_cooldown = 0
  98.   end
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # new method: update_party_cooldown
  102.   #--------------------------------------------------------------------------
  103.   def update_party_cooldown
  104.     reset_party_cooldown if @party_cooldown.nil?
  105.     @party_cooldown = [@party_cooldown - 1, 0].max
  106.   end
  107.   
  108.   #--------------------------------------------------------------------------
  109.   # new method: battle_party_change?
  110.   #--------------------------------------------------------------------------
  111.   def battle_party_change?
  112.     switch = YEA::COMMAND_PARTY::ENABLE_SWITCH
  113.     enabled = switch <= 0 ? true : $game_switches[switch]
  114.     return false unless enabled
  115.     reset_party_cooldown if @party_cooldown.nil?
  116.     return @party_cooldown <= 0
  117.   end
  118.   
  119.   #--------------------------------------------------------------------------
  120.   # new method: set_party_cooldown
  121.   #--------------------------------------------------------------------------
  122.   def set_party_cooldown
  123.     @party_cooldown = YEA::COMMAND_PARTY::PARTY_COOLDOWN
  124.   end
  125.   
  126.   #--------------------------------------------------------------------------
  127.   # alias method: on_battle_end
  128.   #--------------------------------------------------------------------------
  129.   alias game_unit_on_battle_end_cpt on_battle_end
  130.   def on_battle_end
  131.     game_unit_on_battle_end_cpt
  132.     reset_party_cooldown
  133.   end
  134.   
  135. end # Game_Unit

  136. #==============================================================================
  137. # ■ Window_PartyCommand
  138. #==============================================================================

  139. class Window_PartyCommand < Window_Command
  140.   
  141.   #--------------------------------------------------------------------------
  142.   # alias method: make_command_list
  143.   #--------------------------------------------------------------------------
  144.   alias window_partycommand_make_command_list_cpt make_command_list
  145.   def make_command_list
  146.     window_partycommand_make_command_list_cpt
  147.     return if $imported["YEA-BattleCommandList"]
  148.     add_party_command
  149.   end
  150.   
  151.   #--------------------------------------------------------------------------
  152.   # new method: add_party_command
  153.   #--------------------------------------------------------------------------
  154.   def add_party_command
  155.     return unless YEA::PARTY::ENABLE_MENU
  156.     show = YEA::COMMAND_PARTY::SHOW_SWITCH
  157.     continue = show == 0 ? true : $game_switches[show]
  158.     continue = false if $game_party.all_members.size < 2
  159.     return unless continue
  160.     text = YEA::COMMAND_PARTY::COMMAND_TEXT
  161.     add_command(text, :party, $game_party.battle_party_change?)
  162.   end
  163.   
  164. end # Window_PartyCommand

  165. #==============================================================================
  166. # ■ Scene_Battle
  167. #==============================================================================

  168. class Scene_Battle < Scene_Base
  169.   
  170.   #--------------------------------------------------------------------------
  171.   # alias method: create_party_command_window
  172.   #--------------------------------------------------------------------------
  173.   alias create_party_command_window_cpt create_party_command_window
  174.   def create_party_command_window
  175.     create_party_command_window_cpt
  176.     @party_command_window.set_handler(:party, method(:command_party))
  177.   end
  178.   
  179.   #--------------------------------------------------------------------------
  180.   # new method: command_party
  181.   #--------------------------------------------------------------------------
  182.   def command_party
  183.     Graphics.freeze
  184.     @info_viewport.visible = false
  185.     hide_extra_gauges if $imported["YEA-BattleEngine"]
  186.     SceneManager.snapshot_for_background
  187.     previous_party = $game_party.battle_members.clone
  188.     index = @party_command_window.index
  189.     oy = @party_command_window.oy
  190.     #---
  191.     SceneManager.call(Scene_Party)
  192.     SceneManager.scene.main
  193.     SceneManager.force_recall(self)
  194.     #---
  195.     show_extra_gauges if $imported["YEA-BattleEngine"]
  196.     if previous_party != $game_party.battle_members
  197.       $game_party.make_actions
  198.       $game_party.set_party_cooldown
  199.     end
  200.     @info_viewport.visible = true
  201.     @status_window.refresh
  202.     @party_command_window.setup
  203.     @party_command_window.select(index)
  204.     @party_command_window.oy = oy
  205.     perform_transition
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # alias method: turn_end
  210.   #--------------------------------------------------------------------------
  211.   alias scene_battle_turn_end_cpt turn_end
  212.   def turn_end
  213.     scene_battle_turn_end_cpt
  214.     return if $imported["YEA-BattleEngine"]
  215.     update_party_cooldowns
  216.   end
  217.   
  218.   #--------------------------------------------------------------------------
  219.   # new method: update_party_cooldowns
  220.   #--------------------------------------------------------------------------
  221.   def update_party_cooldowns
  222.     $game_party.update_party_cooldown
  223.     $game_troop.update_party_cooldown
  224.   end
  225.   
  226. end # Scene_Battle
  227. end # $imported["YEA-PartySystem"]

  228. #==============================================================================
  229. #
  230. # ▼ End of File
  231. #
  232. #==============================================================================
复制代码

点评

谢谢各位前辈,确实就是这三套代码。  发表于 2013-2-10 21:19
『我只是一个正在潜心修炼的渣乐师罢了』
Dear Time\(^o^)/~


假如上面的图片挂了的话麻烦各位去发个帖 @ 一下 orzFly 让他修复 deartime
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部