设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 8643|回复: 18
打印 上一主题 下一主题

[已经解决] 如何在战斗中整队

[复制链接]

Lv5.捕梦者

梦石
0
星屑
21977
在线时间
8570 小时
注册时间
2011-12-31
帖子
3362
1
发表于 2012-3-28 22:42:59 | 显示全部楼层
本帖最后由 tseyik 于 2012-3-28 23:22 编辑

http://a1tktk.web.fc2.com/scripts_page/change_member.html
A1共通スクリプト

  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1共通処理(RGSS2/RGSS3共用)
  4. #
  5. # バージョン   : 4.50 (2012/01/26)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. # ---------------------------------------------------------------------------
  9. # 更新履歴   :2011/11/11 Ver1.00 新規作成
  10. #        :2011/12/22 Ver2.00 RGSS3用と同様の処理に変更
  11. #        :2011/12/30 Ver2.10 RGSS3用メソッドを追加
  12. #        :2011/12/30 Ver3.00 RGSS3用共通処理と統合
  13. #        :2011/12/31 Ver3.10 マップチップサーチの仕様を変更
  14. #        :2011/12/31 Ver3.10 拡張通行判定を追加
  15. #        :2012/01/01 Ver3.11 クラス名の取得処理を追加
  16. #              :2012/01/02 Ver3.20 配列を考慮したsplit処理を追加
  17. #              :2012/01/02 Ver3.20 配列の全ての要素を整数にする処理を追加
  18. #              :2012/01/02 Ver3.30 注釈の処理の仕様を変更
  19. #              :2012/01/02 Ver3.40 「前のイベントコマンドの取得」を追加
  20. #              :2012/01/03 Ver3.50 「フレーム更新」を追加
  21. #              :2012/01/04 Ver3.60 「指定のウィンドウが開いている間ウェイト」追加
  22. #              :2012/01/04 Ver3.70 RGSS2用処理見直し
  23. #              :2012/01/05 Ver3.80 注釈文字列にエスケープコマンド対応
  24. #              :2012/01/05 Ver3.80 多次元配列を考慮したsplit処理を追加
  25. #              :2012/01/05 Ver3.80 注釈にスクリプト処理機能を追加
  26. #              :2012/01/10 Ver3.90 文字縁取り描画を追加
  27. #              :2012/01/11 Ver4.00 テキストビットマップのキャッシュを追加
  28. #              :2012/01/13 Ver4.01 「タイルセットの変更」ができなくなる不具合を修正
  29. #              :2012/01/14 Ver4.10 split処理を強化
  30. #              :2012/01/14 Ver4.20 空白を含む注釈コマンドに対応
  31. #              :2012/01/14 Ver4.21 split処理の不具合を修正
  32. #              :2012/01/21 Ver4.30 メモの内容を取得する関数を追加
  33. #              :2012/01/24 Ver4.40 メモの内容を取得する関数を追加
  34. #              :2012/01/24 Ver4.50 メモの内容を取得する関数を追加
  35. # ---------------------------------------------------------------------------
  36. # 設置場所      
  37. #  なるべく上の方
  38. #
  39. # 必要スクリプト
  40. #    なし
  41. #==============================================================================
  42. $imported = {} if $imported == nil
  43. $imported["A1_Common_Script"] = 4.50
  44. #==============================================================================
  45. # ■ Kernel
  46. #==============================================================================
  47. module Kernel
  48.   #--------------------------------------------------------------------------
  49.   # ○ RGSSのバージョン取得
  50.   #--------------------------------------------------------------------------
  51.   def rgss_version
  52.     return 3 if defined? Graphics.play_movie
  53.     return 2 if defined? Graphics.resize_screen
  54.     return 1
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ○ コモンスクリプトのバージョン取得
  58.   #--------------------------------------------------------------------------
  59.   def common_version
  60.     $imported["A1_Common_Script"]
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ○ コモンスクリプトのバージョンが古い
  64.   #--------------------------------------------------------------------------
  65.   def old_common_script(script_name, version)
  66.     msgbox("#{script_name}にはA1共通スクリプトVer#{version}以上が必要です")
  67.   end
  68. end
  69. #==============================================================================
  70. # ■ A1_System
  71. #==============================================================================
  72. module A1_System
  73. end
  74. #==============================================================================
  75. # ■ A1_System::CommonModule
  76. #==============================================================================

  77. class A1_System::CommonModule
  78.   #--------------------------------------------------------------------------
  79.   # ○ 定数
  80.   #--------------------------------------------------------------------------
  81.   TWOBYTE_LIST = {
  82.                   " " => " ",
  83.                   "=" => "=",
  84.                   ":" => ":"
  85.                   }
  86.   #--------------------------------------------------------------------------
  87.   # ○ オブジェクト初期化
  88.   #--------------------------------------------------------------------------
  89.   def initialize
  90.     define_command
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ 変換対象の全角文字を半角に置換
  94.   #--------------------------------------------------------------------------
  95.   def replace_twobyte(str)
  96.     for key in TWOBYTE_LIST.keys
  97.       str.gsub!(key) {TWOBYTE_LIST[key]}
  98.     end
  99.     return str
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ○ マイナスが含まれている文字列を数値にする
  103.   #--------------------------------------------------------------------------
  104.   def minus_to_i(s)
  105.     if s[0,0] == "-"
  106.       s.gsub!("-","")
  107.       return s.to_i * -1
  108.     else
  109.       return s.to_i
  110.     end
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ○ ミリ秒単位の現在時間
  114.   #--------------------------------------------------------------------------
  115.   def now_usec
  116.     now = Time.now
  117.     hour = now.hour * 60 * 60
  118.     min  = now.min * 60
  119.     sec  = now.sec
  120.     msec = (now.usec / 1000.0).round
  121.     return (hour + min + sec) * 1000 + msec
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ○ イベントリストの作成
  125.   #--------------------------------------------------------------------------
  126.   def create_event_list(code, indent, parameters)
  127.     list = RPG::EventCommand.new
  128.     list.code       = code
  129.     list.indent     = indent
  130.     list.parameters = parameters
  131.     return list
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ メソッド呼び出し
  135.   #--------------------------------------------------------------------------
  136.   def send_method(method_name)
  137.     return send(method_name) if respond_to?(method_name)
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ○ オブジェクトの型を判断してStringならエンコード
  141.   #--------------------------------------------------------------------------
  142.   def encoding_string(obj)
  143.     obj.force_encoding("UTF-8") if obj.is_a?(String)
  144.     return obj
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ○ メモの内容から必要な情報を取得
  148.   #--------------------------------------------------------------------------
  149.   def note_data(note, key)
  150.     result = []
  151.     note.each_line {|line|
  152.       next unless line =~ /<#{key}[ ]?(.*)>/
  153.       return true if $1.empty?
  154.       data = $a1_common.replace_twobyte($1).split(" ")
  155.       for st in data
  156.         result.push(st)
  157.       end
  158.     }
  159.     return false if result.empty?
  160.     return result
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ○ メモの内容からハッシュを作成
  164.   #--------------------------------------------------------------------------
  165.   def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
  166.     list = note_data_split(note, key)
  167.     return default if list.empty?
  168.     list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
  169.     return ret
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ○ メモの内容からカンマ区切りの多元配列を取得
  173.   #--------------------------------------------------------------------------
  174.   def note_data_split(note, key, default = [], ret = [])
  175.     data = note_data(note, key)
  176.     return default unless data.is_a?(Array)
  177.     data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
  178.     return ret
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ○ 配列の内容から数値があれば変換
  182.   #--------------------------------------------------------------------------
  183.   def convert_integer_from_array(data, ret = [])
  184.     data.each {|str| ret.push(convert_integer(str))}
  185.     return ret
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ○ 数値があれば変換
  189.   #--------------------------------------------------------------------------
  190.   def convert_integer(str)
  191.     return $1.to_i if str =~ /(^[-]?[0-9]+$)/
  192.     str.is_a?(Array) ? convert_integer_from_array(str) : str
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ メモの内容から単項目の数値を取得
  196.   #--------------------------------------------------------------------------
  197.   def note_data_one_value(note, key, default)
  198.     data = note_data(note, key)
  199.     return data[0].to_i if data.is_a?(Array)
  200.     return default
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ○ メモの内容から単項目を取得
  204.   #--------------------------------------------------------------------------
  205.   def note_data_one(note, key, default)
  206.     data = note_data(note, key)
  207.     return data[0] if data.is_a?(Array)
  208.     return default
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ メモの内容からカンマ区切りの文字列を取得
  212.   #--------------------------------------------------------------------------
  213.   def note_data_array_str(note, key, default)
  214.     data = note_data(note, key)
  215.     return data[0].split(",") if data.is_a?(Array)
  216.     return default
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ○ メモの内容からカンマ区切りの数値を取得
  220.   #--------------------------------------------------------------------------
  221.   def note_data_array_value(note, key, default)
  222.     data = note_data(note, key)
  223.     return default unless data.is_a?(Array)
  224.     return convert_integer_from_array(split_array(data[0]))
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ○ カンマ区切りの文字列メモを変換
  228.   #--------------------------------------------------------------------------
  229.   def note_data_array(note, key, type, default = nil, through = true)
  230.     ret = []
  231.     default.each {|dat| ret.push(dat)} if default != nil
  232.    
  233.     data = note_data(note, key)
  234.     return ret unless data.is_a?(Array)
  235.    
  236.     data = data[0].split(",")
  237.     for d in data
  238.       next if ret.include?(d) if through
  239.       ret.push(d.to_i) if type.is_a?(Integer)
  240.       ret.push(d)      if type.is_a?(String)
  241.     end
  242.     return ret
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ○ ディレクトリの作成
  246.   #--------------------------------------------------------------------------
  247.   def make_directory(dir_name)
  248.     Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ コマンドリスト
  252.   #--------------------------------------------------------------------------
  253.   def make_command(command, src = "", dect = "")
  254.     src.gsub!("/","\\")
  255.     dect.gsub!("/","\\")
  256.     cmd = "#{command} \"#{src}\" \"#{dect}\""
  257.     return cmd
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ○ 素材の拡張子を取得
  261.   #--------------------------------------------------------------------------
  262.   def material_ext(directory, file, direct = false)
  263.     exts = []
  264.     exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
  265.     exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
  266.    
  267.     find_file = sprintf("%s%s", directory, file) unless direct
  268.     find_file = file if direct
  269.    
  270.     for ext in exts
  271.       return ext if File.exist?(sprintf("%s%s", find_file, ext))
  272.     end
  273.     return nil
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ○ 素材が存在するかチェック
  277.   #--------------------------------------------------------------------------
  278.   def material_exist?(directory, file, direct = false)
  279.     return false if material_ext(directory, file, direct) == nil
  280.     return true
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ○ ファイルコピー
  284.   #--------------------------------------------------------------------------
  285.   def copy_file(src, dest)
  286.     srcFile = File.open( src, "rb" )
  287.     dstFile = File.open( dest, "wb" )
  288.     dstFile.write( srcFile.read )
  289.     srcFile.close
  290.     dstFile.close
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ○ ファイルの存在を確認してファイルコピー
  294.   #--------------------------------------------------------------------------
  295.   def material_copy(src, dest, directory)
  296.     ext = material_ext(directory, src, true)
  297.     copy_file( src + ext, dest + ext ) if ext != nil
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ○ 配列からAudioを作成
  301.   #--------------------------------------------------------------------------
  302.   def set_audio(sound, kind)
  303.     case kind
  304.     when "BGM"; audio = RPG::BGM.new
  305.     when "BGS"; audio = RPG::BGS.new
  306.     when "ME";  audio = RPG::ME.new
  307.     when "SE";  audio = RPG::SE.new
  308.     end
  309.     audio.name   = sound[0]
  310.     audio.volume = sound[1]
  311.     audio.pitch  = sound[2]
  312.     return audio
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ○ 既に準拠識別子を持っているかチェック
  316.   #--------------------------------------------------------------------------
  317.   def chk_rtp(file_name, default)
  318.     return "" if file_name =~ /^VX_.*/
  319.     return "" if file_name =~ /^XP_.*/
  320.     return "" if file_name =~ /^2000_.*/
  321.     return "" if file_name =~ /^2003_.*/
  322.     return default
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ○ 先頭の $ を切り出す
  326.   #--------------------------------------------------------------------------
  327.   def one_character(file_name)
  328.     return file_name unless file_name[0] == "$"
  329.     tmp = file_name.clone
  330.     tmp[0] = ""
  331.     return tmp
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ 配列を入れ替える
  335.   #--------------------------------------------------------------------------
  336.   def change_array(array, index1, index2)
  337.     tmp = array[index1]
  338.     array[index1] = array[index2]
  339.     array[index2] = tmp
  340.     return array
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ○ 移動ルートの作成
  344.   #--------------------------------------------------------------------------
  345.   def create_move_route(repeat, skippable, wait, list)
  346.     move_route = RPG::MoveRoute.new
  347.     move_route.repeat    = repeat
  348.     move_route.skippable = skippable
  349.     move_route.wait      = wait
  350.     move_route.list      = list
  351.     return move_route
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ○ 移動ルートコマンドの作成
  355.   #--------------------------------------------------------------------------
  356.   def create_move_command(code, parameters)
  357.     list = RPG::MoveCommand.new
  358.     list.code       = code
  359.     list.parameters = parameters
  360.     return list
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ○ インタプリタ起動用リストの作成
  364.   #--------------------------------------------------------------------------
  365.   def create_list(code, indent, parameters)
  366.     list            = RPG::EventCommand.new
  367.     list.code       = code
  368.     list.indent     = indent
  369.     list.parameters = parameters
  370.     return list
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ○ クラス名の取得
  374.   #--------------------------------------------------------------------------
  375.   def class_name(class_instance)
  376.     return class_instance.to_s.split(":")[0].gsub("#<","")
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ○ 配列を考慮したsplit
  380.   #--------------------------------------------------------------------------
  381.   def split_array(str)
  382.     str = convert_escape_characters(str)
  383.    
  384.     ret       = []
  385.     tmp_array = str.split(",")
  386.    
  387.     return strip_array_str(tmp_array) unless str.include?("[")
  388.     tmp_str   = ""
  389.     tmp_array.each {|s|
  390.       if char_in_str(s, "[", "]") && tmp_str.empty?
  391.         ret.push(s) unless s =~ /^\[/
  392.         ret.push([s[1...s.size-1]]) if s =~ /^\[/
  393.       else
  394.         tmp_str = "#{tmp_str}#{s},"
  395.         if char_in_str(tmp_str, "[", "]")
  396.           unless tmp_str =~ /^\[/
  397.             ret.push(tmp_str[0...tmp_str.size-1])
  398.             tmp_str = ""
  399.           else
  400.             tmp_str = tmp_str[1...tmp_str.size-2]
  401.             tmp_str = split_array(tmp_str) if tmp_str.include?("[")
  402.             tmp_str = tmp_str.split(",") if tmp_str.include?(",")
  403.             ret.push(tmp_str)   if tmp_str.is_a?(Array)
  404.             ret.push([tmp_str]) if !tmp_str.is_a?(Array)
  405.             tmp_str = ""
  406.           end
  407.         end
  408.       end
  409.     }
  410.     return strip_array_str(ret)
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ○ 配列の中の文字列の先頭と末尾の空白を除去
  414.   #--------------------------------------------------------------------------
  415.   def strip_array_str(array, ret = [])
  416.     array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
  417.     return ret
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  421.   #--------------------------------------------------------------------------
  422.   def char_in_str(str, c1, c2)
  423.     num1 = 0
  424.     num2 = 0
  425.     (0...str.size).each {|i| num1 += 1 if str[i] == c1; num2 += 1 if str[i] == c2 }
  426.     return num1 == num2
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ○ 制御文字の変換
  430.   #--------------------------------------------------------------------------
  431.   def convert_escape_characters(text)
  432.     result = text.to_s.clone
  433.     result.gsub!(/\\/)                           { "\e" }
  434.     result.gsub!(/\e\e/)                         { "\\" }
  435.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  436.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  437.     result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
  438.     result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
  439.     result.gsub!(/\eG/i)                         { Vocab::currency_unit }
  440.     loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  441.     result
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ○ アクター n 番の名前を取得
  445.   #--------------------------------------------------------------------------
  446.   def actor_name(n)
  447.     actor = n >= 1 ? $game_actors[n] : nil
  448.     actor ? actor.name : ""
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ○ パーティメンバー n 番の名前を取得
  452.   #--------------------------------------------------------------------------
  453.   def party_member_name(n)
  454.     actor = n >= 1 ? $game_party.members[n - 1] : nil
  455.     actor ? actor.name : ""
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ○ 配列を全て整数にする
  459.   #--------------------------------------------------------------------------
  460.   def params_to_i(params)
  461.     ret = []
  462.     params.each {|param| ret.push(param.to_i)}
  463.     return ret
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ○ 注釈コマンド定義
  467.   #--------------------------------------------------------------------------
  468.   def define_command
  469.     @cmd_108 = {}
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ○ 注釈コマンド定義取得
  473.   #--------------------------------------------------------------------------
  474.   def cmd_108
  475.     @cmd_108
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ○ フレーム更新
  479.   #--------------------------------------------------------------------------
  480.   def update
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ○ 文字の幅と高さを取得
  484.   #--------------------------------------------------------------------------
  485.   def text_size(font, size, text)
  486.     bitmap = Cache.system("")
  487.     bitmap.font.name = font
  488.     bitmap.font.size = size
  489.     tw = bitmap.text_size(text).width
  490.     th = bitmap.text_size(text).height
  491.     bitmap.dispose
  492.     return [tw, th]
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ○ 文字の幅を取得
  496.   #--------------------------------------------------------------------------
  497.   def text_width(font, text)
  498.     texts = text.split("\n")
  499.     @max_width = 0
  500.     texts.each {|text|
  501.       width = text_size(font.name, font.size, text)[0]
  502.       @max_width = @max_width < width ? width : @max_width
  503.     }
  504.     return @max_width
  505.   end
  506. end
  507. #==============================================================================
  508. # ◆ RGSS3用処理
  509. #==============================================================================
  510. if rgss_version == 3
  511. #==============================================================================
  512. # ■ RPG::Tileset
  513. #==============================================================================

  514. class RPG::Tileset
  515.   #--------------------------------------------------------------------------
  516.   # ○ 拡張通行判定
  517.   #--------------------------------------------------------------------------
  518.   def ex_flags
  519.     @ex_flags ||= Table.new(8192)
  520.     return @ex_flags
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ○ 拡張通行判定初期化
  524.   #--------------------------------------------------------------------------
  525.   def init_ex_flags
  526.     @ex_flags = Table.new(8192)
  527.   end
  528. end
  529. #==============================================================================
  530. # ■ Game_Interpreter
  531. #------------------------------------------------------------------------------
  532. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  533. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  534. #==============================================================================

  535. class Game_Interpreter
  536.   #--------------------------------------------------------------------------
  537.   # ☆ オブジェクト初期化
  538.   #     depth : ネストの深さ
  539.   #--------------------------------------------------------------------------
  540.   alias a1_common_gi_rgss3_initialize initialize
  541.   def initialize(depth = 0, sub_interpreter = false)
  542.     @sub_interpreter = sub_interpreter
  543.     a1_common_gi_rgss3_initialize(depth)
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ☆ メッセージ表示がビジー状態の間ウェイト
  547.   #--------------------------------------------------------------------------
  548.   alias a1_common_gi_wait_for_message wait_for_message
  549.   def wait_for_message
  550.     return if @sub_interpreter
  551.     a1_common_gi_wait_for_message
  552.   end
  553. end
  554. #==============================================================================
  555. # ■ Window_Message
  556. #------------------------------------------------------------------------------
  557. #  文章表示に使うメッセージウィンドウです。
  558. #==============================================================================

  559. class Window_Message < Window_Base
  560.   #--------------------------------------------------------------------------
  561.   # ☆ 通常文字の処理
  562.   #--------------------------------------------------------------------------
  563.   alias a1_common_wm_process_normal_character process_normal_character
  564.   def process_normal_character(c, pos)
  565.     wait_for_one_character_before
  566.     a1_common_wm_process_normal_character(c, pos)
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ○ 一文字出力前のウェイト
  570.   #--------------------------------------------------------------------------
  571.   def wait_for_one_character_before
  572.   end
  573. end
  574. #==============================================================================
  575. # ■ RPG::Map
  576. #==============================================================================

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

  592. class Game_Map
  593.   #--------------------------------------------------------------------------
  594.   # ☆ セットアップ
  595.   #--------------------------------------------------------------------------
  596.   alias a1_common_gm_setup setup
  597.   def setup(map_id)
  598.     a1_common_gm_setup(map_id)
  599.     setup_tileset
  600.     map_chip_search if search_map_chip?
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ★ タイルセットの取得
  604.   #--------------------------------------------------------------------------
  605.   def tileset
  606.     setup_tileset unless @tileset && @now_tileset_id == @tileset_id
  607.     return @tileset
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ○ タイルセットのセットアップ
  611.   #--------------------------------------------------------------------------
  612.   def setup_tileset
  613.     @tileset        = $data_tilesets[@tileset_id].clone
  614.     @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
  615.     @now_tileset_id = @tileset_id
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ○ マップチップを調べるか判定する
  619.   #--------------------------------------------------------------------------
  620.   def search_map_chip?
  621.     return @map.search_map_chip?
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  625.   #--------------------------------------------------------------------------
  626.   def all_tiles_flag?(x, y, bit)
  627.     all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  631.   #--------------------------------------------------------------------------
  632.   def all_tiles_flag_ex?(x, y, bit)
  633.     all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ○ 指定座標の全レイヤーの拡張フラグ判定
  637.   #--------------------------------------------------------------------------
  638.   def layered_tiles_flag_ex?(x, y, bit)
  639.     layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ○ 地形タグの取得(イベント含む)
  643.   #--------------------------------------------------------------------------
  644.   def terrain_tag_all_tailes(x, y)
  645.     return 0 unless valid?(x, y)
  646.     all_tiles(x, y).each do |tile_id|
  647.       tag = tileset.flags[tile_id] >> 12
  648.       return tag if tag > 0
  649.     end
  650.     return 0
  651.   end
  652. end
  653. #==============================================================================
  654. # ■ DataManager
  655. #------------------------------------------------------------------------------
  656. #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
  657. # ほぼ全てのグローバル変数はこのモジュールで初期化されます。
  658. #==============================================================================

  659. module DataManager
  660.   #--------------------------------------------------------------------------
  661.   # ○ エイリアス用特異メソッド
  662.   #--------------------------------------------------------------------------
  663.   class << self
  664.     alias :a1_common_create_game_objects :create_game_objects
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ☆ 各種ゲームオブジェクトの作成
  668.   #--------------------------------------------------------------------------
  669.   def self.create_game_objects
  670.     $a1_common ||= A1_System::CommonModule.new
  671.     a1_common_create_game_objects
  672.   end
  673. end
  674. #==============================================================================
  675. # ■ Scene_Base
  676. #------------------------------------------------------------------------------
  677. #  ゲーム中の全てのシーンのスーパークラスです。
  678. #==============================================================================

  679. class Scene_Base
  680.   #--------------------------------------------------------------------------
  681.   # ☆ フレーム更新(基本)
  682.   #--------------------------------------------------------------------------
  683.   alias a1_common_sb_update_basic update_basic
  684.   def update_basic
  685.     a1_common_sb_update_basic
  686.     $a1_common.update
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ○ 指定のウィンドウが開いている間ウェイト
  690.   #--------------------------------------------------------------------------
  691.   def wait_for_window_open(window)
  692.     update_basic until window.openness == 0
  693.   end
  694. end
  695. #==============================================================================
  696. # ■ Window_Base
  697. #------------------------------------------------------------------------------
  698. #  ゲーム中の全てのウィンドウのスーパークラスです。
  699. #==============================================================================

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

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

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

  753. class Game_Interpreter
  754.   #--------------------------------------------------------------------------
  755.   # ○ 注釈
  756.   #--------------------------------------------------------------------------
  757.   def command_108
  758.     @comments = [@params[0]]
  759.     while next_event_code == 408
  760.       @index += 1
  761.       @comments.push(@list[@index].parameters[0])
  762.     end
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ★ イベントコマンドの実行
  766.   #--------------------------------------------------------------------------
  767.   def execute_command
  768.     return rgss3_execute_command unless @index >= @list.size-1
  769.     command_end
  770.     return true
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ○ RGSS3風「イベントコマンドの実行」
  774.   #--------------------------------------------------------------------------
  775.   def rgss3_execute_command
  776.     command = @list[@index]
  777.     @params = command.parameters
  778.     @indent = command.indent
  779.     method_name = "command_#{command.code}"
  780.     send(method_name) if respond_to?(method_name)
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # ○ 次のイベントコマンドのコードを取得
  784.   #--------------------------------------------------------------------------
  785.   def next_event_code
  786.     @list[@index + 1].code
  787.   end
  788. end
  789. #==============================================================================
  790. # ■ Game_Map
  791. #------------------------------------------------------------------------------
  792. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  793. # このクラスのインスタンスは $game_map で参照されます。
  794. #==============================================================================

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

  821. class Game_Character
  822.   #--------------------------------------------------------------------------
  823.   # ○ タイル判定
  824.   #--------------------------------------------------------------------------
  825.   def tile?
  826.     @tile_id > 0 && @priority_type == 0
  827.   end
  828. end
  829. #==============================================================================
  830. # ■ Scene_Title
  831. #------------------------------------------------------------------------------
  832. #  タイトル画面の処理を行うクラスです。
  833. #==============================================================================

  834. class Scene_Title < Scene_Base
  835.   #--------------------------------------------------------------------------
  836.   # ☆ データベースのロード
  837.   #--------------------------------------------------------------------------
  838.   alias a1_common_st_load_database load_database
  839.   def load_database
  840.     a1_common_st_load_database
  841.     $data_map_infos = load_data("Data/MapInfos.rvdata")
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ☆ 各種ゲームオブジェクトの作成
  845.   #--------------------------------------------------------------------------
  846.   alias a1_common_st_create_game_objects create_game_objects
  847.   def create_game_objects
  848.     $a1_common ||= A1_System::CommonModule.new
  849.     a1_common_st_create_game_objects
  850.   end
  851. end
  852. #==============================================================================
  853. # ◆ RGSS用処理
  854. #==============================================================================
  855. elsif rgss_version == 1
  856. end
  857. #==============================================================================
  858. # ■ Cache
  859. #------------------------------------------------------------------------------
  860. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  861. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  862. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  863. # を返すようになっています。
  864. #==============================================================================

  865. module Cache
  866.   #--------------------------------------------------------------------------
  867.   # ○ 拡大縮小したビットマップのロード
  868.   #--------------------------------------------------------------------------
  869.   def self.load_resize_bitmap(load_path, key, resize = nil)
  870.     @cache ||= {}
  871.     key = load_path if key == nil
  872.     return @cache[key] if include?(key)
  873.    
  874.     @cache[key] = Bitmap.new(load_path)
  875.     return @cache[key] if resize == nil
  876.     return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
  877.    
  878.     info = calc_size(resize, key)
  879.     return resize_bitmap(@cache[key], info[0], info[1], key)
  880.   end
  881.   #--------------------------------------------------------------------------
  882.   # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  883.   #--------------------------------------------------------------------------
  884.   def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
  885.     key = [path, hue]
  886.     return @cache[key] if include?(key)
  887.    
  888.     @cache[key] = load_resize_bitmap(load_path, path, resize).clone
  889.     @cache[key].hue_change(hue)
  890.     return @cache[key]
  891.   end
  892.   #--------------------------------------------------------------------------
  893.   # ○ リサイズするサイズを取得
  894.   #--------------------------------------------------------------------------
  895.   def self.calc_size(resize, key)
  896.     width  = resize[0]
  897.     width  = @cache[key].width * width.abs if width < 0
  898.     height = resize[1]
  899.     height = @cache[key].height * height.abs if height < 0
  900.     height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
  901.     return [width, height]
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ○ ビットマップの拡大縮小
  905.   #--------------------------------------------------------------------------
  906.   def self.resize_bitmap(bitmap, width, height, key)
  907.     resize = Bitmap.new(width, height)
  908.     resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
  909.     @cache[key] = resize
  910.     return resize
  911.   end
  912.   #--------------------------------------------------------------------------
  913.   # ○ テキストビットマップの取得
  914.   #--------------------------------------------------------------------------
  915.   def self.text_picture(text, font)
  916.     load_text_bitmap(text, font)
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ フォントのキーを作成
  920.   #--------------------------------------------------------------------------
  921.   def self.make_font_key(text, font)
  922.     [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  923.   end
  924.   #--------------------------------------------------------------------------
  925.   # ○ テキストビットマップの作成
  926.   #--------------------------------------------------------------------------
  927.   def self.load_text_bitmap(text, font)
  928.     @cache ||= {}
  929.     key = make_font_key(text, font)
  930.     return @cache[key] if include?(key)
  931.    
  932.     # 計算用ダミービットマップ
  933.     bitmap = Cache.system("")
  934.     bitmap.font = font
  935.     tw = bitmap.text_size(text).width + 8
  936.    
  937.     # ビットマップ作成
  938.     bitmap = Bitmap.new(tw, bitmap.font.size + 4)
  939.     bitmap.font = font
  940.     bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
  941.    
  942.     @cache[key] = bitmap
  943.     return @cache[key]
  944.   end
  945. end
  946. #==============================================================================
  947. # ■ Game_Interpreter
  948. #------------------------------------------------------------------------------
  949. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  950. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  951. #==============================================================================

  952. class Game_Interpreter
  953.   #--------------------------------------------------------------------------
  954.   # ○ 注釈
  955.   #--------------------------------------------------------------------------
  956.   alias a1_common_command_108 command_108
  957.   def command_108
  958.     a1_common_command_108
  959.     proc_comment(@comments)
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ○ 注釈の処理
  963.   #--------------------------------------------------------------------------
  964.   def proc_comment(comments)
  965.     param = ""
  966.     comments.each {|comment| param += comment }
  967.     params = param.sub(/^(\S+)/, "")
  968.     command = $1
  969.     comment_parameters = $a1_common.split_array(params) if params
  970.     proc_comment_command(command, comment_parameters)
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ○ 注釈の実行
  974.   #--------------------------------------------------------------------------
  975.   def proc_comment_command(command, params)
  976.     cmd_108 = $a1_common.cmd_108[command]
  977.     method(cmd_108).call(params) if cmd_108 != nil
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ○ 前のイベントコマンドを取得
  981.   #--------------------------------------------------------------------------
  982.   def prev_event
  983.     @list[@index - 1]
  984.   end
  985. end
  986. #==============================================================================
  987. # ■ Game_Map
  988. #------------------------------------------------------------------------------
  989. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  990. # このクラスのインスタンスは $game_map で参照されます。
  991. #==============================================================================

  992. class Game_Map
  993.   #--------------------------------------------------------------------------
  994.   # ○ 全マップチップを調べる
  995.   #--------------------------------------------------------------------------
  996.   def map_chip_search
  997.     tileset.init_ex_flags
  998.     ([email protected]).each {|x| map_chip_search_y(x) }
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ○ x座標にあるy座標のマップチップを調べる
  1002.   #--------------------------------------------------------------------------
  1003.   def map_chip_search_y(x)
  1004.     ([email protected]).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  1005.   end
  1006.   #--------------------------------------------------------------------------
  1007.   # ○ x,y座標にあるz座標のマップチップを調べる
  1008.   #--------------------------------------------------------------------------
  1009.   def map_chip_search_z(x, y)
  1010.     ([email protected]).each {|z| map_chip_proc(x, y, z) }
  1011.     tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # ○ 座標に対して処理を行う
  1015.   #--------------------------------------------------------------------------
  1016.   def map_pos_proc(x, y)
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ マップチップに対して処理を行う
  1020.   #--------------------------------------------------------------------------
  1021.   def map_chip_proc(x, y, z)
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ○ タイルのイベントに対して処理を行う
  1025.   #--------------------------------------------------------------------------
  1026.   def tile_event_proc(tile_id)
  1027.   end
  1028. end
  1029. #==============================================================================
  1030. # ■ Window_Base
  1031. #------------------------------------------------------------------------------
  1032. #  ゲーム中の全てのウィンドウのスーパークラスです。
  1033. #==============================================================================

  1034. class Window_Base < Window
  1035.   #--------------------------------------------------------------------------
  1036.   # ○ 入力を受け付けるか?
  1037.   #--------------------------------------------------------------------------
  1038.   def can_input?
  1039.     @can_input
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # ○ 入力受け付け設定
  1043.   #--------------------------------------------------------------------------
  1044.   def can_input=(flag)
  1045.     @can_input = flag
  1046.   end
  1047. end
  1048. #==============================================================================
  1049. # ■ Bitmap
  1050. #==============================================================================

  1051. class Bitmap
  1052.   #--------------------------------------------------------------------------
  1053.   # ○ 文字縁取り描画
  1054.   #--------------------------------------------------------------------------
  1055.   def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
  1056.     shadow = self.font.shadow
  1057.     b_color = self.font.color.dup
  1058.     font.shadow = false
  1059.     font.color = color
  1060.     draw_text(x + 1, y, width, height, str, align)
  1061.     draw_text(x - 1, y, width, height, str, align)
  1062.     draw_text(x, y + 1, width, height, str, align)
  1063.     draw_text(x, y - 1, width, height, str, align)
  1064.     font.color = b_color
  1065.     draw_text(x, y, width, height, str, align)
  1066.     font.shadow = shadow
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # ○ 文字縁取り描画の矩形を取得
  1070.   #--------------------------------------------------------------------------
  1071.   def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
  1072.     draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  1073.   end
  1074. end

复制代码
A1バトル共通スクリプト

  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1バトル共通スクリプト(RGSS3)
  4. #
  5. # バージョン   : 1.23 (2012/01/27)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. # ---------------------------------------------------------------------------
  9. # 更新履歴   :2012/01/18 Ver1.00 リリース
  10. #                2012/01/21 Ver1.10 装備拡張対応
  11. #                2012/01/21 Ver1.10 メンバー加入時の不具合を修正
  12. #                2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正
  13. #                2012/01/24 Ver1.20 スキル拡張対応
  14. #                2012/01/24 Ver1.21 Window_BattleActorの不具合を修正
  15. #                2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正
  16. #                2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正
  17. # ---------------------------------------------------------------------------
  18. # 設置場所      
  19. #  A1共通スクリプトより下
  20. #    一部再定義メソッドがあるため、なるべく上の方
  21. #
  22. # 必要スクリプト
  23. #    A1共通スクリプトVer4.30以上
  24. #==============================================================================
  25. $imported = {} if $imported == nil
  26. if $imported["A1_Common_Script"]
  27. $imported["A1_BattleCommonScript"] = true
  28. old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30
  29. #==============================================================================
  30. # ■ Window_Base
  31. #------------------------------------------------------------------------------
  32. #  ゲーム中の全てのウィンドウのスーパークラスです。
  33. #==============================================================================

  34. class Window_Base < Window
  35.   #--------------------------------------------------------------------------
  36.   # ○ メソッドの定義
  37.   #--------------------------------------------------------------------------
  38.   def define_method(method, symbol)
  39.     @method ||= {}
  40.     @method[symbol] = method
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ○ メソッドのコール
  44.   #--------------------------------------------------------------------------
  45.   def call_method(symbol, *args)
  46.     @method ||= {}
  47.     @method[symbol].call(*args) if @method[symbol]
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ 顔グラフィックの描画(解放なし)
  51.   #--------------------------------------------------------------------------
  52.   def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)
  53.     bitmap = Cache.face(face_name)
  54.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
  55.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ○ 背景の描画
  59.   #--------------------------------------------------------------------------
  60.   def draw_background(rect)
  61.     temp_rect = rect.clone
  62.     temp_rect.width /= 2
  63.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
  64.     temp_rect.x = temp_rect.width
  65.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ○ 背景色 1 の取得
  69.   #--------------------------------------------------------------------------
  70.   def back_color1
  71.     Color.new(0, 0, 0, 192)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ○ 背景色 2 の取得
  75.   #--------------------------------------------------------------------------
  76.   def back_color2
  77.     Color.new(0, 0, 0, 0)
  78.   end
  79. end
  80. #==============================================================================
  81. # ■ Window_Help
  82. #------------------------------------------------------------------------------
  83. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  84. #==============================================================================

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

  99. class Window_BattleActor < Window_BattleStatus
  100.   #--------------------------------------------------------------------------
  101.   # ★ ウィンドウの表示
  102.   #--------------------------------------------------------------------------
  103.   def show
  104.     setup_remain if @info_viewport
  105.     self.visible = true
  106.     refresh
  107.     open
  108.     self
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ★ ウィンドウの非表示
  112.   #--------------------------------------------------------------------------
  113.   def hide
  114.     close
  115.     @info_viewport.rect.width = Graphics.width if @info_viewport
  116.     call_method(:select_actor_end)
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ○ フレーム更新
  120.   #--------------------------------------------------------------------------
  121.   def update
  122.     return update_basic unless self.visible
  123.     super
  124.     self.visible = false if self.openness == 0
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ○ フレーム更新(基本)
  128.   #--------------------------------------------------------------------------
  129.   def update_basic
  130.     process_cursor_move
  131.     process_handling
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ 項目の選択
  135.   #--------------------------------------------------------------------------
  136.   def select(index)
  137.     super
  138.     call_method(:select_actor, index)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ○ ウィンドウの調整
  142.   #--------------------------------------------------------------------------
  143.   def setup_remain
  144.     width_remain = Graphics.width - width
  145.     self.x = width_remain
  146.     @info_viewport.rect.width = width_remain
  147.     select(0)
  148.   end
  149. end
  150. #==============================================================================
  151. # ■ Window_BattleEnemy
  152. #------------------------------------------------------------------------------
  153. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  154. #==============================================================================

  155. class Window_BattleEnemy < Window_Selectable
  156.   #--------------------------------------------------------------------------
  157.   # ★ ウィンドウの表示
  158.   #--------------------------------------------------------------------------
  159.   def show
  160.     setup_remain if @info_viewport
  161.     self.visible = true
  162.     open
  163.     self
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ★ ウィンドウの非表示
  167.   #--------------------------------------------------------------------------
  168.   def hide
  169.     close
  170.     @info_viewport.rect.width = Graphics.width if @info_viewport
  171.     call_method(:select_enemy_end)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ○ フレーム更新
  175.   #--------------------------------------------------------------------------
  176.   def update
  177.     return update_basic unless self.visible
  178.     super
  179.     self.visible = false if self.openness == 0
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ○ フレーム更新(基本)
  183.   #--------------------------------------------------------------------------
  184.   def update_basic
  185.     process_cursor_move
  186.     process_handling
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ○ 項目の選択
  190.   #--------------------------------------------------------------------------
  191.   def select(index)
  192.     super
  193.     call_method(:select_enemy, index)
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ○ ウィンドウの調整
  197.   #--------------------------------------------------------------------------
  198.   def setup_remain
  199.     width_remain = Graphics.width - width
  200.     self.x = width_remain
  201.     @info_viewport.rect.width = width_remain
  202.     select(0)
  203.   end
  204. end
  205. #==============================================================================
  206. # ■ Window_BattleSkill
  207. #------------------------------------------------------------------------------
  208. #  バトル画面で、使用するスキルを選択するウィンドウです。
  209. #==============================================================================

  210. class Window_BattleSkill < Window_SkillList
  211.   #--------------------------------------------------------------------------
  212.   # ☆ オブジェクト初期化
  213.   #     info_viewport : 情報表示用ビューポート
  214.   #--------------------------------------------------------------------------
  215.   alias a1_psw_wbs_initialize initialize
  216.   def initialize(help_window, info_viewport)
  217.     a1_psw_wbs_initialize(help_window, info_viewport)
  218.     self.openness = 0
  219.     self.visible  = true
  220.     @help_window.openness = 0
  221.     @help_window.visible = true
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ○ 高さを変える
  225.   #--------------------------------------------------------------------------
  226.   def resize_height(base_y)
  227.     self.height = base_y - self.y
  228.     create_contents
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ★ ウィンドウの表示
  232.   #--------------------------------------------------------------------------
  233.   def show
  234.     self.visible = true
  235.     @help_window.visible = true
  236.     select_last
  237.     open
  238.     @help_window.open
  239.     self
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ★ ウィンドウの非表示
  243.   #--------------------------------------------------------------------------
  244.   def hide
  245.     close
  246.     @help_window.close
  247.     @info_viewport.rect.width = Graphics.width if @info_viewport
  248.     call_method(:skill_item_window_hide)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ○ オープン
  252.   #--------------------------------------------------------------------------
  253.   def open
  254.     self.visible = true
  255.     call_method(:skill_item_window_show)
  256.     super
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ アクティブ化
  260.   #--------------------------------------------------------------------------
  261.   def activate
  262.     open
  263.     @help_window.open
  264.     super
  265.   end
  266. end
  267. #==============================================================================
  268. # ■ Window_BattleItem
  269. #------------------------------------------------------------------------------
  270. #  バトル画面で、使用するアイテムを選択するウィンドウです。
  271. #==============================================================================

  272. class Window_BattleItem < Window_ItemList
  273.   #--------------------------------------------------------------------------
  274.   # ☆ オブジェクト初期化
  275.   #     info_viewport : 情報表示用ビューポート
  276.   #--------------------------------------------------------------------------
  277.   alias a1_battle_common_wbi_initialize initialize
  278.   def initialize(help_window, info_viewport)
  279.     a1_battle_common_wbi_initialize(help_window, info_viewport)
  280.     self.openness = 0
  281.     self.visible  = true
  282.     @help_window.openness = 0
  283.     @help_window.visible = true
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ○ 高さを変える
  287.   #--------------------------------------------------------------------------
  288.   def resize_height(base_y)
  289.     self.height = base_y - self.y
  290.     create_contents
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ★ ウィンドウの表示
  294.   #--------------------------------------------------------------------------
  295.   def show
  296.     self.visible = true
  297.     @help_window.visible = true
  298.     select_last
  299.     open
  300.     @help_window.open
  301.     self
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ★ ウィンドウの非表示
  305.   #--------------------------------------------------------------------------
  306.   def hide
  307.     close
  308.     @help_window.close
  309.     call_method(:skill_item_window_hide)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ オープン
  313.   #--------------------------------------------------------------------------
  314.   def open
  315.     self.visible = true
  316.     call_method(:skill_item_window_show)
  317.     super
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ○ アクティブ化
  321.   #--------------------------------------------------------------------------
  322.   def activate
  323.     open
  324.     @help_window.open
  325.     super
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ○ フレーム更新
  329.   #--------------------------------------------------------------------------
  330.   def update
  331.     return unless self.visible
  332.     super
  333.     self.visible = false if self.openness == 0
  334.   end
  335. end
  336. #==============================================================================
  337. # ■ Window_ActorCommand
  338. #------------------------------------------------------------------------------
  339. #  バトル画面で、アクターの行動を選択するウィンドウです。
  340. #==============================================================================

  341. class Window_ActorCommand < Window_Command
  342.   #--------------------------------------------------------------------------
  343.   # ☆ セットアップ
  344.   #--------------------------------------------------------------------------
  345.   alias a1_battle_common_wac_setup setup
  346.   def setup(actor)
  347.     call_method(:actor_command_setup, actor)
  348.     a1_battle_common_wac_setup(actor)
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ○ ウィンドウのアクティブ化
  352.   #--------------------------------------------------------------------------
  353.   def activate
  354.     open
  355.     super
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ○ オープン
  359.   #--------------------------------------------------------------------------
  360.   def open
  361.     call_method(:actor_command_open)
  362.     super
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ○ クローズ
  366.   #--------------------------------------------------------------------------
  367.   def close
  368.     call_method(:actor_command_close)
  369.     super
  370.   end
  371. end
  372. #==============================================================================
  373. # ■ Window_BattleStatus
  374. #------------------------------------------------------------------------------
  375. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
  376. #==============================================================================

  377. class Window_BattleStatus < Window_Selectable
  378.   #--------------------------------------------------------------------------
  379.   # ☆ リフレッシュ
  380.   #--------------------------------------------------------------------------
  381.   alias a1_battle_common_wbs_refresh refresh
  382.   def refresh
  383.     call_method(:refresh_statsu_window)
  384.     return unless self.visible
  385.     a1_battle_common_wbs_refresh
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ○ ウィンドウを開く
  389.   #--------------------------------------------------------------------------
  390.   def open
  391.     super
  392.     call_method(:open_status_window)
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ○ ウィンドウを閉じる
  396.   #--------------------------------------------------------------------------
  397.   def close
  398.     super
  399.     call_method(:close_status_window)
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ○ 項目の選択
  403.   #--------------------------------------------------------------------------
  404.   def select(index)
  405.     super
  406.     call_method(:select_status_window, index)
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # ○ フレーム更新
  410.   #--------------------------------------------------------------------------
  411.   def update
  412.     call_method(:update_status_window)
  413.     return unless self.visible
  414.     super
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ○ 解放
  418.   #--------------------------------------------------------------------------
  419.   def dispose
  420.     super
  421.     call_method(:dispose_status_window)
  422.   end
  423. end
  424. #==============================================================================
  425. # ■ Window_PersonalStatus
  426. #==============================================================================

  427. class Window_PersonalStatus < Window_Base
  428.   #--------------------------------------------------------------------------
  429.   # ○ オブジェクト初期化
  430.   #--------------------------------------------------------------------------
  431.   def initialize(x, y, opacity = 0)
  432.     super(x, y, Graphics.width / 2, 120)
  433.     self.opacity  = opacity
  434.     self.openness = 0
  435.     @actor = nil
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ○ アクターの設定
  439.   #--------------------------------------------------------------------------
  440.   def actor=(actor)
  441.     @actor = actor
  442.     refresh
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ リフレッシュ
  446.   #--------------------------------------------------------------------------
  447.   def refresh
  448.     contents.clear
  449.     draw_face(@actor.face_name, @actor.face_index, 0, 0)
  450.     draw_text(116, line_height * 0, contents.width, line_height, @actor.name)
  451.     draw_actor_level(@actor, 116, 0 + line_height * 1)
  452.     draw_actor_icons(@actor, 180, 0 + line_height * 1)
  453.     draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)
  454.     draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)
  455.     draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ○ フレーム更新
  459.   #--------------------------------------------------------------------------
  460.   def update
  461.     return unless self.visible
  462.     super
  463.     self.visible = false if self.openness == 0
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ○ オープン
  467.   #--------------------------------------------------------------------------
  468.   def open
  469.     self.visible = true
  470.     super
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ○ 顔グラフィックの描画
  474.   #--------------------------------------------------------------------------
  475.   def draw_face(face_name, face_index, x, y, enabled = true)
  476.     draw_face_no_dispose(face_name, face_index, x, y, enabled)
  477.   end
  478. end
  479. #==============================================================================
  480. # ■ RPG::Enemy
  481. #==============================================================================

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

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

  515. class Game_Actor < Game_Battler
  516.   #--------------------------------------------------------------------------
  517.   # ★ 装備品の初期化
  518.   #     equips : 初期装備の配列
  519.   #--------------------------------------------------------------------------
  520.   def init_equips(equips)
  521.     super
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ★ 装備タイプからスロット ID に変換(空きを優先)
  525.   #--------------------------------------------------------------------------
  526.   def empty_slot(etype_id)
  527.     super
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ★ 装備タイプからスロット ID のリストに変換
  531.   #--------------------------------------------------------------------------
  532.   def slot_list(etype_id)
  533.     super
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ★ エディタで設定されたインデックスを装備タイプ ID に変換
  537.   #--------------------------------------------------------------------------
  538.   def index_to_etype_id(index)
  539.     super
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # ★ 装備スロットの配列を取得
  543.   #--------------------------------------------------------------------------
  544.   def equip_slots
  545.     super
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ★ 装備品オブジェクトの配列取得
  549.   #--------------------------------------------------------------------------
  550.   def equips
  551.     super
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # ★ 武器オブジェクトの配列取得
  555.   #--------------------------------------------------------------------------
  556.   def weapons
  557.     super
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # ★ 通常能力値の加算値取得
  561.   #--------------------------------------------------------------------------
  562.   def param_plus(param_id)
  563.     super
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ☆ 通常攻撃 アニメーション ID の取得
  567.   #--------------------------------------------------------------------------
  568.   alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1
  569.   def atk_animation_id1
  570.     return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)
  571.     @current_weapon.animation_id
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  575.   #--------------------------------------------------------------------------
  576.   alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2
  577.   def atk_animation_id2
  578.     return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)
  579.     @current_weapon.animation_id
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ○ 装備タイプ名を取得
  583.   #--------------------------------------------------------------------------
  584.   def e_type_name(item)
  585.     return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)
  586.     return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)
  587.   end
  588. end
  589. #==============================================================================
  590. # ■ Game_BattlerBase
  591. #------------------------------------------------------------------------------
  592. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
  593. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
  594. #==============================================================================

  595. class Game_BattlerBase
  596.   #--------------------------------------------------------------------------
  597.   # ○ 二刀流?
  598.   #--------------------------------------------------------------------------
  599.   def two_sword_style?
  600.     weapons[0] && weapons[1]
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ○ バトラーオブジェクト取得
  604.   #--------------------------------------------------------------------------
  605.   def battler
  606.     return actor if self.actor?
  607.     return enemy
  608.   end
  609. end
  610. #==============================================================================
  611. # ■ Game_Battler
  612. #------------------------------------------------------------------------------
  613. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  614. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  615. #==============================================================================

  616. class Game_Battler < Game_BattlerBase
  617.   #--------------------------------------------------------------------------
  618.   # ○ 公開インスタンス変数
  619.   #--------------------------------------------------------------------------
  620.   attr_accessor :current_weapon
  621.   attr_accessor :current_main
  622.   #--------------------------------------------------------------------------
  623.   # ○ 装備品の初期化
  624.   #     equips : 初期装備の配列
  625.   #--------------------------------------------------------------------------
  626.   def init_equips(equips)
  627.     @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
  628.     equips.each_with_index do |item_id, i|
  629.       etype_id = index_to_etype_id(i)
  630.       slot_id = empty_slot(etype_id)
  631.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  632.     end
  633.     refresh
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ○ 装備タイプからスロット ID に変換(空きを優先)
  637.   #--------------------------------------------------------------------------
  638.   def empty_slot(etype_id)
  639.     list = slot_list(etype_id)
  640.     list.find {|i| @equips[i].is_nil? } || list[0]
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ○ 装備タイプからスロット ID のリストに変換
  644.   #--------------------------------------------------------------------------
  645.   def slot_list(etype_id)
  646.     result = []
  647.     equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
  648.     result
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ○ エディタで設定されたインデックスを装備タイプ ID に変換
  652.   #--------------------------------------------------------------------------
  653.   def index_to_etype_id(index)
  654.     index == 1 && dual_wield? ? 0 : index
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ○ 装備スロットの配列を取得
  658.   #--------------------------------------------------------------------------
  659.   def equip_slots
  660.     return [0,0,2,3,4] if dual_wield?       # 二刀流
  661.     return [0,1,2,3,4]                      # 通常
  662.   end
  663.   #--------------------------------------------------------------------------
  664.   # ○ 装備品オブジェクトの配列取得
  665.   #--------------------------------------------------------------------------
  666.   def equips
  667.     @equips.collect {|item| item.object }
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ○ 武器オブジェクトの配列取得
  671.   #--------------------------------------------------------------------------
  672.   def weapons
  673.     @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ○ 通常能力値の加算値取得
  677.   #--------------------------------------------------------------------------
  678.   def param_plus(param_id)
  679.     equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ○ アイテムにかける追加要素
  683.   #--------------------------------------------------------------------------
  684.   def ex_item_params(item, param_id)
  685.     return 0
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ○ スキルを取得
  689.   #--------------------------------------------------------------------------
  690.   def skill(skill_id)
  691.     $data_skills[skill_id]
  692.   end
  693. end
  694. #==============================================================================
  695. # ■ Game_Party
  696. #------------------------------------------------------------------------------
  697. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  698. # スのインスタンスは $game_party で参照されます。
  699. #==============================================================================

  700. class Game_Party < Game_Unit
  701.   #--------------------------------------------------------------------------
  702.   # ☆ アクターを加える
  703.   #--------------------------------------------------------------------------
  704.   alias a1_battle_common_gp_add_actor add_actor
  705.   def add_actor(actor_id)
  706.     return a1_battle_common_gp_add_actor(actor_id) unless in_battle
  707.     return if @actors.include?(actor_id)
  708.     prev_add_actor(battle_members)
  709.     insert_actor(actor_id)
  710.     post_add_actor($game_actors[actor_id])
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ○ アクターを加える
  714.   #--------------------------------------------------------------------------
  715.   def insert_actor(actor_id)
  716.     @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size
  717.     @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)
  718.     $game_player.refresh
  719.     $game_map.need_refresh = true
  720.     return unless @remove_member_index
  721.     @remove_member_index.delete_at(0)
  722.     @remove_member_index = nil if @remove_member_index.empty?
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ○ アクターを加えたIndexを取得
  726.   #--------------------------------------------------------------------------
  727.   def new_index
  728.     @new_index
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ○ アクターを加える前処理
  732.   #--------------------------------------------------------------------------
  733.   def prev_add_actor(members)
  734.     BattleManager.call_method(:prev_add_battler, members)
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ○ アクターを加えた後処理
  738.   #--------------------------------------------------------------------------
  739.   def post_add_actor(member)
  740.     BattleManager.call_method(:post_add_battler, member)
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ☆ アクターを外す
  744.   #--------------------------------------------------------------------------
  745.   alias a1_battle_common_gp_remove_actor remove_actor
  746.   def remove_actor(actor_id)
  747.     prev_remove_actor($game_actors[actor_id]) if in_battle
  748.     a1_battle_common_gp_remove_actor(actor_id)
  749.     post_remove_actor if in_battle
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ○ アクターを外す前処理
  753.   #--------------------------------------------------------------------------
  754.   def prev_remove_actor(member)
  755.     @remove_member_index ||= []
  756.     @remove_member_index.push(member.index)
  757.     BattleManager.call_method(:prev_remove_battler, member)
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # ○ アクターを外した後処理
  761.   #--------------------------------------------------------------------------
  762.   def post_remove_actor
  763.     BattleManager.call_method(:post_remove_battler)
  764.   end
  765. end
  766. #==============================================================================
  767. # ■ BattleManager
  768. #------------------------------------------------------------------------------
  769. #  戦闘の進行を管理するモジュールです。
  770. #==============================================================================

  771. module BattleManager
  772.   #--------------------------------------------------------------------------
  773.   # ○ エイリアス用特異メソッド
  774.   #--------------------------------------------------------------------------
  775.   class << self
  776.     alias :a1_battle_common_bm_turn_end :turn_end
  777.     alias :a1_battle_common_bm_turn_start :turn_start
  778.     alias :a1_battle_common_bm_battle_end :battle_end
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ☆ ターン開始
  782.   #--------------------------------------------------------------------------
  783.   def self.turn_start
  784.     @turn_end_wait = 0
  785.     a1_battle_common_bm_turn_start
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ☆ ターン終了
  789.   #--------------------------------------------------------------------------
  790.   def self.turn_end
  791.     call_method(:wait, @turn_end_wait) if @turn_end_wait > 0
  792.     @turn_end_wait = 0
  793.     a1_battle_common_bm_turn_end
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ○ メソッドの設定
  797.   #--------------------------------------------------------------------------
  798.   def self.define_method(method, symbol)
  799.     @method ||= {}
  800.     @method[symbol] = method
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ○ メソッドのコール
  804.   #--------------------------------------------------------------------------
  805.   def self.call_method(symbol, *args)
  806.     @method[symbol].call(*args) if @method[symbol]
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ○ ターン終了後ウェイト設定
  810.   #--------------------------------------------------------------------------
  811.   def self.turn_end_wait=(flame)
  812.     @turn_end_wait = flame if @turn_end_wait < flame || flame == 0
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ☆ 戦闘終了
  816.   #     result : 結果(0:勝利 1:逃走 2:敗北)
  817.   #--------------------------------------------------------------------------
  818.   def self.battle_end(result)
  819.     call_method(:battle_end, result)
  820.     a1_battle_common_bm_battle_end(result)
  821.   end
  822. end
  823. #==============================================================================
  824. # ■ Game_Action
  825. #------------------------------------------------------------------------------
  826. #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
  827. # ます。
  828. #==============================================================================

  829. class Game_Action
  830.   #--------------------------------------------------------------------------
  831.   # ☆ ターゲットの配列作成
  832.   #--------------------------------------------------------------------------
  833.   alias a1_battle_common_gac_make_targets make_targets
  834.   def make_targets
  835.     @targets ||= pre_make_targets
  836.     return @targets
  837.   end
  838.   #--------------------------------------------------------------------------
  839.   # ○ ターゲットの配列先行作成
  840.   #--------------------------------------------------------------------------
  841.   def pre_make_targets
  842.     @targets = a1_battle_common_gac_make_targets
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # ○ ターゲットの配列を取得
  846.   #--------------------------------------------------------------------------
  847.   def targets
  848.     @targets.compact
  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # ○ ターゲットの配列をクリア
  852.   #--------------------------------------------------------------------------
  853.   def clear_targets
  854.     @targets = nil
  855.   end
  856. end
  857. #==============================================================================
  858. # ■ Scene_Battle
  859. #------------------------------------------------------------------------------
  860. #  バトル画面の処理を行うクラスです。
  861. #==============================================================================

  862. class Scene_Battle < Scene_Base
  863.   #--------------------------------------------------------------------------
  864.   # ☆ 開始処理
  865.   #--------------------------------------------------------------------------
  866.   alias a1_battle_common_sb_start start
  867.   def start
  868.     a1_battle_common_sb_start
  869.     define_battle_manager_method
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ○ バトルマネージャメソッドの定義
  873.   #--------------------------------------------------------------------------
  874.   def define_battle_manager_method
  875.     BattleManager.define_method(method(:wait), :wait)
  876.     BattleManager.define_method(method(:post_add_battler),       :post_add_battler)
  877.     BattleManager.define_method(method(:post_remove_battler),    :post_remove_battler)
  878.     BattleManager.define_method(method(:prev_remove_battler),    :prev_remove_battler)
  879.     BattleManager.define_method(method(:prev_add_battler),       :prev_add_battler)
  880.     BattleManager.define_method(method(:process_victory),        :process_victory)
  881.     BattleManager.define_method(method(:battle_end),             :battle_end)
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ☆ ステータスウィンドウの作成
  885.   #--------------------------------------------------------------------------
  886.   alias a1_battle_common_sb_create_status_window create_status_window
  887.   def create_status_window
  888.     a1_battle_common_sb_create_status_window
  889.     post_create_status_window
  890.     define_status_window_method
  891.   end
  892.   #--------------------------------------------------------------------------
  893.   # ○ ステータスウィンドウ作成の後処理
  894.   #--------------------------------------------------------------------------
  895.   def post_create_status_window
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ○ ステータスウィンドウメソッドの定義
  899.   #--------------------------------------------------------------------------
  900.   def define_status_window_method
  901.     @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)
  902.     @status_window.define_method(method(:close_status_window),   :close_status_window)
  903.     @status_window.define_method(method(:open_status_window),    :open_status_window)
  904.     @status_window.define_method(method(:select_status_window),  :select_status_window)
  905.     @status_window.define_method(method(:update_status_window),  :update_status_window)
  906.     @status_window.define_method(method(:dispose_status_window), :dispose_status_window)
  907.   end
  908.   #--------------------------------------------------------------------------
  909.   # ○ ステータスウィンドウがリフレッシュされた時の処理
  910.   #--------------------------------------------------------------------------
  911.   def refresh_statsu_window
  912.   end
  913.   #--------------------------------------------------------------------------
  914.   # ○ ステータスウィンドウがクローズされた時の処理
  915.   #--------------------------------------------------------------------------
  916.   def close_status_window
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ○ ステータスウィンドウがオープンされた時の処理
  920.   #--------------------------------------------------------------------------
  921.   def open_status_window
  922.   end
  923.   #--------------------------------------------------------------------------
  924.   # ○ ステータスウィンドウがセレクトされた時の処理
  925.   #--------------------------------------------------------------------------
  926.   def select_status_window(index)
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ○ ステータスウィンドウが更新された時の処理
  930.   #--------------------------------------------------------------------------
  931.   def update_status_window
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ○ ステータスウィンドウが解放された時の処理
  935.   #--------------------------------------------------------------------------
  936.   def dispose_status_window
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ☆ 情報表示ビューポートの作成
  940.   #--------------------------------------------------------------------------
  941.   alias a1_battle_common_sb_create_info_viewport create_info_viewport
  942.   def create_info_viewport
  943.     a1_battle_common_sb_create_info_viewport
  944.     post_create_info_viewport
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ○ 情報表示ビューポート作成の後処理
  948.   #--------------------------------------------------------------------------
  949.   def post_create_info_viewport
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ☆ スキルウィンドウの作成
  953.   #--------------------------------------------------------------------------
  954.   alias a1_battle_common_sb_create_skill_window create_skill_window
  955.   def create_skill_window
  956.     a1_battle_common_sb_create_skill_window
  957.     post_create_skill_window
  958.     define_skill_window_method
  959.   end
  960.   #--------------------------------------------------------------------------
  961.   # ○ スキルウィンドウ作成の後処理
  962.   #--------------------------------------------------------------------------
  963.   def post_create_skill_window
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ○ スキルウィンドウメソッドの定義
  967.   #--------------------------------------------------------------------------
  968.   def define_skill_window_method
  969.     @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  970.     @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ☆ アイテムウィンドウの作成
  974.   #--------------------------------------------------------------------------
  975.   alias a1_battle_common_sb_create_item_window create_item_window
  976.   def create_item_window
  977.     a1_battle_common_sb_create_item_window
  978.     post_create_item_window
  979.     define_item_window_method
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ○ アイテムウィンドウ作成の後処理
  983.   #--------------------------------------------------------------------------
  984.   def post_create_item_window
  985.   end
  986.   #--------------------------------------------------------------------------
  987.   # ○ アイテムウィンドウメソッドの定義
  988.   #--------------------------------------------------------------------------
  989.   def define_item_window_method
  990.     @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  991.     @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # ○ スキル/アイテムウィンドウが表示された時の処理
  995.   #--------------------------------------------------------------------------
  996.   def skill_item_window_show
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ○ スキル/アイテムウィンドウが非表示になった時の処理
  1000.   #--------------------------------------------------------------------------
  1001.   def skill_item_window_hide
  1002.   end
  1003.   #--------------------------------------------------------------------------
  1004.   # ☆ パーティコマンドウィンドウの作成
  1005.   #--------------------------------------------------------------------------
  1006.   alias a1_battle_common_sb_create_party_command_window create_party_command_window
  1007.   def create_party_command_window
  1008.     a1_battle_common_sb_create_party_command_window
  1009.     post_create_party_command_window
  1010.     define_party_command_window_method
  1011.     define_party_command_window_handle
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # ○ パーティコマンドウィンドウ作成の後処理
  1015.   #--------------------------------------------------------------------------
  1016.   def post_create_party_command_window
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ パーティコマンドウィンドウメソッドの定義
  1020.   #--------------------------------------------------------------------------
  1021.   def define_party_command_window_method
  1022.   end
  1023.   #--------------------------------------------------------------------------
  1024.   # ○ パーティコマンドウィンドウハンドルの定義
  1025.   #--------------------------------------------------------------------------
  1026.   def define_party_command_window_handle
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ☆ アクターウィンドウの作成
  1030.   #--------------------------------------------------------------------------
  1031.   alias a1_battle_common_sb_create_actor_window create_actor_window
  1032.   def create_actor_window
  1033.     a1_battle_common_sb_create_actor_window
  1034.     post_create_actor_window
  1035.     define_actor_window_method
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # ○ アクターウィンドウ作成の後処理
  1039.   #--------------------------------------------------------------------------
  1040.   def post_create_actor_window
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ○ アクターウィンドウメソッドの定義
  1044.   #--------------------------------------------------------------------------
  1045.   def define_actor_window_method
  1046.     @actor_window.define_method(method(:select_actor),     :select_actor)
  1047.     @actor_window.define_method(method(:select_actor_end), :select_actor_end)
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ○ アクターウィンドウをセレクトした時の処理
  1051.   #--------------------------------------------------------------------------
  1052.   def select_actor(index)
  1053.   end
  1054.   #--------------------------------------------------------------------------
  1055.   # ○ アクターウィンドウをセレクト終了した時の処理
  1056.   #--------------------------------------------------------------------------
  1057.   def select_actor_end
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # ☆ 敵キャラウィンドウの作成
  1061.   #--------------------------------------------------------------------------
  1062.   alias a1_battle_common_sb_create_enemy_window create_enemy_window
  1063.   def create_enemy_window
  1064.     a1_battle_common_sb_create_enemy_window
  1065.     post_create_enemy_window
  1066.     define_enemy_window_method
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # ○ 敵キャラウィンドウ作成の後処理
  1070.   #--------------------------------------------------------------------------
  1071.   def post_create_enemy_window
  1072.   end
  1073.   #--------------------------------------------------------------------------
  1074.   # ○ 敵キャラウィンドウメソッドの定義
  1075.   #--------------------------------------------------------------------------
  1076.   def define_enemy_window_method
  1077.     @enemy_window.define_method(method(:select_enemy),     :select_enemy)
  1078.     @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)
  1079.   end
  1080.   #--------------------------------------------------------------------------
  1081.   # ○ 敵キャラウィンドウをセレクトした時の処理
  1082.   #--------------------------------------------------------------------------
  1083.   def select_enemy(index)
  1084.   end
  1085.   #--------------------------------------------------------------------------
  1086.   # ○ 敵キャラウィンドウをセレクト終了した時の処理
  1087.   #--------------------------------------------------------------------------
  1088.   def select_enemy_end
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ☆ アクターコマンドウィンドウの作成
  1092.   #--------------------------------------------------------------------------
  1093.   alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window
  1094.   def create_actor_command_window
  1095.     a1_battle_common_sb_start_create_actor_command_window
  1096.     post_create_actor_command_window
  1097.     define_actor_command_handle
  1098.     define_actor_command_window
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # ○ アクターコマンドウィンドウ作成の後処理
  1102.   #--------------------------------------------------------------------------
  1103.   def post_create_actor_command_window
  1104.   end
  1105.   #--------------------------------------------------------------------------
  1106.   # ○ アクターコマンドウィンドウメソッドの定義
  1107.   #--------------------------------------------------------------------------
  1108.   def define_actor_command_window
  1109.     @actor_command_window.define_method(method(:actor_command_open),  :actor_command_open)
  1110.     @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)
  1111.     @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # ○ アクターコマンドウィンドウハンドルの定義
  1115.   #--------------------------------------------------------------------------
  1116.   def define_actor_command_handle
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ○ アクターコマンドウィンドウがオープンした時の処理
  1120.   #--------------------------------------------------------------------------
  1121.   def actor_command_open
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # ○ アクターコマンドウィンドウがクローズした時の処理
  1125.   #--------------------------------------------------------------------------
  1126.   def actor_command_close
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # ○ アクターコマンドウィンドウのセットアップ時の処理
  1130.   #--------------------------------------------------------------------------
  1131.   def actor_command_setup(actor)
  1132.   end
  1133.   #--------------------------------------------------------------------------
  1134.   # ☆ パーティコマンド選択の開始
  1135.   #--------------------------------------------------------------------------
  1136.   alias a1_battle_common_sb_start_party_command_selection start_party_command_selection
  1137.   def start_party_command_selection
  1138.     prev_start_party_command_selection
  1139.     a1_battle_common_sb_start_party_command_selection
  1140.     post_start_party_command_selection
  1141.   end
  1142.   #--------------------------------------------------------------------------
  1143.   # ○ パーティコマンド選択の開始の前処理
  1144.   #--------------------------------------------------------------------------
  1145.   def prev_start_party_command_selection
  1146.   end
  1147.   #--------------------------------------------------------------------------
  1148.   # ○ パーティコマンド選択の開始の後処理
  1149.   #--------------------------------------------------------------------------
  1150.   def post_start_party_command_selection
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # ☆ 次のコマンド入力へ
  1154.   #--------------------------------------------------------------------------
  1155.   alias a1_battle_common_sb_next_command next_command
  1156.   def next_command
  1157.     prev_next_command
  1158.     a1_battle_common_sb_next_command
  1159.     post_next_command
  1160.   end
  1161.   #--------------------------------------------------------------------------
  1162.   # ○ 次のコマンド入力への前処理
  1163.   #--------------------------------------------------------------------------
  1164.   def prev_next_command
  1165.   end
  1166.   #--------------------------------------------------------------------------
  1167.   # ○ 次のコマンド入力への後処理
  1168.   #--------------------------------------------------------------------------
  1169.   def post_next_command
  1170.   end
  1171.   #--------------------------------------------------------------------------
  1172.   # ☆ 前のコマンド入力へ
  1173.   #--------------------------------------------------------------------------
  1174.   alias a1_battle_common_sb_prior_command prior_command
  1175.   def prior_command
  1176.     prev_prior_command
  1177.     a1_battle_common_sb_prior_command
  1178.     post_prior_command
  1179.   end
  1180.   #--------------------------------------------------------------------------
  1181.   # ○ 前のコマンド入力への前処理
  1182.   #--------------------------------------------------------------------------
  1183.   def prev_prior_command
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # ○ 前のコマンド入力への後処理
  1187.   #--------------------------------------------------------------------------
  1188.   def post_prior_command
  1189.   end
  1190.   #--------------------------------------------------------------------------
  1191.   # ☆ ターン開始
  1192.   #--------------------------------------------------------------------------
  1193.   alias a1_battle_common_sb_turn_start turn_start
  1194.   def turn_start
  1195.     prev_turn_start
  1196.     a1_battle_common_sb_turn_start
  1197.     post_turn_start
  1198.   end
  1199.   #--------------------------------------------------------------------------
  1200.   # ○ ターン開始の前処理
  1201.   #--------------------------------------------------------------------------
  1202.   def prev_turn_start
  1203.   end
  1204.   #--------------------------------------------------------------------------
  1205.   # ○ ターン開始の後処理
  1206.   #--------------------------------------------------------------------------
  1207.   def post_turn_start
  1208.   end
  1209.   #--------------------------------------------------------------------------
  1210.   # ☆ ターン終了
  1211.   #--------------------------------------------------------------------------
  1212.   alias a1_battle_common_sb_turn_end turn_end
  1213.   def turn_end
  1214.     prev_turn_end
  1215.     a1_battle_common_sb_turn_end
  1216.     post_turn_end
  1217.   end
  1218.   #--------------------------------------------------------------------------
  1219.   # ○ ターン終了の前処理
  1220.   #--------------------------------------------------------------------------
  1221.   def prev_turn_end
  1222.   end
  1223.   #--------------------------------------------------------------------------
  1224.   # ○ ターン終了の後処理
  1225.   #--------------------------------------------------------------------------
  1226.   def post_turn_end
  1227.   end
  1228.   #--------------------------------------------------------------------------
  1229.   # ○ ウィンドウが閉じるまでウェイト
  1230.   #--------------------------------------------------------------------------
  1231.   def wait_fot_window_close(window)
  1232.     update_basic while window.close?
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # ○ アクターのバトルメンバー取得
  1236.   #--------------------------------------------------------------------------
  1237.   def battle_members
  1238.     @party_battle_members ||= $game_party.battle_members
  1239.     return @party_battle_members
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # ○ バトルメンバーの追加の前処理
  1243.   #--------------------------------------------------------------------------
  1244.   def prev_add_battler(members)
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # ○ バトルメンバーの追加後の処理
  1248.   #--------------------------------------------------------------------------
  1249.   def post_add_battler(member)
  1250.     @party_battle_members = $game_party.battle_members
  1251.   end
  1252.   #--------------------------------------------------------------------------
  1253.   # ○ バトルメンバー削除の前処理
  1254.   #--------------------------------------------------------------------------
  1255.   def prev_remove_battler(member)
  1256.   end
  1257.   #--------------------------------------------------------------------------
  1258.   # ○ バトルメンバーの削除後の処理
  1259.   #--------------------------------------------------------------------------
  1260.   def post_remove_battler
  1261.     @party_battle_members = $game_party.battle_members
  1262.   end
  1263.   #--------------------------------------------------------------------------
  1264.   # ☆ 戦闘行動の実行
  1265.   #--------------------------------------------------------------------------
  1266.   alias a1_battle_common_sb_execute_action execute_action
  1267.   def execute_action
  1268.     prev_execute_action
  1269.     a1_battle_common_sb_execute_action
  1270.     post_execute_action
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # ○ 戦闘行動の実行の前処理
  1274.   #--------------------------------------------------------------------------
  1275.   def prev_execute_action
  1276.     @subject.current_action.pre_make_targets
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # ○ 戦闘行動の実行の後処理
  1280.   #--------------------------------------------------------------------------
  1281.   def post_execute_action
  1282.     @subject.current_action.clear_targets if @subject.current_action
  1283.   end
  1284.   #--------------------------------------------------------------------------
  1285.   # ☆ スキル/アイテムの使用
  1286.   #--------------------------------------------------------------------------
  1287.   alias a1_battle_common_sb_use_item use_item
  1288.   def use_item
  1289.     prev_use_item
  1290.     a1_battle_common_sb_use_item
  1291.     post_use_item
  1292.   end
  1293.   #--------------------------------------------------------------------------
  1294.   # ○ スキル/アイテムの使用の前処理
  1295.   #--------------------------------------------------------------------------
  1296.   def prev_use_item
  1297.   end
  1298.   #--------------------------------------------------------------------------
  1299.   # ○ スキル/アイテムの使用の後処理
  1300.   #--------------------------------------------------------------------------
  1301.   def post_use_item
  1302.   end
  1303.   #--------------------------------------------------------------------------
  1304.   # ○ 勝利の処理
  1305.   #--------------------------------------------------------------------------
  1306.   def process_victory
  1307.   end
  1308.   #--------------------------------------------------------------------------
  1309.   # ○ 戦闘終了
  1310.   #--------------------------------------------------------------------------
  1311.   def battle_end(result)
  1312.     $game_party.all_members.each {|member| init_member_battle_end(member) }
  1313.   end
  1314.   #--------------------------------------------------------------------------
  1315.   # ○ 戦闘終了時のメンバー初期化
  1316.   #--------------------------------------------------------------------------
  1317.   def init_member_battle_end(member)
  1318.     member.current_weapon = nil
  1319.     member.current_main   = nil
  1320.   end
  1321. end
  1322. end
复制代码
スクリプト本体

  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    戦闘中入れ替え(RGSS3)
  4. #
  5. # バージョン   : 1.00 (2012/01/18)
  6. # 作者         : A1
  7. # URL     : http://a1tktk.web.fc2.com/
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・戦闘中にメンバーを入れ替えます
  11. #---------------------------------------------------------------------------
  12. # 更新履歴   :2012/01/18 Ver1.00 リリース
  13. #---------------------------------------------------------------------------
  14. # 設置場所      
  15. #    A1バトル共通スクリプト以下
  16. #
  17. # 必要スクリプト
  18. #    A1バトル共通スクリプト
  19. #---------------------------------------------------------------------------
  20. # 使い方
  21. #   導入することで適用されます
  22. #==============================================================================
  23. $imported ||= {}
  24. if $imported["A1_BattleCommonScript"]
  25. $imported["A1_ChangeMember"] = true
  26. old_common_script("戦闘中入れ替え", "3.90") if common_version < 3.90
  27. #==============================================================================
  28. # ■ Window_PartyCommand
  29. #==============================================================================

  30. class Window_MemberChange < Window_Selectable
  31.   #--------------------------------------------------------------------------
  32.   # ○ オブジェクト初期化
  33.   #--------------------------------------------------------------------------
  34.   def initialize
  35.     @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)
  36.     @to_actor_window   = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)
  37.     setup_members
  38.     width              = @battle_members.size * 48 + standard_padding * 2
  39.     height             = (@all_members.size / @battle_members.size.to_f).ceil * 48 + standard_padding * 2 + 36
  40.     super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)
  41.     self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height
  42.     self.index = 0
  43.     @from_actor = -1
  44.     self.openness = 0
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ○ アクティブ化
  48.   #--------------------------------------------------------------------------
  49.   def activate
  50.     super
  51.     refresh
  52.     @form_actor_window.actor = @all_members[self.index]
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ○ メンバーのセットアップ
  56.   #--------------------------------------------------------------------------
  57.   def setup_members
  58.     @all_members    = $game_party.all_members
  59.     @battle_members = $game_party.battle_members
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ○ 項目の選択
  63.   #--------------------------------------------------------------------------
  64.   def select(index)
  65.     super
  66.     @form_actor_window.actor = @all_members[self.index] if @from_actor == -1
  67.     @to_actor_window.actor   = @all_members[self.index] if @from_actor >= 0
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ○ 項目数の取得
  71.   #--------------------------------------------------------------------------
  72.   def item_max
  73.     @all_members.size
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ○ 桁数の取得
  77.   #--------------------------------------------------------------------------
  78.   def col_max
  79.     @battle_members.size
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ○ リフレッシュ
  83.   #--------------------------------------------------------------------------
  84.   def refresh
  85.     super
  86.     draw_horz_line(52)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ 水平線の描画
  90.   #--------------------------------------------------------------------------
  91.   def draw_horz_line(y)
  92.     line_y = y + line_height / 2 - 1
  93.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ○ 水平線の色を取得
  97.   #--------------------------------------------------------------------------
  98.   def line_color
  99.     color = normal_color
  100.     color.alpha = 128
  101.     color
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ○ 項目の描画
  105.   #--------------------------------------------------------------------------
  106.   def draw_item(index)
  107.     c_name  = member(index).character_name
  108.     c_index = member(index).character_index
  109.     rect    = item_rect(index)
  110.     draw_character(c_name, c_index, rect.x + 24, rect.y + 40)
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ○ 項目を描画する矩形の取得
  114.   #--------------------------------------------------------------------------
  115.   def item_rect(index)
  116.     rect = Rect.new
  117.     rect.width = item_width
  118.     rect.height = item_height
  119.     rect.x = index % col_max * item_width
  120.     rect.y = index / col_max * item_height
  121.     rect.y += 24 if index > @battle_members.size - 1
  122.     rect
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ○ 項目の幅を取得
  126.   #--------------------------------------------------------------------------
  127.   def item_width
  128.     return 48
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ○ 項目の高さを取得
  132.   #--------------------------------------------------------------------------
  133.   def item_height
  134.     return 48
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ ウィンドウ内容の高さを計算
  138.   #--------------------------------------------------------------------------
  139.   def contents_height
  140.     row_max * item_height + 24
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ○ 下端パディングの更新
  144.   #--------------------------------------------------------------------------
  145.   def update_padding_bottom
  146.     surplus = (height - standard_padding * 2) % item_height - 24
  147.     self.padding_bottom = padding + surplus
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ○ メンバーの取得
  151.   #--------------------------------------------------------------------------
  152.   def member(index)
  153.     @all_members[index]
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ○ 決定処理の有効状態を取得
  157.   #--------------------------------------------------------------------------
  158.   def ok_enabled?
  159.     return true
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ○ 決定ボタンが押されたときの処理
  163.   #--------------------------------------------------------------------------
  164.   def process_ok
  165.     Sound.play_ok
  166.     Input.update
  167.     return select_start_to_actor if @from_actor == -1
  168.     return call_cancel_handler if @from_actor == self.index
  169.     change_member if @from_actor >= 0
  170.     post_change_member
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ メンバー入れ替え
  174.   #--------------------------------------------------------------------------
  175.   def change_member
  176.     $game_party.swap_order(@from_actor, self.index)
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ メンバー入れ替え後の処理
  180.   #--------------------------------------------------------------------------
  181.   def post_change_member
  182.     setup_members
  183.     self.index  = @from_actor
  184.     @form_actor_window.actor = @all_members[self.index]
  185.     @from_actor = -1
  186.     @to_actor_window.close
  187.     refresh
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ○ 入れ替え先のアクター選択開始
  191.   #--------------------------------------------------------------------------
  192.   def select_start_to_actor
  193.     @from_actor = self.index
  194.     @to_actor_window.open
  195.     self.index = self.index < @battle_members.size ? @battle_members.size : 0
  196.     @to_actor_window.actor = @all_members[self.index]
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ○ 入れ替え元のアクター
  200.   #--------------------------------------------------------------------------
  201.   def from_actor
  202.     @from_actor
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ○ オープン
  206.   #--------------------------------------------------------------------------
  207.   def open
  208.     super
  209.     @form_actor_window.open
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ○ キャンセルハンドラの呼び出し
  213.   #--------------------------------------------------------------------------
  214.   def call_cancel_handler
  215.     super if @from_actor == -1
  216.     @from_actor = -1
  217.     @to_actor_window.close
  218.     @form_actor_window.actor = @all_members[self.index]
  219.     activate
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ○ クローズ
  223.   #--------------------------------------------------------------------------
  224.   def close
  225.     super
  226.     @form_actor_window.close
  227.     @to_actor_window.close
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ○ フレーム更新
  231.   #--------------------------------------------------------------------------
  232.   def update
  233.     super
  234.     @form_actor_window.update
  235.     @to_actor_window.update
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ 解放
  239.   #--------------------------------------------------------------------------
  240.   def dispose
  241.     super
  242.     @form_actor_window.dispose
  243.     @to_actor_window.dispose
  244.   end
  245. end
  246. #==============================================================================
  247. # ■ Window_PartyCommand
  248. #------------------------------------------------------------------------------
  249. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  250. #==============================================================================

  251. class Window_PartyCommand < Window_Command
  252.   #--------------------------------------------------------------------------
  253.   # ☆ コマンドリストの作成
  254.   #--------------------------------------------------------------------------
  255.   alias a1_cbm_wpc_make_command_list make_command_list
  256.   def make_command_list
  257.     a1_cbm_wpc_make_command_list
  258.     add_command("入れ替え", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
  259.   end
  260. end
  261. #==============================================================================
  262. # ■ Scene_Battle
  263. #------------------------------------------------------------------------------
  264. #  バトル画面の処理を行うクラスです。
  265. #==============================================================================

  266. class Scene_Battle < Scene_Base
  267.   #--------------------------------------------------------------------------
  268.   # ☆ 全ウィンドウの作成
  269.   #--------------------------------------------------------------------------
  270.   alias a1_cbm_wpc_create_all_windows create_all_windows
  271.   def create_all_windows
  272.     a1_cbm_wpc_create_all_windows
  273.     create_member_change_window
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ○ 入れ替えウィンドウの作成
  277.   #--------------------------------------------------------------------------
  278.   def create_member_change_window
  279.     @window_member_change = Window_MemberChange.new
  280.     @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ☆ パーティコマンドウィンドウハンドルの定義
  284.   #--------------------------------------------------------------------------
  285.   alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
  286.   def define_party_command_window_handle
  287.     a1_cbm_sb_define_party_command_window_handle
  288.     @party_command_window.set_handler(:member_change,  method(:command_member_change))
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ○ 入れ替え
  292.   #--------------------------------------------------------------------------
  293.   def command_member_change
  294.     @prev_battle_members = $game_party.battle_members
  295.     @status_window.close
  296.     @party_command_window.close
  297.     @window_member_change.open
  298.     @window_member_change.activate
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ○ 変更したメンバーを取得
  302.   #--------------------------------------------------------------------------
  303.   def change_diss_members(ret = [])
  304.     $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }
  305.     return ret
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ○ メンバーチェンジ[キャンセル]
  309.   #--------------------------------------------------------------------------
  310.   def on_member_change_cancel
  311.     @party_command_window.activate
  312.     @status_window.refresh
  313.     @status_window.open
  314.     @party_command_window.open
  315.     @window_member_change.close
  316.     change_diss_members.each {|member| member.make_actions }
  317.     @party_battle_members = $game_party.battle_members
  318.   end
  319. end
  320. end

复制代码

������

点评

这个脚本能禁止第一个角色换位吗?  发表于 2013-5-15 22:13
这三个脚本都需要?因为我用的是六格行走图,行走图显示会出现问题,请问怎么修改成头像?  发表于 2013-5-14 11:05
hcm
链接Over了。  发表于 2012-3-28 22:52

评分

参与人数 1星屑 +60 收起 理由
hcm + 60 感谢回答。

查看全部评分

回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-7 19:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表