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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2006-5-22
帖子
68
跳转到指定楼层
1
 楼主| 发表于 2013-2-9 12:19:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

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

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

就像FF12那样。

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

2
发表于 2013-2-9 14:14:23 | 只看该作者
本帖最后由 hcm 于 2013-2-9 20:43 编辑

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

整队脚本先放一个上来
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.     @cache ||= {}
  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.     [url=home.php?mod=space&uid=95897]@actor[/url] = 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 * 48 + standard_padding * 2
  40.     height             = (@all_members.size / @battle_members.size.to_f).ceil * 48 + 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(52)
  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).character_name
  109.     c_index = member(index).character_index
  110.     rect    = item_rect(index)
  111.     draw_character(c_name, c_index, rect.x + 24, rect.y + 40)
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ○ 項目を描画する矩形の取得
  115.   #--------------------------------------------------------------------------
  116.   def item_rect(index)
  117.     rect = Rect.new
  118.     rect.width = item_width
  119.     rect.height = item_height
  120.     rect.x = index % col_max * item_width
  121.     rect.y = index / col_max * item_height
  122.     rect.y += 24 if index > @battle_members.size - 1
  123.     rect
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ○ 項目の幅を取得
  127.   #--------------------------------------------------------------------------
  128.   def item_width
  129.     return 48
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ○ 項目の高さを取得
  133.   #--------------------------------------------------------------------------
  134.   def item_height
  135.     return 48
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ○ ウィンドウ内容の高さを計算
  139.   #--------------------------------------------------------------------------
  140.   def contents_height
  141.     row_max * item_height + 24
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ○ 下端パディングの更新
  145.   #--------------------------------------------------------------------------
  146.   def update_padding_bottom
  147.     surplus = (height - standard_padding * 2) % item_height - 24
  148.     self.padding_bottom = padding + surplus
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ○ メンバーの取得
  152.   #--------------------------------------------------------------------------
  153.   def member(index)
  154.     @all_members[index]
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ○ 決定処理の有効状態を取得
  158.   #--------------------------------------------------------------------------
  159.   def ok_enabled?
  160.     return true
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ○ 決定ボタンが押されたときの処理
  164.   #--------------------------------------------------------------------------
  165.   def process_ok
  166.     Sound.play_ok
  167.     Input.update
  168.     return select_start_to_actor if @from_actor == -1
  169.     return call_cancel_handler if @from_actor == self.index
  170.     change_member if @from_actor >= 0
  171.     post_change_member
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ○ メンバー入れ替え
  175.   #--------------------------------------------------------------------------
  176.   def change_member
  177.     $game_party.swap_order(@from_actor, self.index)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ○ メンバー入れ替え後の処理
  181.   #--------------------------------------------------------------------------
  182.   def post_change_member
  183.     setup_members
  184.     self.index  = @from_actor
  185.     @form_actor_window.actor = @all_members[self.index]
  186.     @from_actor = -1
  187.     @to_actor_window.close
  188.     refresh
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ○ 入れ替え先のアクター選択開始
  192.   #--------------------------------------------------------------------------
  193.   def select_start_to_actor
  194.     @from_actor = self.index
  195.     @to_actor_window.open
  196.     self.index = self.index < @battle_members.size ? @battle_members.size : 0
  197.     @to_actor_window.actor = @all_members[self.index]
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ○ 入れ替え元のアクター
  201.   #--------------------------------------------------------------------------
  202.   def from_actor
  203.     @from_actor
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ○ オープン
  207.   #--------------------------------------------------------------------------
  208.   def open
  209.     super
  210.     @form_actor_window.open
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ○ キャンセルハンドラの呼び出し
  214.   #--------------------------------------------------------------------------
  215.   def call_cancel_handler
  216.     super if @from_actor == -1
  217.     @from_actor = -1
  218.     @to_actor_window.close
  219.     @form_actor_window.actor = @all_members[self.index]
  220.     activate
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ○ クローズ
  224.   #--------------------------------------------------------------------------
  225.   def close
  226.     super
  227.     @form_actor_window.close
  228.     @to_actor_window.close
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ○ フレーム更新
  232.   #--------------------------------------------------------------------------
  233.   def update
  234.     super
  235.     @form_actor_window.update
  236.     @to_actor_window.update
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ○ 解放
  240.   #--------------------------------------------------------------------------
  241.   def dispose
  242.     super
  243.     @form_actor_window.dispose
  244.     @to_actor_window.dispose
  245.   end
  246. end
  247. #==============================================================================
  248. # ■ Window_PartyCommand
  249. #------------------------------------------------------------------------------
  250. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  251. #==============================================================================
  252.  
  253. class Window_PartyCommand < Window_Command
  254.   #--------------------------------------------------------------------------
  255.   # ☆ コマンドリストの作成
  256.   #--------------------------------------------------------------------------
  257.   alias a1_cbm_wpc_make_command_list make_command_list
  258.   def make_command_list
  259.     a1_cbm_wpc_make_command_list
  260.     add_command("入れ替え", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
  261.   end
  262. end
  263. #==============================================================================
  264. # ■ Scene_Battle
  265. #------------------------------------------------------------------------------
  266. #  バトル画面の処理を行うクラスです。
  267. #==============================================================================
  268.  
  269. class Scene_Battle < Scene_Base
  270.   #--------------------------------------------------------------------------
  271.   # ☆ 全ウィンドウの作成
  272.   #--------------------------------------------------------------------------
  273.   alias a1_cbm_wpc_create_all_windows create_all_windows
  274.   def create_all_windows
  275.     a1_cbm_wpc_create_all_windows
  276.     create_member_change_window
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ○ 入れ替えウィンドウの作成
  280.   #--------------------------------------------------------------------------
  281.   def create_member_change_window
  282.     @window_member_change = Window_MemberChange.new
  283.     @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ☆ パーティコマンドウィンドウハンドルの定義
  287.   #--------------------------------------------------------------------------
  288.   alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
  289.   def define_party_command_window_handle
  290.     a1_cbm_sb_define_party_command_window_handle
  291.     @party_command_window.set_handler(:member_change,  method(:command_member_change))
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ○ 入れ替え
  295.   #--------------------------------------------------------------------------
  296.   def command_member_change
  297.     @prev_battle_members = $game_party.battle_members
  298.     @status_window.close
  299.     @party_command_window.close
  300.     @window_member_change.open
  301.     @window_member_change.activate
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ○ 変更したメンバーを取得
  305.   #--------------------------------------------------------------------------
  306.   def change_diss_members(ret = [])
  307.     $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }
  308.     return ret
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ○ メンバーチェンジ[キャンセル]
  312.   #--------------------------------------------------------------------------
  313.   def on_member_change_cancel
  314.     @party_command_window.activate
  315.     @status_window.refresh
  316.     @status_window.open
  317.     @party_command_window.open
  318.     @window_member_change.close
  319.     change_diss_members.each {|member| member.make_actions }
  320.     @party_battle_members = $game_party.battle_members
  321.   end
  322. end
  323. end
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2006-5-22
帖子
68
3
 楼主| 发表于 2013-2-10 20:25:44 | 只看该作者
请问版主,您的脚本,在大整合包里,是哪个脚本?大概叫什么名字?很难找啊

点评

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

使用道具 举报

Lv3.寻梦者

唯一的信徒

梦石
0
星屑
1665
在线时间
1357 小时
注册时间
2013-1-29
帖子
1637
4
发表于 2013-2-10 20:53:54 | 只看该作者
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Command Equip v1.01
  4. # -- Last Updated: 2012.01.10
  5. # -- Level: Easy, Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

点评

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


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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 06:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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