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

Project1

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

[已经过期] 有没有战斗中能用的物品分类脚本

[复制链接]

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

跳转到指定楼层
1
发表于 2014-11-9 10:03:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 yang1zhi 于 2014-11-9 12:08 编辑

或者教我怎么把普通的物品分类脚本改成战斗中也能用。
找到的都是菜单物品分类脚本。
我想要在战斗中也有分类效果。
有些人可能会说:战斗中不能用的物品不是不显示吗。
单单这样是不够的。
还要分:恢复品,战斗品,召唤物品,等等。

我目前没有使用脚本分类。
下面这些是我找到的脚本分类
一、这个是我找到的唯一一个战斗中有分类的物品分类脚本。
不过276行报错。        @item_window.item_class = @command[1][@commanda_window.index]

RUBY 代码复制
  1. module Sword
  2. #=======================================
  3. #★ 魔劍工舖 - 物品分類 2.03
  4. # [url]http://blog.yam.com/a870053jjkj/[/url]
  5. #=======================================
  6.   Sword35_ItemClass, Sword35_BattleClass = [], []
  7. #=======================================
  8. #● 使用者自定設置
  9. Sword35_Help = ['物品欄', 1]  # 設定在分類選擇時上方窗口顯示的文字 ['內容', 位置]
  10. Sword35_Gold = true # 是否要在左下方顯示金錢窗口
  11. Sword35_Width = 160 # 設定選項窗口的寬度,物品顯示窗口也會對應的更改
  12. #--------------------------------------------------------------
  13. #○ 物品畫面分類屬性辨識表
  14. # 設置法1:Sword35_ItemClass[第幾個選項] = 屬性編號(顯示該屬性道具)
  15. # 設置法2:Sword35_ItemClass[第幾個選項] = '選項內容'(顯示全部道具)
  16. # 該設置可以全數移除,這樣物品畫面將不會有道具分類效果
  17. Sword35_ItemClass[1] = 17
  18. Sword35_ItemClass[2] = 18
  19. Sword35_ItemClass[3] = 19
  20. Sword35_ItemClass[4] = 20
  21. Sword35_ItemClass[5] = 21
  22. Sword35_ItemClass[6] = 22
  23. Sword35_ItemClass[7] = 23
  24. Sword35_ItemClass[8] = 24
  25. Sword35_ItemClass[9] = 25
  26. Sword35_ItemClass[10] = '全部道具'
  27. #--------------------------------------------------------------
  28. #○ 戰鬥畫面分類屬性辨識表
  29. # 設置法1:Sword35_BattleClass[第幾個選項] = 屬性編號(顯示該屬性道具)
  30. # 設置法2:Sword35_BattleClass[第幾個選項] = '選項內容'(顯示全部道具)
  31. # 設置法3:Sword35_BattleClass = Sword35_ItemClass(照物品畫面,只留這個就好)
  32. # 該設置可以全數移除,這樣戰鬥畫面將不會有道具分類效果
  33. Sword35_BattleClass[1] = 17
  34. Sword35_BattleClass[2] = 19
  35. Sword35_BattleClass[3] = 18
  36. =begin
  37. ========================================
  38. 詳細設置說明請參考:[url]http://blog.yam.com/a870053jjkj/article/24014108[/url]
  39. =end
  40.   $Sword ? $Sword[35] = true : $Sword = {35=>true} # 腳本使用標誌
  41.   ($Sword_VX = false ; RPG::Weather rescue $Sword_VX = true) if $Sword_VX == nil
  42.   elements = load_data("Data/System.r#{$Sword_VX ? 'v' : 'x'}data").elements
  43. (1...Sword35_ItemClass.size).each{|i| next unless Sword35_ItemClass[i].is_a?(Integer)
  44. raise("物品畫面中的道具不存在第#{Sword35_ItemClass[i]}號的屬性
  45. 請添加該屬性或是檢查 Sword35_ItemClass 設置是否正確") unless
  46. elements[Sword35_ItemClass[i]]} unless Sword35_ItemClass.empty? # Error1
  47. (1...Sword35_BattleClass.size).each{|i| next unless Sword35_BattleClass[i].is_a?(Integer)
  48. raise("戰鬥畫面中的道具不存在第#{Sword35_BattleClass[i]}號的屬性
  49. 請添加該屬性或是檢查 Sword35_BattleClass 設置是否正確") unless
  50. elements[Sword35_BattleClass[i]]} unless Sword35_BattleClass.empty? # Error2
  51. end
  52. #=======================================
  53. #■ 擁有游標的移動以及滾動功能的視窗類別
  54. class Window_Selectable < Window_Base
  55.   #-------------------------------------------------------------
  56.   #● 獲取行數
  57.   alias sword35_row_max row_max
  58.   def row_max
  59.     return sword35_row_max if # 不需分類就採用預設頂行
  60.     Sword::Sword35_BattleClass.empty? && $game_temp.in_battle or
  61.     Sword::Sword35_ItemClass.empty? && $scene.is_a?(Scene_Item)
  62.     return @item_max if $scene.is_a?(Scene_Item) ; sword35_row_max
  63.   end
  64. end
  65. #=======================================
  66. #■ 技能及物品的說明、角色的狀態顯示的視窗
  67. class Window_Help < Window_Base
  68.   include Sword # 連接自定設置
  69.   #-------------------------------------------------------------
  70.   #● 初始化物件
  71.   alias sword35_initialize initialize
  72.   def initialize
  73.     sword35_initialize
  74.     set_text(Sword35_Help[0], Sword35_Help[1]) if $scene.is_a?(Scene_Item)
  75.   end
  76. end
  77. #=======================================
  78. #■ 物品畫面、戰鬥畫面、顯示瀏覽物品的視窗
  79. class Window_Item < Window_Selectable
  80.   include Sword # 連接自定設置
  81.   attr_writer     :item_class # 目前的分類
  82.   #-------------------------------------------------------------
  83.   #● 初始化物件(X座標, Y座標, 寬度, 高度)
  84.   alias sword35_initialize initialize
  85.   def initialize(xn = nil, yn = nil, widthn = nil, heightn = nil)
  86.     # [物品窗口高度, 物品窗口寬度, 文字高度, 右邊放置距離, 開頭距離,
  87.     #  冒號顯示框寬度, 數量顯示框寬度, 戰鬥時物品窗口高度]
  88.     [url=home.php?mod=space&uid=280620]@xpvx[/url] = $Sword_VX ? [Graphics.height - WLH - 32,
  89.     Graphics.width - Sword35_Width, 24, 240, 0, 216, 236, 232] :
  90.     [416, 640 - Sword35_Width, 32, 288, 4, 253, 280, 256]
  91.     $Sword_VX ? sword35_initialize(xn, yn, widthn, heightn) : sword35_initialize
  92.     #○ 物品窗口的位置與大小修正
  93.     if $game_temp.in_battle and ! Sword35_BattleClass.empty? # 戰鬥的話就中斷
  94.       self.x = Sword35_Width ; self.height = @xpvx[7] ; self.active = false
  95.       @index = -1 ; @column_max = 1
  96.       $Sword_VX ? update_cursor : update_cursor_rect # 修正為1行一個道具
  97.     elsif $scene.is_a?(Scene_Item) and ! Sword35_ItemClass.empty? # 物品畫面要分類時
  98.       self.x = Sword35_Width ; self.height = @xpvx[0] ; self.active = false
  99.       @index = -1 ; @column_max = 1
  100.       $Sword_VX ? update_cursor : update_cursor_rect # 修正為1行一個道具
  101.     end
  102.   end
  103.   #-------------------------------------------------------------
  104.   #● 更新內容
  105.   alias sword35_refresh refresh
  106.   def refresh
  107.     if $game_temp.in_battle and (not Sword35_BattleClass.empty?) ; self.width = @xpvx[1]
  108.       Sword35_BattleClass.each_index{|index| (@item_class = Sword35_BattleClass[index]
  109.       break) if Sword35_BattleClass[index]} unless @item_class # 起始選項分類
  110.       @item_class = 0 if @item_class.is_a?(String) # 是字符串的場合就設為0
  111.     elsif $game_temp.in_battle or Sword35_ItemClass.empty? or # 不需分類
  112.     $scene.is_a?(Scene_Shop) or $scene.is_a?(Scene_Equip)
  113.       @item_class = 0
  114.     else ; self.width = @xpvx[1] # 非戰鬥時的情況(物品畫面的情況)
  115.       Sword35_ItemClass.each_index{|index| (@item_class = Sword35_ItemClass[index]
  116.       break) if Sword35_ItemClass[index]} unless @item_class # 起始選項分類
  117.       @item_class = 0 if @item_class.is_a?(String) # 是字符串的場合就設為0
  118.     end
  119.     @go_bitmap = true ; sword35_refresh ; self.index = -1 unless sword35_whether?
  120.   end
  121.   #-------------------------------------------------------------
  122.   #● 描繪項目
  123.   alias sword35_draw_item draw_item if $Sword_VX
  124.   def draw_item(index)
  125.     return sword35_draw_item(index) if $scene.is_a?(Scene_Shop) or
  126.     $scene.is_a?(Scene_Equip) if $Sword_VX
  127.     if @item_class > 0 and @go_bitmap ; i = 0 # 重新產生適合的位圖
  128.       @data.each{|data| i += 1 if (data.is_a?(RPG::Armor) and (not $Sword_VX)) ?
  129.       data.guard_element_set.include?(@item_class) : data.element_set.include?(@item_class)}
  130.       i = 1 if i == 0 ; self.contents = Bitmap.new(width - 32, i * 32) ; @go_bitmap = false
  131.     end
  132.     return if (item = @data[index]) == nil # 物品是空就中斷
  133.     number = $game_party.item_number(item) if $Sword_VX
  134.     case item #○ 依據道具種類,獲取道具持有數量即確認是否要顯示該道具
  135.     when RPG::Item ; number = $game_party.item_number(item.id) unless $Sword_VX
  136.       return delete_item_class(index) unless
  137.       (item.element_set.include?(@item_class) or @item_class == 0)
  138.     when RPG::Weapon ; number = $game_party.weapon_number(item.id) unless $Sword_VX
  139.       return delete_item_class(index) unless
  140.       (item.element_set.include?(@item_class) or @item_class == 0)
  141.     when RPG::Armor ; number = $game_party.armor_number(item.id) unless $Sword_VX
  142.       return delete_item_class(index) unless (($Sword_VX ?
  143.       item.element_set.include?(@item_class) :
  144.       item.guard_element_set.include?(@item_class)) or @item_class == 0)
  145.     end
  146.     if item.is_a?(RPG::Item) and $game_party.item_can_use?($Sword_VX ? item : item.id)
  147.       $Sword_VX ? enabled = true : self.contents.font.color = normal_color
  148.     else ; $Sword_VX ? enabled = false : self.contents.font.color = disabled_color
  149.     end
  150.     (self.contents.font.color = normal_color
  151.     self.contents.font.color.alpha = enabled ? 255 : 128) if $Sword_VX
  152.     if sword35_whether?
  153.       x = @xpvx[4] + index % 2 * (@xpvx[3] + 32) ; y = index / 2 * @xpvx[2]
  154.     else ; x = 4 ; y = index * @xpvx[2]
  155.     end
  156.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  157.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  158.     (bitmap = RPG::Cache.icon(item.icon_name)
  159.     opacity = self.contents.font.color == normal_color ? 255 : 128) unless $Sword_VX
  160.     if sword35_whether? # 一般模式
  161.       $Sword_VX ? draw_item_name(item, x, y, enabled) : (
  162.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  163.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0))
  164.       self.contents.draw_text(x, y, @xpvx[5], @xpvx[2], ":", 2)
  165.       self.contents.draw_text(x, y, @xpvx[6], @xpvx[2], number.to_s, 2)
  166.     else # 分類模式
  167.       $Sword_VX ? draw_item_name(item, x, y, enabled) : (
  168.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  169.       self.contents.draw_text(x + 28, y, 212, 32, item.name, 0))
  170.       self.contents.draw_text(x, y, self.width - 64, @xpvx[2], ":", 2)
  171.       self.contents.draw_text(x, y, self.width - 40, @xpvx[2], number.to_s, 2)
  172.     end
  173.   end
  174.   #-------------------------------------------------------------
  175.   #● 忽略道具的方法
  176.   def delete_item_class(index)
  177.     @data.delete_at(index) ; @item_max -= 1 ; draw_item(index)
  178.   end
  179.   #-------------------------------------------------------------
  180.   #● 判斷是否不需要道具分類效果
  181.   def sword35_whether?
  182.     Sword35_BattleClass.empty? && $game_temp.in_battle or
  183.     Sword35_ItemClass.empty? && $scene.is_a?(Scene_Item) or
  184.     $scene.is_a?(Scene_Shop) or $scene.is_a?(Scene_Equip)
  185.   end
  186. end
  187. #=======================================
  188. #■ 處理戰鬥畫面的類別
  189. unless Sword::Sword35_BattleClass.empty? # 無Sword35_BattleClass設置的場合
  190.   class Scene_Battle
  191.     include Sword # 連接自定設置
  192.     #-----------------------------------------------------------
  193.     #● 主處理
  194.     alias sword35_main main unless $Sword_VX
  195.     def main
  196.       @xpvx = $Sword_VX ? [56, 232] : [64, 256] # [選項窗口Y座標, 選項窗口高度]
  197.       (sword35_main ; return) if Sword35_BattleClass.empty? # 有設置的情況下
  198.       @command = [[], []] # 獲取選項名稱和屬性編號
  199.       Sword35_BattleClass.each_index do |index| ; next if Sword35_BattleClass[index] == nil
  200.       unless Sword35_BattleClass[index].is_a?(String) # 不是字符串的場合
  201.         @command[0] += [$data_system.elements[Sword35_BattleClass[index]]]
  202.         @command[1] += [Sword35_BattleClass[index]]
  203.       else ; @command[0] += [Sword35_BattleClass[index]] ; @command[1] += [0] # 字串
  204.       end ; end
  205.       @commanda_window = Window_Command.new(Sword35_Width, @command[0])
  206.       @commanda_window.y, @commanda_window.height = @xpvx[0], @xpvx[1]
  207.       @commanda_window.back_opacity = 160
  208.       @commanda_window.active = false ; @commanda_window.visible = false
  209.       $Sword_VX ? super : sword35_main
  210.       @commanda_window.dispose if @commanda_window
  211.     end
  212.     #-----------------------------------------------------------
  213.     #● 更新角色命令回合 - 選擇物品
  214.     $Sword_VX ? (alias sword35_update_phase3_item_select update_item_selection
  215.     def update_item_selection ; update_phase3_item_select ; end) :
  216.     (alias sword35_update_phase3_item_select update_phase3_item_select)
  217.     def update_phase3_item_select
  218.       @commanda_window.update
  219.       @commanda_window.visible = true
  220.       if @item_window ; if @item_window.active ; if Input.trigger?(Input::B)
  221.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  222.         @commanda_window.active = true ; @item_window.index = -1
  223.         @help_window.set_text(Sword35_Help[0], Sword35_Help[1])
  224.         @item_window.active = false ; return
  225.       elsif Input.trigger?(Input::C) and (not @item_window.item)
  226.         $Sword_VX ? Sound.play_buzzer : $game_system.se_play($data_system.buzzer_se) ; return
  227.       end ; end ; end
  228.       (commanda_update ; return) if @commanda_window.active# 當種類窗口活動的時
  229.       sword35_update_phase3_item_select
  230.     end
  231.     #-----------------------------------------------------------
  232.     #● 開始選擇敵人
  233.   unless $Sword_VX
  234.     alias sword35_start_enemy_select start_enemy_select
  235.     def start_enemy_select
  236.       sword35_start_enemy_select ; @commanda_window.visible = false
  237.     end
  238.     #-----------------------------------------------------------
  239.     #● 開始選擇角色
  240.     alias sword35_start_actor_select start_actor_select
  241.     def start_actor_select
  242.       sword35_start_actor_select ; @commanda_window.visible = false
  243.     end
  244.   end
  245.     #-----------------------------------------------------------
  246.     #● 開始選擇物品
  247.     $Sword_VX ? (alias sword35_start_item_select start_item_selection
  248.     def start_item_selection ; start_item_select ; end) :
  249.     (alias sword35_start_item_select start_item_select)
  250.     def start_item_select
  251.       sword35_start_item_select ; @item_window.active = false
  252.       @help_window.set_text(Sword35_Help[0], Sword35_Help[1])
  253.       @commanda_window.active = true ; @commanda_window.visible = true
  254.     end
  255.     #-----------------------------------------------------------
  256.     #● 結束選擇物品
  257.     $Sword_VX ? (alias sword35_end_item_select end_item_selection
  258.     def end_item_selection ; end_item_select ; end) :
  259.     (alias sword35_end_item_select end_item_select)
  260.     def end_item_select
  261.       sword35_end_item_select
  262.       @commanda_window.active = false ; @commanda_window.visible = false
  263.     end
  264.     #-----------------------------------------------------------
  265.     #● 分類選項更新
  266.     def commanda_update
  267.       if Input.trigger?(Input::B) ; end_item_select
  268.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  269.       elsif Input.trigger?(Input::C)
  270.         $Sword_VX ? Sound.play_decision : $game_system.se_play($data_system.decision_se)
  271.         @item_window.index = 0
  272.         @item_window.active = true ; @commanda_window.active = false
  273.         @help_window.set_text(
  274.         @item_window.item == nil ? '' : @item_window.item.description)
  275.       elsif Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新物品
  276.         @item_window.item_class = @command[1][@commanda_window.index]
  277.         @item_window.refresh
  278.       end
  279.     end
  280.   end
  281. end
  282. #=======================================
  283. #■ 處理物品畫面的類別
  284. unless Sword::Sword35_ItemClass.empty? # 無Sword35_ItemClass設置的場合
  285.   class Scene_Item
  286.     include Sword # 連接自定設置
  287.     #-----------------------------------------------------------
  288.     #● 主處理
  289.     alias sword35_main main unless $Sword_VX
  290.     def main
  291.       # [選項窗口高度, 有金錢窗口選項窗口高度, 選項窗口Y座標, 修正]
  292.       @xpvx = $Sword_VX ? [Graphics.height - 56, Graphics.height - 56 * 2,
  293.       56, true] : [416, 352, 64, false]
  294.       @command = [[], []] # 獲取選項名稱和屬性編號
  295.       Sword35_ItemClass.each_index do |index| ; next if Sword35_ItemClass[index] == nil
  296.       unless Sword35_ItemClass[index].is_a?(String) # 不是字符串的場合
  297.         @command[0] += [$data_system.elements[Sword35_ItemClass[index]]]
  298.         @command[1] += [Sword35_ItemClass[index]]
  299.       else ; @command[0] += [Sword35_ItemClass[index]] ; @command[1] += [0] # 字符串
  300.       end ; end
  301.       @commanda_window = Window_Command.new(Sword35_Width, @command[0])
  302.       @commanda_window.y = @xpvx[2]
  303.       unless Sword35_Gold ; @commanda_window.height = @xpvx[0]
  304.       else ; @commanda_window.height = @xpvx[1]
  305.         @gold_window = $Sword_VX ? # 產生金錢窗口
  306.         Window_Gold.new(0, Graphics.height - 56) : Window_Gold.new
  307.         @gold_window.x, @gold_window.y = 0, 416 unless $Sword_VX
  308.       end
  309.       $Sword_VX ? super : sword35_main
  310.       @commanda_window.dispose ; @gold_window.dispose if @gold_window
  311.     end
  312.     #-----------------------------------------------------------
  313.     #● 更新畫面
  314.     alias sword35_update update
  315.     def update
  316.       @commanda_window.update
  317.       @item_window.active, @xpvx[3] = false, false if @xpvx[3] # 修正
  318.       if @item_window.active ; if Input.trigger?(Input::B)
  319.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  320.         @item_window.active = false ; @commanda_window.active = true
  321.         @help_window.set_text(Sword35_Help[0], Sword35_Help[1]) # 更新幫助窗口文字
  322.         @help_wsword.visible = false if $Sword[8] # 隱藏跟隨說明窗口
  323.         @item_window.index = -1 ; return
  324.       end ; end
  325.       (commanda_update ; return) if @commanda_window.active # 當種類窗口活動的時
  326.       sword35_update
  327.     end
  328.     #-----------------------------------------------------------
  329.     #● 分類選項更新
  330.     def commanda_update
  331.       if Input.trigger?(Input::B)
  332.         $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
  333.         $scene = Scene_Menu.new
  334.       elsif Input.trigger?(Input::C)
  335.         $Sword_VX ? Sound.play_decision : $game_system.se_play($data_system.decision_se)
  336.         @item_window.index = 0 ; @help_wsword.visible = true if $Sword[8] # 顯示說明窗口
  337.         @item_window.active = true ; @commanda_window.active = false
  338.         @help_window.set_text(
  339.         @item_window.item == nil ? '' : @item_window.item.description)
  340.       elsif Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) # 更新物品
  341.         @item_window.item_class = @command[1][@commanda_window.index]
  342.         @item_window.refresh
  343.       end
  344.     end
  345.   end
  346. end


二、这个脚本没有战斗分类的效果
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 物品分类
  3. #==============================================================================
  4.  
  5. # 主体窗口透明度
  6. OPACITY_Item = 0
  7. # 使用物品窗口透明度
  8. OPACITY_Target = 200
  9. #==============================================================================
  10. # ■ RPG追加定义
  11. #==============================================================================
  12. module RPG
  13.   #--------------------------------------------------------------------------
  14.   # ● 物品追加
  15.   #--------------------------------------------------------------------------
  16.   class Item
  17.     def description
  18.       description = @description.split(/@/)[0]
  19.       return description != nil ? description : ''
  20.     end
  21.     def desc
  22.       desc = @description.split(/@/)[1]
  23.       return desc != nil ? desc : "恢复物品"
  24.     end
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 武器追加
  28.   #--------------------------------------------------------------------------
  29.   class Weapon
  30.     def description
  31.       description = @description.split(/@/)[0]
  32.       return description != nil ? description : ''
  33.     end
  34.     def desc
  35.       desc = @description.split(/@/)[1]
  36.       return desc != nil ? desc : "武器装备"
  37.     end
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 防具追加
  41.   #--------------------------------------------------------------------------
  42.   class Armor
  43.     def description
  44.       description = @description.split(/@/)[0]
  45.       return description != nil ? description : ''
  46.     end
  47.     def desc
  48.       desc = @description.split(/@/)[1]
  49.       return desc != nil ? desc : "防具装备"
  50.     end
  51.   end
  52. end
  53.  
  54. #==============================================================================
  55. # ■ Window_Target
  56. #------------------------------------------------------------------------------
  57. #  物品画面与特技画面的、使用对像角色选择窗口。
  58. #   修复使用物品时还有跟随帮助窗口....
  59. #==============================================================================
  60.  
  61. class Window_Target < Window_Selectable
  62.   #--------------------------------------------------------------------------
  63.   # ● 刷新帮助文本
  64.   #--------------------------------------------------------------------------
  65.   def update_help
  66.     @help_window.set_text(item)
  67.     #校正帮助窗口位置
  68.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  69.   end
  70. end
  71.  
  72. #==============================================================================
  73. # ■ Window_ItemCommand
  74. #------------------------------------------------------------------------------
  75. #  显示分类的窗口。
  76. #==============================================================================
  77.  
  78. class Window_ItemCommand < Window_Selectable
  79.   attr_accessor :commands
  80.   #--------------------------------------------------------------------------
  81.   # ● 初始化对像
  82.   #     commands : 命令字符串序列
  83.   #--------------------------------------------------------------------------
  84.   def initialize
  85.     super(0, 0, 160, 416)
  86.     self.opacity = OPACITY_Item
  87.     @commands = []
  88.     # 获取物品
  89.     for i in 1...$data_items.size
  90.       if $game_party.item_number(i) > 0
  91.         push = true
  92.         for com in @commands
  93.           if com == $data_items[i].desc
  94.             push = false
  95.           end
  96.         end
  97.         if push == true
  98.           @commands.push($data_items[i].desc)
  99.         end
  100.       end
  101.     end
  102.     # 获取武器
  103.     for i in 1...$data_weapons.size
  104.       if $game_party.weapon_number(i) > 0
  105.         push = true
  106.         for com in @commands
  107.           if com == $data_weapons[i].desc
  108.             push = false
  109.           end
  110.         end
  111.         if push == true
  112.           @commands.push($data_weapons[i].desc)
  113.         end
  114.       end
  115.     end
  116.     # 获取防具
  117.     for i in 1...$data_armors.size
  118.       if $game_party.armor_number(i) > 0
  119.         push = true
  120.         for com in @commands
  121.           if com == $data_armors[i].desc
  122.             push = false
  123.           end
  124.         end
  125.         if push == true
  126.           @commands.push($data_armors[i].desc)
  127.         end
  128.       end
  129.     end
  130.     if @commands == []
  131.       @commands.push("普通物品")
  132.     end
  133.     @item_max = @commands.size
  134.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  135.     refresh
  136.     self.index = 0
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 刷新
  140.   #--------------------------------------------------------------------------
  141.   def refresh
  142.     self.contents.clear
  143.     for i in 0...@item_max
  144.       draw_item(i, normal_color)
  145.     end
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 描绘项目
  149.   #     index : 项目编号
  150.   #     color : 文字色
  151.   #--------------------------------------------------------------------------
  152.   def draw_item(index, color)
  153.     self.contents.font.color = color
  154.     y = index * 32
  155.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 刷新帮助文本
  159.   #--------------------------------------------------------------------------
  160.   def update_help
  161.     @help_window.set_text(item)
  162.     #校正帮助窗口位置
  163.     @help_window.set_pos(self.x,self.y,32,self.oy,self.index,@column_max)
  164.   end
  165. end
  166.  
  167. #==============================================================================
  168. # ■ Window_Item
  169. #------------------------------------------------------------------------------
  170. #  物品画面、战斗画面、显示浏览物品的窗口。
  171. #==============================================================================
  172.  
  173. class Window_ItemList < Window_Selectable
  174.   #--------------------------------------------------------------------------
  175.   # ● 初始化对像
  176.   #--------------------------------------------------------------------------
  177.   def initialize
  178.     super(160, 0, 480, 480)
  179.     self.opacity = OPACITY_Item
  180.     @column_max = 2
  181.     refresh
  182.     self.index = 0
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 获取物品
  186.   #--------------------------------------------------------------------------
  187.   def item
  188.     return @data[self.index]
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 刷新
  192.   #--------------------------------------------------------------------------
  193.   def refresh
  194.     if self.contents != nil
  195.       self.contents.dispose
  196.       self.contents = nil
  197.     end
  198.     @data = []
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 分类
  202.   #     command : 类别名称
  203.   #--------------------------------------------------------------------------
  204.   def set_item(command)
  205.     refresh
  206.     if $game_temp.in_battle
  207.       # 添加物品
  208.       for i in 1...$data_items.size
  209.         if $game_party.item_number(i) > 0
  210.           @data.push($data_items[i])
  211.         end
  212.       end
  213.     end
  214.     for i in 1...$data_items.size
  215.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  216.         @data.push($data_items[i])
  217.       end
  218.     end
  219.     for i in 1...$data_weapons.size
  220.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  221.         @data.push($data_weapons[i])
  222.       end
  223.     end
  224.     for i in 1...$data_armors.size
  225.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  226.         @data.push($data_armors[i])
  227.       end
  228.     end
  229.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  230.     @item_max = @data.size
  231.     if @item_max > 0
  232.       self.contents = Bitmap.new(width - 32, row_max * 32)
  233.       self.contents.clear
  234.       for i in 0...@item_max
  235.         draw_item(i)
  236.       end
  237.     end
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 获取物品的所持数
  241.   #--------------------------------------------------------------------------
  242.   def item_number
  243.     return @item_max
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 描绘项目
  247.   #     index : 项目编号
  248.   #--------------------------------------------------------------------------
  249.   def draw_item(index)
  250.     item = @data[index]
  251.     case item
  252.     when RPG::Item
  253.       number = $game_party.item_number(item.id)
  254.     when RPG::Weapon
  255.       number = $game_party.weapon_number(item.id)
  256.     when RPG::Armor
  257.       number = $game_party.armor_number(item.id)
  258.     end
  259.     if item.is_a?(RPG::Item) and
  260.       $game_party.item_can_use?(item.id)
  261.       self.contents.font.color = normal_color
  262.     else
  263.       self.contents.font.color = disabled_color
  264.     end
  265.     x = 4 + index % 2 * (208 + 32)
  266.     y = index / 2 * 32
  267.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  268.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  269.     bitmap = RPG::Cache.icon(item.icon_name)
  270.     opacity = self.contents.font.color == normal_color ? 255 : 128
  271.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  272.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  273.     self.contents.draw_text(x + 170, y, 16, 32, ":", 1)
  274.     self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● 刷新帮助文本
  278.   #--------------------------------------------------------------------------
  279.   def update_help
  280.     @help_window.set_text(item)
  281.     #校正帮助窗口位置
  282.     @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  283.   end
  284. end
  285.  
  286. #==============================================================================
  287. # ■ Scene_Item
  288. #------------------------------------------------------------------------------
  289. #  处理物品画面的类。
  290. #==============================================================================
  291.  
  292. class Scene_Item
  293.   #--------------------------------------------------------------------------
  294.   # ● 主处理
  295.   #--------------------------------------------------------------------------
  296.   def main
  297.     # 创建背景图
  298.     @itemmenu = Sprite.new
  299.     @itemmenu.bitmap = RPG::Cache.picture("物品背景.png")
  300.     # 生成帮助窗口、物品窗口
  301.     @itemcommand_window = Window_ItemCommand.new
  302.     @command_index = @itemcommand_window.index
  303.     @itemlist_window = Window_ItemList.new
  304.     @itemlist_window.active = false
  305.     @help_window = Window_Help.new
  306.     # 生成金钱窗口
  307.     @gold_window = Window_Gold.new
  308.     @gold_window.y = 416
  309.     @gold_window.opacity = OPACITY_Item
  310.     # 关联帮助窗口
  311.     @itemcommand_window.help_window = @help_window
  312.     @itemlist_window.help_window = @help_window
  313.     # 生成目标窗口 (设置为不可见・不活动)
  314.     @target_window = Window_Target.new
  315.     # 关联帮助窗口
  316.     @target_window.help_window = @help_window
  317.     @target_window.opacity = OPACITY_Target
  318.     @target_window.visible = false
  319.     @target_window.active = false
  320.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  321.     # 执行过度
  322.     Graphics.transition
  323.     # 主循环
  324.     loop do
  325.       # 刷新游戏画面
  326.       Graphics.update
  327.       # 刷新输入信息
  328.       Input.update
  329.       # 刷新画面
  330.       update
  331.       # 如果画面切换就中断循环
  332.       if $scene != self
  333.         break
  334.       end
  335.     end
  336.     # 装备过渡
  337.     Graphics.freeze
  338.     # 释放窗口
  339.     @itemmenu.dispose
  340.     @itemcommand_window.dispose
  341.     @itemlist_window.dispose
  342.     @gold_window.dispose
  343.     @help_window.dispose
  344.     @target_window.dispose
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 刷新画面
  348.   #--------------------------------------------------------------------------
  349.   def update
  350.     # 刷新窗口
  351.     @help_window.update
  352.     @gold_window.update
  353.     @itemlist_window.update
  354.     @itemcommand_window.update
  355.     @target_window.update
  356.     if @command_index != @itemcommand_window.index
  357.       @command_index = @itemcommand_window.index
  358.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  359.     end
  360.     # 分类窗口被激活的情况下: 调用 update_itemcommand
  361.     if @itemcommand_window.active
  362.       update_itemcommand
  363.       return
  364.     end
  365.     # 物品窗口被激活的情况下: 调用 update_itemlist
  366.     if @itemlist_window.active
  367.       update_itemlist
  368.       return
  369.     end
  370.     # 目标窗口被激活的情况下: 调用 update_target
  371.     if @target_window.active
  372.       update_target
  373.       return
  374.     end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 刷新画面 (分类窗口被激活的情况下)
  378.   #--------------------------------------------------------------------------
  379.   def update_itemcommand
  380.     # 按下 B 键的情况下
  381.     if Input.trigger?(Input::B)
  382.       # 演奏取消 SE
  383.       $game_system.se_play($data_system.cancel_se)
  384.       # 切换到菜单画面
  385.       $scene = Scene_Menu.new(0)
  386.       return
  387.     end
  388.     if Input.trigger?(Input::C)
  389.       # 按下 C 键的情况下
  390.       if @itemlist_window.item_number == 0
  391.         # 演奏冻结 SE
  392.         $game_system.se_play($data_system.buzzer_se)
  393.         return
  394.       end
  395.       # 演奏确定 SE
  396.       $game_system.se_play($data_system.decision_se)
  397.       # 激活目标窗口
  398.       @itemcommand_window.active = false
  399.       @itemlist_window.active = true
  400.       @itemlist_window.index = 0
  401.       return
  402.     end
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 刷新画面 (物品窗口被激活的情况下)
  406.   #--------------------------------------------------------------------------
  407.   def update_itemlist
  408.     # 按下 B 键的情况下
  409.     if Input.trigger?(Input::B)
  410.       # 演奏取消 SE
  411.       $game_system.se_play($data_system.cancel_se)
  412.       @itemcommand_window.active = true
  413.       @itemlist_window.active = false
  414.       @itemlist_window.index = 0
  415.       # 切换到分类窗口
  416.       @itemcommand_window.index = @command_index
  417.       return
  418.     end
  419.     if Input.trigger?(Input::C)
  420.       # 获取物品窗口当前选中的物品数据
  421.       @item = @itemlist_window.item
  422.       # 不使用物品的情况下
  423.       unless @item.is_a?(RPG::Item)
  424.         # 演奏冻结 SE
  425.         $game_system.se_play($data_system.buzzer_se)
  426.         return
  427.       end
  428.       # 不能使用的情况下
  429.       unless $game_party.item_can_use?(@item.id)
  430.         # 演奏冻结 SE
  431.         $game_system.se_play($data_system.buzzer_se)
  432.         return
  433.       end
  434.       # 演奏确定 SE
  435.       $game_system.se_play($data_system.decision_se)
  436.       # 效果范围是我方的情况下
  437.       if @item.scope >= 3
  438.         # 激活目标窗口
  439.         @itemlist_window.active = false
  440.         @target_window.x = 304
  441.         @target_window.visible = true
  442.         @target_window.active = true
  443.         # 设置效果范围 (单体/全体) 的对应光标位置
  444.         if @item.scope == 4 || @item.scope == 6
  445.           @target_window.index = -1
  446.         else
  447.           @target_window.index = 0
  448.         end
  449.         # 效果在我方以外的情况下
  450.       else
  451.         # 公共事件 ID 有效的情况下
  452.         if @item.common_event_id > 0
  453.           # 预约调用公共事件
  454.           $game_temp.common_event_id = @item.common_event_id
  455.           # 演奏物品使用时的 SE
  456.           $game_system.se_play(@item.menu_se)
  457.           # 消耗品的情况下
  458.           if @item.consumable
  459.             # 使用的物品数减 1
  460.             $game_party.lose_item(@item.id, 1)
  461.             # 再描绘物品窗口的项目
  462.             @itemlist_window.draw_item(@itemlist_window.index)
  463.           end
  464.           # 切换到地图画面
  465.           $scene = Scene_Map.new
  466.           return
  467.         end
  468.       end
  469.       return
  470.     end
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 刷新画面 (目标窗口被激活的情况下)
  474.   #--------------------------------------------------------------------------
  475.   def update_target
  476.     # 按下 B 键的情况下
  477.     if Input.trigger?(Input::B)
  478.       # 演奏取消 SE
  479.       $game_system.se_play($data_system.cancel_se)
  480.       # 由于物品用完而不能使用的场合
  481.       unless $game_party.item_can_use?(@item.id)
  482.         # 再次生成物品窗口的内容
  483.         @itemlist_window.refresh
  484.       end
  485.       # 删除目标窗口
  486.       @itemlist_window.active = true
  487.       @target_window.visible = false
  488.       @target_window.active = false
  489.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  490.       return
  491.     end
  492.     # 按下 C 键的情况下
  493.     if Input.trigger?(Input::C)
  494.       # 如果物品用完的情况下
  495.       if $game_party.item_number(@item.id) == 0
  496.         # 演奏冻结 SE
  497.         $game_system.se_play($data_system.buzzer_se)
  498.         return
  499.       end
  500.       # 目标是全体的情况下
  501.       if @target_window.index == -1
  502.         used = false
  503.         for i in $game_party.actors
  504.           used |= i.item_effect(@item)
  505.         end
  506.       end
  507.       # 目标是单体的情况下
  508.       if @target_window.index >= 0
  509.         # 对目标角色应用物品的使用效果
  510.         target = $game_party.actors[@target_window.index]
  511.         used = target.item_effect(@item)
  512.       end
  513.       # 使用物品的情况下
  514.       if used
  515.         # 演奏物品使用时的 SE
  516.         $game_system.se_play(@item.menu_se)
  517.         # 使用的物品数减 1
  518.         if @item.consumable
  519.           $game_party.lose_item(@item.id, 1)
  520.           # 再描绘物品窗口的项目
  521.           @itemlist_window.draw_item(@itemlist_window.index)
  522.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  523.         end
  524.         # 再生成目标窗口的内容
  525.         @target_window.refresh
  526.         # 全灭的情况下
  527.         if $game_party.all_dead?
  528.           # 切换到游戏结束画面
  529.           $scene = Scene_Gameover.new
  530.           return
  531.         end
  532.         # 公共事件 ID 有效的情况下
  533.         if @item.common_event_id > 0
  534.           # 预约调用公共事件
  535.           $game_temp.common_event_id = @item.common_event_id
  536.           # 切换到地图画面
  537.           $scene = Scene_Map.new
  538.           return
  539.         end
  540.       end
  541.       # 无法使用物品的情况下
  542.       unless used
  543.         # 演奏冻结 SE
  544.         $game_system.se_play($data_system.buzzer_se)
  545.       end
  546.     return
  547.     end
  548.   end
  549. end

点评

但是至少需要把你用的分类脚本贴出来。  发表于 2014-11-9 10:05

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

2
 楼主| 发表于 2014-11-9 12:20:51 | 只看该作者
@芯☆淡茹水 脚本给出来了,帮忙看看{:2_264:}

点评

第一个脚本,在菜单和战斗里都试了下,没有报错咯~!(σ゚д゚)σ  发表于 2014-11-9 13:24
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

3
 楼主| 发表于 2014-11-9 13:45:59 | 只看该作者
@芯☆淡茹水  第一个我试了下下。是和RTAB战斗系统冲突了。

RUBY 代码复制
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  4.  
  5. class Scene_Battle
  6.   #--------------------------------------------------------------------------
  7.   # ● 公開インスタンス変数
  8.   #--------------------------------------------------------------------------
  9.   attr_reader   :status_window            # ステータスウィンドウ
  10.   attr_reader   :spriteset                # バトルスプライト
  11.   attr_reader   :scroll_time              # スクリーン移動基本時間
  12.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  13.   attr_reader   :drive                    # カメラ駆動
  14.   attr_accessor :force                    # アクション強制度
  15.   attr_accessor :camera                   # 現在のカメラ所持者
  16.   #--------------------------------------------------------------------------
  17.   # ● ATB基礎セットアップ
  18.   #--------------------------------------------------------------------------
  19.   def atb_setup
  20.     # ATB初期化
  21.     # speed   : バトルスピード決定。値が小さいほど早い
  22.     # @active : アクティブ度設定
  23.     #           3 : 常にアクティブ状態
  24.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  25.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  26.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  27.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  28.     #           3 : 自分が行動不能でない限り限り許す
  29.     #           2 : 自分がダメージを受けていない限り許す
  30.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  31.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  32.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  33.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  34.     # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
  35.     #               [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
  36.     # @enemy_speed : 敵の思考速度。1なら即時行動。
  37.     #                1フレーム毎に、1/@enemy_speedの確率で行動を起こす
  38.     # [url=home.php?mod=space&uid=316545]@force[/url] : 強制アクションでスキル使用時の強制具合
  39.     #          2:スキルは全て詠唱せず、必ず即時実行
  40.     #          1:単独スキルは詠唱し、連携スキルのみ即時実行
  41.     #          0:全スキル詠唱を行うだけ
  42.     # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
  43.     # @drive : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
  44.     # @scroll_time : スクリーン移動に要する基本時間
  45.     # @zoom_rate = [i, j] : エネミーのズーム率
  46.     #                       i が画面最上部に配置した時の拡大率
  47.     #                       j が画面最下部に配置した時の拡大率
  48.     #                       1 倍としたいときも、1.0 と必ず小数で設定すること
  49.     speed = 100
  50.     @active = 1
  51.     @action = 0
  52.     @anime_wait = false
  53.     @damage_wait = 10
  54.     @after_wait = [80, 0]
  55.     @enemy_speed = 40
  56.     @force = 2
  57.     @drive = true
  58.     @scroll_time = 15
  59.     @zoom_rate = [0.2, 1.0]
  60.     @help_time = 40
  61.     @escape == false
  62.     @camera = nil
  63.     [url=home.php?mod=space&uid=25307]@Max[/url] = 0
  64.     @turn_cnt = 0
  65.     @help_wait = 0
  66.     @action_battlers = []
  67.     @synthe = []
  68.     @spell_p = {}
  69.     @spell_e = {}
  70.     @command_a = false
  71.     @command = []
  72. #------------------------------------------------------------------------------   
  73. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  74. #    @party = false
  75. #------------------------------------------------------------------------------
  76.     for battler in $game_party.actors + $game_troop.enemies
  77.       spell_reset(battler)
  78.       battler.at = battler.agi * rand(speed / 2)
  79.       battler.damage_pop = {}
  80.       battler.damage = {}
  81.       battler.damage_sp = {}
  82.       battler.critical = {}
  83.       battler.recover_hp = {}
  84.       battler.recover_sp = {}
  85.       battler.state_p = {}
  86.       battler.state_m = {}
  87.       battler.animation = []
  88.       if battler.is_a?(Game_Actor)
  89.         @max += battler.agi
  90.       end
  91.     end
  92.     @max *= speed
  93.     @max /= $game_party.actors.size
  94.     for battler in $game_party.actors + $game_troop.enemies
  95.       battler.atp = 100 * battler.at / @max
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● ATゲージMax時SE
  100.   #--------------------------------------------------------------------------
  101.   def fullat_se
  102.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● レベルアップSE
  106.   #--------------------------------------------------------------------------
  107.   def levelup_se
  108.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● スキル習得SE
  112.   #--------------------------------------------------------------------------
  113.   def skill_se
  114.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  115.   end
  116. end
  117.  
  118. class Window_Base < Window
  119.   #--------------------------------------------------------------------------
  120.   # ● ATG の描画
  121.   #     actor : アクター
  122.   #     x     : 描画先 X 座標
  123.   #     y     : 描画先 Y 座標
  124.   #     width : 描画先の幅
  125.   #--------------------------------------------------------------------------
  126.   def draw_actor_atg(actor, x, y, width = 144)
  127.     if @at_gauge == nil
  128.       # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  129.       # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  130.       # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  131.       # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  132.       # align3:ゲージタイプ 0:左詰め 1:右詰め
  133.       @plus_x = 0
  134.       @rate_x = 0
  135.       @plus_y = 16
  136.       @plus_width = 0
  137.       @rate_width = 100
  138.       @width = @plus_width + width * @rate_width / 100
  139.       [url=home.php?mod=space&uid=291977]@height[/url] = 16
  140.       @align1 = 0
  141.       @align2 = 1
  142.       @align3 = 0
  143.       # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  144.       # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
  145.       grade1 = 1
  146.       grade2 = 0
  147.       # 色設定。color1:最外枠,color2:中枠
  148.       # color3:空枠ダークカラー,color4:空枠ライトカラー
  149.       color1 = Color.new(0, 0, 0)
  150.       color2 = Color.new(255, 255, 192)
  151.       color3 = Color.new(0, 0, 0, 192)
  152.       color4 = Color.new(0, 0, 64, 192)
  153.       # ゲージの色設定
  154.       # 通常時の色設定
  155.       color5 = Color.new(0, 64, 80)
  156.       color6 = Color.new(0, 128, 160)
  157.       # ゲージがMAXの時の色設定
  158.       color7 = Color.new(80, 0, 0)
  159.       color8 = Color.new(240, 0, 0)
  160.       # 連携スキル使用時の色設定
  161.       color9 = Color.new(80, 64, 32)
  162.       color10 = Color.new(240, 192, 96)
  163.       # スキル詠唱時の色設定
  164.       color11 = Color.new(80, 0, 64)
  165.       color12 = Color.new(240, 0, 192)
  166.       # ゲージの描画
  167.       gauge_rect_at(@width, @height, @align3, color1, color2,
  168.                   color3, color4, color5, color6, color7, color8,
  169.                   color9, color10, color11, color12, grade1, grade2)
  170.     end
  171.     # 変数atに描画するゲージの幅を代入
  172.     if actor.rtp == 0
  173.       at = (width + @plus_width) * actor.atp * @rate_width / 10000
  174.     else
  175.       at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
  176.     end
  177.     if at > width
  178.       at = width
  179.     end
  180.     # ゲージの左詰・中央構え等の補正
  181.     case @align1
  182.     when 1
  183.       x += (@rect_width - width) / 2
  184.     when 2
  185.       x += @rect_width - width
  186.     end
  187.     case @align2
  188.     when 1
  189.       y -= @height / 2
  190.     when 2
  191.       y -= @height
  192.     end
  193.     self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
  194.                       @at_gauge, Rect.new(0, 0, @width, @height))
  195.     if @align3 == 0
  196.       rect_x = 0
  197.     else
  198.       x += @width - at - 1
  199.       rect_x = @width - at - 1
  200.     end
  201.     # ゲージの色設定
  202.     if at == width
  203.         # MAX時のゲージ描画
  204.       self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  205.                         @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
  206.     else
  207.       if actor.rtp == 0
  208.         # 通常時のゲージ描画
  209.         self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  210.                           @at_gauge, Rect.new(rect_x, @height, at, @height))
  211.       else
  212.         if actor.spell == true
  213.           # 連携スキル使用時のゲージ描画
  214.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  215.                         @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
  216.         else
  217.           # スキル詠唱時のゲージ描画
  218.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  219.                         @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
  220.         end
  221.       end
  222.     end
  223.   end
  224. end
  225.  
  226. #==============================================================================
  227. # ■ Scene_Battle (分割定義 1)
  228. #------------------------------------------------------------------------------
  229. #  バトル画面の処理を行うクラスです。
  230. #==============================================================================
  231.  
  232. class Scene_Battle
  233.   #--------------------------------------------------------------------------
  234.   # ● メイン処理
  235.   #--------------------------------------------------------------------------
  236.   def main
  237.     # 戦闘用の各種一時データを初期化
  238.    # Graphics.frame_rate = 60
  239.     $game_temp.in_battle = true
  240.     $game_temp.battle_turn = 0
  241.     $game_temp.battle_event_flags.clear
  242.     $game_temp.battle_abort = false
  243.     $game_temp.battle_main_phase = false
  244.     $game_temp.battleback_name = $game_map.battleback_name
  245.     $game_temp.forcing_battler = nil
  246.     # バトルイベント用インタプリタを初期化
  247.     $game_system.battle_interpreter.setup(nil, 0)
  248.     # トループを準備
  249.     @troop_id = $game_temp.battle_troop_id
  250.     $game_troop.setup(@troop_id)
  251.     atb_setup
  252.     # アクターコマンドウィンドウを作成
  253. #==============================================================================
  254. #RTAB观光游第三站,战斗菜单增加逃跑选项
  255. #==============================================================================   
  256.     s1 = $data_system.words.attack
  257.     s2 = $data_system.words.skill
  258.     s3 = $data_system.words.guard
  259.     s4 = $data_system.words.item
  260.     s5 = "逃跑"
  261.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])   
  262. #   @actor_command_window.y = 160
  263.     @actor_command_window.y = 128
  264.     @actor_command_window.back_opacity = 160
  265.     @actor_command_window.active = false
  266.     @actor_command_window.visible = false
  267. #==============================================================================   
  268.     # その他のウィンドウを作成
  269. #------------------------------------------------------------------------------
  270. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  271. #    @party_command_window = Window_PartyCommand.new
  272. #------------------------------------------------------------------------------   
  273.     @help_window = Window_Help.new
  274.     @help_window.back_opacity = 160
  275.     @help_window.visible = false
  276.     @status_window = Window_BattleStatus.new
  277.     @message_window = Window_Message.new
  278.     # スプライトセットを作成
  279.     @spriteset = Spriteset_Battle.new
  280.     # ウェイトカウントを初期化
  281.     @wait_count = 0
  282.     # トランジション実行
  283.     if $data_system.battle_transition == ""
  284.       Graphics.transition(20)
  285.     else
  286.       Graphics.transition(40, "Graphics/Transitions/" +
  287.         $data_system.battle_transition)
  288.     end
  289.     # プレバトルフェーズ開始
  290.     start_phase1
  291.     # メインループ
  292.     loop do
  293.       # ゲーム画面を更新
  294.       Graphics.update
  295.       # 入力情報を更新
  296.       Input.update
  297.       # フレーム更新
  298.       update
  299.       # 画面が切り替わったらループを中断
  300.       if $scene != self
  301.         break
  302.       end
  303.     end
  304.     # マップをリフレッシュ
  305.     $game_map.refresh
  306.     # トランジション準備
  307.     Graphics.freeze
  308.     # ウィンドウを解放
  309.     @actor_command_window.dispose
  310. #------------------------------------------------------------------------------
  311. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  312. #    @party_command_window.dispose
  313. #------------------------------------------------------------------------------   
  314.     @help_window.dispose
  315.     @status_window.dispose
  316.     @message_window.dispose
  317.     if @skill_window != nil
  318.       @skill_window.dispose
  319.     end
  320.     if @item_window != nil
  321.       @item_window.dispose
  322.     end
  323.     if @result_window != nil
  324.       @result_window.dispose
  325.     end
  326.     # スプライトセットを解放
  327.     @spriteset.dispose
  328.     # タイトル画面に切り替え中の場合
  329.     if $scene.is_a?(Scene_Title)
  330.       # 画面をフェードアウト
  331.       Graphics.transition
  332.       Graphics.freeze
  333.     end
  334.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  335.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  336.       $scene = nil
  337.     end
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 勝敗判定
  341.   #--------------------------------------------------------------------------
  342.   def judge
  343.     # 全滅判定が真、またはパーティ人数が 0 人の場合
  344.     if $game_party.all_dead? or $game_party.actors.size == 0
  345.       # 敗北可能の場合
  346.       if $game_temp.battle_can_lose
  347.         # バトル開始前の BGM に戻す
  348.         $game_system.bgm_play($game_temp.map_bgm)
  349.         # バトル終了
  350.         battle_end(2)
  351.         # true を返す
  352.         return true
  353.       end
  354.       # ゲームオーバーフラグをセット
  355.       $game_temp.gameover = true
  356.       # true を返す
  357.       return true
  358.     end
  359.     # エネミーが 1 体でも存在すれば false を返す
  360.     for enemy in $game_troop.enemies
  361.       if enemy.exist?
  362.         return false
  363.       end
  364.     end
  365.     # アフターバトルフェーズ開始 (勝利)
  366.     start_phase5
  367.     # true を返す
  368.     return true
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● フレーム更新
  372.   #--------------------------------------------------------------------------
  373.   def update
  374.     # バトルイベント実行中の場合
  375.     if $game_system.battle_interpreter.running?
  376.       if @command.size > 0
  377.         @command_a = false
  378.         @command = []
  379.         command_delete
  380.       end
  381.       @status_window.at_refresh
  382.       # インタプリタを更新
  383.       $game_system.battle_interpreter.update
  384.       # アクションを強制されているバトラーが存在しない場合
  385.       if $game_temp.forcing_battler == nil
  386.         # バトルイベントの実行が終わった場合
  387.         unless $game_system.battle_interpreter.running?
  388.           # バトルイベントのセットアップを再実行
  389.           @status_window.refresh
  390.           setup_battle_event
  391.         end
  392.       end
  393.     end
  394.     # システム (タイマー)、画面を更新
  395.     $game_system.update
  396.     $game_screen.update
  397.     # タイマーが 0 になった場合
  398.     if $game_system.timer_working and $game_system.timer == 0
  399.       # バトル中断
  400.       $game_temp.battle_abort = true
  401.     end
  402.     # ウィンドウを更新
  403.     @help_window.update
  404. #------------------------------------------------------------------------------
  405. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  406. #    @party_command_window.update
  407. #------------------------------------------------------------------------------
  408.     @actor_command_window.update
  409.     @status_window.update
  410.     @message_window.update
  411.     # スプライトセットを更新
  412.     @spriteset.update
  413.     # トランジション処理中の場合
  414.     if $game_temp.transition_processing
  415.       # トランジション処理中フラグをクリア
  416.       $game_temp.transition_processing = false
  417.       # トランジション実行
  418.       if $game_temp.transition_name == ""
  419.         Graphics.transition(20)
  420.       else
  421.         Graphics.transition(40, "Graphics/Transitions/" +
  422.           $game_temp.transition_name)
  423.       end
  424.     end
  425.     # メッセージウィンドウ表示中の場合
  426.     if $game_temp.message_window_showing
  427.       return
  428.     end
  429.     # ゲームオーバーの場合
  430.     if $game_temp.gameover
  431.       # ゲームオーバー画面に切り替え
  432.       $scene = Scene_Gameover.new
  433.       return
  434.     end
  435.     # タイトル画面に戻す場合
  436.     if $game_temp.to_title
  437.       # タイトル画面に切り替え
  438.       $scene = Scene_Title.new
  439.       return
  440.     end
  441.     # バトル中断の場合
  442.     if $game_temp.battle_abort
  443.       # バトル開始前の BGM に戻す
  444.       $game_system.bgm_play($game_temp.map_bgm)
  445.       # バトル終了
  446.       battle_end(1)
  447.       return
  448.     end
  449.     # ヘルプウィンドウ表示中の場合
  450.     if @help_wait > 0
  451.       @help_wait -= 1
  452.       if @help_wait == 0
  453.         # ヘルプウィンドウを隠す
  454.         @help_window.visible = false
  455.       end
  456.     end
  457.     # アクションを強制されているバトラーが存在せず、
  458.     # かつバトルイベントが実行中の場合
  459.     if $game_temp.forcing_battler == nil and
  460.        $game_system.battle_interpreter.running?
  461.       return
  462.     end
  463.     # フェーズによって分岐
  464.     case @phase
  465.     when 0  # ATゲージ更新フェーズ
  466.       if anime_wait_return
  467.         update_phase0
  468.       end
  469.     when 1  # プレバトルフェーズ
  470.       update_phase1
  471.       return
  472.     when 2  # パーティコマンドフェーズ
  473.       update_phase2
  474.       return
  475.     when 5  # アフターバトルフェーズ
  476.       update_phase5
  477.       return
  478.     end
  479.     if $scene != self
  480.       return
  481.     end
  482.     if @phase == 0
  483.       if @command.size != 0  # アクターコマンドフェーズ
  484.         if @command_a == false
  485.           start_phase3
  486.         end
  487.         update_phase3
  488.       end
  489.       # ウェイト中の場合
  490.       if @wait_count > 0
  491.         # ウェイトカウントを減らす
  492.         @wait_count -= 1
  493.         return
  494.       end
  495.       update_phase4
  496.     end
  497.   end
  498.  
  499. #==============================================================================
  500. # ■ Scene_Battle (分割定義 2)
  501. #------------------------------------------------------------------------------
  502. #  バトル画面の処理を行うクラスです。
  503. #==============================================================================
  504.  
  505.   #--------------------------------------------------------------------------
  506.   # ● フレーム更新 (ATゲージ更新フェーズ)
  507.   #--------------------------------------------------------------------------
  508.   def update_phase0
  509.     if $game_temp.battle_turn == 0
  510.       $game_temp.battle_turn = 1
  511.     end
  512.     # B ボタンが押された場合
  513.   #  if @command_a == false and @party == false
  514.    #   if Input.trigger?(Input::B)
  515.         # キャンセル SE を演奏
  516.    #     $game_system.se_play($data_system.cancel_se)
  517.    #     @party = true
  518.    #   end
  519.    # end
  520.    # if @party == true and
  521.    #     ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  522.    #     (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  523.       # パーティコマンドフェーズへ
  524.    #   start_phase2
  525.    #   return
  526.    # end
  527.     # ATゲージ増加処理
  528.     cnt = 0
  529.     for battler in $game_party.actors + $game_troop.enemies
  530.       active?(battler)
  531.       if battler.rtp == 0
  532.         if battler.at >= @max
  533.           if battler.is_a?(Game_Actor)
  534.             if battler.inputable?
  535.               unless @action_battlers.include?(battler) or
  536.                   @command.include?(battler) or @escape == true
  537.                 if battler.current_action.forcing
  538.                   fullat_se
  539.                   force_action(battler)
  540.                   action_start(battler)
  541.                 else
  542.                   fullat_se
  543.                   @command.push(battler)
  544.                 end
  545.               end
  546.             else
  547.               unless @action_battlers.include?(battler) or
  548.                       battler == @command[0]
  549.                 battler.current_action.clear
  550.                 if @command.include?(battler)
  551.                   @command.delete(battler)
  552.                 else
  553.                   if battler.movable?
  554.                     fullat_se
  555.                   end
  556.                 end
  557.                 action_start(battler)
  558.               end
  559.             end
  560.           else
  561.             unless @action_battlers.include?(battler)
  562.               if battler.current_action.forcing
  563.                 force_action(battler)
  564.                 action_start(battler)
  565.               else
  566.                 if @enemy_speed != 0
  567.                   if rand(@enemy_speed) == 0
  568.                     number = cnt - $game_party.actors.size
  569.                     enemy_action(number)
  570.                   end
  571.                 else
  572.                   number = cnt - $game_party.actors.size
  573.                   enemy_action(number)
  574.                 end
  575.               end
  576.             end
  577.           end
  578.         else
  579.           battler.at += battler.agi
  580.           if battler.guarding?
  581.             battler.at += battler.agi
  582.           end
  583.           if battler.movable?
  584.             battler.atp = 100 * battler.at / @max
  585.           end
  586.         end
  587.       else
  588.         if battler.rt >= battler.rtp
  589.           speller = synthe?(battler)
  590.           if speller != nil
  591.             battler = speller[0]
  592.           end
  593.           unless @action_battlers.include?(battler)
  594.             if battler.is_a?(Game_Actor)
  595.               fullat_se
  596.             end
  597.             battler.rt = battler.rtp
  598.             action_start(battler)
  599.           end
  600.         else
  601.           battler.rt += battler.agi
  602.           speller = synthe?(battler)
  603.           if speller != nil
  604.             for spell in speller
  605.               if spell != battler
  606.                 spell.rt += battler.agi
  607.               end
  608.             end
  609.           end
  610.         end
  611.       end
  612.       cnt += 1
  613.     end
  614.     # ATゲージをリフレッシュ
  615.     @status_window.at_refresh
  616.     # 逃走処理
  617.     if @escape == true and
  618.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  619.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  620.       temp = false
  621.       for battler in $game_party.actors
  622.         if battler.inputable?
  623.           temp = true
  624.         end
  625.       end
  626.       if temp == true
  627.         for battler in $game_party.actors
  628.           if battler.at < @max and battler.inputable?
  629.             temp = false
  630.             break
  631.           end
  632.         end
  633.         if temp == true
  634.           @escape = false
  635.           for battler in $game_party.actors
  636.             battler.at %= @max
  637.           end
  638.           $game_temp.battle_main_phase = false
  639.           update_phase2_escape
  640.         end
  641.       end
  642.     end
  643.   end
  644. #------------------------------------------------------------------------------
  645. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  646.   #--------------------------------------------------------------------------
  647.   # ● パーティコマンドフェーズ開始
  648.   #--------------------------------------------------------------------------
  649. #  def start_phase2
  650.     # フェーズ 2 に移行
  651. #    @phase = 2
  652. #    @party = false
  653.     # パーティコマンドウィンドウを有効化
  654. #    @party_command_window.active = true
  655. #    @party_command_window.visible = true
  656.     # アクターを非選択状態に設定
  657. #    @actor_index = -1
  658.     # アクターコマンドウィンドウを無効化
  659. #    @actor_command_window.active = false
  660. #    @actor_command_window.visible = false
  661. #    if @command.size != 0
  662.       # アクターの明滅エフェクト OFF
  663. #      if @active_actor != nil
  664. #        @active_actor.blink = false
  665. #      end
  666. #    end
  667.     # カメラセット
  668. #    @camera == "party"
  669. #    @spriteset.screen_target(0, 0, 1)
  670.     # メインフェーズフラグをクリア
  671. #    $game_temp.battle_main_phase = false
  672. #  end
  673. #------------------------------------------------------------------------------
  674.   #--------------------------------------------------------------------------
  675.   # ● フレーム更新 (パーティコマンドフェーズ)
  676.   #--------------------------------------------------------------------------
  677.   def update_phase2
  678. #------------------------------------------------------------------------------
  679. #RTAB观光游第一站,去除“战斗/逃跑”选项部分  
  680.     # C ボタンが押された場合
  681.    # 去掉“战斗/逃跑”选项
  682. #    if Input.trigger?(Input::C)
  683.       # パーティコマンドウィンドウのカーソル位置で分岐
  684. #      case @party_command_window.index
  685. #      when 0  # 戦う
  686.         # パーティコマンドウィンドウを無効化
  687. #        @party_command_window.active = false
  688. #        @party_command_window.visible = false
  689.         # 決定 SE を演奏
  690. #        $game_system.se_play($data_system.decision_se)
  691. #------------------------------------------------------------------------------
  692.         @escape = false
  693.         @phase = 0
  694.         if $game_temp.battle_turn == 0
  695.           $game_temp.battle_turn = 1
  696.         end
  697.         if @command_a == true
  698.           # アクターコマンドフェーズ開始
  699.           start_phase3
  700.         else
  701.           $game_temp.battle_main_phase = true
  702.         end
  703. end         
  704. #------------------------------------------------------------------------------
  705. #RTAB观光游第一站,去除“战斗/逃跑”选项部分         
  706. #      when 1  # 逃げる
  707.         # 逃走可能ではない場合
  708. #        if $game_temp.battle_can_escape == false
  709.           # ブザー SE を演奏
  710. #          $game_system.se_play($data_system.buzzer_se)
  711. #          return
  712. #        end
  713.         # 決定 SE を演奏
  714. #        $game_system.se_play($data_system.decision_se)
  715. #        @phase = 0
  716.         # パーティコマンドウィンドウを無効化
  717. #        @party_command_window.active = false
  718. #        @party_command_window.visible = false
  719. #        $game_temp.battle_main_phase = true
  720. #        if $game_temp.battle_turn == 0
  721. #          update_phase2_escape
  722. #          $game_temp.battle_turn = 1
  723. #        for battler in $game_party.actors
  724. #           battler.at -= @max / 2
  725. #         end
  726. #         return
  727. #      end
  728.         # 決定 SE を演奏
  729. #       $game_system.se_play($data_system.decision_se)
  730. #       @escape = true
  731. #       for battler in $game_party.actors
  732. #         @command_a = false
  733. #         @command.delete(battler)
  734. #         @action_battlers.delete(battler)
  735. #         skill_reset(battler)
  736. #       end
  737. #     end
  738. #     return
  739. #   end
  740. #end
  741. #------------------------------------------------------------------------------
  742.   #--------------------------------------------------------------------------
  743.   # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  744.   #--------------------------------------------------------------------------
  745.   def update_phase2_escape
  746.     # エネミーの素早さ平均値を計算
  747.     enemies_agi = 0
  748.     enemies_number = 0
  749.     for enemy in $game_troop.enemies
  750.       if enemy.exist?
  751.         enemies_agi += enemy.agi
  752.         enemies_number += 1
  753.       end
  754.     end
  755.     if enemies_number > 0
  756.       enemies_agi /= enemies_number
  757.     end
  758.     # アクターの素早さ平均値を計算
  759.     actors_agi = 0
  760.     actors_number = 0
  761.     for actor in $game_party.actors
  762.       if actor.exist?
  763.         actors_agi += actor.agi
  764.         actors_number += 1
  765.       end
  766.     end
  767.     if actors_number > 0
  768.       actors_agi /= actors_number
  769.     end
  770.     # 逃走成功判定
  771.     success = rand(100) < 50 * actors_agi / enemies_agi
  772.     # 逃走成功の場合
  773.     if success
  774.       # 逃走 SE を演奏
  775.       $game_system.se_play($data_system.escape_se)
  776.       # バトル開始前の BGM に戻す
  777.       $game_system.bgm_play($game_temp.map_bgm)
  778.       # バトル終了
  779.       battle_end(1)
  780.     # 逃走失敗の場合
  781.     else
  782.       @help_window.set_text("逃走失敗", 1)
  783.       @help_wait = @help_time
  784.       # パーティ全員のアクションをクリア
  785.       $game_party.clear_actions
  786.       # メインフェーズ開始
  787.       start_phase4
  788.     end
  789.   end
  790.   #--------------------------------------------------------------------------
  791.   # ● アフターバトルフェーズ開始
  792.   #--------------------------------------------------------------------------
  793.   def start_phase5
  794.     # フェーズ 5 に移行
  795.     @phase = 5
  796.     # バトル終了 ME を演奏
  797.     $game_system.me_play($game_system.battle_end_me)
  798.     # バトル開始前の BGM に戻す
  799.     $game_system.bgm_play($game_temp.map_bgm)
  800.     # EXP、ゴールド、トレジャーを初期化
  801.     exp = 0
  802.     gold = 0
  803.     treasures = []
  804.     if @active_actor != nil
  805.       @active_actor.blink = false
  806.     end
  807.     # メインフェーズフラグをセット
  808.     $game_temp.battle_main_phase = true
  809. #------------------------------------------------------------------------------
  810. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  811.     # パーティコマンドウィンドウを無効化
  812. #    @party_command_window.active = false
  813. #    @party_command_window.visible = false
  814. #------------------------------------------------------------------------------
  815.     # アクターコマンドウィンドウを無効化
  816.     @actor_command_window.active = false
  817.     @actor_command_window.visible = false
  818.     if @skill_window != nil
  819.       # スキルウィンドウを解放
  820.       @skill_window.dispose
  821.       @skill_window = nil
  822.     end
  823.     if @item_window != nil
  824.       # アイテムウィンドウを解放
  825.       @item_window.dispose
  826.       @item_window = nil
  827.     end
  828.     # ヘルプウィンドウを隠す
  829.     @help_window.visible = false
  830.     # ループ
  831.     for enemy in $game_troop.enemies
  832.       # エネミーが隠れ状態でない場合
  833.       unless enemy.hidden
  834.         # 獲得 EXP、ゴールドを追加
  835.         exp += enemy.exp
  836.         gold += enemy.gold
  837.         # トレジャー出現判定
  838.         if rand(100) < enemy.treasure_prob
  839.           if enemy.item_id > 0
  840.             treasures.push($data_items[enemy.item_id])
  841.           end
  842.           if enemy.weapon_id > 0
  843.             treasures.push($data_weapons[enemy.weapon_id])
  844.           end
  845.           if enemy.armor_id > 0
  846.             treasures.push($data_armors[enemy.armor_id])
  847.           end
  848.         end
  849.       end
  850.     end
  851.     # トレジャーの数を 6 個までに限定
  852.     treasures = treasures[0..5]
  853.     # EXP 獲得
  854.     for i in 0...$game_party.actors.size
  855.       actor = $game_party.actors[i]
  856.       if actor.cant_get_exp? == false
  857.         last_level = actor.level
  858.         actor.exp += exp
  859.         if actor.level > last_level
  860.           @status_window.level_up(i)
  861.           actor.damage[[actor, -1]] = "Level up!"
  862.           actor.up_level = actor.level - last_level
  863.         end
  864.       end
  865.     end
  866.     # ゴールド獲得
  867.     $game_party.gain_gold(gold)
  868.     # トレジャー獲得
  869.     for item in treasures
  870.       case item
  871.       when RPG::Item
  872.         $game_party.gain_item(item.id, 1)
  873.       when RPG::Weapon
  874.         $game_party.gain_weapon(item.id, 1)
  875.       when RPG::Armor
  876.         $game_party.gain_armor(item.id, 1)
  877.       end
  878.     end
  879.     # バトルリザルトウィンドウを作成
  880.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  881.     # ウェイトカウントを設定
  882.     @phase5_wait_count = 100
  883.   end
  884.   #--------------------------------------------------------------------------
  885.   # ● フレーム更新 (アフターバトルフェーズ)
  886.   #--------------------------------------------------------------------------
  887.   def update_phase5
  888.     # ウェイトカウントが 0 より大きい場合
  889.     if @phase5_wait_count > 0
  890.       # ウェイトカウントを減らす
  891.       @phase5_wait_count -= 1
  892.       # ウェイトカウントが 0 になった場合
  893.       if @phase5_wait_count == 0
  894.         # リザルトウィンドウを表示
  895.         @result_window.visible = true
  896.         # メインフェーズフラグをクリア
  897.         $game_temp.battle_main_phase = false
  898.         # ステータスウィンドウをリフレッシュ
  899.         @status_window.refresh
  900.         for actor in $game_party.actors
  901.           if actor.damage.include?([actor, 0])
  902.             @phase5_wait_count = 20
  903.             actor.damage_pop[[actor, 0]] = true
  904.           end
  905.           if actor.damage.include?([actor, -1])
  906.             @phase5_wait_count = 20
  907.             actor.damage_pop[[actor, -1]] = true
  908.             for level in actor.level - actor.up_level + 1..actor.level
  909.               for skill in $data_classes[actor.class_id].learnings
  910.                 if level == skill.level and not actor.skill_learn?(skill.id)
  911.                   actor.damage[[actor, 0]] = "New Skill!"
  912.                   break
  913.                 end
  914.               end
  915.             end
  916.           end
  917.         end
  918.       end
  919.       return
  920.     end
  921.     # C ボタンが押された場合
  922.     if Input.trigger?(Input::C)
  923.       # バトル終了
  924.       battle_end(0)
  925.     end
  926.   end
  927.  
  928. #==============================================================================
  929. # ■ Scene_Battle (分割定義 3)
  930. #------------------------------------------------------------------------------
  931. #  バトル画面の処理を行うクラスです。
  932. #==============================================================================
  933.  
  934.   #--------------------------------------------------------------------------
  935.   # ● アクターコマンドフェーズ開始
  936.   #--------------------------------------------------------------------------
  937.   def start_phase3
  938.     if victory?
  939.       return
  940.     end
  941.     # メインフェーズフラグをクリア
  942.     $game_temp.battle_main_phase = false
  943.     @command_a = true
  944.     @active_actor = @command[0]
  945.     cnt = 0
  946.     for actor in $game_party.actors
  947.       if actor == @active_actor
  948.         @actor_index = cnt
  949.       end
  950.       cnt += 1
  951.     end
  952.     @active_actor.blink = true
  953.     unless @active_actor.inputable?
  954.       @active_actor.current_action.clear
  955.       phase3_next_actor
  956.       return
  957.     end
  958.     phase3_setup_command_window
  959.     # カメラの設定
  960.     @camera = "command"
  961.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  962.     y = [(plus.abs - 1.5) * 10 , 0].min
  963.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # ● アクターのコマンド入力終了
  967.   #--------------------------------------------------------------------------
  968.   def phase3_next_actor
  969.     @command.shift
  970.     @command_a = false
  971.     # メインフェーズフラグをセット
  972.     $game_temp.battle_main_phase = true
  973.     # アクターコマンドウィンドウを無効化
  974.     @actor_command_window.active = false
  975.     @actor_command_window.visible = false
  976.     # アクターの明滅エフェクト OFF
  977.     if @active_actor != nil
  978.       @active_actor.blink = false
  979.     end
  980.     action_start(@active_actor)
  981.     # カメラを元に戻す
  982.     if @camera == "command"
  983.       @spriteset.screen_target(0, 0, 1)
  984.     end
  985.     return
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # ● アクターコマンドウィンドウのセットアップ
  989.   #--------------------------------------------------------------------------
  990.   def phase3_setup_command_window
  991. #------------------------------------------------------------------------------
  992. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  993.     # パーティコマンドウィンドウを無効化
  994. #    @party_command_window.active = false
  995. #    @party_command_window.visible = false
  996. #------------------------------------------------------------------------------  
  997.     # アクターコマンドウィンドウを有効化
  998.     @actor_command_window.active = true
  999.     @actor_command_window.visible = true
  1000.     # アクターコマンドウィンドウの位置を設定
  1001.     @actor_command_window.x = @actor_index * 160 +
  1002.                               (4 - $game_party.actors.size) * 80
  1003.     # インデックスを 0 に設定
  1004.     @actor_command_window.index = 0
  1005.   end
  1006.   #--------------------------------------------------------------------------
  1007.   # ● エネミーアクション作成
  1008.   #--------------------------------------------------------------------------
  1009.   def enemy_action(number)
  1010.     enemy = $game_troop.enemies[number]
  1011.     unless enemy.current_action.forcing
  1012.       enemy.make_action
  1013.     end
  1014.     action_start(enemy)
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ● フレーム更新 (アクターコマンドフェーズ)
  1018.   #--------------------------------------------------------------------------
  1019.   def update_phase3
  1020.     if victory? and @command_a
  1021.       command_delete
  1022.       @command.push(@active_actor)
  1023.       return
  1024.     end
  1025.     # エネミーアローが有効の場合
  1026.     if @enemy_arrow != nil
  1027.       update_phase3_enemy_select
  1028.     # アクターアローが有効の場合
  1029.     elsif @actor_arrow != nil
  1030.       update_phase3_actor_select
  1031.     # スキルウィンドウが有効の場合
  1032.     elsif @skill_window != nil
  1033.       update_phase3_skill_select
  1034.     # アイテムウィンドウが有効の場合
  1035.     elsif @item_window != nil
  1036.       update_phase3_item_select
  1037.     # アクターコマンドウィンドウが有効の場合
  1038.     elsif @actor_command_window.active
  1039.       update_phase3_basic_command
  1040.     end
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  1044.   #--------------------------------------------------------------------------
  1045.   def update_phase3_basic_command
  1046.     unless @active_actor.inputable?
  1047.       @active_actor.current_action.clear
  1048.       phase3_next_actor
  1049.       return
  1050.     end
  1051. #--------------------------------------------------------------------------
  1052. #RTAB观光游第一站,去除“战斗/逃跑”选项部分
  1053. # B ボタンが押された場合
  1054. #   if Input.trigger?(Input::B) and @party == false
  1055.       # キャンセル SE を演奏
  1056. #     $game_system.se_play($data_system.cancel_se)
  1057. #     @party = true
  1058. #   end
  1059. #   if @party == true and
  1060. #       ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  1061. #       (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  1062.       # パーティコマンドフェーズへ
  1063. #     start_phase2
  1064. #     return
  1065. #   end
  1066. #==============================================================================
  1067. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1068. #==============================================================================
  1069.     # A : SKILL
  1070.     if Input.trigger?(Input::X)
  1071.       # 決定 SE を演奏
  1072.       $game_system.se_play($data_system.decision_se)
  1073.       # スキルの選択を開始
  1074.       start_skill_select
  1075.       return
  1076.     end
  1077.     # S : 防御
  1078.     if Input.trigger?(Input::Y)
  1079.       # 決定 SE を演奏
  1080.       $game_system.se_play($data_system.decision_se)
  1081.       # アクションを設定
  1082.       @active_actor.current_action.kind = 0
  1083.       @active_actor.current_action.basic = 1
  1084.       # 次のアクターのコマンド入力へ
  1085.       phase3_next_actor
  1086.       return
  1087.     end
  1088.     # D : ITEM
  1089.     if Input.trigger?(Input::Z)
  1090.       # 決定 SE を演奏
  1091.       $game_system.se_play($data_system.decision_se)
  1092.       # アイテムの選択を開始
  1093.       start_item_select
  1094.       return
  1095.     end
  1096. #==============================================================================
  1097.     # C ボタンが押された場合
  1098.     if Input.trigger?(Input::C)
  1099. #------------------------------------------------------------------------------
  1100. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1101. #      @party = false
  1102. #------------------------------------------------------------------------------
  1103.       # アクターコマンドウィンドウのカーソル位置で分岐
  1104.       case @actor_command_window.index
  1105.       when 0  # 攻撃
  1106. #==============================================================================
  1107. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1108. #==============================================================================        
  1109.         if victory?
  1110.           # ブザー SE を演奏
  1111.           $game_system.se_play($data_system.buzzer_se)
  1112.           return
  1113.         end
  1114. #==============================================================================        
  1115.         # 決定 SE を演奏
  1116.         $game_system.se_play($data_system.decision_se)
  1117.         # エネミーの選択を開始
  1118.         start_enemy_select
  1119.       when 1  # スキル
  1120.         # 決定 SE を演奏
  1121.         $game_system.se_play($data_system.decision_se)
  1122.         # スキルの選択を開始
  1123.         start_skill_select
  1124.       when 2  # 防御
  1125.         # 決定 SE を演奏
  1126.         $game_system.se_play($data_system.decision_se)
  1127.         # アクションを設定
  1128.         @active_actor.current_action.kind = 0
  1129.         @active_actor.current_action.basic = 1
  1130.         # 次のアクターのコマンド入力へ
  1131.         phase3_next_actor
  1132.       when 3  # アイテム
  1133.         # 決定 SE を演奏
  1134.         $game_system.se_play($data_system.decision_se)
  1135.         # アイテムの選択を開始
  1136.         start_item_select
  1137. #==============================================================================
  1138. #RTAB观光游第三站,战斗菜单增加逃跑选项
  1139. #==============================================================================
  1140.       when 4 #逃跑(添加内容)
  1141.         if $game_temp.battle_can_escape == false
  1142.           # ブザー SE を演奏
  1143.           $game_system.se_play($data_system.buzzer_se)
  1144.           return
  1145.        end
  1146.         # 決定 SE を演奏
  1147.         $game_system.se_play($data_system.decision_se)
  1148.        @phase = 0
  1149.         # パーティコマンドウィンドウを無効化
  1150.         @actor_command_window.active = false
  1151.         @actor_command_window.visible = false
  1152.         $game_temp.battle_main_phase = true
  1153.         if $game_temp.battle_turn == 0
  1154.           update_phase2_escape
  1155.          $game_temp.battle_turn = 1
  1156.          for battler in $game_party.actors
  1157.             battler.at -= @max / 2
  1158.           end
  1159.           return
  1160.        end
  1161.        # 決定 SE を演奏
  1162.         $game_system.se_play($data_system.decision_se)
  1163.         @escape = true
  1164.         for battler in $game_party.actors
  1165.           @command_a = false
  1166.           @command.delete(battler)
  1167.           @action_battlers.delete(battler)
  1168.           skill_reset(battler)
  1169.         end
  1170. #==============================================================================        
  1171.       end
  1172.       return
  1173.     end
  1174.     # キャラチェンジ
  1175.     if @command.size > 1
  1176.       # R ボタンが押された場合
  1177.       if Input.trigger?(Input::L)
  1178.         $game_system.se_play($data_system.cursor_se)
  1179. #------------------------------------------------------------------------------
  1180. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1181.        # @party = false
  1182. #------------------------------------------------------------------------------      
  1183.         # アクターの明滅エフェクト OFF
  1184.         if @active_actor != nil
  1185.           @active_actor.blink = false
  1186.         end
  1187.         @command.push(@command[0])
  1188.         @command.shift
  1189.         @command_a = false
  1190.         # 新たなコマンドウィンドウの立ち上げ
  1191.         start_phase3
  1192.       end
  1193.       # L ボタンが押された場合
  1194.       if Input.trigger?(Input::R)
  1195.         $game_system.se_play($data_system.cursor_se)
  1196. #------------------------------------------------------------------------------
  1197. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1198.      #   @party = false
  1199. #------------------------------------------------------------------------------      
  1200.         # アクターの明滅エフェクト OFF
  1201.         if @active_actor != nil
  1202.           @active_actor.blink = false
  1203.         end
  1204.         @command.unshift(@command[@command.size - 1])
  1205.         @command.delete_at(@command.size - 1)
  1206.         @command_a = false
  1207.         # 新たなコマンドウィンドウの立ち上げ
  1208.         start_phase3
  1209.       end
  1210.       # 右 ボタンが押された場合
  1211.       if Input.trigger?(Input::RIGHT)
  1212.         $game_system.se_play($data_system.cursor_se)
  1213. #------------------------------------------------------------------------------
  1214. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1215.    #     @party = false
  1216. #------------------------------------------------------------------------------      
  1217.         # アクターの明滅エフェクト OFF
  1218.         if @active_actor != nil
  1219.           @active_actor.blink = false
  1220.         end
  1221.         actor = $game_party.actors[@actor_index]
  1222.         while actor == @command[0] or (not @command.include?(actor))
  1223.           @actor_index += 1
  1224.           @actor_index %= $game_party.actors.size
  1225.           actor = $game_party.actors[@actor_index]
  1226.           if actor == @command[0]
  1227.             break
  1228.           end
  1229.         end
  1230.         while actor != @command[0]
  1231.           @command.push(@command.shift)
  1232.         end
  1233.         @command_a = false
  1234.         # 新たなコマンドウィンドウの立ち上げ
  1235.         start_phase3
  1236.       end
  1237.       # 左 ボタンが押された場合
  1238.       if Input.trigger?(Input::LEFT)
  1239.         $game_system.se_play($data_system.cursor_se)
  1240. #------------------------------------------------------------------------------
  1241. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1242.    #     @party = false
  1243. #------------------------------------------------------------------------------
  1244.         # アクターの明滅エフェクト OFF
  1245.         if @active_actor != nil
  1246.           @active_actor.blink = false
  1247.         end
  1248.         actor = $game_party.actors[@actor_index]
  1249.         while actor == @command[0] or (not @command.include?(actor))
  1250.           @actor_index -= 1
  1251.           @actor_index %= $game_party.actors.size
  1252.           actor = $game_party.actors[@actor_index]
  1253.           if actor == @command[0]
  1254.             break
  1255.           end
  1256.         end
  1257.         while actor != @command[0]
  1258.           @command.push(@command.shift)
  1259.         end
  1260.         @command_a = false
  1261.         # 新たなコマンドウィンドウの立ち上げ
  1262.         start_phase3
  1263.       end
  1264.     end
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1268.   #--------------------------------------------------------------------------
  1269.   def update_phase3_skill_select
  1270.     # コマンド選択中に行動不能になった場合
  1271.     unless @active_actor.inputable?
  1272.       @active_actor.current_action.clear
  1273.       command_delete
  1274.       # 次のアクターのコマンド入力へ
  1275.       phase3_next_actor
  1276.       return
  1277.     end
  1278.     # スキルウィンドウを可視状態にする
  1279.     @skill_window.visible = true
  1280.     # スキルウィンドウを更新
  1281.     @skill_window.update
  1282.     # B ボタンが押された場合
  1283.     if Input.trigger?(Input::B)
  1284.       # キャンセル SE を演奏
  1285.       $game_system.se_play($data_system.cancel_se)
  1286.       # スキルの選択を終了
  1287.       end_skill_select
  1288.       return
  1289.     end
  1290.     # C ボタンが押された場合
  1291.     if Input.trigger?(Input::C)
  1292.       # スキルウィンドウで現在選択されているデータを取得
  1293.       @skill = @skill_window.skill
  1294.       # 使用できない場合
  1295.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1296.         # ブザー SE を演奏
  1297.         $game_system.se_play($data_system.buzzer_se)
  1298.         return
  1299.       end
  1300.       # 決定 SE を演奏
  1301.       $game_system.se_play($data_system.decision_se)
  1302.       # アクションを設定
  1303.       @active_actor.current_action.skill_id = @skill.id
  1304.       # スキルウィンドウを不可視状態にする
  1305.       @skill_window.visible = false
  1306.       # 効果範囲が敵単体の場合
  1307.       if @skill.scope == 1
  1308.         # エネミーの選択を開始
  1309.         start_enemy_select
  1310.       # 効果範囲が味方単体の場合
  1311.       elsif @skill.scope == 3 or @skill.scope == 5
  1312.         # アクターの選択を開始
  1313.         start_actor_select
  1314.       # 効果範囲が単体ではない場合
  1315.       else
  1316.         # アクションを設定
  1317.         @active_actor.current_action.kind = 1
  1318.         # スキルの選択を終了
  1319.         end_skill_select
  1320.         # 次のアクターのコマンド入力へ
  1321.         phase3_next_actor
  1322.       end
  1323.       return
  1324.     end
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1328.   #--------------------------------------------------------------------------
  1329.   def update_phase3_item_select
  1330.     # コマンド選択中に行動不能になった場合
  1331.     unless @active_actor.inputable?
  1332.       @active_actor.current_action.clear
  1333.       command_delete
  1334.       # 次のアクターのコマンド入力へ
  1335.       phase3_next_actor
  1336.       return
  1337.     end
  1338.     # アイテムウィンドウを可視状態にする
  1339.     @item_window.visible = true
  1340.     # アイテムウィンドウを更新
  1341.     @item_window.update
  1342.     # B ボタンが押された場合
  1343.     if Input.trigger?(Input::B)
  1344.       # キャンセル SE を演奏
  1345.       $game_system.se_play($data_system.cancel_se)
  1346.       # アイテムの選択を終了
  1347.       end_item_select
  1348.       return
  1349.     end
  1350.     # C ボタンが押された場合
  1351.     if Input.trigger?(Input::C)
  1352.       # アイテムウィンドウで現在選択されているデータを取得
  1353.       @item = @item_window.item
  1354.       # 使用できない場合
  1355.       unless $game_party.item_can_use?(@item.id)
  1356.         # ブザー SE を演奏
  1357.         $game_system.se_play($data_system.buzzer_se)
  1358.         return
  1359.       end
  1360.       # 決定 SE を演奏
  1361.       $game_system.se_play($data_system.decision_se)
  1362.       # アクションを設定
  1363.       @active_actor.current_action.item_id = @item.id
  1364.       # アイテムウィンドウを不可視状態にする
  1365.       @item_window.visible = false
  1366.       # 効果範囲が敵単体の場合
  1367.       if @item.scope == 1
  1368.         # エネミーの選択を開始
  1369.         start_enemy_select
  1370.       # 効果範囲が味方単体の場合
  1371.       elsif @item.scope == 3 or @item.scope == 5
  1372.         # アクターの選択を開始
  1373.         start_actor_select
  1374.       # 効果範囲が単体ではない場合
  1375.       else
  1376.         # アクションを設定
  1377.         @active_actor.current_action.kind = 2
  1378.         # アイテムの選択を終了
  1379.         end_item_select
  1380.         # 次のアクターのコマンド入力へ
  1381.         phase3_next_actor
  1382.       end
  1383.       return
  1384.     end
  1385.   end
  1386.   #--------------------------------------------------------------------------
  1387.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1388.   #--------------------------------------------------------------------------
  1389.   def update_phase3_enemy_select
  1390.     # コマンド選択中に行動不能になった場合
  1391.     unless @active_actor.inputable?
  1392.       # カメラを元に戻す
  1393.       if @camera == "select"
  1394.         @spriteset.screen_target(0, 0, 1)
  1395.       end
  1396.       @active_actor.current_action.clear
  1397.       command_delete
  1398.       # 次のアクターのコマンド入力へ
  1399.       phase3_next_actor
  1400.       return
  1401.     end
  1402.     # エネミーアローを更新
  1403.     @enemy_arrow.update
  1404.     # B ボタンが押された場合
  1405.     if Input.trigger?(Input::B)
  1406.       # キャンセル SE を演奏
  1407.       $game_system.se_play($data_system.cancel_se)
  1408.       # カメラを元に戻す
  1409.       if @camera == "select"
  1410.         # カメラの設定
  1411.         @camera = "command"
  1412.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1413.         y = [(plus.abs - 1.5) * 10 , 0].min
  1414.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1415.       end
  1416.       # エネミーの選択を終了
  1417.       end_enemy_select
  1418.       return
  1419.     end
  1420.     # C ボタンが押された場合
  1421.     if Input.trigger?(Input::C)
  1422.       # 決定 SE を演奏
  1423.       $game_system.se_play($data_system.decision_se)
  1424.       # アクションを設定
  1425.       @active_actor.current_action.kind = 0
  1426.       @active_actor.current_action.basic = 0
  1427.       @active_actor.current_action.target_index = @enemy_arrow.index
  1428.       # スキルウィンドウ表示中の場合
  1429.       if @skill_window != nil
  1430.         # アクションを再設定
  1431.         @active_actor.current_action.kind = 1
  1432.         # スキルの選択を終了
  1433.         end_skill_select
  1434.       end
  1435.       # アイテムウィンドウ表示中の場合
  1436.       if @item_window != nil
  1437.         # アクションを再設定
  1438.         @active_actor.current_action.kind = 2
  1439.         # アイテムの選択を終了
  1440.         end_item_select
  1441.       end
  1442.       # エネミーの選択を終了
  1443.       end_enemy_select
  1444.       # 次のアクターのコマンド入力へ
  1445.       phase3_next_actor
  1446.     end
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1450.   #--------------------------------------------------------------------------
  1451.   def update_phase3_actor_select
  1452.     # コマンド選択中に行動不能になった場合
  1453.     unless @active_actor.inputable?
  1454.       @active_actor.current_action.clear
  1455.       command_delete
  1456.       # 次のアクターのコマンド入力へ
  1457.       phase3_next_actor
  1458.       return
  1459.     end
  1460.     # アクターアローを更新
  1461.     @actor_arrow.update
  1462.     # B ボタンが押された場合
  1463.     if Input.trigger?(Input::B)
  1464.       # キャンセル SE を演奏
  1465.       $game_system.se_play($data_system.cancel_se)
  1466.       # アクターの選択を終了
  1467.       end_actor_select
  1468.       return
  1469.     end
  1470.     # C ボタンが押された場合
  1471.     if Input.trigger?(Input::C)
  1472.       # 決定 SE を演奏
  1473.       $game_system.se_play($data_system.decision_se)
  1474.       # アクションを設定
  1475.       @active_actor.current_action.kind = 0
  1476.       @active_actor.current_action.basic = 0
  1477.       @active_actor.current_action.target_index = @actor_arrow.index
  1478.       # アクターの選択を終了
  1479.       end_actor_select
  1480.       # スキルウィンドウ表示中の場合
  1481.       if @skill_window != nil
  1482.         # アクションを再設定
  1483.         @active_actor.current_action.kind = 1
  1484.         # スキルの選択を終了
  1485.         end_skill_select
  1486.       end
  1487.       # アイテムウィンドウ表示中の場合
  1488.       if @item_window != nil
  1489.         # アクションを再設定
  1490.         @active_actor.current_action.kind = 2
  1491.         # アイテムの選択を終了
  1492.         end_item_select
  1493.       end
  1494.       # 次のアクターのコマンド入力へ
  1495.       phase3_next_actor
  1496.     end
  1497.   end
  1498.   #--------------------------------------------------------------------------
  1499.   # ● エネミー選択開始
  1500.   #--------------------------------------------------------------------------
  1501.   alias :start_enemy_select_rtab :start_enemy_select
  1502.   def start_enemy_select
  1503.     @camera = "select"
  1504.     for enemy in $game_troop.enemies
  1505.       if enemy.exist?
  1506.         zoom = 1 / enemy.zoom
  1507.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1508.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1509.         break
  1510.       end
  1511.     end
  1512.     # オリジナルの処理
  1513.     start_enemy_select_rtab
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # ● エネミー選択終了
  1517.   #--------------------------------------------------------------------------
  1518.   alias :end_enemy_select_rtab :end_enemy_select
  1519.   def end_enemy_select
  1520.     # オリジナルの処理
  1521.     end_enemy_select_rtab
  1522.     if (@action == 0 and not @action_battlers.empty?) or
  1523.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1524.                                             @active_actor.animation1_id != 0))
  1525.       @spriteset.screen_target(0, 0, 1)
  1526.     end
  1527.   end
  1528.   #--------------------------------------------------------------------------
  1529.   # ● スキル選択開始
  1530.   #--------------------------------------------------------------------------
  1531.   def start_skill_select
  1532.     # スキルウィンドウを作成
  1533.     @skill_window = Window_Skill.new(@active_actor)
  1534.     # ヘルプウィンドウを関連付け
  1535.     @skill_window.help_window = @help_window
  1536.     # アクターコマンドウィンドウを無効化
  1537.     @actor_command_window.active = false
  1538.     @actor_command_window.visible = false
  1539.   end
  1540.  
  1541. #==============================================================================
  1542. # ■ Scene_Battle (分割定義 4)
  1543. #------------------------------------------------------------------------------
  1544. #  バトル画面の処理を行うクラスです。
  1545. #==============================================================================
  1546.  
  1547.   #--------------------------------------------------------------------------
  1548.   # ● メインフェーズ開始
  1549.   #--------------------------------------------------------------------------
  1550.   def start_phase4
  1551.     $game_temp.battle_main_phase = true
  1552.   end
  1553.   #--------------------------------------------------------------------------
  1554.   # ● フレーム更新 (メインフェーズ)
  1555.   #--------------------------------------------------------------------------
  1556.   def update_phase4
  1557.     # アクションを強制されているバトラーが存在する場合
  1558.     if $game_temp.forcing_battler != nil
  1559.       battler = $game_temp.forcing_battler
  1560.       if battler.current_action.forcing == false
  1561.         if @action_battlers.include?(battler)
  1562.           if @action > 0 or @action_battlers[0].phase == 1
  1563.             @action_battlers.delete(battler)
  1564.             @action_battlers.push(battler)
  1565.           end
  1566.           if battler.phase == 1
  1567.             battler.current_action.forcing = true
  1568.             force_action(battler)
  1569.           end
  1570.         else
  1571.           battler.current_action.forcing = true
  1572.           force_action(battler)
  1573.           action_start(battler)
  1574.           @action_battlers.delete(battler)
  1575.           @action_battlers.push(battler)
  1576.         end
  1577.         battler.at = @max
  1578.         battler.atp = 100 * battler.at / @max
  1579.       end
  1580.     end
  1581.     # action が1以上の場合、一斉に行動を起こす
  1582.     for battler in @action_battlers.reverse
  1583.       # ウェイト中の場合
  1584.       if battler.wait > 0
  1585.         # ウェイトカウントを減らす
  1586.         battler.wait -= 1
  1587.         break if @action == 0
  1588.         next
  1589.       end
  1590.       unless fin? and battler.phase < 3 and
  1591.           not $game_system.battle_interpreter.running?
  1592.         action_phase(battler)
  1593.       end
  1594.       break if @action == 0
  1595.     end
  1596.     # アクションを強制されているバトラーが存在しない場合
  1597.     if $game_temp.forcing_battler == nil
  1598.       # バトルイベントをセットアップ
  1599.       setup_battle_event
  1600.       # バトルイベント実行中の場合
  1601.       if $game_system.battle_interpreter.running?
  1602.         return
  1603.       end
  1604.     end
  1605.     # 勝敗を決した際の処理
  1606.     if fin?
  1607.       # 敗北時、指定時間ウェイト
  1608.       if $game_party.all_dead? and @after_wait[0] > 0
  1609.         @after_wait[0] -= 1
  1610.         return
  1611.       end
  1612.       # 勝利時、指定時間ウェイト
  1613.       if victory? and @after_wait[1] > 0
  1614.         @after_wait[1] -= 1
  1615.         return
  1616.       end
  1617.       # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1618.       for battler in @action_battlers.reverse
  1619.         if battler.phase < 3 and not $game_system.battle_interpreter.running?
  1620.           @action_battlers.delete(battler)
  1621.         end
  1622.       end
  1623.       # 勝敗判定
  1624.       if @action_battlers.empty? and
  1625.           not $game_system.battle_interpreter.running?
  1626.         judge
  1627.       end
  1628.     end
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # ● アクション更新 (メインフェーズ)
  1632.   #--------------------------------------------------------------------------
  1633.   def action_phase(battler)
  1634.     # action が 1 の場合、バトラーが行動中かどうか確認
  1635.     if @action == 1 and battler.phase <= 3
  1636.       for target in battler.target
  1637.         speller = synthe?(target)
  1638.         if speller == nil
  1639.           # ターゲットが通常行動中の場合
  1640.           if @action_battlers.include?(target)
  1641.             if target.phase > 2
  1642.               return
  1643.             end
  1644.           end
  1645.         else
  1646.           # ターゲットが連携スキル発動中の場合
  1647.           for spell in speller
  1648.             if @action_battlers.include?(spell)
  1649.               if spell.phase > 2
  1650.                 return
  1651.               end
  1652.             end
  1653.           end
  1654.         end
  1655.       end
  1656.     end
  1657.     case battler.phase
  1658.     when 1
  1659.       update_phase4_step1(battler)
  1660.     when 2
  1661.       update_phase4_step2(battler)
  1662.     when 3
  1663.       update_phase4_step3(battler)
  1664.     when 4
  1665.       update_phase4_step4(battler)
  1666.     when 5
  1667.       update_phase4_step5(battler)
  1668.     when 6
  1669.       update_phase4_step6(battler)
  1670.     end
  1671.   end
  1672.   #--------------------------------------------------------------------------
  1673.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1674.   #--------------------------------------------------------------------------
  1675.   def update_phase4_step1(battler)
  1676.     # すでに戦闘から外されている場合
  1677.     if battler.index == nil
  1678.       @action_battlers.delete(battler)
  1679.       anime_wait_return
  1680.       return
  1681.     end
  1682.     speller = synthe?(battler)
  1683.     if speller == nil
  1684.       # ダメージ食らい中の場合
  1685.       unless battler.damage.empty? or @action > 2
  1686.         return
  1687.       end
  1688.       # 行動可能かどうか判定
  1689.       unless battler.movable?
  1690.         battler.phase = 6
  1691.         return
  1692.       end
  1693.     else
  1694.       # ダメージ食らい中の場合
  1695.       for spell in speller
  1696.         unless spell.damage.empty? or @action > 2
  1697.           return
  1698.         end
  1699.         # 行動可能かどうか判定
  1700.         unless spell.movable?
  1701.           battler.phase = 6
  1702.           return
  1703.         end
  1704.       end
  1705.     end
  1706.     # スキル使用時、詠唱時間設定
  1707.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1708.     if battler.current_action.kind == 1 and
  1709.       (not battler.current_action.forcing or @force != 2)
  1710.       if battler.rtp == 0
  1711.         # スキル詠唱中ならば、解除
  1712.         skill_reset(battler)
  1713.         # スキル詠唱時間設定
  1714.         recite_time(battler)
  1715.         # 連携技設定
  1716.         synthe_spell(battler)
  1717.         # スキルを詠唱する場合
  1718.         if battler.rtp > 0
  1719.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1720.           speller = synthe?(battler)
  1721.           if battler.current_action.forcing and @force > 0 and speller != nil
  1722.             for spell in speller
  1723.               spell.rt = spell.rtp
  1724.             end
  1725.           else
  1726.             battler.blink = true
  1727.             if battler.current_action.forcing
  1728.               $game_temp.forcing_battler = nil
  1729.               battler.current_action.forcing = false
  1730.             end
  1731.             @action_battlers.delete(battler)
  1732.             return
  1733.           end
  1734.         end
  1735.       end
  1736.     end
  1737.     # アクターの明滅エフェクト OFF
  1738.     if battler != nil
  1739.       battler.blink = false
  1740.     end
  1741.     speller = synthe?(battler)
  1742.     if speller == nil
  1743.       @spell_p.delete(battler)
  1744.       @spell_e.delete(battler)
  1745.     else
  1746.       for spell in speller
  1747.         spell.blink = false
  1748.         @spell_p.delete(spell)
  1749.         @spell_e.delete(spell)
  1750.       end
  1751.     end
  1752.     # ステップ 2 に移行
  1753.     battler.phase = 2
  1754.   end
  1755.   #--------------------------------------------------------------------------
  1756.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1757.   #--------------------------------------------------------------------------
  1758.   def update_phase4_step2(battler)
  1759.     # 強制アクションでなければ
  1760.     unless battler.current_action.forcing
  1761.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1762.       if battler.restriction == 2 or battler.restriction == 3
  1763.         # アクションに攻撃を設定
  1764.         battler.current_action.kind = 0
  1765.         battler.current_action.basic = 0
  1766.       end
  1767.     end
  1768.     # アクションの種別で分岐
  1769.     case battler.current_action.kind
  1770.     when 0  # 基本
  1771.       if fin?
  1772.         battler.phase = 6
  1773.         return
  1774.       end
  1775.       make_basic_action_result(battler)
  1776.     when 1  # スキル
  1777.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1778.         battler.phase = 6
  1779.         return
  1780.       end
  1781.       make_skill_action_result(battler)
  1782.     when 2  # アイテム
  1783.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1784.         battler.phase = 6
  1785.         return
  1786.       end
  1787.       make_item_action_result(battler)
  1788.     end
  1789.     if battler.phase == 2
  1790.       # ステップ 3 に移行
  1791.       battler.phase = 3
  1792.     end
  1793.   end
  1794.   #--------------------------------------------------------------------------
  1795.   # ● 基本アクション 結果作成
  1796.   #--------------------------------------------------------------------------
  1797.   def make_basic_action_result(battler)
  1798.     # 攻撃の場合
  1799.     if battler.current_action.basic == 0
  1800.       # アニメーション ID を設定
  1801.       battler.anime1 = battler.animation1_id
  1802.       battler.anime2 = battler.animation2_id
  1803.       # 行動側バトラーがエネミーの場合
  1804.       if battler.is_a?(Game_Enemy)
  1805.         if battler.restriction == 3
  1806.           target = $game_troop.random_target_enemy
  1807.         elsif battler.restriction == 2
  1808.           target = $game_party.random_target_actor
  1809.         else
  1810.           index = battler.current_action.target_index
  1811.           target = $game_party.smooth_target_actor(index)
  1812.         end
  1813.       end
  1814.       # 行動側バトラーがアクターの場合
  1815.       if battler.is_a?(Game_Actor)
  1816.         if battler.restriction == 3
  1817.           target = $game_party.random_target_actor
  1818.         elsif battler.restriction == 2
  1819.           target = $game_troop.random_target_enemy
  1820.         else
  1821.           index = battler.current_action.target_index
  1822.           target = $game_troop.smooth_target_enemy(index)
  1823.         end
  1824.       end
  1825.       # 対象側バトラーの配列を設定
  1826.       battler.target = [target]
  1827.       # 通常攻撃の効果を適用
  1828.       for target in battler.target
  1829.         target.attack_effect(battler)
  1830.       end
  1831.       return
  1832.     end
  1833.     # 防御の場合
  1834.     if battler.current_action.basic == 1
  1835.       return
  1836.     end
  1837.     # 逃げるの場合
  1838. #    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1839.       # 逃げる
  1840. #      @help_window.set_text("逃げる", 1)
  1841. #      @help_wait = @help_time
  1842. #      battler.escape
  1843. #      return
  1844. #    end
  1845. #========RTAB 1.16=====================================================   
  1846.     # 逃げるの場合
  1847.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1848.       return
  1849.     end
  1850. #======================================================================
  1851.     # 何もしないの場合
  1852.     if battler.current_action.basic == 3
  1853.       # ステップ 6 に移行
  1854.       battler.phase = 6
  1855.       return
  1856.     end
  1857.   end
  1858.   #--------------------------------------------------------------------------
  1859.   # ● スキルまたはアイテムの対象側バトラー設定
  1860.   #     scope : スキルまたはアイテムの効果範囲
  1861.   #--------------------------------------------------------------------------
  1862.   def set_target_battlers(scope, battler)
  1863.     # 行動側バトラーがエネミーの場合
  1864.     if battler.is_a?(Game_Enemy)
  1865.       # 効果範囲で分岐
  1866.       case scope
  1867.       when 1  # 敵単体
  1868.         index =battler.current_action.target_index
  1869.         battler.target.push($game_party.smooth_target_actor(index))
  1870.       when 2  # 敵全体
  1871.         for actor in $game_party.actors
  1872.           if actor.exist?
  1873.             battler.target.push(actor)
  1874.           end
  1875.         end
  1876.       when 3  # 味方単体
  1877.         index = battler.current_action.target_index
  1878.         battler.target.push($game_troop.smooth_target_enemy(index))
  1879.       when 4  # 味方全体
  1880.         for enemy in $game_troop.enemies
  1881.           if enemy.exist?
  1882.             battler.target.push(enemy)
  1883.           end
  1884.         end
  1885.       when 5  # 味方単体 (HP 0)
  1886.         index = battler.current_action.target_index
  1887.         enemy = $game_troop.enemies[index]
  1888.         if enemy != nil and enemy.hp0?
  1889.           battler.target.push(enemy)
  1890.         end
  1891.       when 6  # 味方全体 (HP 0)
  1892.         for enemy in $game_troop.enemies
  1893.           if enemy != nil and enemy.hp0?
  1894.             battler.target.push(enemy)
  1895.           end
  1896.         end
  1897.       when 7  # 使用者
  1898.         battler.target.push(battler)
  1899.       end
  1900.     end
  1901.     # 行動側バトラーがアクターの場合
  1902.     if battler.is_a?(Game_Actor)
  1903.       # 効果範囲で分岐
  1904.       case scope
  1905.       when 1  # 敵単体
  1906.         index = battler.current_action.target_index
  1907.         battler.target.push($game_troop.smooth_target_enemy(index))
  1908.       when 2  # 敵全体
  1909.         for enemy in $game_troop.enemies
  1910.           if enemy.exist?
  1911.             battler.target.push(enemy)
  1912.           end
  1913.         end
  1914.       when 3  # 味方単体
  1915.         index = battler.current_action.target_index
  1916.         battler.target.push($game_party.smooth_target_actor(index))
  1917.       when 4  # 味方全体
  1918.         for actor in $game_party.actors
  1919.           if actor.exist?
  1920.             battler.target.push(actor)
  1921.           end
  1922.         end
  1923.       when 5  # 味方単体 (HP 0)
  1924.         index = battler.current_action.target_index
  1925.         actor = $game_party.actors[index]
  1926.         if actor != nil and actor.hp0?
  1927.           battler.target.push(actor)
  1928.         end
  1929.       when 6  # 味方全体 (HP 0)
  1930.         for actor in $game_party.actors
  1931.           if actor != nil and actor.hp0?
  1932.             battler.target.push(actor)
  1933.           end
  1934.         end
  1935.       when 7  # 使用者
  1936.         battler.target.push(battler)
  1937.       end
  1938.     end
  1939.   end
  1940.   #--------------------------------------------------------------------------
  1941.   # ● スキルアクション 結果作成
  1942.   #--------------------------------------------------------------------------
  1943.   def make_skill_action_result(battler)
  1944.     # スキルを取得
  1945.     @skill = $data_skills[battler.current_action.skill_id]
  1946.     # 連携スキルであるかどうか確認
  1947.     speller = synthe?(battler)
  1948.     # 強制アクションでなければ
  1949.     unless battler.current_action.forcing
  1950.       # SP 切れなどで使用できなくなった場合
  1951.       if speller == nil
  1952.         unless battler.skill_can_use?(@skill.id)
  1953.           # ステップ 6 に移行
  1954.           battler.phase = 6
  1955.          return
  1956.         end
  1957.       end
  1958.     end
  1959.     # SP 消費
  1960.     temp = false
  1961.     if speller != nil
  1962.       for spell in speller
  1963.         if spell.current_action.spell_id == 0
  1964.           spell.sp -= @skill.sp_cost
  1965.         else
  1966.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1967.         end
  1968.         # ステータスウィンドウをリフレッシュ
  1969.         status_refresh(spell)
  1970.       end
  1971.     else
  1972.       battler.sp -= @skill.sp_cost
  1973.       # ステータスウィンドウをリフレッシュ
  1974.       status_refresh(battler)
  1975.     end
  1976.     # アニメーション ID を設定
  1977.     battler.anime1 = @skill.animation1_id
  1978.     battler.anime2 = @skill.animation2_id
  1979.     # コモンイベント ID を設定
  1980.     battler.event = @skill.common_event_id
  1981.     # 対象側バトラーを設定
  1982.     set_target_battlers(@skill.scope, battler)
  1983.     # スキルの効果を適用
  1984.     for target in battler.target
  1985.       if speller != nil
  1986.         damage = 0
  1987.         d_result = false
  1988.         effective = false
  1989.         state_p = []
  1990.         state_m = []
  1991.         for spell in speller
  1992.           if spell.current_action.spell_id != 0
  1993.             @skill = $data_skills[spell.current_action.spell_id]
  1994.           end
  1995.           effective |= target.skill_effect(spell, @skill)
  1996.           if target.damage[spell].class != String
  1997.             d_result = true
  1998.             damage += target.damage[spell]
  1999.           elsif effective
  2000.             effect = target.damage[spell]
  2001.           end
  2002.           state_p += target.state_p[spell]
  2003.           state_m += target.state_m[spell]
  2004.           target.damage.delete(spell)
  2005.           target.state_p.delete(spell)
  2006.           target.state_m.delete(spell)
  2007.         end
  2008.         if d_result
  2009.           target.damage[battler] = damage
  2010.         elsif effective
  2011.           target.damage[battler] = effect
  2012.         else
  2013.           target.damage[battler] = 0
  2014.         end
  2015.         target.state_p[battler] = state_p
  2016.         target.state_m[battler] = state_m
  2017.       else
  2018.         target.skill_effect(battler, @skill)
  2019.       end
  2020.     end
  2021.   end
  2022.   #--------------------------------------------------------------------------
  2023.   # ● アイテムアクション 結果作成
  2024.   #--------------------------------------------------------------------------
  2025.   def make_item_action_result(battler)
  2026.     # アイテムを取得
  2027.     @item = $data_items[battler.current_action.item_id]
  2028.     # アイテム切れなどで使用できなくなった場合
  2029.     unless $game_party.item_can_use?(@item.id)
  2030.       # ステップ 6 に移行
  2031.       battler.phase = 6
  2032.       return
  2033.     end
  2034.     # 消耗品の場合
  2035.     if @item.consumable
  2036.       # 使用したアイテムを 1 減らす
  2037.       $game_party.lose_item(@item.id, 1)
  2038.     end
  2039.     # アニメーション ID を設定
  2040.     battler.anime1 = @item.animation1_id
  2041.     battler.anime2 = @item.animation2_id
  2042.     # コモンイベント ID を設定
  2043.     battler.event = @item.common_event_id
  2044.     # 対象を決定
  2045.     index = battler.current_action.target_index
  2046.     target = $game_party.smooth_target_actor(index)
  2047.     # 対象側バトラーを設定
  2048.     set_target_battlers(@item.scope, battler)
  2049.     # アイテムの効果を適用
  2050.     for target in battler.target
  2051.       target.item_effect(@item, battler)
  2052.     end
  2053.   end
  2054.   #--------------------------------------------------------------------------
  2055.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2056.   #--------------------------------------------------------------------------
  2057.   def update_phase4_step3(battler)
  2058.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2059.     case battler.current_action.kind
  2060.     when 0  # 基本
  2061.       if battler.current_action.basic == 1
  2062.         @help_window.set_text($data_system.words.guard, 1)
  2063.         @help_wait = @help_time
  2064.       end
  2065. #========RTAB 1.16==================================      
  2066.       if battler.current_action.basic == 2
  2067.         # 逃げる
  2068.         @help_window.set_text("逃げる", 1)
  2069.         @help_wait = @help_time
  2070.         battler.escape
  2071.         battler.phase = 4
  2072.         return
  2073.       end
  2074. #===================================================        
  2075.     when 1  # スキル
  2076.       skill =  $data_skills[battler.current_action.skill_id]
  2077.       @help_window.set_text(skill.name, 1)
  2078.       @help_wait = @help_time
  2079.     when 2  # アイテム
  2080.       item = $data_items[battler.current_action.item_id]
  2081.       @help_window.set_text(item.name, 1)
  2082.       @help_wait = @help_time
  2083.     end
  2084.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2085.     if battler.anime1 == 0
  2086.       battler.white_flash = true
  2087.       battler.wait = 5
  2088.       # カメラ設定
  2089.       if battler.target[0].is_a?(Game_Enemy)
  2090.         camera_set(battler)
  2091.       end
  2092.     else
  2093.       battler.animation.push([battler.anime1, true])
  2094.       speller = synthe?(battler)
  2095.       if speller != nil
  2096.         for spell in speller
  2097.           if spell != battler
  2098.             if spell.current_action.spell_id == 0
  2099.               spell.animation.push([battler.anime1, true])
  2100.             else
  2101.               skill = spell.current_action.spell_id
  2102.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2103.               spell.current_action.spell_id = 0
  2104.             end
  2105.           end
  2106.         end
  2107.       end
  2108.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2109.     end
  2110.     # ステップ 4 に移行
  2111.     battler.phase = 4
  2112.   end
  2113.   #--------------------------------------------------------------------------
  2114.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2115.   #--------------------------------------------------------------------------
  2116.   def update_phase4_step4(battler)
  2117.     # カメラ設定
  2118.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2119.        camera_set(battler)
  2120.     end
  2121.     # 対象側アニメーション
  2122.     for target in battler.target
  2123.       target.animation.push([battler.anime2,
  2124.                                           (target.damage[battler] != "Miss")])
  2125.       unless battler.anime2 == 0
  2126.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2127.       end
  2128.     end
  2129.     # ステップ 5 に移行
  2130.     battler.phase = 5
  2131.   end
  2132.   #--------------------------------------------------------------------------
  2133.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2134.   #--------------------------------------------------------------------------
  2135.   def update_phase4_step5(battler)
  2136.     # ダメージ表示
  2137.     for target in battler.target
  2138.       if target.damage[battler] != nil
  2139.         target.damage_pop[battler] = true
  2140.         target.damage_effect(battler, battler.current_action.kind)
  2141.         battler.wait = @damage_wait
  2142.         # ステータスウィンドウをリフレッシュ
  2143.         status_refresh(target)
  2144.       end
  2145.     end
  2146.     # ステップ 6 に移行
  2147.     battler.phase = 6
  2148.   end
  2149.   #--------------------------------------------------------------------------
  2150.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2151.   #--------------------------------------------------------------------------
  2152.   def update_phase4_step6(battler)
  2153.     # カメラを戻す
  2154.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2155.       @spriteset.screen_target(0, 0, 1)
  2156.     end
  2157.     # スキルラーニング
  2158.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2159.       for target in battler.target
  2160.         skill_learning(target, target.class_id,
  2161.                         battler.current_action.skill_id)
  2162.       end
  2163.     end
  2164.     # アクション強制対象のバトラーをクリア
  2165.     if battler.current_action.forcing == true and
  2166.         battler.current_action.force_kind == 0 and
  2167.         battler.current_action.force_basic == 0 and
  2168.         battler.current_action.force_skill_id == 0
  2169.       $game_temp.forcing_battler = nil
  2170.       battler.current_action.forcing = false
  2171.     end
  2172.     refresh_phase(battler)
  2173.     speller = synthe?(battler)
  2174.     if speller != nil
  2175.       for spell in speller
  2176.         if spell != battler
  2177.           refresh_phase(spell)
  2178.         end
  2179.       end
  2180.       synthe_delete(speller)
  2181.     end
  2182.     # コモンイベント ID が有効の場合
  2183.     if battler.event > 0
  2184.       # イベントをセットアップ
  2185.       common_event = $data_common_events[battler.event]
  2186.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2187.     end
  2188.     act = 0
  2189.     for actor in $game_party.actors + $game_troop.enemies
  2190.       if actor.movable?
  2191.         act += 1
  2192.       end
  2193.     end
  2194.     if @turn_cnt >= act and act > 0
  2195.       @turn_cnt %= act
  2196.       $game_temp.battle_turn += 1
  2197.       # バトルイベントの全ページを検索
  2198.       for index in 0...$data_troops[@troop_id].pages.size
  2199.         # イベントページを取得
  2200.         page = $data_troops[@troop_id].pages[index]
  2201.         # このページのスパンが [ターン] の場合
  2202.         if page.span == 1
  2203.           # 実行済みフラグをクリア
  2204.           $game_temp.battle_event_flags[index] = false
  2205.         end
  2206.       end
  2207.     end
  2208.     battler.phase = 1
  2209.     @action_battlers.delete(battler)
  2210.   end
  2211.   #--------------------------------------------------------------------------
  2212.   # ● リフレッシュ
  2213.   #--------------------------------------------------------------------------
  2214.   def refresh_phase(battler)
  2215.     battler.at -= @max
  2216.     if battler.movable?
  2217.       battler.atp = 100 * battler.at / @max
  2218.     end
  2219.     spell_reset(battler)
  2220.     # スリップダメージ
  2221.     if battler.hp > 0 and battler.slip_damage?
  2222.       battler.slip_damage_effect
  2223.       battler.damage_pop["slip"] = true
  2224.     end
  2225.     # ステート自然解除
  2226.     battler.remove_states_auto
  2227.     # ステータスウィンドウをリフレッシュ
  2228.     status_refresh(battler, true)
  2229.     unless battler.movable?
  2230.       return
  2231.     end
  2232.     # ターン数カウント
  2233.     @turn_cnt += 1
  2234.   end
  2235.   #--------------------------------------------------------------------------
  2236.   # ● バトラーアクションスタート
  2237.   #--------------------------------------------------------------------------
  2238.   def action_start(battler)
  2239.     battler.phase = 1
  2240.     battler.anime1 = 0
  2241.     battler.anime2 = 0
  2242.     battler.target = []
  2243.     battler.event = 0
  2244.     @action_battlers.unshift(battler)
  2245.   end
  2246.   #--------------------------------------------------------------------------
  2247.   # ● ステータスウィンドウをリフレッシュ
  2248.   #--------------------------------------------------------------------------
  2249.   def status_refresh(battler, at = false)
  2250.     if battler.is_a?(Game_Actor)
  2251.       for i in 0...$game_party.actors.size
  2252.         if battler == $game_party.actors[i]
  2253.           number = i + 1
  2254.         end
  2255.       end
  2256.       @status_window.refresh(number)
  2257.       if at == true
  2258.         @status_window.at_refresh(number)
  2259.       end
  2260.     end
  2261.   end
  2262.   #--------------------------------------------------------------------------
  2263.   # ● アニメウェイト判断処理
  2264.   #--------------------------------------------------------------------------
  2265.   def anime_wait_return
  2266.     if (@action_battlers.empty? or @anime_wait == false) and
  2267.         not $game_system.battle_interpreter.running?
  2268.       # エネミーアローが有効の場合
  2269.       if @enemy_arrow != nil
  2270.         return [@active - 2, 0].min == 0
  2271.       # アクターアローが有効の場合
  2272.       elsif @actor_arrow != nil
  2273.         return [@active - 2, 0].min == 0
  2274.       # スキルウィンドウが有効の場合
  2275.       elsif @skill_window != nil
  2276.         return [@active - 3, 0].min == 0
  2277.       # アイテムウィンドウが有効の場合
  2278.       elsif @item_window != nil
  2279.         return [@active - 3, 0].min == 0
  2280.       # アクターコマンドウィンドウが有効の場合
  2281.       elsif @actor_command_window.active
  2282.         return [@active - 1, 0].min == 0
  2283.       else
  2284.         return true
  2285.       end
  2286.     else
  2287.       return false
  2288.     end
  2289.   end
  2290.   #--------------------------------------------------------------------------
  2291.   # ● アクターコマンド消去判断
  2292.   #--------------------------------------------------------------------------
  2293.   def command_delete
  2294.     # エネミーアローが有効の場合
  2295.     if @enemy_arrow != nil
  2296.       end_enemy_select
  2297.     # アクターアローが有効の場合
  2298.     elsif @actor_arrow != nil
  2299.       end_actor_select
  2300.     end
  2301.     # スキルウィンドウが有効の場合
  2302.     if @skill_window != nil
  2303.       end_skill_select
  2304.     # アイテムウィンドウが有効の場合
  2305.     elsif @item_window != nil
  2306.       end_item_select
  2307.     end
  2308.     # アクターコマンドウィンドウが有効の場合
  2309.     if @actor_command_window.active
  2310.       @command.shift
  2311.       @command_a = false
  2312.       # メインフェーズフラグをセット
  2313.       $game_temp.battle_main_phase = true
  2314.       # アクターコマンドウィンドウを無効化
  2315.       @actor_command_window.active = false
  2316.       @actor_command_window.visible = false
  2317.       # アクターの明滅エフェクト OFF
  2318.       if @active_actor != nil
  2319.         @active_actor.blink = false
  2320.       end
  2321.     end
  2322.   end
  2323.   #--------------------------------------------------------------------------
  2324.   # ● 強制アクション設定
  2325.   #--------------------------------------------------------------------------
  2326.   def force_action(battler)
  2327.     battler.current_action.kind = battler.current_action.force_kind
  2328.     battler.current_action.basic = battler.current_action.force_basic
  2329.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2330.     battler.current_action.force_kind = 0
  2331.     battler.current_action.force_basic = 0
  2332.     battler.current_action.force_skill_id = 0
  2333.   end
  2334.   #--------------------------------------------------------------------------
  2335.   # ● カメラセット
  2336.   #--------------------------------------------------------------------------
  2337.   def camera_set(battler)
  2338.     @camera = battler
  2339.     if battler.target.size == 1
  2340.       if battler.current_action.kind == 0
  2341.         zoom = 1.2 / battler.target[0].zoom
  2342.       elsif synthe?(battler) == nil
  2343.         zoom = 1.5 / battler.target[0].zoom
  2344.       else
  2345.         zoom = 2.0 / battler.target[0].zoom
  2346.       end
  2347.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2348.                                 battler.target[0].attack_y(zoom), zoom)
  2349.     else
  2350.       @spriteset.screen_target(0, 0, 0.75)
  2351.     end
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # ● スキル詠唱タイム作成
  2355.   #--------------------------------------------------------------------------
  2356.   def recite_time(battler)
  2357.   end
  2358.   #--------------------------------------------------------------------------
  2359.   # ● 連携スキル判別
  2360.   #--------------------------------------------------------------------------
  2361.   def synthe_spell(battler)
  2362.   end
  2363.   #--------------------------------------------------------------------------
  2364.   # ● スキルラーニングシステム
  2365.   #--------------------------------------------------------------------------
  2366.   def skill_learning(actor, class_id, skill_id)
  2367.   end
  2368.   #--------------------------------------------------------------------------
  2369.   # ● 行動可能判定
  2370.   #--------------------------------------------------------------------------
  2371.   def active?(battler)
  2372.     speller = synthe?(battler)
  2373.     if speller != nil
  2374.       if synthe_delete?(speller)
  2375.         return false
  2376.       end
  2377.     else
  2378.       unless battler.inputable?
  2379.         spell_reset(battler)
  2380.         unless battler.movable?
  2381.           battler.atp = 0
  2382.           return false
  2383.         end
  2384.       end
  2385.       if battler.current_action.forcing
  2386.         spell_reset(battler)
  2387.       end
  2388.     end
  2389.     return true
  2390.   end
  2391.   #--------------------------------------------------------------------------
  2392.   # ● 合成スキル詠唱中か?
  2393.   #--------------------------------------------------------------------------
  2394.   def synthe?(battler)
  2395.     for speller in @synthe
  2396.       if speller.include?(battler)
  2397.         return speller
  2398.       end
  2399.     end
  2400.     return nil
  2401.   end
  2402.   #--------------------------------------------------------------------------
  2403.   # ● 合成スキル消去判断
  2404.   #--------------------------------------------------------------------------
  2405.   def synthe_delete?(speller)
  2406.     for battler in speller
  2407.       if not battler.inputable? and dead_ok?(battler)
  2408.         synthe_delete(speller)
  2409.         return true
  2410.       end
  2411.     end
  2412.     return false
  2413.   end
  2414.   #--------------------------------------------------------------------------
  2415.   # ● 合成スキル消去
  2416.   #--------------------------------------------------------------------------
  2417.   def synthe_delete(speller)
  2418.     for battler in speller
  2419.       spell_reset(battler)
  2420.       if dead_ok?(battler)
  2421.         @action_battlers.delete(battler)
  2422.       end
  2423.     end
  2424.     @synthe.delete(speller)
  2425.   end
  2426.   #--------------------------------------------------------------------------
  2427.   # ● 連携含むスキル詠唱解除
  2428.   #--------------------------------------------------------------------------
  2429.   def skill_reset(battler)
  2430.     speller = synthe?(battler)
  2431.     if speller != nil
  2432.       synthe_delete(speller)
  2433.     else
  2434.       spell_reset(battler)
  2435.     end
  2436.   end
  2437.   #--------------------------------------------------------------------------
  2438.   # ● スキル詠唱解除
  2439.   #--------------------------------------------------------------------------
  2440.   def spell_reset(battler)
  2441.     battler.rt = 0
  2442.     battler.rtp = 0
  2443.     battler.blink = false
  2444.     battler.spell = false
  2445.     battler.current_action.spell_id = 0
  2446.     @spell_p.delete(battler)
  2447.     @spell_e.delete(battler)
  2448.   end
  2449.   #--------------------------------------------------------------------------
  2450.   # ● 戦闘終了判定
  2451.   #--------------------------------------------------------------------------
  2452.   def fin?
  2453.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2454.   end
  2455.   #--------------------------------------------------------------------------
  2456.   # ● 敵全滅判定
  2457.   #--------------------------------------------------------------------------
  2458.   def victory?
  2459.     for battler in $game_troop.enemies
  2460.       if not battler.hidden and (battler.rest_hp > 0 or
  2461.           battler.immortal or battler.damage_pop.size > 0)
  2462.         return false
  2463.       end
  2464.     end
  2465.     return true
  2466.   end
  2467.   #--------------------------------------------------------------------------
  2468.   # ● 死亡許可判定
  2469.   #--------------------------------------------------------------------------
  2470.   def dead_ok?(battler)
  2471.     speller = synthe?(battler)
  2472.     if speller == nil
  2473.       if @action_battlers.include?(battler)
  2474.         if battler.phase > 2
  2475.           return false
  2476.         end
  2477.       end
  2478.     else
  2479.       for battler in speller
  2480.         if @action_battlers.include?(battler)
  2481.           if battler.phase > 2
  2482.             return false
  2483.           end
  2484.         end
  2485.       end
  2486.     end
  2487.     return true
  2488.   end
  2489. end
  2490.  
  2491. #==============================================================================
  2492. # ■ Game_Actor
  2493. #------------------------------------------------------------------------------
  2494. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2495. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2496. #==============================================================================
  2497.  
  2498. class Game_Actor < Game_Battler
  2499.   #--------------------------------------------------------------------------
  2500.   # ● バトル画面 X 座標の取得
  2501.   #--------------------------------------------------------------------------
  2502.   def screen_x
  2503.     # パーティ内の並び順から X 座標を計算して返す
  2504.     if self.index != nil
  2505.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2506.     else
  2507.       return 0
  2508.     end
  2509.   end
  2510. end
  2511.  
  2512. #==============================================================================
  2513. # ■ Spriteset_Battle
  2514. #------------------------------------------------------------------------------
  2515. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2516. # スの内部で使用されます。
  2517. #==============================================================================
  2518.  
  2519. class Spriteset_Battle
  2520.   #--------------------------------------------------------------------------
  2521.   # ● 公開インスタンス変数
  2522.   #--------------------------------------------------------------------------
  2523.   attr_reader   :real_x                   # x座標補正(現在値)
  2524.   attr_reader   :real_y                   # y座標補正(現在値)
  2525.   attr_reader   :real_zoom                # 拡大率(現在値)
  2526.   #--------------------------------------------------------------------------
  2527.   # ● オブジェクト初期化
  2528.   #--------------------------------------------------------------------------
  2529.   def initialize
  2530.     # ビューポートを作成
  2531.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2532.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2533.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2534.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2535.     @viewport2.z = 101
  2536.     @viewport3.z = 200
  2537.     @viewport4.z = 5000
  2538.     @wait = 0
  2539.     @real_x = 0
  2540.     @real_y = 0
  2541.     @real_zoom = 1.0
  2542.     @target_x = 0
  2543.     @target_y = 0
  2544.     @target_zoom = 1.0
  2545.     @gap_x = 0
  2546.     @gap_y = 0
  2547.     @gap_zoom = 0.0
  2548.     # バトルバックスプライトを作成
  2549.     @battleback_sprite = Sprite.new(@viewport1)
  2550.     # エネミースプライトを作成
  2551.     @enemy_sprites = []
  2552.     for enemy in $game_troop.enemies.reverse
  2553.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2554.     end
  2555.     # アクタースプライトを作成
  2556.     @actor_sprites = []
  2557.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2558.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2559.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2560.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2561.     # 天候を作成
  2562.     @weather = RPG::Weather.new(@viewport1)
  2563.     # ピクチャスプライトを作成
  2564.     @picture_sprites = []
  2565.     for i in 51..100
  2566.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2567.         $game_screen.pictures[i]))
  2568.     end
  2569.     # タイマースプライトを作成
  2570.     @timer_sprite = Sprite_Timer.new
  2571.     # フレーム更新
  2572.     update
  2573.   end
  2574.   #--------------------------------------------------------------------------
  2575.   # ● フレーム更新
  2576.   #--------------------------------------------------------------------------
  2577.   def update
  2578.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2579.     @actor_sprites[0].battler = $game_party.actors[0]
  2580.     @actor_sprites[1].battler = $game_party.actors[1]
  2581.     @actor_sprites[2].battler = $game_party.actors[2]
  2582.     @actor_sprites[3].battler = $game_party.actors[3]
  2583.     # バトルバックのファイル名が現在のものと違う場合
  2584.     if @battleback_name != $game_temp.battleback_name
  2585.       make_battleback
  2586.     end
  2587.     # 画面のスクロール
  2588.     screen_scroll
  2589.     # モンスターの位置補正
  2590.     for enemy in $game_troop.enemies
  2591.       enemy.real_x = @real_x
  2592.       enemy.real_y = @real_y
  2593.       enemy.real_zoom = @real_zoom
  2594.     end
  2595.     # バトラースプライトを更新
  2596.     for sprite in @enemy_sprites + @actor_sprites
  2597.       sprite.update
  2598.     end
  2599.     # 天候グラフィックを更新
  2600.     @weather.type = $game_screen.weather_type
  2601.     @weather.max = $game_screen.weather_max
  2602.     @weather.update
  2603.     # ピクチャスプライトを更新
  2604.     for sprite in @picture_sprites
  2605.       sprite.update
  2606.     end
  2607.     # タイマースプライトを更新
  2608.     @timer_sprite.update
  2609.     # 画面の色調とシェイク位置を設定
  2610.     @viewport1.tone = $game_screen.tone
  2611.     @viewport1.ox = $game_screen.shake
  2612.     # 画面のフラッシュ色を設定
  2613.     @viewport4.color = $game_screen.flash_color
  2614.     # ビューポートを更新
  2615.     @viewport1.update
  2616.     @viewport2.update
  2617.     @viewport4.update
  2618.   end
  2619.   #--------------------------------------------------------------------------
  2620.   # ● バトル背景の設定
  2621.   #--------------------------------------------------------------------------
  2622.   def make_battleback
  2623.     @battleback_name = $game_temp.battleback_name
  2624.     if @battleback_sprite.bitmap != nil
  2625.       @battleback_sprite.bitmap.dispose
  2626.     end
  2627.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2628.     if @battleback_sprite.bitmap.width == 640 and
  2629.        @battleback_sprite.bitmap.height == 320
  2630.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2631.       @base_zoom = 2.0
  2632.       @battleback_sprite.zoom_x = @base_zoom
  2633.       @battleback_sprite.zoom_y = @base_zoom
  2634.       @real_y = 4
  2635.       @battleback_sprite.x = 320
  2636.       @battleback_sprite.y = @real_y
  2637.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2638.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2639.     elsif @battleback_sprite.bitmap.width == 640 and
  2640.           @battleback_sprite.bitmap.height == 480
  2641.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2642.       @base_zoom = 1.5
  2643.       @battleback_sprite.zoom_x = @base_zoom
  2644.       @battleback_sprite.zoom_y = @base_zoom
  2645.       @battleback_sprite.x = 320
  2646.       @battleback_sprite.y = 0
  2647.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2648.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2649.     else
  2650.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2651.                                       @battleback_sprite.bitmap.height)
  2652.       @base_zoom = 1.0
  2653.       @battleback_sprite.zoom_x = @base_zoom
  2654.       @battleback_sprite.zoom_y = @base_zoom
  2655.       @battleback_sprite.x = 320
  2656.       @battleback_sprite.y = 0
  2657.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2658.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2659.     end
  2660.   end
  2661.   #--------------------------------------------------------------------------
  2662.   # ● 画面のスクロール目標の位置・拡大率設定
  2663.   #--------------------------------------------------------------------------
  2664.   def screen_target(x, y, zoom)
  2665.     return unless $scene.drive
  2666.     @wait = $scene.scroll_time
  2667.     @target_x = x
  2668.     @target_y = y
  2669.     @target_zoom = zoom
  2670.     screen_over
  2671.     @gap_x = @target_x - @real_x
  2672.     @gap_y = @target_y - @real_y
  2673.     @gap_zoom = @target_zoom - @real_zoom
  2674.   end
  2675.   #--------------------------------------------------------------------------
  2676.   # ● 画面のスクロール
  2677.   #--------------------------------------------------------------------------
  2678.   def screen_scroll
  2679.     if @wait > 0
  2680.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2681.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2682.       @real_zoom = @target_zoom -
  2683.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2684.       @battleback_sprite.x = 320 + @real_x
  2685.       @battleback_sprite.y = @real_y
  2686.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2687.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2688.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2689.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2690.       @wait -= 1
  2691.     end
  2692.   end
  2693.   #--------------------------------------------------------------------------
  2694.   # ● スクリーンが画面外に出た時の補正処理
  2695.   #--------------------------------------------------------------------------
  2696.   def screen_over
  2697.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2698.     unless 324 + @target_x > width and 324 - @target_x > width
  2699.       if 324 + @target_x > width
  2700.         @target_x = width - 324
  2701.       elsif 324 - @target_x > width
  2702.         @target_x = 324 - width
  2703.       end
  2704.     end
  2705.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2706.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2707.       if @target_y > height - 4
  2708.         @target_y = height - 4
  2709.       elsif 484 - @target_y > 3 * height
  2710.         @target_y = 484 - 3 * height
  2711.       end
  2712.     end
  2713.   end
  2714. end
  2715.  
  2716. #==============================================================================
  2717. # ■ Game_Battler (分割定義 1)
  2718. #------------------------------------------------------------------------------
  2719. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2720. # スのスーパークラスとして使用されます。
  2721. #==============================================================================
  2722.  
  2723. class Game_Battler
  2724.   #--------------------------------------------------------------------------
  2725.   # ● 公開インスタンス変数追加
  2726.   #--------------------------------------------------------------------------
  2727.   attr_accessor :up_level                  # レベルアップ数
  2728.   attr_accessor :at                        # AT(タイムゲージ)
  2729.   attr_accessor :atp                       # AT(表示用)
  2730.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2731.   attr_accessor :rtp                       # RP(詠唱必要量)
  2732.   attr_accessor :spell                     # 合成スキル発動中
  2733.   attr_accessor :recover_hp                # HP回復量
  2734.   attr_accessor :recover_sp                # SP回復量
  2735.   attr_accessor :state_p                   # ステータス異常配列
  2736.   attr_accessor :state_m                   # ステータス異常配列
  2737.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2738.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2739.   attr_accessor :phase
  2740.   attr_accessor :wait
  2741.   attr_accessor :target
  2742.   attr_accessor :anime1
  2743.   attr_accessor :anime2
  2744.   attr_accessor :event
  2745.   #--------------------------------------------------------------------------
  2746.   # ● オブジェクト初期化
  2747.   #--------------------------------------------------------------------------
  2748.   alias :initialize_rtab :initialize
  2749.   def initialize
  2750.     initialize_rtab
  2751.     @damage_pop = {}
  2752.     @damage = {}
  2753.     @damage_sp = {}
  2754.     @critical = {}
  2755.     @recover_hp = {}
  2756.     @recover_sp = {}
  2757.     @state_p = {}
  2758.     @state_m = {}
  2759.     @animation = []
  2760.     @phase = 1
  2761.     @wait = 0
  2762.     @target = []
  2763.     @anime1 = 0
  2764.     @anime2 = 0
  2765.     @event = 0
  2766.   end
  2767.   #--------------------------------------------------------------------------
  2768.   # ● 存在判定
  2769.   #--------------------------------------------------------------------------
  2770.   def exist?
  2771.     return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
  2772.   end
  2773.   #--------------------------------------------------------------------------
  2774.   # ● 残HP予測
  2775.   #--------------------------------------------------------------------------
  2776.   def rest_hp
  2777.     # rest_hp に現HPを代入
  2778.     rest_hp = @hp
  2779.     # バトラーが受ける全ダメージをrest_hpに反映させる
  2780.     for pre_damage in @damage
  2781.       if pre_damage[1].is_a?(Numeric)
  2782.         rest_hp -= pre_damage[1]
  2783.       end
  2784.     end
  2785.     return rest_hp
  2786.   end
  2787.   #--------------------------------------------------------------------------
  2788.   # ● ステートの解除
  2789.   #     state_id : ステート ID
  2790.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2791.   #--------------------------------------------------------------------------
  2792.   def remove_state(state_id, force = false)
  2793.     # このステートが付加されている場合
  2794.     if state?(state_id)
  2795.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2796.       if @states_turn[state_id] == -1 and not force
  2797.         # メソッド終了
  2798.         return
  2799.       end
  2800.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2801.       if @hp == 0 and $data_states[state_id].zero_hp
  2802.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2803.         zero_hp = false
  2804.         for i in @states
  2805.           if i != state_id and $data_states[i].zero_hp
  2806.             zero_hp = true
  2807.           end
  2808.         end
  2809.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2810.         if zero_hp == false
  2811.           @hp = 1
  2812.         end
  2813.       end
  2814.       unless self.movable?
  2815.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2816.         @states.delete(state_id)
  2817.         @states_turn.delete(state_id)
  2818.         if self.movable?
  2819.           self.at = 0
  2820.         end
  2821.       else
  2822.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2823.         @states.delete(state_id)
  2824.         @states_turn.delete(state_id)
  2825.       end
  2826.     end
  2827.     # HP および SP の最大値チェック
  2828.     @hp = [@hp, self.maxhp].min
  2829.     @sp = [@sp, self.maxsp].min
  2830.   end
  2831.   #--------------------------------------------------------------------------
  2832.   # ● 通常攻撃の効果適用
  2833.   #     attacker : 攻撃者 (バトラー)
  2834.   #--------------------------------------------------------------------------
  2835.   def attack_effect(attacker)
  2836.     # クリティカルフラグをクリア
  2837.     self.critical[attacker] = false
  2838.     state_p[attacker] = []
  2839.     state_m[attacker] = []
  2840.     # 第一命中判定
  2841.     hit_result = (rand(100) < attacker.hit)
  2842.     # 命中の場合
  2843.     if hit_result == true
  2844.       # 基本ダメージを計算
  2845.       atk = [attacker.atk - self.pdef / 2, 0].max
  2846.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2847.       # 属性修正
  2848.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2849.       self.damage[attacker] /= 100
  2850.       # ダメージの符号が正の場合
  2851.       if self.damage[attacker] > 0
  2852.         # クリティカル修正
  2853.         if rand(100) < 4 * attacker.dex / self.agi
  2854.           self.damage[attacker] *= 2
  2855.           self.critical[attacker] = true
  2856.         end
  2857.         # 防御修正
  2858.         if self.guarding?
  2859.           self.damage[attacker] /= 2
  2860.         end
  2861.       end
  2862.       # 分散
  2863.       if self.damage[attacker].abs > 0
  2864.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2865.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2866.       end
  2867.       # 第二命中判定
  2868.       eva = 8 * self.agi / attacker.dex + self.eva
  2869.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2870.       hit = self.cant_evade? ? 100 : hit
  2871.       hit_result = (rand(100) < hit)
  2872.     end
  2873.     # 命中の場合
  2874.     if hit_result == true
  2875.       # ステート衝撃解除
  2876.       remove_states_shock
  2877.       # HP からダメージを減算
  2878.       # ステート変化
  2879.       @state_changed = false
  2880.       states_plus(attacker, attacker.plus_state_set)
  2881.       states_minus(attacker, attacker.minus_state_set)
  2882.     # ミスの場合
  2883.     else
  2884.       # ダメージに "Miss" を設定
  2885.       self.damage[attacker] = "Miss"
  2886.       # クリティカルフラグをクリア
  2887.       self.critical[attacker] = false
  2888.     end
  2889.     # メソッド終了
  2890.     return true
  2891.   end
  2892.   #--------------------------------------------------------------------------
  2893.   # ● スキルの効果適用
  2894.   #     user  : スキルの使用者 (バトラー)
  2895.   #     skill : スキル
  2896.   #--------------------------------------------------------------------------
  2897.   def skill_effect(user, skill)
  2898.     # クリティカルフラグをクリア
  2899.     self.critical[user] = false
  2900.     state_p[user] = []
  2901.     state_m[user] = []
  2902.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2903.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2904.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
  2905.   #     ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2906.       # メソッド終了
  2907.       return false
  2908.     end
  2909.     # 有効フラグをクリア
  2910.     effective = false
  2911.     # コモンイベント ID が有効の場合は有効フラグをセット
  2912.     effective |= skill.common_event_id > 0
  2913.     # 第一命中判定
  2914.     hit = skill.hit
  2915.     if skill.atk_f > 0
  2916.       hit *= user.hit / 100
  2917.     end
  2918.     hit_result = (rand(100) < hit)
  2919.     # 不確実なスキルの場合は有効フラグをセット
  2920.     effective |= hit < 100
  2921.     # 命中の場合
  2922.     if hit_result == true
  2923.       # 威力を計算
  2924.       power = skill.power + user.atk * skill.atk_f / 100
  2925.       if power > 0
  2926.         power -= self.pdef * skill.pdef_f / 200
  2927.         power -= self.mdef * skill.mdef_f / 200
  2928.         power = [power, 0].max
  2929.       end
  2930.       # 倍率を計算
  2931.       rate = 20
  2932.       rate += (user.str * skill.str_f / 100)
  2933.       rate += (user.dex * skill.dex_f / 100)
  2934.       rate += (user.agi * skill.agi_f / 100)
  2935.       rate += (user.int * skill.int_f / 100)
  2936.       # 基本ダメージを計算
  2937.       self.damage[user] = power * rate / 20
  2938.       # 属性修正
  2939.       self.damage[user] *= elements_correct(skill.element_set)
  2940.       self.damage[user] /= 100
  2941.       # ダメージの符号が正の場合
  2942.       if self.damage[user] > 0
  2943.         # 防御修正
  2944.         if self.guarding?
  2945.           self.damage[user] /= 2
  2946.         end
  2947.       end
  2948.       # 分散
  2949.       if skill.variance > 0 and self.damage[user].abs > 0
  2950.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  2951.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  2952.       end
  2953.       # 第二命中判定
  2954.       eva = 8 * self.agi / user.dex + self.eva
  2955.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  2956.       hit = self.cant_evade? ? 100 : hit
  2957.       hit_result = (rand(100) < hit)
  2958.       # 不確実なスキルの場合は有効フラグをセット
  2959.       effective |= hit < 100
  2960.     end
  2961.     # 命中の場合
  2962.     if hit_result == true
  2963.       # 威力 0 以外の物理攻撃の場合
  2964.       if skill.power != 0 and skill.atk_f > 0
  2965.         # ステート衝撃解除
  2966.         remove_states_shock
  2967.         # 有効フラグをセット
  2968.         effective = true
  2969.       end
  2970.       # HP の変動判定
  2971.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  2972.       # 効果判定
  2973.       effective |= self.hp != last_hp
  2974.       # ステート変化
  2975.       @state_changed = false
  2976.       effective |= states_plus(user, skill.plus_state_set)
  2977.       effective |= states_minus(user, skill.minus_state_set)
  2978.       unless $game_temp.in_battle
  2979.         self.damage_effect(user,1 )
  2980.       end
  2981.       # 威力が 0 の場合
  2982.       if skill.power == 0
  2983.         # ダメージに空文字列を設定
  2984.         self.damage[user] = ""
  2985.         # ステートに変化がない場合
  2986.         unless @state_changed
  2987.           # ダメージに "Miss" を設定
  2988.           self.damage[user] = "Miss"
  2989.         end
  2990.       end
  2991.     # ミスの場合
  2992.     else
  2993.       # ダメージに "Miss" を設定
  2994.       self.damage[user] = "Miss"
  2995.     end
  2996.     # 戦闘中でない場合
  2997.     unless $game_temp.in_battle
  2998.       # ダメージに nil を設定
  2999.       self.damage[user] = nil
  3000.     end
  3001.     # メソッド終了
  3002.     return effective
  3003.   end
  3004.   #--------------------------------------------------------------------------
  3005.   # ● アイテムの効果適用
  3006.   #     item : アイテム
  3007.   #--------------------------------------------------------------------------
  3008.   def item_effect(item, user = $game_party.actors[0])
  3009.     # クリティカルフラグをクリア
  3010.     self.critical[user] = false
  3011.     state_p[user] = []
  3012.     state_m[user] = []
  3013.     self.recover_hp[user] = 0
  3014.     self.recover_sp[user] = 0
  3015.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  3016.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  3017.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0)# or
  3018.     #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  3019.       # メソッド終了
  3020.       return false
  3021.     end
  3022.     # 有効フラグをクリア
  3023.     effective = false
  3024.     # コモンイベント ID が有効の場合は有効フラグをセット
  3025.     effective |= item.common_event_id > 0
  3026.     # 命中判定
  3027.     hit_result = (rand(100) < item.hit)
  3028.     # 不確実なスキルの場合は有効フラグをセット
  3029.     effective |= item.hit < 100
  3030.     # 命中の場合
  3031.     if hit_result == true
  3032.       # 回復量を計算
  3033.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  3034.                               item.recover_hp
  3035.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  3036.                               item.recover_sp
  3037.       if self.recover_hp[user] < 0
  3038.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  3039.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  3040.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  3041.       end
  3042.       # 属性修正
  3043.       self.recover_hp[user] *= elements_correct(item.element_set)
  3044.       self.recover_hp[user] /= 100
  3045.       self.recover_sp[user] *= elements_correct(item.element_set)
  3046.       self.recover_sp[user] /= 100
  3047.       # 分散
  3048.       if item.variance > 0 and self.recover_hp[user].abs > 0
  3049.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  3050.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  3051.       end
  3052.       if item.variance > 0 and self.recover_sp[user].abs > 0
  3053.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  3054.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  3055.       end
  3056.       # 回復量の符号が負の場合
  3057.       if self.recover_hp[user] < 0
  3058.         # 防御修正
  3059.         if self.guarding?
  3060.           self.recover_hp[user] /= 2
  3061.         end
  3062.       end
  3063.       # HP 回復量の符号を反転し、ダメージの値に設定
  3064.       self.damage[user] = -self.recover_hp[user]
  3065.       # HP および SP の変動判定
  3066.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  3067.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  3068.       effective |= self.hp != last_hp
  3069.       effective |= self.sp != last_sp
  3070.       # ステート変化
  3071.       @state_changed = false
  3072.       effective |= states_plus(user, item.plus_state_set)
  3073.       effective |= states_minus(user, item.minus_state_set)
  3074.       unless $game_temp.in_battle
  3075.         self.damage_effect(user, 2)
  3076.       end
  3077.       # パラメータ上昇値が有効の場合
  3078.       if item.parameter_type > 0 and item.parameter_points != 0
  3079.         # パラメータで分岐
  3080.         case item.parameter_type
  3081.         when 1  # MaxHP
  3082.           @maxhp_plus += item.parameter_points
  3083.         when 2  # MaxSP
  3084.           @maxsp_plus += item.parameter_points
  3085.         when 3  # 腕力
  3086.           @str_plus += item.parameter_points
  3087.         when 4  # 器用さ
  3088.           @dex_plus += item.parameter_points
  3089.         when 5  # 素早さ
  3090.           @agi_plus += item.parameter_points
  3091.         when 6  # 魔力
  3092.           @int_plus += item.parameter_points
  3093.         end
  3094.         # 有効フラグをセット
  3095.         effective = true
  3096.       end
  3097.       # HP 回復率と回復量が 0 の場合
  3098.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  3099.         # ダメージに空文字列を設定
  3100.         self.damage[user] = ""
  3101.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  3102.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  3103.            (item.parameter_type == 0 or item.parameter_points == 0)
  3104.           # ステートに変化がない場合
  3105.           unless @state_changed
  3106.             # ダメージに "Miss" を設定
  3107.             self.damage[user] = "Miss"
  3108.           end
  3109.         end
  3110.       end
  3111.     # ミスの場合
  3112.     else
  3113.       # ダメージに "Miss" を設定
  3114.       self.damage[user] = "Miss"
  3115.     end
  3116.     # 戦闘中でない場合
  3117.     unless $game_temp.in_battle
  3118.       # ダメージに nil を設定
  3119.       self.damage[user] = nil
  3120.     end
  3121.     # メソッド終了
  3122.     return effective
  3123.   end
  3124.   #--------------------------------------------------------------------------
  3125.   # ● ステート変化 (+) の適用
  3126.   #     plus_state_set  : ステート変化 (+)
  3127.   #--------------------------------------------------------------------------
  3128.   def states_plus(battler, plus_state_set)
  3129.     # 有効フラグをクリア
  3130.     effective = false
  3131.     # ループ (付加するステート)
  3132.     for i in plus_state_set
  3133.       # このステートが防御されていない場合
  3134.       unless self.state_guard?(i)
  3135.         # このステートがフルでなければ有効フラグをセット
  3136.         effective |= self.state_full?(i) == false
  3137.         # ステートが [抵抗しない] の場合
  3138.         if $data_states[i].nonresistance
  3139.           # ステート変化フラグをセット
  3140.           @state_changed = true
  3141.           # ステートを付加
  3142.           self.state_p[battler].push(i)
  3143.         # このステートがフルではない場合
  3144.         elsif self.state_full?(i) == false
  3145.           # ステート有効度を確率に変換し、乱数と比較
  3146.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  3147.             # ステート変化フラグをセット
  3148.             @state_changed = true
  3149.             # ステートを付加
  3150.             self.state_p[battler].push(i)
  3151.           end
  3152.         end
  3153.       end
  3154.     end
  3155.     # メソッド終了
  3156.     return effective
  3157.   end
  3158.   #--------------------------------------------------------------------------
  3159.   # ● ステート変化 (-) の適用
  3160.   #     minus_state_set : ステート変化 (-)
  3161.   #--------------------------------------------------------------------------
  3162.   def states_minus(battler, minus_state_set)
  3163.     # 有効フラグをクリア
  3164.     effective = false
  3165.     # ループ (解除するステート)
  3166.     for i in minus_state_set
  3167.       # このステートが付加されていれば有効フラグをセット
  3168.       effective |= self.state?(i)
  3169.       # ステート変化フラグをセット
  3170.       @state_changed = true
  3171.       # ステートを解除
  3172.       self.state_m[battler].push(i)
  3173.     end
  3174.     # メソッド終了
  3175.     return effective
  3176.   end
  3177.   #--------------------------------------------------------------------------
  3178.   # ● ダメージ演算
  3179.   #--------------------------------------------------------------------------
  3180.   def damage_effect(battler, item)
  3181.     if item == 2
  3182.       self.hp += self.recover_hp[battler]
  3183.       self.sp += self.recover_sp[battler]
  3184.       if self.recover_sp[battler] != 0
  3185.         self.damage_sp[battler] = -self.recover_sp[battler]
  3186.       end
  3187.       self.recover_hp.delete(battler)
  3188.       self.recover_sp.delete(battler)
  3189.     else
  3190.       if self.damage[battler].class != String
  3191.         self.hp -= self.damage[battler]
  3192.       end
  3193.     end
  3194.     for i in self.state_p[battler]
  3195.       add_state(i)
  3196.     end
  3197.     for i in self.state_m[battler]
  3198.       remove_state(i)
  3199.     end
  3200.   end
  3201.   #--------------------------------------------------------------------------
  3202.   # ● スリップダメージの効果適用
  3203.   #--------------------------------------------------------------------------
  3204. # 3=>毒
  3205. # 24=>回血
  3206. # 32=>烧伤
  3207. # 45=>回蓝
  3208. def slip_damage_effect
  3209.   hp_v = {3 => self.maxhp / 30, 24 => -self.hp / 20, 32 => self.maxhp / 10}
  3210.   sp_v = {45 => -self.maxsp / 20}
  3211.   hp_damage = 0
  3212.   sp_damage = 0
  3213.   hp_v.keys.each do |id|
  3214.     hp_damage += hp_v[id] if self.state?(id)
  3215.   end
  3216.   sp_v.keys.each do |id|
  3217.     sp_damage += sp_v[id] if self.state?(id)
  3218.   end
  3219.   self.damage["slip"] = hp_damage if hp_damage != 0
  3220.   self.hp -= hp_damage
  3221.   self.damage_sp["slip"] = sp_damage if sp_damage != 0
  3222.   self.sp -= sp_damage
  3223. end
  3224. end
  3225. #######################################
  3226. #==============================================================================
  3227. # ■ Game_BattleAction
  3228. #------------------------------------------------------------------------------
  3229. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3230. # スの内部で使用されます。
  3231. #==============================================================================
  3232.  
  3233. class Game_BattleAction
  3234.   #--------------------------------------------------------------------------
  3235.   # ● 公開インスタンス変数
  3236.   #--------------------------------------------------------------------------
  3237.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3238.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3239.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3240.   attr_accessor :force_skill_id           # スキル ID
  3241.   #--------------------------------------------------------------------------
  3242.   # ● 有効判定
  3243.   #--------------------------------------------------------------------------
  3244.   def valid?
  3245.     return (not (@force_kind == 0 and @force_basic == 3))
  3246.   end
  3247. end
  3248.  
  3249. #==============================================================================
  3250. # ■ Game_Actor
  3251. #------------------------------------------------------------------------------
  3252. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3253. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3254. #==============================================================================
  3255.  
  3256. class Game_Actor < Game_Battler
  3257.   def skill_can_use?(skill_id)
  3258.     return super
  3259.   end
  3260. end
  3261.  
  3262. #==============================================================================
  3263. # ■ Game_Enemy
  3264. #------------------------------------------------------------------------------
  3265. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3266. # 内部で使用されます。
  3267. #==============================================================================
  3268.  
  3269. class Game_Enemy < Game_Battler
  3270.   #--------------------------------------------------------------------------
  3271.   # ● 公開インスタンス変数
  3272.   #--------------------------------------------------------------------------
  3273.   attr_accessor :height                  # 画像の高さ
  3274.   attr_accessor :real_x                  # X座標補正
  3275.   attr_accessor :real_y                  # Y座標補正
  3276.   attr_accessor :real_zoom               # 拡大率
  3277.   #--------------------------------------------------------------------------
  3278.   # ● オブジェクト初期化
  3279.   #     troop_id     : トループ ID
  3280.   #     member_index : トループメンバーのインデックス
  3281.   #--------------------------------------------------------------------------
  3282.   def initialize(troop_id, member_index)
  3283.     super()
  3284.     @troop_id = troop_id
  3285.     @member_index = member_index
  3286.     troop = $data_troops[@troop_id]
  3287.     @enemy_id = troop.members[@member_index].enemy_id
  3288.     enemy = $data_enemies[@enemy_id]
  3289.     @battler_name = enemy.battler_name
  3290.     @battler_hue = enemy.battler_hue
  3291.     @hp = maxhp
  3292.     @sp = maxsp
  3293.     @real_x = 0
  3294.     @real_y = 0
  3295.     @real_zoom = 1.0
  3296.     @fly = 0
  3297.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3298.     @hidden = troop.members[@member_index].hidden
  3299.     @immortal = troop.members[@member_index].immortal
  3300.   end
  3301.   alias :true_x :screen_x
  3302.   alias :true_y :screen_y
  3303.   #--------------------------------------------------------------------------
  3304.   # ● バトル画面 X 座標の取得
  3305.   #--------------------------------------------------------------------------
  3306.   def screen_x
  3307.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3308.   end
  3309.   #--------------------------------------------------------------------------
  3310.   # ● バトル画面 Y 座標の取得
  3311.   #--------------------------------------------------------------------------
  3312.   def screen_y
  3313.     return true_y * @real_zoom + @real_y
  3314.   end
  3315.   #--------------------------------------------------------------------------
  3316.   # ● バトル画面 Z 座標の取得
  3317.   #--------------------------------------------------------------------------
  3318.   def screen_z
  3319.     return true_y + @fly
  3320.   end
  3321.   #--------------------------------------------------------------------------
  3322.   # ● バトル画面 拡大率の取得
  3323.   #--------------------------------------------------------------------------
  3324.   def zoom
  3325.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3326.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3327.   end
  3328.   #--------------------------------------------------------------------------
  3329.   # ● 攻撃用、バトル画面 X 座標の取得
  3330.   #--------------------------------------------------------------------------
  3331.   def attack_x(z)
  3332.     return (320 - true_x) * z * 0.75
  3333.   end
  3334.   #--------------------------------------------------------------------------
  3335.   # ● 攻撃用、バトル画面 Y 座標の取得
  3336.   #--------------------------------------------------------------------------
  3337.   def attack_y(z)
  3338.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3339.   end
  3340.   #--------------------------------------------------------------------------
  3341.   # ● アクション作成
  3342.   #--------------------------------------------------------------------------
  3343.   def make_action
  3344.     # カレントアクションをクリア
  3345.     self.current_action.clear
  3346.     # 動けない場合
  3347.     unless self.inputable?
  3348.       # メソッド終了
  3349.       return
  3350.     end
  3351.     # 現在有効なアクションを抽出
  3352.     available_actions = []
  3353.     rating_max = 0
  3354.     for action in self.actions
  3355.       # ターン 条件確認
  3356.       n = $game_temp.battle_turn
  3357.       a = action.condition_turn_a
  3358.       b = action.condition_turn_b
  3359.       if (b == 0 and n != a) or
  3360.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3361.         next
  3362.       end
  3363.       # HP 条件確認
  3364.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3365.         next
  3366.       end
  3367.       # レベル 条件確認
  3368.       if $game_party.max_level < action.condition_level
  3369.         next
  3370.       end
  3371.       # スイッチ 条件確認
  3372.       switch_id = action.condition_switch_id
  3373.       if switch_id > 0 and $game_switches[switch_id] == false
  3374.         next
  3375.       end
  3376.       # スキル使用可能 条件確認
  3377.       if action.kind == 1
  3378.         unless self.skill_can_use?(action.skill_id)
  3379.           next
  3380.         end
  3381.       end
  3382.       # 条件に該当 : このアクションを追加
  3383.       available_actions.push(action)
  3384.       if action.rating > rating_max
  3385.         rating_max = action.rating
  3386.       end
  3387.     end
  3388.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3389.     ratings_total = 0
  3390.     for action in available_actions
  3391.       if action.rating > rating_max - 3
  3392.         ratings_total += action.rating - (rating_max - 3)
  3393.       end
  3394.     end
  3395.     # レーティングの合計が 0 ではない場合
  3396.     if ratings_total > 0
  3397.       # 乱数を作成
  3398.       value = rand(ratings_total)
  3399.       # 作成した乱数に対応するものをカレントアクションに設定
  3400.       for action in available_actions
  3401.         if action.rating > rating_max - 3
  3402.           if value < action.rating - (rating_max - 3)
  3403.             self.current_action.kind = action.kind
  3404.             self.current_action.basic = action.basic
  3405.             self.current_action.skill_id = action.skill_id
  3406.             self.current_action.decide_random_target_for_enemy
  3407.             return
  3408.           else
  3409.             value -= action.rating - (rating_max - 3)
  3410.           end
  3411.         end
  3412.       end
  3413.     end
  3414.   end
  3415. end
  3416.  
  3417. #==============================================================================
  3418. # ■ Game_Party
  3419. #------------------------------------------------------------------------------
  3420. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3421. # ラスのインスタンスは $game_party で参照されます。
  3422. #==============================================================================
  3423.  
  3424. class Game_Party
  3425.   #--------------------------------------------------------------------------
  3426.   # ● 全滅判定
  3427.   #--------------------------------------------------------------------------
  3428.   def all_dead?
  3429.     # パーティ人数が 0 人の場合
  3430.     if $game_party.actors.size == 0
  3431.       return false
  3432.     end
  3433.     # HP 0 以上のアクターがパーティにいる場合
  3434.     for actor in @actors
  3435.       if actor.rest_hp > 0
  3436.         return false
  3437.       end
  3438.     end
  3439.     # 全滅
  3440.     return true
  3441.   end
  3442.   #--------------------------------------------------------------------------
  3443.   # ● 対象アクターのランダムな決定
  3444.   #     hp0 : HP 0 のアクターに限る
  3445.   #--------------------------------------------------------------------------
  3446.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3447.   alias :random_target_actor_rtab :random_target_actor
  3448.   def random_target_actor(hp0 = false)
  3449.     # ルーレットを初期化
  3450.     roulette = []
  3451.     # ループ
  3452.     for actor in @actors
  3453.       # 条件に該当する場合
  3454.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3455.           (hp0 and actor.hp0?)
  3456.         # アクターのクラスの [位置] を取得
  3457.         position = $data_classes[actor.class_id].position
  3458.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3459.         n = 4 - position
  3460.         # ルーレットにアクターを n 回追加
  3461.         n.times do
  3462.           roulette.push(actor)
  3463.         end
  3464.       end
  3465.     end
  3466.     # ルーレットのサイズが 0 の場合
  3467.     if roulette.size == 0
  3468.       return random_target_actor_rtab(hp0)
  3469.     end
  3470.     # ルーレットを回し、アクターを決定
  3471.     return roulette[rand(roulette.size)]
  3472.   end
  3473.   #--------------------------------------------------------------------------
  3474.   # ● 対象アクターのスムーズな決定
  3475.   #     actor_index : アクターインデックス
  3476.   #--------------------------------------------------------------------------
  3477.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3478.   alias :smooth_target_actor_rtab :smooth_target_actor
  3479.   def smooth_target_actor(actor_index)
  3480.     # アクターを取得
  3481.     actor = @actors[actor_index]
  3482.     # アクターが存在する場合
  3483.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3484.       return actor
  3485.     end
  3486.     # ループ
  3487.     for actor in @actors
  3488.       # アクターが存在する場合
  3489.       if actor.exist? and actor.rest_hp > 0
  3490.         return actor
  3491.       end
  3492.     end
  3493.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3494.     return smooth_target_actor_rtab(actor_index)
  3495.   end
  3496. end
  3497.  
  3498. #==============================================================================
  3499. # ■ Game_Troop
  3500. #------------------------------------------------------------------------------
  3501. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3502. # れます。
  3503. #==============================================================================
  3504.  
  3505. class Game_Troop
  3506.   #--------------------------------------------------------------------------
  3507.   # ● 対象エネミーのランダムな決定
  3508.   #     hp0 : HP 0 のエネミーに限る
  3509.   #--------------------------------------------------------------------------
  3510.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3511.   alias :random_target_enemy_rtab :random_target_enemy
  3512.   def random_target_enemy(hp0 = false)
  3513.     # ルーレットを初期化
  3514.     roulette = []
  3515.     # ループ
  3516.     for enemy in @enemies
  3517.       # 条件に該当する場合
  3518.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3519.           (hp0 and enemy.hp0?)
  3520.         # ルーレットにエネミーを追加
  3521.         roulette.push(enemy)
  3522.       end
  3523.     end
  3524.     # ルーレットのサイズが 0 の場合
  3525.     if roulette.size == 0
  3526.       return random_target_enemy_rtab(hp0)
  3527.     end
  3528.     # ルーレットを回し、エネミーを決定
  3529.     return roulette[rand(roulette.size)]
  3530.   end
  3531.   #--------------------------------------------------------------------------
  3532.   # ● 対象エネミーのスムーズな決定
  3533.   #     enemy_index : エネミーインデックス
  3534.   #--------------------------------------------------------------------------
  3535.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3536.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3537.   def smooth_target_enemy(enemy_index)
  3538.     # エネミーを取得
  3539.     enemy = @enemies[enemy_index]
  3540.     # エネミーが存在する場合
  3541.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3542.       return enemy
  3543.     end
  3544.     # ループ
  3545.     for enemy in @enemies
  3546.       # エネミーが存在する場合
  3547.       if enemy.exist? and enemy.rest_hp > 0
  3548.         return enemy
  3549.       end
  3550.     end
  3551.     # 敵が全滅している場合、再度敵の検索を行う
  3552.     return smooth_target_enemy_rtab(enemy_index)
  3553.   end
  3554. end
  3555.  
  3556. #==============================================================================
  3557. # ■ Sprite_Battler
  3558. #------------------------------------------------------------------------------
  3559. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3560. # スプライトの状態を自動的に変化させます。
  3561. #==============================================================================
  3562.  
  3563. class Sprite_Battler < RPG::Sprite
  3564.   #--------------------------------------------------------------------------
  3565.   # ● フレーム更新
  3566.   #--------------------------------------------------------------------------
  3567.   def update
  3568.     super
  3569.     # バトラーが nil の場合
  3570.     if @battler == nil
  3571.       self.bitmap = nil
  3572.       loop_animation(nil)
  3573.       return
  3574.     end
  3575.     # ファイル名か色相が現在のものと異なる場合
  3576.     if @battler.battler_name != @battler_name or
  3577.        @battler.battler_hue != @battler_hue
  3578.       # ビットマップを取得、設定
  3579.       @battler_name = @battler.battler_name
  3580.       @battler_hue = @battler.battler_hue
  3581.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3582.       @width = bitmap.width
  3583.       @height = bitmap.height
  3584.       self.ox = @width / 2
  3585.       self.oy = @height
  3586.       if @battler.is_a?(Game_Enemy)
  3587.         @battler.height = @height
  3588.       end
  3589.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3590.       if @battler.dead? or @battler.hidden
  3591.         self.opacity = 0
  3592.       end
  3593.     end
  3594.     # アニメーション ID が現在のものと異なる場合
  3595.     if @battler.state_animation_id != @state_animation_id
  3596.       @state_animation_id = @battler.state_animation_id
  3597.       loop_animation($data_animations[@state_animation_id])
  3598.     end
  3599.     # 表示されるべきアクターの場合
  3600.     if @battler.is_a?(Game_Actor) and @battler_visible
  3601.       # メインフェーズでないときは不透明度をやや下げる
  3602.       if $game_temp.battle_main_phase
  3603.         self.opacity += 3 if self.opacity < 255
  3604.       else
  3605.         self.opacity -= 3 if self.opacity > 207
  3606.       end
  3607.     end
  3608.     # 明滅
  3609.     if @battler.blink
  3610.       blink_on
  3611.     else
  3612.       blink_off
  3613.     end
  3614.     # 不可視の場合
  3615.     unless @battler_visible
  3616.       # 出現
  3617.       if not @battler.hidden and not @battler.dead? and
  3618.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3619.         appear
  3620.         @battler_visible = true
  3621.       end
  3622.     end
  3623.     # ダメージ
  3624.     for battler in @battler.damage_pop
  3625.       if battler[0].class == Array
  3626.         if battler[0][1] >= 0
  3627.           $scene.skill_se
  3628.         else
  3629.           $scene.levelup_se
  3630.         end
  3631.         damage(@battler.damage[battler[0]], false, 2)
  3632.       else
  3633.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3634.       end
  3635.       if @battler.damage_sp.include?(battler[0])
  3636.         damage(@battler.damage_sp[battler[0]],
  3637.                 @battler.critical[battler[0]], 1)
  3638.         @battler.damage_sp.delete(battler[0])
  3639.       end
  3640.       @battler.damage_pop.delete(battler[0])
  3641.       @battler.damage.delete(battler[0])
  3642.       @battler.critical.delete(battler[0])
  3643.     end
  3644.     # 可視の場合
  3645.     if @battler_visible
  3646.       # 逃走
  3647.       if @battler.hidden
  3648.         $game_system.se_play($data_system.escape_se)
  3649.         escape
  3650.         @battler_visible = false
  3651.       end
  3652.       # 白フラッシュ
  3653.       if @battler.white_flash
  3654.         whiten
  3655.         @battler.white_flash = false
  3656.       end
  3657.       # アニメーション
  3658.       unless @battler.animation.empty?
  3659.         for animation in @battler.animation.reverse
  3660.           animation($data_animations[animation[0]], animation[1])
  3661.           @battler.animation.delete(animation)
  3662.         end
  3663.       end
  3664.       # コラプス
  3665.       if @battler.damage.empty? and @battler.dead?
  3666.         if $scene.dead_ok?(@battler)
  3667.           if @battler.is_a?(Game_Enemy)
  3668.             $game_system.se_play($data_system.enemy_collapse_se)
  3669.           else
  3670.             $game_system.se_play($data_system.actor_collapse_se)
  3671.           end
  3672.           collapse
  3673.           @battler_visible = false
  3674.         end
  3675.       end
  3676.     end
  3677.     # スプライトの座標を設定
  3678.     self.x = @battler.screen_x
  3679.     self.y = @battler.screen_y
  3680.     self.z = @battler.screen_z
  3681.     if @battler.is_a?(Game_Enemy)
  3682.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3683.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3684.     end
  3685.   end
  3686. end
  3687.  
  3688. #==============================================================================
  3689. # ■ Window_Base
  3690. #------------------------------------------------------------------------------
  3691. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3692. #==============================================================================
  3693.  
  3694. class Window_Base < Window
  3695.   #--------------------------------------------------------------------------
  3696.   # ● ゲージの描画
  3697.   #--------------------------------------------------------------------------
  3698.   def gauge_rect_at(width, height, align3,
  3699.                     color1, color2, color3, color4, color5, color6, color7,
  3700.                     color8, color9, color10, color11, color12, grade1, grade2)
  3701.     # 枠描画
  3702.     @at_gauge = Bitmap.new(width, height * 5)
  3703.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3704.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3705.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3706.       color = color3
  3707.       color3 = color4
  3708.       color4 = color
  3709.     end
  3710.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3711.       color = color5
  3712.       color5 = color6
  3713.       color6 = color
  3714.       color = color7
  3715.       color7 = color8
  3716.       color8 = color
  3717.       color = color9
  3718.       color9 = color10
  3719.       color10 = color
  3720.       color = color11
  3721.       color11 = color12
  3722.       color12 = color
  3723.     end
  3724.     if align3 == 0
  3725.       if grade1 == 2
  3726.         grade1 = 3
  3727.       end
  3728.       if grade2 == 2
  3729.         grade2 = 3
  3730.       end
  3731.     end
  3732.     # 空ゲージの描画 縦にグラデーション表示
  3733.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3734.                                   color3, color4, grade1)
  3735.     # 実ゲージの描画
  3736.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3737.                                   color5, color6, grade2)
  3738.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3739.                                   color7, color8, grade2)
  3740.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3741.                                   color9, color10, grade2)
  3742.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3743.                                   color11, color12, grade2)
  3744.   end
  3745. end
  3746.  
  3747. #==============================================================================
  3748. # ■ Window_Help
  3749. #------------------------------------------------------------------------------
  3750. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3751. #==============================================================================
  3752.  
  3753. class Window_Help < Window_Base
  3754.   #--------------------------------------------------------------------------
  3755.   # ● エネミー設定
  3756.   #     enemy : 名前とステートを表示するエネミー
  3757.   #--------------------------------------------------------------------------
  3758.   def set_enemy(enemy)
  3759.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3760.     state_text = make_battler_state_text(enemy, 112, false)
  3761.     if state_text != ""
  3762.       text += "  " + state_text
  3763.     end
  3764.     set_text(text, 1)
  3765.   end
  3766. end
  3767.  
  3768. #==============================================================================
  3769. # ■ Window_BattleStatus
  3770. #------------------------------------------------------------------------------
  3771. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3772. #==============================================================================
  3773.  
  3774. class Window_BattleStatus < Window_Base
  3775.   #--------------------------------------------------------------------------
  3776.   # ● オブジェクト初期化
  3777.   #--------------------------------------------------------------------------
  3778.   def initialize
  3779.     x = (4 - $game_party.actors.size) * 80
  3780.     width = $game_party.actors.size * 160
  3781.     super(x, 320, width, 160)
  3782.     self.back_opacity = 160
  3783.     @actor_window = []
  3784.     for i in 0...$game_party.actors.size
  3785.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3786.     end
  3787.     @level_up_flags = [false, false, false, false]
  3788.     refresh
  3789.   end
  3790.   #--------------------------------------------------------------------------
  3791.   # ● 解放
  3792.   #--------------------------------------------------------------------------
  3793.   def dispose
  3794.     for window in @actor_window
  3795.       window.dispose
  3796.     end
  3797.     super
  3798.   end
  3799.   #--------------------------------------------------------------------------
  3800.   # ● リフレッシュ
  3801.   #--------------------------------------------------------------------------
  3802.   def refresh(number = 0)
  3803.     if number == 0
  3804.       cnt = 0
  3805.       for window in @actor_window
  3806.         window.refresh(@level_up_flags[cnt])
  3807.         cnt += 1
  3808.       end
  3809.     else
  3810.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3811.     end
  3812.   end
  3813.   #--------------------------------------------------------------------------
  3814.   # ● ATゲージリフレッシュ
  3815.   #--------------------------------------------------------------------------
  3816.   def at_refresh(number = 0)
  3817.     if number == 0
  3818.       for window in @actor_window
  3819.         window.at_refresh
  3820.       end
  3821.     else
  3822.       @actor_window[number - 1].at_refresh
  3823.     end
  3824.   end
  3825.   #--------------------------------------------------------------------------
  3826.   # ● フレーム更新
  3827.   #--------------------------------------------------------------------------
  3828.   def update
  3829.     super
  3830.     if self.x != (4 - $game_party.actors.size) * 80
  3831.       self.x = (4 - $game_party.actors.size) * 80
  3832.       self.width = $game_party.actors.size * 160
  3833.       for window in @actor_window
  3834.         window.dispose
  3835.       end
  3836.       @actor_window = []
  3837.       for i in 0...$game_party.actors.size
  3838.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3839.       end
  3840.       refresh
  3841.     end
  3842.     for window in @actor_window
  3843.       window.update
  3844.     end
  3845.   end
  3846. end
  3847.  
  3848. #==============================================================================
  3849. # ■ Window_ActorStatus
  3850. #------------------------------------------------------------------------------
  3851. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3852. #==============================================================================
  3853.  
  3854. class Window_ActorStatus < Window_Base
  3855.   #--------------------------------------------------------------------------
  3856.   # ● オブジェクト初期化
  3857.   #--------------------------------------------------------------------------
  3858.   def initialize(id, x)
  3859.     @actor_num = id
  3860.     super(x, 320, 160, 160)
  3861.     self.contents = Bitmap.new(width - 32, height - 32)
  3862.     self.opacity = 0
  3863.     self.back_opacity = 0
  3864.     actor = $game_party.actors[@actor_num]
  3865.     @actor_nm = actor.name
  3866.     @actor_mhp = actor.maxhp
  3867.     @actor_msp = actor.maxsp
  3868.     @actor_hp = actor.hp
  3869.     @actor_sp = actor.sp
  3870.     @actor_st = make_battler_state_text(actor, 120, true)
  3871.     @status_window = []
  3872.     for i in 0...5
  3873.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3874.     end
  3875.     refresh(false)
  3876.   end
  3877.   #--------------------------------------------------------------------------
  3878.   # ● 解放
  3879.   #--------------------------------------------------------------------------
  3880.   def dispose
  3881.     for i in 0...5
  3882.       @status_window[i].dispose
  3883.     end
  3884.     super
  3885.   end
  3886.   #--------------------------------------------------------------------------
  3887.   # ● リフレッシュ
  3888.   #--------------------------------------------------------------------------
  3889.   def refresh(level_up_flags)
  3890.     self.contents.clear
  3891.     actor = $game_party.actors[@actor_num]
  3892.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3893.     @status_window[1].refresh(actor) if
  3894.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3895.     @status_window[2].refresh(actor) if
  3896.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3897.     @status_window[3].refresh(actor, level_up_flags) if
  3898.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3899.     @actor_nm = actor.name
  3900.     @actor_mhp = actor.maxhp
  3901.     @actor_msp = actor.maxsp
  3902.     @actor_hp = actor.hp
  3903.     @actor_sp = actor.sp
  3904.     @actor_st = make_battler_state_text(actor, 120, true)
  3905.   end
  3906.   #--------------------------------------------------------------------------
  3907.   # ● ATゲージリフレッシュ
  3908.   #--------------------------------------------------------------------------
  3909.   def at_refresh
  3910.     @status_window[4].refresh($game_party.actors[@actor_num])
  3911.   end
  3912.   #--------------------------------------------------------------------------
  3913.   # ● フレーム更新
  3914.   #--------------------------------------------------------------------------
  3915.   def update
  3916.     for window in @status_window
  3917.       window.update
  3918.     end
  3919.   end
  3920. end
  3921.  
  3922. #==============================================================================
  3923. # ■ Window_DetailsStatus
  3924. #------------------------------------------------------------------------------
  3925. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3926. #==============================================================================
  3927.  
  3928. class Window_DetailsStatus < Window_Base
  3929.   #--------------------------------------------------------------------------
  3930.   # ● オブジェクト初期化
  3931.   #--------------------------------------------------------------------------
  3932.   def initialize(actor, id, x)
  3933.     @status_id = id
  3934.     super(x, 320 + id * 26, 160, 64)
  3935.     self.contents = Bitmap.new(width - 32, height - 32)
  3936.     self.opacity = 0
  3937.     self.back_opacity = 0
  3938.     refresh(actor, false)
  3939.   end
  3940.   #--------------------------------------------------------------------------
  3941.   # ● 解放
  3942.   #--------------------------------------------------------------------------
  3943.   def dispose
  3944.     super
  3945.   end
  3946.   #--------------------------------------------------------------------------
  3947.   # ● リフレッシュ
  3948.   #--------------------------------------------------------------------------
  3949.   def refresh(actor, level_up_flags = false)
  3950.     self.contents.clear
  3951.     case @status_id
  3952.     when 0
  3953.       draw_actor_name(actor, 4, 0)
  3954.     when 1
  3955.       draw_actor_hp(actor, 4, 0, 120)
  3956.     when 2
  3957.       draw_actor_sp(actor, 4, 0, 120)
  3958.     when 3
  3959.       if level_up_flags
  3960.         self.contents.font.color = normal_color
  3961.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3962.       else
  3963.         draw_actor_state(actor, 4, 0)
  3964.       end
  3965.     when 4
  3966.       draw_actor_atg(actor, 4, 0, 120)
  3967.     end
  3968.   end
  3969.   #--------------------------------------------------------------------------
  3970.   # ● フレーム更新
  3971.   #--------------------------------------------------------------------------
  3972.   def update
  3973.     # メインフェーズのときは不透明度をやや下げる
  3974.     if $game_temp.battle_main_phase
  3975.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3976.     else
  3977.       self.contents_opacity += 4 if self.contents_opacity < 255
  3978.     end
  3979.   end
  3980. end
  3981.  
  3982. #==============================================================================
  3983. # ■ Arrow_Base
  3984. #------------------------------------------------------------------------------
  3985. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3986. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3987. #==============================================================================
  3988.  
  3989. class Arrow_Base < Sprite
  3990.   #--------------------------------------------------------------------------
  3991.   # ● オブジェクト初期化
  3992.   #     viewport : ビューポート
  3993.   #--------------------------------------------------------------------------
  3994.   def initialize(viewport)
  3995.     super(viewport)
  3996.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3997.     self.ox = 16
  3998.     self.oy = 32
  3999.     self.z = 2500
  4000.     @blink_count = 0
  4001.     @index = 0
  4002.     @help_window = nil
  4003.     update
  4004.   end
  4005. end
  4006.  
  4007. #==============================================================================
  4008. # ■ Arrow_Enemy
  4009. #------------------------------------------------------------------------------
  4010. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  4011. # スを継承します。
  4012. #==============================================================================
  4013.  
  4014. class Arrow_Enemy < Arrow_Base
  4015.   #--------------------------------------------------------------------------
  4016.   # ● フレーム更新
  4017.   #--------------------------------------------------------------------------
  4018.   def update
  4019.     super
  4020.     # 存在しないエネミーを指していたら飛ばす
  4021.     $game_troop.enemies.size.times do
  4022.       break if self.enemy.exist?
  4023.       @index += 1
  4024.       @index %= $game_troop.enemies.size
  4025.     end
  4026.     # カーソル右
  4027.     if Input.repeat?(Input::RIGHT)
  4028.       $game_system.se_play($data_system.cursor_se)
  4029.       $game_troop.enemies.size.times do
  4030.         @index += 1
  4031.         @index %= $game_troop.enemies.size
  4032.         break if self.enemy.exist?
  4033.       end
  4034.       $scene.camera = "select"
  4035.       zoom = 1 / self.enemy.zoom
  4036.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4037.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4038.     end
  4039.     # カーソル左
  4040.     if Input.repeat?(Input::LEFT)
  4041.       $game_system.se_play($data_system.cursor_se)
  4042.       $game_troop.enemies.size.times do
  4043.         @index += $game_troop.enemies.size - 1
  4044.         @index %= $game_troop.enemies.size
  4045.         break if self.enemy.exist?
  4046.       end
  4047.       $scene.camera = "select"
  4048.       zoom = 1 / self.enemy.zoom
  4049.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4050.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4051.     end
  4052.     # スプライトの座標を設定
  4053.     if self.enemy != nil
  4054.       self.x = self.enemy.screen_x
  4055.       self.y = self.enemy.screen_y
  4056.     end
  4057.   end
  4058. end
  4059.  
  4060. #==============================================================================
  4061. # ■ Interpreter
  4062. #------------------------------------------------------------------------------
  4063. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4064. # スや Game_Event クラスの内部で使用されます。
  4065. #==============================================================================
  4066.  
  4067. class Interpreter
  4068.   #--------------------------------------------------------------------------
  4069.   # ● アクターの入れ替え
  4070.   #--------------------------------------------------------------------------
  4071.   def command_129
  4072.     # アクターを取得
  4073.     actor = $game_actors[@parameters[0]]
  4074.     # アクターが有効の場合
  4075.     if actor != nil
  4076.       # 操作で分岐
  4077.       if @parameters[1] == 0
  4078.         if @parameters[2] == 1
  4079.           $game_actors[@parameters[0]].setup(@parameters[0])
  4080.         end
  4081.         $game_party.add_actor(@parameters[0])
  4082.         if $game_temp.in_battle
  4083.           $game_actors[@parameters[0]].at = 0
  4084.           $game_actors[@parameters[0]].atp = 0
  4085.           $scene.spell_reset($game_actors[@parameters[0]])
  4086.           $game_actors[@parameters[0]].damage_pop = {}
  4087.           $game_actors[@parameters[0]].damage = {}
  4088.           $game_actors[@parameters[0]].damage_sp = {}
  4089.           $game_actors[@parameters[0]].critical = {}
  4090.           $game_actors[@parameters[0]].recover_hp = {}
  4091.           $game_actors[@parameters[0]].recover_sp = {}
  4092.           $game_actors[@parameters[0]].state_p = {}
  4093.           $game_actors[@parameters[0]].state_m = {}
  4094.           $game_actors[@parameters[0]].animation = []
  4095.         end
  4096.       else
  4097.         $game_party.remove_actor(@parameters[0])
  4098.       end
  4099.     end
  4100.     if $game_temp.in_battle
  4101.       $scene.status_window.update
  4102.     end
  4103.     # 継続
  4104.     return true
  4105.   end
  4106.   #--------------------------------------------------------------------------
  4107.   # ● HP の増減
  4108.   #--------------------------------------------------------------------------
  4109.   alias :command_311_rtab :command_311
  4110.   def command_311
  4111.     command_311_rtab
  4112.     if $game_temp.in_battle
  4113.       $scene.status_window.refresh
  4114.     end
  4115.   end
  4116.   #--------------------------------------------------------------------------
  4117.   # ● SP の増減
  4118.   #--------------------------------------------------------------------------
  4119.   alias :command_312_rtab :command_312
  4120.   def command_312
  4121.     command_312_rtab
  4122.     if $game_temp.in_battle
  4123.       $scene.status_window.refresh
  4124.     end
  4125.   end
  4126.   #--------------------------------------------------------------------------
  4127.   # ● ステートの変更
  4128.   #--------------------------------------------------------------------------
  4129.   alias :command_313_rtab :command_313
  4130.   def command_313
  4131.     command_313_rtab
  4132.     if $game_temp.in_battle
  4133.       $scene.status_window.refresh
  4134.     end
  4135.   end
  4136.   #--------------------------------------------------------------------------
  4137.   # ● 全回復
  4138.   #--------------------------------------------------------------------------
  4139.   alias :command_314_rtab :command_314
  4140.   def command_314
  4141.     command_314_rtab
  4142.     if $game_temp.in_battle
  4143.       $scene.status_window.refresh
  4144.     end
  4145.   end
  4146.   #--------------------------------------------------------------------------
  4147.   # ● EXP の増減
  4148.   #--------------------------------------------------------------------------
  4149.   alias :command_315_rtab :command_315
  4150.   def command_315
  4151.     command_315_rtab
  4152.     if $game_temp.in_battle
  4153.       $scene.status_window.refresh
  4154.     end
  4155.   end
  4156.   #--------------------------------------------------------------------------
  4157.   # ● レベルの増減
  4158.   #--------------------------------------------------------------------------
  4159.   alias :command_316_rtab :command_316
  4160.   def command_316
  4161.     command_316_rtab
  4162.     if $game_temp.in_battle
  4163.       $scene.status_window.refresh
  4164.     end
  4165.   end
  4166.   #--------------------------------------------------------------------------
  4167.   # ● パラメータの増減
  4168.   #--------------------------------------------------------------------------
  4169.   alias :command_317_rtab :command_317
  4170.   def command_317
  4171.     command_317_rtab
  4172.     if $game_temp.in_battle
  4173.       $scene.status_window.refresh
  4174.     end
  4175.   end
  4176.   #--------------------------------------------------------------------------
  4177.   # ● 装備の変更
  4178.   #--------------------------------------------------------------------------
  4179.   alias :command_319_rtab :command_319
  4180.   def command_319
  4181.     command_319_rtab
  4182.     if $game_temp.in_battle
  4183.       $scene.status_window.refresh
  4184.     end
  4185.   end
  4186.   #--------------------------------------------------------------------------
  4187.   # ● アクターの名前変更
  4188.   #--------------------------------------------------------------------------
  4189.   alias :command_320_rtab :command_320
  4190.   def command_320
  4191.     command_320_rtab
  4192.     if $game_temp.in_battle
  4193.       $scene.status_window.refresh
  4194.     end
  4195.   end
  4196.   #--------------------------------------------------------------------------
  4197.   # ● アクターのクラス変更
  4198.   #--------------------------------------------------------------------------
  4199.   alias :command_321_rtab :command_321
  4200.   def command_321
  4201.     command_321_rtab
  4202.     if $game_temp.in_battle
  4203.       $scene.status_window.refresh
  4204.     end
  4205.   end
  4206.   #--------------------------------------------------------------------------
  4207.   # ● アニメーションの表示
  4208.   #--------------------------------------------------------------------------
  4209.   def command_337
  4210.     # イテレータで処理
  4211.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4212.       # バトラーが存在する場合
  4213.       if battler.exist?
  4214.         # アニメーション ID を設定
  4215.         battler.animation.push([@parameters[2], true])
  4216.       end
  4217.     end
  4218.     # 継続
  4219.     return true
  4220.   end
  4221.   #--------------------------------------------------------------------------
  4222.   # ● ダメージの処理
  4223.   #--------------------------------------------------------------------------
  4224.   def command_338
  4225.     # 操作する値を取得
  4226.     value = operate_value(0, @parameters[2], @parameters[3])
  4227.     # イテレータで処理
  4228.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4229.       # バトラーが存在する場合
  4230.       if battler.exist?
  4231.         # HP を変更
  4232.         battler.hp -= value
  4233.         # 戦闘中なら
  4234.         if $game_temp.in_battle
  4235.           # ダメージを設定
  4236.           battler.damage["event"] = value
  4237.           battler.damage_pop["event"] = true
  4238.         end
  4239.       end
  4240.     end
  4241.     if $game_temp.in_battle
  4242.       $scene.status_window.refresh
  4243.     end
  4244.     # 継続
  4245.     return true
  4246.   end
  4247.   #--------------------------------------------------------------------------
  4248.   # ● アクションの強制
  4249.   #--------------------------------------------------------------------------
  4250.   def command_339
  4251.     # 戦闘中でなければ無視
  4252.     unless $game_temp.in_battle
  4253.       return true
  4254.     end
  4255.     # ターン数が 0 なら無視
  4256.     if $game_temp.battle_turn == 0
  4257.       return true
  4258.     end
  4259.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4260.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4261.       # バトラーが存在する場合
  4262.       if battler.exist?
  4263.         # アクションを設定
  4264.         battler.current_action.force_kind = @parameters[2]
  4265.         if battler.current_action.force_kind == 0
  4266.           battler.current_action.force_basic = @parameters[3]
  4267.         else
  4268.           battler.current_action.force_skill_id = @parameters[3]
  4269.         end
  4270.         # 行動対象を設定
  4271.         if @parameters[4] == -2
  4272.           if battler.is_a?(Game_Enemy)
  4273.             battler.current_action.decide_last_target_for_enemy
  4274.           else
  4275.             battler.current_action.decide_last_target_for_actor
  4276.           end
  4277.         elsif @parameters[4] == -1
  4278.           if battler.is_a?(Game_Enemy)
  4279.             battler.current_action.decide_random_target_for_enemy
  4280.           else
  4281.             battler.current_action.decide_random_target_for_actor
  4282.           end
  4283.         elsif @parameters[4] >= 0
  4284.           battler.current_action.target_index = @parameters[4]
  4285.         end
  4286.         # アクションが有効かつ [すぐに実行] の場合
  4287.         if battler.current_action.valid? and @parameters[5] == 1
  4288.           # 強制対象のバトラーを設定
  4289.           $game_temp.forcing_battler = battler
  4290.           # インデックスを進める
  4291.           @index += 1
  4292.           # 終了
  4293.           return false
  4294.         elsif battler.current_action.valid? and @parameters[5] == 0
  4295.           battler.current_action.forcing = true
  4296.         end
  4297.       end
  4298.     end
  4299.     # 継続
  4300.     return true
  4301.   end
  4302. end
  4303.  
  4304. #==============================================================================
  4305. # ■ Spriteモジュール
  4306. #------------------------------------------------------------------------------
  4307. #  アニメーションの管理を行うモジュールです。
  4308. #==============================================================================
  4309.  
  4310. module RPG
  4311.   class Sprite < ::Sprite
  4312.     def initialize(viewport = nil)
  4313.       super(viewport)
  4314.       @_whiten_duration = 0
  4315.       @_appear_duration = 0
  4316.       @_escape_duration = 0
  4317.       @_collapse_duration = 0
  4318.       @_damage = []
  4319.       @_animation = []
  4320.       @_animation_duration = 0
  4321.       @_blink = false
  4322.     end
  4323.     def damage(value, critical, type = 0)
  4324.       if value.is_a?(Numeric)
  4325.         damage_string = value.abs.to_s
  4326.       else
  4327.         damage_string = value.to_s
  4328.       end
  4329.       bitmap = Bitmap.new(160, 48)
  4330.       bitmap.font.name = "Arial Black"
  4331.       bitmap.font.size = 32
  4332.       bitmap.font.color.set(0, 0, 0)
  4333.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4334.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4335.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4336.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4337.       if value.is_a?(Numeric) and value < 0
  4338.         if type == 0
  4339.           bitmap.font.color.set(176, 255, 144)
  4340.         else
  4341.           bitmap.font.color.set(176, 144, 255)
  4342.         end
  4343.       else
  4344.         if type == 0
  4345.           bitmap.font.color.set(255, 255, 255)
  4346.         else
  4347.           bitmap.font.color.set(255, 176, 144)
  4348.         end
  4349.       end
  4350.       if type == 2
  4351.         bitmap.font.color.set(255, 224, 128)
  4352.       end
  4353.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4354.       if critical
  4355.         string = "CRITICAL"
  4356.         bitmap.font.size = 20
  4357.         bitmap.font.color.set(0, 0, 0)
  4358.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4359.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4360.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4361.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4362.         bitmap.font.color.set(255, 255, 255)
  4363.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4364.       end
  4365.       num = @_damage.size
  4366.       if type != 2
  4367.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4368.       else
  4369.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4370.       end
  4371.       @_damage[num][0].bitmap = bitmap
  4372.       @_damage[num][0].ox = 80 + self.viewport.ox
  4373.       @_damage[num][0].oy = 20 + self.viewport.oy
  4374.       if self.battler.is_a?(Game_Actor)
  4375.         @_damage[num][0].x = self.x
  4376.         @_damage[num][0].y = self.y - self.oy / 2
  4377.       else
  4378.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4379.                             self.ox + self.src_rect.width / 2
  4380.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4381.                             self.viewport.rect.y
  4382.         @_damage[num][0].zoom_x = self.zoom_x
  4383.         @_damage[num][0].zoom_y = self.zoom_y
  4384.         @_damage[num][0].z = 3000
  4385.       end
  4386.     end
  4387.     def animation(animation, hit)
  4388.       return if animation == nil
  4389.       num = @_animation.size
  4390.       @_animation.push([animation, hit, animation.frame_max, []])
  4391.       bitmap = RPG::Cache.animation(animation.animation_name,
  4392.                                     animation.animation_hue)
  4393.       if @@_reference_count.include?(bitmap)
  4394.         @@_reference_count[bitmap] += 1
  4395.       else
  4396.         @@_reference_count[bitmap] = 1
  4397.       end
  4398.       if @_animation[num][0].position != 3 or
  4399.           not @@_animations.include?(animation)
  4400.         for i in 0..15
  4401.           sprite = ::Sprite.new
  4402.           sprite.bitmap = bitmap
  4403.           sprite.visible = false
  4404.           @_animation[num][3].push(sprite)
  4405.         end
  4406.         unless @@_animations.include?(animation)
  4407.           @@_animations.push(animation)
  4408.         end
  4409.       end
  4410.       update_animation(@_animation[num])
  4411.     end
  4412.     def loop_animation(animation)
  4413.       return if animation == @_loop_animation
  4414.       dispose_loop_animation
  4415.       @_loop_animation = animation
  4416.       return if @_loop_animation == nil
  4417.       @_loop_animation_index = 0
  4418.       animation_name = @_loop_animation.animation_name
  4419.       animation_hue = @_loop_animation.animation_hue
  4420.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4421.       if @@_reference_count.include?(bitmap)
  4422.         @@_reference_count[bitmap] += 1
  4423.       else
  4424.         @@_reference_count[bitmap] = 1
  4425.       end
  4426.       @_loop_animation_sprites = []
  4427.       for i in 0..15
  4428.         sprite = ::Sprite.new
  4429.         sprite.bitmap = bitmap
  4430.         sprite.visible = false
  4431.         @_loop_animation_sprites.push(sprite)
  4432.       end
  4433.       # update_loop_animation
  4434.     end
  4435.     def dispose_damage
  4436.       for damage in @_damage.reverse
  4437.         damage[0].bitmap.dispose
  4438.         damage[0].dispose
  4439.         @_damage.delete(damage)
  4440.       end
  4441.     end
  4442.     def dispose_animation
  4443.       for anime in @_animation.reverse
  4444.         sprite = anime[3][0]
  4445.         if sprite != nil
  4446.           @@_reference_count[sprite.bitmap] -= 1
  4447.           if @@_reference_count[sprite.bitmap] == 0
  4448.             sprite.bitmap.dispose
  4449.           end
  4450.         end
  4451.         for sprite in anime[3]
  4452.           sprite.dispose
  4453.         end
  4454.         @_animation.delete(anime)
  4455.       end
  4456.     end
  4457.     def effect?
  4458.       @_whiten_duration > 0 or
  4459.       @_appear_duration > 0 or
  4460.       @_escape_duration > 0 or
  4461.       @_collapse_duration > 0 or
  4462.       @_damage.size == 0 or
  4463.       @_animation.size == 0
  4464.     end
  4465.     def update
  4466.       super
  4467.       if @_whiten_duration > 0
  4468.         @_whiten_duration -= 1
  4469.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4470.       end
  4471.       if @_appear_duration > 0
  4472.         @_appear_duration -= 1
  4473.         self.opacity = (16 - @_appear_duration) * 16
  4474.       end
  4475.       if @_escape_duration > 0
  4476.         @_escape_duration -= 1
  4477.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4478.       end
  4479.       if @_collapse_duration > 0
  4480.         @_collapse_duration -= 1
  4481.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4482.       end
  4483.       for damage in @_damage
  4484.         if damage[1] > 0
  4485.           damage[1] -= 1
  4486.           damage[4] -= 3
  4487.           damage[2] -= damage[4]
  4488.           if self.battler.is_a?(Game_Actor)
  4489.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4490.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4491.           else
  4492.             damage[0].x = self.x + self.viewport.rect.x -
  4493.                           self.ox + self.src_rect.width / 2 +
  4494.                           (40 - damage[1]) * damage[3] / 10
  4495.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4496.                           self.viewport.rect.y + damage[2] / 10
  4497.             damage[0].zoom_x = self.zoom_x
  4498.             damage[0].zoom_y = self.zoom_y
  4499.           end
  4500.           damage[0].z = 2960 + damage[1]
  4501.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4502.           if damage[1] == 0
  4503.             damage[0].bitmap.dispose
  4504.             damage[0].dispose
  4505.             @_damage.delete(damage)
  4506.           end
  4507.         end
  4508.       end
  4509.       for anime in @_animation
  4510.         if (Graphics.frame_count % 2 == 0)
  4511.           anime[2] -= 1
  4512.           update_animation(anime)
  4513.         end
  4514.       end
  4515.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4516.         update_loop_animation
  4517.         @_loop_animation_index += 1
  4518.         @_loop_animation_index %= @_loop_animation.frame_max
  4519.       end
  4520.       if @_blink
  4521.         @_blink_count = (@_blink_count + 1) % 32
  4522.         if @_blink_count < 16
  4523.           alpha = (16 - @_blink_count) * 6
  4524.         else
  4525.           alpha = (@_blink_count - 16) * 6
  4526.         end
  4527.         self.color.set(255, 255, 255, alpha)
  4528.       end
  4529.       @@_animations.clear
  4530.     end
  4531.     def update_animation(anime)
  4532.       if anime[2] > 0
  4533.         frame_index = anime[0].frame_max - anime[2]
  4534.         cell_data = anime[0].frames[frame_index].cell_data
  4535.         position = anime[0].position
  4536.         animation_set_sprites(anime[3], cell_data, position)
  4537.         for timing in anime[0].timings
  4538.           if timing.frame == frame_index
  4539.             animation_process_timing(timing, anime[1])
  4540.           end
  4541.         end
  4542.       else
  4543.         @@_reference_count[anime[3][0].bitmap] -= 1
  4544.         if @@_reference_count[anime[3][0].bitmap] == 0
  4545.             anime[3][0].bitmap.dispose
  4546.         end
  4547.         for sprite in anime[3]
  4548.           sprite.dispose
  4549.         end
  4550.         @_animation.delete(anime)
  4551.       end
  4552.     end
  4553.     def animation_set_sprites(sprites, cell_data, position)
  4554.       for i in 0..15
  4555.         sprite = sprites[i]
  4556.         pattern = cell_data[i, 0]
  4557.         if sprite == nil or pattern == nil or pattern == -1
  4558.           sprite.visible = false if sprite != nil
  4559.           next
  4560.         end
  4561.         sprite.visible = true
  4562.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4563.         if position == 3
  4564.           if self.viewport != nil
  4565.             sprite.x = self.viewport.rect.width / 2
  4566.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4567.               sprite.y = self.viewport.rect.height - 320
  4568.             else
  4569.               sprite.y = self.viewport.rect.height - 160
  4570.             end
  4571.           else
  4572.             sprite.x = 320
  4573.             sprite.y = 240
  4574.           end
  4575.         else
  4576.           sprite.x = self.x + self.viewport.rect.x -
  4577.                       self.ox + self.src_rect.width / 2
  4578.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4579.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4580.                         self.viewport.rect.y
  4581.             if position == 0
  4582.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4583.             elsif position == 2
  4584.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4585.             end
  4586.           else
  4587.             sprite.y = self.y + self.viewport.rect.y -
  4588.                         self.oy + self.src_rect.height / 2
  4589.             sprite.y -= self.src_rect.height / 4 if position == 0
  4590.             sprite.y += self.src_rect.height / 4 if position == 2
  4591.           end
  4592.         end
  4593.         sprite.x += cell_data[i, 1]
  4594.         sprite.y += cell_data[i, 2]
  4595.         sprite.z = 2000
  4596.         sprite.ox = 96
  4597.         sprite.oy = 96
  4598.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4599.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4600.         if position != 3
  4601.           sprite.zoom_x *= self.zoom_x
  4602.           sprite.zoom_y *= self.zoom_y
  4603.         end
  4604.         sprite.angle = cell_data[i, 4]
  4605.         sprite.mirror = (cell_data[i, 5] == 1)
  4606.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4607.         sprite.blend_type = cell_data[i, 7]
  4608.       end
  4609.     end
  4610.     def x=(x)
  4611.       sx = x - self.x
  4612.       if sx != 0
  4613.         for anime in @_animation
  4614.           if anime[3] != nil
  4615.             for i in 0..15
  4616.               anime[3][i].x += sx
  4617.             end
  4618.           end
  4619.         end
  4620.         if @_loop_animation_sprites != nil
  4621.           for i in 0..15
  4622.             @_loop_animation_sprites[i].x += sx
  4623.           end
  4624.         end
  4625.       end
  4626.       super
  4627.     end
  4628.     def y=(y)
  4629.       sy = y - self.y
  4630.       if sy != 0
  4631.         for anime in @_animation
  4632.           if anime[3] != nil
  4633.             for i in 0..15
  4634.               anime[3][i].y += sy
  4635.             end
  4636.           end
  4637.         end
  4638.         if @_loop_animation_sprites != nil
  4639.           for i in 0..15
  4640.             @_loop_animation_sprites[i].y += sy
  4641.           end
  4642.         end
  4643.       end
  4644.       super
  4645.     end
  4646.   end
  4647. end
  4648.  
  4649. #------------------------------------------------------------------------------
  4650. #  Bitmapクラスに新たな機能を追加します。
  4651. #==============================================================================
  4652.  
  4653. class Bitmap
  4654.   #--------------------------------------------------------------------------
  4655.   # ● 矩形をグラデーション表示
  4656.   #     color1 : スタートカラー
  4657.   #     color2 : エンドカラー
  4658.   #     align  :  0:横にグラデーション
  4659.   #               1:縦にグラデーション
  4660.   #               2:斜めにグラデーション(激重につき注意)
  4661.   #--------------------------------------------------------------------------
  4662.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4663.     if align == 0
  4664.       for i in x...x + width
  4665.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4666.         green = color1.green +
  4667.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4668.         blue  = color1.blue +
  4669.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4670.         alpha = color1.alpha +
  4671.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4672.         color = Color.new(red, green, blue, alpha)
  4673.         fill_rect(i, y, 1, height, color)
  4674.       end
  4675.     elsif align == 1
  4676.       for i in y...y + height
  4677.         red   = color1.red +
  4678.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4679.         green = color1.green +
  4680.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4681.         blue  = color1.blue +
  4682.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4683.         alpha = color1.alpha +
  4684.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4685.         color = Color.new(red, green, blue, alpha)
  4686.         fill_rect(x, i, width, 1, color)
  4687.       end
  4688.     elsif align == 2
  4689.       for i in x...x + width
  4690.         for j in y...y + height
  4691.           red   = color1.red + (color2.red - color1.red) *
  4692.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4693.           green = color1.green + (color2.green - color1.green) *
  4694.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4695.           blue  = color1.blue + (color2.blue - color1.blue) *
  4696.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4697.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4698.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4699.           color = Color.new(red, green, blue, alpha)
  4700.           set_pixel(i, j, color)
  4701.         end
  4702.       end
  4703.     elsif align == 3
  4704.       for i in x...x + width
  4705.         for j in y...y + height
  4706.           red   = color1.red + (color2.red - color1.red) *
  4707.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4708.           green = color1.green + (color2.green - color1.green) *
  4709.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4710.           blue  = color1.blue + (color2.blue - color1.blue) *
  4711.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4712.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4713.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4714.           color = Color.new(red, green, blue, alpha)
  4715.           set_pixel(i, j, color)
  4716.         end
  4717.       end
  4718.     end
  4719.     end
  4720.       end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 22:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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