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

Project1

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

[已经解决] 求教,VA战斗中换人的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
288
在线时间
70 小时
注册时间
2013-3-2
帖子
43
跳转到指定楼层
1
发表于 2014-9-6 21:51:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求高手指教,VA战斗中换人的脚本和使用方法
刚才找了下图书馆,不知道是不是我看漏了,找了半天没有
查了下资料,几乎都是XP区的
求高手指教,在此先行感谢

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
帖子
799
2
发表于 2014-9-6 22:40:48 | 只看该作者
有一个,需要三个脚本

RUBY 代码复制
  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1共通処理(RGSS2/RGSS3共用)
  4. #
  5. # バージョン   : 4.50 (2012/01/26)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  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.  
  78. class A1_System::CommonModule
  79.   #--------------------------------------------------------------------------
  80.   # ○ 定数
  81.   #--------------------------------------------------------------------------
  82.   TWOBYTE_LIST = {
  83.                   " " => " ",
  84.                   "=" => "=",
  85.                   ":" => ":"
  86.                   }
  87.   #--------------------------------------------------------------------------
  88.   # ○ オブジェクト初期化
  89.   #--------------------------------------------------------------------------
  90.   def initialize
  91.     define_command
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ 変換対象の全角文字を半角に置換
  95.   #--------------------------------------------------------------------------
  96.   def replace_twobyte(str)
  97.     for key in TWOBYTE_LIST.keys
  98.       str.gsub!(key) {TWOBYTE_LIST[key]}
  99.     end
  100.     return str
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ○ マイナスが含まれている文字列を数値にする
  104.   #--------------------------------------------------------------------------
  105.   def minus_to_i(s)
  106.     if s[0,0] == "-"
  107.       s.gsub!("-","")
  108.       return s.to_i * -1
  109.     else
  110.       return s.to_i
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ○ ミリ秒単位の現在時間
  115.   #--------------------------------------------------------------------------
  116.   def now_usec
  117.     now = Time.now
  118.     hour = now.hour * 60 * 60
  119.     min  = now.min * 60
  120.     sec  = now.sec
  121.     msec = (now.usec / 1000.0).round
  122.     return (hour + min + sec) * 1000 + msec
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ○ イベントリストの作成
  126.   #--------------------------------------------------------------------------
  127.   def create_event_list(code, indent, parameters)
  128.     list = RPG::EventCommand.new
  129.     list.code       = code
  130.     list.indent     = indent
  131.     list.parameters = parameters
  132.     return list
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ○ メソッド呼び出し
  136.   #--------------------------------------------------------------------------
  137.   def send_method(method_name)
  138.     return send(method_name) if respond_to?(method_name)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ○ オブジェクトの型を判断してStringならエンコード
  142.   #--------------------------------------------------------------------------
  143.   def encoding_string(obj)
  144.     obj.force_encoding("UTF-8") if obj.is_a?(String)
  145.     return obj
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ○ メモの内容から必要な情報を取得
  149.   #--------------------------------------------------------------------------
  150.   def note_data(note, key)
  151.     result = []
  152.     note.each_line {|line|
  153.       next unless line =~ /<#{key}[ ]?(.*)>/
  154.       return true if $1.empty?
  155.       data = $a1_common.replace_twobyte($1).split(" ")
  156.       for st in data
  157.         result.push(st)
  158.       end
  159.     }
  160.     return false if result.empty?
  161.     return result
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ○ メモの内容からハッシュを作成
  165.   #--------------------------------------------------------------------------
  166.   def note_data_hash(note, key, data_default = nil, default = {}, ret = {})
  167.     list = note_data_split(note, key)
  168.     return default if list.empty?
  169.     list.each {|data| ret[data[0]] = data[1] ? data[1] : data_default }
  170.     return ret
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ メモの内容からカンマ区切りの多元配列を取得
  174.   #--------------------------------------------------------------------------
  175.   def note_data_split(note, key, default = [], ret = [])
  176.     data = note_data(note, key)
  177.     return default unless data.is_a?(Array)
  178.     data.each {|str| ret.push(convert_integer_from_array(split_array(str)))}
  179.     return ret
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ○ 配列の内容から数値があれば変換
  183.   #--------------------------------------------------------------------------
  184.   def convert_integer_from_array(data, ret = [])
  185.     data.each {|str| ret.push(convert_integer(str))}
  186.     return ret
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ○ 数値があれば変換
  190.   #--------------------------------------------------------------------------
  191.   def convert_integer(str)
  192.     return $1.to_i if str =~ /(^[-]?[0-9]+$)/
  193.     str.is_a?(Array) ? convert_integer_from_array(str) : str
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ○ メモの内容から単項目の数値を取得
  197.   #--------------------------------------------------------------------------
  198.   def note_data_one_value(note, key, default)
  199.     data = note_data(note, key)
  200.     return data[0].to_i if data.is_a?(Array)
  201.     return default
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ○ メモの内容から単項目を取得
  205.   #--------------------------------------------------------------------------
  206.   def note_data_one(note, key, default)
  207.     data = note_data(note, key)
  208.     return data[0] if data.is_a?(Array)
  209.     return default
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ○ メモの内容からカンマ区切りの文字列を取得
  213.   #--------------------------------------------------------------------------
  214.   def note_data_array_str(note, key, default)
  215.     data = note_data(note, key)
  216.     return data[0].split(",") if data.is_a?(Array)
  217.     return default
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ○ メモの内容からカンマ区切りの数値を取得
  221.   #--------------------------------------------------------------------------
  222.   def note_data_array_value(note, key, default)
  223.     data = note_data(note, key)
  224.     return default unless data.is_a?(Array)
  225.     return convert_integer_from_array(split_array(data[0]))
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ○ カンマ区切りの文字列メモを変換
  229.   #--------------------------------------------------------------------------
  230.   def note_data_array(note, key, type, default = nil, through = true)
  231.     ret = []
  232.     default.each {|dat| ret.push(dat)} if default != nil
  233.  
  234.     data = note_data(note, key)
  235.     return ret unless data.is_a?(Array)
  236.  
  237.     data = data[0].split(",")
  238.     for d in data
  239.       next if ret.include?(d) if through
  240.       ret.push(d.to_i) if type.is_a?(Integer)
  241.       ret.push(d)      if type.is_a?(String)
  242.     end
  243.     return ret
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ○ ディレクトリの作成
  247.   #--------------------------------------------------------------------------
  248.   def make_directory(dir_name)
  249.     Dir::mkdir(dir_name) unless FileTest.exist?(dir_name)
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ○ コマンドリスト
  253.   #--------------------------------------------------------------------------
  254.   def make_command(command, src = "", dect = "")
  255.     src.gsub!("/","\\")
  256.     dect.gsub!("/","\\")
  257.     cmd = "#{command} \"#{src}\" \"#{dect}\""
  258.     return cmd
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ○ 素材の拡張子を取得
  262.   #--------------------------------------------------------------------------
  263.   def material_ext(directory, file, direct = false)
  264.     exts = []
  265.     exts = [".png",".bmp",".jpg"]               if directory =~ /(.*)Graphics\/(.*)/
  266.     exts = [".mid",".ogg",".wav",".mp3",".wma"] if directory =~ /(.*)Audio(.*)/
  267.  
  268.     find_file = sprintf("%s%s", directory, file) unless direct
  269.     find_file = file if direct
  270.  
  271.     for ext in exts
  272.       return ext if File.exist?(sprintf("%s%s", find_file, ext))
  273.     end
  274.     return nil
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ○ 素材が存在するかチェック
  278.   #--------------------------------------------------------------------------
  279.   def material_exist?(directory, file, direct = false)
  280.     return false if material_ext(directory, file, direct) == nil
  281.     return true
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ○ ファイルコピー
  285.   #--------------------------------------------------------------------------
  286.   def copy_file(src, dest)
  287.     srcFile = File.open( src, "rb" )
  288.     dstFile = File.open( dest, "wb" )
  289.     dstFile.write( srcFile.read )
  290.     srcFile.close
  291.     dstFile.close
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ○ ファイルの存在を確認してファイルコピー
  295.   #--------------------------------------------------------------------------
  296.   def material_copy(src, dest, directory)
  297.     ext = material_ext(directory, src, true)
  298.     copy_file( src + ext, dest + ext ) if ext != nil
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ○ 配列からAudioを作成
  302.   #--------------------------------------------------------------------------
  303.   def set_audio(sound, kind)
  304.     case kind
  305.     when "BGM"; audio = RPG::BGM.new
  306.     when "BGS"; audio = RPG::BGS.new
  307.     when "ME";  audio = RPG::ME.new
  308.     when "SE";  audio = RPG::SE.new
  309.     end
  310.     audio.name   = sound[0]
  311.     audio.volume = sound[1]
  312.     audio.pitch  = sound[2]
  313.     return audio
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ○ 既に準拠識別子を持っているかチェック
  317.   #--------------------------------------------------------------------------
  318.   def chk_rtp(file_name, default)
  319.     return "" if file_name =~ /^VX_.*/
  320.     return "" if file_name =~ /^XP_.*/
  321.     return "" if file_name =~ /^2000_.*/
  322.     return "" if file_name =~ /^2003_.*/
  323.     return default
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ○ 先頭の $ を切り出す
  327.   #--------------------------------------------------------------------------
  328.   def one_character(file_name)
  329.     return file_name unless file_name[0] == "$"
  330.     tmp = file_name.clone
  331.     tmp[0] = ""
  332.     return tmp
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ○ 配列を入れ替える
  336.   #--------------------------------------------------------------------------
  337.   def change_array(array, index1, index2)
  338.     tmp = array[index1]
  339.     array[index1] = array[index2]
  340.     array[index2] = tmp
  341.     return array
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ○ 移動ルートの作成
  345.   #--------------------------------------------------------------------------
  346.   def create_move_route(repeat, skippable, wait, list)
  347.     move_route = RPG::MoveRoute.new
  348.     move_route.repeat    = repeat
  349.     move_route.skippable = skippable
  350.     move_route.wait      = wait
  351.     move_route.list      = list
  352.     return move_route
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ○ 移動ルートコマンドの作成
  356.   #--------------------------------------------------------------------------
  357.   def create_move_command(code, parameters)
  358.     list = RPG::MoveCommand.new
  359.     list.code       = code
  360.     list.parameters = parameters
  361.     return list
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ○ インタプリタ起動用リストの作成
  365.   #--------------------------------------------------------------------------
  366.   def create_list(code, indent, parameters)
  367.     list            = RPG::EventCommand.new
  368.     list.code       = code
  369.     list.indent     = indent
  370.     list.parameters = parameters
  371.     return list
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ○ クラス名の取得
  375.   #--------------------------------------------------------------------------
  376.   def class_name(class_instance)
  377.     return class_instance.to_s.split(":")[0].gsub("#<","")
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ○ 配列を考慮したsplit
  381.   #--------------------------------------------------------------------------
  382.   def split_array(str)
  383.     str = convert_escape_characters(str)
  384.  
  385.     ret       = []
  386.     tmp_array = str.split(",")
  387.  
  388.     return strip_array_str(tmp_array) unless str.include?("[")
  389.     tmp_str   = ""
  390.     tmp_array.each {|s|
  391.       if char_in_str(s, "[", "]") && tmp_str.empty?
  392.         ret.push(s) unless s =~ /^\[/
  393.         ret.push([s[1...s.size-1]]) if s =~ /^\[/
  394.       else
  395.         tmp_str = "#{tmp_str}#{s},"
  396.         if char_in_str(tmp_str, "[", "]")
  397.           unless tmp_str =~ /^\[/
  398.             ret.push(tmp_str[0...tmp_str.size-1])
  399.             tmp_str = ""
  400.           else
  401.             tmp_str = tmp_str[1...tmp_str.size-2]
  402.             tmp_str = split_array(tmp_str) if tmp_str.include?("[")
  403.             tmp_str = tmp_str.split(",") if tmp_str.include?(",")
  404.             ret.push(tmp_str)   if tmp_str.is_a?(Array)
  405.             ret.push([tmp_str]) if !tmp_str.is_a?(Array)
  406.             tmp_str = ""
  407.           end
  408.         end
  409.       end
  410.     }
  411.     return strip_array_str(ret)
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ○ 配列の中の文字列の先頭と末尾の空白を除去
  415.   #--------------------------------------------------------------------------
  416.   def strip_array_str(array, ret = [])
  417.     array.each {|str| ret.push(strip_array_str(str)) if str.is_a?(Array); next if str.is_a?(Array); ret.push(str.strip) }
  418.     return ret
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ○ 文字列の中に文字が何文字含まれているか調べて同数ならtrueを返す
  422.   #--------------------------------------------------------------------------
  423.   def char_in_str(str, c1, c2)
  424.     num1 = 0
  425.     num2 = 0
  426.     (0...str.size).each {|i| num1 += 1 if str[i] == c1; num2 += 1 if str[i] == c2 }
  427.     return num1 == num2
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ○ 制御文字の変換
  431.   #--------------------------------------------------------------------------
  432.   def convert_escape_characters(text)
  433.     result = text.to_s.clone
  434.     result.gsub!(/\\/)                           { "\e" }
  435.     result.gsub!(/\e\e/)                         { "\\" }
  436.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  437.     result.gsub!(/\eV\[(\d+)\]/i)                { $game_variables[$1.to_i] }
  438.     result.gsub!(/\eN\[(\d+)\]/i)                { actor_name($1.to_i) }
  439.     result.gsub!(/\eP\[(\d+)\]/i)                { party_member_name($1.to_i) }
  440.     result.gsub!(/\eG/i)                         { Vocab::currency_unit }
  441.     loop { result = result.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  442.     result
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ アクター n 番の名前を取得
  446.   #--------------------------------------------------------------------------
  447.   def actor_name(n)
  448.     actor = n >= 1 ? $game_actors[n] : nil
  449.     actor ? actor.name : ""
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ○ パーティメンバー n 番の名前を取得
  453.   #--------------------------------------------------------------------------
  454.   def party_member_name(n)
  455.     actor = n >= 1 ? $game_party.members[n - 1] : nil
  456.     actor ? actor.name : ""
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ○ 配列を全て整数にする
  460.   #--------------------------------------------------------------------------
  461.   def params_to_i(params)
  462.     ret = []
  463.     params.each {|param| ret.push(param.to_i)}
  464.     return ret
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ○ 注釈コマンド定義
  468.   #--------------------------------------------------------------------------
  469.   def define_command
  470.     @cmd_108 = {}
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ○ 注釈コマンド定義取得
  474.   #--------------------------------------------------------------------------
  475.   def cmd_108
  476.     @cmd_108
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ○ フレーム更新
  480.   #--------------------------------------------------------------------------
  481.   def update
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ○ 文字の幅と高さを取得
  485.   #--------------------------------------------------------------------------
  486.   def text_size(font, size, text)
  487.     bitmap = Cache.system("")
  488.     bitmap.font.name = font
  489.     bitmap.font.size = size
  490.     tw = bitmap.text_size(text).width
  491.     th = bitmap.text_size(text).height
  492.     bitmap.dispose
  493.     return [tw, th]
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # ○ 文字の幅を取得
  497.   #--------------------------------------------------------------------------
  498.   def text_width(font, text)
  499.     texts = text.split("\n")
  500.     @max_width = 0
  501.     texts.each {|text|
  502.       width = text_size(font.name, font.size, text)[0]
  503.       @max_width = @max_width < width ? width : @max_width
  504.     }
  505.     return @max_width
  506.   end
  507. end
  508. #==============================================================================
  509. # ◆ RGSS3用処理
  510. #==============================================================================
  511. if rgss_version == 3
  512. #==============================================================================
  513. # ■ RPG::Tileset
  514. #==============================================================================
  515.  
  516. class RPG::Tileset
  517.   #--------------------------------------------------------------------------
  518.   # ○ 拡張通行判定
  519.   #--------------------------------------------------------------------------
  520.   def ex_flags
  521.     @ex_flags ||= Table.new(8192)
  522.     return @ex_flags
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ○ 拡張通行判定初期化
  526.   #--------------------------------------------------------------------------
  527.   def init_ex_flags
  528.     @ex_flags = Table.new(8192)
  529.   end
  530. end
  531. #==============================================================================
  532. # ■ Game_Interpreter
  533. #------------------------------------------------------------------------------
  534. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  535. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  536. #==============================================================================
  537.  
  538. class Game_Interpreter
  539.   #--------------------------------------------------------------------------
  540.   # ☆ オブジェクト初期化
  541.   #     depth : ネストの深さ
  542.   #--------------------------------------------------------------------------
  543.   alias a1_common_gi_rgss3_initialize initialize
  544.   def initialize(depth = 0, sub_interpreter = false)
  545.     @sub_interpreter = sub_interpreter
  546.     a1_common_gi_rgss3_initialize(depth)
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ☆ メッセージ表示がビジー状態の間ウェイト
  550.   #--------------------------------------------------------------------------
  551.   alias a1_common_gi_wait_for_message wait_for_message
  552.   def wait_for_message
  553.     return if @sub_interpreter
  554.     a1_common_gi_wait_for_message
  555.   end
  556. end
  557. #==============================================================================
  558. # ■ Window_Message
  559. #------------------------------------------------------------------------------
  560. #  文章表示に使うメッセージウィンドウです。
  561. #==============================================================================
  562.  
  563. class Window_Message < Window_Base
  564.   #--------------------------------------------------------------------------
  565.   # ☆ 通常文字の処理
  566.   #--------------------------------------------------------------------------
  567.   alias a1_common_wm_process_normal_character process_normal_character
  568.   def process_normal_character(c, pos)
  569.     wait_for_one_character_before
  570.     a1_common_wm_process_normal_character(c, pos)
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ○ 一文字出力前のウェイト
  574.   #--------------------------------------------------------------------------
  575.   def wait_for_one_character_before
  576.   end
  577. end
  578. #==============================================================================
  579. # ■ RPG::Map
  580. #==============================================================================
  581.  
  582. class RPG::Map
  583.   #--------------------------------------------------------------------------
  584.   # ○ マップチップを調べるか判定する
  585.   #--------------------------------------------------------------------------
  586.   def search_map_chip?
  587.     return true if $a1_common.note_data(self.note, "マップチップサーチ")
  588.     return false
  589.   end
  590. end
  591. #==============================================================================
  592. # ■ Game_Map
  593. #------------------------------------------------------------------------------
  594. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  595. # このクラスのインスタンスは $game_map で参照されます。
  596. #==============================================================================
  597.  
  598. class Game_Map
  599.   #--------------------------------------------------------------------------
  600.   # ☆ セットアップ
  601.   #--------------------------------------------------------------------------
  602.   alias a1_common_gm_setup setup
  603.   def setup(map_id)
  604.     a1_common_gm_setup(map_id)
  605.     setup_tileset
  606.     map_chip_search if search_map_chip?
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ★ タイルセットの取得
  610.   #--------------------------------------------------------------------------
  611.   def tileset
  612.     setup_tileset unless @tileset && @now_tileset_id == @tileset_id
  613.     return @tileset
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ○ タイルセットのセットアップ
  617.   #--------------------------------------------------------------------------
  618.   def setup_tileset
  619.     @tileset        = $data_tilesets[@tileset_id].clone
  620.     @tileset.flags  = $data_tilesets[@tileset_id].flags.clone
  621.     @now_tileset_id = @tileset_id
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ○ マップチップを調べるか判定する
  625.   #--------------------------------------------------------------------------
  626.   def search_map_chip?
  627.     return @map.search_map_chip?
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ○ 指定座標の全レイヤーのフラグ判定(イベント含む)
  631.   #--------------------------------------------------------------------------
  632.   def all_tiles_flag?(x, y, bit)
  633.     all_tiles(x, y).any? {|tile_id| tileset.flags[tile_id] & bit != 0 }
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ○ 指定座標の全レイヤーの拡張フラグ判定(イベント含む)
  637.   #--------------------------------------------------------------------------
  638.   def all_tiles_flag_ex?(x, y, bit)
  639.     all_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ○ 指定座標の全レイヤーの拡張フラグ判定
  643.   #--------------------------------------------------------------------------
  644.   def layered_tiles_flag_ex?(x, y, bit)
  645.     layered_tiles(x, y).any? {|tile_id| tileset.ex_flags[tile_id] & bit != 0 }
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ○ 地形タグの取得(イベント含む)
  649.   #--------------------------------------------------------------------------
  650.   def terrain_tag_all_tailes(x, y)
  651.     return 0 unless valid?(x, y)
  652.     all_tiles(x, y).each do |tile_id|
  653.       tag = tileset.flags[tile_id] >> 12
  654.       return tag if tag > 0
  655.     end
  656.     return 0
  657.   end
  658. end
  659. #==============================================================================
  660. # ■ DataManager
  661. #------------------------------------------------------------------------------
  662. #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
  663. # ほぼ全てのグローバル変数はこのモジュールで初期化されます。
  664. #==============================================================================
  665.  
  666. module DataManager
  667.   #--------------------------------------------------------------------------
  668.   # ○ エイリアス用特異メソッド
  669.   #--------------------------------------------------------------------------
  670.   class << self
  671.     alias :a1_common_create_game_objects :create_game_objects
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ☆ 各種ゲームオブジェクトの作成
  675.   #--------------------------------------------------------------------------
  676.   def self.create_game_objects
  677.     $a1_common ||= A1_System::CommonModule.new
  678.     a1_common_create_game_objects
  679.   end
  680. end
  681. #==============================================================================
  682. # ■ Scene_Base
  683. #------------------------------------------------------------------------------
  684. #  ゲーム中の全てのシーンのスーパークラスです。
  685. #==============================================================================
  686.  
  687. class Scene_Base
  688.   #--------------------------------------------------------------------------
  689.   # ☆ フレーム更新(基本)
  690.   #--------------------------------------------------------------------------
  691.   alias a1_common_sb_update_basic update_basic
  692.   def update_basic
  693.     a1_common_sb_update_basic
  694.     $a1_common.update
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # ○ 指定のウィンドウが開いている間ウェイト
  698.   #--------------------------------------------------------------------------
  699.   def wait_for_window_open(window)
  700.     update_basic until window.openness == 0
  701.   end
  702. end
  703. #==============================================================================
  704. # ■ Window_Base
  705. #------------------------------------------------------------------------------
  706. #  ゲーム中の全てのウィンドウのスーパークラスです。
  707. #==============================================================================
  708.  
  709. class Window_Base < Window
  710.   #--------------------------------------------------------------------------
  711.   # ★ 制御文字の事前変換
  712.   #    実際の描画を始める前に、原則として文字列に変わるものだけを置き換える。
  713.   #    文字「\」はエスケープ文字(\e)に変換。
  714.   #--------------------------------------------------------------------------
  715.   def convert_escape_characters(text)
  716.     return $a1_common.convert_escape_characters(text)
  717.   end
  718. end
  719. #==============================================================================
  720. # ◆ RGSS2用処理
  721. #==============================================================================
  722. elsif rgss_version == 2
  723. #==============================================================================
  724. # ■ Window
  725. #==============================================================================
  726.  
  727. class Window
  728.   #--------------------------------------------------------------------------
  729.   # ○ ウィンドウが開いている?
  730.   #--------------------------------------------------------------------------
  731.   def open?
  732.     return self.openness == 255
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ○ ウィンドウが閉じている?
  736.   #--------------------------------------------------------------------------
  737.   def close?
  738.     return self.openness == 0
  739.   end
  740. end
  741. #==============================================================================
  742. # ■ Cache
  743. #------------------------------------------------------------------------------
  744. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  745. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  746. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  747. # を返すようになっています。
  748. #==============================================================================
  749.  
  750. module Cache
  751.   #--------------------------------------------------------------------------
  752.   # ○ キャッシュ存在チェック
  753.   #--------------------------------------------------------------------------
  754.   def self.include?(key)
  755.     @cache[key] && !@cache[key].disposed?
  756.   end
  757. end
  758. #==============================================================================
  759. # ■ Game_Interpreter
  760. #------------------------------------------------------------------------------
  761. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  762. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  763. #==============================================================================
  764.  
  765. class Game_Interpreter
  766.   #--------------------------------------------------------------------------
  767.   # ○ 注釈
  768.   #--------------------------------------------------------------------------
  769.   def command_108
  770.     @comments = [@params[0]]
  771.     while next_event_code == 408
  772.       @index += 1
  773.       @comments.push(@list[@index].parameters[0])
  774.     end
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ★ イベントコマンドの実行
  778.   #--------------------------------------------------------------------------
  779.   def execute_command
  780.     return rgss3_execute_command unless @index >= @list.size-1
  781.     command_end
  782.     return true
  783.   end
  784.   #--------------------------------------------------------------------------
  785.   # ○ RGSS3風「イベントコマンドの実行」
  786.   #--------------------------------------------------------------------------
  787.   def rgss3_execute_command
  788.     command = @list[@index]
  789.     @params = command.parameters
  790.     @indent = command.indent
  791.     method_name = "command_#{command.code}"
  792.     send(method_name) if respond_to?(method_name)
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # ○ 次のイベントコマンドのコードを取得
  796.   #--------------------------------------------------------------------------
  797.   def next_event_code
  798.     @list[@index + 1].code
  799.   end
  800. end
  801. #==============================================================================
  802. # ■ Game_Map
  803. #------------------------------------------------------------------------------
  804. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  805. # このクラスのインスタンスは $game_map で参照されます。
  806. #==============================================================================
  807.  
  808. class Game_Map
  809.   #--------------------------------------------------------------------------
  810.   # ○ マップチップを調べるか判定する
  811.   #--------------------------------------------------------------------------
  812.   def search_map_chip?
  813.     return $data_map_infos[@map_id].name =~ /\[サーチ\]/
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ○ 指定座標に存在するタイル扱いイベント(すり抜け以外)の配列取得
  817.   #--------------------------------------------------------------------------
  818.   def tile_events_xy(x, y)
  819.     @tile_events.select {|event| event.pos_nt?(x, y) }
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ○ タイル扱いイベントの配列をリフレッシュ
  823.   #--------------------------------------------------------------------------
  824.   def refresh_tile_events
  825.     @tile_events = @events.values.select {|event| event.tile? }
  826.   end
  827. end
  828. #==============================================================================
  829. # ■ Game_Character
  830. #------------------------------------------------------------------------------
  831. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  832. # クラスのスーパークラスとして使用されます。
  833. #==============================================================================
  834.  
  835. class Game_Character
  836.   #--------------------------------------------------------------------------
  837.   # ○ タイル判定
  838.   #--------------------------------------------------------------------------
  839.   def tile?
  840.     @tile_id > 0 && @priority_type == 0
  841.   end
  842. end
  843. #==============================================================================
  844. # ■ Scene_Title
  845. #------------------------------------------------------------------------------
  846. #  タイトル画面の処理を行うクラスです。
  847. #==============================================================================
  848.  
  849. class Scene_Title < Scene_Base
  850.   #--------------------------------------------------------------------------
  851.   # ☆ データベースのロード
  852.   #--------------------------------------------------------------------------
  853.   alias a1_common_st_load_database load_database
  854.   def load_database
  855.     a1_common_st_load_database
  856.     $data_map_infos = load_data("Data/MapInfos.rvdata")
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # ☆ 各種ゲームオブジェクトの作成
  860.   #--------------------------------------------------------------------------
  861.   alias a1_common_st_create_game_objects create_game_objects
  862.   def create_game_objects
  863.     $a1_common ||= A1_System::CommonModule.new
  864.     a1_common_st_create_game_objects
  865.   end
  866. end
  867. #==============================================================================
  868. # ◆ RGSS用処理
  869. #==============================================================================
  870. elsif rgss_version == 1
  871. end
  872. #==============================================================================
  873. # ■ Cache
  874. #------------------------------------------------------------------------------
  875. #  各種グラフィックを読み込み、Bitmap オブジェクトを作成、保持するモジュール
  876. # です。読み込みの高速化とメモリ節約のため、作成した Bitmap オブジェクトを内部
  877. # のハッシュに保存し、同じビットマップが再度要求されたときに既存のオブジェクト
  878. # を返すようになっています。
  879. #==============================================================================
  880.  
  881. module Cache
  882.   #--------------------------------------------------------------------------
  883.   # ○ 拡大縮小したビットマップのロード
  884.   #--------------------------------------------------------------------------
  885.   def self.load_resize_bitmap(load_path, key, resize = nil)
  886.     [url=home.php?mod=space&uid=341345]@Cache[/url] ||= {}
  887.     key = load_path if key == nil
  888.     return @cache[key] if include?(key)
  889.  
  890.     @cache[key] = Bitmap.new(load_path)
  891.     return @cache[key] if resize == nil
  892.     return @cache[key] if @cache[key].width == resize[0] and @cache[key].height == resize[1]
  893.  
  894.     info = calc_size(resize, key)
  895.     return resize_bitmap(@cache[key], info[0], info[1], key)
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ○ 拡大縮小した色相変化済みビットマップを作成/取得
  899.   #--------------------------------------------------------------------------
  900.   def self.load_resize_hue_changed_bitmap(load_path, path, hue, resize)
  901.     key = [path, hue]
  902.     return @cache[key] if include?(key)
  903.  
  904.     @cache[key] = load_resize_bitmap(load_path, path, resize).clone
  905.     @cache[key].hue_change(hue)
  906.     return @cache[key]
  907.   end
  908.   #--------------------------------------------------------------------------
  909.   # ○ リサイズするサイズを取得
  910.   #--------------------------------------------------------------------------
  911.   def self.calc_size(resize, key)
  912.     width  = resize[0]
  913.     width  = @cache[key].width * width.abs if width < 0
  914.     height = resize[1]
  915.     height = @cache[key].height * height.abs if height < 0
  916.     height = Integer(@cache[key].height * (width.to_f / @cache[key].width.to_f)) if height == 0
  917.     return [width, height]
  918.   end
  919.   #--------------------------------------------------------------------------
  920.   # ○ ビットマップの拡大縮小
  921.   #--------------------------------------------------------------------------
  922.   def self.resize_bitmap(bitmap, width, height, key)
  923.     resize = Bitmap.new(width, height)
  924.     resize.stretch_blt(resize.rect, bitmap, bitmap.rect)
  925.     @cache[key] = resize
  926.     return resize
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # ○ テキストビットマップの取得
  930.   #--------------------------------------------------------------------------
  931.   def self.text_picture(text, font)
  932.     load_text_bitmap(text, font)
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ○ フォントのキーを作成
  936.   #--------------------------------------------------------------------------
  937.   def self.make_font_key(text, font)
  938.     [text, font.name, font.size, font.bold, font.italic, font.outline, font.shadow, font.color.to_s, font.out_color.to_s]
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ○ テキストビットマップの作成
  942.   #--------------------------------------------------------------------------
  943.   def self.load_text_bitmap(text, font)
  944.     @cache ||= {}
  945.     key = make_font_key(text, font)
  946.     return @cache[key] if include?(key)
  947.  
  948.     # 計算用ダミービットマップ
  949.     bitmap = Cache.system("")
  950.     bitmap.font = font
  951.     tw = bitmap.text_size(text).width + 8
  952.  
  953.     # ビットマップ作成
  954.     bitmap = Bitmap.new(tw, bitmap.font.size + 4)
  955.     bitmap.font = font
  956.     bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)
  957.  
  958.     @cache[key] = bitmap
  959.     return @cache[key]
  960.   end
  961. end
  962. #==============================================================================
  963. # ■ Game_Interpreter
  964. #------------------------------------------------------------------------------
  965. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  966. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  967. #==============================================================================
  968.  
  969. class Game_Interpreter
  970.   #--------------------------------------------------------------------------
  971.   # ○ 注釈
  972.   #--------------------------------------------------------------------------
  973.   alias a1_common_command_108 command_108
  974.   def command_108
  975.     a1_common_command_108
  976.     proc_comment(@comments)
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ○ 注釈の処理
  980.   #--------------------------------------------------------------------------
  981.   def proc_comment(comments)
  982.     param = ""
  983.     comments.each {|comment| param += comment }
  984.     params = param.sub(/^(\S+)/, "")
  985.     command = $1
  986.     comment_parameters = $a1_common.split_array(params) if params
  987.     proc_comment_command(command, comment_parameters)
  988.   end
  989.   #--------------------------------------------------------------------------
  990.   # ○ 注釈の実行
  991.   #--------------------------------------------------------------------------
  992.   def proc_comment_command(command, params)
  993.     cmd_108 = $a1_common.cmd_108[command]
  994.     method(cmd_108).call(params) if cmd_108 != nil
  995.   end
  996.   #--------------------------------------------------------------------------
  997.   # ○ 前のイベントコマンドを取得
  998.   #--------------------------------------------------------------------------
  999.   def prev_event
  1000.     @list[@index - 1]
  1001.   end
  1002. end
  1003. #==============================================================================
  1004. # ■ Game_Map
  1005. #------------------------------------------------------------------------------
  1006. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  1007. # このクラスのインスタンスは $game_map で参照されます。
  1008. #==============================================================================
  1009.  
  1010. class Game_Map
  1011.   #--------------------------------------------------------------------------
  1012.   # ○ 全マップチップを調べる
  1013.   #--------------------------------------------------------------------------
  1014.   def map_chip_search
  1015.     tileset.init_ex_flags
  1016.     ([email]0...@map.data.xsize[/email]).each {|x| map_chip_search_y(x) }
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ x座標にあるy座標のマップチップを調べる
  1020.   #--------------------------------------------------------------------------
  1021.   def map_chip_search_y(x)
  1022.     ([email]0...@map.data.ysize[/email]).each {|y| map_pos_proc(x, y); map_chip_search_z(x, y) }
  1023.   end
  1024.   #--------------------------------------------------------------------------
  1025.   # ○ x,y座標にあるz座標のマップチップを調べる
  1026.   #--------------------------------------------------------------------------
  1027.   def map_chip_search_z(x, y)
  1028.     ([email]0...@map.data.zsize[/email]).each {|z| map_chip_proc(x, y, z) }
  1029.     tile_events_xy(x, y).collect {|ev| tile_event_proc(ev.tile_id) }
  1030.   end
  1031.   #--------------------------------------------------------------------------
  1032.   # ○ 座標に対して処理を行う
  1033.   #--------------------------------------------------------------------------
  1034.   def map_pos_proc(x, y)
  1035.   end
  1036.   #--------------------------------------------------------------------------
  1037.   # ○ マップチップに対して処理を行う
  1038.   #--------------------------------------------------------------------------
  1039.   def map_chip_proc(x, y, z)
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # ○ タイルのイベントに対して処理を行う
  1043.   #--------------------------------------------------------------------------
  1044.   def tile_event_proc(tile_id)
  1045.   end
  1046. end
  1047. #==============================================================================
  1048. # ■ Window_Base
  1049. #------------------------------------------------------------------------------
  1050. #  ゲーム中の全てのウィンドウのスーパークラスです。
  1051. #==============================================================================
  1052.  
  1053. class Window_Base < Window
  1054.   #--------------------------------------------------------------------------
  1055.   # ○ 入力を受け付けるか?
  1056.   #--------------------------------------------------------------------------
  1057.   def can_input?
  1058.     @can_input
  1059.   end
  1060.   #--------------------------------------------------------------------------
  1061.   # ○ 入力受け付け設定
  1062.   #--------------------------------------------------------------------------
  1063.   def can_input=(flag)
  1064.     @can_input = flag
  1065.   end
  1066. end
  1067. #==============================================================================
  1068. # ■ Bitmap
  1069. #==============================================================================
  1070.  
  1071. class Bitmap
  1072.   #--------------------------------------------------------------------------
  1073.   # ○ 文字縁取り描画
  1074.   #--------------------------------------------------------------------------
  1075.   def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
  1076.     shadow = self.font.shadow
  1077.     b_color = self.font.color.dup
  1078.     font.shadow = false
  1079.     font.color = color
  1080.     draw_text(x + 1, y, width, height, str, align)
  1081.     draw_text(x - 1, y, width, height, str, align)
  1082.     draw_text(x, y + 1, width, height, str, align)
  1083.     draw_text(x, y - 1, width, height, str, align)
  1084.     font.color = b_color
  1085.     draw_text(x, y, width, height, str, align)
  1086.     font.shadow = shadow
  1087.   end
  1088.   #--------------------------------------------------------------------------
  1089.   # ○ 文字縁取り描画の矩形を取得
  1090.   #--------------------------------------------------------------------------
  1091.   def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128))
  1092.     draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color)
  1093.   end
  1094. end






RUBY 代码复制
  1. # ===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    A1バトル共通スクリプト(RGSS3)
  4. #
  5. # バージョン   : 1.23 (2012/01/27)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  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.  
  35. class Window_Base < Window
  36.   #--------------------------------------------------------------------------
  37.   # ○ メソッドの定義
  38.   #--------------------------------------------------------------------------
  39.   def define_method(method, symbol)
  40.     @method ||= {}
  41.     @method[symbol] = method
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ○ メソッドのコール
  45.   #--------------------------------------------------------------------------
  46.   def call_method(symbol, *args)
  47.     @method ||= {}
  48.     @method[symbol].call(*args) if @method[symbol]
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ○ 顔グラフィックの描画(解放なし)
  52.   #--------------------------------------------------------------------------
  53.   def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)
  54.     bitmap = Cache.face(face_name)
  55.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
  56.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ○ 背景の描画
  60.   #--------------------------------------------------------------------------
  61.   def draw_background(rect)
  62.     temp_rect = rect.clone
  63.     temp_rect.width /= 2
  64.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
  65.     temp_rect.x = temp_rect.width
  66.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ○ 背景色 1 の取得
  70.   #--------------------------------------------------------------------------
  71.   def back_color1
  72.     Color.new(0, 0, 0, 192)
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ○ 背景色 2 の取得
  76.   #--------------------------------------------------------------------------
  77.   def back_color2
  78.     Color.new(0, 0, 0, 0)
  79.   end
  80. end
  81. #==============================================================================
  82. # ■ Window_Help
  83. #------------------------------------------------------------------------------
  84. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  85. #==============================================================================
  86.  
  87. class Window_Help < Window_Base
  88.   #--------------------------------------------------------------------------
  89.   # ○ センターにテキストを描画
  90.   #--------------------------------------------------------------------------
  91.   def draw_center_text(text)
  92.     contents.clear
  93.     draw_text(0, 0, contents.width, line_height, text, 1)
  94.   end
  95. end
  96. #==============================================================================
  97. # ■ Window_BattleActor
  98. #------------------------------------------------------------------------------
  99. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  100. #==============================================================================
  101.  
  102. class Window_BattleActor < Window_BattleStatus
  103.   #--------------------------------------------------------------------------
  104.   # ★ ウィンドウの表示
  105.   #--------------------------------------------------------------------------
  106.   def show
  107.     setup_remain if @info_viewport
  108.     self.visible = true
  109.     refresh
  110.     open
  111.     self
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ★ ウィンドウの非表示
  115.   #--------------------------------------------------------------------------
  116.   def hide
  117.     close
  118.     @info_viewport.rect.width = Graphics.width if @info_viewport
  119.     call_method(:select_actor_end)
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ○ フレーム更新
  123.   #--------------------------------------------------------------------------
  124.   def update
  125.     return update_basic unless self.visible
  126.     super
  127.     self.visible = false if self.openness == 0
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ○ フレーム更新(基本)
  131.   #--------------------------------------------------------------------------
  132.   def update_basic
  133.     process_cursor_move
  134.     process_handling
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ 項目の選択
  138.   #--------------------------------------------------------------------------
  139.   def select(index)
  140.     super
  141.     call_method(:select_actor, index)
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ○ ウィンドウの調整
  145.   #--------------------------------------------------------------------------
  146.   def setup_remain
  147.     width_remain = Graphics.width - width
  148.     self.x = width_remain
  149.     @info_viewport.rect.width = width_remain
  150.     select(0)
  151.   end
  152. end
  153. #==============================================================================
  154. # ■ Window_BattleEnemy
  155. #------------------------------------------------------------------------------
  156. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  157. #==============================================================================
  158.  
  159. class Window_BattleEnemy < Window_Selectable
  160.   #--------------------------------------------------------------------------
  161.   # ★ ウィンドウの表示
  162.   #--------------------------------------------------------------------------
  163.   def show
  164.     setup_remain if @info_viewport
  165.     self.visible = true
  166.     open
  167.     self
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ★ ウィンドウの非表示
  171.   #--------------------------------------------------------------------------
  172.   def hide
  173.     close
  174.     @info_viewport.rect.width = Graphics.width if @info_viewport
  175.     call_method(:select_enemy_end)
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ○ フレーム更新
  179.   #--------------------------------------------------------------------------
  180.   def update
  181.     return update_basic unless self.visible
  182.     super
  183.     self.visible = false if self.openness == 0
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ○ フレーム更新(基本)
  187.   #--------------------------------------------------------------------------
  188.   def update_basic
  189.     process_cursor_move
  190.     process_handling
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ○ 項目の選択
  194.   #--------------------------------------------------------------------------
  195.   def select(index)
  196.     super
  197.     call_method(:select_enemy, index)
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ○ ウィンドウの調整
  201.   #--------------------------------------------------------------------------
  202.   def setup_remain
  203.     width_remain = Graphics.width - width
  204.     self.x = width_remain
  205.     @info_viewport.rect.width = width_remain
  206.     select(0)
  207.   end
  208. end
  209. #==============================================================================
  210. # ■ Window_BattleSkill
  211. #------------------------------------------------------------------------------
  212. #  バトル画面で、使用するスキルを選択するウィンドウです。
  213. #==============================================================================
  214.  
  215. class Window_BattleSkill < Window_SkillList
  216.   #--------------------------------------------------------------------------
  217.   # ☆ オブジェクト初期化
  218.   #     info_viewport : 情報表示用ビューポート
  219.   #--------------------------------------------------------------------------
  220.   alias a1_psw_wbs_initialize initialize
  221.   def initialize(help_window, info_viewport)
  222.     a1_psw_wbs_initialize(help_window, info_viewport)
  223.     self.openness = 0
  224.     self.visible  = true
  225.     @help_window.openness = 0
  226.     @help_window.visible = true
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ○ 高さを変える
  230.   #--------------------------------------------------------------------------
  231.   def resize_height(base_y)
  232.     self.height = base_y - self.y
  233.     create_contents
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ★ ウィンドウの表示
  237.   #--------------------------------------------------------------------------
  238.   def show
  239.     self.visible = true
  240.     @help_window.visible = true
  241.     select_last
  242.     open
  243.     @help_window.open
  244.     self
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ★ ウィンドウの非表示
  248.   #--------------------------------------------------------------------------
  249.   def hide
  250.     close
  251.     @help_window.close
  252.     @info_viewport.rect.width = Graphics.width if @info_viewport
  253.     call_method(:skill_item_window_hide)
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ オープン
  257.   #--------------------------------------------------------------------------
  258.   def open
  259.     self.visible = true
  260.     call_method(:skill_item_window_show)
  261.     super
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ○ アクティブ化
  265.   #--------------------------------------------------------------------------
  266.   def activate
  267.     open
  268.     @help_window.open
  269.     super
  270.   end
  271. end
  272. #==============================================================================
  273. # ■ Window_BattleItem
  274. #------------------------------------------------------------------------------
  275. #  バトル画面で、使用するアイテムを選択するウィンドウです。
  276. #==============================================================================
  277.  
  278. class Window_BattleItem < Window_ItemList
  279.   #--------------------------------------------------------------------------
  280.   # ☆ オブジェクト初期化
  281.   #     info_viewport : 情報表示用ビューポート
  282.   #--------------------------------------------------------------------------
  283.   alias a1_battle_common_wbi_initialize initialize
  284.   def initialize(help_window, info_viewport)
  285.     a1_battle_common_wbi_initialize(help_window, info_viewport)
  286.     self.openness = 0
  287.     self.visible  = true
  288.     @help_window.openness = 0
  289.     @help_window.visible = true
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ○ 高さを変える
  293.   #--------------------------------------------------------------------------
  294.   def resize_height(base_y)
  295.     self.height = base_y - self.y
  296.     create_contents
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ★ ウィンドウの表示
  300.   #--------------------------------------------------------------------------
  301.   def show
  302.     self.visible = true
  303.     @help_window.visible = true
  304.     select_last
  305.     open
  306.     @help_window.open
  307.     self
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ★ ウィンドウの非表示
  311.   #--------------------------------------------------------------------------
  312.   def hide
  313.     close
  314.     @help_window.close
  315.     call_method(:skill_item_window_hide)
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ○ オープン
  319.   #--------------------------------------------------------------------------
  320.   def open
  321.     self.visible = true
  322.     call_method(:skill_item_window_show)
  323.     super
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ○ アクティブ化
  327.   #--------------------------------------------------------------------------
  328.   def activate
  329.     open
  330.     @help_window.open
  331.     super
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ フレーム更新
  335.   #--------------------------------------------------------------------------
  336.   def update
  337.     return unless self.visible
  338.     super
  339.     self.visible = false if self.openness == 0
  340.   end
  341. end
  342. #==============================================================================
  343. # ■ Window_ActorCommand
  344. #------------------------------------------------------------------------------
  345. #  バトル画面で、アクターの行動を選択するウィンドウです。
  346. #==============================================================================
  347.  
  348. class Window_ActorCommand < Window_Command
  349.   #--------------------------------------------------------------------------
  350.   # ☆ セットアップ
  351.   #--------------------------------------------------------------------------
  352.   alias a1_battle_common_wac_setup setup
  353.   def setup(actor)
  354.     call_method(:actor_command_setup, actor)
  355.     a1_battle_common_wac_setup(actor)
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ○ ウィンドウのアクティブ化
  359.   #--------------------------------------------------------------------------
  360.   def activate
  361.     open
  362.     super
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ○ オープン
  366.   #--------------------------------------------------------------------------
  367.   def open
  368.     call_method(:actor_command_open)
  369.     super
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # ○ クローズ
  373.   #--------------------------------------------------------------------------
  374.   def close
  375.     call_method(:actor_command_close)
  376.     super
  377.   end
  378. end
  379. #==============================================================================
  380. # ■ Window_BattleStatus
  381. #------------------------------------------------------------------------------
  382. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
  383. #==============================================================================
  384.  
  385. class Window_BattleStatus < Window_Selectable
  386.   #--------------------------------------------------------------------------
  387.   # ☆ リフレッシュ
  388.   #--------------------------------------------------------------------------
  389.   alias a1_battle_common_wbs_refresh refresh
  390.   def refresh
  391.     call_method(:refresh_statsu_window)
  392.     return unless self.visible
  393.     a1_battle_common_wbs_refresh
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ○ ウィンドウを開く
  397.   #--------------------------------------------------------------------------
  398.   def open
  399.     super
  400.     call_method(:open_status_window)
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ○ ウィンドウを閉じる
  404.   #--------------------------------------------------------------------------
  405.   def close
  406.     super
  407.     call_method(:close_status_window)
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ○ 項目の選択
  411.   #--------------------------------------------------------------------------
  412.   def select(index)
  413.     super
  414.     call_method(:select_status_window, index)
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ○ フレーム更新
  418.   #--------------------------------------------------------------------------
  419.   def update
  420.     call_method(:update_status_window)
  421.     return unless self.visible
  422.     super
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # ○ 解放
  426.   #--------------------------------------------------------------------------
  427.   def dispose
  428.     super
  429.     call_method(:dispose_status_window)
  430.   end
  431. end
  432. #==============================================================================
  433. # ■ Window_PersonalStatus
  434. #==============================================================================
  435.  
  436. class Window_PersonalStatus < Window_Base
  437.   #--------------------------------------------------------------------------
  438.   # ○ オブジェクト初期化
  439.   #--------------------------------------------------------------------------
  440.   def initialize(x, y, opacity = 0)
  441.     super(x, y, Graphics.width / 2, 120)
  442.     self.opacity  = opacity
  443.     self.openness = 0
  444.     @actor = nil
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # ○ アクターの設定
  448.   #--------------------------------------------------------------------------
  449.   def actor=(actor)
  450.     @actor = actor
  451.     refresh
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ○ リフレッシュ
  455.   #--------------------------------------------------------------------------
  456.   def refresh
  457.     contents.clear
  458.     draw_face(@actor.face_name, @actor.face_index, 0, 0)
  459.     draw_text(116, line_height * 0, contents.width, line_height, @actor.name)
  460.     draw_actor_level(@actor, 116, 0 + line_height * 1)
  461.     draw_actor_icons(@actor, 180, 0 + line_height * 1)
  462.     draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)
  463.     draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)
  464.     draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ○ フレーム更新
  468.   #--------------------------------------------------------------------------
  469.   def update
  470.     return unless self.visible
  471.     super
  472.     self.visible = false if self.openness == 0
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ○ オープン
  476.   #--------------------------------------------------------------------------
  477.   def open
  478.     self.visible = true
  479.     super
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # ○ 顔グラフィックの描画
  483.   #--------------------------------------------------------------------------
  484.   def draw_face(face_name, face_index, x, y, enabled = true)
  485.     draw_face_no_dispose(face_name, face_index, x, y, enabled)
  486.   end
  487. end
  488. #==============================================================================
  489. # ■ RPG::Enemy
  490. #==============================================================================
  491.  
  492. class RPG::Enemy < RPG::BaseItem
  493.   #--------------------------------------------------------------------------
  494.   # ○ 初期装備
  495.   #--------------------------------------------------------------------------
  496.   def equips
  497.     @equips ||= [0,0,0,0,0]
  498.     @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0)
  499.     return @equips
  500.   end
  501. end
  502. #==============================================================================
  503. # ■ Game_Enemy
  504. #------------------------------------------------------------------------------
  505. #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の
  506. # 内部で使用されます。
  507. #==============================================================================
  508.  
  509. class Game_Enemy < Game_Battler
  510.   #--------------------------------------------------------------------------
  511.   # ☆ オブジェクト初期化
  512.   #--------------------------------------------------------------------------
  513.   alias a1_battle_common_ge_initialize initialize
  514.   def initialize(index, enemy_id)
  515.     @equips = []
  516.     a1_battle_common_ge_initialize(index, enemy_id)
  517.     init_equips(enemy.equips)
  518.   end
  519. end
  520. #==============================================================================
  521. # ■ Game_Actor
  522. #------------------------------------------------------------------------------
  523. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  524. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  525. #==============================================================================
  526.  
  527. class Game_Actor < Game_Battler
  528.   #--------------------------------------------------------------------------
  529.   # ★ 装備品の初期化
  530.   #     equips : 初期装備の配列
  531.   #--------------------------------------------------------------------------
  532.   def init_equips(equips)
  533.     super
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ★ 装備タイプからスロット ID に変換(空きを優先)
  537.   #--------------------------------------------------------------------------
  538.   def empty_slot(etype_id)
  539.     super
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # ★ 装備タイプからスロット ID のリストに変換
  543.   #--------------------------------------------------------------------------
  544.   def slot_list(etype_id)
  545.     super
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ★ エディタで設定されたインデックスを装備タイプ ID に変換
  549.   #--------------------------------------------------------------------------
  550.   def index_to_etype_id(index)
  551.     super
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # ★ 装備スロットの配列を取得
  555.   #--------------------------------------------------------------------------
  556.   def equip_slots
  557.     super
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # ★ 装備品オブジェクトの配列取得
  561.   #--------------------------------------------------------------------------
  562.   def equips
  563.     super
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ★ 武器オブジェクトの配列取得
  567.   #--------------------------------------------------------------------------
  568.   def weapons
  569.     super
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ★ 通常能力値の加算値取得
  573.   #--------------------------------------------------------------------------
  574.   def param_plus(param_id)
  575.     super
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ☆ 通常攻撃 アニメーション ID の取得
  579.   #--------------------------------------------------------------------------
  580.   alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1
  581.   def atk_animation_id1
  582.     return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)
  583.     @current_weapon.animation_id
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  587.   #--------------------------------------------------------------------------
  588.   alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2
  589.   def atk_animation_id2
  590.     return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)
  591.     @current_weapon.animation_id
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ○ 装備タイプ名を取得
  595.   #--------------------------------------------------------------------------
  596.   def e_type_name(item)
  597.     return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)
  598.     return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)
  599.   end
  600. end
  601. #==============================================================================
  602. # ■ Game_BattlerBase
  603. #------------------------------------------------------------------------------
  604. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
  605. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
  606. #==============================================================================
  607.  
  608. class Game_BattlerBase
  609.   #--------------------------------------------------------------------------
  610.   # ○ 二刀流?
  611.   #--------------------------------------------------------------------------
  612.   def two_sword_style?
  613.     weapons[0] && weapons[1]
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ○ バトラーオブジェクト取得
  617.   #--------------------------------------------------------------------------
  618.   def battler
  619.     return actor if self.actor?
  620.     return enemy
  621.   end
  622. end
  623. #==============================================================================
  624. # ■ Game_Battler
  625. #------------------------------------------------------------------------------
  626. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  627. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  628. #==============================================================================
  629.  
  630. class Game_Battler < Game_BattlerBase
  631.   #--------------------------------------------------------------------------
  632.   # ○ 公開インスタンス変数
  633.   #--------------------------------------------------------------------------
  634.   attr_accessor :current_weapon
  635.   attr_accessor :current_main
  636.   #--------------------------------------------------------------------------
  637.   # ○ 装備品の初期化
  638.   #     equips : 初期装備の配列
  639.   #--------------------------------------------------------------------------
  640.   def init_equips(equips)
  641.     @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
  642.     equips.each_with_index do |item_id, i|
  643.       etype_id = index_to_etype_id(i)
  644.       slot_id = empty_slot(etype_id)
  645.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  646.     end
  647.     refresh
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ○ 装備タイプからスロット ID に変換(空きを優先)
  651.   #--------------------------------------------------------------------------
  652.   def empty_slot(etype_id)
  653.     list = slot_list(etype_id)
  654.     list.find {|i| @equips[i].is_nil? } || list[0]
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ○ 装備タイプからスロット ID のリストに変換
  658.   #--------------------------------------------------------------------------
  659.   def slot_list(etype_id)
  660.     result = []
  661.     equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
  662.     result
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ○ エディタで設定されたインデックスを装備タイプ ID に変換
  666.   #--------------------------------------------------------------------------
  667.   def index_to_etype_id(index)
  668.     index == 1 && dual_wield? ? 0 : index
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ○ 装備スロットの配列を取得
  672.   #--------------------------------------------------------------------------
  673.   def equip_slots
  674.     return [0,0,2,3,4] if dual_wield?       # 二刀流
  675.     return [0,1,2,3,4]                      # 通常
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ○ 装備品オブジェクトの配列取得
  679.   #--------------------------------------------------------------------------
  680.   def equips
  681.     @equips.collect {|item| item.object }
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ○ 武器オブジェクトの配列取得
  685.   #--------------------------------------------------------------------------
  686.   def weapons
  687.     @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ○ 通常能力値の加算値取得
  691.   #--------------------------------------------------------------------------
  692.   def param_plus(param_id)
  693.     equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # ○ アイテムにかける追加要素
  697.   #--------------------------------------------------------------------------
  698.   def ex_item_params(item, param_id)
  699.     return 0
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ○ スキルを取得
  703.   #--------------------------------------------------------------------------
  704.   def skill(skill_id)
  705.     $data_skills[skill_id]
  706.   end
  707. end
  708. #==============================================================================
  709. # ■ Game_Party
  710. #------------------------------------------------------------------------------
  711. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  712. # スのインスタンスは $game_party で参照されます。
  713. #==============================================================================
  714.  
  715. class Game_Party < Game_Unit
  716.   #--------------------------------------------------------------------------
  717.   # ☆ アクターを加える
  718.   #--------------------------------------------------------------------------
  719.   alias a1_battle_common_gp_add_actor add_actor
  720.   def add_actor(actor_id)
  721.     return a1_battle_common_gp_add_actor(actor_id) unless in_battle
  722.     return if @actors.include?(actor_id)
  723.     prev_add_actor(battle_members)
  724.     insert_actor(actor_id)
  725.     post_add_actor($game_actors[actor_id])
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # ○ アクターを加える
  729.   #--------------------------------------------------------------------------
  730.   def insert_actor(actor_id)
  731.     @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size
  732.     @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)
  733.     $game_player.refresh
  734.     $game_map.need_refresh = true
  735.     return unless @remove_member_index
  736.     @remove_member_index.delete_at(0)
  737.     @remove_member_index = nil if @remove_member_index.empty?
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ○ アクターを加えたIndexを取得
  741.   #--------------------------------------------------------------------------
  742.   def new_index
  743.     @new_index
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # ○ アクターを加える前処理
  747.   #--------------------------------------------------------------------------
  748.   def prev_add_actor(members)
  749.     BattleManager.call_method(:prev_add_battler, members)
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ○ アクターを加えた後処理
  753.   #--------------------------------------------------------------------------
  754.   def post_add_actor(member)
  755.     BattleManager.call_method(:post_add_battler, member)
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ☆ アクターを外す
  759.   #--------------------------------------------------------------------------
  760.   alias a1_battle_common_gp_remove_actor remove_actor
  761.   def remove_actor(actor_id)
  762.     prev_remove_actor($game_actors[actor_id]) if in_battle
  763.     a1_battle_common_gp_remove_actor(actor_id)
  764.     post_remove_actor if in_battle
  765.   end
  766.   #--------------------------------------------------------------------------
  767.   # ○ アクターを外す前処理
  768.   #--------------------------------------------------------------------------
  769.   def prev_remove_actor(member)
  770.     @remove_member_index ||= []
  771.     @remove_member_index.push(member.index)
  772.     BattleManager.call_method(:prev_remove_battler, member)
  773.   end
  774.   #--------------------------------------------------------------------------
  775.   # ○ アクターを外した後処理
  776.   #--------------------------------------------------------------------------
  777.   def post_remove_actor
  778.     BattleManager.call_method(:post_remove_battler)
  779.   end
  780. end
  781. #==============================================================================
  782. # ■ BattleManager
  783. #------------------------------------------------------------------------------
  784. #  戦闘の進行を管理するモジュールです。
  785. #==============================================================================
  786.  
  787. module BattleManager
  788.   #--------------------------------------------------------------------------
  789.   # ○ エイリアス用特異メソッド
  790.   #--------------------------------------------------------------------------
  791.   class << self
  792.     alias :a1_battle_common_bm_turn_end :turn_end
  793.     alias :a1_battle_common_bm_turn_start :turn_start
  794.     alias :a1_battle_common_bm_battle_end :battle_end
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ☆ ターン開始
  798.   #--------------------------------------------------------------------------
  799.   def self.turn_start
  800.     @turn_end_wait = 0
  801.     a1_battle_common_bm_turn_start
  802.   end
  803.   #--------------------------------------------------------------------------
  804.   # ☆ ターン終了
  805.   #--------------------------------------------------------------------------
  806.   def self.turn_end
  807.     call_method(:wait, @turn_end_wait) if @turn_end_wait > 0
  808.     @turn_end_wait = 0
  809.     a1_battle_common_bm_turn_end
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # ○ メソッドの設定
  813.   #--------------------------------------------------------------------------
  814.   def self.define_method(method, symbol)
  815.     @method ||= {}
  816.     @method[symbol] = method
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # ○ メソッドのコール
  820.   #--------------------------------------------------------------------------
  821.   def self.call_method(symbol, *args)
  822.     @method[symbol].call(*args) if @method[symbol]
  823.   end
  824.   #--------------------------------------------------------------------------
  825.   # ○ ターン終了後ウェイト設定
  826.   #--------------------------------------------------------------------------
  827.   def self.turn_end_wait=(flame)
  828.     @turn_end_wait = flame if @turn_end_wait < flame || flame == 0
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ☆ 戦闘終了
  832.   #     result : 結果(0:勝利 1:逃走 2:敗北)
  833.   #--------------------------------------------------------------------------
  834.   def self.battle_end(result)
  835.     call_method(:battle_end, result)
  836.     a1_battle_common_bm_battle_end(result)
  837.   end
  838. end
  839. #==============================================================================
  840. # ■ Game_Action
  841. #------------------------------------------------------------------------------
  842. #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
  843. # ます。
  844. #==============================================================================
  845.  
  846. class Game_Action
  847.   #--------------------------------------------------------------------------
  848.   # ☆ ターゲットの配列作成
  849.   #--------------------------------------------------------------------------
  850.   alias a1_battle_common_gac_make_targets make_targets
  851.   def make_targets
  852.     @targets ||= pre_make_targets
  853.     return @targets
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ○ ターゲットの配列先行作成
  857.   #--------------------------------------------------------------------------
  858.   def pre_make_targets
  859.     @targets = a1_battle_common_gac_make_targets
  860.   end
  861.   #--------------------------------------------------------------------------
  862.   # ○ ターゲットの配列を取得
  863.   #--------------------------------------------------------------------------
  864.   def targets
  865.     @targets.compact
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ○ ターゲットの配列をクリア
  869.   #--------------------------------------------------------------------------
  870.   def clear_targets
  871.     @targets = nil
  872.   end
  873. end
  874. #==============================================================================
  875. # ■ Scene_Battle
  876. #------------------------------------------------------------------------------
  877. #  バトル画面の処理を行うクラスです。
  878. #==============================================================================
  879.  
  880. class Scene_Battle < Scene_Base
  881.   #--------------------------------------------------------------------------
  882.   # ☆ 開始処理
  883.   #--------------------------------------------------------------------------
  884.   alias a1_battle_common_sb_start start
  885.   def start
  886.     a1_battle_common_sb_start
  887.     define_battle_manager_method
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ○ バトルマネージャメソッドの定義
  891.   #--------------------------------------------------------------------------
  892.   def define_battle_manager_method
  893.     BattleManager.define_method(method(:wait), :wait)
  894.     BattleManager.define_method(method(:post_add_battler),       :post_add_battler)
  895.     BattleManager.define_method(method(:post_remove_battler),    :post_remove_battler)
  896.     BattleManager.define_method(method(:prev_remove_battler),    :prev_remove_battler)
  897.     BattleManager.define_method(method(:prev_add_battler),       :prev_add_battler)
  898.     BattleManager.define_method(method(:process_victory),        :process_victory)
  899.     BattleManager.define_method(method(:battle_end),             :battle_end)
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ☆ ステータスウィンドウの作成
  903.   #--------------------------------------------------------------------------
  904.   alias a1_battle_common_sb_create_status_window create_status_window
  905.   def create_status_window
  906.     a1_battle_common_sb_create_status_window
  907.     post_create_status_window
  908.     define_status_window_method
  909.   end
  910.   #--------------------------------------------------------------------------
  911.   # ○ ステータスウィンドウ作成の後処理
  912.   #--------------------------------------------------------------------------
  913.   def post_create_status_window
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ○ ステータスウィンドウメソッドの定義
  917.   #--------------------------------------------------------------------------
  918.   def define_status_window_method
  919.     @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)
  920.     @status_window.define_method(method(:close_status_window),   :close_status_window)
  921.     @status_window.define_method(method(:open_status_window),    :open_status_window)
  922.     @status_window.define_method(method(:select_status_window),  :select_status_window)
  923.     @status_window.define_method(method(:update_status_window),  :update_status_window)
  924.     @status_window.define_method(method(:dispose_status_window), :dispose_status_window)
  925.   end
  926.   #--------------------------------------------------------------------------
  927.   # ○ ステータスウィンドウがリフレッシュされた時の処理
  928.   #--------------------------------------------------------------------------
  929.   def refresh_statsu_window
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # ○ ステータスウィンドウがクローズされた時の処理
  933.   #--------------------------------------------------------------------------
  934.   def close_status_window
  935.   end
  936.   #--------------------------------------------------------------------------
  937.   # ○ ステータスウィンドウがオープンされた時の処理
  938.   #--------------------------------------------------------------------------
  939.   def open_status_window
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ○ ステータスウィンドウがセレクトされた時の処理
  943.   #--------------------------------------------------------------------------
  944.   def select_status_window(index)
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ○ ステータスウィンドウが更新された時の処理
  948.   #--------------------------------------------------------------------------
  949.   def update_status_window
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ○ ステータスウィンドウが解放された時の処理
  953.   #--------------------------------------------------------------------------
  954.   def dispose_status_window
  955.   end
  956.   #--------------------------------------------------------------------------
  957.   # ☆ 情報表示ビューポートの作成
  958.   #--------------------------------------------------------------------------
  959.   alias a1_battle_common_sb_create_info_viewport create_info_viewport
  960.   def create_info_viewport
  961.     a1_battle_common_sb_create_info_viewport
  962.     post_create_info_viewport
  963.   end
  964.   #--------------------------------------------------------------------------
  965.   # ○ 情報表示ビューポート作成の後処理
  966.   #--------------------------------------------------------------------------
  967.   def post_create_info_viewport
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ☆ スキルウィンドウの作成
  971.   #--------------------------------------------------------------------------
  972.   alias a1_battle_common_sb_create_skill_window create_skill_window
  973.   def create_skill_window
  974.     a1_battle_common_sb_create_skill_window
  975.     post_create_skill_window
  976.     define_skill_window_method
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ○ スキルウィンドウ作成の後処理
  980.   #--------------------------------------------------------------------------
  981.   def post_create_skill_window
  982.   end
  983.   #--------------------------------------------------------------------------
  984.   # ○ スキルウィンドウメソッドの定義
  985.   #--------------------------------------------------------------------------
  986.   def define_skill_window_method
  987.     @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  988.     @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # ☆ アイテムウィンドウの作成
  992.   #--------------------------------------------------------------------------
  993.   alias a1_battle_common_sb_create_item_window create_item_window
  994.   def create_item_window
  995.     a1_battle_common_sb_create_item_window
  996.     post_create_item_window
  997.     define_item_window_method
  998.   end
  999.   #--------------------------------------------------------------------------
  1000.   # ○ アイテムウィンドウ作成の後処理
  1001.   #--------------------------------------------------------------------------
  1002.   def post_create_item_window
  1003.   end
  1004.   #--------------------------------------------------------------------------
  1005.   # ○ アイテムウィンドウメソッドの定義
  1006.   #--------------------------------------------------------------------------
  1007.   def define_item_window_method
  1008.     @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
  1009.     @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
  1010.   end
  1011.   #--------------------------------------------------------------------------
  1012.   # ○ スキル/アイテムウィンドウが表示された時の処理
  1013.   #--------------------------------------------------------------------------
  1014.   def skill_item_window_show
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ○ スキル/アイテムウィンドウが非表示になった時の処理
  1018.   #--------------------------------------------------------------------------
  1019.   def skill_item_window_hide
  1020.   end
  1021.   #--------------------------------------------------------------------------
  1022.   # ☆ パーティコマンドウィンドウの作成
  1023.   #--------------------------------------------------------------------------
  1024.   alias a1_battle_common_sb_create_party_command_window create_party_command_window
  1025.   def create_party_command_window
  1026.     a1_battle_common_sb_create_party_command_window
  1027.     post_create_party_command_window
  1028.     define_party_command_window_method
  1029.     define_party_command_window_handle
  1030.   end
  1031.   #--------------------------------------------------------------------------
  1032.   # ○ パーティコマンドウィンドウ作成の後処理
  1033.   #--------------------------------------------------------------------------
  1034.   def post_create_party_command_window
  1035.   end
  1036.   #--------------------------------------------------------------------------
  1037.   # ○ パーティコマンドウィンドウメソッドの定義
  1038.   #--------------------------------------------------------------------------
  1039.   def define_party_command_window_method
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # ○ パーティコマンドウィンドウハンドルの定義
  1043.   #--------------------------------------------------------------------------
  1044.   def define_party_command_window_handle
  1045.   end
  1046.   #--------------------------------------------------------------------------
  1047.   # ☆ アクターウィンドウの作成
  1048.   #--------------------------------------------------------------------------
  1049.   alias a1_battle_common_sb_create_actor_window create_actor_window
  1050.   def create_actor_window
  1051.     a1_battle_common_sb_create_actor_window
  1052.     post_create_actor_window
  1053.     define_actor_window_method
  1054.   end
  1055.   #--------------------------------------------------------------------------
  1056.   # ○ アクターウィンドウ作成の後処理
  1057.   #--------------------------------------------------------------------------
  1058.   def post_create_actor_window
  1059.   end
  1060.   #--------------------------------------------------------------------------
  1061.   # ○ アクターウィンドウメソッドの定義
  1062.   #--------------------------------------------------------------------------
  1063.   def define_actor_window_method
  1064.     @actor_window.define_method(method(:select_actor),     :select_actor)
  1065.     @actor_window.define_method(method(:select_actor_end), :select_actor_end)
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ○ アクターウィンドウをセレクトした時の処理
  1069.   #--------------------------------------------------------------------------
  1070.   def select_actor(index)
  1071.   end
  1072.   #--------------------------------------------------------------------------
  1073.   # ○ アクターウィンドウをセレクト終了した時の処理
  1074.   #--------------------------------------------------------------------------
  1075.   def select_actor_end
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ☆ 敵キャラウィンドウの作成
  1079.   #--------------------------------------------------------------------------
  1080.   alias a1_battle_common_sb_create_enemy_window create_enemy_window
  1081.   def create_enemy_window
  1082.     a1_battle_common_sb_create_enemy_window
  1083.     post_create_enemy_window
  1084.     define_enemy_window_method
  1085.   end
  1086.   #--------------------------------------------------------------------------
  1087.   # ○ 敵キャラウィンドウ作成の後処理
  1088.   #--------------------------------------------------------------------------
  1089.   def post_create_enemy_window
  1090.   end
  1091.   #--------------------------------------------------------------------------
  1092.   # ○ 敵キャラウィンドウメソッドの定義
  1093.   #--------------------------------------------------------------------------
  1094.   def define_enemy_window_method
  1095.     @enemy_window.define_method(method(:select_enemy),     :select_enemy)
  1096.     @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)
  1097.   end
  1098.   #--------------------------------------------------------------------------
  1099.   # ○ 敵キャラウィンドウをセレクトした時の処理
  1100.   #--------------------------------------------------------------------------
  1101.   def select_enemy(index)
  1102.   end
  1103.   #--------------------------------------------------------------------------
  1104.   # ○ 敵キャラウィンドウをセレクト終了した時の処理
  1105.   #--------------------------------------------------------------------------
  1106.   def select_enemy_end
  1107.   end
  1108.   #--------------------------------------------------------------------------
  1109.   # ☆ アクターコマンドウィンドウの作成
  1110.   #--------------------------------------------------------------------------
  1111.   alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window
  1112.   def create_actor_command_window
  1113.     a1_battle_common_sb_start_create_actor_command_window
  1114.     post_create_actor_command_window
  1115.     define_actor_command_handle
  1116.     define_actor_command_window
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ○ アクターコマンドウィンドウ作成の後処理
  1120.   #--------------------------------------------------------------------------
  1121.   def post_create_actor_command_window
  1122.   end
  1123.   #--------------------------------------------------------------------------
  1124.   # ○ アクターコマンドウィンドウメソッドの定義
  1125.   #--------------------------------------------------------------------------
  1126.   def define_actor_command_window
  1127.     @actor_command_window.define_method(method(:actor_command_open),  :actor_command_open)
  1128.     @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)
  1129.     @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)
  1130.   end
  1131.   #--------------------------------------------------------------------------
  1132.   # ○ アクターコマンドウィンドウハンドルの定義
  1133.   #--------------------------------------------------------------------------
  1134.   def define_actor_command_handle
  1135.   end
  1136.   #--------------------------------------------------------------------------
  1137.   # ○ アクターコマンドウィンドウがオープンした時の処理
  1138.   #--------------------------------------------------------------------------
  1139.   def actor_command_open
  1140.   end
  1141.   #--------------------------------------------------------------------------
  1142.   # ○ アクターコマンドウィンドウがクローズした時の処理
  1143.   #--------------------------------------------------------------------------
  1144.   def actor_command_close
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ○ アクターコマンドウィンドウのセットアップ時の処理
  1148.   #--------------------------------------------------------------------------
  1149.   def actor_command_setup(actor)
  1150.   end
  1151.   #--------------------------------------------------------------------------
  1152.   # ☆ パーティコマンド選択の開始
  1153.   #--------------------------------------------------------------------------
  1154.   alias a1_battle_common_sb_start_party_command_selection start_party_command_selection
  1155.   def start_party_command_selection
  1156.     prev_start_party_command_selection
  1157.     a1_battle_common_sb_start_party_command_selection
  1158.     post_start_party_command_selection
  1159.   end
  1160.   #--------------------------------------------------------------------------
  1161.   # ○ パーティコマンド選択の開始の前処理
  1162.   #--------------------------------------------------------------------------
  1163.   def prev_start_party_command_selection
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # ○ パーティコマンド選択の開始の後処理
  1167.   #--------------------------------------------------------------------------
  1168.   def post_start_party_command_selection
  1169.   end
  1170.   #--------------------------------------------------------------------------
  1171.   # ☆ 次のコマンド入力へ
  1172.   #--------------------------------------------------------------------------
  1173.   alias a1_battle_common_sb_next_command next_command
  1174.   def next_command
  1175.     prev_next_command
  1176.     a1_battle_common_sb_next_command
  1177.     post_next_command
  1178.   end
  1179.   #--------------------------------------------------------------------------
  1180.   # ○ 次のコマンド入力への前処理
  1181.   #--------------------------------------------------------------------------
  1182.   def prev_next_command
  1183.   end
  1184.   #--------------------------------------------------------------------------
  1185.   # ○ 次のコマンド入力への後処理
  1186.   #--------------------------------------------------------------------------
  1187.   def post_next_command
  1188.   end
  1189.   #--------------------------------------------------------------------------
  1190.   # ☆ 前のコマンド入力へ
  1191.   #--------------------------------------------------------------------------
  1192.   alias a1_battle_common_sb_prior_command prior_command
  1193.   def prior_command
  1194.     prev_prior_command
  1195.     a1_battle_common_sb_prior_command
  1196.     post_prior_command
  1197.   end
  1198.   #--------------------------------------------------------------------------
  1199.   # ○ 前のコマンド入力への前処理
  1200.   #--------------------------------------------------------------------------
  1201.   def prev_prior_command
  1202.   end
  1203.   #--------------------------------------------------------------------------
  1204.   # ○ 前のコマンド入力への後処理
  1205.   #--------------------------------------------------------------------------
  1206.   def post_prior_command
  1207.   end
  1208.   #--------------------------------------------------------------------------
  1209.   # ☆ ターン開始
  1210.   #--------------------------------------------------------------------------
  1211.   alias a1_battle_common_sb_turn_start turn_start
  1212.   def turn_start
  1213.     prev_turn_start
  1214.     a1_battle_common_sb_turn_start
  1215.     post_turn_start
  1216.   end
  1217.   #--------------------------------------------------------------------------
  1218.   # ○ ターン開始の前処理
  1219.   #--------------------------------------------------------------------------
  1220.   def prev_turn_start
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ○ ターン開始の後処理
  1224.   #--------------------------------------------------------------------------
  1225.   def post_turn_start
  1226.   end
  1227.   #--------------------------------------------------------------------------
  1228.   # ☆ ターン終了
  1229.   #--------------------------------------------------------------------------
  1230.   alias a1_battle_common_sb_turn_end turn_end
  1231.   def turn_end
  1232.     prev_turn_end
  1233.     a1_battle_common_sb_turn_end
  1234.     post_turn_end
  1235.   end
  1236.   #--------------------------------------------------------------------------
  1237.   # ○ ターン終了の前処理
  1238.   #--------------------------------------------------------------------------
  1239.   def prev_turn_end
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # ○ ターン終了の後処理
  1243.   #--------------------------------------------------------------------------
  1244.   def post_turn_end
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # ○ ウィンドウが閉じるまでウェイト
  1248.   #--------------------------------------------------------------------------
  1249.   def wait_fot_window_close(window)
  1250.     update_basic while window.close?
  1251.   end
  1252.   #--------------------------------------------------------------------------
  1253.   # ○ アクターのバトルメンバー取得
  1254.   #--------------------------------------------------------------------------
  1255.   def battle_members
  1256.     @party_battle_members ||= $game_party.battle_members
  1257.     return @party_battle_members
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # ○ バトルメンバーの追加の前処理
  1261.   #--------------------------------------------------------------------------
  1262.   def prev_add_battler(members)
  1263.   end
  1264.   #--------------------------------------------------------------------------
  1265.   # ○ バトルメンバーの追加後の処理
  1266.   #--------------------------------------------------------------------------
  1267.   def post_add_battler(member)
  1268.     @party_battle_members = $game_party.battle_members
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # ○ バトルメンバー削除の前処理
  1272.   #--------------------------------------------------------------------------
  1273.   def prev_remove_battler(member)
  1274.   end
  1275.   #--------------------------------------------------------------------------
  1276.   # ○ バトルメンバーの削除後の処理
  1277.   #--------------------------------------------------------------------------
  1278.   def post_remove_battler
  1279.     @party_battle_members = $game_party.battle_members
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ☆ 戦闘行動の実行
  1283.   #--------------------------------------------------------------------------
  1284.   alias a1_battle_common_sb_execute_action execute_action
  1285.   def execute_action
  1286.     prev_execute_action
  1287.     a1_battle_common_sb_execute_action
  1288.     post_execute_action
  1289.   end
  1290.   #--------------------------------------------------------------------------
  1291.   # ○ 戦闘行動の実行の前処理
  1292.   #--------------------------------------------------------------------------
  1293.   def prev_execute_action
  1294.     @subject.current_action.pre_make_targets
  1295.   end
  1296.   #--------------------------------------------------------------------------
  1297.   # ○ 戦闘行動の実行の後処理
  1298.   #--------------------------------------------------------------------------
  1299.   def post_execute_action
  1300.     @subject.current_action.clear_targets if @subject.current_action
  1301.   end
  1302.   #--------------------------------------------------------------------------
  1303.   # ☆ スキル/アイテムの使用
  1304.   #--------------------------------------------------------------------------
  1305.   alias a1_battle_common_sb_use_item use_item
  1306.   def use_item
  1307.     prev_use_item
  1308.     a1_battle_common_sb_use_item
  1309.     post_use_item
  1310.   end
  1311.   #--------------------------------------------------------------------------
  1312.   # ○ スキル/アイテムの使用の前処理
  1313.   #--------------------------------------------------------------------------
  1314.   def prev_use_item
  1315.   end
  1316.   #--------------------------------------------------------------------------
  1317.   # ○ スキル/アイテムの使用の後処理
  1318.   #--------------------------------------------------------------------------
  1319.   def post_use_item
  1320.   end
  1321.   #--------------------------------------------------------------------------
  1322.   # ○ 勝利の処理
  1323.   #--------------------------------------------------------------------------
  1324.   def process_victory
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ○ 戦闘終了
  1328.   #--------------------------------------------------------------------------
  1329.   def battle_end(result)
  1330.     $game_party.all_members.each {|member| init_member_battle_end(member) }
  1331.   end
  1332.   #--------------------------------------------------------------------------
  1333.   # ○ 戦闘終了時のメンバー初期化
  1334.   #--------------------------------------------------------------------------
  1335.   def init_member_battle_end(member)
  1336.     member.current_weapon = nil
  1337.     member.current_main   = nil
  1338.   end
  1339. end
  1340. end



RUBY 代码复制
  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    戦闘中入れ替え(RGSS3)
  4. #
  5. # バージョン   : 1.00 (2012/01/18)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  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.  
  31. class Window_MemberChange < Window_Selectable
  32.   #--------------------------------------------------------------------------
  33.   # ○ オブジェクト初期化
  34.   #--------------------------------------------------------------------------
  35.   def initialize
  36.     @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)
  37.     @to_actor_window   = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)
  38.     setup_members
  39.     width              = @battle_members.size * 102 + standard_padding * 2
  40.     height             = (@all_members.size / @battle_members.size.to_f).ceil * 96 + standard_padding * 2 + 36
  41.     super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)
  42.     self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height
  43.     self.index = 0
  44.     @from_actor = -1
  45.     self.openness = 0
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ○ アクティブ化
  49.   #--------------------------------------------------------------------------
  50.   def activate
  51.     super
  52.     refresh
  53.     @form_actor_window.actor = @all_members[self.index]
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ メンバーのセットアップ
  57.   #--------------------------------------------------------------------------
  58.   def setup_members
  59.     @all_members    = $game_party.all_members
  60.     @battle_members = $game_party.battle_members
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ○ 項目の選択
  64.   #--------------------------------------------------------------------------
  65.   def select(index)
  66.     super
  67.     @form_actor_window.actor = @all_members[self.index] if @from_actor == -1
  68.     @to_actor_window.actor   = @all_members[self.index] if @from_actor >= 0
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ○ 項目数の取得
  72.   #--------------------------------------------------------------------------
  73.   def item_max
  74.     @all_members.size
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ○ 桁数の取得
  78.   #--------------------------------------------------------------------------
  79.   def col_max
  80.     @battle_members.size
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ○ リフレッシュ
  84.   #--------------------------------------------------------------------------
  85.   def refresh
  86.     super
  87.     draw_horz_line(100)
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ○ 水平線の描画
  91.   #--------------------------------------------------------------------------
  92.   def draw_horz_line(y)
  93.     line_y = y + line_height / 2 - 1
  94.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ○ 水平線の色を取得
  98.   #--------------------------------------------------------------------------
  99.   def line_color
  100.     color = normal_color
  101.     color.alpha = 128
  102.     color
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ○ 項目の描画
  106.   #--------------------------------------------------------------------------
  107. def draw_item(index)
  108.        c_name  = member(index).face_name#character_name
  109.        c_index = member(index).face_index#character_index
  110.        rect    = item_rect(index)
  111.    draw_face(c_name, c_index, rect.x+3 , rect.y+3 )
  112.   end
  113.  
  114.  
  115.   #--------------------------------------------------------------------------
  116.   # ○ 項目を描画する矩形の取得
  117.   #--------------------------------------------------------------------------
  118.   def item_rect(index)
  119.     rect = Rect.new
  120.     rect.width = item_width
  121.     rect.height = item_height
  122.     rect.x = index % col_max * item_width
  123.     rect.y = index / col_max * item_height
  124.     rect.y += 24 if index > @battle_members.size - 1
  125.     rect
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ○ 項目の幅を取得
  129.   #--------------------------------------------------------------------------
  130.   def item_width
  131.     return 102
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ○ 項目の高さを取得
  135.   #--------------------------------------------------------------------------
  136.   def item_height
  137.     return 102
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ○ ウィンドウ内容の高さを計算
  141.   #--------------------------------------------------------------------------
  142.   def contents_height
  143.     row_max * item_height + 24
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ○ 下端パディングの更新
  147.   #--------------------------------------------------------------------------
  148.   def update_padding_bottom
  149.     surplus = (height - standard_padding * 2) % item_height - 24
  150.     self.padding_bottom = padding + surplus
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ○ メンバーの取得
  154.   #--------------------------------------------------------------------------
  155.   def member(index)
  156.     @all_members[index]
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ○ 決定処理の有効状態を取得
  160.   #--------------------------------------------------------------------------
  161.   def ok_enabled?
  162.     return true
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ○ 決定ボタンが押されたときの処理
  166.   #--------------------------------------------------------------------------
  167.   def process_ok
  168.     Sound.play_ok
  169.     Input.update
  170.     return select_start_to_actor if @from_actor == -1
  171.     return call_cancel_handler if @from_actor == self.index
  172.     change_member if @from_actor >= 0
  173.     post_change_member
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ○ メンバー入れ替え
  177.   #--------------------------------------------------------------------------
  178.   def change_member
  179.     $game_party.swap_order(@from_actor, self.index)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ○ メンバー入れ替え後の処理
  183.   #--------------------------------------------------------------------------
  184.   def post_change_member
  185.     setup_members
  186.     self.index  = @from_actor
  187.     @form_actor_window.actor = @all_members[self.index]
  188.     @from_actor = -1
  189.     @to_actor_window.close
  190.     refresh
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ○ 入れ替え先のアクター選択開始
  194.   #--------------------------------------------------------------------------
  195.   def select_start_to_actor
  196.     @from_actor = self.index
  197.     @to_actor_window.open
  198.     self.index = self.index < @battle_members.size ? @battle_members.size : 0
  199.     @to_actor_window.actor = @all_members[self.index]
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ○ 入れ替え元のアクター
  203.   #--------------------------------------------------------------------------
  204.   def from_actor
  205.     @from_actor
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ○ オープン
  209.   #--------------------------------------------------------------------------
  210.   def open
  211.     super
  212.     @form_actor_window.open
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ○ キャンセルハンドラの呼び出し
  216.   #--------------------------------------------------------------------------
  217.   def call_cancel_handler
  218.     super if @from_actor == -1
  219.     @from_actor = -1
  220.     @to_actor_window.close
  221.     @form_actor_window.actor = @all_members[self.index]
  222.     activate
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ○ クローズ
  226.   #--------------------------------------------------------------------------
  227.   def close
  228.     super
  229.     @form_actor_window.close
  230.     @to_actor_window.close
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ○ フレーム更新
  234.   #--------------------------------------------------------------------------
  235.   def update
  236.     super
  237.     @form_actor_window.update
  238.     @to_actor_window.update
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ○ 解放
  242.   #--------------------------------------------------------------------------
  243.   def dispose
  244.     super
  245.     @form_actor_window.dispose
  246.     @to_actor_window.dispose
  247.   end
  248. end
  249. #==============================================================================
  250. # ■ Window_PartyCommand
  251. #------------------------------------------------------------------------------
  252. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  253. #==============================================================================
  254.  
  255. class Window_PartyCommand < Window_Command
  256.   #--------------------------------------------------------------------------
  257.   # ☆ コマンドリストの作成
  258.   #--------------------------------------------------------------------------
  259.   alias a1_cbm_wpc_make_command_list make_command_list
  260.   def make_command_list
  261.     a1_cbm_wpc_make_command_list
  262.     add_command("更换队员", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
  263.   end
  264. end
  265. #==============================================================================
  266. # ■ Scene_Battle
  267. #------------------------------------------------------------------------------
  268. #  バトル画面の処理を行うクラスです。
  269. #==============================================================================
  270.  
  271. class Scene_Battle < Scene_Base
  272.   #--------------------------------------------------------------------------
  273.   # ☆ 全ウィンドウの作成
  274.   #--------------------------------------------------------------------------
  275.   alias a1_cbm_wpc_create_all_windows create_all_windows
  276.   def create_all_windows
  277.     a1_cbm_wpc_create_all_windows
  278.     create_member_change_window
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ○ 入れ替えウィンドウの作成
  282.   #--------------------------------------------------------------------------
  283.   def create_member_change_window
  284.     @window_member_change = Window_MemberChange.new
  285.     @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ☆ パーティコマンドウィンドウハンドルの定義
  289.   #--------------------------------------------------------------------------
  290.   alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
  291.   def define_party_command_window_handle
  292.     a1_cbm_sb_define_party_command_window_handle
  293.     @party_command_window.set_handler(:member_change,  method(:command_member_change))
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ○ 入れ替え
  297.   #--------------------------------------------------------------------------
  298.   def command_member_change
  299.     @prev_battle_members = $game_party.battle_members
  300.     @status_window.close
  301.     @party_command_window.close
  302.     @window_member_change.open
  303.     @window_member_change.activate
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ○ 変更したメンバーを取得
  307.   #--------------------------------------------------------------------------
  308.   def change_diss_members(ret = [])
  309.     $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }
  310.     return ret
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ○ メンバーチェンジ[キャンセル]
  314.   #--------------------------------------------------------------------------
  315.   def on_member_change_cancel
  316.     @party_command_window.activate
  317.     @status_window.refresh
  318.     @status_window.open
  319.     @party_command_window.open
  320.     @window_member_change.close
  321.     change_diss_members.each {|member| member.make_actions }
  322.     @party_battle_members = $game_party.battle_members
  323.   end
  324. end
  325. end
  326.  
  327. =begin
  328. game_party
  329. #--------------------------------------------------------------------------
  330.   # ● 交换顺序
  331.   #--------------------------------------------------------------------------
  332.   def swap_order(index1, index2)
  333.     return if (index1 == 0 or index2 == 0)  #加这一行
  334.     @actors[index1], @actors[index2] = @actors[index2], @actors[index1]
  335.     $game_player.refresh
  336.   end
  337. =end



前两个是前置脚本,第三个是换人脚本

点评

谢谢  发表于 2014-9-13 08:14
如果说明较长,新帖回复,点评字数有限啊  发表于 2014-9-7 09:56
复制进去后显示第一个脚本,第1022行发生错误,求解,还有,请劳烦你补充一下使用方法,应该不是直接复制进去那么简单吧,如果说明较长,新帖...  发表于 2014-9-7 09:55

评分

参与人数 1星屑 +200 收起 理由
taroxd + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

david_ng223 该用户已被删除
3
发表于 2014-9-6 22:49:59 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
288
在线时间
70 小时
注册时间
2013-3-2
帖子
43
4
 楼主| 发表于 2014-9-7 10:02:25 | 只看该作者
本帖最后由 szerova 于 2014-9-7 10:05 编辑

就是这样的

@lirn  


麻烦说一下脚本的使用方法

0ff1.jpg (293.26 KB, 下载次数: 23)

0ff1.jpg

点评

在886行  发表于 2014-9-7 12:31
把01脚本的 [url=home.php?mod=space&uid=341345]@Cache[/url] ||= {} 改为 @Cache ||= {} (原因:论坛BUG)  发表于 2014-9-7 12:30
我是直接从自己使用的脚本中复制出来的,我自己没有遇到这个问题。 这三个脚本是按顺序由上到下排列,战斗中就会多了一个选项  发表于 2014-9-7 11:38
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
288
在线时间
70 小时
注册时间
2013-3-2
帖子
43
5
 楼主| 发表于 2014-9-13 08:17:58 | 只看该作者
@taroxd
可以结贴了,感谢 lirn 的帮助
同样感谢 david_ng223 的回答(虽然搞不懂他的脚本怎么用……)
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-26 04:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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