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

Project1

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

[已经解决] 求一个像幻想三国志那样的带阵形功能的战斗系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
197 小时
注册时间
2014-9-16
帖子
70
跳转到指定楼层
1
发表于 2015-8-19 18:57:37 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就像幻想三国志那样的:
1.敌我分别有一个5*5的区域,敌我使用相应的阵法时候会自动将角色移动到这个5*5区域中的特定位置,然后每个角色逐一添加这个阵法的buff或debuff(每个角色的buff和debuff都要能独立设置互不干扰
2.此外一个角色的正前方如果有其他角色,那这个角色不能被普通攻击,对于有些法术可以突破这一限制
希望有现成的脚本,多谢,论坛搜索和图书馆里没翻到相关内容

点评

如果没有现成的,就不麻烦各位大大了,我感觉写一个这个脚本会很费劲  发表于 2015-8-19 18:59

Lv3.寻梦者

梦石
0
星屑
2271
在线时间
610 小时
注册时间
2009-1-21
帖子
273
来自 4楼
发表于 2015-8-19 22:05:44 | 只看该作者
本帖最后由 御之嵐 于 2015-8-19 22:51 编辑

雖然這是『VX的橫版戰鬥陣形』腳本
但是功能應該很接近你的需求
你要學 RUBY的話
這個腳本給你參考吧
https://rpg.blue/forum.php?mod=viewthread&tid=189131

雖然RGSS2 和 RGSS3 不太一樣
但我想思路應該是差不多的


=======================================
這個是剛剛在日站找到的
13年的東西
但是好像沒完成的樣子
http://blog.livedoor.jp/kuremente-rgssscript/archives/21745117.html
是VA橫版的腳本

預覽截圖


=======================================
日站
ツクール工房 A1(仮)的 VA橫版陣形腳本
http://a1tktk.web.fc2.com/scripts_page/battle_formation.html

預覽截圖

点评

不知道是我浏览器有问题还是怎么着,我打开日站那个以后注释部分全是乱码,你能把那两个脚本粘过来吗?多谢  发表于 2015-8-20 18:05
感谢  发表于 2015-8-20 10:20

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
29185
在线时间
604 小时
注册时间
2014-7-18
帖子
729

开拓者

2
发表于 2015-8-19 19:07:16 | 只看该作者
我准备在今后写一个类似的脚本,但是近期不会写,因为脚本知识严重不足,正在学脚本补课。
你能等到大约1~3年之后吗?

点评

好像MV不是RGSS4,因为都不用ruby了,用JS,专业人士说所有语言都差不多,关键是思路。 所以等出来再学~  发表于 2015-8-20 11:53
1-3年之后RGSS4就出来了 建议前辈去学这个吧 MV刚出来肯定会缺脚本的  发表于 2015-8-20 11:32
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
197 小时
注册时间
2014-9-16
帖子
70
3
 楼主| 发表于 2015-8-19 19:20:29 | 只看该作者
xjzsq 发表于 2015-8-19 19:07
我准备在今后写一个类似的脚本,但是近期不会写,因为脚本知识严重不足,正在学脚本补课。
你能等到大约1~3 ...

学脚本要那么久?先等等看有没有其他大大回复我吧,没有的话我就去学Ruby了,多谢回复

点评

我设计的游戏涉及到了鼠标脚本,要研究的透彻一点。  发表于 2015-8-19 20:06
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2271
在线时间
610 小时
注册时间
2009-1-21
帖子
273
5
发表于 2015-8-20 22:23:21 | 只看该作者
本帖最后由 御之嵐 于 2016-4-16 00:37 编辑

@朢瑏禾火氺  

不知道為什麼
用了兩個摺疊的語法
內文就會天下大亂ლ(゚Д゚ლ)
後面的腳本我只用代碼的語法去顯示
所以給他一點時間顯示吧
會有點久_(:з」∠)_

========================================

RGSSスクリプト倉庫
RPG探検隊Sideview対応隊列設定 Ver0.20-α



========================================

ツクール工房 A1(仮)
這個日站的腳本需要他的戰鬥系統
所以會用到很多腳本

A1共通スクリプト
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


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


バトルアクション
RUBY 代码复制
  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    バトルアクション(RGSS3)
  4. #
  5. # バージョン   : 2.00 (2012/01/18)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・バトル中のスキル・アイテム使用時に行うアクションを設定します
  11. # ・バトル時のアニメーションを複数同時表示します
  12. #---------------------------------------------------------------------------
  13. # 更新履歴   :2012/01/10 Ver1.00 リリース
  14. #              :2012/01/10 Ver1.01 アクターのアニメーションを画面左上に表示してしまう不具合を修正
  15. #              :2012/01/18 Ver2.00 反撃・戦闘不能時に攻撃を続ける不具合を修正
  16. #              :2012/01/18 Ver2.00 位置がずれる不具合を修正
  17. #              :2012/01/18 Ver2.00 A1バトル共通スクリプト対応
  18. #---------------------------------------------------------------------------
  19. # 設置場所      
  20. #    A1バトル共通スクリプト以下
  21. #
  22. # 必要スクリプト
  23. #    A1バトル共通スクリプト
  24. #---------------------------------------------------------------------------
  25. # 使い方
  26. #   スキルorアイテムのメモ欄に記述します
  27. #
  28. #     <アクション action,action,acton・・・>
  29. #
  30. #       actionの書き方
  31. #       アニメーション:A(ID)(Damage)(Skip)
  32. #         例:A103DS → アニメーションID 103 を表示し
  33. #                       ダメージを与えて、アニメーションの終了を待ちません
  34. #
  35. #         例:A76D   → アニメーションID 76 を表示し
  36. #                       ダメージを与えて、アニメーションの終了を待ちます
  37. #     
  38. #         例:A124S  → アニメーションID 124 を表示し
  39. #                       ダメージを与えず、アニメーションの終了を待ちません
  40. #     
  41. #         例:A53    → アニメーションID 53 を表示し
  42. #                       ダメージを与えず、アニメーションの終了を待ちます
  43. #
  44. #       ダメージ発生:D(times)(Skip)
  45. #         例:D3     → ダメージを3回発生させ、ログのウェイトを発生させます
  46. #         例:D1S    → ダメージを1回発生させ、ログのウェイトを発生させません
  47. #
  48. #       ウェイト:W(frame)
  49. #         例:W60    → 60フレーム(1秒)の間ウェイトします
  50. #
  51. #     ※アクション中にダメージを発生させると
  52. #       アクション終了後にダメージを発生させません
  53. #
  54. #     アクション設定例
  55. #       例:桜花夢幻刃
  56. #           <アクション A88S,D1S,W8,D1S,W8,D1S,W8,D1S,W30>
  57. #
  58. #           この設定でアニメーション「斬撃/必殺技4」に合わせてダメージが入ります
  59. #
  60. #       例:連続アニメーション
  61. #           <アクション A7D,A7D,A7D,A7D,A7D>
  62. #
  63. #           この設定でアニメーション「斬撃/物理」をダメージ付きで5回連続させます
  64. #==============================================================================
  65. $imported ||= {}
  66. if $imported["A1_BattleCommonScript"]
  67. $imported["A1_BattleAction"] = true
  68. old_common_script("バトルアクション", "3.30") if common_version < 3.30
  69. #==============================================================================
  70. # ■ RPG::UsableItem
  71. #==============================================================================
  72.  
  73. class RPG::UsableItem < RPG::BaseItem
  74.   #--------------------------------------------------------------------------
  75.   # ○ アクション
  76.   #--------------------------------------------------------------------------
  77.   def actions
  78.     @actions = $a1_common.note_data_array(self.note, "アクション", "A", nil, false) if @actions == nil
  79.     return nil if @actions.empty?
  80.     return @actions
  81.   end
  82. end
  83. #==============================================================================
  84. # ■ Scene_Battle
  85. #------------------------------------------------------------------------------
  86. #  バトル画面の処理を行うクラスです。
  87. #==============================================================================
  88.  
  89. class Scene_Battle < Scene_Base
  90.   #--------------------------------------------------------------------------
  91.   # ☆ ウェイト
  92.   #--------------------------------------------------------------------------
  93.   alias a1_chain_animation_sb_wait wait
  94.   def wait(duration)
  95.     a1_chain_animation_sb_wait(duration) unless @skip_animation_wait || @skip_effect_wait
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ☆ アニメーション表示が終わるまでウェイト
  99.   #--------------------------------------------------------------------------
  100.   alias a1_chain_animation_sb_wait_for_animation wait_for_animation
  101.   def wait_for_animation
  102.     a1_chain_animation_sb_wait_for_animation unless @skip_animation_wait
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ☆ エフェクト実行が終わるまでウェイト
  106.   #--------------------------------------------------------------------------
  107.   alias a1_chain_animation_sb_wait_for_effect wait_for_effect
  108.   def wait_for_effect
  109.     a1_chain_animation_sb_wait_for_effect unless @skip_effect_wait
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ☆ スキル/アイテムの使用
  113.   #--------------------------------------------------------------------------
  114.   alias a1_chain_animation_sb_use_item use_item
  115.   def use_item
  116.     return if @subject.hp <= 0
  117.     @skip_animation_wait  = false
  118.     @action_invoke        = false
  119.     @invoke_damage        = false
  120.     @log_window.wait_skip = false
  121.     @action_item          = @subject.current_action.item if @subject.current_action
  122.     a1_chain_animation_sb_use_item
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ☆ アニメーションの表示
  126.   #     targets      : 対象者の配列
  127.   #     animation_id : アニメーション ID(-1: 通常攻撃と同じ)
  128.   #--------------------------------------------------------------------------
  129.   alias a1_chain_animation_sb_show_animation show_animation
  130.   def show_animation(targets, animation_id)
  131.     return a1_chain_animation_sb_show_animation(targets, animation_id) unless check_action_item
  132.     set_wait_collapse(targets, true)
  133.     @action_item.actions.each {|action| proc_action(targets, action) }
  134.     set_wait_collapse(targets, false)
  135.     @action_invoke = @invoke_damage
  136.     @action_item   = nil
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ○ アクションの存在チェック
  140.   #--------------------------------------------------------------------------
  141.   def check_action_item
  142.     return false unless @action_item
  143.     return false unless @action_item.actions
  144.     return true
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ○ コラプス処理保留の設定
  148.   #--------------------------------------------------------------------------
  149.   def set_wait_collapse(targets, flag)
  150.     @skip_effect_wait = true unless flag
  151.     targets.each {|target| target.wait_collapse = flag; next if flag
  152.       target.refresh
  153.       @log_window.display_added_states(target)
  154.     }
  155.     @skip_effect_wait = false
  156.     wait_for_effect unless flag
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ○ アクションの実行
  160.   #--------------------------------------------------------------------------
  161.   def proc_action(targets, action)
  162.     @skip_animation_wait  = false
  163.     @log_window.wait_skip = false
  164.     return action_animation(targets, $1.to_i, $2) if action =~ /A([-]?\d+)(.*)/
  165.     return wait($1.to_i) if action =~ /W(\d+)/
  166.     proc_damage(targets, $1.to_i, $2) if action =~ /D(\d+)(.*)/
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ○ ダメージの実行
  170.   #--------------------------------------------------------------------------
  171.   def proc_damage(targets, num, params)
  172.     @log_window.wait_skip = true if params.include?("S")
  173.     @skip_animation_wait  = true if params.include?("S")
  174.     targets.each {|target| num.times { invoke_item(target, @action_item) } }
  175.     @invoke_damage = true
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ○ アクションのアニメーション
  179.   #--------------------------------------------------------------------------
  180.   def action_animation(targets, animation_id, params)
  181.     return if @subject.hp <= 0
  182.     @skip_animation_wait  = true if params.include?("S")
  183.     @log_window.wait_skip = true if params.include?("S")
  184.     a1_chain_animation_sb_show_animation(targets, animation_id)
  185.     targets.each {|target| invoke_item(target, @action_item) } if params.include?("D")
  186.     @invoke_damage = true if params.include?("D")
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ☆ スキル/アイテムの発動
  190.   #--------------------------------------------------------------------------
  191.   alias a1_chain_animation_sb_invoke_item invoke_item
  192.   def invoke_item(target, item)
  193.     return if @subject.hp <= 0
  194.     a1_chain_animation_sb_invoke_item(target, item) unless @action_invoke
  195.   end
  196. end
  197. #==============================================================================
  198. # ■ Sprite_BattleAnimation
  199. #==============================================================================
  200.  
  201. class Sprite_BattleAnimation < Sprite_Base
  202.   #--------------------------------------------------------------------------
  203.   # ○ オブジェクト初期化
  204.   #--------------------------------------------------------------------------
  205.   def initialize(viewport, battler_sprite, index, use_sprite)
  206.     @use_sprite     = use_sprite
  207.     super(viewport)
  208.     self.x          = battler_sprite.x
  209.     self.y          = battler_sprite.y
  210.     self.z          = battler_sprite.z + index
  211.     self.ox         = battler_sprite.ox
  212.     self.oy         = battler_sprite.oy
  213.     self.src_rect   = battler_sprite.src_rect
  214.   end
  215. end
  216. #==============================================================================
  217. # ■ Sprite_Battler
  218. #------------------------------------------------------------------------------
  219. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  220. # スプライトの状態を自動的に変化させます。
  221. #==============================================================================
  222.  
  223. class Sprite_Battler < Sprite_Base
  224.   #--------------------------------------------------------------------------
  225.   # ☆ オブジェクト初期化
  226.   #--------------------------------------------------------------------------
  227.   alias a1_multi_animation_sb_initialize initialize
  228.   def initialize(viewport, battler = nil)
  229.     @viewport = viewport
  230.     @sprite_animation = []
  231.     a1_multi_animation_sb_initialize(viewport, battler)
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ○ アニメーションの開始
  235.   #--------------------------------------------------------------------------
  236.   def start_animation(animation, mirror)
  237.     sprite_animation = Sprite_BattleAnimation.new(@viewport, self, @sprite_animation.size, @battler.use_sprite?)
  238.     sprite_animation.start_animation(animation, mirror)
  239.     @sprite_animation.push(sprite_animation)
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ○ アニメーション表示中判定
  243.   #--------------------------------------------------------------------------
  244.   def battle_animation?
  245.     @sprite_animation.each {|animation| return true if animation.animation? }
  246.     return false
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ☆ フレーム更新
  250.   #--------------------------------------------------------------------------
  251.   alias a1_multi_animation_sb_update update
  252.   def update
  253.     a1_multi_animation_sb_update
  254.     update_animation_ex
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ○ アニメーションの更新
  258.   #--------------------------------------------------------------------------
  259.   def update_animation_ex
  260.     @sprite_animation.each_with_index {|animation, i|
  261.       animation.update
  262.       next if animation.animation?
  263.       animation.dispose
  264.       @sprite_animation.delete_at(i)
  265.     }
  266.   end
  267. end
  268. #==============================================================================
  269. # ■ Window_BattleLog
  270. #------------------------------------------------------------------------------
  271. #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド
  272. # ウとして扱います。
  273. #==============================================================================
  274.  
  275. class Window_BattleLog < Window_Selectable
  276.   #--------------------------------------------------------------------------
  277.   # ☆ オブジェクト初期化
  278.   #--------------------------------------------------------------------------
  279.   alias a1_chain_animation_wbl_initialize initialize
  280.   def initialize
  281.     @wait_skip = false
  282.     a1_chain_animation_wbl_initialize
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ☆ ウェイト
  286.   #--------------------------------------------------------------------------
  287.   alias a1_chain_animation_wbl_wait wait
  288.   def wait
  289.     a1_chain_animation_wbl_wait unless @wait_skip
  290.     @wait_skip = false
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ○ ウェイトスキップの設定
  294.   #--------------------------------------------------------------------------
  295.   def wait_skip=(flag)
  296.     @wait_skip = flag
  297.   end
  298. end
  299. #==============================================================================
  300. # ■ Game_Battler
  301. #------------------------------------------------------------------------------
  302. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  303. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  304. #==============================================================================
  305.  
  306. class Game_Battler < Game_BattlerBase
  307.   #--------------------------------------------------------------------------
  308.   # ☆ オブジェクト初期化
  309.   #--------------------------------------------------------------------------
  310.   alias a1_battle_action_gb_initialize initialize
  311.   def initialize
  312.     a1_battle_action_gb_initialize
  313.     @wait_collapse = false
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ☆ ステートの付加
  317.   #--------------------------------------------------------------------------
  318.   alias a1_battle_action_gb_add_state add_state
  319.   def add_state(state_id)
  320.     return if @wait_collapse && state_id == death_state_id
  321.     a1_battle_action_gb_add_state(state_id)
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ○ コラプスウェイト
  325.   #--------------------------------------------------------------------------
  326.   def wait_collapse=(flg)
  327.     @wait_collapse = flg
  328.   end
  329. end
  330. 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. # 必要スクリプト
  19. #    A1バトル共通スクリプト
  20. #---------------------------------------------------------------------------
  21. # 使い方
  22. #   導入することで適用されます
  23. #==============================================================================
  24. $imported ||= {}
  25. if $imported["A1_BattleCommonScript"]
  26. $imported["A1_FaceStatusWindow"] = true
  27. old_common_script("フェイスステータスウィンドウ", "3.90") if common_version < 3.90
  28. #==============================================================================
  29. # ■ Window_FaceStatus
  30. #==============================================================================
  31.  
  32. class Window_FaceStatus < Window_Base
  33.   #--------------------------------------------------------------------------
  34.   # ○ オブジェクト初期化
  35.   #--------------------------------------------------------------------------
  36.   def initialize
  37.     @actors = $game_party.battle_members
  38.     super(0, 0, 0, 0)
  39.     setup_window_pos
  40.     self.openness = 0
  41.     self.contents.font.size = 21
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ○ 項目数の取得
  45.   #--------------------------------------------------------------------------
  46.   def item_max
  47.     @actors.size
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ ウィンドウ位置のセットアップ
  51.   #--------------------------------------------------------------------------
  52.   def setup_window_pos
  53.     self.width  = actor_width * @actors.size + standard_padding * 1.5
  54.     self.height = 96 + standard_padding * 2
  55.     self.y      = Graphics.height - height
  56.     self.x      = Graphics.width  - width
  57.     create_contents
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ○ アクターの設定
  61.   #--------------------------------------------------------------------------
  62.   def actors=(actors)
  63.     @actors = actors
  64.     setup_window_pos
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ○ 一人のアクターにかける幅
  68.   #--------------------------------------------------------------------------
  69.   def actor_width
  70.     return 96 + standard_padding / 2
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ○ 項目の描画
  74.   #--------------------------------------------------------------------------
  75.   def draw_item(index)
  76.     actor = @actors[index]
  77.     x     = actor_width * index
  78.     draw_face(actor.face_name, actor.face_index, x, 0, false)
  79.     draw_text(x, line_height * 0, actor_width - (standard_padding / 2), line_height, actor.name, 1)
  80.     draw_actor_icons(actor, x, 0 + line_height * 3)
  81.     draw_actor_hp(actor, x, 0 + line_height * 1, 95)
  82.     draw_actor_mp(actor, x, 0 + line_height * 2, 48)
  83.     draw_actor_tp(actor, x + 50, 0 + line_height * 2, 45) if $data_system.opt_display_tp
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ○ 全項目の描画
  87.   #--------------------------------------------------------------------------
  88.   def draw_all_items
  89.     item_max.times {|i| draw_item(i) }
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ○ リフレッシュ
  93.   #--------------------------------------------------------------------------
  94.   def refresh
  95.     return unless self.visible
  96.     contents.clear
  97.     draw_all_items
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ○ フレーム更新
  101.   #--------------------------------------------------------------------------
  102.   def update
  103.     return unless self.visible
  104.     super
  105.     self.visible = false if self.openness == 0
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ○ オープン
  109.   #--------------------------------------------------------------------------
  110.   def open
  111.     self.visible = true
  112.     refresh
  113.     super
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ○ 顔グラフィックの描画
  117.   #--------------------------------------------------------------------------
  118.   def draw_face(face_name, face_index, x, y, enabled = true)
  119.     draw_face_no_dispose(face_name, face_index, x, y, enabled)
  120.   end
  121. end
  122. #==============================================================================
  123. # ■ Scene_Battle
  124. #------------------------------------------------------------------------------
  125. #  バトル画面の処理を行うクラスです。
  126. #==============================================================================
  127.  
  128. class Scene_Battle < Scene_Base
  129.   #--------------------------------------------------------------------------
  130.   # ☆ 全ウィンドウの作成
  131.   #--------------------------------------------------------------------------
  132.   alias a1_face_status_window_sb_create_all_windows create_all_windows
  133.   def create_all_windows
  134.     create_face_status_window
  135.     create_personal_status_window
  136.     a1_face_status_window_sb_create_all_windows
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ○ ステータスウィンドウ作成の後処理
  140.   #--------------------------------------------------------------------------
  141.   def post_create_status_window
  142.     @status_window.visible = false
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ○ フェイスステータスウィンドウの作成
  146.   #--------------------------------------------------------------------------
  147.   def create_face_status_window
  148.     @face_status_window = Window_FaceStatus.new
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ○ 個人ステータスウィンドウの作成
  152.   #--------------------------------------------------------------------------
  153.   def create_personal_status_window
  154.     @personal_status_window = Window_PersonalStatus.new(0, Graphics.height - 120, 0)
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ☆ ステータスウィンドウがリフレッシュされた時の処理
  158.   #--------------------------------------------------------------------------
  159.   alias a1_face_status_window_sb_refresh_statsu_window refresh_statsu_window
  160.   def refresh_statsu_window
  161.     a1_face_status_window_sb_refresh_statsu_window
  162.     @face_status_window.refresh
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ☆ ステータスウィンドウがクローズされた時の処理
  166.   #--------------------------------------------------------------------------
  167.   alias a1_face_status_window_sb_close_status_window close_status_window
  168.   def close_status_window
  169.     a1_face_status_window_sb_close_status_window
  170.     @face_status_window.close
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ 個人ステータスウィンドウのアクター設定
  174.   #--------------------------------------------------------------------------
  175.   def setup_personal_status_actor
  176.     actor = BattleManager.actor
  177.     actor ? @personal_status_window.actor = actor : @personal_status_window.close
  178.     @personal_status_window.open if actor
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ○ パーティコマンド選択の開始の後処理
  182.   #--------------------------------------------------------------------------
  183.   alias a1_face_status_window_sb_post_start_party_command_selection post_start_party_command_selection
  184.   def post_start_party_command_selection
  185.     a1_face_status_window_sb_post_start_party_command_selection
  186.     @face_status_window.close
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ☆ 次のコマンド入力への後処理
  190.   #--------------------------------------------------------------------------
  191.   alias a1_face_status_window_sb_post_next_command post_next_command
  192.   def post_next_command
  193.     a1_face_status_window_sb_post_next_command
  194.     setup_personal_status_actor
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ☆ 前のコマンド入力への後処理
  198.   #--------------------------------------------------------------------------
  199.   alias a1_face_status_window_sb_post_prior_command post_prior_command
  200.   def post_prior_command
  201.     a1_face_status_window_sb_post_prior_command
  202.     setup_personal_status_actor
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ☆ ターン開始の前処理
  206.   #--------------------------------------------------------------------------
  207.   alias a1_face_status_window_sb_prev_turn_start prev_turn_start
  208.   def prev_turn_start
  209.     a1_face_status_window_sb_prev_turn_start
  210.     @personal_status_window.close
  211.     @face_status_window.open
  212.     @face_status_window.refresh
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ○ バトルメンバーの追加後の処理
  216.   #--------------------------------------------------------------------------
  217.   alias a1_face_status_window_sb_post_add_battler post_add_battler
  218.   def post_add_battler(member)
  219.     a1_face_status_window_sb_post_add_battler(member)
  220.     @face_status_window.actors = $game_party.battle_members
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ○ バトルメンバーの削除後の処理
  224.   #--------------------------------------------------------------------------
  225.   alias a1_face_status_window_sb_post_remove_battler post_remove_battler
  226.   def post_remove_battler
  227.     a1_face_status_window_sb_post_remove_battler
  228.     @face_status_window.actors = $game_party.battle_members
  229.   end
  230. #==============================================================================
  231. # ■ 戦闘中入れ替えインポート時処理
  232. #==============================================================================
  233. if $imported["A1_ChangeMember"]
  234.   #--------------------------------------------------------------------------
  235.   # ○ メンバーチェンジ[キャンセル]
  236.   #--------------------------------------------------------------------------
  237.   alias a1_face_status_window_sb_on_member_change_cancel on_member_change_cancel
  238.   def on_member_change_cancel
  239.     a1_face_status_window_sb_on_member_change_cancel
  240.     @face_status_window.actors = $game_party.battle_members
  241.   end;end
  242. end
  243. #==============================================================================
  244. # ■ ポップアップダメージインポート時処理
  245. #==============================================================================
  246. if $imported["A1_DamagePopUp"]
  247. #==============================================================================
  248. # ■ Window_BattleLog
  249. #------------------------------------------------------------------------------
  250. #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド
  251. # ウとして扱います。
  252. #==============================================================================
  253.  
  254. class Window_BattleLog < Window_Selectable
  255.   #--------------------------------------------------------------------------
  256.   # ★ ポップアップの位置取得・アクター
  257.   #--------------------------------------------------------------------------
  258.   def popup_pos_actor(target)
  259.     y           = (Graphics.height - (96 + standard_padding * 2) / 2 )
  260.     actor_width = (96 + standard_padding / 2)
  261.     width       = actor_width * $game_party.battle_members.size + standard_padding * 1.5
  262.     x           = Graphics.width  - width
  263.     x           = x + actor_width * target.index + actor_width / 2
  264.     return [x, y]
  265.   end
  266. end;end
  267. end


個別バトルステータスウィンドウ
RUBY 代码复制
  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    個別バトルステータスウィンドウ(RGSS3)
  4. #
  5. # バージョン   : 2.11 (2012/01/24)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・おれは「個別バトルステータスウィンドウ」だけを作っていたと思ったら
  11. #  いつの間にかバトル画面全部を作っていた
  12. #
  13. #  な… 何を言ってるのか わからねーと思うが
  14. #   おれも何をしてたのかわからなかった…
  15. #
  16. #   頭がどうにかなりそうだった…
  17. #
  18. #   ついでだとかヒマだっただとか
  19. #   そんなチャチなもんじゃあ 断じてねえ
  20. #
  21. #   もっと恐ろしいものの片鱗を味わったぜ…
  22. #---------------------------------------------------------------------------
  23. # 更新履歴   :2012/01/10 Ver1.00 リリース
  24. #              :2012/01/10 Ver1.10 敵選択の不具合を修正
  25. #              :2012/01/10 Ver1.10 顔グラフィック位置の不具合を修正
  26. #              :2012/01/10 Ver1.10 顔グラフィック切り替えの際、一瞬カクつく不具合を修正
  27. #              :2012/01/16 Ver1.11 二回行動の際顔グラフィックが1段階上にせりあがる不具合を修正
  28. #              :2012/01/17 Ver1.20 陣形対応
  29. #              :2012/01/17 Ver1.20 戦闘中入れ替え対応
  30. #              :2012/01/19 Ver2.00 A1バトル共通スクリプト対応
  31. #              :2012/01/21 Ver2.10 ウィンドウのフォントサイズ調整できるようにしました
  32. #              :2012/01/24 Ver2.11 フェイスステータスウィンドウを使用しない際の不具合を修正
  33. #---------------------------------------------------------------------------
  34. # 設置場所      
  35. #    A1バトル共通スクリプト以下
  36. #    (リザルトウィンドウ以下)
  37. #    (ダメージポップアップ以下)
  38. #    (戦闘中入れ替えスクリプト以下)
  39. #
  40. # 必要スクリプト
  41. #    A1バトル共通スクリプト
  42. #---------------------------------------------------------------------------
  43. # 使い方
  44. #   ■ 設定項目 に設定します
  45. #
  46. #   ※顔グラフィックモード false 時
  47. #   データベース「アクター」のメモ欄にバトラーグラフィックを設定します
  48. #
  49. #     <バトラー filename>
  50. #     
  51. #     顔グラフィックの代わりに、設定したピクチャを使用します  
  52. #     インポート先は「Picture」ディレクトリになります
  53. #==============================================================================
  54. $imported ||= {}
  55. if $imported["A1_BattleCommonScript"]
  56. $imported["A1_PersonalBattleStatus"] = true
  57. old_common_script("個別バトルステータスウィンドウ", "3.90") if common_version < 3.90
  58. #==============================================================================
  59. # ■ 設定項目
  60. #==============================================================================
  61. module A1_System::PersonalBattleStatusConfig
  62.   #--------------------------------------------------------------------------
  63.   # 顔グラフィックモード
  64.   #--------------------------------------------------------------------------
  65.   FACE_MODE       = true
  66.   #--------------------------------------------------------------------------
  67.   # ウィンドウのフォントサイズ
  68.   #--------------------------------------------------------------------------
  69.   FONT_SIZE       = 18
  70. end
  71. #==============================================================================
  72. # ■ ポップアップダメージインポート時処理
  73. #==============================================================================
  74. if $imported["A1_DamagePopUp"]
  75. #==============================================================================
  76. # ■ Window_BattleLog
  77. #------------------------------------------------------------------------------
  78. #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド
  79. # ウとして扱います。
  80. #==============================================================================
  81.  
  82. class Window_BattleLog < Window_Selectable
  83.   #--------------------------------------------------------------------------
  84.   # ★ ポップアップの位置取得・アクター
  85.   #--------------------------------------------------------------------------
  86.   def popup_pos_actor(target)
  87.     [target.screen_x ,target.screen_y - target.sprite_height / 2]
  88.   end
  89. end
  90. #==============================================================================
  91. # ■ ポップアップダメージ非インポート時処理
  92. #==============================================================================
  93. else
  94. #==============================================================================
  95. # ■ Scene_Battle
  96. #------------------------------------------------------------------------------
  97. #  バトル画面の処理を行うクラスです。
  98. #==============================================================================
  99.  
  100. class Scene_Battle < Scene_Base
  101.   #--------------------------------------------------------------------------
  102.   # ☆ 開始処理
  103.   #--------------------------------------------------------------------------
  104.   alias a1_damege_popup_sb_start start
  105.   def start
  106.     a1_damege_popup_sb_start
  107.     setup_actor_index
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ○ アクターインデックスの割り当て
  111.   #--------------------------------------------------------------------------
  112.   def setup_actor_index
  113.     $game_party.battle_members.each_with_index {|actor, i| actor.index = i }
  114.   end
  115. end
  116. #==============================================================================
  117. # ■ Game_Actor
  118. #------------------------------------------------------------------------------
  119. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  120. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  121. #==============================================================================
  122.  
  123. class Game_Actor < Game_Battler
  124.   #--------------------------------------------------------------------------
  125.   # ○ 公開インスタンス変数
  126.   #--------------------------------------------------------------------------
  127.   attr_accessor :index
  128.   #--------------------------------------------------------------------------
  129.   # ☆ セットアップ
  130.   #--------------------------------------------------------------------------
  131.   alias a1_damege_popup_setup setup
  132.   def setup(actor_id)
  133.     a1_damege_popup_setup(actor_id)
  134.     @index = nil
  135.   end
  136. end;end
  137. #==============================================================================
  138. # ■ RPG::Actor
  139. #==============================================================================
  140.  
  141. class RPG::Actor < RPG::BaseItem
  142.   #--------------------------------------------------------------------------
  143.   # ○ バトラー名
  144.   #--------------------------------------------------------------------------
  145.   def battler_name
  146.     @battler_name ||= $a1_common.note_data_one(self.note, "バトラー", "")
  147.     return @battler_name
  148.   end
  149. end
  150. #==============================================================================
  151. # ■ BattleManager
  152. #------------------------------------------------------------------------------
  153. #  戦闘の進行を管理するモジュールです。
  154. #==============================================================================
  155.  
  156. module BattleManager
  157.   #--------------------------------------------------------------------------
  158.   # ○ エイリアス用特異メソッド
  159.   #--------------------------------------------------------------------------
  160.   class << self
  161.     alias :a1_psw_bm_turn_end :turn_end
  162.     alias :a1_psw_bm_turn_start :turn_start
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ☆ ターン開始
  166.   #--------------------------------------------------------------------------
  167.   def self.turn_start
  168.     @regenerate_actor = []
  169.     a1_psw_bm_turn_start
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ☆ ターン終了
  173.   #--------------------------------------------------------------------------
  174.   def self.turn_end
  175.     call_method(:show_regenerate_actor, @regenerate_actor) unless @regenerate_actor.empty?
  176.     a1_psw_bm_turn_end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ 自動回復したアクターの取得
  180.   #--------------------------------------------------------------------------
  181.   def self.regenerate_actor
  182.     @regenerate_actor
  183.   end
  184. end
  185. #==============================================================================
  186. # ■ Window_BattleActors
  187. #==============================================================================
  188.  
  189. class Window_BattleActors < Window_Base
  190.   #--------------------------------------------------------------------------
  191.   # ○ 定数
  192.   #--------------------------------------------------------------------------
  193.   FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE
  194.   FONT_SIZE = A1_System::PersonalBattleStatusConfig::FONT_SIZE
  195.   #--------------------------------------------------------------------------
  196.   # ○ オブジェクト初期化
  197.   #--------------------------------------------------------------------------
  198.   def initialize(index, actor)
  199.     @actor    = actor
  200.     @states   = []
  201.     super(0, 0, 0, 0)
  202.     self.visible  = false
  203.     self.opacity  = 0
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ○ ウィンドウ位置のセット
  207.   #--------------------------------------------------------------------------
  208.   def setup_window_pos(index)
  209.     width       = Graphics.width / 4
  210.     width       = Graphics.width / $game_party.battle_members.size if $game_party.battle_members.size > 4
  211.     @line_num   = $data_system.opt_display_tp ? 5 : 4
  212.     height      = fitting_height(@line_num)
  213.     self.x      = width * index
  214.     self.y      = Graphics.height - height
  215.     self.width  = width
  216.     self.height = height + 24
  217.     create_contents
  218.     self.contents.font.size = FONT_SIZE
  219.     @target_y = self.y
  220.     @org_y    = self.y
  221.     refresh
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ○ リフレッシュ
  225.   #--------------------------------------------------------------------------
  226.   def refresh
  227.     contents.clear
  228.     draw_info
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ○ 情報の描画
  232.   #--------------------------------------------------------------------------
  233.   def draw_info
  234.     draw_background(contents.rect)
  235.     draw_face(@actor.face_name, @actor.face_index, (self.contents.width - 96) / 2, 0, false) if FACE_MODE
  236.     draw_actor_icons(@actor, 4, line_height * 0, contents.width)
  237.     draw_text(0, draw_y(1) - 8, contents.width, line_height, @actor.name, 1)
  238.     draw_actor_hp(@actor, 4, draw_y(2), contents.width)
  239.     draw_actor_mp(@actor, 4, draw_y(3), contents.width)
  240.     draw_actor_tp(@actor, 4, draw_y(4), contents.width) if $data_system.opt_display_tp
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ○ 描画するy座標
  244.   #--------------------------------------------------------------------------
  245.   def draw_y(index)
  246.     self.height - (line_height - 6) * (@line_num - index) - 42
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ○ 1行の高さ
  250.   #--------------------------------------------------------------------------
  251.   def line_height
  252.     return 20
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ○ 上に移動
  256.   #--------------------------------------------------------------------------
  257.   def move_up
  258.     @target_y = @org_y - 24
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ○ 戻る
  262.   #--------------------------------------------------------------------------
  263.   def move_return
  264.     @target_y = @org_y
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ○ フレーム更新
  268.   #--------------------------------------------------------------------------
  269.   def update
  270.     super
  271.     self.y -= 6 if @target_y < self.y
  272.     self.y += 6 if @target_y > self.y
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ○ 顔グラフィックの描画
  276.   #--------------------------------------------------------------------------
  277.   def draw_face(face_name, face_index, x, y, enabled = true)
  278.     draw_face_no_dispose(face_name, face_index, x, y, enabled)
  279.   end
  280. end
  281. #==============================================================================
  282. # ■ Scene_Battle
  283. #------------------------------------------------------------------------------
  284. #  バトル画面の処理を行うクラスです。
  285. #==============================================================================
  286.  
  287. class Scene_Battle < Scene_Base
  288.   #--------------------------------------------------------------------------
  289.   # ○ 定数
  290.   #--------------------------------------------------------------------------
  291.   FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE
  292.   #--------------------------------------------------------------------------
  293.   # ☆ バトルマネージャメソッドの定義
  294.   #--------------------------------------------------------------------------
  295.   alias a1_psw_sb_define_battle_manager_method define_battle_manager_method
  296.   def define_battle_manager_method
  297.     a1_psw_sb_define_battle_manager_method
  298.     BattleManager.define_method(method(:show_regenerate_actor),  :show_regenerate_actor)
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ☆ 全ウィンドウの作成
  302.   #--------------------------------------------------------------------------
  303.   alias a1_psw_sb_create_all_windows create_all_windows
  304.   def create_all_windows
  305.     a1_psw_sb_create_all_windows
  306.     create_name_help_window
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ☆ ステータスウィンドウ作成の後処理
  310.   #--------------------------------------------------------------------------
  311.   alias a1_psw_sb_post_create_status_window post_create_status_window
  312.   def post_create_status_window
  313.     a1_psw_sb_post_create_status_window
  314.     create_status_windows
  315.     a1_psw_sb_post_create_status_window
  316.     @status_window.visible = false
  317.     @status_window.y       = @status_window_y
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ○ 名前表示用ヘルプウィンドウの作成
  321.   #--------------------------------------------------------------------------
  322.   def create_name_help_window
  323.     @name_help_window = Window_Help.new
  324.     @name_help_window.openness = 0
  325.     @name_help_window.visible  = true
  326.     @actor_window.help_window = @name_help_window
  327.     @enemy_window.help_window = @name_help_window
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ○ 個別ステータスウィンドウの作成
  331.   #--------------------------------------------------------------------------
  332.   def create_status_windows
  333.     @status_windows = []
  334.     @status_window_height = 0
  335.     battle_members.each_with_index {|actor, i| setup_status_windows(i, actor) }
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ○ 個別ステータスウィンドウのセットアップ
  339.   #--------------------------------------------------------------------------
  340.   def setup_status_windows(index, actor)
  341.     @status_windows[index] = Window_BattleActors.new(index, actor)
  342.     @status_windows[index].z = 15
  343.     setup_status_windows_pos(index, actor)
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ○ 個別ステータスウィンドウとアクターの位置をセットアップ
  347.   #--------------------------------------------------------------------------
  348.   def setup_status_windows_pos(index, actor)
  349.     @status_windows[index].setup_window_pos(index)
  350.     setup_actor_battler(index, actor)
  351.     @status_window_height = @status_windows[index].height
  352.     @status_window_y      = @status_windows[index].y
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ○ アクター位置のセットアップ
  356.   #--------------------------------------------------------------------------
  357.   def setup_actor_battler(index, actor)
  358.     actor.screen_x = @status_windows[index].x + @status_windows[index].width / 2
  359.     actor.screen_z = 10
  360.     return setup_actor_sprite(actor, index) if actor.use_sprite && !FACE_MODE
  361.     return setup_empty_sprite(actor, index)
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ○ アクタースプライトのセットアップ
  365.   #--------------------------------------------------------------------------
  366.   def setup_actor_sprite(actor, index)
  367.     actor.screen_y = Graphics.height
  368.     actor.visible  = false
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ○ 空のダミースプライトのセットアップ
  372.   #--------------------------------------------------------------------------
  373.   def setup_empty_sprite(actor, index)
  374.     actor.screen_y    = @status_windows[index].y + @status_windows[index].height / 2
  375.     actor.use_sprite = true
  376.     sprite = @spriteset.actor_sprite[index]
  377.     height = (Graphics.height - @status_windows[index].y) / 2
  378.     sprite.setup_empty_actor_bitmap(@status_windows[index].width, height)
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ☆ 情報表示ビューポートの作成
  382.   #--------------------------------------------------------------------------
  383.   alias a1_psw_sb_create_info_viewport create_info_viewport
  384.   def create_info_viewport
  385.     a1_psw_sb_create_info_viewport
  386.     @info_viewport.rect.y = Graphics.height - (@status_window.height + @status_window_height)
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ☆ ステータスウィンドウがリフレッシュされた時の処理
  390.   #--------------------------------------------------------------------------
  391.   alias a1_psw_sb_refresh_statsu_window refresh_statsu_window
  392.   def refresh_statsu_window
  393.     a1_psw_sb_refresh_statsu_window
  394.     refresh_status_windows
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ☆ スキルウィンドウ作成の後処理
  398.   #--------------------------------------------------------------------------
  399.   alias a1_psw_sb_post_create_skill_window post_create_skill_window
  400.   def post_create_skill_window
  401.     a1_psw_sb_post_create_skill_window
  402.     @skill_window.resize_height(@status_window_y)
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ☆ アイテムウィンドウ作成の後処理
  406.   #--------------------------------------------------------------------------
  407.   alias a1_psw_sb_post_create_item_window post_create_item_window
  408.   def post_create_item_window
  409.     a1_psw_sb_post_create_item_window
  410.     @item_window.resize_height(@status_window_y)
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ☆ パーティコマンド選択の開始の前処理
  414.   #--------------------------------------------------------------------------
  415.   alias a1_psw_sb_prev_start_party_command_selection prev_start_party_command_selection
  416.   def prev_start_party_command_selection
  417.     battle_members.each {|actor| enable_open_status(actor.index) }
  418.     a1_psw_sb_prev_start_party_command_selection
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ☆ コマンド[戦う]
  422.   #--------------------------------------------------------------------------
  423.   alias a1_psw_sb_prev_command_fight command_fight
  424.   def command_fight
  425.     battle_members.each {|actor| disable_open_status(actor.index) }
  426.     a1_psw_sb_prev_command_fight
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ☆ コマンド[逃げる]
  430.   #--------------------------------------------------------------------------
  431.   alias a1_psw_sb_prev_command_escape command_escape
  432.   def command_escape
  433.     battle_members.each {|actor| disable_open_status(actor.index) }
  434.     a1_psw_sb_prev_command_escape
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ☆ コマンド[スキル]
  438.   #--------------------------------------------------------------------------
  439.   alias a1_psw_sb_command_skill command_skill
  440.   def command_skill
  441.     a1_psw_sb_command_skill
  442.     @actor_command_window.close
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ☆ コマンド[アイテム]
  446.   #--------------------------------------------------------------------------
  447.   alias a1_psw_sb_command_item command_item
  448.   def command_item
  449.     a1_psw_sb_command_item
  450.     @actor_command_window.close
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ☆ アクター選択の開始
  454.   #--------------------------------------------------------------------------
  455.   alias a1_psw_sb_select_actor_selection select_actor_selection
  456.   def select_actor_selection
  457.     @skill_window.hide
  458.     @item_window.hide
  459.     a1_psw_sb_select_actor_selection
  460.     @actor_window.visible = false
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ☆ 敵キャラ選択の開始
  464.   #--------------------------------------------------------------------------
  465.   alias a1_psw_sb_select_enemy_selection select_enemy_selection
  466.   def select_enemy_selection
  467.     @skill_window.hide
  468.     @item_window.hide
  469.     a1_psw_sb_select_enemy_selection
  470.     @enemy_window.visible = false
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ☆ ターン開始の前処理
  474.   #--------------------------------------------------------------------------
  475.   alias a1_psw_sb_prev_turn_start prev_turn_start
  476.   def prev_turn_start
  477.     close_status_windows
  478.     a1_psw_sb_prev_turn_start
  479.     @face_status_window.close if $imported["A1_FaceStatusWindow"]
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # ☆ ターン開始の後処理
  483.   #--------------------------------------------------------------------------
  484.   alias a1_psw_sb_post_turn_start post_turn_start
  485.   def post_turn_start
  486.     battle_members.each {|actor| disable_status_window(actor) }
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ☆ 戦闘行動終了時の処理
  490.   #--------------------------------------------------------------------------
  491.   alias a1_psw_sb_process_action_end process_action_end
  492.   def process_action_end
  493.     close_status_windows
  494.     diseble_close_status(@subject.index) if @subject.actor?
  495.     a1_psw_sb_process_action_end
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ☆ 戦闘行動の実行
  499.   #--------------------------------------------------------------------------
  500.   alias a1_psw_sb_execute_action execute_action
  501.   def execute_action
  502.     close_status_windows
  503.     enable_open_status(@subject.index) if @subject.actor?
  504.     a1_psw_sb_execute_action
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ☆ アニメーションの表示
  508.   #     targets      : 対象者の配列
  509.   #     animation_id : アニメーション ID(-1: 通常攻撃と同じ)
  510.   #--------------------------------------------------------------------------
  511.   alias a1_psw_sb_show_animation show_animation
  512.   def show_animation(targets, animation_id)
  513.     targets.each {|target| on_target_window_open(target) }
  514.     a1_psw_sb_show_animation(targets, animation_id)
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ○ ターゲットされた個別ステータスウィンドウをオープンする
  518.   #--------------------------------------------------------------------------
  519.   def on_target_window_open(target)
  520.     disable_open_status(target.index) if target.actor? && target != @subject
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ○ 個別ステータスウィンドウをクローズして非選択状態にする
  524.   #--------------------------------------------------------------------------
  525.   def diseble_close_status(index)
  526.     @status_windows[index].visible = false
  527.     battle_members[index].visible =  false
  528.     battle_members[index].opacity =  128
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ○ 個別ステータスウィンドウを非選択状態でオープン
  532.   #--------------------------------------------------------------------------
  533.   def disable_open_status(index)
  534.     @status_windows[index].visible = true
  535.     battle_members[index].visible  = true
  536.     battle_members[index].opacity  = 128
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ○ 個別ステータスウィンドウを選択状態でオープン
  540.   #--------------------------------------------------------------------------
  541.   def enable_open_status(index)
  542.     @status_windows[index].visible = true
  543.     battle_members[index].visible  = true
  544.     battle_members[index].opacity  = 255
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ○ 自動回復したアクターのウィンドウをオープン
  548.   #--------------------------------------------------------------------------
  549.   def show_regenerate_actor(actors_index)
  550.     actors_index.each {|index| enable_open_status(index) }
  551.   end
  552.   #--------------------------------------------------------------------------
  553.   # ○ 個別ステータスウィンドウのクローズ
  554.   #--------------------------------------------------------------------------
  555.   def close_status_windows
  556.     battle_members.each_with_index {|actor, i| actor_visible(false, i, actor) }
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # ○ 可視状態設定してウィンドウ位置を戻す
  560.   #--------------------------------------------------------------------------
  561.   def actor_visible(flag, i, actor)
  562.     actor.visible = flag;
  563.     @status_windows[i].visible = flag
  564.     return_window(actor)
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # ☆ ステータスウィンドウが更新された時の処理
  568.   #--------------------------------------------------------------------------
  569.   alias a1_psw_sb_update_status_window update_status_window
  570.   def update_status_window
  571.     a1_psw_sb_update_status_window
  572.     @status_windows.each {|window| window.update }
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ☆ ステータスウィンドウが解放された時の処理
  576.   #--------------------------------------------------------------------------
  577.   alias a1_psw_sb_dispose_status_window dispose_status_window
  578.   def dispose_status_window
  579.     a1_psw_sb_dispose_status_window
  580.     @status_windows.each {|window| window.dispose }
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ☆ 次のコマンド入力への前処理
  584.   #--------------------------------------------------------------------------
  585.   alias a1_psw_sb_prev_next_command prev_next_command
  586.   def prev_next_command
  587.     a1_psw_sb_prev_next_command
  588.     disable_status_window(BattleManager.actor) if BattleManager.actor
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ☆ 次のコマンド入力への後処理
  592.   #--------------------------------------------------------------------------
  593.   alias a1_psw_sb_post_next_command post_next_command
  594.   def post_next_command
  595.     a1_psw_sb_post_next_command
  596.     move_up_status_window(BattleManager.actor) if BattleManager.actor
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ○ 前のコマンド入力への前処理
  600.   #--------------------------------------------------------------------------
  601.   alias a1_psw_sb_prev_prior_command prev_prior_command
  602.   def prev_prior_command
  603.     a1_psw_sb_prev_prior_command
  604.     disable_status_window(BattleManager.actor) if BattleManager.actor
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ☆ 前のコマンド入力への後処理
  608.   #--------------------------------------------------------------------------
  609.   alias a1_psw_sb_post_prior_command post_prior_command
  610.   def post_prior_command
  611.     a1_psw_sb_post_prior_command
  612.     move_up_status_window(BattleManager.actor) if BattleManager.actor
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ○ 個別ステータスウィンドウを非選択状態にする
  616.   #--------------------------------------------------------------------------
  617.   def disable_status_window(actor)
  618.     actor.opacity = 128
  619.     return_window(actor)
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # ○ 個別ステータスウィンドウを選択状態にする
  623.   #--------------------------------------------------------------------------
  624.   def move_up_status_window(actor)
  625.     actor.opacity = 255
  626.     @status_windows[actor.index].move_up if FACE_MODE || actor.battler_name.empty?
  627.   end
  628.   #--------------------------------------------------------------------------
  629.   # ○ 個別ステータスウィンドウを定位置に戻す
  630.   #--------------------------------------------------------------------------
  631.   def return_window(actor)
  632.     @status_windows[actor.index].move_return if FACE_MODE || actor.battler_name.empty?
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ○ 個別ステータスウィンドウをリフレッシュ
  636.   #--------------------------------------------------------------------------
  637.   def refresh_status_windows
  638.     @status_windows.each {|window| window.refresh }
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # ○ アクターの選択
  642.   #--------------------------------------------------------------------------
  643.   def select_actor(index)
  644.     @spriteset.cursor.target = battle_members[index]
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # ○ アクターの選択の終了
  648.   #--------------------------------------------------------------------------
  649.   def select_actor_end
  650.     @spriteset.cursor.target = nil
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ○ 敵の選択
  654.   #--------------------------------------------------------------------------
  655.   def select_enemy(index)
  656.     @spriteset.cursor.target = @enemy_window.enemy
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ○ 敵の選択の終了
  660.   #--------------------------------------------------------------------------
  661.   def select_enemy_end
  662.     @spriteset.cursor.target = nil
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ○ バトラースプライトの変更
  666.   #--------------------------------------------------------------------------
  667.   def change_battler_sprite(member)
  668.     @spriteset.actor_sprite[member.index] ||= @spriteset.add_actor_sprite(member.index, member)
  669.     @spriteset.actor_sprite[member.index].battler = member
  670.   end
  671.   #--------------------------------------------------------------------------
  672.   # ☆ バトルメンバー追加の後処理
  673.   #--------------------------------------------------------------------------
  674.   alias a1_psw_sb_post_add_battler post_add_battler
  675.   def post_add_battler(member)
  676.     a1_psw_sb_post_add_battler(member)
  677.     battle_members.each {|member| recreate_status_windows(member) }
  678.   end
  679.   #--------------------------------------------------------------------------
  680.   # ○ 個別ステータスウィンドウを再作成する
  681.   #--------------------------------------------------------------------------
  682.   def recreate_status_windows(member)
  683.     @status_windows[member.index].dispose if @status_windows[member.index]
  684.     setup_status_windows(member.index, member)
  685.     change_battler_sprite(member)
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ☆ バトルメンバー削除の前処理
  689.   #--------------------------------------------------------------------------
  690.   alias a1_psw_sb_prev_remove_battler prev_remove_battler
  691.   def prev_remove_battler(member)
  692.     a1_psw_sb_prev_remove_battler(member)
  693.     delete_actor_sprite(member.index)
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # ○ 削除するメンバーの個別バトルステータスウィンドウとスプライトを解放
  697.   #--------------------------------------------------------------------------
  698.   def delete_actor_sprite(index)
  699.     @spriteset.actor_sprite[index].battler.battler_name = ""
  700.     @status_windows[index].dispose
  701.     @status_windows.delete_at(index)
  702.   end
  703. #==============================================================================
  704. # ■ フェイスステータスウィンドウ対応処理
  705. #==============================================================================
  706.   if $imported["A1_FaceStatusWindow"]
  707.   #--------------------------------------------------------------------------
  708.   # ☆ 個人ステータスウィンドウのアクター設定(エイリアスを取って潰す)
  709.   #--------------------------------------------------------------------------
  710.   alias a1_psw_sb_setup_personal_status_actor setup_personal_status_actor
  711.   def setup_personal_status_actor
  712.   end;end
  713. #==============================================================================
  714. # ■ 戦闘中入れ替え対応処理
  715. #==============================================================================
  716.   if $imported["A1_ChangeMember"]
  717.   #--------------------------------------------------------------------------
  718.   # ○ 入れ替え
  719.   #--------------------------------------------------------------------------
  720.   alias a1_psw_command_member_change command_member_change
  721.   def command_member_change
  722.     battle_members.each {|actor| close_status_windows }
  723.     a1_psw_command_member_change
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ☆ メンバーチェンジ[キャンセル]
  727.   #--------------------------------------------------------------------------
  728.   alias a1_psw_on_member_change_cancel on_member_change_cancel
  729.   def on_member_change_cancel
  730.     a1_psw_on_member_change_cancel
  731.     battle_members.each {|member| member_change_refresh(member) }
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ○ メンバーチェンジリフレッシュ
  735.   #--------------------------------------------------------------------------
  736.   def member_change_refresh(member)
  737.     recreate_status_windows(member)
  738.     enable_open_status(member.index)
  739.   end;end
  740. end
  741. #==============================================================================
  742. # ■ Sprite_BattleCursor
  743. #==============================================================================
  744.  
  745. class Sprite_BattleCursor < Sprite_Base
  746.   #--------------------------------------------------------------------------
  747.   # ○ 定数
  748.   #--------------------------------------------------------------------------
  749.   FACE_MODE     = A1_System::PersonalBattleStatusConfig::FACE_MODE
  750.   FONT_NAME     = "VL-Gothic-Regular"
  751.   FONT_SIZE     = 32
  752.   DEFAULT_COLOR = Color.new(255,0,255)
  753.   #--------------------------------------------------------------------------
  754.   # ○ 公開インスタンス変数
  755.   #--------------------------------------------------------------------------
  756.   attr_accessor :target
  757.   #--------------------------------------------------------------------------
  758.   # ○ オブジェクト初期化
  759.   #--------------------------------------------------------------------------
  760.   def initialize(color = DEFAULT_COLOR)
  761.     super(nil)
  762.     @color = color
  763.     create_bitmap
  764.     self.visible = false
  765.     self.z = 10
  766.     @target = nil
  767.     @plus_x = 0
  768.     @plus_y = 0
  769.   end
  770.   #--------------------------------------------------------------------------
  771.   # ○ ビットマップ作成
  772.   #--------------------------------------------------------------------------
  773.   def create_bitmap
  774.     text = "▼"
  775.  
  776.     # 計算用ダミービットマップ
  777.     bitmap = Cache.system("")
  778.     bitmap.font.name = FONT_NAME
  779.     bitmap.font.size = FONT_SIZE
  780.     tw = bitmap.text_size(text).width + 8
  781.  
  782.     # ビットマップ作成
  783.     bitmap = Bitmap.new(tw, (bitmap.font.size + 4) * text.size * 1.5)
  784.     bitmap.font.name = FONT_NAME
  785.     bitmap.font.size = FONT_SIZE
  786.     bitmap.font.color = @color
  787.     bitmap.draw_text_f(0, 0, bitmap.width, bitmap.height, text, 2, Color.new(0,0,0))
  788.  
  789.     # スプライト設定
  790.     self.bitmap = bitmap
  791.     self.ox = bitmap.width / 2
  792.     self.oy = bitmap.height / 2
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # ○ x座標補正値の設定
  796.   #--------------------------------------------------------------------------
  797.   def plus_x=(x)
  798.     @plus_x = x
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ○ y座標補正値の設定
  802.   #--------------------------------------------------------------------------
  803.   def plus_y=(y)
  804.     @plus_y = y
  805.   end
  806.   #--------------------------------------------------------------------------
  807.   # ○ フレーム更新
  808.   #--------------------------------------------------------------------------
  809.   def update
  810.     self.visible = @target ? true : false
  811.     return unless @target
  812.     super
  813.     self.x = @target.screen_x + @plus_x
  814.     self.y = @target.screen_y - @target.battler_height + @plus_y
  815.     self.y = @target.screen_y - 96 if @target.actor? && (FACE_MODE || @target.battler_name.empty?)
  816.   end
  817. end
  818. #==============================================================================
  819. # ■ Spriteset_Battle
  820. #------------------------------------------------------------------------------
  821. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  822. # スの内部で使用されます。
  823. #==============================================================================
  824.  
  825. class Spriteset_Battle
  826.   #--------------------------------------------------------------------------
  827.   # ☆ オブジェクト初期化
  828.   #--------------------------------------------------------------------------
  829.   alias a1_psw_spsb_initialize initialize
  830.   def initialize
  831.     create_cursor_sprite
  832.     a1_psw_spsb_initialize
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ○ カーソルスプライトの作成
  836.   #--------------------------------------------------------------------------
  837.   def create_cursor_sprite
  838.     @cursor_sprite = Sprite_BattleCursor.new
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # ○ アクタースプライト
  842.   #--------------------------------------------------------------------------
  843.   def actor_sprite
  844.     return @actor_sprites
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # ☆ フレーム更新
  848.   #--------------------------------------------------------------------------
  849.   alias a1_psw_spsb_update update
  850.   def update
  851.     a1_psw_spsb_update
  852.     update_cursor
  853.   end
  854.   #--------------------------------------------------------------------------
  855.   # ○ カーソルスプライトの更新
  856.   #--------------------------------------------------------------------------
  857.   def update_cursor
  858.     @cursor_sprite.update
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ○ カーソルスプライトの取得
  862.   #--------------------------------------------------------------------------
  863.   def cursor
  864.     @cursor_sprite
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # ★ アクタースプライトの作成
  868.   #--------------------------------------------------------------------------
  869.   def create_actors
  870.     @actor_sprites = []
  871.     $game_party.battle_members.each {|actor| @actor_sprites.push(Sprite_Battler.new(@viewport1, actor)) }
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ○ カーソルの解放
  875.   #--------------------------------------------------------------------------
  876.   def add_actor_sprite(index, actor)
  877.     @actor_sprites[index] = Sprite_Battler.new(@viewport1, actor)
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ★ アクタースプライトの更新
  881.   #--------------------------------------------------------------------------
  882.   def update_actors
  883.     @actor_sprites.each {|sprite| sprite.update }
  884.   end
  885.   #--------------------------------------------------------------------------
  886.   # ☆ 解放
  887.   #--------------------------------------------------------------------------
  888.   alias a1_psw_spsb_dispose dispose
  889.   def dispose
  890.     a1_psw_spsb_dispose
  891.     dispose_cursor
  892.   end
  893.   #--------------------------------------------------------------------------
  894.   # ○ カーソルの解放
  895.   #--------------------------------------------------------------------------
  896.   def dispose_cursor
  897.     @cursor_sprite.dispose
  898.   end
  899. end
  900. #==============================================================================
  901. # ■ Game_Battler
  902. #------------------------------------------------------------------------------
  903. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  904. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  905. #==============================================================================
  906.  
  907. class Game_Battler < Game_BattlerBase
  908.   #--------------------------------------------------------------------------
  909.   # ○ バトラーの高さを取得
  910.   #--------------------------------------------------------------------------
  911.   def battler_height
  912.     @battler_height ||= 0
  913.     return @battler_height
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ○ バトラーの高さを設定
  917.   #--------------------------------------------------------------------------
  918.   def battler_height=(height)
  919.     @battler_height = height
  920.   end
  921. #==============================================================================
  922. # ■ ダメージポップアップ対応処理
  923. #==============================================================================
  924.   if $imported["A1_DamagePopUp"]
  925.   #--------------------------------------------------------------------------
  926.   # ○ ポップアップのセットアップ
  927.   #--------------------------------------------------------------------------
  928.   alias a1_psw_gbt_setup_popup setup_popup
  929.   def setup_popup(kind)
  930.     BattleManager.regenerate_actor.push(self.index) unless BattleManager.regenerate_actor.include?(self.index)
  931.     a1_psw_gbt_setup_popup(kind)
  932.   end;end
  933. end
  934. #==============================================================================
  935. # ■ Sprite_Battler
  936. #------------------------------------------------------------------------------
  937. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  938. # スプライトの状態を自動的に変化させます。
  939. #==============================================================================
  940.  
  941. class Sprite_Battler < Sprite_Base
  942.   #--------------------------------------------------------------------------
  943.   # ☆ オブジェクト初期化
  944.   #--------------------------------------------------------------------------
  945.   alias a1_psw_spb_initialize initialize
  946.   def initialize(viewport, battler = nil)
  947.     a1_psw_spb_initialize(viewport, battler)
  948.     setup_battler_info
  949.   end
  950.   #--------------------------------------------------------------------------
  951.   # ○ バトラー情報のセットアップ
  952.   #--------------------------------------------------------------------------
  953.   def setup_battler_info
  954.     return unless @battler
  955.     @battler.battler_height = self.height
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ☆ 転送元ビットマップの更新
  959.   #--------------------------------------------------------------------------
  960.   alias a1_psw_spb_update_bitmap update_bitmap
  961.   def update_bitmap
  962.     return update_bitmap_actor if @battler.actor?
  963.     a1_psw_spb_update_bitmap
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ○ アクター用転送元ビットマップの更新
  967.   #--------------------------------------------------------------------------
  968.   def update_bitmap_actor
  969.     self.opacity = @battler.opacity
  970.     self.visible = @battler.visible
  971.     return unless update_bitmap?
  972.     return self.bitmap = nil if @battler.battler_name.empty?
  973.     new_bitmap   = Cache.picture(@battler.battler_name)
  974.     @prev_battler_name = @battler.battler_name
  975.     self.bitmap = new_bitmap
  976.     @battler.sprite_height = self.bitmap.height
  977.     setup_battler_info
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ○ アクターのビットマップをアップデートするか判断
  981.   #--------------------------------------------------------------------------
  982.   def update_bitmap?
  983.     return false if @battler.battler_name == @prev_battler_name
  984.     return false if @battler.battler_name.empty?
  985.     return true
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ☆ 可視状態の初期化
  989.   #--------------------------------------------------------------------------
  990.   alias a1_psw_spb_init_visibility init_visibility
  991.   def init_visibility
  992.     a1_psw_spb_init_visibility
  993.     setup_battler_info
  994.   end
  995.   #--------------------------------------------------------------------------
  996.   # ○ アクターの空Bitmapのセットアップ
  997.   #--------------------------------------------------------------------------
  998.   def setup_empty_actor_bitmap(width, height)
  999.     self.bitmap = Bitmap.new(width, height)
  1000.   end
  1001. end
  1002. #==============================================================================
  1003. # ■ Game_Actor
  1004. #------------------------------------------------------------------------------
  1005. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  1006. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  1007. #==============================================================================
  1008.  
  1009. class Game_Actor < Game_Battler
  1010.   #--------------------------------------------------------------------------
  1011.   # ○ 定数
  1012.   #--------------------------------------------------------------------------
  1013.   FACE_MODE = A1_System::PersonalBattleStatusConfig::FACE_MODE
  1014.   #--------------------------------------------------------------------------
  1015.   # ○ 公開インスタンス変数
  1016.   #--------------------------------------------------------------------------
  1017.   attr_accessor :screen_x
  1018.   attr_accessor :screen_y
  1019.   attr_accessor :screen_z
  1020.   attr_accessor :opacity
  1021.   attr_accessor :visible
  1022.   attr_accessor :use_sprite
  1023.   attr_accessor :sprite_height
  1024.   attr_accessor :battler_name
  1025.   #--------------------------------------------------------------------------
  1026.   # ☆ セットアップ
  1027.   #--------------------------------------------------------------------------
  1028.   alias a1_psw_setup setup
  1029.   def setup(actor_id)
  1030.     a1_psw_setup(actor_id)
  1031.     @screen_x      = 0
  1032.     @screen_y      = 0
  1033.     @screen_z      = 0
  1034.     @opacity       = 255
  1035.     @visible       = true
  1036.     @sprite_height = 0
  1037.     @battler_name  = FACE_MODE ? "" : actor.battler_name
  1038.     @use_sprite    = @battler_name.empty? ? false : true
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # ★ スプライトを使うか?
  1042.   #--------------------------------------------------------------------------
  1043.   def use_sprite?
  1044.     @use_sprite
  1045.   end
  1046. end
  1047. #==============================================================================
  1048. # ■ Window_BattleEnemy
  1049. #------------------------------------------------------------------------------
  1050. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  1051. #==============================================================================
  1052.  
  1053. class Window_BattleEnemy < Window_Selectable
  1054.   #--------------------------------------------------------------------------
  1055.   # ☆ ウィンドウの非表示
  1056.   #--------------------------------------------------------------------------
  1057.   alias a1_psw_wbe_hide hide
  1058.   def hide
  1059.     @help_window.close
  1060.     a1_psw_wbe_hide
  1061.   end
  1062.   #--------------------------------------------------------------------------
  1063.   # ○ カーソルの移動処理
  1064.   #--------------------------------------------------------------------------
  1065.   def process_cursor_move
  1066.     return unless cursor_movable?
  1067.     last_index = @index
  1068.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  1069.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  1070.     cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  1071.     cursor_up   (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  1072.     Sound.play_cursor if @index != last_index
  1073.   end
  1074.   #--------------------------------------------------------------------------
  1075.   # ○ ヘルプテキスト更新
  1076.   #--------------------------------------------------------------------------
  1077.   def update_help
  1078.     @help_window.draw_center_text(enemy.name)
  1079.   end
  1080.   #--------------------------------------------------------------------------
  1081.   # ○ ヘルプウィンドウの設定
  1082.   #--------------------------------------------------------------------------
  1083.   def help_window=(window)
  1084.     @help_window = window
  1085.     @help_window.height = fitting_height(1)
  1086.     @help_window.create_contents
  1087.   end
  1088.   #--------------------------------------------------------------------------
  1089.   # ○ ウィンドウのアクティブ化
  1090.   #--------------------------------------------------------------------------
  1091.   def activate
  1092.     @help_window.open
  1093.     super
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ★ 桁数の取得
  1097.   #--------------------------------------------------------------------------
  1098.   def col_max
  1099.     return 1
  1100.   end
  1101. end
  1102. #==============================================================================
  1103. # ■ Window_BattleActor
  1104. #------------------------------------------------------------------------------
  1105. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  1106. #==============================================================================
  1107.  
  1108. class Window_BattleActor < Window_BattleStatus
  1109.   #--------------------------------------------------------------------------
  1110.   # ☆ ウィンドウの非表示
  1111.   #--------------------------------------------------------------------------
  1112.   alias a1_psw_wba_hide hide
  1113.   def hide
  1114.     @help_window.close
  1115.     a1_psw_wba_hide
  1116.   end
  1117.   #--------------------------------------------------------------------------
  1118.   # ○ カーソルの移動処理
  1119.   #--------------------------------------------------------------------------
  1120.   def process_cursor_move
  1121.     return unless cursor_movable?
  1122.     last_index = @index
  1123.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  1124.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  1125.     cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  1126.     cursor_up   (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  1127.     Sound.play_cursor if @index != last_index
  1128.   end
  1129.   #--------------------------------------------------------------------------
  1130.   # ○ アクターオブジェクト取得
  1131.   #--------------------------------------------------------------------------
  1132.   def actor
  1133.     $game_party.battle_members[@index]
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # ○ ヘルプテキスト更新
  1137.   #--------------------------------------------------------------------------
  1138.   def update_help
  1139.     @help_window.draw_center_text(actor.name)
  1140.   end
  1141.   #--------------------------------------------------------------------------
  1142.   # ○ ヘルプウィンドウの設定
  1143.   #--------------------------------------------------------------------------
  1144.   def help_window=(window)
  1145.     @help_window = window
  1146.     @help_window.height = fitting_height(1)
  1147.     @help_window.create_contents
  1148.   end
  1149.   #--------------------------------------------------------------------------
  1150.   # ○ ウィンドウのアクティブ化
  1151.   #--------------------------------------------------------------------------
  1152.   def activate
  1153.     @help_window.open
  1154.     super
  1155.   end
  1156. end
  1157. end


サイドビューバトルアクション設定
RUBY 代码复制
  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    サイドビューバトルアクション設定(RGSS3)
  4. #
  5. # バージョン   : 1.10 (2012/01/17)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・パトラッシュ・・・僕はもう疲れたよ・・・
  11. #---------------------------------------------------------------------------
  12. # 更新履歴   :2012/01/16 Ver1.00 リリース
  13. #            :2012/01/17 Ver1.10 防御待機追加
  14. #---------------------------------------------------------------------------
  15. # 設置場所      
  16. #    フェイスステータスウィンドウ以下
  17. #    個別バトルステータスウィンドウ以下
  18. #    バトルアクション以下
  19. #    (リザルトウィンドウ以下)
  20. #    (ダメージポップアップ以下)
  21. #    (Audioフェードイン以下)
  22. #
  23. # 必要スクリプト
  24. #    フェイスステータスウィンドウスクリプト
  25. #    個別バトルステータスウィンドウスクリプト
  26. #    バトルアクションスクリプト
  27. #---------------------------------------------------------------------------
  28. # 使い方
  29. #   ■ サイドビューアクション設定 に設定します
  30. #
  31. #   個別バトルステータスウィンドウのフォントサイズは
  32. #   個別バトルステータスウィンドウスクリプトののフォントサイズ依存になりました
  33. #
  34. #   二刀流の攻撃力補正値は撤廃になりました
  35. #   設定する際は「装備拡張」スクリプトが必要になります
  36. #---------------------------------------------------------------------------
  37. # 注意
  38. #   このスクリプトは「個別バトルステータスウィンドウ」のFACEモードを無効化します
  39. #   FACEモード時での動作は保証できませんので、FACEモードは false で使用してください
  40. #==============================================================================
  41. $imported ||= {}
  42. if $imported["A1_PersonalBattleStatus"] && $imported["A1_FaceStatusWindow"] && $imported["A1_BattleAction"]
  43. $imported["A1_SideViewBattleConfig"] = true
  44. old_common_script("サイドビューバトル", "4.20") if common_version < 4.20
  45. #==============================================================================
  46. # ■ サイドビューアクション設定
  47. #==============================================================================
  48. module A1_System::SideViewActionConfig
  49.   #--------------------------------------------------------------------------
  50.   # 戦闘画面突入時の位置
  51.   #--------------------------------------------------------------------------
  52.   INTT_POS     = [ [758, 152], [774, 208], [790, 264], [806, 320], [822, 376] ]
  53.   #--------------------------------------------------------------------------
  54.   # 戦闘中の定位置
  55.   #--------------------------------------------------------------------------
  56.   STANDARD_POS = [ [472, 250], [488, 304], [504, 364], [520, 418], [536, 476] ]
  57.   #--------------------------------------------------------------------------
  58.   # 個別バトルステータスウィンドウの位置
  59.   #--------------------------------------------------------------------------
  60.   WINDOW_POS   = [ [488, 181], [504, 237], [520, 293], [536, 349], [552, 405] ]
  61.   #--------------------------------------------------------------------------
  62.   # 敵のy座標補正値(+方向で画面下方に補正)
  63.   #--------------------------------------------------------------------------
  64.   TROOP_COMP_Y = 96
  65.   #--------------------------------------------------------------------------
  66.   # 二刀流時のTP増加量補正値(倍率)
  67.   #--------------------------------------------------------------------------
  68.   TSS_TP_RATE  = 0.5
  69.   #--------------------------------------------------------------------------
  70.   # 各アクションのメソッドシンボル
  71.   #   それぞれのアクションは、Game_Battler クラスのメソッドが呼ばれます
  72.   #   この項目にメソッドを追加することで、アクションを追加できます(上級者向け)
  73.   #
  74.   #   アクションを呼ぶ時は メソッドキー[引数1,引数2・・・] と記述し
  75.   #   メソッドは シンボル(params) で、params に引数が配列として渡されます
  76.   #--------------------------------------------------------------------------
  77.   ACTION_SYMBOL = {
  78.   #--------------------------------------------------------------------------
  79.   # 移動[params, ジャンプ]:移動アクションです
  80.   #      params   定位置[duration, wait]     定位置に戻ります
  81.   #               前進[duration, wait]       1歩前に移動します
  82.   #               後退[duration, wait]       1歩後に移動します
  83.   #               対象[duration, wait]       対象まで移動します
  84.   #               敵中心[duration, wait]     敵の中心まで移動します(アクター限定)
  85.   #               相対[x, y, duration, wait] x y で指定した相対座標まで移動します
  86.   #               絶対[x, y, duration, wait] x y で指定した絶対座標まで移動します
  87.   #
  88.   #               duration:移動にかける時間(フレーム数)
  89.   #               wait 移動完了までウェイト 省略すると待ちません
  90.   #
  91.   #     ジャンプ 移動をジャンプで行います
  92.   #               duration の値が大きいほど高くジャンプします
  93.   #--------------------------------------------------------------------------
  94.   "移動"     => :move_pos,
  95.   #--------------------------------------------------------------------------
  96.   # 直立[params]  歩行アニメーションの有無を設定するアクションです
  97.   #
  98.   #      params   予約 アクション終了後に直立します
  99.   #               解除 歩行アニメーションを再開します
  100.   #
  101.   #      params を省略し 直立 とすると、即座に直立します
  102.   #--------------------------------------------------------------------------
  103.   "直立"     => :set_pattern_fix,
  104.   #--------------------------------------------------------------------------
  105.   # 武器[action]  武器アクションを実行します
  106.   #               詳しくは「武器アクション」参照
  107.   #--------------------------------------------------------------------------
  108.   "武器"     => :weapon_action,
  109.   #--------------------------------------------------------------------------
  110.   # 実行[skip]    スキル/アイテムを実行します
  111.   #
  112.   #      skip     実行終了を待たずに次のアクションに進みます
  113.   #      skip を省略し 実行 とすると、スキル実行終了まで待ちます
  114.   #--------------------------------------------------------------------------
  115.   "実行"     => :proc_use_item,
  116.   #--------------------------------------------------------------------------
  117.   # アニメ[id,skip]  アニメーションを表示します
  118.   #
  119.   #        id        表示するアニメーションIDを指定します
  120.   #        skip      アニメーションの終了を待ちません 省略可
  121.   #--------------------------------------------------------------------------
  122.   "アニメ"   => :proc_animation,
  123.   #--------------------------------------------------------------------------
  124.   # 向き[direction, pattern]
  125.   #                 キャラクターの向きを設定します(アクター専用)
  126.   #
  127.   #      direction  上 下 左 右 で設定します
  128.   #      pattern    0 ~ 2 の値でパターンを設定します 省略可
  129.   #--------------------------------------------------------------------------
  130.   "向き"     => :change_direction,
  131.   #--------------------------------------------------------------------------
  132.   # キャラ[params] キャラクターアクションを実行します
  133.   #                詳しくはキャラクターアクションを参照のこと
  134.   #--------------------------------------------------------------------------
  135.   "キャラ"   => :character_action,
  136.   #--------------------------------------------------------------------------
  137.   # 状態[params] ステートアクションを実行します
  138.   #              詳しくはステートアクションを参照のこと
  139.   #--------------------------------------------------------------------------
  140.   "状態"     => :state_action,
  141.   #--------------------------------------------------------------------------
  142.   # 派生[action] アクションを派生させます
  143.   #               
  144.   #      action  記述したアクション名のアクションに派生し、戻ってきます
  145.   #               
  146.   # 派生[スキル[id]]
  147.   # 派生[アイテム[id]]
  148.   #
  149.   #      指定した id のスキル/アイテムに派生し、派生先で終了します
  150.   #--------------------------------------------------------------------------
  151.   "派生"     => :next_action,
  152.   #--------------------------------------------------------------------------
  153.   # 条件[condition, not] 条件を判断し、false の場合次のアクションを飛ばします
  154.   #
  155.   #      condition  二刀流             二刀流で両手に武器を持っている場合 true を返します
  156.   #                 スキル使用可[id]   id のスキルが使用可の場合 true を返します
  157.   #                 アイテム使用可[id] id のアイテムが使用可の場合 true を返します
  158.   #                 対象生存           攻撃対象のいずれかが生存している場合 true を返します
  159.   #
  160.   #      not        条件を反転させ、true の場合に次のアクションを飛ばします 省略可
  161.   #
  162.   # その他の条件は、アクション「条件」の追加項目 参照のこと
  163.   #--------------------------------------------------------------------------
  164.   "条件"     => :next_condition,
  165.   #--------------------------------------------------------------------------
  166.   # G変更[c_info, direction, pattern, pattern_fix]
  167.   #      キャラクターのグラフィックを変更します(アクター専用)
  168.   #            
  169.   #      c_info データベース「アクター」のメモ欄に設定したグラフィックを指定します
  170.   #        <サブ1 Actor4_ex,  7> と設定した場合 サブ1 を指定します
  171.   #        <サブ3 Actor4_ex2, 7> と設定した場合 サブ3 を指定します
  172.   #        データベースの設定は、名前の重複がなければ複数可
  173.   #
  174.   #      direction 向きを 上 下 左 右 で指定します
  175.   #
  176.   #      pattern     0 ~ 2 の値でパターンを設定します 省略可
  177.   #
  178.   #      pattern_fix 固定 とするとパターンを固定します
  179.   #--------------------------------------------------------------------------
  180.   "G変更"    => :change_graphic,
  181.   #--------------------------------------------------------------------------
  182.   # コラプス[許可] コラプスエフェクトを許可します
  183.   #--------------------------------------------------------------------------
  184.   "コラプス" => :set_collapse,
  185.   #--------------------------------------------------------------------------
  186.   # 繰り返し[num] num の回数だけ次のアクションを繰り返します
  187.   #--------------------------------------------------------------------------
  188.   "繰り返し" => :repeat_action,
  189.   #--------------------------------------------------------------------------
  190.   # ピクチャ[action] ピクチャの操作を行います
  191.   #                  詳しくはピクチャ操作を参照のこと
  192.   #--------------------------------------------------------------------------
  193.   "ピクチャ" => :picture_action,
  194.   #--------------------------------------------------------------------------
  195.   # 同時[action, member] 複数キャラクターを同時に行動させます
  196.   #
  197.   #      action 行動させるアクションを指定します
  198.   #      member Index[no,no,...]    指定したIndexのメンバーを同時に行動させます
  199.   #             名前[name,name,...] 指定した名前のメンバーを同時に行動させます(アクター専用)
  200.   #
  201.   #      member を省略すると全員が同時に行動します
  202.   #--------------------------------------------------------------------------
  203.   "同時"     => :parallel_action,
  204.   #--------------------------------------------------------------------------
  205.   # 中断  アクションを中断します
  206.   #
  207.   #   派生アクション中(スキル/アイテム指定除く)は 派生アクションを中断して
  208.   #   親アクションに戻ります
  209.   #
  210.   #   親アクション中に中断すると、定位置に戻ります
  211.   #--------------------------------------------------------------------------
  212.   "中断"     => :break_action,
  213.   #--------------------------------------------------------------------------
  214.   # ダメージ ダメージを与えます
  215.   #--------------------------------------------------------------------------
  216.   "ダメージ" => :proc_damage,
  217.   #--------------------------------------------------------------------------
  218.   # Audio オーディオを操作します
  219.   #
  220.   #   Audio[BGM[name, volume, pitch], 停止]
  221.   #   Audio[BGS[name, volume, pitch], 停止]
  222.   #   Audio[ME[name, volume, pitch], 停止]
  223.   #   Audio[SE[name, volume, pitch], 停止]
  224.   #
  225.   #     各種Audioの演奏/停止を行います
  226.   #     停止 を省略すると 演奏します
  227.   #
  228.   #   Audio[BGM[フェードアウト, duration]]
  229.   #   Audio[BGS[フェードアウト, duration]]
  230.   #
  231.   #     BGMやBGSを duration の時間をかけてフェードアウトします
  232.   #     duration は ミリ秒 単位で設定します
  233.   #
  234.   #   Audio[BGM[フェードイン, volume, duration]]
  235.   #   Audio[BGS[フェードイン, volume, duration]]
  236.   #
  237.   #     BGMやBGSを duration の時間をかけて volume までフェードインします
  238.   #     duration は ミリ秒 単位で設定します
  239.   #
  240.   #     フェードイン機能は「Audioフェードイン」スクリプトが必要です
  241.   #--------------------------------------------------------------------------
  242.   "Audio"      => :audio_action,
  243.   "使用武器"   => :use_weapon_pos,
  244.   }
  245.   #--------------------------------------------------------------------------
  246.   # アクション内容
  247.   #--------------------------------------------------------------------------
  248.   ACTION_LIST = {
  249.   #--------------------------------------------------------------------------
  250.   # プリセットアクション
  251.   #   ※ 内容の変更はOK、項目名を変更するとエラー発生
  252.   #--------------------------------------------------------------------------
  253.   "戦闘開始の登場"     => ["状態","条件[自身生存]","移動[定位置[30],ジャンプ]"],
  254.   "コマンド選択開始"   => ["状態","移動[前進[10]]","直立[予約]","ピクチャ[表示[<s>@name</s>立ち絵]]","ピクチャ[移動[立ち絵移動]]"],
  255.   "コマンド選択終了"   => ["ピクチャ[消去[1]]","状態","移動[定位置[10]]","状態[待機]","直立[解除]"],
  256.   "勝利アクション"     => ["同時[勝利アクション実行]"],
  257.   "勝利アクション実行" => ["状態[通常]","キャラ[高速回転l]","移動[{高ジャンプ}]", "キャラ[左を向く]", 5, "移動[{高速画面外}]"],
  258.   "初期位置にジャンプ" => ["移動[初期位置[30],ジャンプ]"],
  259.   "逃げる"             => ["同時[逃げる実行]"],
  260.   "逃げる実行"         => ["条件[自身生存]","向き[右]","移動[{逃げる画面外}]"],
  261.   "逃げる失敗"         => ["同時[逃げる失敗戻り]"],
  262.   "逃げる失敗戻り"     => ["条件[自身生存]","向き[左]","移動[{帰還}]"],
  263.  
  264.   "回避アクション"     => ["移動[{小J始}]","移動[{小J終}]","移動[{回避戻り}]"],
  265.   "敵回避アクション"   => ["移動[{敵小J始}]","移動[{敵小J終}]","派生[帰還]"],
  266.   "ダメージアクション" => ["移動[{ダメージ}]","移動[{帰還}]"],
  267.   "状態変化アクション" => ["状態"],
  268.   "帰還"               => ["条件[自身生存]","移動[{帰還}]","状態"],
  269.   "カウンターダメージ" => ["移動[{ダメージ}]","移動[{対象w}]"],
  270.   "回復アクション"     => ["状態","移動[{帰還}]"],
  271.   "身代わり動作"       => ["移動[身代わり[10w]]"],
  272.   "身代わられ動作"     => ["移動[後退[10]]"],
  273.   "身代わりダメージ"   => ["移動[{ダメージ}]","移動[{ダメージ戻り}]",10,"同時[同時帰還]"],
  274.   "身代わり回避"       => ["移動[{小J始}]","移動[{小J終}]","移動[{回避戻り}]",10,"同時[同時帰還]"],
  275.   "同時帰還"           => ["移動[{帰還}]"],
  276.  
  277.   "通常攻撃"           => ["移動[{対象w}]","直立","派生[武器振り実行]","条件[二刀流]","派生[二刀流攻撃]","派生[行動終了]"],
  278.   "武器振り実行"       => ["武器[振り]","実行"],
  279.   "二刀流攻撃"         => ["条件[対象生存, not]","中断","武器[振り]","使用武器[左]","実行"],
  280.   "防御"               => ["実行"],
  281.   "汎用スキル使用"     => ["移動[前進[{10w}]]","武器[掲げ]","アニメ[{詠唱}]",15,"武器[振り]","実行","派生[行動終了]"],
  282.   "汎用アイテム使用"   => ["移動[前進[{10w}]]","武器[振り]","実行","派生[行動終了]"],
  283.   "行動終了"           => ["コラプス[許可]","派生[帰還]"],
  284.   #--------------------------------------------------------------------------
  285.   # スキルアクション
  286.   #
  287.   #   データベース「スキル」「アイテム」「武器」のメモ欄に
  288.   #   <SVアクション アクション名> と記述すると
  289.   #   以下で設定するアクションを実行します
  290.   #
  291.   #   また「バトルアクション」スクリプトで設定したアクションも有効です
  292.   #   その場合、アクション「実行」時にバトルアクションのアクションを実行します
  293.   #
  294.   #   アクションを設定していないスキルは
  295.   #   データベース「スキル」の「攻撃属性」が「通常攻撃」なら 通常攻撃 を
  296.   #   「通常攻撃」以外なら 汎用スキル使用 を実行します
  297.   #
  298.   #   アクションを設定していないアイテムは 汎用アイテム使用 を実行します
  299.   #
  300.   #   スキル「防御」(スキルID 2) は 防御 を実行します
  301.   #
  302.   #   データベース「エネミー」のメモ欄に
  303.   #   <エネミー武器 id> と記述すると
  304.   #   エネミーの通常攻撃のアニメーションが指定した id の武器アニメーションになります
  305.   #
  306.   #   数字のみのアクションは 数字分のフレームウェイトします
  307.   #--------------------------------------------------------------------------
  308.   "桜花夢幻刃"         => ["移動[敵中心[{10w}]]","直立","武器[振り]","実行","派生[行動終了]"],
  309.   "トリプルショット"   => ["移動[前進[{10w}]]","武器[振り]","実行","派生[スキル[109]]","派生[行動終了]"],
  310.   "サウザンドアロー"   => ["移動[前進[{10w}]]","武器[振り]","実行","派生[行動終了]"],
  311.   "三回攻撃"           => ["移動[{対象w}]","直立","繰り返し[3]","派生[武器振り実行]","派生[行動終了]"],
  312.   "弓発射"             => ["移動[前進[{10w}]]",10,"アニメ[{弓発射}]",20,"実行","派生[行動終了]"],
  313.   }
  314.   #--------------------------------------------------------------------------
  315.   # 汎用アクションパラメータ
  316.   #
  317.   #   {} で囲まれた部分は汎用アクションパラメータで設定した項目に置き換わります
  318.   #   汎用アクションパラメータで{}を使うことも可能です
  319.   #
  320.   #   移動[{帰還}] としたアクションは
  321.   #   移動[定位置[{10w}]] と記述するのと同じで、{10w}も汎用アクションパラメータなので
  322.   #   移動[定位置[10,wait]] が最終的なアクションになります
  323.   #--------------------------------------------------------------------------
  324.   ACTION_PARAMS = {
  325.   "ダメージ"       => "相対[32, 0, 5, wait]",
  326.   "ダメージ戻り"   => "相対[-32, 0, 5, wait]",
  327.   "回避戻り"       => "相対[-64, 0,10, wait]",
  328.   "対象w"          => "対象[{10w}]",
  329.   "詠唱"           => "44,自身,skip",
  330.   "弓発射"         => "111,自身,skip",
  331.   "帰還"           => "定位置[{10w}]",
  332.   "10w"            => "10,wait",
  333.   "5w"             => "5,wait",
  334.   "高ジャンプ"     => "相対[0, 0, 30, wait],ジャンプ",
  335.   "小J始"          => "相対[32, -32, 5, wait]",
  336.   "小J終"          => "相対[32,  32, 5, wait]",
  337.   "敵小J始"        => "相対[-32, -32, 5, wait]",
  338.   "敵小J終"        => "相対[-32,  32, 5, wait]",
  339.   "高速画面外"     => "絶対[-64, <s>@screen_y</s>, 20]",
  340.   "逃げる画面外"   => "絶対[<s>Graphics.width + 64</s>, <s>@screen_y</s>, 10, wait]",
  341.   "4方向高速回転"  => ["向き[左]", 2, "向き[上]", 2, "向き[右]", 2, "向き[下]", 2],
  342.   }
  343.   #--------------------------------------------------------------------------
  344.   # アクション「条件」の追加項目(上級者向け)
  345.   #
  346.   #   条件[設定例] とした 設定例 の部分をハッシュのキーに
  347.   #   <s>スクリプト</s> で記述したスクリプトを用いて条件を追加します
  348.   #
  349.   #   スクリプトの実行は Game_Battler クラスで行います
  350.   #--------------------------------------------------------------------------
  351.   CONDITION_LIST = {
  352.   "設定例"    => "<s>@name == \"エリック\"</s>"
  353.   }
  354.   #--------------------------------------------------------------------------
  355.   # ピクチャ操作
  356.   #
  357.   #   基本的にイベントコマンド「ピクチャの表示」「ピクチャの移動」・・・等に準拠します
  358.   #
  359.   #   ピクチャ名を「バトラー」にすると
  360.   #   データベース「アクター」のメモ欄に <バトラー picture_name> とした
  361.   #   ピクチャを表示します
  362.   #
  363.   #   「表示」「移動」「回転」「色調」全てこの項目で設定します
  364.   #--------------------------------------------------------------------------
  365.   PICTURE_PARAMS = {
  366.                       # 番号, ピクチャ名,   原点,    x,  y, 横拡大, 縦拡大, 不透明度, 合成方法
  367.   "エリック立ち絵"   => [1,   "バトラー", "左上", -300,  0,     50,     50,      255,    0],
  368.   "アーネスト立ち絵" => [1,   "バトラー", "左上", -300,  0,     50,     50,      255,    0],
  369.   "ブレンダ立ち絵"   => [1,   "バトラー", "左上", -300,  0,     50,     50,      255,    0],
  370.   "アリス立ち絵"     => [1,   "バトラー", "左上", -300,  0,     50,     50,      255,    0],
  371.   "イザベル立ち絵"   => [1,   "バトラー", "左上", -300,  0,     50,     50,      255,    0],
  372.                       # 番号, 原点, x, y, 横拡大, 縦拡大, 不透明度, 合成方法, 時間
  373.   "立ち絵移動"       => [1, "左上", 0, 0,     50,     50,      255,        0,   10],
  374.   }
  375.   #--------------------------------------------------------------------------
  376.   # アクション対象のステート
  377.   #
  378.   #   アクション対象のステートです
  379.   #   追加する場合、以下のステートアクションも設定すること
  380.   #--------------------------------------------------------------------------
  381.   STATE_LIST   = ["戦闘不能","毒"]
  382.   #--------------------------------------------------------------------------
  383.   # ステートアクション
  384.   #
  385.   #   アクション対象のステートにかかった時や
  386.   #   待機時に実行するキャラクターアクションです
  387.   #
  388.   #   通常    :コマンド未入力時の状態です
  389.   #   通常待機:「攻撃」「防御」「アイテム」時の待機状態です
  390.   #   魔法待機:スキルタイプ「魔法」時の待機状態です
  391.   #   特技待機:スキルタイプ「特技」時の待機状態です
  392.   #
  393.   #   「○○待機」とすることでスキルタイプに対応した待機状態になります
  394.   #
  395.   #   戦闘不能:ステート「戦闘不能」時の待機状態です
  396.   #   毒      :ステート「毒」時の待機状態です
  397.   #
  398.   #   中断 を true にすると、アクション「状態」の後のアクションを中断します
  399.   #   吹き出しを 1 以上にすると該当する吹き出しが表示されます
  400.   #--------------------------------------------------------------------------
  401.   STATE_ACTIONS = {
  402.               # キャラクターアクション,中断, 吹き出し
  403.   "通常"     => ["通常時",             false, 0],
  404.   "通常待機" => ["左を向く",           false, 0],
  405.   "魔法待機" => ["左を向く",           false, 0],
  406.   "特技待機" => ["左を向く",           false, 0],
  407.   "防御待機" => ["防御待機",           false, 0],
  408.   "戦闘不能" => ["戦闘不能",           true,  0],
  409.   "毒"       => ["左を向く",           false, 7],
  410.   }
  411.   #--------------------------------------------------------------------------
  412.   # 武器アクション
  413.   #
  414.   #   武器(アイコン)に対してピクチャアクションを実行します
  415.   #   キャラクターアクションを設定していると、キャラクターアクションを実行します
  416.   #--------------------------------------------------------------------------
  417.   WEAPN_ACTION = {
  418.             # ピクチャアクション, キャラクターアクション
  419.   "振り" => ["振り"],
  420.   "掲げ" => ["掲げ"],
  421.   }
  422.   #--------------------------------------------------------------------------
  423.   # キャラクターアクション
  424.   #
  425.   #   アクションには「汎用アクションパラメータ」を設定することが可能です
  426.   #   ループを true にすると、一連のアクション終了後に最初にループします
  427.   #
  428.   #   ループすると、他のキャラクターアクションで上書きしない限り
  429.   #   ループを続けます
  430.   #
  431.   #   ピクチャアクションを指定すると、ピクチャアクションを実行します
  432.   #--------------------------------------------------------------------------
  433.   CHARACTER_ACTION = {
  434.                   # アクション,        ループ, ピクチャアクション
  435.   "高速回転l"  => ["{4方向高速回転}",         true],
  436.   "左を向く"   => [["向き[左]"],              false],
  437.   "防御待機"   => [["向き[左]","直立[予約]"], false],
  438.   "通常時"     => [["向き[左]","直立[解除]"], false, "通常"],
  439.   "戦闘不能"   => [["向き[上]","直立"],       false, "戦闘不能"],
  440.   }
  441.   #--------------------------------------------------------------------------
  442.   # ピクチャアクション
  443.   #
  444.   #   始 から 終 まで 時間 フレームかけて変化させていきます
  445.   #   「回転」に限り、終 には 始 から見た回転角度を指定します
  446.   #   -720 としたら、始 の角度から時計回りに720度(2回転)回転します
  447.   #
  448.   #   「色調」は配列で [red, green, blue, gray] を指定します
  449.   #   gray は省略可
  450.   #
  451.   #   消去 を true にすると、時間 フレーム後に消えます
  452.   #--------------------------------------------------------------------------
  453.   PICTURE_ACTION = {
  454.                # 始[x,  y, 回転, x拡大, y拡大, 色調, 透明], 終[  x,  y, 回転, x拡大, y拡大, 色調, 透明], 時間, 消去
  455.   "振り"     => [[  0,-32,  -90,   100,   100,  nil,  255],   [-10,  0,  180,   100,   100,  nil,  255],  10, false],
  456.   "掲げ"     => [[  0,-32,  -45,   100,   100,  nil,  255],   [  0,-32,    0,   100,   100,  nil,  255],  10, false],
  457.   "戦闘不能" => [[  0,  0,  -90,   100,   100,  nil,  255],   [  0,  0,    0,   100,   100,  nil,  255],   1, false],
  458.   "通常"     => [[  0,  0,    0,   100,   100,  nil,  255],   [  0,  0,    0,   100,   100,  nil,  255],   1, false],
  459.   }
  460. end
  461. end


サイドビューバトル
RUBY 代码复制
  1. #===========================================================================
  2. # ◆ A1 Scripts ◆
  3. #    サイドビューバトル基本スクリプト(RGSS3)
  4. #
  5. # バージョン   : 2.40 (2012/01/26)
  6. # 作者         : A1
  7. # URL     : [url]http://a1tktk.web.fc2.com/[/url]
  8. #---------------------------------------------------------------------------
  9. # 機能:
  10. # ・パトラッシュ・・・僕はもう疲れたよ・・・
  11. #---------------------------------------------------------------------------
  12. # 更新履歴   :2012/01/16 Ver1.00 リリース
  13. #            :2012/01/17 Ver1.10 同時アクションの見直し
  14. #            :2012/01/17 Ver1.10 防御待機追加
  15. #            :2012/01/17 Ver1.10 陣形対応
  16. #              :2012/01/17 Ver1.10 戦闘中入れ替え対応
  17. #              :2012/01/18 Ver2.00 A1バトル共通スクリプト対応
  18. #              :2012/01/18 Ver2.00 「逃げる」対応
  19. #              :2012/01/18 Ver2.00 「身代わり」対応
  20. #              :2012/01/18 Ver2.00 「反撃」「反射」対応
  21. #              :2012/01/19 Ver2.10 パーティ加入/脱退対応
  22. #              :2012/01/19 Ver2.10 イベントコマンド「注釈」からアクション発動実装
  23. #              :2012/01/21 Ver2.20 全体通常攻撃対応
  24. #              :2012/01/21 Ver2.20 装備拡張対応
  25. #              :2012/01/24 Ver2.30 スキル拡張対応
  26. #              :2012/01/24 Ver2.30 左利きの場合、左から攻撃するように変更
  27. #              :2012/01/26 Ver2.40 スキル拡張の新機能対応
  28. #---------------------------------------------------------------------------
  29. # 設置場所      
  30. #    サイドビューバトルアクション設定以下
  31. #
  32. # 必要スクリプト
  33. #    サイドビューバトルアクション設定
  34. #---------------------------------------------------------------------------
  35. # 使い方
  36. #   ■ サイドビューアクション設定 に設定します
  37. #
  38. #   バトル用イベントコマンド「注釈」に記述します
  39. #
  40. #     加入アクション アクション名
  41. #     脱退アクション アクション名
  42. #
  43. #       次にメンバーが加入/脱退した時に行うアクションを指定します
  44. #
  45. #     アクション実行 index|アクター名 アクション名
  46. #
  47. #       戦闘時のIndexか、アクター名を指定して
  48. #       指定したアクションを実行します
  49. #
  50. #       戦闘行動を伴うもの(攻撃など)は動作保証外です
  51. #==============================================================================
  52. $imported ||= {}
  53. if $imported["A1_SideViewBattleConfig"]
  54. $imported["A1_SideViewBattle"] = true
  55. old_common_script("サイドビューバトル", "4.20") if common_version < 4.20
  56. #==============================================================================
  57. # ■ A1_System::SideViewAction
  58. #==============================================================================
  59.  
  60. class A1_System::SideViewAction
  61.   #--------------------------------------------------------------------------
  62.   # ○ 公開インスタンス変数
  63.   #--------------------------------------------------------------------------
  64.   attr_reader   :action_list
  65.   attr_reader   :action_params
  66.   attr_reader   :action_symbol
  67.   attr_reader   :weapon_action
  68.   attr_reader   :character_action
  69.   attr_reader   :state_actions
  70.   attr_reader   :condition_list
  71.   attr_reader   :picture_params
  72.   #--------------------------------------------------------------------------
  73.   # ○ オブジェクト初期化
  74.   #--------------------------------------------------------------------------
  75.   def initialize
  76.     @action_list      = A1_System::SideViewActionConfig::ACTION_LIST
  77.     @action_symbol    = A1_System::SideViewActionConfig::ACTION_SYMBOL
  78.     @picture_action   = A1_System::SideViewActionConfig::PICTURE_ACTION
  79.     @weapon_action    = A1_System::SideViewActionConfig::WEAPN_ACTION
  80.     @character_action = A1_System::SideViewActionConfig::CHARACTER_ACTION
  81.     @action_params    = A1_System::SideViewActionConfig::ACTION_PARAMS
  82.     @state_actions    = A1_System::SideViewActionConfig::STATE_ACTIONS
  83.     @condition_list   = A1_System::SideViewActionConfig::CONDITION_LIST
  84.     @picture_params   = A1_System::SideViewActionConfig::PICTURE_PARAMS
  85.     @action_cache     = {}
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ○ ピクチャアクション
  89.   #--------------------------------------------------------------------------
  90.   def picture_action(kind)
  91.     key = "picture_#{kind}"
  92.     @action_cache[key] ||= A1_System::SpriteAction.new(@picture_action[kind])
  93.     return @action_cache[key]
  94.   end
  95. end
  96. #==============================================================================
  97. # ■ A1_System::SpriteAction
  98. #==============================================================================
  99.  
  100. class A1_System::SpriteAction
  101.   #--------------------------------------------------------------------------
  102.   # ○ 公開インスタンス変数
  103.   #--------------------------------------------------------------------------
  104.   attr_reader   :st_x
  105.   attr_reader   :st_y
  106.   attr_reader   :st_angle
  107.   attr_reader   :st_zoom_x
  108.   attr_reader   :st_zoom_y
  109.   attr_reader   :st_tone
  110.   attr_reader   :st_opacity
  111.   attr_reader   :ed_x
  112.   attr_reader   :ed_y
  113.   attr_reader   :ed_angle
  114.   attr_reader   :ed_zoom_x
  115.   attr_reader   :ed_zoom_y
  116.   attr_reader   :ed_tone
  117.   attr_reader   :ed_opacity
  118.   attr_reader   :duration
  119.   attr_reader   :erase
  120.   #--------------------------------------------------------------------------
  121.   # ○ オブジェクト初期化
  122.   #--------------------------------------------------------------------------
  123.   def initialize(info)
  124.     action_start = info[0]
  125.     action_end   = info[1]
  126.     @duration    = info[2]
  127.     @erase       = info[3]
  128.     @st_x        = action_start[0]
  129.     @st_y        = action_start[1]
  130.     @st_angle    = action_start[2]
  131.     @st_zoom_x   = action_start[3]
  132.     @st_zoom_y   = action_start[4]
  133.     @st_tone     = action_start[5]
  134.     @st_opacity  = action_start[6]
  135.     @ed_x        = action_end[0]
  136.     @ed_y        = action_end[1]
  137.     @ed_angle    = action_end[2]
  138.     @ed_zoom_x   = action_end[3]
  139.     @ed_zoom_y   = action_end[4]
  140.     @ed_tone     = action_end[5]
  141.     @ed_opacity  = action_end[6]
  142.   end
  143. end
  144. #==============================================================================
  145. # ■ RPG::Troop::Member
  146. #==============================================================================
  147.  
  148. class RPG::Troop::Member
  149.   #--------------------------------------------------------------------------
  150.   # ○ x座標
  151.   #--------------------------------------------------------------------------
  152.   def y
  153.     return @y + A1_System::SideViewActionConfig::TROOP_COMP_Y
  154.   end
  155. end
  156. #==============================================================================
  157. # ■ RPG::Weapon
  158. #==============================================================================
  159.  
  160. class RPG::Weapon < RPG::EquipItem
  161.   #--------------------------------------------------------------------------
  162.   # ○ サイドビューアイコン
  163.   #--------------------------------------------------------------------------
  164.   def sv_icon
  165.     @sv_icon ||= $a1_common.note_data_one(self.note, "SVアイコン", -1).to_i
  166.     return @sv_icon
  167.   end
  168. end
  169. #==============================================================================
  170. # ■ RPG::Actor
  171. #==============================================================================
  172.  
  173. class RPG::Actor < RPG::BaseItem
  174.   #--------------------------------------------------------------------------
  175.   # ○ マルチキャラクター
  176.   #--------------------------------------------------------------------------
  177.   def multi_character(kind)
  178.     @multi_character ||= {}
  179.     @multi_character[kind] ||= $a1_common.note_data_array_str(self.note, kind, [@character_name, @character_index])
  180.     return @multi_character[kind]
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ○ バトラーピクチャ
  184.   #--------------------------------------------------------------------------
  185.   def battler_picture
  186.     @battler_picture ||= $a1_common.note_data_one(self.note, "バトラー", "")
  187.     return @battler_picture
  188.   end
  189. end
  190. #==============================================================================
  191. # ■ RPG::Enemy
  192. #==============================================================================
  193.  
  194. class RPG::Enemy < RPG::BaseItem
  195.   #--------------------------------------------------------------------------
  196.   # ○ バトラーピクチャ
  197.   #--------------------------------------------------------------------------
  198.   def battler_picture
  199.     @battler_picture ||= $a1_common.note_data_one(self.note, "バトラー", "")
  200.     return @battler_picture
  201.   end
  202. end
  203. #==============================================================================
  204. # ■ Game_Enemy
  205. #------------------------------------------------------------------------------
  206. #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の
  207. # 内部で使用されます。
  208. #==============================================================================
  209.  
  210. class Game_Enemy < Game_Battler
  211.   #--------------------------------------------------------------------------
  212.   # ☆ オブジェクト初期化
  213.   #--------------------------------------------------------------------------
  214.   alias a1_side_view_ge_initialize initialize
  215.   def initialize(index, enemy_id)
  216.     a1_side_view_ge_initialize(index, enemy_id)
  217.     @battler_picture = enemy.battler_picture
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ○ 標準位置を設定
  221.   #--------------------------------------------------------------------------
  222.   def set_standard_pos
  223.     @standard_x = @screen_x
  224.     @standard_y = @screen_y
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ○ 通常攻撃 アニメーション ID の取得
  228.   #--------------------------------------------------------------------------
  229.   def atk_animation_id1
  230.     if dual_wield?
  231.       return weapons[0].animation_id if weapons[0]
  232.       return weapons[1] ? 0 : 1
  233.     else
  234.       return weapons[0] ? weapons[0].animation_id : 1
  235.     end
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
  239.   #--------------------------------------------------------------------------
  240.   def atk_animation_id2
  241.     if dual_wield?
  242.       return weapons[1] ? weapons[1].animation_id : 0
  243.     else
  244.       return 0
  245.     end
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ★ 通常能力値の加算値取得
  249.   #--------------------------------------------------------------------------
  250.   def param_plus(param_id)
  251.     super
  252.   end
  253. end
  254. #==============================================================================
  255. # ■ RPG::UsableItem
  256. #==============================================================================
  257.  
  258. class RPG::BaseItem
  259.   #--------------------------------------------------------------------------
  260.   # ○ アクション
  261.   #--------------------------------------------------------------------------
  262.   def sv_action
  263.     @sv_action = $a1_common.note_data_one(self.note, "SVアクション", "")
  264.     return @sv_action
  265.   end
  266. end
  267. #==============================================================================
  268. # ■ BattleManager
  269. #------------------------------------------------------------------------------
  270. #  戦闘の進行を管理するモジュールです。
  271. #==============================================================================
  272.  
  273. module BattleManager
  274.   #--------------------------------------------------------------------------
  275.   # ○ エイリアス用特異メソッド
  276.   #--------------------------------------------------------------------------
  277.   class << self
  278.     alias :a1_side_view_bm_battle_start :battle_start
  279.     alias :a1_side_view_bm_play_battle_end_me :play_battle_end_me
  280.     alias :a1_side_view_bm_process_escape :process_escape
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ☆ 戦闘開始
  284.   #--------------------------------------------------------------------------
  285.   def self.battle_start
  286.     call_method(:move_start_pos)
  287.     a1_side_view_bm_battle_start
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ○ サイドビューアクション取得
  291.   #--------------------------------------------------------------------------
  292.   def self.side_view_actions
  293.     @side_view_actions ||= A1_System::SideViewAction.new
  294.     return @side_view_actions
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ○ 移動先ターゲットの設定
  298.   #--------------------------------------------------------------------------
  299.   def self.move_target=(target)
  300.     @move_target = target
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ○ 移動先ターゲットの取得
  304.   #--------------------------------------------------------------------------
  305.   def self.move_target
  306.     @move_target
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ○ 全ターゲットの設定
  310.   #--------------------------------------------------------------------------
  311.   def self.all_targets=(targets)
  312.     @all_targets = targets
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ○ 全ターゲットの取得
  316.   #--------------------------------------------------------------------------
  317.   def self.all_targets
  318.     @all_targets
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ○ アクションウェイトの設定
  322.   #--------------------------------------------------------------------------
  323.   def self.action_wait_skip=(flag)
  324.     @action_wait_skip = flag
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ○ アクションウェイトの取得
  328.   #--------------------------------------------------------------------------
  329.   def self.action_wait_skip
  330.     @action_wait_skip
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ☆ 戦闘終了 ME の演奏
  334.   #--------------------------------------------------------------------------
  335.   def self.play_battle_end_me
  336.     a1_side_view_bm_play_battle_end_me
  337.     call_method(:victory_action)
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ☆ 逃走の処理
  341.   #--------------------------------------------------------------------------
  342.   def self.process_escape
  343.     success = a1_side_view_bm_process_escape
  344.     call_method(:escape_failure) unless success
  345.     return success
  346.   end
  347. end
  348. #==============================================================================
  349. # ■ Window_BattleActors
  350. #==============================================================================
  351.  
  352. class Window_BattleActors < Window_Base
  353.   #--------------------------------------------------------------------------
  354.   # ○ 定数
  355.   #--------------------------------------------------------------------------
  356.   WINDOW_POS = A1_System::SideViewActionConfig::WINDOW_POS
  357.   #--------------------------------------------------------------------------
  358.   # ★ ウィンドウ位置のセット(個別バトルステータスウィンドウの再定義)
  359.   #--------------------------------------------------------------------------
  360.   def setup_window_pos(index)
  361.     width       = 68 + (FONT_SIZE - 18) * 4
  362.     @line_num   = 3
  363.     height      = fitting_height(@line_num)
  364.     pos         = window_pos(index)
  365.     self.x      = pos[0]
  366.     self.y      = pos[1]
  367.     self.width  = width
  368.     self.height = height
  369.     create_contents
  370.     self.contents.font.size = FONT_SIZE
  371.     @state_icon_window.dispose if @state_icon_window
  372.     @state_icon_window = Window_StateIcons.new(self.x + 48, self.y + line_height + 8)
  373.     @target_y = self.y
  374.     @org_y    = self.y
  375.     refresh
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # ○ ウィンドウ位置の取得
  379.   #--------------------------------------------------------------------------
  380.   def window_pos(index)
  381.     WINDOW_POS[index]
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ○ 情報の描画
  385.   #--------------------------------------------------------------------------
  386.   def draw_info
  387.     draw_actor_hp(@actor, 0, draw_y(0), 44+ (FONT_SIZE - 18) * 4)
  388.     draw_actor_mp(@actor, 0, draw_y(1), 44+ (FONT_SIZE - 18) * 4)
  389.     draw_actor_tp(@actor, 0, draw_y(2), 44+ (FONT_SIZE - 18) * 4)
  390.     @state_icon_window.state_icons = (@actor.state_icons + @actor.buff_icons)
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ○ 描画するy座標
  394.   #--------------------------------------------------------------------------
  395.   def draw_y(index)
  396.     (line_height - 8) * index
  397.   end
  398.   #--------------------------------------------------------------------------
  399.   # ○ 1行の高さ
  400.   #--------------------------------------------------------------------------
  401.   def line_height
  402.     return 24
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ○ ステートおよび強化/弱体のアイコンを描画
  406.   #--------------------------------------------------------------------------
  407.   def draw_actor_icons(actor, x, y, width = 96)
  408.     icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
  409.     icons.each_with_index {|n, i| draw_icon(n, x, y - 24 * i) }
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ○ フレーム更新
  413.   #--------------------------------------------------------------------------
  414.   def update
  415.     super
  416.     update_state_icons
  417.   end
  418.   #--------------------------------------------------------------------------
  419.   # ○ 解放
  420.   #--------------------------------------------------------------------------
  421.   def dispose
  422.     @state_icon_window.dispose
  423.     super
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ○ ステートアイコンの更新
  427.   #--------------------------------------------------------------------------
  428.   def update_state_icons
  429.     @state_icon_window.update
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ○ 可視状態の変更
  433.   #--------------------------------------------------------------------------
  434.   def visible=(flag)
  435.     super
  436.     @state_icon_window.visible = flag if @state_icon_window
  437.   end
  438. end
  439. #==============================================================================
  440. # ■ Window_StateIcons
  441. #==============================================================================
  442.  
  443. class Window_StateIcons < Window_Base
  444.   #--------------------------------------------------------------------------
  445.   # ○ 定数
  446.   #--------------------------------------------------------------------------
  447.   MOVE_COUNT = 24
  448.   DRAW_COUNT = 60
  449.   #--------------------------------------------------------------------------
  450.   # ○ オブジェクト初期化
  451.   #--------------------------------------------------------------------------
  452.   def initialize(x ,y)
  453.     @state_icons = []
  454.     @draw_count  = 0
  455.     @move_count  = 0
  456.     @icon_draw   = false
  457.     @icon_index  = 0
  458.     super(x, y, 48, 48)
  459.     skin = Cache.system("Window").clone
  460.     skin.clear_rect(80, 16, 32, 32)
  461.     self.windowskin = skin
  462.     self.opacity = 0
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # ○ ステートアイコンの設定
  466.   #--------------------------------------------------------------------------
  467.   def state_icons=(icons)
  468.     return if @state_icons == icons
  469.     @state_icons = icons
  470.     clear
  471.     draw_icon(@state_icons[0], 0, 0) if !@icon_draw && @state_icons.size > 0
  472.     @draw_count = DRAW_COUNT if @state_icons.size > 1
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ○ クリア
  476.   #--------------------------------------------------------------------------
  477.   def clear
  478.     contents.clear
  479.     @icon_draw = false if @state_icons.size == 0
  480.     @icon_index = @state_icons.size - 1 if @icon_index >= @state_icons.size
  481.     @draw_count = 0 if @state_icons.size <= 1
  482.     @move_count = 0 if @state_icons.size <= 1
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ○ ステートアイコンの描画
  486.   #--------------------------------------------------------------------------
  487.   def draw_state_icon(icon_index, x, y)
  488.     draw_icon(icon_index, x, y)
  489.     @icon_draw = true
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ○ フレーム更新
  493.   #--------------------------------------------------------------------------
  494.   def update
  495.     super
  496.     update_state_icons if @draw_count > 0
  497.     update_sprite_move if @move_count > 0
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ○ ステートアイコン移動の更新
  501.   #--------------------------------------------------------------------------
  502.   def update_sprite_move
  503.     @move_count -= 1
  504.     self.ox += 1
  505.     return if @move_count > 0
  506.     contents.clear_rect(0, 0, 24, 24)
  507.     draw_icon(@state_icons[@icon_index], 0, 0)
  508.     self.ox = 0
  509.     @draw_count = DRAW_COUNT
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ○ ステートアイコンの更新
  513.   #--------------------------------------------------------------------------
  514.   def update_state_icons
  515.     @draw_count -= 1
  516.     return if @draw_count > 0
  517.     @icon_index += 1
  518.     @icon_index = 0 if @icon_index == @state_icons.size
  519.     contents.clear_rect(24, 0, 24, 24)
  520.     draw_icon(@state_icons[@icon_index], 24, 0)
  521.     @move_count = MOVE_COUNT
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ○ ウィンドウ内容の幅を計算
  525.   #--------------------------------------------------------------------------
  526.   def contents_width
  527.     return 48
  528.   end
  529. end
  530. #==============================================================================
  531. # ■ Window_NameActor
  532. #==============================================================================
  533.  
  534. class Window_NameActor < Window_Base
  535.   #--------------------------------------------------------------------------
  536.   # ○ オブジェクト初期化
  537.   #--------------------------------------------------------------------------
  538.   def initialize(main_window)
  539.     @text = ""
  540.     @main_window = main_window
  541.     super(0, @main_window.y, 0, fitting_height(1))
  542.     self.openness = 0
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ○ リフレッシュ
  546.   #--------------------------------------------------------------------------
  547.   def refresh
  548.     contents.clear
  549.     draw_text(0, 0, contents.width, line_height, @text, 1)
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ○ テキストの設定
  553.   #--------------------------------------------------------------------------
  554.   def text=(str)
  555.     @text = str
  556.     self.width = $a1_common.text_width(contents.font, @text) + standard_padding * 2
  557.     self.x     = @main_window.x - self.width
  558.     create_contents
  559.     refresh
  560.   end
  561. end
  562. #==============================================================================
  563. # ■ Window_BattleLog
  564. #------------------------------------------------------------------------------
  565. #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド
  566. # ウとして扱います。
  567. #==============================================================================
  568.  
  569. class Window_BattleLog < Window_Selectable
  570.   #--------------------------------------------------------------------------
  571.   # ☆ ウェイト
  572.   #--------------------------------------------------------------------------
  573.   alias a1_side_view_sbl_wait wait
  574.   def wait
  575.     a1_side_view_sbl_wait unless @skip_wait_for_action
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ☆ HP ダメージ表示
  579.   #--------------------------------------------------------------------------
  580.   alias a1_side_view_sbl_display_hp_damage display_hp_damage
  581.   def display_hp_damage(target, item)
  582.     @skip_wait_for_action = true if target.hp <= 0 || target.actor?
  583.     a1_side_view_sbl_display_hp_damage(target, item)
  584.     proc_damage_action(target) if target.actor?
  585.     @counter = false
  586.     @skip_wait_for_action = false
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ○ 身代わりアクション
  590.   #--------------------------------------------------------------------------
  591.   def substitute_action(kind)
  592.     @substitute.proc_action("身代わりダメージ") if kind == "ダメージ"
  593.     @substitute.proc_action("身代わり回避")     if kind == "回避"
  594.     @substitute.substitute_target = nil if @substitute
  595.     @substitute = nil
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ○ ダメージアクションの実行
  599.   #--------------------------------------------------------------------------
  600.   def proc_damage_action(target)
  601.     return if target.result.hp_damage == 0
  602.     return target.proc_action("回復アクション")        if target.result.hp_damage < 0
  603.     return target.proc_action("カウンターダメージ")    if @counter
  604.     return substitute_action("ダメージ")               if @substitute
  605.     target.proc_action("ダメージアクション")
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ☆ 反撃の表示
  609.   #--------------------------------------------------------------------------
  610.   alias a1_side_view_sbl_display_counter display_counter
  611.   def display_counter(target, item)
  612.     @counter = true
  613.     a1_side_view_sbl_display_counter(target, item)
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ☆ 反射の表示
  617.   #--------------------------------------------------------------------------
  618.   alias a1_side_view_sbl_display_reflection display_reflection
  619.   def display_reflection(target, item)
  620.     @counter = true
  621.     a1_side_view_sbl_display_reflection(target, item)
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ☆ 身代わりの表示
  625.   #--------------------------------------------------------------------------
  626.   alias a1_side_view_sbl_display_substitute display_substitute
  627.   def display_substitute(substitute, target)
  628.     substitute.substitute_target = target.index
  629.     target.proc_action("身代わられ動作")   if target.actor?
  630.     substitute.proc_action("身代わり動作") if target.actor?
  631.     @substitute = substitute
  632.     a1_side_view_sbl_display_substitute(substitute, target)
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ☆ ステート付加の表示
  636.   #--------------------------------------------------------------------------
  637.   alias a1_side_view_sbl_display_added_states display_added_states
  638.   def display_added_states(target)
  639.     a1_side_view_sbl_display_added_states(target)
  640.     target.proc_action("状態変化アクション")
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ☆ ステート解除の表示
  644.   #--------------------------------------------------------------------------
  645.   alias a1_side_view_sbl_display_removed_states display_removed_states
  646.   def display_removed_states(target)
  647.     a1_side_view_sbl_display_removed_states(target)
  648.     target.proc_action("状態変化アクション")
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ☆ ミスの表示
  652.   #--------------------------------------------------------------------------
  653.   alias a1_side_view_sbl_display_miss display_miss
  654.   def display_miss(target, item)
  655.     @skip_wait_for_action = true
  656.     a1_side_view_sbl_display_miss(target, item)
  657.     proc_evasion_action(target)
  658.     @skip_wait_for_action = false
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # ☆ 回避の表示
  662.   #--------------------------------------------------------------------------
  663.   alias a1_side_view_sbl_display_evasion display_evasion
  664.   def display_evasion(target, item)
  665.     @skip_wait_for_action = true
  666.     a1_side_view_sbl_display_evasion(target, item)
  667.     proc_evasion_action(target)
  668.     @skip_wait_for_action = false
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ○ 回避アクションの実行
  672.   #--------------------------------------------------------------------------
  673.   def proc_evasion_action(target)
  674.     return substitute_action("回避")     if @substitute
  675.     target.proc_action("回避アクション") if target.actor?
  676.     target.proc_action("敵回避アクション") unless target.actor?
  677.   end
  678. end
  679. #==============================================================================
  680. # ■ Window_BattleActor
  681. #------------------------------------------------------------------------------
  682. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  683. #==============================================================================
  684.  
  685. class Window_BattleActor < Window_BattleStatus
  686.   #--------------------------------------------------------------------------
  687.   # ○ ヘルプテキスト更新
  688.   #--------------------------------------------------------------------------
  689.   alias a1_wide_view_wba_update_help update_help
  690.   def update_help
  691.     @help_window.width = $a1_common.text_width(@help_window.contents.font, actor.name) + standard_padding * 2
  692.     @help_window.x = actor.screen_x - @help_window.width - 48
  693.     @help_window.y = actor.screen_y - 64
  694.     @help_window.create_contents
  695.     a1_wide_view_wba_update_help
  696.   end
  697. end
  698. #==============================================================================
  699. # ■ Window_BattleEnemy
  700. #------------------------------------------------------------------------------
  701. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
  702. #==============================================================================
  703.  
  704. class Window_BattleEnemy < Window_Selectable
  705.   #--------------------------------------------------------------------------
  706.   # ○ ヘルプテキスト更新
  707.   #--------------------------------------------------------------------------
  708.   alias a1_wide_view_wbe_update_help update_help
  709.   def update_help
  710.     @help_window.width = $a1_common.text_width(@help_window.contents.font, enemy.name) + standard_padding * 2
  711.     @help_window.x = [enemy.screen_x - @help_window.width, 0].max
  712.     @help_window.y = enemy.screen_y
  713.     @help_window.create_contents
  714.     a1_wide_view_wbe_update_help
  715.   end
  716. end
  717. #==============================================================================
  718. # ■ Scene_Battle
  719. #------------------------------------------------------------------------------
  720. #  バトル画面の処理を行うクラスです。
  721. #==============================================================================
  722.  
  723. class Scene_Battle < Scene_Base
  724.   #--------------------------------------------------------------------------
  725.   # ○ 定数
  726.   #--------------------------------------------------------------------------
  727.   INTT_POS = A1_System::SideViewActionConfig::INTT_POS
  728.   #--------------------------------------------------------------------------
  729.   # ○ エイリアス
  730.   #--------------------------------------------------------------------------
  731.   alias a1_side_view_sb_execute_action execute_action
  732.   alias a1_side_view_sb_use_item use_item
  733.   alias a1_side_view_sb_show_animation show_animation
  734.   #--------------------------------------------------------------------------
  735.   # ☆ バトルマネージャメソッドのセットアップ
  736.   #--------------------------------------------------------------------------
  737.   alias a1_side_view_sb_define_battle_manager_method define_battle_manager_method
  738.   def define_battle_manager_method
  739.     a1_side_view_sb_define_battle_manager_method
  740.     BattleManager.define_method(method(:a1_side_view_sb_use_item),       :use_item)
  741.     BattleManager.define_method(method(:a1_side_view_sb_execute_action), :execute_action)
  742.     BattleManager.define_method(method(:wait_for_move),                  :wait_for_move)
  743.     BattleManager.define_method(method(:action_icon),                    :action_icon)
  744.     BattleManager.define_method(method(:a1_side_view_sb_show_animation), :show_animation)
  745.     BattleManager.define_method(method(:move_start_pos),                 :move_start_pos)
  746.     BattleManager.define_method(method(:set_wait_collapse),              :set_wait_collapse)
  747.     BattleManager.define_method(method(:victory_action),                 :victory_action)
  748.     BattleManager.define_method(method(:invoke_item),                    :invoke_item)
  749.     BattleManager.define_method(method(:escape_failure),                 :escape_failure)
  750.     BattleManager.define_method(method(:setup_actor_battler),            :setup_actor_battler)
  751.     BattleManager.define_method(method(:setup_status_windows),           :setup_status_windows)
  752.     BattleManager.define_method(method(:change_battler_sprite),          :change_battler_sprite)
  753.     BattleManager.define_method(method(:proc_event_action),              :proc_event_action)
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # ☆ 全ウィンドウの作成
  757.   #--------------------------------------------------------------------------
  758.   alias a1_side_view_sb_create_all_windows create_all_windows
  759.   def create_all_windows
  760.     a1_side_view_sb_create_all_windows
  761.     create_actor_name_window
  762.   end
  763.   #--------------------------------------------------------------------------
  764.   # ☆ スキルウィンドウ作成の後処理
  765.   #--------------------------------------------------------------------------
  766.   alias a1_side_view_post_create_skill_window post_create_skill_window
  767.   def post_create_skill_window
  768.     a1_side_view_post_create_skill_window
  769.     @skill_window.resize_height(Graphics.height - 120)
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # ○ アイテムウィンドウ作成の後処理
  773.   #--------------------------------------------------------------------------
  774.   alias a1_side_view_post_create_item_window post_create_item_window
  775.   def post_create_item_window
  776.     @item_window.resize_height(Graphics.height - 120)
  777.   end
  778.   #--------------------------------------------------------------------------
  779.   # ○ スキル/アイテムウィンドウが表示された時の処理
  780.   #--------------------------------------------------------------------------
  781.   alias a1_side_view_skill_item_window_show skill_item_window_show
  782.   def skill_item_window_show
  783.     a1_side_view_skill_item_window_show
  784.     @face_status_window.open
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # ○ スキル/アイテムウィンドウが非表示になった時の処理
  788.   #--------------------------------------------------------------------------
  789.   alias a1_side_view_skill_item_window_hide skill_item_window_hide
  790.   def skill_item_window_hide
  791.     @face_status_window.close
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ○ アクターネームウィンドウ作成
  795.   #--------------------------------------------------------------------------
  796.   def create_actor_name_window
  797.     @actor_name_window = Window_NameActor.new(@actor_command_window)
  798.   end
  799.   #--------------------------------------------------------------------------
  800.   # ☆ アクターコマンドウィンドウがオープンした時の処理
  801.   #--------------------------------------------------------------------------
  802.   alias a1_side_view_sb_actor_command_open actor_command_open
  803.   def actor_command_open
  804.     a1_side_view_sb_actor_command_open
  805.     @actor_name_window.open
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ☆ アクターコマンドウィンドウがクローズした時の処理
  809.   #--------------------------------------------------------------------------
  810.   alias a1_side_view_sb_actor_command_close actor_command_close
  811.   def actor_command_close
  812.     a1_side_view_sb_actor_command_close
  813.     @actor_name_window.close
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ☆ アクターコマンドウィンドウのセットアップ時の処理
  817.   #--------------------------------------------------------------------------
  818.   alias a1_side_view_sb_actor_command_setup actor_command_setup
  819.   def actor_command_setup(actor)
  820.     a1_side_view_sb_actor_command_setup(actor)
  821.     @actor_name_window.text = actor.name
  822.   end
  823.   #--------------------------------------------------------------------------
  824.   # ○ 移動完了待ち
  825.   #--------------------------------------------------------------------------
  826.   def wait_for_move
  827.     update_basic
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ☆ メッセージウィンドウの作成
  831.   #--------------------------------------------------------------------------
  832.   alias a1_side_view_sb_create_message_window create_message_window
  833.   def create_message_window
  834.     a1_side_view_sb_create_message_window
  835.     $game_message.position = 0
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # ○ 戦闘開始の登場
  839.   #--------------------------------------------------------------------------
  840.   def move_start_pos
  841.     battle_members.each {|actor| actor.proc_action("戦闘開始の登場") }
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ○ アクターの初期位置
  845.   #--------------------------------------------------------------------------
  846.   def members_init_pos(index)
  847.     INTT_POS[index]
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ★ アクター位置のセットアップ(個別バトルステータスウィンドウの再定義)
  851.   #--------------------------------------------------------------------------
  852.   def setup_actor_battler(index, actor)
  853.     pos = members_init_pos(index)
  854.     pos = actor.members_standard_pos(index) if actor.hp <= 0
  855.     setup_actor_screen_pos(actor, pos)
  856.     actor.init_x   = pos[0]
  857.     actor.init_y   = pos[1]
  858.     actor.screen_z = 50
  859.     actor.target_x = actor.screen_x
  860.     actor.target_y = actor.screen_y
  861.     actor.setup_standard_pos(index)
  862.     actor.visible  = true
  863.   end
  864.   #--------------------------------------------------------------------------
  865.   # ○ アクターの画面位置を設定
  866.   #--------------------------------------------------------------------------
  867.   def setup_actor_screen_pos(actor, pos)
  868.     actor.screen_x = pos[0]
  869.     actor.screen_y = pos[1]
  870.   end
  871.   #--------------------------------------------------------------------------
  872.   # ☆ 次のコマンド入力への前処理
  873.   #--------------------------------------------------------------------------
  874.   alias a1_side_view_sb_prev_next_command prev_next_command
  875.   def prev_next_command
  876.     BattleManager.actor.proc_action("コマンド選択終了") if BattleManager.actor
  877.     a1_side_view_sb_prev_next_command
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ☆ 次のコマンド入力への後処理
  881.   #--------------------------------------------------------------------------
  882.   alias a1_side_view_sb_post_next_command post_next_command
  883.   def post_next_command
  884.     a1_side_view_sb_post_next_command
  885.     BattleManager.actor.proc_action("コマンド選択開始") if BattleManager.actor
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ○ 前のコマンド入力への前処理
  889.   #--------------------------------------------------------------------------
  890.   alias a1_side_view_sb_prev_prior_command prev_prior_command
  891.   def prev_prior_command
  892.     BattleManager.actor.proc_action("コマンド選択終了") if BattleManager.actor
  893.     a1_side_view_sb_prev_prior_command
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ☆ 前のコマンド入力への後処理
  897.   #--------------------------------------------------------------------------
  898.   alias a1_side_view_sb_post_prior_command post_prior_command
  899.   def post_prior_command
  900.     a1_side_view_sb_post_prior_command
  901.     BattleManager.actor.proc_action("コマンド選択開始") if BattleManager.actor
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ○ 同時アクションを実行するメンバーを取得
  905.   #--------------------------------------------------------------------------
  906.   def alive_index
  907.     battle_members.each {|member| return member.index if member.alive?}
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ○ 勝利アクション
  911.   #--------------------------------------------------------------------------
  912.   def victory_action
  913.     @victory_action = true
  914.     battle_members[alive_index].proc_action("勝利アクション")
  915.   end
  916.   #--------------------------------------------------------------------------
  917.   # ☆ コマンド[逃げる]
  918.   #--------------------------------------------------------------------------
  919.   alias a1_side_view_sb_command_escape command_escape
  920.   def command_escape
  921.     battle_members[alive_index].proc_action("逃げる")
  922.     a1_side_view_sb_command_escape
  923.   end
  924.   #--------------------------------------------------------------------------
  925.   # ○ 逃げる失敗
  926.   #--------------------------------------------------------------------------
  927.   def escape_failure
  928.     battle_members[0].proc_action("逃げる失敗")
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ☆ パーティコマンドウィンドウ作成の後処理
  932.   #--------------------------------------------------------------------------
  933.   alias a1_side_view_sb_post_create_party_command_window post_create_party_command_window
  934.   def post_create_party_command_window
  935.     @party_command_window.viewport = nil
  936.     @party_command_window.x = Graphics.width - @party_command_window.width
  937.     @party_command_window.y = 0
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # ○ アクターウィンドウ作成の後処理
  941.   #--------------------------------------------------------------------------
  942.   alias a1_side_view_sb_post_create_actor_window post_create_actor_window
  943.   def post_create_actor_window
  944.     a1_side_view_sb_post_create_actor_window
  945.     @actor_command_window.viewport = nil
  946.     @actor_command_window.x = Graphics.width - @actor_command_window.width
  947.     @actor_command_window.y = 0
  948.   end
  949.   #--------------------------------------------------------------------------
  950.   # ☆ 敵キャラ選択の開始
  951.   #--------------------------------------------------------------------------
  952.   alias a1_side_view_sb_select_enemy_selection select_enemy_selection
  953.   def select_enemy_selection
  954.     a1_side_view_sb_select_enemy_selection
  955.     @actor_command_window.close
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ☆ コラプス処理保留の設定
  959.   #--------------------------------------------------------------------------
  960.   alias a1_side_view_sb_set_wait_collapse set_wait_collapse
  961.   def set_wait_collapse(targets, flag, sv_flag = true)
  962.     return if !flag && sv_flag
  963.     a1_side_view_sb_set_wait_collapse(targets, flag)
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ☆ 戦闘行動の実行
  967.   #--------------------------------------------------------------------------
  968.   def execute_action
  969.     @subject.execute_action
  970.   end
  971.   #--------------------------------------------------------------------------
  972.   # ☆ スキル/アイテムの使用
  973.   #--------------------------------------------------------------------------
  974.   def use_item
  975.     @subject.battler_use_item
  976.   end
  977.   #--------------------------------------------------------------------------
  978.   # ★ 攻撃アニメーションの表示
  979.   #--------------------------------------------------------------------------
  980.   def show_attack_animation(targets)
  981.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  982.   end
  983.   #--------------------------------------------------------------------------
  984.   # ○ アクションアイコン
  985.   #--------------------------------------------------------------------------
  986.   def action_icon(icon_index, action_info = nil, battler = nil)
  987.     return @spriteset.erase_icon(icon_index) unless action_info
  988.     @spriteset.setup_action_icon(action_info, icon_index, battler)
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # ☆ ウェイト
  992.   #--------------------------------------------------------------------------
  993.   alias a1_side_view_sb_wait wait
  994.   def wait(duration)
  995.     a1_side_view_sb_wait(duration) unless action_wait_skip
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # ☆ 短時間ウェイト(早送り無効)
  999.   #--------------------------------------------------------------------------
  1000.   alias a1_side_view_sb_abs_wait_short abs_wait_short
  1001.   def abs_wait_short
  1002.     a1_side_view_sb_abs_wait_short unless action_wait_skip
  1003.   end
  1004.   #--------------------------------------------------------------------------
  1005.   # ☆ アニメーション表示が終わるまでウェイト
  1006.   #--------------------------------------------------------------------------
  1007.   alias a1_side_view_sb_wait_for_animation wait_for_animation
  1008.   def wait_for_animation
  1009.     a1_side_view_sb_wait_for_animation unless action_wait_skip
  1010.   end
  1011.   #--------------------------------------------------------------------------
  1012.   # ○ アクションのウェイト
  1013.   #--------------------------------------------------------------------------
  1014.   def action_wait_skip
  1015.     BattleManager.action_wait_skip
  1016.   end
  1017.   #--------------------------------------------------------------------------
  1018.   # ☆ 個別ステータスウィンドウを再作成する
  1019.   #--------------------------------------------------------------------------
  1020.   alias a1_side_view_sb_recreate_status_windows recreate_status_windows
  1021.   def recreate_status_windows(member)
  1022.     a1_side_view_sb_recreate_status_windows(member)
  1023.     return add_party_action(member) if member.index == $game_party.new_index
  1024.     setup_actor_screen_pos(member, member.members_standard_pos(member.index))
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # ○ パーティ加入時のアクション
  1028.   #--------------------------------------------------------------------------
  1029.   def add_party_action(member)
  1030.     member.proc_action($game_temp.add_party_action) if $game_temp.add_party_action
  1031.     $game_temp.add_party_action = nil
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # ☆ アクターを外す前処理
  1035.   #--------------------------------------------------------------------------
  1036.   alias a1_side_view_sb_prev_remove_battler prev_remove_battler
  1037.   def prev_remove_battler(member)
  1038.     member.proc_action($game_temp.remove_party_action) if $game_temp.remove_party_action
  1039.     a1_side_view_sb_prev_remove_battler(member)
  1040.     $game_temp.remove_party_action = nil
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ○ イベントアクション実行
  1044.   #--------------------------------------------------------------------------
  1045.   def proc_event_action(member, action)
  1046.     member.proc_action(action)
  1047.   end
  1048. #==============================================================================
  1049. # ■ パッシブスキル/スキルレベル対応処理
  1050. #==============================================================================
  1051.   if $imported["A1_PassiveSkill"]
  1052.   #--------------------------------------------------------------------------
  1053.   # ☆ 戦闘行動の実行の前処理
  1054.   #--------------------------------------------------------------------------
  1055.   alias a1_side_view_sb_prev_execute_action prev_execute_action
  1056.   def prev_execute_action
  1057.     a1_side_view_sb_prev_execute_action
  1058.     @original_current_weapon = @subject.current_weapon
  1059.   end
  1060.   #--------------------------------------------------------------------------
  1061.   # ☆ スキル/アイテムの使用の前処理
  1062.   #--------------------------------------------------------------------------
  1063.   alias a1_side_view_sb_prev_use_item prev_use_item
  1064.   def prev_use_item
  1065.     @subject.current_action.set_skill(@original_action_item.id) if @original_action_item.is_a?(RPG::Skill) && change_current_weapon?
  1066.     a1_side_view_sb_prev_use_item
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # ○ 使用武器が変わった?
  1070.   #--------------------------------------------------------------------------
  1071.   def change_current_weapon?
  1072.     @original_current_weapon != @subject.current_weapon
  1073.   end
  1074.   #--------------------------------------------------------------------------
  1075.   # ☆ 通常攻撃がスキルに変化する条件のチェック
  1076.   #--------------------------------------------------------------------------
  1077.   alias a1_side_view_sb_skill_change_condition skill_change_condition
  1078.   def skill_change_condition(passive, skill_id)
  1079.     return false if @subject.actor? && !@subject.skill_change_condition
  1080.     a1_side_view_sb_skill_change_condition(passive, skill_id)
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # ☆ スキル/アイテムの使用後の追加発動スキル
  1084.   #--------------------------------------------------------------------------
  1085.   alias a1_side_view_sb_use_after_next_skill use_after_next_skill
  1086.   def use_after_next_skill(item)
  1087.     return false if @subject.actor? && !@subject.skill_change_condition
  1088.     a1_side_view_sb_use_after_next_skill(item)
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ☆ コンボスキルの実行
  1092.   #--------------------------------------------------------------------------
  1093.   alias a1_side_view_sb_next_combo next_combo
  1094.   def next_combo(skill)
  1095.     @subject.start_combo
  1096.     a1_side_view_sb_next_combo(skill)
  1097.   end;end
  1098. #==============================================================================
  1099. # ■ 消耗品装備対応処理
  1100. #==============================================================================
  1101.   if $imported["A1_ConsumerEquip"] && $imported["A1_PassiveSkill"]
  1102.   #--------------------------------------------------------------------------
  1103.   # ☆ 戦闘行動の実行の前処理
  1104.   #--------------------------------------------------------------------------
  1105.   def prev_execute_action
  1106.     a1_side_view_sb_prev_execute_action
  1107.     @original_current_weapon = @subject.current_weapon
  1108.     @original_current_main   = @subject.current_main
  1109.   end
  1110.   #--------------------------------------------------------------------------
  1111.   # ○ 使用武器が変わった?
  1112.   #--------------------------------------------------------------------------
  1113.   def change_current_weapon?
  1114.     @original_current_weapon != @subject.current_weapon || @original_current_main != @subject.current_main
  1115.   end;end
  1116. #==============================================================================
  1117. # ■ 戦闘中入れ替え対応処理
  1118. #==============================================================================
  1119.   if $imported["A1_ChangeMember"]
  1120.   #--------------------------------------------------------------------------
  1121.   # ☆ メンバーチェンジ[キャンセル]
  1122.   #--------------------------------------------------------------------------
  1123.   alias a1_side_view_on_member_change_cancel on_member_change_cancel
  1124.   def on_member_change_cancel
  1125.     @window_member_change.close
  1126.     change_diss_members.each{|member| @prev_battle_members[member.index].proc_action("初期位置にジャンプ") }
  1127.     wait(30) unless change_diss_members.empty?
  1128.     a1_side_view_on_member_change_cancel
  1129.     change_diss_members.each {|member| return_for_change_member(member)  }
  1130.   end
  1131.   #--------------------------------------------------------------------------
  1132.   # ○ 入れ替えメンバー向け初期位置設定
  1133.   #--------------------------------------------------------------------------
  1134.   def return_for_change_member(member)
  1135.     pos = members_init_pos(member.index)
  1136.     member.init_x   = pos[0]
  1137.     member.init_y   = pos[1]
  1138.     member.screen_x = pos[0]
  1139.     member.screen_y = pos[1]
  1140.     member.proc_action("戦闘開始の登場")
  1141.   end;end
  1142. end
  1143. #==============================================================================
  1144. # ■ Spriteset_Battle
  1145. #------------------------------------------------------------------------------
  1146. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  1147. # スの内部で使用されます。
  1148. #==============================================================================
  1149.  
  1150. class Spriteset_Battle
  1151.   #--------------------------------------------------------------------------
  1152.   # ☆ オブジェクト初期化
  1153.   #--------------------------------------------------------------------------
  1154.   alias a1_side_view_ssb_initialize initialize
  1155.   def initialize
  1156.     create_action_icon
  1157.     a1_side_view_ssb_initialize
  1158.   end
  1159.   #--------------------------------------------------------------------------
  1160.   # ○ アクションアイコンの作成
  1161.   #--------------------------------------------------------------------------
  1162.   def create_action_icon
  1163.     @action_icons = {}
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # ○ アクションアイコンのセットアップ
  1167.   #--------------------------------------------------------------------------
  1168.   def setup_action_icon(action_info, icon_index, battler)
  1169.     @action_icons[icon_index] ||= Sprite_ActionIcon.new(@viewport1, icon_index)
  1170.     @action_icons[icon_index].setup_action(action_info, battler)
  1171.   end
  1172.   #--------------------------------------------------------------------------
  1173.   # ○ アクションアイコンのセットアップ
  1174.   #--------------------------------------------------------------------------
  1175.   def erase_icon(icon_index)
  1176.     @action_icons[icon_index].visible = false if @action_icons[icon_index]
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # ☆ フレーム更新
  1180.   #--------------------------------------------------------------------------
  1181.   alias a1_side_view_ssb_update update
  1182.   def update
  1183.     a1_side_view_ssb_update
  1184.     update_action_icon
  1185.   end
  1186.   #--------------------------------------------------------------------------
  1187.   # ☆ 解放
  1188.   #--------------------------------------------------------------------------
  1189.   alias a1_side_view_ssb_dispose dispose
  1190.   def dispose
  1191.     dispose_action_icon
  1192.     a1_side_view_ssb_dispose
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # ○ アクションアイコンの更新
  1196.   #--------------------------------------------------------------------------
  1197.   def update_action_icon
  1198.     @action_icons.values.each {|icon| icon.update }
  1199.   end
  1200.   #--------------------------------------------------------------------------
  1201.   # ○ アクションアイコンの解放
  1202.   #--------------------------------------------------------------------------
  1203.   def dispose_action_icon
  1204.     @action_icons.values.each {|icon| icon.dispose }
  1205.   end
  1206. end
  1207. #==============================================================================
  1208. # ■ Sprite_ActionIcon
  1209. #==============================================================================
  1210.  
  1211. class Sprite_ActionIcon < Sprite
  1212.   #--------------------------------------------------------------------------
  1213.   # ○ オブジェクト初期化
  1214.   #--------------------------------------------------------------------------
  1215.   def initialize(viewport, icon_index)
  1216.     super(viewport)
  1217.     setup_icon(icon_index)
  1218.   end
  1219.   #--------------------------------------------------------------------------
  1220.   # ○ アイコンのセットアップ
  1221.   #--------------------------------------------------------------------------
  1222.   def setup_icon(icon_index)
  1223.     self.bitmap = Bitmap.new(24, 24)
  1224.     icon_bitmap = Cache.system("Iconset")
  1225.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1226.     self.bitmap.blt(0, 0, icon_bitmap, rect, 255)
  1227.     self.ox = self.bitmap.width / 2
  1228.     self.oy = self.bitmap.height / 2
  1229.     self.visible = false
  1230.   end
  1231.   #--------------------------------------------------------------------------
  1232.   # ○ アクションのセットアップ
  1233.   #--------------------------------------------------------------------------
  1234.   def setup_action(action_info, battler)
  1235.     @battler      = battler
  1236.     @action_info  = action_info
  1237.     @duration     = action_info.duration
  1238.     self.x        = @battler.screen_x + action_info.st_x
  1239.     self.y        = @battler.screen_y + action_info.st_y
  1240.     self.z        = @battler.screen_z - 10
  1241.     self.angle    = action_info.st_angle
  1242.     self.opacity  = action_info.st_opacity
  1243.     self.zoom_x   = action_info.st_zoom_x / 100.0
  1244.     self.zoom_y   = action_info.st_zoom_y / 100.0
  1245.     self.tone     = action_info.st_tone ? action_info.st_tone : Tone.new(0, 0, 0)
  1246.     @x_plus       = (action_info.ed_x - action_info.st_x)             / @duration.to_f
  1247.     @y_plus       = (action_info.ed_y - action_info.st_y)             / @duration.to_f
  1248.     @angle_plus   = action_info.ed_angle                              / @duration.to_f
  1249.     @opacity_plus = (action_info.ed_opacity - action_info.st_opacity) / @duration.to_f
  1250.     @zoom_x_plus  = (action_info.ed_zoom_x - action_info.st_zoom_x)   / @duration.to_f
  1251.     @zoom_y_plus  = (action_info.ed_zoom_y - action_info.st_zoom_y)   / @duration.to_f
  1252.     @tone_r_plus  = 0
  1253.     @tone_g_plus  = 0
  1254.     @tone_b_plus  = 0
  1255.     @tone_gr_plus = 0
  1256.     setup_tone_plus(action_info.st_tone, action_info.ed_tone)
  1257.     self.visible = true
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # ○ トーンの差分セットアップ
  1261.   #--------------------------------------------------------------------------
  1262.   def setup_tone_plus(st_tone, ed_tone)
  1263.     return unless st_tone && ed_tone
  1264.     @tone_r_plus  = ed_tone[0] - st_tone[0] / @duration.to_f
  1265.     @tone_g_plus  = ed_tone[1] - st_tone[1] / @duration.to_f
  1266.     @tone_b_plus  = ed_tone[2] - st_tone[2] / @duration.to_f
  1267.     @tone_gr_plus = ed_tone[3] - st_tone[3] / @duration.to_f if st_tone[3] && ed_tone[3]
  1268.   end
  1269.   #--------------------------------------------------------------------------
  1270.   # ○ フレーム更新
  1271.   #--------------------------------------------------------------------------
  1272.   def update
  1273.     return unless @battler
  1274.     @duration -= 1
  1275.     super
  1276.     update_position
  1277.     update_zoom
  1278.     update_other
  1279.     clear if @duration == 0
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # ○ クリア
  1283.   #--------------------------------------------------------------------------
  1284.   def clear
  1285.     self.visible = false if @action_info.erase
  1286.     @battler     = nil
  1287.     @action_info = nil
  1288.   end
  1289.   #--------------------------------------------------------------------------
  1290.   # ○ 位置の更新
  1291.   #--------------------------------------------------------------------------
  1292.   def update_position
  1293.     self.x += @x_plus
  1294.     self.y += @y_plus
  1295.   end
  1296.   #--------------------------------------------------------------------------
  1297.   # ○ 拡大率の更新
  1298.   #--------------------------------------------------------------------------
  1299.   def update_zoom
  1300.     self.zoom_x += @zoom_x_plus / 100.0
  1301.     self.zoom_y += @zoom_y_plus / 100.0
  1302.   end
  1303.   #--------------------------------------------------------------------------
  1304.   # ○ その他の更新
  1305.   #--------------------------------------------------------------------------
  1306.   def update_other
  1307.     self.opacity    += @opacity_plus
  1308.     self.angle      += @angle_plus
  1309.     self.tone.red   += @tone_r_plus
  1310.     self.tone.green += @tone_g_plus
  1311.     self.tone.blue  += @tone_b_plus
  1312.     self.tone.gray  += @tone_gr_plus
  1313.   end
  1314. end
  1315. #==============================================================================
  1316. # ■ Sprite_Battler
  1317. #------------------------------------------------------------------------------
  1318. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  1319. # スプライトの状態を自動的に変化させます。
  1320. #==============================================================================
  1321.  
  1322. class Sprite_Battler < Sprite_Base
  1323.   #--------------------------------------------------------------------------
  1324.   # ☆ オブジェクト初期化
  1325.   #--------------------------------------------------------------------------
  1326.   alias a1_side_view_sb_initialize initialize
  1327.   def initialize(viewport, battler = nil)
  1328.     @balloon_duration = 0
  1329.     a1_side_view_sb_initialize(viewport, battler)
  1330.   end
  1331.   #--------------------------------------------------------------------------
  1332.   # ☆ 新しいエフェクトの設定
  1333.   #--------------------------------------------------------------------------
  1334.   alias a1_side_view_sb_setup_new_effect setup_new_effect
  1335.   def setup_new_effect
  1336.     a1_side_view_sb_setup_new_effect
  1337.     if !@balloon_sprite && @battler.balloon_id > 0
  1338.       @balloon_id = @battler.balloon_id
  1339.       start_balloon
  1340.     end
  1341.   end
  1342.   #--------------------------------------------------------------------------
  1343.   # ☆ バトラー情報のセットアップ
  1344.   #--------------------------------------------------------------------------
  1345.   alias a1_side_view_sb_setup_battler_info setup_battler_info
  1346.   def setup_battler_info
  1347.     clear
  1348.     a1_side_view_sb_setup_battler_info
  1349.     return unless @battler
  1350.     set_character_bitmap if @battler.actor?
  1351.   end
  1352.   #--------------------------------------------------------------------------
  1353.   # ☆ 位置の更新
  1354.   #--------------------------------------------------------------------------
  1355.   alias a1_side_view_sb_update_position update_position
  1356.   def update_position
  1357.     a1_side_view_sb_update_position
  1358.     update_battler_move
  1359.     update_battler_action
  1360.     update_balloon
  1361.   end
  1362.   #--------------------------------------------------------------------------
  1363.   # ○ バトラーアクションの更新
  1364.   #--------------------------------------------------------------------------
  1365.   def update_battler_action
  1366.     setup_action(@battler.battler_action) if @battler.battler_action && !@action_info
  1367.     return unless @action_info
  1368.     @duration -= 1 if @duration && @duration > 0
  1369.     update_zoom
  1370.     update_other
  1371.     clear if @duration == 0
  1372.   end
  1373.   #--------------------------------------------------------------------------
  1374.   # ★ アクター用転送元ビットマップの更新(個別バトルステータスウィンドウの再定義)
  1375.   #--------------------------------------------------------------------------
  1376.   def update_bitmap_actor
  1377.     update_src_rect
  1378.     return unless change_graphic?
  1379.     setup_battler_info
  1380.     update_src_rect
  1381.   end
  1382.   #--------------------------------------------------------------------------
  1383.   # ○ グラフィック変更?
  1384.   #--------------------------------------------------------------------------
  1385.   def change_graphic?
  1386.     @now_battler_name != @battler.battler_name || @now_battler_index != @battler.battler_index
  1387.   end
  1388.   #--------------------------------------------------------------------------
  1389.   # ○ バトラー移動の更新
  1390.   #--------------------------------------------------------------------------
  1391.   def update_battler_move
  1392.     @battler.update_battler_move
  1393.   end
  1394.   #--------------------------------------------------------------------------
  1395.   # ○ キャラクターのビットマップを設定
  1396.   #--------------------------------------------------------------------------
  1397.   def set_character_bitmap
  1398.     self.bitmap = Cache.character(@battler.battler_name)
  1399.     sign = @battler.battler_name[/^[\!\$]./]
  1400.     if sign && sign.include?('$')
  1401.       @cw = bitmap.width / 3
  1402.       @ch = bitmap.height / 4
  1403.     else
  1404.       @cw = bitmap.width / 12
  1405.       @ch = bitmap.height / 8
  1406.     end
  1407.     self.ox = @cw / 2
  1408.     self.oy = @ch
  1409.     @now_battler_name      = @battler.battler_name
  1410.     @now_battler_index     = @battler.battler_index
  1411.     @battler.sprite_height = @ch
  1412.   end
  1413.   #--------------------------------------------------------------------------
  1414.   # ○ 転送元矩形の更新
  1415.   #--------------------------------------------------------------------------
  1416.   def update_src_rect
  1417.     @battler.update_pattern
  1418.     index = @battler.battler_index
  1419.     pattern = @battler.pattern < 3 ? @battler.pattern : 1
  1420.     sx = (index % 4 * 3 + pattern) * @cw
  1421.     sy = (index / 4 * 4 + (@battler.direction - 2) / 2) * @ch
  1422.     self.src_rect.set(sx, sy, @cw, @ch)
  1423.   end
  1424.   #--------------------------------------------------------------------------
  1425.   # ☆ 原点の更新
  1426.   #--------------------------------------------------------------------------
  1427.   alias a1_side_view_spb_update_origin update_origin
  1428.   def update_origin
  1429.     a1_side_view_spb_update_origin unless @battler.actor?
  1430.   end
  1431.   #--------------------------------------------------------------------------
  1432.   # ☆ 通常の設定に戻す
  1433.   #--------------------------------------------------------------------------
  1434.   alias a1_side_view_spb_revert_to_normal revert_to_normal
  1435.   def revert_to_normal
  1436.     a1_side_view_spb_revert_to_normal unless @battler.actor?
  1437.   end
  1438.   #--------------------------------------------------------------------------
  1439.   # ○ アクションのセットアップ
  1440.   #--------------------------------------------------------------------------
  1441.   def setup_action(action_info)
  1442.     @action_info  = action_info
  1443.     @duration     = action_info.duration
  1444.     self.angle    = action_info.st_angle
  1445.     self.opacity  = action_info.st_opacity
  1446.     self.zoom_x   = action_info.st_zoom_x / 100.0
  1447.     self.zoom_y   = action_info.st_zoom_y / 100.0
  1448.     self.tone     = action_info.st_tone ? action_info.st_tone : Tone.new(0, 0, 0)
  1449.     @angle_plus   = action_info.ed_angle                              / @duration.to_f
  1450.     @opacity_plus = (action_info.ed_opacity - action_info.st_opacity) / @duration.to_f
  1451.     @zoom_x_plus  = (action_info.ed_zoom_x - action_info.st_zoom_x)   / @duration.to_f
  1452.     @zoom_y_plus  = (action_info.ed_zoom_y - action_info.st_zoom_y)   / @duration.to_f
  1453.     @tone_r_plus  = 0
  1454.     @tone_g_plus  = 0
  1455.     @tone_b_plus  = 0
  1456.     @tone_gr_plus = 0
  1457.     setup_tone_plus(action_info.st_tone, action_info.ed_tone)
  1458.     self.visible = true
  1459.   end
  1460.   #--------------------------------------------------------------------------
  1461.   # ○ トーンの差分セットアップ
  1462.   #--------------------------------------------------------------------------
  1463.   def setup_tone_plus(st_tone, ed_tone)
  1464.     return unless @action_info
  1465.     return unless st_tone && ed_tone
  1466.     @tone_r_plus  = ed_tone[0] - st_tone[0] / @duration.to_f
  1467.     @tone_g_plus  = ed_tone[1] - st_tone[1] / @duration.to_f
  1468.     @tone_b_plus  = ed_tone[2] - st_tone[2] / @duration.to_f
  1469.     @tone_gr_plus = ed_tone[3] - st_tone[3] / @duration.to_f if st_tone[3] && ed_tone[3]
  1470.   end
  1471.   #--------------------------------------------------------------------------
  1472.   # ○ クリア
  1473.   #--------------------------------------------------------------------------
  1474.   def clear
  1475.     return unless @action_info
  1476.     self.visible = false if @action_info.erase
  1477.     @action_info = nil
  1478.     @battler.battler_action = nil
  1479.     @angle_plus   = 0
  1480.     @opacity_plus = 0
  1481.     @zoom_x_plus  = 0
  1482.     @zoom_y_plus  = 0
  1483.     @tone_r_plus  = 0
  1484.     @tone_g_plus  = 0
  1485.     @tone_b_plus  = 0
  1486.     @tone_gr_plus = 0
  1487.   end
  1488.   #--------------------------------------------------------------------------
  1489.   # ○ 拡大率の更新
  1490.   #--------------------------------------------------------------------------
  1491.   def update_zoom
  1492.     return unless @action_info
  1493.     self.zoom_x += @zoom_x_plus / 100.0
  1494.     self.zoom_y += @zoom_y_plus / 100.0
  1495.   end
  1496.   #--------------------------------------------------------------------------
  1497.   # ○ その他の更新
  1498.   #--------------------------------------------------------------------------
  1499.   def update_other
  1500.     return unless @action_info
  1501.     self.opacity    += @opacity_plus
  1502.     self.angle      += @angle_plus
  1503.     self.tone.red   += @tone_r_plus
  1504.     self.tone.green += @tone_g_plus
  1505.     self.tone.blue  += @tone_b_plus
  1506.     self.tone.gray  += @tone_gr_plus
  1507.   end
  1508.   #--------------------------------------------------------------------------
  1509.   # ○ フキダシアイコン表示の開始
  1510.   #--------------------------------------------------------------------------
  1511.   def start_balloon
  1512.     dispose_balloon
  1513.     @balloon_sprite = ::Sprite.new(viewport)
  1514.     set_balloon_duration
  1515.     @balloon_sprite.bitmap = Cache.system("Balloon")
  1516.     @balloon_sprite.ox = 16
  1517.     @balloon_sprite.oy = 32
  1518.     update_balloon
  1519.   end
  1520.   #--------------------------------------------------------------------------
  1521.   # ○ フキダシアイコンの時間設定
  1522.   #--------------------------------------------------------------------------
  1523.   def set_balloon_duration
  1524.     @balloon_duration = 8 * balloon_speed + balloon_wait
  1525.   end   
  1526.   #--------------------------------------------------------------------------
  1527.   # ○ フキダシアイコンの解放
  1528.   #--------------------------------------------------------------------------
  1529.   def dispose_balloon
  1530.     if @balloon_sprite
  1531.       @balloon_sprite.dispose
  1532.       @balloon_sprite = nil
  1533.     end
  1534.   end
  1535.   #--------------------------------------------------------------------------
  1536.   # ○ フキダシアイコンの更新
  1537.   #--------------------------------------------------------------------------
  1538.   def update_balloon
  1539.     if @balloon_duration > 0
  1540.       @balloon_duration -= 1
  1541.       if @balloon_duration > 0
  1542.         @balloon_sprite.x = x
  1543.         @balloon_sprite.y = y - height
  1544.         @balloon_sprite.z = z + 200
  1545.         sx = balloon_frame_index * 32
  1546.         sy = (@balloon_id - 1) * 32
  1547.         @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  1548.       else
  1549.         set_balloon_duration
  1550.       end
  1551.       end_balloon if @battler.balloon_id == 0
  1552.     end
  1553.   end
  1554.   #--------------------------------------------------------------------------
  1555.   # ○ フキダシアイコンの終了
  1556.   #--------------------------------------------------------------------------
  1557.   def end_balloon
  1558.     dispose_balloon
  1559.     @balloon_duration   = 0
  1560.     @battler.balloon_id = 0
  1561.   end
  1562.   #--------------------------------------------------------------------------
  1563.   # ○ フキダシアイコンの表示速度
  1564.   #--------------------------------------------------------------------------
  1565.   def balloon_speed
  1566.     return 8
  1567.   end
  1568.   #--------------------------------------------------------------------------
  1569.   # ○ フキダシ最終フレームのウェイト時間
  1570.   #--------------------------------------------------------------------------
  1571.   def balloon_wait
  1572.     return 12
  1573.   end
  1574.   #--------------------------------------------------------------------------
  1575.   # ○ フキダシアイコンのフレーム番号
  1576.   #--------------------------------------------------------------------------
  1577.   def balloon_frame_index
  1578.     return 7 - [(@balloon_duration - balloon_wait) / balloon_speed, 0].max
  1579.   end
  1580.   #--------------------------------------------------------------------------
  1581.   # ☆ エフェクトの開始
  1582.   #--------------------------------------------------------------------------
  1583.   alias a1_side_view_spb_start_effect start_effect
  1584.   def start_effect(effect_type)
  1585.     return revert_to_normal if @battler.actor? && effect_type == :collapse
  1586.     a1_side_view_spb_start_effect(effect_type)
  1587.   end
  1588. end
  1589. #==============================================================================
  1590. # ■ Game_Unit
  1591. #------------------------------------------------------------------------------
  1592. #  ユニットを扱うクラスです。このクラスは Game_Party クラスと Game_Troop クラ
  1593. # スのスーパークラスとして使用されます。
  1594. #==============================================================================
  1595.  
  1596. class Game_Unit
  1597.   #--------------------------------------------------------------------------
  1598.   # ○ 公開インスタンス変数
  1599.   #--------------------------------------------------------------------------
  1600.   attr_accessor :parallel_action_members
  1601.   #--------------------------------------------------------------------------
  1602.   # ☆ オブジェクト初期化
  1603.   #--------------------------------------------------------------------------
  1604.   alias a1_side_view_gu_initialize initialize
  1605.   def initialize
  1606.     a1_side_view_gu_initialize
  1607.     @parallel_action_members = []
  1608.   end
  1609. end
  1610. #==============================================================================
  1611. # ■ Game_Party
  1612. #------------------------------------------------------------------------------
  1613. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  1614. # スのインスタンスは $game_party で参照されます。
  1615. #==============================================================================
  1616.  
  1617. class Game_Party < Game_Unit
  1618.   #--------------------------------------------------------------------------
  1619.   # ○ 生存している戦闘メンバーの配列取得
  1620.   #--------------------------------------------------------------------------
  1621.   def alive_battle_members
  1622.     battle_members.select {|member| member.alive? }
  1623.   end
  1624.   #--------------------------------------------------------------------------
  1625.   # ○ 同時アクションのメンバーを設定
  1626.   #--------------------------------------------------------------------------
  1627.   def parallel_action_alive_members
  1628.     battle_members.select {|member| member.alive? && @parallel_action_members.include?(member.index) }
  1629.   end
  1630. end
  1631. #==============================================================================
  1632. # ■ Game_Troop
  1633. #------------------------------------------------------------------------------
  1634. #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も
  1635. # 行います。このクラスのインスタンスは $game_troop で参照されます。
  1636. #==============================================================================
  1637.  
  1638. class Game_Troop < Game_Unit
  1639.   #--------------------------------------------------------------------------
  1640.   # ☆ セットアップ
  1641.   #--------------------------------------------------------------------------
  1642.   alias a1_side_view_gtp_setup setup
  1643.   def setup(troop_id)
  1644.     a1_side_view_gtp_setup(troop_id)
  1645.     @enemies.each {|enemy| enemy.set_standard_pos }
  1646.   end
  1647.   #--------------------------------------------------------------------------
  1648.   # ○ 同時アクションのメンバーを設定
  1649.   #--------------------------------------------------------------------------
  1650.   def parallel_action_alive_members
  1651.     members.select {|member| member.alive? && @parallel_action_members.include?(member.index) }
  1652.   end
  1653. end
  1654. #==============================================================================
  1655. # ■ Game_Actor
  1656. #------------------------------------------------------------------------------
  1657. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  1658. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  1659. #==============================================================================
  1660.  
  1661. class Game_Actor < Game_Battler
  1662.   #--------------------------------------------------------------------------
  1663.   # ○ 定数
  1664.   #--------------------------------------------------------------------------
  1665.   PATTERN_COUNT = 20
  1666.   STANDARD_POS  = A1_System::SideViewActionConfig::STANDARD_POS
  1667.   #--------------------------------------------------------------------------
  1668.   # ○ 公開インスタンス変数
  1669.   #--------------------------------------------------------------------------
  1670.   attr_accessor :pattern
  1671.   attr_accessor :pattern_fix
  1672.   attr_accessor :pre_pattern_fix
  1673.   attr_accessor :direction
  1674.   attr_accessor :battler_index
  1675.   #--------------------------------------------------------------------------
  1676.   # ★ セットアップ(個別バトルステータスウィンドウの再定義)
  1677.   #--------------------------------------------------------------------------
  1678.   def setup(actor_id)
  1679.     a1_psw_setup(actor_id)
  1680.     @screen_x        = 0
  1681.     @screen_y        = 0
  1682.     @screen_z        = 0
  1683.     @opacity         = 255
  1684.     @visible         = true
  1685.     @sprite_height   = 0
  1686.     @battler_name    = actor.character_name  
  1687.     @use_sprite      = @battler_name.empty? ? false : true
  1688.     @pattern         = 1
  1689.     @pattern_fix     = -1
  1690.     @pre_pattern_fix = -1
  1691.     @direction       = 4
  1692.     @target_x        = @screen_x
  1693.     @target_y        = @screen_y
  1694.     @distance_x      = 0.0
  1695.     @distance_y      = 0.0
  1696.     @pattern_count   = PATTERN_COUNT
  1697.     @pattern_plus    = 1
  1698.     @battler_index   = @character_index
  1699.     @battler_picture = actor.battler_picture
  1700.   end
  1701.   #--------------------------------------------------------------------------
  1702.   # ○ 歩行パターンの更新
  1703.   #--------------------------------------------------------------------------
  1704.   def update_pattern
  1705.     return @pattern = @pattern_fix if @pattern_fix >= 0
  1706.     @pattern_count -= 1
  1707.     change_pattern if @pattern_count == 0
  1708.   end
  1709.   #--------------------------------------------------------------------------
  1710.   # ○ 歩行パターンの変更
  1711.   #--------------------------------------------------------------------------
  1712.   def change_pattern
  1713.     @pattern += @pattern_plus
  1714.     @pattern_plus = -1 if @pattern_plus > 0 && @pattern == 2
  1715.     @pattern_plus =  1 if @pattern_plus < 0 && @pattern == 0
  1716.     @pattern_count = PATTERN_COUNT
  1717.   end
  1718.   #--------------------------------------------------------------------------
  1719.   # ○ 定位置を取得
  1720.   #--------------------------------------------------------------------------
  1721.   def members_standard_pos(index)
  1722.     STANDARD_POS[index]
  1723.   end
  1724.   #--------------------------------------------------------------------------
  1725.   # ○ 定位置をセット
  1726.   #--------------------------------------------------------------------------
  1727.   def setup_standard_pos(index)
  1728.     pos = members_standard_pos(index)
  1729.     @standard_x = pos[0]
  1730.     @standard_y = pos[1]
  1731.   end
  1732.   #--------------------------------------------------------------------------
  1733.   # ★ ダメージ効果の実行
  1734.   #--------------------------------------------------------------------------
  1735.   def perform_damage_effect
  1736.     Sound.play_actor_damage
  1737.   end
  1738.   #--------------------------------------------------------------------------
  1739.   # ☆ 通常能力値の加算値取得
  1740.   #--------------------------------------------------------------------------
  1741.   alias a1_side_view_ga_param_plus param_plus
  1742.   def param_plus(param_id)
  1743.     ret = a1_side_view_ga_param_plus(param_id)
  1744.     return ret if param_id != 2
  1745.     return ret - no_current_weapon_atk
  1746.   end
  1747.   #--------------------------------------------------------------------------
  1748.   # ○ 使用中の武器でない武器の攻撃力を取得
  1749.   #--------------------------------------------------------------------------
  1750.   def no_current_weapon_atk
  1751.     return 0 unless no_calc_weapon_atk?
  1752.     return calc_no_current_weapon_atk(no_current_weapon)
  1753.   end
  1754.   #--------------------------------------------------------------------------
  1755.   # ○ 使用中の武器でない武器を取得
  1756.   #--------------------------------------------------------------------------
  1757.   def no_current_weapon
  1758.     (weapons - [@current_weapon])[0]
  1759.   end
  1760.   #--------------------------------------------------------------------------
  1761.   # ○ 使用中の武器でない武器の攻撃力を計算
  1762.   #--------------------------------------------------------------------------
  1763.   def calc_no_current_weapon_atk(weapon)
  1764.     weapon.params[2]
  1765.   end
  1766.   #--------------------------------------------------------------------------
  1767.   # ○ 使用中の武器でない武器の攻撃力を計算しない?
  1768.   #--------------------------------------------------------------------------
  1769.   def no_calc_weapon_atk?
  1770.     weapons && @current_weapon && $game_party.in_battle && two_sword_style?
  1771.   end
  1772.   #--------------------------------------------------------------------------
  1773.   # ○ 通常攻撃が他のスキルに変化する条件
  1774.   #--------------------------------------------------------------------------
  1775.   def skill_change_condition
  1776.     return true unless two_sword_style?
  1777.     weapons.index(no_current_weapon) == 1
  1778.   end
  1779. #==============================================================================
  1780. # ■ 消耗品装備対応処理
  1781. #==============================================================================
  1782.   if $imported["A1_ConsumerEquip"]
  1783.   #--------------------------------------------------------------------------
  1784.   # ○ 使用中のメイン武器
  1785.   #--------------------------------------------------------------------------
  1786.   def current_main
  1787.     @current_main
  1788.   end
  1789.   #--------------------------------------------------------------------------
  1790.   # ○ 通常攻撃が他のスキルに変化する条件
  1791.   #--------------------------------------------------------------------------
  1792.   def skill_change_condition
  1793.     return true unless two_sword_style?
  1794.     no_current_index = weapons.index(no_current_weapon)
  1795.     return no_current_index == 0 if dominant_hand == "左"
  1796.     no_current_index == 1
  1797.   end
  1798.   #--------------------------------------------------------------------------
  1799.   # ☆ 通常能力値の基本値取得
  1800.   #--------------------------------------------------------------------------
  1801.   alias a1_side_view_ga_param_base param_base
  1802.   def param_base(param_id)
  1803.     ret = a1_side_view_ga_param_base(param_id)
  1804.     return ret if param_id != 2
  1805.     return ret unless no_calc_weapon_atk?
  1806.     no_current_index = weapons.index(no_current_weapon)
  1807.     basic = a1_ex_equip_ga_param_base(param_id)
  1808.     no_current_index = no_current_index == 1 ? 0 : 1 if dominant_hand == "左"
  1809.     no_current_index = 1 if dominant_hand == "両"
  1810.     return (ret - basic * DUAL_BASIC_RATE * dual_wirld_rate[no_current_index]).round.to_i
  1811.   end
  1812.   #--------------------------------------------------------------------------
  1813.   # ○ 使用中の武器でない武器を取得
  1814.   #--------------------------------------------------------------------------
  1815.   def no_current_weapon
  1816.     (weapons - [@current_weapon] - [@current_main])[0]
  1817.   end
  1818.   #--------------------------------------------------------------------------
  1819.   # ○ 使用中の武器でない武器の攻撃力を計算
  1820.   #--------------------------------------------------------------------------
  1821.   alias a1_side_view_for_consumer_equip_ga_calc_no_current_weapon_atk calc_no_current_weapon_atk
  1822.   def calc_no_current_weapon_atk(weapon)
  1823.     w_atk = a1_side_view_for_consumer_equip_ga_calc_no_current_weapon_atk(weapon)
  1824.     no_current_index = weapons.index(weapon)
  1825.     return (w_atk * dual_wirld_rate[no_current_index]).round.to_i
  1826.   end;end
  1827. #==============================================================================
  1828. # ■ パッシブスキル/スキルレベル対応処理
  1829. #==============================================================================
  1830.   if $imported["A1_PassiveSkill"]
  1831.   #--------------------------------------------------------------------------
  1832.   # ○ 使用中の武器でない武器の攻撃力を計算
  1833.   #--------------------------------------------------------------------------
  1834.   alias a1_side_view_for_passive_skill_ga_calc_no_current_weapon_atk calc_no_current_weapon_atk
  1835.   def calc_no_current_weapon_atk(weapon)
  1836.     w_atk = a1_side_view_for_passive_skill_ga_calc_no_current_weapon_atk(weapon)
  1837.     return w_atk if @current_weapon.wtype_id == weapon.wtype_id
  1838.     return w_atk + params_equip_passive(weapon, 2)
  1839.   end;end
  1840. end
  1841. #==============================================================================
  1842. # ■ Sprite_BattleCursor
  1843. #==============================================================================
  1844.  
  1845. class Sprite_BattleCursor < Sprite_Base
  1846.   #--------------------------------------------------------------------------
  1847.   # ☆ オブジェクト初期化
  1848.   #--------------------------------------------------------------------------
  1849.   alias a1_side_view_sbc_initialize initialize
  1850.   def initialize(color = DEFAULT_COLOR)
  1851.     a1_side_view_sbc_initialize(color)
  1852.     @angle     = 0
  1853.     @set_angle = 0
  1854.   end
  1855.   #--------------------------------------------------------------------------
  1856.   # ★ フレーム更新
  1857.   #--------------------------------------------------------------------------
  1858.   def update
  1859.     self.visible = @target ? true : false
  1860.     return unless @target
  1861.     super
  1862.     update_for_actor if @target.actor?
  1863.     update_for_enemy unless @target.actor?
  1864.     set_angle if @set_angle != @angle
  1865.   end
  1866.   #--------------------------------------------------------------------------
  1867.   # ○ 回転角度のセット
  1868.   #--------------------------------------------------------------------------
  1869.   def set_angle
  1870.     self.angle = @set_angle
  1871.     @angle = @set_angle
  1872.   end
  1873.   #--------------------------------------------------------------------------
  1874.   # ○ エネミー用フレーム更新
  1875.   #--------------------------------------------------------------------------
  1876.   def update_for_enemy
  1877.     self.x = @target.screen_x + @plus_x
  1878.     self.y = @target.screen_y - @target.battler_height + @plus_y
  1879.     @set_angle = 0
  1880.   end
  1881.   #--------------------------------------------------------------------------
  1882.   # ○ アクター用フレーム更新
  1883.   #--------------------------------------------------------------------------
  1884.   def update_for_actor
  1885.     self.x = @target.screen_x - 32 + @plus_x
  1886.     self.y = @target.screen_y - 16 + @plus_y
  1887.     @set_angle = 90
  1888.   end
  1889. end
  1890. #==============================================================================
  1891. # ■ Sprite_Base
  1892. #------------------------------------------------------------------------------
  1893. #  アニメーションの表示処理を追加したスプライトのクラスです。
  1894. #==============================================================================
  1895.  
  1896. class Sprite_Base < Sprite
  1897.   #--------------------------------------------------------------------------
  1898.   # ☆ アニメーションの開始
  1899.   #--------------------------------------------------------------------------
  1900.   alias a1_side_view_sb_start_animation start_animation
  1901.   def start_animation(animation, mirror = false)
  1902.     clone_animation = animation.clone
  1903.     clone_animation.position = $game_temp.force_animation_position if $game_temp.force_animation_position
  1904.     a1_side_view_sb_start_animation(clone_animation, mirror)
  1905.   end
  1906. end
  1907. #==============================================================================
  1908. # ■ Game_Temp
  1909. #------------------------------------------------------------------------------
  1910. #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
  1911. # スタンスは $game_temp で参照されます。
  1912. #==============================================================================
  1913.  
  1914. class Game_Temp
  1915.   #--------------------------------------------------------------------------
  1916.   # ○ 公開インスタンス変数
  1917.   #--------------------------------------------------------------------------
  1918.   attr_accessor :force_animation_position
  1919.   #--------------------------------------------------------------------------
  1920.   # ☆ オブジェクト初期化
  1921.   #--------------------------------------------------------------------------
  1922.   alias a1_side_view_gt_initialize initialize
  1923.   def initialize
  1924.     a1_side_view_gt_initialize
  1925.     @force_animation_position = nil
  1926.   end
  1927. end
  1928. #==============================================================================
  1929. # ■ Game_Battler
  1930. #------------------------------------------------------------------------------
  1931. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  1932. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  1933. #==============================================================================
  1934.  
  1935. class Game_Battler < Game_BattlerBase
  1936.   #--------------------------------------------------------------------------
  1937.   # ○ 定数
  1938.   #--------------------------------------------------------------------------
  1939.   TSS_TP_RATE   = A1_System::SideViewActionConfig::TSS_TP_RATE
  1940.   DIRECTION_SET = {"下" => 2, "左" => 4, "右" => 6, "上" => 8}
  1941.   STATE_LIST    = A1_System::SideViewActionConfig::STATE_LIST
  1942.   #--------------------------------------------------------------------------
  1943.   # ○ 公開インスタンス変数
  1944.   #--------------------------------------------------------------------------
  1945.   attr_accessor :target_x
  1946.   attr_accessor :target_y
  1947.   attr_accessor :distance_x
  1948.   attr_accessor :distance_y
  1949.   attr_accessor :standard_x
  1950.   attr_accessor :standard_y
  1951.   attr_accessor :move_count
  1952.   attr_accessor :move_duration
  1953.   attr_accessor :pre_move_x
  1954.   attr_accessor :pre_move_y
  1955.   attr_accessor :battler_action
  1956.   attr_accessor :balloon_id
  1957.   attr_accessor :wait_collapse
  1958.   attr_accessor :reserve_wait
  1959.   attr_accessor :parallel_action
  1960.   attr_accessor :parallel_members
  1961.   attr_accessor :init_x
  1962.   attr_accessor :init_y
  1963.   attr_accessor :substitute_target
  1964.   #--------------------------------------------------------------------------
  1965.   # ☆ オブジェクト初期化
  1966.   #--------------------------------------------------------------------------
  1967.   alias a1_side_view_sb_initialize initialize
  1968.   def initialize
  1969.     @jump_peak         = 0
  1970.     @move_count        = 0
  1971.     @move_duration     = 0
  1972.     @c_action_count    = 0
  1973.     @c_action_index    = 0
  1974.     @c_action_list     = nil
  1975.     @c_action_loop     = false
  1976.     @battler_action    = nil
  1977.     @direction         = 4
  1978.     @break_action      = false
  1979.     @force_break       = false
  1980.     @balloon_id        = 0
  1981.     @continue          = true
  1982.     @wait_collapse     = false
  1983.     @next_action       = false
  1984.     @repeat_count      = []
  1985.     @next_repeat_count = []
  1986.     @action_depth      = 0
  1987.     @reserve_wait      = 0
  1988.     @parallel_action   = false
  1989.     @proc_reserve_wait = false
  1990.     @parallel_members  = []
  1991.     @init_x            = 0
  1992.     @init_y            = 0
  1993.     @substitute_target = nil
  1994.     a1_side_view_sb_initialize
  1995.   end
  1996.   #--------------------------------------------------------------------------
  1997.   # ○ パラメータの初期化
  1998.   #--------------------------------------------------------------------------
  1999.   def init_params
  2000.     @action_depth      = 0
  2001.     @repeat_count      = []
  2002.     @next_repeat_count = []
  2003.   end
  2004.   #--------------------------------------------------------------------------
  2005.   # ○ 戦闘行動の実行
  2006.   #--------------------------------------------------------------------------
  2007.   def execute_action
  2008.     @collapse_flag = true
  2009.     @return_flag   = false
  2010.     @screen_z += 100 if @screen_z
  2011.     set_current_weapon
  2012.     BattleManager.call_method(:execute_action)
  2013.     @screen_z -= 100 if @screen_z
  2014.   end
  2015.   #--------------------------------------------------------------------------
  2016.   # ○ スキル/アイテムの使用
  2017.   #--------------------------------------------------------------------------
  2018.   def battler_use_item
  2019.     @next_action = false
  2020.     init_params
  2021.     item    = current_action.item
  2022.     targets = current_action.pre_make_targets.compact
  2023.     BattleManager.move_target = targets[0]
  2024.     BattleManager.all_targets = targets
  2025.     BattleManager.call_method(:set_wait_collapse, targets, true)
  2026.     proc_item_action(item, targets)
  2027.     battler_use_item if @next_action
  2028.   end
  2029.   #--------------------------------------------------------------------------
  2030.   # ○ スキル/アイテム使用時のアクション実行
  2031.   #--------------------------------------------------------------------------
  2032.   def proc_item_action(item, targets)
  2033.     action_key = item.sv_action
  2034.     action_key = get_action(item) if action_key.empty?
  2035.     proc_action(action_key)
  2036.     @break_action   = false
  2037.     @force_break    = false
  2038.   end
  2039.   #--------------------------------------------------------------------------
  2040.   # ○ アクションの実行
  2041.   #--------------------------------------------------------------------------
  2042.   def proc_action(action_key, members = nil)
  2043.     actions = BattleManager.side_view_actions.action_list[action_key]
  2044.     actions.each {|action| conv_action_members(action, members)
  2045.       break if @break_action || @force_break
  2046.       @repeat_count[@action_depth] = @next_repeat_count[@action_depth]
  2047.     }
  2048.     return_standard_pos(members) unless @next_action
  2049.     BattleManager.action_wait_skip = false
  2050.   end
  2051.   #--------------------------------------------------------------------------
  2052.   # ○ 定位置に戻る
  2053.   #--------------------------------------------------------------------------
  2054.   def return_standard_pos(members)
  2055.     end_combo
  2056.     return unless @break_action && @action_depth == 0
  2057.     conv_action_members("コラプス[許可]", members)
  2058.     conv_action_members("移動[定位置[10, wait]]", members)
  2059.   end
  2060.   #--------------------------------------------------------------------------
  2061.   # ○ 使用武器のセット
  2062.   #--------------------------------------------------------------------------
  2063.   def set_current_weapon
  2064.     @current_weapon = weapons[0]
  2065.   end
  2066.   #--------------------------------------------------------------------------
  2067.   # ○ アクションの変換とメソッドのコール
  2068.   #--------------------------------------------------------------------------
  2069.   def conv_action_members(action, members, i = 0)
  2070.     @parallel_action = false
  2071.     return conv_action(action) unless members
  2072.     num = alive_members_num(members)
  2073.     members.each {|member| next unless member.alive?; parallel_action_proc(member, action, i, num); i+= 1 }
  2074.     $game_party.parallel_action_members = [] if self.actor?
  2075.     $game_troop.parallel_action_members = [] if self.enemy?
  2076.   end
  2077.   #--------------------------------------------------------------------------
  2078.   # ○ 同時アクションメンバーの生存メンバー数を取得
  2079.   #--------------------------------------------------------------------------
  2080.   def alive_members_num(members)
  2081.     return actor_alive_members_num(members) if self.actor?
  2082.     return enemy_alive_members_num(members)
  2083.   end
  2084.   #--------------------------------------------------------------------------
  2085.   # ○ 同時アクションメンバーの生存メンバー数を取得(アクター)
  2086.   #--------------------------------------------------------------------------
  2087.   def actor_alive_members_num(members)
  2088.     members.each {|member| $game_party.parallel_action_members.push(member.index) }
  2089.     return $game_party.parallel_action_alive_members.size - 1
  2090.   end
  2091.   #--------------------------------------------------------------------------
  2092.   # ○ 同時アクションメンバーの生存メンバー数を取得(エネミー)
  2093.   #--------------------------------------------------------------------------
  2094.   def enemy_alive_members_num(members)
  2095.     members.each {|member| $game_troop.parallel_action_members.push(member.index) }
  2096.     return $game_troop.parallel_action_alive_members.size - 1
  2097.   end
  2098.   #--------------------------------------------------------------------------
  2099.   # ○ ダメージの実行
  2100.   #--------------------------------------------------------------------------
  2101.   def proc_damage(params)
  2102.     action_targets.each {|target| BattleManager.call_method(:invoke_item, target, current_action.item) }
  2103.   end
  2104.   #--------------------------------------------------------------------------
  2105.   # ○ 使用武器
  2106.   #--------------------------------------------------------------------------
  2107.   def use_weapon_pos(params)
  2108.     next_use_weapon = params[0] == "左" && weapons[1] ? weapons[1] : weapons[0]
  2109.     change_weapon_and_target(next_use_weapon)
  2110.   end
  2111.   #--------------------------------------------------------------------------
  2112.   # ○ 使用武器変更とターゲットの再設定
  2113.   #--------------------------------------------------------------------------
  2114.   def change_weapon_and_target(next_use_weapon)
  2115.     BattleManager.call_method(:action_icon, @current_weapon.icon_index) if self.actor?
  2116.     @current_weapon = next_use_weapon
  2117.     BattleManager.all_targets = current_action.pre_make_targets.compact
  2118.   end
  2119.   #--------------------------------------------------------------------------
  2120.   # ○ ターゲットの取得
  2121.   #--------------------------------------------------------------------------
  2122.   def action_targets
  2123.     BattleManager.all_targets
  2124.   end
  2125.   #--------------------------------------------------------------------------
  2126.   # ○ 同時アクションの実行
  2127.   #--------------------------------------------------------------------------
  2128.   def parallel_action_proc(member, action, index, alive_members_num)
  2129.     member.parallel_action = true
  2130.     member.conv_action(action)
  2131.     wait_for_action(member.reserve_wait.to_i) if member.reserve_wait > 0 && index == alive_members_num
  2132.     member.reserve_wait = 0 if member
  2133.     member.parallel_action = false
  2134.   end
  2135.   #--------------------------------------------------------------------------
  2136.   # ○ アクションの変換とメソッドのコール
  2137.   #--------------------------------------------------------------------------
  2138.   def conv_action(action)
  2139.     @next_repeat_count[@action_depth] = 0
  2140.     return @continue = true unless @continue
  2141.     BattleManager.action_wait_skip = false
  2142.     return wait_for_action(action) if action.is_a?(Integer)
  2143.     p_action = action.gsub(/\[(.+)\]/, "")
  2144.     call_action_method(p_action, $1)
  2145.     proc_repeat(action) if @repeat_count[@action_depth] && @repeat_count[@action_depth] > 0
  2146.   end
  2147.   #--------------------------------------------------------------------------
  2148.   # ○ ウェイト
  2149.   #--------------------------------------------------------------------------
  2150.   def wait_for_action(duration)
  2151.     BattleManager.call_method(:wait, duration)
  2152.   end
  2153.   #--------------------------------------------------------------------------
  2154.   # ○ アクションの中断
  2155.   #--------------------------------------------------------------------------
  2156.   def break_action(params)
  2157.     @break_action = true
  2158.   end
  2159.   #--------------------------------------------------------------------------
  2160.   # ○ リピートの実行
  2161.   #--------------------------------------------------------------------------
  2162.   def proc_repeat(action)
  2163.     @repeat_count[@action_depth] -= 1
  2164.     conv_action(action)
  2165.   end
  2166.   #--------------------------------------------------------------------------
  2167.   # ○ 繰り返し
  2168.   #--------------------------------------------------------------------------
  2169.   def repeat_action(params)
  2170.     @next_repeat_count[@action_depth] = params[0].to_i - 1
  2171.   end
  2172.   #--------------------------------------------------------------------------
  2173.   # ○ 条件
  2174.   #--------------------------------------------------------------------------
  2175.   def next_condition(params)
  2176.     ret = check_condition(params[0])
  2177.     @continue = params[1] == "not" ? !ret : ret
  2178.   end
  2179.   #--------------------------------------------------------------------------
  2180.   # ○ 同時
  2181.   #--------------------------------------------------------------------------
  2182.   def parallel_action(params)
  2183.     members = parallel_all_members
  2184.     members = parallel_index_members(members, $1) if params[1] =~ /Index\[(.*?)\]/
  2185.     members = parallel_name_members(members, $1)  if params[1] =~ /名前\[(.*?)\]/
  2186.     proc_parallel_action(members, params[0])
  2187.   end
  2188.   #--------------------------------------------------------------------------
  2189.   # ○ 名前指定同時のメンバー取得
  2190.   #--------------------------------------------------------------------------
  2191.   def parallel_name_members(members, param, ret = [])
  2192.     return members unless self.actor?
  2193.     names = $a1_common.split_array(param)
  2194.     names.each {|name| members.each {|member| ret.push(member) if member.name == name }}
  2195.     return ret
  2196.   end
  2197.   #--------------------------------------------------------------------------
  2198.   # ○ Index指定同時のメンバー取得
  2199.   #--------------------------------------------------------------------------
  2200.   def parallel_index_members(members, param, ret = [])
  2201.     indexs = $a1_common.split_array(param)
  2202.     indexs.each {|index| ret.push(members[index.to_i]) }
  2203.     return ret
  2204.   end
  2205.   #--------------------------------------------------------------------------
  2206.   # ○ 全員同時のメンバー取得
  2207.   #--------------------------------------------------------------------------
  2208.   def parallel_all_members
  2209.     return $game_party.battle_members if self.actor?
  2210.     return $game_troop.members unless self.actor?
  2211.   end
  2212.   #--------------------------------------------------------------------------
  2213.   # ○ 同時アクション実行
  2214.   #--------------------------------------------------------------------------
  2215.   def proc_parallel_action(members, action_key)
  2216.     proc_action(action_key, members)
  2217.   end
  2218.   #--------------------------------------------------------------------------
  2219.   # ○ コンボ開始
  2220.   #--------------------------------------------------------------------------
  2221.   def start_combo
  2222.     @commbo      = true
  2223.     @next_action = true
  2224.   end
  2225.   #--------------------------------------------------------------------------
  2226.   # ○ コンボ終了
  2227.   #--------------------------------------------------------------------------
  2228.   def end_combo
  2229.     @commbo      = false
  2230.   end
  2231.   #--------------------------------------------------------------------------
  2232.   # ○ 派生
  2233.   #--------------------------------------------------------------------------
  2234.   def next_action(params)
  2235.     return setup_next_skill($1.to_i) if params[0] =~ /スキル\[(\d+)\]/
  2236.     return setup_next_item($1.to_i)  if params[0] =~ /アイテム\[(\d+)\]/
  2237.     @action_depth += 1
  2238.     proc_action(params[0])
  2239.     @action_depth -= 1 if @action_depth > 0
  2240.   end
  2241.   #--------------------------------------------------------------------------
  2242.   # ○ 派生スキルのセット
  2243.   #--------------------------------------------------------------------------
  2244.   def setup_next_skill(skill_id)
  2245.     current_action.set_skill(skill_id)
  2246.     @break_action = true
  2247.     @next_action  = true
  2248.   end
  2249.   #--------------------------------------------------------------------------
  2250.   # ○ 派生アイテムのセット
  2251.   #--------------------------------------------------------------------------
  2252.   def setup_next_item(item_id)
  2253.     current_action.set_item(item_id)
  2254.     @break_action = true
  2255.     @next_action  = true
  2256.   end
  2257.   #--------------------------------------------------------------------------
  2258.   # ○ メソッドのコール
  2259.   #--------------------------------------------------------------------------
  2260.   def call_action_method(action, param)
  2261.     param  = conv_action_params(param) if param
  2262.     params = $a1_common.split_array(param) if param
  2263.     method(BattleManager.side_view_actions.action_symbol[action]).call(params)
  2264.   end
  2265.   #--------------------------------------------------------------------------
  2266.   # ○ スクリプトのコンバート(配列から)
  2267.   #--------------------------------------------------------------------------
  2268.   def convert_script_array(params, ret = [])
  2269.     params.each {|param| ret.push(convert_script(param)) }
  2270.     return ret
  2271.   end
  2272.   #--------------------------------------------------------------------------
  2273.   # ○ スクリプトのコンバート
  2274.   #--------------------------------------------------------------------------
  2275.   def convert_script(param)
  2276.     return param unless param.is_a?(String)
  2277.     loop { param = param.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  2278.     return param
  2279.   end
  2280.   #--------------------------------------------------------------------------
  2281.   # ○ アクションパラメータのコンバート
  2282.   #--------------------------------------------------------------------------
  2283.   def conv_action_params(param)
  2284.     param = convert_script(param)
  2285.     loop { param = param.sub(/<s>(.+?)<\/s>/i) { eval($1) }; break unless $1 }
  2286.     param = param.sub(/\{(.*?)\}/) { BattleManager.side_view_actions.action_params[$1] }
  2287.     return param unless $1
  2288.     conv_data = BattleManager.side_view_actions.action_params[$1]
  2289.     return conv_data unless conv_data.is_a?(String)
  2290.     param = conv_action_params(param) if $1
  2291.     return param
  2292.   end
  2293.   #--------------------------------------------------------------------------
  2294.   # ○ スキル/アイテムのアクションを取得
  2295.   #--------------------------------------------------------------------------
  2296.   def get_action(item)
  2297.     return get_item_action if item.is_a?(RPG::Item)
  2298.     get_skill_action(item)
  2299.   end
  2300.   #--------------------------------------------------------------------------
  2301.   # ○ アイテムのアクションを取得
  2302.   #--------------------------------------------------------------------------
  2303.   def get_item_action
  2304.     return "汎用アイテム使用"
  2305.   end
  2306.   #--------------------------------------------------------------------------
  2307.   # ○ スキルのアクションを取得
  2308.   #--------------------------------------------------------------------------
  2309.   def get_skill_action(item)
  2310.     return "防御" if item.id == 2
  2311.     return "汎用スキル使用" if item.damage.element_id >= 0
  2312.     action_key = @current_weapon.sv_action if @current_weapon
  2313.     return "通常攻撃" if !action_key || action_key.empty?
  2314.     return action_key
  2315.   end
  2316.   #--------------------------------------------------------------------------
  2317.   # ○ 実行
  2318.   #--------------------------------------------------------------------------
  2319.   def proc_use_item(params)
  2320.     BattleManager.action_wait_skip = true if params && params[0] == "skip"
  2321.     BattleManager.call_method(:use_item)
  2322.   end
  2323.   #--------------------------------------------------------------------------
  2324.   # ○ 移動
  2325.   #--------------------------------------------------------------------------
  2326.   def move_pos(params)
  2327.     return if @commbo
  2328.     @jump = (params[1] == "ジャンプ")
  2329.     return move_standard_pos($a1_common.split_array($1)) if params[0] =~ /定位置\[(.*?)\]/
  2330.     return move_leftstep($a1_common.split_array($1))     if params[0] =~ /前進\[(.*?)\]/
  2331.     return move_rightstep($a1_common.split_array($1))    if params[0] =~ /後退\[(.*?)\]/
  2332.     return move_to_target($a1_common.split_array($1))    if params[0] =~ /対象\[(.*?)\]/
  2333.     return move_to_center($a1_common.split_array($1))    if params[0] =~ /敵中心\[(.*?)\]/
  2334.     return rel_move($a1_common.split_array($1))          if params[0] =~ /相対\[(.*?)\]/
  2335.     return abs_move($a1_common.split_array($1))          if params[0] =~ /絶対\[(.*?)\]/
  2336.     return move_init_pos($a1_common.split_array($1))     if params[0] =~ /初期位置\[(.*?)\]/
  2337.     return move_substitute($a1_common.split_array($1))   if params[0] =~ /身代わり\[(.*?)\]/
  2338.   end
  2339.   #--------------------------------------------------------------------------
  2340.   # ○ 身代わり先に移動
  2341.   #--------------------------------------------------------------------------
  2342.   def move_substitute(params)
  2343.     substitute_target = $game_party.battle_members[@substitute_target]
  2344.     x = substitute_target.screen_x - 32
  2345.     y = substitute_target.screen_y
  2346.     move_to_pos(params[0].to_f, x, y)
  2347.     wait_for_move if params[1] == "wait"
  2348.   end
  2349.   #--------------------------------------------------------------------------
  2350.   # ○ 敵中心に移動
  2351.   #--------------------------------------------------------------------------
  2352.   def move_to_center(params)
  2353.     return move_to_target(params) unless self.actor?
  2354.     move_to_pos(params[0].to_f, Graphics.width / 3, Graphics.height / 3 * 2)
  2355.     wait_for_move if params[1] == "wait"
  2356.   end
  2357.   #--------------------------------------------------------------------------
  2358.   # ○ 初期位置に戻る
  2359.   #--------------------------------------------------------------------------
  2360.   def move_init_pos(params)
  2361.     move_to_pos(params[0].to_f, @init_x, @init_y)
  2362.     wait_for_move if params[1] == "wait"
  2363.   end
  2364.   #--------------------------------------------------------------------------
  2365.   # ○ 定位置に戻る
  2366.   #--------------------------------------------------------------------------
  2367.   def move_standard_pos(params)
  2368.     return if @screen_x == @standard_x && @screen_y == @standard_y
  2369.     BattleManager.call_method(:action_icon, @current_weapon.icon_index) if self.actor? && @current_weapon
  2370.     move_to_pos(params[0].to_f, @standard_x, @standard_y)
  2371.     wait_for_move if params[1] == "wait"
  2372.   end
  2373.   #--------------------------------------------------------------------------
  2374.   # ○ ターゲット前まで移動
  2375.   #--------------------------------------------------------------------------
  2376.   def move_to_target(params)
  2377.     target = BattleManager.move_target
  2378.     move_to_pos(params[0].to_f, post_target_x(target.screen_x), target.screen_y)
  2379.     wait_for_move if params[1] == "wait"
  2380.   end
  2381.   #--------------------------------------------------------------------------
  2382.   # ○ ターゲットの前を取得
  2383.   #--------------------------------------------------------------------------
  2384.   def post_target_x(target_screen_x)
  2385.     return target_screen_x + 64 if self.actor?
  2386.     return target_screen_x - 64
  2387.   end
  2388.   #--------------------------------------------------------------------------
  2389.   # ○ 指定位置まで移動
  2390.   #--------------------------------------------------------------------------
  2391.   def move_to_pos(duration, target_x, target_y)
  2392.     @move_count      = 0
  2393.     @move_duration   = duration
  2394.     @pre_move_x      = @screen_x
  2395.     @pre_move_y      = @screen_y
  2396.     @target_x        = @screen_x + (target_x - @screen_x)
  2397.     @distance_x      = (target_x - @screen_x) / duration
  2398.     @target_y        = @screen_y + (target_y - @screen_y)
  2399.     @distance_y      = (target_y - @screen_y) / duration
  2400.   end
  2401.   #--------------------------------------------------------------------------
  2402.   # ○ 左に1歩移動
  2403.   #--------------------------------------------------------------------------
  2404.   def move_leftstep(params)
  2405.     plus = self.actor? ? -32 : 32
  2406.     move_to_pos(params[0].to_f, @standard_x + plus, @standard_y)
  2407.     wait_for_move if params[1] == "wait"
  2408.   end
  2409.   #--------------------------------------------------------------------------
  2410.   # ○ 右に1歩移動
  2411.   #--------------------------------------------------------------------------
  2412.   def move_rightstep(params)
  2413.     plus = self.actor? ? 32 : -32
  2414.     move_to_pos(params[0].to_f, @standard_x + plus, @standard_y)
  2415.     wait_for_move if params[1] == "wait"
  2416.   end
  2417.   #--------------------------------------------------------------------------
  2418.   # ○ 相対移動
  2419.   #--------------------------------------------------------------------------
  2420.   def rel_move(params)
  2421.     target_x = @screen_x + params[0].to_i
  2422.     target_y = @screen_y + params[1].to_i
  2423.     move_to_pos(params[2].to_f, target_x, target_y)
  2424.     wait_for_move if params[3] == "wait"
  2425.   end
  2426.   #--------------------------------------------------------------------------
  2427.   # ○ 絶対移動
  2428.   #--------------------------------------------------------------------------
  2429.   def abs_move(params)
  2430.     move_to_pos(params[2].to_f, params[0].to_i, params[1].to_i)
  2431.     wait_for_move if params[3] == "wait"
  2432.   end
  2433.   #--------------------------------------------------------------------------
  2434.   # ○ 直立
  2435.   #--------------------------------------------------------------------------
  2436.   def set_pattern_fix(params)
  2437.     return @pre_pattern_fix =  1 if params && params[0] == "予約"
  2438.     return release_ptattern_fix  if params && params[0] == "解除"
  2439.     @pattern_fix = 1
  2440.   end
  2441.   #--------------------------------------------------------------------------
  2442.   # ○ 直立解除
  2443.   #--------------------------------------------------------------------------
  2444.   def release_ptattern_fix
  2445.     @pre_pattern_fix = -1
  2446.     @pattern_fix     = -1
  2447.   end
  2448.   #--------------------------------------------------------------------------
  2449.   # ○ 移動が終わるまでウェイト
  2450.   #--------------------------------------------------------------------------
  2451.   def wait_for_move
  2452.     return @reserve_wait = @move_duration if @parallel_action
  2453.     BattleManager.call_method(:wait_for_move) while move_now?
  2454.   end
  2455.   #--------------------------------------------------------------------------
  2456.   # ○ 移動中?
  2457.   #--------------------------------------------------------------------------
  2458.   def move_now?
  2459.     @move_duration > 0
  2460.   end
  2461.   #--------------------------------------------------------------------------
  2462.   # ○ 武器動作
  2463.   #--------------------------------------------------------------------------
  2464.   def weapon_action(params)
  2465.     return unless self.actor?
  2466.     sv_action = BattleManager.side_view_actions
  2467.     w_action  = sv_action.weapon_action[params[0]]
  2468.     p_action  = sv_action.picture_action(w_action[0])
  2469.     p_action  = conv_action_params(p_action) if p_action.is_a?(String)
  2470.     character_action([w_action[1]]) if w_action[1]
  2471.     use_icon  = @current_weapon.sv_icon >= 0 ?  @current_weapon.sv_icon : @current_weapon.icon_index
  2472.     BattleManager.call_method(:action_icon, use_icon, p_action, self)
  2473.   end
  2474.   #--------------------------------------------------------------------------
  2475.   # ○ ステート動作
  2476.   #--------------------------------------------------------------------------
  2477.   def state_action(params)
  2478.     return unless self.actor?
  2479.     param = params[0] if params
  2480.     action_name = now_state(param)
  2481.     action_name = wait_type if action_name == "待機"
  2482.     action_list = BattleManager.side_view_actions.state_actions[action_name]
  2483.     character_action([action_list[0]])
  2484.     @force_break  = action_list[1]
  2485.     @balloon_id   = action_list[2]
  2486.   end
  2487.   #--------------------------------------------------------------------------
  2488.   # ○ 表示するステート取得
  2489.   #--------------------------------------------------------------------------
  2490.   def now_state(now_state)
  2491.     states.each {|state| return state.name if STATE_LIST.include?(state.name)}
  2492.     return "防御待機" if guard?
  2493.     now_state ? now_state : "通常"
  2494.   end
  2495.   #--------------------------------------------------------------------------
  2496.   # ○ 待機タイプ取得
  2497.   #--------------------------------------------------------------------------
  2498.   def wait_type
  2499.     return "通常待機" unless current_action
  2500.     return "通常待機" unless current_action.item.is_a?(RPG::Skill)
  2501.     return "通常待機" if current_action.item.stype_id == 0
  2502.     return "#{$data_system.skill_types[current_action.item.stype_id]}待機"
  2503.   end
  2504.   #--------------------------------------------------------------------------
  2505.   # ○ キャラクター動作
  2506.   #--------------------------------------------------------------------------
  2507.   def character_action(params)
  2508.     return unless self.actor?
  2509.     c_action = BattleManager.side_view_actions.character_action[params[0]]
  2510.     proc_character_action(c_action)
  2511.   end
  2512.   #--------------------------------------------------------------------------
  2513.   # ○ キャラクター動作の実行
  2514.   #--------------------------------------------------------------------------
  2515.   def proc_character_action(c_action)
  2516.     @c_action_loop     = c_action[1]
  2517.     @c_action_list     = c_action[0]
  2518.     @c_action_list     = conv_action_params(@c_action_list) if @c_action_list.is_a?(String)
  2519.     @c_action_index    = 0
  2520.     setup_action_battler(c_action[2]) if c_action[2]
  2521.   end
  2522.   #--------------------------------------------------------------------------
  2523.   # ○ キャラクター動作の更新
  2524.   #--------------------------------------------------------------------------
  2525.   def update_character_action
  2526.     return unless @c_action_list
  2527.     return @c_action_count -= 1 if @c_action_count > 0
  2528.     action = @c_action_list[@c_action_index]
  2529.     @c_action_index += 1
  2530.     @c_action_index = 0   if !@c_action_list[@c_action_index] && @c_action_loop
  2531.     @c_action_list  = nil if !@c_action_list[@c_action_index] && !@c_action_loop
  2532.     return @c_action_count = action if action.is_a?(Integer)
  2533.     return unless action
  2534.     conv_action(action)
  2535.   end
  2536.   #--------------------------------------------------------------------------
  2537.   # ○ バトラーアクションの設定
  2538.   #--------------------------------------------------------------------------
  2539.   def setup_action_battler(action_name)
  2540.     sv_action = BattleManager.side_view_actions
  2541.     @battler_action = sv_action.picture_action(action_name)
  2542.     @battler_action = conv_action_params(@battler_action) if @battler_action.is_a?(String)
  2543.     @x_plus         = (@battler_action.ed_x - @battler_action.st_x) / @battler_action.duration.to_f
  2544.     @y_plus         = (@battler_action.ed_y - @battler_action.st_y) / @battler_action.duration.to_f
  2545.     @pre_move_x = @screen_x
  2546.     @pre_move_y = @screen_y
  2547.     update_action_pos
  2548.   end
  2549.   #--------------------------------------------------------------------------
  2550.   # ○ アニメ
  2551.   #--------------------------------------------------------------------------
  2552.   def proc_animation(params)
  2553.     BattleManager.action_wait_skip = true if params[1] == "skip"
  2554.     animation_id = params[0].to_i
  2555.     BattleManager.call_method(:show_animation, animation_targets(params), animation_id)
  2556.   end
  2557.   #--------------------------------------------------------------------------
  2558.   # ○ アニメのターゲットと位置を取得
  2559.   #--------------------------------------------------------------------------
  2560.   def animation_targets(params)
  2561.     targets = action_targets                if params[1] == "対象" || params[1] == "画面"
  2562.     targets = [self]                        if params[1] == "自身"
  2563.     $game_temp.force_animation_position = 1 if params[1] == "対象" || params[1] == "自身"
  2564.     $game_temp.force_animation_position = 3 if params[1] == "画面"
  2565.     return targets
  2566.   end
  2567.   #--------------------------------------------------------------------------
  2568.   # ○ 向き
  2569.   #--------------------------------------------------------------------------
  2570.   def change_direction(params)
  2571.     return unless self.actor?
  2572.     @direction = DIRECTION_SET[params[0]] if params[0]
  2573.     @pattern   = params[1].to_i if params[1]
  2574.   end
  2575.   #--------------------------------------------------------------------------
  2576.   # ○ ジャンプの高さを計算
  2577.   #--------------------------------------------------------------------------
  2578.   def jump_height
  2579.     return 0 unless @jump
  2580.     jump_peak = @move_duration / 2
  2581.     (jump_peak * jump_peak - (@move_count - jump_peak).abs ** 2) / 2
  2582.   end
  2583.   #--------------------------------------------------------------------------
  2584.   # ○ バトラー移動の更新
  2585.   #--------------------------------------------------------------------------
  2586.   def update_battler_move
  2587.     update_character_action if self.actor?
  2588.     update_action_pos if @battler_action
  2589.     return unless @distance_x && @distance_y
  2590.     return if @move_duration == 0
  2591.     @screen_x = @pre_move_x + @distance_x * @move_count
  2592.     @screen_y = @pre_move_y + @distance_y * @move_count - jump_height
  2593.     @move_count += 1
  2594.     move_end   if @move_count     >  @move_duration + 1
  2595.     return unless self.actor?
  2596.     @pattern_fix = @pre_pattern_fix if @distance_x == 0 && @distance_y == 0
  2597.   end
  2598.   #--------------------------------------------------------------------------
  2599.   # ○ バトラーアクション時の位置更新
  2600.   #--------------------------------------------------------------------------
  2601.   def update_action_pos
  2602.     @screen_x = @pre_move_x + @battler_action.st_x + @x_plus
  2603.     @screen_y = @pre_move_y + @battler_action.st_y + @y_plus
  2604.   end
  2605.   #--------------------------------------------------------------------------
  2606.   # ○ 移動の完了
  2607.   #--------------------------------------------------------------------------
  2608.   def move_end
  2609.     move_end_x
  2610.     move_end_y
  2611.     @jump = false
  2612.     @move_duration = 0
  2613.   end
  2614.   #--------------------------------------------------------------------------
  2615.   # ○ x座標移動の完了
  2616.   #--------------------------------------------------------------------------
  2617.   def move_end_x
  2618.     @screen_x = @target_x
  2619.     @distance_x = 0
  2620.   end
  2621.   #--------------------------------------------------------------------------
  2622.   # ○ y座標移動の完了
  2623.   #--------------------------------------------------------------------------
  2624.   def move_end_y
  2625.     @screen_y = @target_y
  2626.     @distance_y = 0
  2627.   end
  2628.   #--------------------------------------------------------------------------
  2629.   # ○ グラフィック変更
  2630.   #--------------------------------------------------------------------------
  2631.   def change_graphic(params)
  2632.     return unless self.actor?
  2633.     c_info         = actor.multi_character(params[0])
  2634.     @battler_name  = c_info[0]
  2635.     @battler_index = c_info[1]
  2636.     @direction     = DIRECTION_SET[params[1]] if params[1]
  2637.     @pattern       = params[2] ? params[2].to_i : 1
  2638.     @pattern_fix   = @pattern if params[3] == "固定"
  2639.   end
  2640.   #--------------------------------------------------------------------------
  2641.   # ○ コラプス許可の設定
  2642.   #--------------------------------------------------------------------------
  2643.   def set_collapse(params)
  2644.     return unless @collapse_flag
  2645.     @collapse_flag = params[0] == "許可" ? false : true
  2646.     BattleManager.call_method(:set_wait_collapse, action_targets, @collapse_flag, @collapse_flag)
  2647.   end
  2648.   #--------------------------------------------------------------------------
  2649.   # ○ アイテム/スキル使用可能チェック
  2650.   #--------------------------------------------------------------------------
  2651.   def item_usable?(kind, id)
  2652.     return usable?($data_skills[id]) if kind == "スキル"
  2653.     return $game_party.usable?($data_items[id]) if kind == "アイテム" && self.actor?
  2654.   end
  2655.   #--------------------------------------------------------------------------
  2656.   # ○ ピクチャ
  2657.   #--------------------------------------------------------------------------
  2658.   def picture_action(params)
  2659.     return unless params
  2660.     return show_picture($1)        if params[0] =~ /表示\[(.+)\]/
  2661.     return move_picture($1)        if params[0] =~ /移動\[(.+)\]/
  2662.     return rotate_picture($1)      if params[0] =~ /回転\[(.+)\]/
  2663.     return tone_change_picture($1) if params[0] =~ /色調\[(.+)\]/
  2664.     return erase_picture($1.to_i)  if params[0] =~ /消去\[(\d+)\]/
  2665.   end
  2666.   #--------------------------------------------------------------------------
  2667.   # ○ ピクチャの表示
  2668.   #--------------------------------------------------------------------------
  2669.   def show_picture(param_name)
  2670.     params     = BattleManager.side_view_actions.picture_params[param_name]
  2671.     params     = convert_script_array(params)
  2672.     pic_name   = params[1] == "バトラー" ? @battler_picture : params[1]
  2673.     return if pic_name.empty?
  2674.     picture    = $game_troop.screen.pictures[params[0].to_i]
  2675.     name       = pic_name
  2676.     origin     = params[2] == "左上" ? 0 : 1
  2677.     x          = params[3].to_i
  2678.     y          = params[4].to_i
  2679.     zoom_x     = params[5].to_i
  2680.     zoom_y     = params[6].to_i
  2681.     opacity    = params[7].to_i
  2682.     blend_type = params[8].to_i
  2683.     picture.show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)   
  2684.   end
  2685.   #--------------------------------------------------------------------------
  2686.   # ○ ピクチャの移動
  2687.   #--------------------------------------------------------------------------
  2688.   def move_picture(param_name)
  2689.     params     = BattleManager.side_view_actions.picture_params[param_name]
  2690.     params     = convert_script_array(params)
  2691.     picture    = $game_troop.screen.pictures[params[0].to_i]
  2692.     origin     = params[1] == "左上" ? 0 : 1
  2693.     x          = params[2].to_i
  2694.     y          = params[3].to_i
  2695.     zoom_x     = params[4].to_i
  2696.     zoom_y     = params[5].to_i
  2697.     opacity    = params[6].to_i
  2698.     blend_type = params[7].to_i
  2699.     duration   = params[8].to_i
  2700.     picture.move(origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration)
  2701.   end
  2702.   #--------------------------------------------------------------------------
  2703.   # ○ ピクチャの回転
  2704.   #--------------------------------------------------------------------------
  2705.   def rotate_picture(param_name)
  2706.     params     = BattleManager.side_view_actions.picture_params[param_name]
  2707.     params     = convert_script_array(params)
  2708.     $game_troop.screen.pictures[params[0].to_i].rotate(params[1].to_i)
  2709.   end
  2710.   #--------------------------------------------------------------------------
  2711.   # ○ ピクチャの色調変更
  2712.   #--------------------------------------------------------------------------
  2713.   def tone_change_picture(param_name)
  2714.     params     = BattleManager.side_view_actions.picture_params[param_name]
  2715.     params     = convert_script_array(params)
  2716.     picture    = $game_troop.screen.pictures[params[0].to_i]
  2717.     r          = params[1].to_i
  2718.     g          = params[2].to_i
  2719.     b          = params[3].to_i
  2720.     gr         = params[4].to_i if params[4]
  2721.     tone       = Tone.new(r, g, b, gr) if params[4]
  2722.     tone       = Tone.new(r, g, b) unless params[4]
  2723.     picture.start_tone_change(tone, params[5].to_i)
  2724.   end
  2725.   #--------------------------------------------------------------------------
  2726.   # ○ ピクチャの消去
  2727.   #--------------------------------------------------------------------------
  2728.   def erase_picture(pic_no)
  2729.     $game_troop.screen.pictures[pic_no].erase
  2730.   end
  2731.   #--------------------------------------------------------------------------
  2732.   # ★ スキル/アイテムの使用者側への効果
  2733.   #--------------------------------------------------------------------------
  2734.   def item_user_effect(user, item)
  2735.     gain = user.two_sword_style? ? item.tp_gain * TSS_TP_RATE : item.tp_gain
  2736.     user.tp += gain.round * user.tcr
  2737.   end
  2738.   #--------------------------------------------------------------------------
  2739.   # ○ ターゲットの生存チェック
  2740.   #--------------------------------------------------------------------------
  2741.   def target_alive_check
  2742.     action_targets.each {|target| return true if target.hp > 0 }
  2743.     return false
  2744.   end
  2745.   #--------------------------------------------------------------------------
  2746.   # ○ 条件のチェック
  2747.   #--------------------------------------------------------------------------
  2748.   def check_condition(condition)
  2749.     return two_sword_style?                        if condition == "二刀流"
  2750.     return item_usable?($1, $2.to_i)               if condition =~ /(\S+)使用可\[(\d+)\]/
  2751.     return target_alive_check                      if condition == "対象生存"
  2752.     return hp > 0                                  if condition == "自身生存"
  2753.     return @substitute_target                      if condition == "身代わり"
  2754.     list = BattleManager.side_view_actions.condition_list
  2755.     return eval($1) if list[condition] =~ /<s>(.+?)<\/s>/
  2756.     return true
  2757.   end
  2758.   #--------------------------------------------------------------------------
  2759.   # ○ オーディオアクション
  2760.   #--------------------------------------------------------------------------
  2761.   def audio_action(params)
  2762.     return audio_se(params[1], $1, $2.to_i, $3.to_i)  if params[0] =~ /SE\[(\S+)[,](\d+)[,](\d+)\]/
  2763.     return audio_me(params[1], $1, $2.to_i, $3.to_i)  if params[0] =~ /ME\[(\S+)[,](\d+)[,](\d+)\]/
  2764.     return audio_bgs(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /BGS\[(\S+)[,](\d+)[,](\d+)\]/
  2765.     return audio_bgm_fede($1, $2.to_i, $3.to_i)       if params[0] =~ /BGM\[フェード(\S+?)[,](\d+)[,]?(\d+)?\]/
  2766.     return audio_bgm(params[1], $1, $2.to_i, $3.to_i) if params[0] =~ /BGM\[(\S+)[,](\d+)[,](\d+)\]/
  2767.   end
  2768.   #--------------------------------------------------------------------------
  2769.   # ○ SEの演奏/停止
  2770.   #--------------------------------------------------------------------------
  2771.   def audio_se(kind, name, volume, pitch)
  2772.     return RPG::SE.stop if kind == "停止"
  2773.     RPG::SE.new(name, volume, pitch).play
  2774.   end
  2775.   #--------------------------------------------------------------------------
  2776.   # ○ MEの演奏/停止
  2777.   #--------------------------------------------------------------------------
  2778.   def audio_me(kind, name, volume, pitch)
  2779.     return RPG::ME.stop if kind == "停止"
  2780.     RPG::ME.new(name, volume, pitch).play
  2781.   end
  2782.   #--------------------------------------------------------------------------
  2783.   # ○ BGSの演奏/停止
  2784.   #--------------------------------------------------------------------------
  2785.   def audio_bgs(kind, name, volume, pitch)
  2786.     return RPG::BGS.stop if kind == "停止"
  2787.     RPG::BGS.new(name, volume, pitch).play
  2788.   end
  2789.   #--------------------------------------------------------------------------
  2790.   # ○ BGMの演奏/停止
  2791.   #--------------------------------------------------------------------------
  2792.   def audio_bgm(kind, name, volume, pitch)
  2793.     return RPG::BGM.stop if kind == "停止"
  2794.     RPG::BGM.new(name, volume, pitch).play
  2795.   end
  2796.   #--------------------------------------------------------------------------
  2797.   # ○ BGMのフェードイン/フェードアウト
  2798.   #--------------------------------------------------------------------------
  2799.   def audio_bgm_fede(kind, param1, param2)
  2800.     return RPG::BGM.fade(param1) if kind == "アウト"
  2801.     audio_class = A1_System::AudioFile.new(RPG::BGM.last, param1, param2)
  2802.     $a1_common.fadein_bgm = audio_class
  2803.   end
  2804.   #--------------------------------------------------------------------------
  2805.   # ○ BGSのフェードイン/フェードアウト
  2806.   #--------------------------------------------------------------------------
  2807.   def audio_bgs_fede(kind, param1, param2)
  2808.     return RPG::BGS.fade(param1) if kind == "アウト"
  2809.     audio_class = A1_System::AudioFile.new(RPG::BGS.last, param1, param2)
  2810.     $a1_common.fadein_bgs = audio_class
  2811.   end
  2812. #==============================================================================
  2813. # ■ 消耗品装備対応処理
  2814. #==============================================================================
  2815.   if $imported["A1_ConsumerEquip"]
  2816.   #--------------------------------------------------------------------------
  2817.   # ○ 使用武器
  2818.   #--------------------------------------------------------------------------
  2819.   def use_weapon_pos(params)
  2820.     next_weapon = next_use_weapon(params)
  2821.     change_weapon_and_target(next_weapon)
  2822.   end
  2823.   #--------------------------------------------------------------------------
  2824.   # ○ 次に使う武器を取得
  2825.   #--------------------------------------------------------------------------
  2826.   def next_use_weapon(params)
  2827.     return chenge_consumer_main(params) if use_consumer?
  2828.     return dominant_hand == "左" && two_sword_style? ? weapons[0] : weapons[1] if params[0] == "左"
  2829.     return dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0]
  2830.     return weapons[0]
  2831.   end
  2832.   #--------------------------------------------------------------------------
  2833.   # ○ 消耗品を使う武器のメインを変更
  2834.   #--------------------------------------------------------------------------
  2835.   def chenge_consumer_main(params)
  2836.     @current_main = dominant_hand == "左" && two_sword_style? ? weapons[0] : weapons[1] if params[0] == "左"
  2837.     @current_main = dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0] if params[0] != "左"
  2838.     return consumer_equip[0]
  2839.   end
  2840.   #--------------------------------------------------------------------------
  2841.   # ○ 主武器
  2842.   #--------------------------------------------------------------------------
  2843.   def main_weapon
  2844.     return weapons[0] unless self.actor?
  2845.     dominant_hand == "左" && two_sword_style? ? weapons[1] : weapons[0]
  2846.   end
  2847.   #--------------------------------------------------------------------------
  2848.   # ○ 使用武器のセット
  2849.   #--------------------------------------------------------------------------
  2850.   def set_current_weapon
  2851.     main = main_weapon
  2852.     @current_weapon = main
  2853.     return if !self.actor?
  2854.     return if !use_consumer?
  2855.     @current_main   = main
  2856.     @current_weapon = consumer_equip[0]
  2857.   end;end
  2858. #==============================================================================
  2859. # ■ 全体通常攻撃対応処理
  2860. #==============================================================================
  2861.   if $imported["A1_WideNomalAttack"]
  2862.   #--------------------------------------------------------------------------
  2863.   # ★ 全体攻撃武器?(全体通常攻撃の再定義)
  2864.   #--------------------------------------------------------------------------
  2865.   def wide_attack_weapon?(any)
  2866.     return @current_weapon.wide_attack if @current_weapon && any
  2867.     return weapons.all? {|weapon| next unless weapon; weapon.wide_attack }
  2868.   end;end
  2869. end
  2870. #==============================================================================
  2871. # ■ Game_Temp
  2872. #------------------------------------------------------------------------------
  2873. #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
  2874. # スタンスは $game_temp で参照されます。
  2875. #==============================================================================
  2876.  
  2877. class Game_Temp
  2878.   #--------------------------------------------------------------------------
  2879.   # ○ 公開インスタンス変数
  2880.   #--------------------------------------------------------------------------
  2881.   attr_accessor :remove_party_action
  2882.   attr_accessor :add_party_action
  2883.   #--------------------------------------------------------------------------
  2884.   # ☆ オブジェクト初期化
  2885.   #--------------------------------------------------------------------------
  2886.   alias a1_side_view_gtp_initialize initialize
  2887.   def initialize
  2888.     a1_side_view_gtp_initialize
  2889.     @remove_party_action = nil
  2890.     @add_party_action    = nil
  2891.   end
  2892. end
  2893. #==============================================================================
  2894. # ■ A1_System::CommonModule
  2895. #==============================================================================
  2896.  
  2897. class A1_System::CommonModule
  2898.   #--------------------------------------------------------------------------
  2899.   # ☆ 注釈コマンド定義
  2900.   #--------------------------------------------------------------------------
  2901.   alias a1_side_view_define_command define_command
  2902.   def define_command
  2903.     a1_side_view_define_command
  2904.     @cmd_108["脱退アクション"] = :remove_party_action
  2905.     @cmd_108["加入アクション"] = :add_party_action
  2906.     @cmd_108["アクション実行"] = :proc_event_action
  2907.   end
  2908. end
  2909. #==============================================================================
  2910. # ■ Game_Interpreter
  2911. #------------------------------------------------------------------------------
  2912. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  2913. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  2914. #==============================================================================
  2915.  
  2916. class Game_Interpreter
  2917.   #--------------------------------------------------------------------------
  2918.   # ○ 脱退アクション
  2919.   #--------------------------------------------------------------------------
  2920.   def remove_party_action(params)
  2921.     return unless $game_party.in_battle
  2922.     $game_temp.remove_party_action = params[0]
  2923.   end
  2924.   #--------------------------------------------------------------------------
  2925.   # ○ 加入アクション
  2926.   #--------------------------------------------------------------------------
  2927.   def add_party_action(params)
  2928.     return unless $game_party.in_battle
  2929.     $game_temp.add_party_action = params[0]
  2930.   end
  2931.   #--------------------------------------------------------------------------
  2932.   # ○ アクション実行
  2933.   #--------------------------------------------------------------------------
  2934.   def proc_event_action(params)
  2935.     return unless $game_party.in_battle
  2936.     member = params[0] =~ /([0-9]+)/ ? $game_party.battle_members[$1.to_i] : search_battle_members(params[0])
  2937.     return unless member
  2938.     BattleManager.call_method(:proc_event_action, member, params[1])
  2939.   end
  2940.   #--------------------------------------------------------------------------
  2941.   # ○ バトルメンバーの名前から検索
  2942.   #--------------------------------------------------------------------------
  2943.   def search_battle_members(name)
  2944.     $game_party.battle_members.each {|member| return member if member.name == name }
  2945.   end
  2946. end
  2947. 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. #              :2012/01/21 Ver1.10 指定した陣形がない時はフリーファイトにするよう調整
  14. #---------------------------------------------------------------------------
  15. # 設置場所      
  16. #    サイドビューバトルスクリプト以下
  17. #
  18. # 必要スクリプト
  19. #    サイドビューバトルスクリプト
  20. #    戦闘中入れ替えスクリプト
  21. #---------------------------------------------------------------------------
  22. # 使い方
  23. #   ■ 陣形設定 に設定します
  24. #   ■ サイドビューアクション設定 に設定します
  25. #
  26. #   イベントコマンド「注釈」に記述します
  27. #
  28. #     陣形メニュー
  29. #
  30. #       陣形メニュー画面を開きます
  31. #
  32. #     陣形習得 追加|削除 陣形no
  33. #
  34. #       指定した陣形noの陣形を追加/削除します
  35. #
  36. #     陣形変更 陣形no
  37. #
  38. #       現在の陣形を指定した陣形noの陣形に変更します
  39. #==============================================================================
  40. $imported ||= {}
  41. if $imported["A1_SideViewBattle"] && $imported["A1_ChangeMember"]
  42. $imported["A1_BattleFormation"] = true
  43. old_common_script("陣形", "4.20") if common_version < 4.20
  44. #==============================================================================
  45. # ■ 陣形設定
  46. #==============================================================================
  47. module A1_System::BattleFormationConfig
  48.   #--------------------------------------------------------------------------
  49.   # 陣形メニュー画面を開く、メニュー画面でのコマンド名
  50.   #--------------------------------------------------------------------------
  51.   COMMAND_NAME       = "陣形"
  52.   #--------------------------------------------------------------------------
  53.   # 初期状態で習得している陣形no
  54.   #--------------------------------------------------------------------------
  55.   STARTING_LEARNED   = [0, 1]
  56.   #--------------------------------------------------------------------------
  57.   # 初期状態の陣形
  58.   #--------------------------------------------------------------------------
  59.   STARTING_FORMATION = 1
  60.   #--------------------------------------------------------------------------
  61.   # 最大戦闘参加人数
  62.   #--------------------------------------------------------------------------
  63.   MAX_BATTLE_MEMBERS = 5
  64.   #--------------------------------------------------------------------------
  65.   # 戦闘テストで5人目を使う
  66.   #--------------------------------------------------------------------------
  67.   TEST_5TH_MEMBER    = true
  68.   #--------------------------------------------------------------------------
  69.   # 各陣形のウィンドウ位置/メンバー初期位置/メンバー定位置座標
  70.   #--------------------------------------------------------------------------
  71.   FF_I_POS  = [ [790, 264], [774, 208], [806, 320], [758, 152], [822, 376] ]
  72.  
  73.   FF_W_POS  = [ [520, 293], [504, 237], [536, 349], [488, 181], [552, 405] ]
  74.   FF_S_POS  = [ [504, 364], [488, 304], [520, 418], [472, 250], [536, 476] ]
  75.  
  76.   FF4_W_POS = [ [504, 253], [520, 309], [488, 197], [536, 365] ]
  77.   FF4_S_POS = [ [488, 320], [504, 380], [472, 266], [520, 434] ]
  78.  
  79.   IC_W_POS  = [ [448, 317], [538, 317], [358, 317], [406, 237], [470, 409] ]
  80.   IC_S_POS  = [ [464, 334], [554, 334], [374, 334], [448, 254], [480, 426] ]
  81.  
  82.   AS_W_POS  = [ [378, 285], [444, 253], [460, 333], [518, 221], [534, 381] ]
  83.   AS_S_POS  = [ [374, 334], [440, 302], [456, 382], [514, 270], [530, 430] ]
  84.  
  85.   RS_W_POS  = [ [498, 293], [504, 237], [536, 349], [488, 181], [552, 405] ]
  86.   RS_S_POS  = [ [472, 364], [488, 304], [520, 418], [472, 250], [536, 476] ]
  87.   #--------------------------------------------------------------------------
  88.   # 陣形位置設定
  89.   #
  90.   #   選択できる陣形は、現在の戦闘参加人数で固定です
  91.   #
  92.   #   陣形No:            陣形Noを指定します
  93.   #                       イベントコマンドでメンバーの変更をした場合
  94.   #                       陣形No 0 に強制的に変わります
  95.   #   陣形名            :陣形名を指定します
  96.   #   ウィンドウ位置    :各メンバーの個別ステータスウィンドウの位置を指定します
  97.   #   初期位置          :各メンバーのバトル初期位置を指定します
  98.   #   定位置            :各メンバーのバトル定位置を指定します
  99.   #   上下カーソル移動順:カーソルを上下に動かした時のカーソル移動順を指定します
  100.   #--------------------------------------------------------------------------
  101.   BATTLE_FORMATION_POS = [
  102.   {
  103.   #--------------------------------------------------------------------------
  104.   # 1人陣形
  105.   #--------------------------------------------------------------------------
  106.   # 陣形No   陣形名,               ウィンドウ位置, 初期位置, 定位置,   上下カーソル移動順
  107.      0   => ["フリーファイト",     FF_W_POS,       FF_I_POS, FF_S_POS,  []],
  108.   },{
  109.   #--------------------------------------------------------------------------
  110.   # 2人陣形
  111.   #--------------------------------------------------------------------------
  112.   # 陣形No   陣形名,               ウィンドウ位置, 初期位置, 定位置,   上下カーソル移動順
  113.      0   => ["フリーファイト",     FF4_W_POS,      FF_I_POS, FF4_S_POS, [0, 1]],
  114.   },{
  115.   #--------------------------------------------------------------------------
  116.   # 3人陣形
  117.   #--------------------------------------------------------------------------
  118.   # 陣形No   陣形名,               ウィンドウ位置, 初期位置, 定位置,   上下カーソル移動順
  119.      0   => ["フリーファイト",     FF_W_POS,       FF_I_POS, FF_S_POS,  [1, 0, 2]],
  120.   },{
  121.   #--------------------------------------------------------------------------
  122.   # 4人陣形
  123.   #--------------------------------------------------------------------------
  124.   # 陣形No   陣形名,               ウィンドウ位置, 初期位置, 定位置,   上下カーソル移動順
  125.      0   => ["フリーファイト",     FF4_W_POS,      FF_I_POS, FF4_S_POS, [2, 0, 1, 3]],
  126.   },{
  127.   #--------------------------------------------------------------------------
  128.   # 5人陣形
  129.   #--------------------------------------------------------------------------
  130.   # 陣形No   陣形名,               ウィンドウ位置, 初期位置, 定位置,   上下カーソル移動順
  131.      0   => ["フリーファイト",     FF_W_POS,       FF_I_POS, FF_S_POS,  [3, 1, 0, 2, 4]],
  132.      1   => ["インペリアルクロス", IC_W_POS,       FF_I_POS, IC_S_POS,  [2, 3, 0, 4, 1]],
  133.      2   => ["アマゾンストライク", AS_W_POS,       FF_I_POS, AS_S_POS,  [0, 1, 2, 3, 4]],
  134.      3   => ["ラピッドストリーム", RS_W_POS,       FF_I_POS, RS_S_POS,  [3, 1, 0, 2, 4]],
  135.   }]
  136.   #--------------------------------------------------------------------------
  137.   # 陣形ボーナス設定
  138.   #
  139.   #   陣形名      :陣形位置設定で設定した陣形名を指定します
  140.   #   付与メンバー:ボーナスを付与するメンバーの位置を指定します
  141.   #   内容        :付与するボーナスの内容を指定します
  142.   #--------------------------------------------------------------------------
  143.   BATTLE_FORMATION_BONUS = {
  144.   # 陣形名                付与メンバー => [内容]
  145.   "フリーファイト"     => {},
  146.   "インペリアルクロス" => {  1 => ["狙われ率-50"],
  147.                              2 => ["行動前防御", "狙われ率50"],
  148.                           },
  149.   "アマゾンストライク" => {  0 => ["攻撃力25", "行動後防御", "すばやさ25"],
  150.                              1 => ["攻撃力25", "行動後防御", "すばやさ25"],  
  151.                              2 => ["攻撃力25", "行動後防御", "すばやさ25"],  
  152.                           },
  153.   "ラピッドストリーム" => { -1 => ["先制行動[RS]"] },
  154.  
  155.   }
  156.   #--------------------------------------------------------------------------
  157.   # 陣形ボーナスの内容設定
  158.   #
  159.   #   ボーナス名    :任意の文字列を指定します
  160.   #   付与タイミング:開始時 行動後 ターン終了時 行動順序 のいずれかを指定します
  161.   #
  162.   #                   「開始時」は各種パラメータボーナスのみ
  163.   #                   「行動後」は「防御状態」のみ
  164.   #                   「ターン終了時」は「HP回復」「MP回復」「TP回復」のみ
  165.   #                   「行動順序」は「先制行動」「敵行動待ち」「連続行動」のみ
  166.   #
  167.   #   内容          :防御状態            防御状態になります
  168.   #                   狙われ率[val]       狙われ率が val の値追加されます
  169.   #                   最大HP[val]         最大HPが val の値追加されます
  170.   #                   最大MP[val]         最大MPが val の値追加されます
  171.   #                   攻撃力[val,w_kind]  攻撃力が val の値追加されます w_kind 省略可
  172.   #                                       w_kind を指定すると指定した武器タイプのみになります
  173.   #                   防御力[val]         防御力が val の値追加されます
  174.   #                   魔法力[val]         魔法力が val の値追加されます
  175.   #                   魔法防御[val]       魔法防御が val の値追加されます
  176.   #                   すばやさ[val]       すばやさが val の値追加されます
  177.   #                   運[val]             運が val の値追加されます
  178.   #                   HP回復[val%]        HPが val% の値回復します
  179.   #                                       % を省略すると固定値になります
  180.   #                   MP回復[val%]        MPが val% の値回復します
  181.   #                                       % を省略すると固定値になります
  182.   #                   TP回復[val%]        TPが val% の値回復します
  183.   #                                       % を省略すると固定値になります
  184.   #                   先制行動[order]     order の順番に先制行動します
  185.   #                   敵行動待ち[order]   敵の行動を待ってから order の順番に行動します
  186.   #                   連続行動[order]     order の最初のメンバーの行動順が回ってきたら
  187.   #                                       order の順番に連続して行動します
  188.   #--------------------------------------------------------------------------
  189.   BONUS_INFO = {
  190.   # ボーナス名         付与タイミング,  内容,            解除タイミング
  191.   "行動前防御"     => ["開始時",       "防御状態",      "行動後"],
  192.   "行動後防御"     => ["行動後",       "防御状態"],
  193.   "狙われ率50"     => ["開始時",       "狙われ率[50]"],
  194.   "狙われ率-50"    => ["開始時",       "狙われ率[-50]"],
  195.   "攻撃力25"       => ["開始時",       "攻撃力[25]"],
  196.   "弓攻撃力25"     => ["開始時",       "攻撃力[25,弓]"],
  197.   "魔法力50"       => ["開始時",       "魔法力[50]"],
  198.   "すばやさ25"     => ["開始時",       "すばやさ[25]"],
  199.   "HP回復[5%]"     => ["ターン終了時", "HP回復[5%]"],
  200.   "先制行動[RS]"   => ["行動順序",     "先制行動[0, 1, 2, 3, 4]"],
  201.   "敵行動待ち[MF]" => ["行動順序",     "敵行動待ち[0, 1, 2, 3, 4]"],
  202.   "連続行動[稲妻]" => ["行動順序",     "連続行動[3, 4, 1, 2, 0]"],
  203.   "連続行動[龍陣]" => ["行動順序",     "連続行動[0, 1, 2, 3, 4]"],
  204.   }
  205. end
  206. #==============================================================================
  207. # ■ サイドビューアクション設定
  208. #==============================================================================
  209. module A1_System::SideViewActionConfig
  210.   ACTION_LIST["陣形変更"]         = ["同時[陣形変更ジャンプ]"]
  211.   ACTION_LIST["位置変更"]         = ["同時[陣形変更ジャンプ, Index[{1人目},{2人目}]]"]
  212.   ACTION_LIST["陣形変更ジャンプ"] = ["移動[定位置[30, wait],ジャンプ]"]
  213.   ACTION_PARAMS["1人目"]          = "<s>@parallel_members[0]</s>"
  214.   ACTION_PARAMS["2人目"]          = "<s>@parallel_members[1]</s>"
  215. end
  216. #==============================================================================
  217. # ■ BattleManager
  218. #------------------------------------------------------------------------------
  219. #  戦闘の進行を管理するモジュールです。
  220. #==============================================================================
  221.  
  222. module BattleManager
  223.   #--------------------------------------------------------------------------
  224.   # ○ エイリアス用特異メソッド
  225.   #--------------------------------------------------------------------------
  226.   class << self
  227.     alias :a1_battle_formation_bm_battle_end :battle_end
  228.     alias :a1_battle_formation_bm_make_action_orders :make_action_orders
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ☆ 行動順序の作成
  232.   #--------------------------------------------------------------------------
  233.   def self.make_action_orders
  234.     a1_battle_formation_bm_make_action_orders
  235.     party_bonus = $game_party.formation_bonus[-1]
  236.     return unless party_bonus && !@surprise
  237.     members = $game_party.battle_members
  238.     party_bonus.each {|bonus| orders_bonus(bonus, members)}
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ○ 行動順序系陣形ボーナス付与
  242.   #--------------------------------------------------------------------------
  243.   def self.orders_bonus(party_bonus, members)
  244.     return if call_method(:member_any_dead?)
  245.     bonus = $game_party.bonus_info(party_bonus)
  246.     return unless bonus[0] == "行動順序"
  247.     return all_members_preemptive($a1_common.split_array($1), members) if bonus[1] =~ /^先制行動\[(.+?)\]/
  248.     return enemy_actionend_wait($a1_common.split_array($1), members)   if bonus[1] =~ /^敵行動待ち\[(.+?)\]/
  249.     return chain_start_action($a1_common.split_array($1), members)     if bonus[1] =~ /^連続行動\[(.+?)\]/
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ○ 先制行動
  253.   #--------------------------------------------------------------------------
  254.   def self.all_members_preemptive(bonus, members)
  255.     members.each {|member| @action_battlers.delete(member) }
  256.     bonus.each_with_index {|index, i| @action_battlers.insert(i, members[index.to_i])  }
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ 敵行動待ち
  260.   #--------------------------------------------------------------------------
  261.   def self.enemy_actionend_wait(bonus, members)
  262.     members.each {|member| @action_battlers.delete(member) }
  263.     bonus.each {|index| @action_battlers.push(members[index.to_i]) }
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ○ 連続行動
  267.   #--------------------------------------------------------------------------
  268.   def self.chain_start_action(bonus, members)
  269.     start_member = members[bonus[0].to_i]
  270.     members.each {|member| next if start_member == member; @action_battlers.delete(member) }
  271.     start_order  = @action_battlers.index(start_member)
  272.     bonus.each_with_index {|index, i| next if i == 0; @action_battlers.insert(start_order + i, members[index.to_i]) }
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ☆ 戦闘終了
  276.   #     result : 結果(0:勝利 1:逃走 2:敗北)
  277.   #--------------------------------------------------------------------------
  278.   def self.battle_end(result)
  279.     call_method(:init_formation_bonus)
  280.     a1_battle_formation_bm_battle_end(result)
  281.   end
  282. end
  283. #==============================================================================
  284. # ■ DataManager
  285. #------------------------------------------------------------------------------
  286. #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する
  287. # ほぼ全てのグローバル変数はこのモジュールで初期化されます。
  288. #==============================================================================
  289.  
  290. module DataManager
  291.   #--------------------------------------------------------------------------
  292.   # ○ エイリアス用特異メソッド
  293.   #--------------------------------------------------------------------------
  294.   class << self
  295.     alias :a1_battle_formation_bm_load_battle_test_database :load_battle_test_database
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ☆ 戦闘テスト用のデータベースをロード
  299.   #--------------------------------------------------------------------------
  300.   def self.load_battle_test_database
  301.     a1_battle_formation_bm_load_battle_test_database
  302.     return unless A1_System::BattleFormationConfig::TEST_5TH_MEMBER
  303.     test_battler = RPG::System::TestBattler.new
  304.     test_battler.actor_id = 9
  305.     test_battler.level    = 30
  306.     test_battler.equips   = [49,0,0,1]
  307.     $data_system.test_battlers.push(test_battler)
  308.   end
  309. end
  310. #==============================================================================
  311. # ■ Game_Party
  312. #------------------------------------------------------------------------------
  313. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
  314. # スのインスタンスは $game_party で参照されます。
  315. #==============================================================================
  316.  
  317. class Game_Party < Game_Unit
  318.   #--------------------------------------------------------------------------
  319.   # ○ 定数
  320.   #--------------------------------------------------------------------------
  321.   BATTLE_FORMATION_POS   = A1_System::BattleFormationConfig::BATTLE_FORMATION_POS
  322.   #--------------------------------------------------------------------------
  323.   # ○ 公開インスタンス変数
  324.   #--------------------------------------------------------------------------
  325.   attr_accessor :learned_formation
  326.   attr_accessor :battle_formation
  327.   #--------------------------------------------------------------------------
  328.   # ☆ オブジェクト初期化
  329.   #--------------------------------------------------------------------------
  330.   alias a1_battle_formation_gp_initialize initialize
  331.   def initialize
  332.     @learned_formation = A1_System::BattleFormationConfig::STARTING_LEARNED
  333.     @battle_formation  = A1_System::BattleFormationConfig::STARTING_FORMATION
  334.     a1_battle_formation_gp_initialize
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ☆ 戦闘テスト用パーティのセットアップ
  338.   #--------------------------------------------------------------------------
  339.   alias a1_battle_formation_gp_setup_battle_test_members setup_battle_test_members
  340.   def setup_battle_test_members
  341.     a1_battle_formation_gp_setup_battle_test_members
  342.     @battle_formation  = A1_System::BattleFormationConfig::STARTING_FORMATION
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ★ バトルメンバーの最大数を取得
  346.   #--------------------------------------------------------------------------
  347.   def max_battle_members
  348.     return A1_System::BattleFormationConfig::MAX_BATTLE_MEMBERS
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ○ 現在有効な陣形を取得
  352.   #--------------------------------------------------------------------------
  353.   def enable_formation(ret = [])
  354.     can_use_formation.keys.each {|key| ret.push(key) if @learned_formation.include?(key) }
  355.     return ret
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ○ 現在の人数で使用できる陣形の取得
  359.   #--------------------------------------------------------------------------
  360.   def can_use_formation
  361.     BATTLE_FORMATION_POS[battle_members.size - 1]
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ☆ アクターを加える
  365.   #--------------------------------------------------------------------------
  366.   alias a1_battle_formation_gp_add_actor add_actor
  367.   def add_actor(actor_id)
  368.     @battle_formation = 0
  369.     a1_battle_formation_gp_add_actor(actor_id)
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # ☆ アクターを外す
  373.   #--------------------------------------------------------------------------
  374.   alias a1_battle_formation_gp_remove_actor remove_actor
  375.   def remove_actor(actor_id)
  376.     @battle_formation = 0
  377.     a1_battle_formation_gp_remove_actor(actor_id)
  378.   end
  379. end
  380. #==============================================================================
  381. # ■ Game_Troop
  382. #------------------------------------------------------------------------------
  383. #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も
  384. # 行います。このクラスのインスタンスは $game_troop で参照されます。
  385. #==============================================================================
  386.  
  387. class Game_Troop < Game_Unit
  388.   #--------------------------------------------------------------------------
  389.   # ○ 公開インスタンス変数
  390.   #--------------------------------------------------------------------------
  391.   attr_accessor :battle_formation
  392.   attr_accessor :use_formation_type
  393.   #--------------------------------------------------------------------------
  394.   # ☆ オブジェクト初期化
  395.   #--------------------------------------------------------------------------
  396.   alias a1_battle_formation_gtp_initialize initialize
  397.   def initialize
  398.     @battle_formation   = 0
  399.     @use_formation_type = 4
  400.     a1_battle_formation_gtp_initialize
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ○ 現在使用できる陣形の取得
  404.   #--------------------------------------------------------------------------
  405.   def can_use_formation
  406.     @use_formation_type
  407.   end
  408. end
  409. #==============================================================================
  410. # ■ Game_Unit
  411. #------------------------------------------------------------------------------
  412. #  ユニットを扱うクラスです。このクラスは Game_Party クラスと Game_Troop クラ
  413. # スのスーパークラスとして使用されます。
  414. #==============================================================================
  415.  
  416. class Game_Unit
  417.   #--------------------------------------------------------------------------
  418.   # ○ 定数
  419.   #--------------------------------------------------------------------------
  420.   BATTLE_FORMATION_BONUS = A1_System::BattleFormationConfig::BATTLE_FORMATION_BONUS
  421.   BONUS_INFO             = A1_System::BattleFormationConfig::BONUS_INFO
  422.   #--------------------------------------------------------------------------
  423.   # ○ 陣形を取得
  424.   #--------------------------------------------------------------------------
  425.   def formation(id)
  426.     ret = can_use_formation
  427.     return ret[0] unless ret[id]
  428.     return ret[id]
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ○ 現在の陣形の名前を取得
  432.   #--------------------------------------------------------------------------
  433.   def formation_name(id = @battle_formation)
  434.     formation(id)[0]
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ○ 現在の陣形のウィンドウ位置を取得
  438.   #--------------------------------------------------------------------------
  439.   def formation_window_pos(id = @battle_formation)
  440.     formation(id)[1]
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ○ 現在の陣形のアクター初期位置を取得
  444.   #--------------------------------------------------------------------------
  445.   def formation_init_pos(id = @battle_formation)
  446.     formation(id)[2]
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ○ 現在の陣形のアクター定位置を取得
  450.   #--------------------------------------------------------------------------
  451.   def formation_standard_pos(id = @battle_formation)
  452.     formation(id)[3]
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ○ 現在の陣形のカーソル順番を取得
  456.   #--------------------------------------------------------------------------
  457.   def formation_cursor_order(id = @battle_formation)
  458.     formation(id)[4]
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ○ 現在の陣形の陣形ボーナスを取得
  462.   #--------------------------------------------------------------------------
  463.   def formation_bonus(id = @battle_formation)
  464.     BATTLE_FORMATION_BONUS[formation_name(id)]
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ○ 陣形ボーナス情報を取得
  468.   #--------------------------------------------------------------------------
  469.   def bonus_info(kind)
  470.     BONUS_INFO[kind]
  471.   end
  472. end
  473. #==============================================================================
  474. # ■ Window_BattleActors
  475. #==============================================================================
  476.  
  477. class Window_BattleActors < Window_Base
  478.   #--------------------------------------------------------------------------
  479.   # ★ ウィンドウ位置の取得(サイドビューバトルの再定義)
  480.   #--------------------------------------------------------------------------
  481.   def window_pos(index)
  482.     $game_party.formation_window_pos[index]
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ○ アクターの設定
  486.   #--------------------------------------------------------------------------
  487.   def actor=(actor)
  488.     @actor = actor
  489.   end
  490. end
  491. #==============================================================================
  492. # ■ Window_BattleActor
  493. #------------------------------------------------------------------------------
  494. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  495. #==============================================================================
  496.  
  497. class Window_BattleActor < Window_BattleStatus
  498.   #--------------------------------------------------------------------------
  499.   # ○ カーソルの移動処理
  500.   #--------------------------------------------------------------------------
  501.   def process_cursor_move
  502.     return unless cursor_movable?
  503.     last_index = @index
  504.     cursor_next (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  505.     cursor_prev (Input.trigger?(:UP))    if Input.repeat?(:UP)
  506.     cursor_down (Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  507.     cursor_up   (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  508.     Sound.play_cursor if @index != last_index
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ○ 次のカーソル位置
  512.   #--------------------------------------------------------------------------
  513.   def cursor_next(wrap = false)
  514.     return if order.empty?
  515.     next_index = order.index(index) + 1
  516.     index = order[next_index]
  517.     index = order[0] unless index
  518.     select(index)
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # ○ 前のカーソル位置
  522.   #--------------------------------------------------------------------------
  523.   def cursor_prev(wrap = false)
  524.     return if order.empty?
  525.     prev_index = order.index(index) - 1
  526.     index = order[prev_index]
  527.     index = order[order.size - 1] unless index
  528.     select(index)
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ○ カーソル位置情報
  532.   #--------------------------------------------------------------------------
  533.   def order
  534.     $game_party.formation_cursor_order
  535.   end
  536. end
  537. #==============================================================================
  538. # ■ Game_Actor
  539. #------------------------------------------------------------------------------
  540. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
  541. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
  542. #==============================================================================
  543.  
  544. class Game_Actor < Game_Battler
  545.   #--------------------------------------------------------------------------
  546.   # ★ 定位置を取得(サイドビューバトルの再定義)
  547.   #--------------------------------------------------------------------------
  548.   def members_standard_pos(index)
  549.     $game_party.formation_standard_pos[index]
  550.   end
  551. end
  552. #==============================================================================
  553. # ■ Scene_Battle
  554. #------------------------------------------------------------------------------
  555. #  バトル画面の処理を行うクラスです。
  556. #==============================================================================
  557.  
  558. class Scene_Battle < Scene_Base
  559.   #--------------------------------------------------------------------------
  560.   # ☆ 開始処理
  561.   #--------------------------------------------------------------------------
  562.   alias a1_battle_formation_sb_start start
  563.   def start
  564.     define_battle_manager_method
  565.     @formation_bonus = $game_party.formation_bonus
  566.     a1_battle_formation_sb_start
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ○ バトルマネージャメソッドの定義
  570.   #--------------------------------------------------------------------------
  571.   alias a1_battle_formation_sb_define_battle_manager_method define_battle_manager_method
  572.   def define_battle_manager_method
  573.     a1_battle_formation_sb_define_battle_manager_method
  574.     BattleManager.define_method(method(:init_formation_bonus), :init_formation_bonus)
  575.     BattleManager.define_method(method(:member_any_dead?),     :member_any_dead?)
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ★ アクターの初期位置(サイドビューバトルの再定義)
  579.   #--------------------------------------------------------------------------
  580.   def members_init_pos(index)
  581.     $game_party.formation_init_pos[index]
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # ☆ 次のコマンド入力へ
  585.   #--------------------------------------------------------------------------
  586.   alias a1_battle_formation_sb_next_command next_command
  587.   def next_command
  588.     index = BattleManager.actor.index if BattleManager.actor
  589.     a1_battle_formation_sb_next_command
  590.     starting_formation_bonus(index, true)
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ☆ 前のコマンド入力へ
  594.   #--------------------------------------------------------------------------
  595.   alias a1_battle_formation_sb_prior_command prior_command
  596.   def prior_command
  597.     a1_battle_formation_sb_prior_command
  598.     starting_formation_bonus(BattleManager.actor.index, false) if BattleManager.actor
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ○ 陣形ボーナスを取得
  602.   #--------------------------------------------------------------------------
  603.   def bonus_info(bonus)
  604.     $game_party.bonus_info(bonus)
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ○ 開始時陣形ボーナス付与/解除
  608.   #--------------------------------------------------------------------------
  609.   def starting_formation_bonus(index, flag)
  610.     return if member_any_dead?
  611.     return unless @formation_bonus[index]
  612.     @formation_bonus[index].each {|bonus| starting_bonus(bonus_info(bonus), index, flag) }
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ○ 開始時ボーナス付与/解除
  616.   #--------------------------------------------------------------------------
  617.   def starting_bonus(bonus, index, flag)
  618.     return unless bonus[0] == "開始時"
  619.     return bonus_guard(flag, index)                              if bonus[1] == "防御状態"
  620.     return battle_members[index].formation_tgr = $1.to_i / 100.0 if bonus[1] =~ /狙われ率\[([-]?\d+)\]/
  621.     return battle_members[index].formation_param[0] = $1.to_i    if bonus[1] =~ /最大HP\[([-]?\d+)\]/
  622.     return battle_members[index].formation_param[1] = $1.to_i    if bonus[1] =~ /最大MP\[([-]?\d+)\]/
  623.     return atk_bonus(index, $1.to_i, $2)                         if bonus[1] =~ /攻撃力\[([-]?\d+)[,]?(\S+)?\]/
  624.     return battle_members[index].formation_param[3] = $1.to_i    if bonus[1] =~ /防御力\[([-]?\d+)\]/
  625.     return battle_members[index].formation_param[4] = $1.to_i    if bonus[1] =~ /魔法力\[([-]?\d+)\]/
  626.     return battle_members[index].formation_param[5] = $1.to_i    if bonus[1] =~ /魔法防御\[([-]?\d+)\]/
  627.     return battle_members[index].formation_param[6] = $1.to_i    if bonus[1] =~ /すばやさ\[([-]?\d+)\]/
  628.     return battle_members[index].formation_param[7] = $1.to_i    if bonus[1] =~ /運\[([-]?\d+)\]/
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ○ 攻撃力ボーナスの付与/解除
  632.   #--------------------------------------------------------------------------
  633.   def atk_bonus(index, num, kind)
  634.     check_weapon_type(battle_members[index], kind)
  635.     return battle_members[index].formation_param[2] = num unless kind
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ○ 武器タイプチェック
  639.   #--------------------------------------------------------------------------
  640.   def check_weapon_type(battler, kind)
  641.     return true if battler.weapons[0] && $data_system.weapon_types[battler.weapons[0].wtype_id] == kind
  642.     return true if battler.weapons[1] && $data_system.weapon_types[battler.weapons[1].wtype_id] == kind
  643.     return false
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # ○ 陣形防御ボーナスの付与/解除
  647.   #--------------------------------------------------------------------------
  648.   def bonus_guard(flag, index)
  649.     battle_members[index].bounus_guard = flag
  650.     battle_members[index].conv_action("状態[防御待機]") if flag
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ○ 行動前陣形ボーナスの解除
  654.   #--------------------------------------------------------------------------
  655.   def remove_before_action_formation_bonus(index)
  656.     return unless @formation_bonus[index]
  657.     @formation_bonus[index].each {|bonus| remove_before_bonus(bonus_info(bonus), index) }
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ○ 行動前陣形ボーナス解除
  661.   #--------------------------------------------------------------------------
  662.   def remove_before_bonus(bonus, index)
  663.     return unless bonus[2] == "行動後"
  664.     return bonus_guard(false, index) if bonus[1] == "防御状態"
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ○ 行動後陣形ボーナスの付与
  668.   #--------------------------------------------------------------------------
  669.   def add_after_action_formation_bonus(index)
  670.     return if member_any_dead?
  671.     return unless @formation_bonus[index]
  672.     @formation_bonus[index].each {|bonus| add_after_bonus(bonus_info(bonus), index) }
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # ○ 行動前陣形ボーナス付与
  676.   #--------------------------------------------------------------------------
  677.   def add_after_bonus(bonus, index)
  678.     return unless bonus[0] == "行動後"
  679.     return bonus_guard(true, index) if bonus[1] == "防御状態"
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ○ ターン終了時ボーナス検索
  683.   #--------------------------------------------------------------------------
  684.   def search_turn_end_bonus
  685.     return if member_any_dead?
  686.     battle_members.each {|member| turn_end_bonus_list(member, $game_party.formation_bonus[member.index]) }
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ○ ターン終了時ボーナスリスト作成
  690.   #--------------------------------------------------------------------------
  691.   def turn_end_bonus_list(member, bonus_key)
  692.     return unless bonus_key
  693.     bonus_key.each {|bonus| proc_turn_end_bonus(member, bonus) }
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # ○ ターン終了時ボーナス実行
  697.   #--------------------------------------------------------------------------
  698.   def proc_turn_end_bonus(member, bonus_key)
  699.     bonus = $game_party.bonus_info(bonus_key)
  700.     return unless bonus[0] == "ターン終了時"
  701.     return bonus_recovery(member, $1, $2) if bonus[1] =~ /(\S+)回復\[(\S+)\]/
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # ○ 回復ボーナス
  705.   #--------------------------------------------------------------------------
  706.   def bonus_recovery(member, kind, recovery_num)
  707.     num = (member.mhp * ($1.to_i / 100.0)).to_i if recovery_num =~ /(\d+)%/
  708.     num = recovery_num.to_i                 unless recovery_num =~ /(\d+)%/
  709.     return turn_end_hp_recovery(member, num) if kind == "HP"
  710.     return turn_end_mp_recovery(member, num) if kind == "MP"
  711.     return turn_end_tp_recovery(member, num) if kind == "TP"
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ○ ターン終了時HP回復ボーナス
  715.   #--------------------------------------------------------------------------
  716.   def turn_end_hp_recovery(member, num)
  717.     member.hp += num
  718.     return unless $imported["A1_DamagePopUp"]
  719.     member.result.hp_damage = num * -1
  720.     popup_damege(member, Sprite_DamagePop::NOML) if num.abs > 0
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ○ ターン終了時MP回復ボーナス
  724.   #--------------------------------------------------------------------------
  725.   def turn_end_mp_recovery(member, num)
  726.     member.mp += num
  727.     return unless $imported["A1_DamagePopUp"]
  728.     member.result.mp_damage = num * -1
  729.     popup_damege(member, Sprite_DamagePop::MPRE) if num > 0
  730.     popup_damege(member, Sprite_DamagePop::MPDA) if num < 0
  731.   end
  732.   #--------------------------------------------------------------------------
  733.   # ○ ターン終了時TP回復ボーナス
  734.   #--------------------------------------------------------------------------
  735.   def turn_end_mp_recovery(member, num)
  736.     member.tp += num
  737.     return unless $imported["A1_DamagePopUp"]
  738.     member.result.tp_damage = num * -1
  739.     popup_damege(member, Sprite_DamagePop::TPRE) if num > 0
  740.     popup_damege(member, Sprite_DamagePop::TPDA) if num < 0
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ☆ 戦闘行動の実行
  744.   #--------------------------------------------------------------------------
  745.   alias a1_battle_formation_sb_execute_action execute_action
  746.   def execute_action
  747.     remove_before_action_formation_bonus(@subject.index) if @subject.actor?
  748.     add_after_action_formation_bonus(@subject.index)     if @subject.actor?
  749.     a1_battle_formation_sb_execute_action
  750.     init_formation_bonus if member_any_dead?
  751.   end
  752.   #--------------------------------------------------------------------------
  753.   # ☆ ターン終了
  754.   #--------------------------------------------------------------------------
  755.   alias a1_battle_formation_sb_turn_end turn_end
  756.   def turn_end
  757.     search_turn_end_bonus
  758.     init_formation_bonus
  759.     a1_battle_formation_sb_turn_end
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # ○ 勝利アクション
  763.   #--------------------------------------------------------------------------
  764.   alias a1_battle_formation_sb_victory_action victory_action
  765.   def victory_action
  766.     init_formation_bonus
  767.     a1_battle_formation_sb_victory_action
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # ○ 陣形ボーナス初期化
  771.   #--------------------------------------------------------------------------
  772.   def init_formation_bonus
  773.     battle_members.each {|battler| battler.init_formation_bonus }
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ○ 誰かが戦闘不能?
  777.   #--------------------------------------------------------------------------
  778.   def member_any_dead?
  779.     battle_members.any? {|member| member.hp <= 0 }
  780.   end
  781.   #--------------------------------------------------------------------------
  782.   # ☆ 個別ステータスウィンドウを再作成する
  783.   #--------------------------------------------------------------------------
  784.   alias a1_battle_formation_sb_recreate_status_windows recreate_status_windows
  785.   def recreate_status_windows(member)
  786.     prev_pos = reserve_before_pos(member) unless member.index == $game_party.new_index
  787.     a1_battle_formation_sb_recreate_status_windows(member)
  788.     proc_change_action(member, prev_pos)
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # ○ 移動ジャンプ実行
  792.   #--------------------------------------------------------------------------
  793.   def proc_change_action(member, prev_pos)
  794.     return unless prev_pos
  795.     return if member.screen_x == prev_pos[0] && member.screen_y == prev_pos[1]
  796.     member.target_x = member.screen_x
  797.     member.target_y = member.screen_y
  798.     member.screen_x = prev_pos[0]
  799.     member.screen_y = prev_pos[1]
  800.     member.proc_action("戦闘開始の登場")
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ○ 移動前の位置を保存
  804.   #--------------------------------------------------------------------------
  805.   def reserve_before_pos(member)
  806.     [member.screen_x, member.screen_y]
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ○ バトルメンバーの追加後の処理
  810.   #--------------------------------------------------------------------------
  811.   alias a1_battle_formation_sb_post_add_battler post_add_battler
  812.   def post_add_battler(member)
  813.     a1_battle_formation_sb_post_add_battler(member)
  814.     wait(35)
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ☆ バトルメンバーの削除後の処理
  818.   #--------------------------------------------------------------------------
  819.   alias a1_battle_formation_sb_post_remove_battler post_remove_battler
  820.   def post_remove_battler
  821.     a1_battle_formation_sb_post_remove_battler
  822.     proc_change_formation
  823.     init_formation_bonus
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ○ 陣形変更の実行
  827.   #--------------------------------------------------------------------------
  828.   def proc_change_formation
  829.     battle_members.each {|actor| actor.setup_standard_pos(actor.index)}
  830.     close_status_windows
  831.     change_formation_action
  832.     @status_windows.each_with_index {|window, i| setup_status_window_pos(window, i) }
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ○ 陣形変更アクション
  836.   #--------------------------------------------------------------------------
  837.   def change_formation_action
  838.     battle_members[0].proc_action("陣形変更")
  839.     wait(5)
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ○ 個別ステータスウィンドウの位置設定
  843.   #--------------------------------------------------------------------------
  844.   def setup_status_window_pos(window, index)
  845.     pos = window.window_pos(index)
  846.     window.x = pos[0]
  847.     window.y = pos[1]
  848.     window.visible = true
  849.   end
  850. end
  851. #==============================================================================
  852. # ■ Game_BattlerBase
  853. #------------------------------------------------------------------------------
  854. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
  855. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
  856. #==============================================================================
  857.  
  858. class Game_BattlerBase
  859.   #--------------------------------------------------------------------------
  860.   # ☆ 防御の判定
  861.   #--------------------------------------------------------------------------
  862.   alias a1_battle_formation_gbb_guard? guard?
  863.   def guard?
  864.     a1_battle_formation_gbb_guard? || @bounus_guard && movable?
  865.   end
  866.   #--------------------------------------------------------------------------
  867.   # ☆ 通常能力値の取得
  868.   #--------------------------------------------------------------------------
  869.   alias a1_battle_formation_gbb_param param
  870.   def param(param_id)
  871.     a1_battle_formation_gbb_param(param_id) + @formation_param[param_id]
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ☆ 特殊能力値の取得
  875.   #--------------------------------------------------------------------------
  876.   alias a1_battle_formation_gbb_sparam sparam
  877.   def sparam(sparam_id)
  878.     ret = a1_battle_formation_gbb_sparam(sparam_id)
  879.     return ret + @formation_tgr if sparam_id == 0
  880.     return ret
  881.   end
  882. end
  883. #==============================================================================
  884. # ■ Game_Battler
  885. #------------------------------------------------------------------------------
  886. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
  887. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
  888. #==============================================================================
  889.  
  890. class Game_Battler < Game_BattlerBase
  891.   #--------------------------------------------------------------------------
  892.   # ○ 公開インスタンス変数
  893.   #--------------------------------------------------------------------------
  894.   attr_accessor :bounus_guard
  895.   attr_accessor :after_action_guard
  896.   attr_accessor :formation_tgr
  897.   attr_accessor :formation_param
  898.   #--------------------------------------------------------------------------
  899.   # ☆ オブジェクト初期化
  900.   #--------------------------------------------------------------------------
  901.   alias a1_battle_formation_gb_initialize initialize
  902.   def initialize
  903.     init_formation_bonus(false)
  904.     a1_battle_formation_gb_initialize
  905.   end
  906.   #--------------------------------------------------------------------------
  907.   # ○ 陣形ボーナス初期化
  908.   #--------------------------------------------------------------------------
  909.   def init_formation_bonus(flag = true)
  910.     @bounus_guard = false
  911.     @formation_tgr   = 0.0
  912.     @formation_param = [0, 0, 0, 0, 0, 0, 0, 0]
  913.     conv_action("状態") if flag
  914.   end
  915. end
  916. #==============================================================================
  917. # ■ Spriteset_Battle
  918. #------------------------------------------------------------------------------
  919. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  920. # スの内部で使用されます。
  921. #==============================================================================
  922.  
  923. class Spriteset_Battle
  924.   #--------------------------------------------------------------------------
  925.   # ☆ カーソルスプライトの作成
  926.   #--------------------------------------------------------------------------
  927.   alias a1_battle_formation_spsb_create_cursor_sprite create_cursor_sprite
  928.   def create_cursor_sprite
  929.     a1_battle_formation_spsb_create_cursor_sprite
  930.     @prev_cursor_sprite = Sprite_BattleCursor.new(Color.new(128,0,128))
  931.     @prev_cursor_sprite.plus_x = -8
  932.     @prev_cursor_sprite.z -= 10
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ○ 前カーソルスプライトの取得
  936.   #--------------------------------------------------------------------------
  937.   def prev_cursor
  938.     @prev_cursor_sprite
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ☆ カーソルスプライトの更新
  942.   #--------------------------------------------------------------------------
  943.   alias a1_battle_formation_spsb_update_cursor update_cursor
  944.   def update_cursor
  945.     a1_battle_formation_spsb_update_cursor
  946.     @prev_cursor_sprite.update if @prev_cursor_sprite.visible
  947.   end
  948.   #--------------------------------------------------------------------------
  949.   # ☆ カーソルの解放
  950.   #--------------------------------------------------------------------------
  951.   alias a1_battle_formation_spsb_dispose_cursor dispose_cursor
  952.   def dispose_cursor
  953.     a1_battle_formation_spsb_dispose_cursor
  954.     @prev_cursor_sprite.dispose
  955.   end
  956. end
  957. #==============================================================================
  958. # ■ Window_ControlInfo
  959. #==============================================================================
  960.  
  961. class Window_ControlInfo < Window_Base
  962.   #--------------------------------------------------------------------------
  963.   # ○ オブジェクト初期化
  964.   #--------------------------------------------------------------------------
  965.   def initialize
  966.     super(0, Graphics.height - fitting_height(1), Graphics.width / 2, fitting_height(1))
  967.     self.opacity = 0
  968.     return if $game_party.all_members.size <= $game_party.max_battle_members
  969.     draw_background(Rect.new(0, 0, self.width, self.height))
  970.     draw_text(0, 0, contents.width, line_height, "Xボタン:パーティ入れ替え")
  971.   end
  972. end
  973. #==============================================================================
  974. # ■ Window_FormationName
  975. #==============================================================================
  976.  
  977. class Window_FormationName < Window_Base
  978.   #--------------------------------------------------------------------------
  979.   # ○ オブジェクト初期化
  980.   #--------------------------------------------------------------------------
  981.   def initialize(window)
  982.     @text = ""
  983.     height = fitting_height(1)
  984.     super(window.x, window.y - height, window.width, height)
  985.     self.openness = 0
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ○ テキストの設定
  989.   #--------------------------------------------------------------------------
  990.   def set_text(text, show_num = true)
  991.     @text = text
  992.     @text = "#{$game_party.battle_members.size}人陣形:#{text}" if show_num
  993.     self.width = text_size(@text).width + standard_padding * 3
  994.     create_contents
  995.     refresh
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # ○ リフレッシュ
  999.   #--------------------------------------------------------------------------
  1000.   def refresh
  1001.     contents.clear
  1002.     draw_text(0, 0, contents.width, line_height, @text)
  1003.   end
  1004. end
  1005. #==============================================================================
  1006. # ■ Window_FormationMenu
  1007. #==============================================================================
  1008.  
  1009. class Window_FormationMenu < Window_Selectable
  1010.   #--------------------------------------------------------------------------
  1011.   # ○ オブジェクト初期化
  1012.   #--------------------------------------------------------------------------
  1013.   def initialize
  1014.     @data      = $game_party.enable_formation
  1015.     @max_width = 0
  1016.     @index     = 0
  1017.     super(0, 0, 0, fitting_height(@data.size))
  1018.     setup_formation_list
  1019.     self.index = @index
  1020.     self.width = @max_width + standard_padding * 3
  1021.     self.x     = 60
  1022.     self.y     = Graphics.height / 5
  1023.     create_contents
  1024.     select(@index)
  1025.     refresh
  1026.     activate
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ○ 陣形リストのセットアップ
  1030.   #--------------------------------------------------------------------------
  1031.   def setup_formation_list
  1032.     @data.each_with_index {|id, i|
  1033.       @index = i if id == $game_party.battle_formation
  1034.       width = text_size($game_party.formation_name(id)).width
  1035.       @max_width = @max_width < width ? width : @max_width
  1036.     }
  1037.   end
  1038.   #--------------------------------------------------------------------------
  1039.   # ○ 選択した項目を取得
  1040.   #--------------------------------------------------------------------------
  1041.   def select_formation
  1042.     @data[self.index]
  1043.   end
  1044.   #--------------------------------------------------------------------------
  1045.   # ○ 項目数の取得
  1046.   #--------------------------------------------------------------------------
  1047.   def item_max
  1048.     @data.size
  1049.   end
  1050.   #--------------------------------------------------------------------------
  1051.   # ○ 項目の描画
  1052.   #--------------------------------------------------------------------------
  1053.   def draw_item(index)
  1054.     id = @data[index]
  1055.     draw_text(0, line_height * index, contents.width, line_height, $game_party.formation_name(id))
  1056.   end
  1057.   #--------------------------------------------------------------------------
  1058.   # ○ 決定やキャンセルなどのハンドリング処理
  1059.   #--------------------------------------------------------------------------
  1060.   def process_handling
  1061.     super
  1062.     return unless open? && active
  1063.     return process_member_change if handle?(:member_change) && Input.trigger?(:X)
  1064.   end
  1065.   #--------------------------------------------------------------------------
  1066.   # ○ メンバーチェンジ
  1067.   #--------------------------------------------------------------------------
  1068.   def process_member_change
  1069.     return if $game_party.all_members.size <= $game_party.max_battle_members
  1070.     Sound.play_ok
  1071.     call_handler(:member_change)
  1072.   end
  1073. end
  1074. #==============================================================================
  1075. # ■ Scene_FormationMenu
  1076. #==============================================================================
  1077.  
  1078. class Scene_FormationMenu < Scene_Battle
  1079.   #--------------------------------------------------------------------------
  1080.   # ○ 開始処理
  1081.   #--------------------------------------------------------------------------
  1082.   def start
  1083.     @selected = false
  1084.     BattleManager.init_members
  1085.     define_battle_manager_method
  1086.     create_main_viewport
  1087.     create_spriteset
  1088.     create_all_windows
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ○ 開始後処理
  1092.   #--------------------------------------------------------------------------
  1093.   def post_start
  1094.     perform_transition
  1095.     Input.update
  1096.     move_start_pos
  1097.     wait(30)
  1098.     @status_windows.each {|window| window.visible = true }
  1099.     @control_info = Window_ControlInfo.new
  1100.     @window_formation_menu.open
  1101.     @formation_name_window.open
  1102.   end
  1103.   #--------------------------------------------------------------------------
  1104.   # ○ 全ウィンドウの作成
  1105.   #--------------------------------------------------------------------------
  1106.   def create_all_windows
  1107.     super
  1108.     create_formation_manu_window
  1109.     create_fomarion_name_window
  1110.   end
  1111.   #--------------------------------------------------------------------------
  1112.   # ○ 陣形メニューウィンドウの作成
  1113.   #--------------------------------------------------------------------------
  1114.   def create_formation_manu_window
  1115.     @window_formation_menu = Window_FormationMenu.new
  1116.     @window_formation_menu.openness = 0
  1117.     @window_formation_menu.set_handler(:ok,            method(:on_formation_ok))
  1118.     @window_formation_menu.set_handler(:cancel,        method(:on_formation_cancel))
  1119.     @window_formation_menu.set_handler(:member_change, method(:command_member_change))
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # ○ 陣形名ウィンドウの作成
  1123.   #--------------------------------------------------------------------------
  1124.   def create_fomarion_name_window
  1125.     @formation_name_window = Window_FormationName.new(@window_formation_menu)
  1126.     @formation_name_window.set_text($game_party.formation_name)
  1127.     @formation_name_window.openness = 0
  1128.   end
  1129.   #--------------------------------------------------------------------------
  1130.   # ○ フレーム更新
  1131.   #--------------------------------------------------------------------------
  1132.   def update
  1133.     update_basic
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # ○ フレーム更新(基本)
  1137.   #--------------------------------------------------------------------------
  1138.   def update_basic
  1139.     Graphics.update
  1140.     Input.update
  1141.     update_all_windows
  1142.     $game_timer.update
  1143.     @spriteset.update
  1144.     update_info_viewport
  1145.     update_message_open
  1146.   end
  1147.   #--------------------------------------------------------------------------
  1148.   # ○ アクター[決定]
  1149.   #--------------------------------------------------------------------------
  1150.   def on_actor_ok
  1151.     return next_select unless @selected
  1152.     change_formation_member
  1153.   end
  1154.   #--------------------------------------------------------------------------
  1155.   # ○ メンバー入れ替え
  1156.   #--------------------------------------------------------------------------
  1157.   def change_formation_member
  1158.     return on_actor_cancel if @prev_index == @actor_window.index
  1159.     change_formation_pos(@prev_index, @actor_window.index)
  1160.     @selected = false
  1161.     actor_select_start
  1162.   end
  1163.   #--------------------------------------------------------------------------
  1164.   # ○ 場所の入れ替え
  1165.   #--------------------------------------------------------------------------
  1166.   def change_formation_pos(prev, now)
  1167.     @actor_window.hide
  1168.     @spriteset.prev_cursor.visible = false
  1169.     $game_party.swap_order(now, prev)
  1170.     battle_members.each {|member| recreate_status_windows(member) }
  1171.     wait(35)
  1172.     @actor_window.refresh
  1173.     @party_battle_members = $game_party.battle_members
  1174.     battle_members.each {|member| enable_open_status(member.index) }
  1175.     @prev_index = -1
  1176.   end
  1177.   #--------------------------------------------------------------------------
  1178.   # ○ 入れ替え先の選択
  1179.   #--------------------------------------------------------------------------
  1180.   def next_select
  1181.     @prev_index = @actor_window.index
  1182.     @selected = true
  1183.     @spriteset.prev_cursor.target = battle_members[@actor_window.index]
  1184.     @spriteset.prev_cursor.visible = true
  1185.     actor_select_start
  1186.   end
  1187.   #--------------------------------------------------------------------------
  1188.   # ○ アクター[キャンセル]
  1189.   #--------------------------------------------------------------------------
  1190.   def on_actor_cancel
  1191.     return restart_select_actor if @spriteset.prev_cursor.visible
  1192.     @actor_window.hide
  1193.     @window_formation_menu.activate
  1194.     @window_formation_menu.open
  1195.     @formation_name_window.set_text($game_party.formation_name)
  1196.     @control_info.open
  1197.   end
  1198.   #--------------------------------------------------------------------------
  1199.   # ○ アクター選択の再開
  1200.   #--------------------------------------------------------------------------
  1201.   def restart_select_actor
  1202.     @actor_window.activate
  1203.     @spriteset.prev_cursor.visible = false
  1204.     @prev_index = -1
  1205.     @selected = false
  1206.   end
  1207.   #--------------------------------------------------------------------------
  1208.   # ○ 陣形[決定]
  1209.   #--------------------------------------------------------------------------
  1210.   def on_formation_ok
  1211.     @control_info.close
  1212.     change_formation if $game_party.battle_formation != @window_formation_menu.select_formation
  1213.     @actor_window.index = 0 if @actor_window.index < 0
  1214.     actor_select_start
  1215.   end
  1216.   #--------------------------------------------------------------------------
  1217.   # ○ 陣形の変更
  1218.   #--------------------------------------------------------------------------
  1219.   def change_formation
  1220.     $game_party.battle_formation = @window_formation_menu.select_formation
  1221.     @formation_name_window.close
  1222.     @window_formation_menu.close
  1223.     proc_change_formation
  1224.     @formation_name_window.set_text($game_party.formation_name)
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # ○ アクター選択の開始
  1228.   #--------------------------------------------------------------------------
  1229.   def actor_select_start
  1230.     index = @actor_window.index
  1231.     @actor_window.show.activate
  1232.     @actor_window.visible = false
  1233.     @actor_window.index = index
  1234.     @window_formation_menu.close
  1235.     @formation_name_window.set_text($game_party.formation_name, false)
  1236.     @formation_name_window.open
  1237.     select_actor(index)
  1238.   end
  1239.   #--------------------------------------------------------------------------
  1240.   # ○ 陣形[キャンセル]
  1241.   #--------------------------------------------------------------------------
  1242.   def on_formation_cancel
  1243.     SceneManager.return
  1244.   end
  1245.   #--------------------------------------------------------------------------
  1246.   # ○ 入れ替え
  1247.   #--------------------------------------------------------------------------
  1248.   def command_member_change
  1249.     @window_member_change.setup_members
  1250.     super
  1251.     @control_info.close
  1252.     @window_formation_menu.close
  1253.     @formation_name_window.set_text("メンバーチェンジ", false)
  1254.   end
  1255.   #--------------------------------------------------------------------------
  1256.   # ○ メンバーチェンジ[キャンセル]
  1257.   #--------------------------------------------------------------------------
  1258.   def on_member_change_cancel
  1259.     super
  1260.     @party_command_window.close
  1261.     @control_info.open
  1262.     @window_formation_menu.open
  1263.     @party_battle_members = $game_party.battle_members
  1264.     @formation_name_window.set_text($game_party.formation_name)
  1265.     battle_members.each {|member| enable_open_status(member.index) }
  1266.   end
  1267. end
  1268. #==============================================================================
  1269. # ■ Window_MenuCommand
  1270. #------------------------------------------------------------------------------
  1271. #  メニュー画面で表示するコマンドウィンドウです。
  1272. #==============================================================================
  1273.  
  1274. class Window_MenuCommand < Window_Command
  1275.   #--------------------------------------------------------------------------
  1276.   # ☆ 独自コマンドの追加用
  1277.   #--------------------------------------------------------------------------
  1278.   alias a1_battle_formation_wmc_add_original_commands add_original_commands
  1279.   def add_original_commands
  1280.     a1_battle_formation_wmc_add_original_commands
  1281.     add_command(A1_System::BattleFormationConfig::COMMAND_NAME, :battle_formation)
  1282.   end
  1283. end
  1284. #==============================================================================
  1285. # ■ Scene_Menu
  1286. #------------------------------------------------------------------------------
  1287. #  メニュー画面の処理を行うクラスです。
  1288. #==============================================================================
  1289.  
  1290. class Scene_Menu < Scene_MenuBase
  1291.   #--------------------------------------------------------------------------
  1292.   # ☆ コマンドウィンドウの作成
  1293.   #--------------------------------------------------------------------------
  1294.   alias a1_battle_formation_sm_create_command_window create_command_window
  1295.   def create_command_window
  1296.     a1_battle_formation_sm_create_command_window
  1297.     @command_window.set_handler(:battle_formation,    method(:menu_battle_formation))
  1298.   end
  1299.   #--------------------------------------------------------------------------
  1300.   # ○ メニュー[陣形]
  1301.   #--------------------------------------------------------------------------
  1302.   def menu_battle_formation
  1303.     SceneManager.call(Scene_FormationMenu)
  1304.   end
  1305. end
  1306. #==============================================================================
  1307. # ■ A1_System::CommonModule
  1308. #==============================================================================
  1309.  
  1310. class A1_System::CommonModule
  1311.   #--------------------------------------------------------------------------
  1312.   # ☆ 注釈コマンド定義
  1313.   #--------------------------------------------------------------------------
  1314.   alias a1_battle_formation_define_command define_command
  1315.   def define_command
  1316.     a1_battle_formation_define_command
  1317.     @cmd_108["陣形メニュー"] = :menu_battle_formation
  1318.     @cmd_108["陣形習得"]     = :learn_battle_formation
  1319.     @cmd_108["陣形変更"]     = :change_battle_formation
  1320.   end
  1321. end
  1322. #==============================================================================
  1323. # ■ Game_Interpreter
  1324. #------------------------------------------------------------------------------
  1325. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  1326. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  1327. #==============================================================================
  1328.  
  1329. class Game_Interpreter
  1330.   #--------------------------------------------------------------------------
  1331.   # ○ 陣形メニュー
  1332.   #--------------------------------------------------------------------------
  1333.   def menu_battle_formation(params)
  1334.     SceneManager.call(Scene_FormationMenu)
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # ○ 陣形習得
  1338.   #--------------------------------------------------------------------------
  1339.   def learn_battle_formation(params)
  1340.     $game_party.learned_formation.push(params[1].to_i)   if params[0] == "追加"
  1341.     $game_party.learned_formation.delete(params[1].to_i) if params[0] == "削除"
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # ○ 陣形変更
  1345.   #--------------------------------------------------------------------------
  1346.   def change_battle_formation(params)
  1347.     $game_party.battle_formation = params[0].to_i
  1348.   end
  1349. end
  1350. end
   

点评

那個沒貼錯...只是我少貼了一個共通腳本,兩個共通腳本都必須使用,否則這個陣型腳本、戰鬥系統會沒有反應  发表于 2016-4-16 00:34
你第一个代码错了  发表于 2016-4-15 07:46
如果你在這邊複製腳本代碼沒辦法使用,只好請閣下自己去日站看看了,抱歉 ( 艸),我在四樓有網址,日站裡面也有說明需要那些腳本才能用  发表于 2016-4-15 00:14
這個日站的陣型腳本只是個額外功能,要使用的話必須他的戰鬥系統 和 他的必須使用的"A1バトル共通スクリプト"腳本  发表于 2016-4-15 00:12
抱歉这些代码好像都没有用啊  发表于 2016-4-14 19:20
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 05:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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