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

Project1

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

[已经过期] cp制战斗问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
657
在线时间
333 小时
注册时间
2011-3-14
帖子
121
跳转到指定楼层
1
发表于 2016-1-29 21:35:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
请问一下,如何让cp战斗显示敌人的cp条?
以下是我用的cp脚本:
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.     # @force : 強制アクションでスキル使用時の強制具合
  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 = 150
  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.     @max = 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.       @height = 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, skill)
  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, nil)
  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.   def slip_damage_effect
  3205.     # ダメージを設定
  3206.     self.damage["slip"] = self.maxhp / 10
  3207.     # 分散
  3208.     if self.damage["slip"].abs > 0
  3209.       amp = [self.damage["slip"].abs * 15 / 100, 1].max
  3210.       self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
  3211.     end
  3212.     # HP からダメージを減算
  3213.     self.hp -= self.damage["slip"]
  3214.     # メソッド終了
  3215.     return true
  3216.   end
  3217. end
  3218.  
  3219. #==============================================================================
  3220. # ■ Game_BattleAction
  3221. #------------------------------------------------------------------------------
  3222. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3223. # スの内部で使用されます。
  3224. #==============================================================================
  3225.  
  3226. class Game_BattleAction
  3227.   #--------------------------------------------------------------------------
  3228.   # ● 公開インスタンス変数
  3229.   #--------------------------------------------------------------------------
  3230.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3231.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3232.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3233.   attr_accessor :force_skill_id           # スキル ID
  3234.   #--------------------------------------------------------------------------
  3235.   # ● 有効判定
  3236.   #--------------------------------------------------------------------------
  3237.   def valid?
  3238.     return (not (@force_kind == 0 and @force_basic == 3))
  3239.   end
  3240. end
  3241.  
  3242. #==============================================================================
  3243. # ■ Game_Actor
  3244. #------------------------------------------------------------------------------
  3245. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3246. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3247. #==============================================================================
  3248.  
  3249. class Game_Actor < Game_Battler
  3250.   def skill_can_use?(skill_id)
  3251.     return super
  3252.   end
  3253. end
  3254.  
  3255. #==============================================================================
  3256. # ■ Game_Enemy
  3257. #------------------------------------------------------------------------------
  3258. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3259. # 内部で使用されます。
  3260. #==============================================================================
  3261.  
  3262. class Game_Enemy < Game_Battler
  3263.   #--------------------------------------------------------------------------
  3264.   # ● 公開インスタンス変数
  3265.   #--------------------------------------------------------------------------
  3266.   attr_accessor :height                  # 画像の高さ
  3267.   attr_accessor :real_x                  # X座標補正
  3268.   attr_accessor :real_y                  # Y座標補正
  3269.   attr_accessor :real_zoom               # 拡大率
  3270.   #--------------------------------------------------------------------------
  3271.   # ● オブジェクト初期化
  3272.   #     troop_id     : トループ ID
  3273.   #     member_index : トループメンバーのインデックス
  3274.   #--------------------------------------------------------------------------
  3275.   def initialize(troop_id, member_index)
  3276.     super()
  3277.     @troop_id = troop_id
  3278.     @member_index = member_index
  3279.     troop = $data_troops[@troop_id]
  3280.     @enemy_id = troop.members[@member_index].enemy_id
  3281.     enemy = $data_enemies[@enemy_id]
  3282.     @battler_name = enemy.battler_name
  3283.     @battler_hue = enemy.battler_hue
  3284.     @hp = maxhp
  3285.     @sp = maxsp
  3286.     @real_x = 0
  3287.     @real_y = 0
  3288.     @real_zoom = 1.0
  3289.     @fly = 0
  3290.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3291.     @hidden = troop.members[@member_index].hidden
  3292.     @immortal = troop.members[@member_index].immortal
  3293.   end
  3294.   alias :true_x :screen_x
  3295.   alias :true_y :screen_y
  3296.   #--------------------------------------------------------------------------
  3297.   # ● バトル画面 X 座標の取得
  3298.   #--------------------------------------------------------------------------
  3299.   def screen_x
  3300.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3301.   end
  3302.   #--------------------------------------------------------------------------
  3303.   # ● バトル画面 Y 座標の取得
  3304.   #--------------------------------------------------------------------------
  3305.   def screen_y
  3306.     return true_y * @real_zoom + @real_y
  3307.   end
  3308.   #--------------------------------------------------------------------------
  3309.   # ● バトル画面 Z 座標の取得
  3310.   #--------------------------------------------------------------------------
  3311.   def screen_z
  3312.     return true_y + @fly
  3313.   end
  3314.   #--------------------------------------------------------------------------
  3315.   # ● バトル画面 拡大率の取得
  3316.   #--------------------------------------------------------------------------
  3317.   def zoom
  3318.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3319.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3320.   end
  3321.   #--------------------------------------------------------------------------
  3322.   # ● 攻撃用、バトル画面 X 座標の取得
  3323.   #--------------------------------------------------------------------------
  3324.   def attack_x(z)
  3325.     return (320 - true_x) * z * 0.75
  3326.   end
  3327.   #--------------------------------------------------------------------------
  3328.   # ● 攻撃用、バトル画面 Y 座標の取得
  3329.   #--------------------------------------------------------------------------
  3330.   def attack_y(z)
  3331.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3332.   end
  3333.   #--------------------------------------------------------------------------
  3334.   # ● アクション作成
  3335.   #--------------------------------------------------------------------------
  3336.   def make_action
  3337.     # カレントアクションをクリア
  3338.     self.current_action.clear
  3339.     # 動けない場合
  3340.     unless self.inputable?
  3341.       # メソッド終了
  3342.       return
  3343.     end
  3344.     # 現在有効なアクションを抽出
  3345.     available_actions = []
  3346.     rating_max = 0
  3347.     for action in self.actions
  3348.       # ターン 条件確認
  3349.       n = $game_temp.battle_turn
  3350.       a = action.condition_turn_a
  3351.       b = action.condition_turn_b
  3352.       if (b == 0 and n != a) or
  3353.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3354.         next
  3355.       end
  3356.       # HP 条件確認
  3357.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3358.         next
  3359.       end
  3360.       # レベル 条件確認
  3361.       if $game_party.max_level < action.condition_level
  3362.         next
  3363.       end
  3364.       # スイッチ 条件確認
  3365.       switch_id = action.condition_switch_id
  3366.       if switch_id > 0 and $game_switches[switch_id] == false
  3367.         next
  3368.       end
  3369.       # スキル使用可能 条件確認
  3370.       if action.kind == 1
  3371.         unless self.skill_can_use?(action.skill_id)
  3372.           next
  3373.         end
  3374.       end
  3375.       # 条件に該当 : このアクションを追加
  3376.       available_actions.push(action)
  3377.       if action.rating > rating_max
  3378.         rating_max = action.rating
  3379.       end
  3380.     end
  3381.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3382.     ratings_total = 0
  3383.     for action in available_actions
  3384.       if action.rating > rating_max - 3
  3385.         ratings_total += action.rating - (rating_max - 3)
  3386.       end
  3387.     end
  3388.     # レーティングの合計が 0 ではない場合
  3389.     if ratings_total > 0
  3390.       # 乱数を作成
  3391.       value = rand(ratings_total)
  3392.       # 作成した乱数に対応するものをカレントアクションに設定
  3393.       for action in available_actions
  3394.         if action.rating > rating_max - 3
  3395.           if value < action.rating - (rating_max - 3)
  3396.             self.current_action.kind = action.kind
  3397.             self.current_action.basic = action.basic
  3398.             self.current_action.skill_id = action.skill_id
  3399.             self.current_action.decide_random_target_for_enemy
  3400.             return
  3401.           else
  3402.             value -= action.rating - (rating_max - 3)
  3403.           end
  3404.         end
  3405.       end
  3406.     end
  3407.   end
  3408. end
  3409.  
  3410. #==============================================================================
  3411. # ■ Game_Party
  3412. #------------------------------------------------------------------------------
  3413. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3414. # ラスのインスタンスは $game_party で参照されます。
  3415. #==============================================================================
  3416.  
  3417. class Game_Party
  3418.   #--------------------------------------------------------------------------
  3419.   # ● 全滅判定
  3420.   #--------------------------------------------------------------------------
  3421.   def all_dead?
  3422.     # パーティ人数が 0 人の場合
  3423.     if $game_party.actors.size == 0
  3424.       return false
  3425.     end
  3426.     # HP 0 以上のアクターがパーティにいる場合
  3427.     for actor in @actors
  3428.       if actor.rest_hp > 0
  3429.         return false
  3430.       end
  3431.     end
  3432.     # 全滅
  3433.     return true
  3434.   end
  3435.   #--------------------------------------------------------------------------
  3436.   # ● 対象アクターのランダムな決定
  3437.   #     hp0 : HP 0 のアクターに限る
  3438.   #--------------------------------------------------------------------------
  3439.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3440.   alias :random_target_actor_rtab :random_target_actor
  3441.   def random_target_actor(hp0 = false)
  3442.     # ルーレットを初期化
  3443.     roulette = []
  3444.     # ループ
  3445.     for actor in @actors
  3446.       # 条件に該当する場合
  3447.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3448.           (hp0 and actor.hp0?)
  3449.         # アクターのクラスの [位置] を取得
  3450.         position = $data_classes[actor.class_id].position
  3451.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3452.         n = 4 - position
  3453.         # ルーレットにアクターを n 回追加
  3454.         n.times do
  3455.           roulette.push(actor)
  3456.         end
  3457.       end
  3458.     end
  3459.     # ルーレットのサイズが 0 の場合
  3460.     if roulette.size == 0
  3461.       return random_target_actor_rtab(hp0)
  3462.     end
  3463.     # ルーレットを回し、アクターを決定
  3464.     return roulette[rand(roulette.size)]
  3465.   end
  3466.   #--------------------------------------------------------------------------
  3467.   # ● 対象アクターのスムーズな決定
  3468.   #     actor_index : アクターインデックス
  3469.   #--------------------------------------------------------------------------
  3470.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3471.   alias :smooth_target_actor_rtab :smooth_target_actor
  3472.   def smooth_target_actor(actor_index)
  3473.     # アクターを取得
  3474.     actor = @actors[actor_index]
  3475.     # アクターが存在する場合
  3476.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3477.       return actor
  3478.     end
  3479.     # ループ
  3480.     for actor in @actors
  3481.       # アクターが存在する場合
  3482.       if actor.exist? and actor.rest_hp > 0
  3483.         return actor
  3484.       end
  3485.     end
  3486.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3487.     return smooth_target_actor_rtab(actor_index)
  3488.   end
  3489. end
  3490.  
  3491. #==============================================================================
  3492. # ■ Game_Troop
  3493. #------------------------------------------------------------------------------
  3494. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3495. # れます。
  3496. #==============================================================================
  3497.  
  3498. class Game_Troop
  3499.   #--------------------------------------------------------------------------
  3500.   # ● 対象エネミーのランダムな決定
  3501.   #     hp0 : HP 0 のエネミーに限る
  3502.   #--------------------------------------------------------------------------
  3503.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3504.   alias :random_target_enemy_rtab :random_target_enemy
  3505.   def random_target_enemy(hp0 = false)
  3506.     # ルーレットを初期化
  3507.     roulette = []
  3508.     # ループ
  3509.     for enemy in @enemies
  3510.       # 条件に該当する場合
  3511.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3512.           (hp0 and enemy.hp0?)
  3513.         # ルーレットにエネミーを追加
  3514.         roulette.push(enemy)
  3515.       end
  3516.     end
  3517.     # ルーレットのサイズが 0 の場合
  3518.     if roulette.size == 0
  3519.       return random_target_enemy_rtab(hp0)
  3520.     end
  3521.     # ルーレットを回し、エネミーを決定
  3522.     return roulette[rand(roulette.size)]
  3523.   end
  3524.   #--------------------------------------------------------------------------
  3525.   # ● 対象エネミーのスムーズな決定
  3526.   #     enemy_index : エネミーインデックス
  3527.   #--------------------------------------------------------------------------
  3528.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3529.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3530.   def smooth_target_enemy(enemy_index)
  3531.     # エネミーを取得
  3532.     enemy = @enemies[enemy_index]
  3533.     # エネミーが存在する場合
  3534.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3535.       return enemy
  3536.     end
  3537.     # ループ
  3538.     for enemy in @enemies
  3539.       # エネミーが存在する場合
  3540.       if enemy.exist? and enemy.rest_hp > 0
  3541.         return enemy
  3542.       end
  3543.     end
  3544.     # 敵が全滅している場合、再度敵の検索を行う
  3545.     return smooth_target_enemy_rtab(enemy_index)
  3546.   end
  3547. end
  3548.  
  3549. #==============================================================================
  3550. # ■ Sprite_Battler
  3551. #------------------------------------------------------------------------------
  3552. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3553. # スプライトの状態を自動的に変化させます。
  3554. #==============================================================================
  3555.  
  3556. class Sprite_Battler < RPG::Sprite
  3557.   #--------------------------------------------------------------------------
  3558.   # ● フレーム更新
  3559.   #--------------------------------------------------------------------------
  3560.   def update
  3561.     super
  3562.     # バトラーが nil の場合
  3563.     if @battler == nil
  3564.       self.bitmap = nil
  3565.       loop_animation(nil)
  3566.       return
  3567.     end
  3568.     # ファイル名か色相が現在のものと異なる場合
  3569.     if @battler.battler_name != @battler_name or
  3570.        @battler.battler_hue != @battler_hue
  3571.       # ビットマップを取得、設定
  3572.       @battler_name = @battler.battler_name
  3573.       @battler_hue = @battler.battler_hue
  3574.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3575.       @width = bitmap.width
  3576.       @height = bitmap.height
  3577.       self.ox = @width / 2
  3578.       self.oy = @height
  3579.       if @battler.is_a?(Game_Enemy)
  3580.         @battler.height = @height
  3581.       end
  3582.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3583.       if @battler.dead? or @battler.hidden
  3584.         self.opacity = 0
  3585.       end
  3586.     end
  3587.     # アニメーション ID が現在のものと異なる場合
  3588.     if @battler.state_animation_id != @state_animation_id
  3589.       @state_animation_id = @battler.state_animation_id
  3590.       loop_animation($data_animations[@state_animation_id])
  3591.     end
  3592.     # 表示されるべきアクターの場合
  3593.     if @battler.is_a?(Game_Actor) and @battler_visible
  3594.       # メインフェーズでないときは不透明度をやや下げる
  3595.       if $game_temp.battle_main_phase
  3596.         self.opacity += 3 if self.opacity < 255
  3597.       else
  3598.         self.opacity -= 3 if self.opacity > 207
  3599.       end
  3600.     end
  3601.     # 明滅
  3602.     if @battler.blink
  3603.       blink_on
  3604.     else
  3605.       blink_off
  3606.     end
  3607.     # 不可視の場合
  3608.     unless @battler_visible
  3609.       # 出現
  3610.       if not @battler.hidden and not @battler.dead? and
  3611.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3612.         appear
  3613.         @battler_visible = true
  3614.       end
  3615.     end
  3616.     # ダメージ
  3617.     for battler in @battler.damage_pop
  3618.       if battler[0].class == Array
  3619.         if battler[0][1] >= 0
  3620.           $scene.skill_se
  3621.         else
  3622.           $scene.levelup_se
  3623.         end
  3624.         damage(@battler.damage[battler[0]], false, 2)
  3625.       else
  3626.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3627.       end
  3628.       if @battler.damage_sp.include?(battler[0])
  3629.         damage(@battler.damage_sp[battler[0]],
  3630.                 @battler.critical[battler[0]], 1)
  3631.         @battler.damage_sp.delete(battler[0])
  3632.       end
  3633.       @battler.damage_pop.delete(battler[0])
  3634.       @battler.damage.delete(battler[0])
  3635.       @battler.critical.delete(battler[0])
  3636.     end
  3637.     # 可視の場合
  3638.     if @battler_visible
  3639.       # 逃走
  3640.       if @battler.hidden
  3641.         $game_system.se_play($data_system.escape_se)
  3642.         escape
  3643.         @battler_visible = false
  3644.       end
  3645.       # 白フラッシュ
  3646.       if @battler.white_flash
  3647.         whiten
  3648.         @battler.white_flash = false
  3649.       end
  3650.       # アニメーション
  3651.       unless @battler.animation.empty?
  3652.         for animation in @battler.animation.reverse
  3653.           animation($data_animations[animation[0]], animation[1])
  3654.           @battler.animation.delete(animation)
  3655.         end
  3656.       end
  3657.       # コラプス
  3658.       if @battler.damage.empty? and @battler.dead?
  3659.         if $scene.dead_ok?(@battler)
  3660.           if @battler.is_a?(Game_Enemy)
  3661.             $game_system.se_play($data_system.enemy_collapse_se)
  3662.           else
  3663.             $game_system.se_play($data_system.actor_collapse_se)
  3664.           end
  3665.           collapse
  3666.           @battler_visible = false
  3667.         end
  3668.       end
  3669.     end
  3670.     # スプライトの座標を設定
  3671.     self.x = @battler.screen_x
  3672.     self.y = @battler.screen_y
  3673.     self.z = @battler.screen_z
  3674.     if @battler.is_a?(Game_Enemy)
  3675.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3676.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3677.     end
  3678.   end
  3679. end
  3680.  
  3681. #==============================================================================
  3682. # ■ Window_Base
  3683. #------------------------------------------------------------------------------
  3684. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3685. #==============================================================================
  3686.  
  3687. class Window_Base < Window
  3688.   #--------------------------------------------------------------------------
  3689.   # ● ゲージの描画
  3690.   #--------------------------------------------------------------------------
  3691.   def gauge_rect_at(width, height, align3,
  3692.                     color1, color2, color3, color4, color5, color6, color7,
  3693.                     color8, color9, color10, color11, color12, grade1, grade2)
  3694.     # 枠描画
  3695.     @at_gauge = Bitmap.new(width, height * 5)
  3696.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3697.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3698.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3699.       color = color3
  3700.       color3 = color4
  3701.       color4 = color
  3702.     end
  3703.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3704.       color = color5
  3705.       color5 = color6
  3706.       color6 = color
  3707.       color = color7
  3708.       color7 = color8
  3709.       color8 = color
  3710.       color = color9
  3711.       color9 = color10
  3712.       color10 = color
  3713.       color = color11
  3714.       color11 = color12
  3715.       color12 = color
  3716.     end
  3717.     if align3 == 0
  3718.       if grade1 == 2
  3719.         grade1 = 3
  3720.       end
  3721.       if grade2 == 2
  3722.         grade2 = 3
  3723.       end
  3724.     end
  3725.     # 空ゲージの描画 縦にグラデーション表示
  3726.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3727.                                   color3, color4, grade1)
  3728.     # 実ゲージの描画
  3729.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3730.                                   color5, color6, grade2)
  3731.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3732.                                   color7, color8, grade2)
  3733.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3734.                                   color9, color10, grade2)
  3735.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3736.                                   color11, color12, grade2)
  3737.   end
  3738. end
  3739.  
  3740. #==============================================================================
  3741. # ■ Window_Help
  3742. #------------------------------------------------------------------------------
  3743. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3744. #==============================================================================
  3745.  
  3746. class Window_Help < Window_Base
  3747.   #--------------------------------------------------------------------------
  3748.   # ● エネミー設定
  3749.   #     enemy : 名前とステートを表示するエネミー
  3750.   #--------------------------------------------------------------------------
  3751.   def set_enemy(enemy)
  3752.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3753.     state_text = make_battler_state_text(enemy, 112, false)
  3754.     if state_text != ""
  3755.       text += "  " + state_text
  3756.     end
  3757.     set_text(text, 1)
  3758.   end
  3759. end
  3760.  
  3761. #==============================================================================
  3762. # ■ Window_BattleStatus
  3763. #------------------------------------------------------------------------------
  3764. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3765. #==============================================================================
  3766.  
  3767. class Window_BattleStatus < Window_Base
  3768.   #--------------------------------------------------------------------------
  3769.   # ● オブジェクト初期化
  3770.   #--------------------------------------------------------------------------
  3771.   def initialize
  3772.     x = (4 - $game_party.actors.size) * 80
  3773.     width = $game_party.actors.size * 160
  3774.     super(x, 320, width, 160)
  3775.     self.back_opacity = 160
  3776.     @actor_window = []
  3777.     for i in 0...$game_party.actors.size
  3778.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3779.     end
  3780.     @level_up_flags = [false, false, false, false]
  3781.     refresh
  3782.   end
  3783.   #--------------------------------------------------------------------------
  3784.   # ● 解放
  3785.   #--------------------------------------------------------------------------
  3786.   def dispose
  3787.     for window in @actor_window
  3788.       window.dispose
  3789.     end
  3790.     super
  3791.   end
  3792.   #--------------------------------------------------------------------------
  3793.   # ● リフレッシュ
  3794.   #--------------------------------------------------------------------------
  3795.   def refresh(number = 0)
  3796.     if number == 0
  3797.       cnt = 0
  3798.       for window in @actor_window
  3799.         window.refresh(@level_up_flags[cnt])
  3800.         cnt += 1
  3801.       end
  3802.     else
  3803.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3804.     end
  3805.   end
  3806.   #--------------------------------------------------------------------------
  3807.   # ● ATゲージリフレッシュ
  3808.   #--------------------------------------------------------------------------
  3809.   def at_refresh(number = 0)
  3810.     if number == 0
  3811.       for window in @actor_window
  3812.         window.at_refresh
  3813.       end
  3814.     else
  3815.       @actor_window[number - 1].at_refresh
  3816.     end
  3817.   end
  3818.   #--------------------------------------------------------------------------
  3819.   # ● フレーム更新
  3820.   #--------------------------------------------------------------------------
  3821.   def update
  3822.     super
  3823.     if self.x != (4 - $game_party.actors.size) * 80
  3824.       self.x = (4 - $game_party.actors.size) * 80
  3825.       self.width = $game_party.actors.size * 160
  3826.       for window in @actor_window
  3827.         window.dispose
  3828.       end
  3829.       @actor_window = []
  3830.       for i in 0...$game_party.actors.size
  3831.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3832.       end
  3833.       refresh
  3834.     end
  3835.     for window in @actor_window
  3836.       window.update
  3837.     end
  3838.   end
  3839. end
  3840.  
  3841. #==============================================================================
  3842. # ■ Window_ActorStatus
  3843. #------------------------------------------------------------------------------
  3844. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3845. #==============================================================================
  3846.  
  3847. class Window_ActorStatus < Window_Base
  3848.   #--------------------------------------------------------------------------
  3849.   # ● オブジェクト初期化
  3850.   #--------------------------------------------------------------------------
  3851.   def initialize(id, x)
  3852.     @actor_num = id
  3853.     super(x, 320, 160, 160)
  3854.     self.contents = Bitmap.new(width - 32, height - 32)
  3855.     self.opacity = 0
  3856.     self.back_opacity = 0
  3857.     actor = $game_party.actors[@actor_num]
  3858.     @actor_nm = actor.name
  3859.     @actor_mhp = actor.maxhp
  3860.     @actor_msp = actor.maxsp
  3861.     @actor_hp = actor.hp
  3862.     @actor_sp = actor.sp
  3863.     @actor_st = make_battler_state_text(actor, 120, true)
  3864.     @status_window = []
  3865.     for i in 0...5
  3866.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3867.     end
  3868.     refresh(false)
  3869.   end
  3870.   #--------------------------------------------------------------------------
  3871.   # ● 解放
  3872.   #--------------------------------------------------------------------------
  3873.   def dispose
  3874.     for i in 0...5
  3875.       @status_window[i].dispose
  3876.     end
  3877.     super
  3878.   end
  3879.   #--------------------------------------------------------------------------
  3880.   # ● リフレッシュ
  3881.   #--------------------------------------------------------------------------
  3882.   def refresh(level_up_flags)
  3883.     self.contents.clear
  3884.     actor = $game_party.actors[@actor_num]
  3885.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3886.     @status_window[1].refresh(actor) if
  3887.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3888.     @status_window[2].refresh(actor) if
  3889.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3890.     @status_window[3].refresh(actor, level_up_flags) if
  3891.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3892.     @actor_nm = actor.name
  3893.     @actor_mhp = actor.maxhp
  3894.     @actor_msp = actor.maxsp
  3895.     @actor_hp = actor.hp
  3896.     @actor_sp = actor.sp
  3897.     @actor_st = make_battler_state_text(actor, 120, true)
  3898.   end
  3899.   #--------------------------------------------------------------------------
  3900.   # ● ATゲージリフレッシュ
  3901.   #--------------------------------------------------------------------------
  3902.   def at_refresh
  3903.     @status_window[4].refresh($game_party.actors[@actor_num])
  3904.   end
  3905.   #--------------------------------------------------------------------------
  3906.   # ● フレーム更新
  3907.   #--------------------------------------------------------------------------
  3908.   def update
  3909.     for window in @status_window
  3910.       window.update
  3911.     end
  3912.   end
  3913. end
  3914.  
  3915. #==============================================================================
  3916. # ■ Window_DetailsStatus
  3917. #------------------------------------------------------------------------------
  3918. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3919. #==============================================================================
  3920.  
  3921. class Window_DetailsStatus < Window_Base
  3922.   #--------------------------------------------------------------------------
  3923.   # ● オブジェクト初期化
  3924.   #--------------------------------------------------------------------------
  3925.   def initialize(actor, id, x)
  3926.     @status_id = id
  3927.     super(x, 320 + id * 26, 160, 64)
  3928.     self.contents = Bitmap.new(width - 32, height - 32)
  3929.     self.opacity = 0
  3930.     self.back_opacity = 0
  3931.     refresh(actor, false)
  3932.   end
  3933.   #--------------------------------------------------------------------------
  3934.   # ● 解放
  3935.   #--------------------------------------------------------------------------
  3936.   def dispose
  3937.     super
  3938.   end
  3939.   #--------------------------------------------------------------------------
  3940.   # ● リフレッシュ
  3941.   #--------------------------------------------------------------------------
  3942.   def refresh(actor, level_up_flags = false)
  3943.     self.contents.clear
  3944.     case @status_id
  3945.     when 0
  3946.       draw_actor_name(actor, 4, 0)
  3947.     when 1
  3948.       draw_actor_hp(actor, 4, 0, 120)
  3949.     when 2
  3950.       draw_actor_sp(actor, 4, 0, 120)
  3951.     when 3
  3952.       if level_up_flags
  3953.         self.contents.font.color = normal_color
  3954.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3955.       else
  3956.         draw_actor_state(actor, 4, 0)
  3957.       end
  3958.     when 4
  3959.       draw_actor_atg(actor, 4, 0, 120)
  3960.     end
  3961.   end
  3962.   #--------------------------------------------------------------------------
  3963.   # ● フレーム更新
  3964.   #--------------------------------------------------------------------------
  3965.   def update
  3966.     # メインフェーズのときは不透明度をやや下げる
  3967.     if $game_temp.battle_main_phase
  3968.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3969.     else
  3970.       self.contents_opacity += 4 if self.contents_opacity < 255
  3971.     end
  3972.   end
  3973. end
  3974.  
  3975. #==============================================================================
  3976. # ■ Arrow_Base
  3977. #------------------------------------------------------------------------------
  3978. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3979. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3980. #==============================================================================
  3981.  
  3982. class Arrow_Base < Sprite
  3983.   #--------------------------------------------------------------------------
  3984.   # ● オブジェクト初期化
  3985.   #     viewport : ビューポート
  3986.   #--------------------------------------------------------------------------
  3987.   def initialize(viewport)
  3988.     super(viewport)
  3989.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3990.     self.ox = 16
  3991.     self.oy = 32
  3992.     self.z = 2500
  3993.     @blink_count = 0
  3994.     @index = 0
  3995.     @help_window = nil
  3996.     update
  3997.   end
  3998. end
  3999.  
  4000. #==============================================================================
  4001. # ■ Arrow_Enemy
  4002. #------------------------------------------------------------------------------
  4003. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  4004. # スを継承します。
  4005. #==============================================================================
  4006.  
  4007. class Arrow_Enemy < Arrow_Base
  4008.   #--------------------------------------------------------------------------
  4009.   # ● フレーム更新
  4010.   #--------------------------------------------------------------------------
  4011.   def update
  4012.     super
  4013.     # 存在しないエネミーを指していたら飛ばす
  4014.     $game_troop.enemies.size.times do
  4015.       break if self.enemy.exist?
  4016.       @index += 1
  4017.       @index %= $game_troop.enemies.size
  4018.     end
  4019.     # カーソル右
  4020.     if Input.repeat?(Input::RIGHT)
  4021.       $game_system.se_play($data_system.cursor_se)
  4022.       $game_troop.enemies.size.times do
  4023.         @index += 1
  4024.         @index %= $game_troop.enemies.size
  4025.         break if self.enemy.exist?
  4026.       end
  4027.       $scene.camera = "select"
  4028.       zoom = 1 / self.enemy.zoom
  4029.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4030.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4031.     end
  4032.     # カーソル左
  4033.     if Input.repeat?(Input::LEFT)
  4034.       $game_system.se_play($data_system.cursor_se)
  4035.       $game_troop.enemies.size.times do
  4036.         @index += $game_troop.enemies.size - 1
  4037.         @index %= $game_troop.enemies.size
  4038.         break if self.enemy.exist?
  4039.       end
  4040.       $scene.camera = "select"
  4041.       zoom = 1 / self.enemy.zoom
  4042.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4043.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4044.     end
  4045.     # スプライトの座標を設定
  4046.     if self.enemy != nil
  4047.       self.x = self.enemy.screen_x
  4048.       self.y = self.enemy.screen_y
  4049.     end
  4050.   end
  4051. end
  4052.  
  4053. #==============================================================================
  4054. # ■ Interpreter
  4055. #------------------------------------------------------------------------------
  4056. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4057. # スや Game_Event クラスの内部で使用されます。
  4058. #==============================================================================
  4059.  
  4060. class Interpreter
  4061.   #--------------------------------------------------------------------------
  4062.   # ● アクターの入れ替え
  4063.   #--------------------------------------------------------------------------
  4064.   def command_129
  4065.     # アクターを取得
  4066.     actor = $game_actors[@parameters[0]]
  4067.     # アクターが有効の場合
  4068.     if actor != nil
  4069.       # 操作で分岐
  4070.       if @parameters[1] == 0
  4071.         if @parameters[2] == 1
  4072.           $game_actors[@parameters[0]].setup(@parameters[0])
  4073.         end
  4074.         $game_party.add_actor(@parameters[0])
  4075.         if $game_temp.in_battle
  4076.           $game_actors[@parameters[0]].at = 0
  4077.           $game_actors[@parameters[0]].atp = 0
  4078.           $scene.spell_reset($game_actors[@parameters[0]])
  4079.           $game_actors[@parameters[0]].damage_pop = {}
  4080.           $game_actors[@parameters[0]].damage = {}
  4081.           $game_actors[@parameters[0]].damage_sp = {}
  4082.           $game_actors[@parameters[0]].critical = {}
  4083.           $game_actors[@parameters[0]].recover_hp = {}
  4084.           $game_actors[@parameters[0]].recover_sp = {}
  4085.           $game_actors[@parameters[0]].state_p = {}
  4086.           $game_actors[@parameters[0]].state_m = {}
  4087.           $game_actors[@parameters[0]].animation = []
  4088.         end
  4089.       else
  4090.         $game_party.remove_actor(@parameters[0])
  4091.       end
  4092.     end
  4093.     if $game_temp.in_battle
  4094.       $scene.status_window.update
  4095.     end
  4096.     # 継続
  4097.     return true
  4098.   end
  4099.   #--------------------------------------------------------------------------
  4100.   # ● HP の増減
  4101.   #--------------------------------------------------------------------------
  4102.   alias :command_311_rtab :command_311
  4103.   def command_311
  4104.     command_311_rtab
  4105.     if $game_temp.in_battle
  4106.       $scene.status_window.refresh
  4107.     end
  4108.   end
  4109.   #--------------------------------------------------------------------------
  4110.   # ● SP の増減
  4111.   #--------------------------------------------------------------------------
  4112.   alias :command_312_rtab :command_312
  4113.   def command_312
  4114.     command_312_rtab
  4115.     if $game_temp.in_battle
  4116.       $scene.status_window.refresh
  4117.     end
  4118.   end
  4119.   #--------------------------------------------------------------------------
  4120.   # ● ステートの変更
  4121.   #--------------------------------------------------------------------------
  4122.   alias :command_313_rtab :command_313
  4123.   def command_313
  4124.     command_313_rtab
  4125.     if $game_temp.in_battle
  4126.       $scene.status_window.refresh
  4127.     end
  4128.   end
  4129.   #--------------------------------------------------------------------------
  4130.   # ● 全回復
  4131.   #--------------------------------------------------------------------------
  4132.   alias :command_314_rtab :command_314
  4133.   def command_314
  4134.     command_314_rtab
  4135.     if $game_temp.in_battle
  4136.       $scene.status_window.refresh
  4137.     end
  4138.   end
  4139.   #--------------------------------------------------------------------------
  4140.   # ● EXP の増減
  4141.   #--------------------------------------------------------------------------
  4142.   alias :command_315_rtab :command_315
  4143.   def command_315
  4144.     command_315_rtab
  4145.     if $game_temp.in_battle
  4146.       $scene.status_window.refresh
  4147.     end
  4148.   end
  4149.   #--------------------------------------------------------------------------
  4150.   # ● レベルの増減
  4151.   #--------------------------------------------------------------------------
  4152.   alias :command_316_rtab :command_316
  4153.   def command_316
  4154.     command_316_rtab
  4155.     if $game_temp.in_battle
  4156.       $scene.status_window.refresh
  4157.     end
  4158.   end
  4159.   #--------------------------------------------------------------------------
  4160.   # ● パラメータの増減
  4161.   #--------------------------------------------------------------------------
  4162.   alias :command_317_rtab :command_317
  4163.   def command_317
  4164.     command_317_rtab
  4165.     if $game_temp.in_battle
  4166.       $scene.status_window.refresh
  4167.     end
  4168.   end
  4169.   #--------------------------------------------------------------------------
  4170.   # ● 装備の変更
  4171.   #--------------------------------------------------------------------------
  4172.   alias :command_319_rtab :command_319
  4173.   def command_319
  4174.     command_319_rtab
  4175.     if $game_temp.in_battle
  4176.       $scene.status_window.refresh
  4177.     end
  4178.   end
  4179.   #--------------------------------------------------------------------------
  4180.   # ● アクターの名前変更
  4181.   #--------------------------------------------------------------------------
  4182.   alias :command_320_rtab :command_320
  4183.   def command_320
  4184.     command_320_rtab
  4185.     if $game_temp.in_battle
  4186.       $scene.status_window.refresh
  4187.     end
  4188.   end
  4189.   #--------------------------------------------------------------------------
  4190.   # ● アクターのクラス変更
  4191.   #--------------------------------------------------------------------------
  4192.   alias :command_321_rtab :command_321
  4193.   def command_321
  4194.     command_321_rtab
  4195.     if $game_temp.in_battle
  4196.       $scene.status_window.refresh
  4197.     end
  4198.   end
  4199.   #--------------------------------------------------------------------------
  4200.   # ● アニメーションの表示
  4201.   #--------------------------------------------------------------------------
  4202.   def command_337
  4203.     # イテレータで処理
  4204.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4205.       # バトラーが存在する場合
  4206.       if battler.exist?
  4207.         # アニメーション ID を設定
  4208.         battler.animation.push([@parameters[2], true])
  4209.       end
  4210.     end
  4211.     # 継続
  4212.     return true
  4213.   end
  4214.   #--------------------------------------------------------------------------
  4215.   # ● ダメージの処理
  4216.   #--------------------------------------------------------------------------
  4217.   def command_338
  4218.     # 操作する値を取得
  4219.     value = operate_value(0, @parameters[2], @parameters[3])
  4220.     # イテレータで処理
  4221.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4222.       # バトラーが存在する場合
  4223.       if battler.exist?
  4224.         # HP を変更
  4225.         battler.hp -= value
  4226.         # 戦闘中なら
  4227.         if $game_temp.in_battle
  4228.           # ダメージを設定
  4229.           battler.damage["event"] = value
  4230.           battler.damage_pop["event"] = true
  4231.         end
  4232.       end
  4233.     end
  4234.     if $game_temp.in_battle
  4235.       $scene.status_window.refresh
  4236.     end
  4237.     # 継続
  4238.     return true
  4239.   end
  4240.   #--------------------------------------------------------------------------
  4241.   # ● アクションの強制
  4242.   #--------------------------------------------------------------------------
  4243.   def command_339
  4244.     # 戦闘中でなければ無視
  4245.     unless $game_temp.in_battle
  4246.       return true
  4247.     end
  4248.     # ターン数が 0 なら無視
  4249.     if $game_temp.battle_turn == 0
  4250.       return true
  4251.     end
  4252.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4253.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4254.       # バトラーが存在する場合
  4255.       if battler.exist?
  4256.         # アクションを設定
  4257.         battler.current_action.force_kind = @parameters[2]
  4258.         if battler.current_action.force_kind == 0
  4259.           battler.current_action.force_basic = @parameters[3]
  4260.         else
  4261.           battler.current_action.force_skill_id = @parameters[3]
  4262.         end
  4263.         # 行動対象を設定
  4264.         if @parameters[4] == -2
  4265.           if battler.is_a?(Game_Enemy)
  4266.             battler.current_action.decide_last_target_for_enemy
  4267.           else
  4268.             battler.current_action.decide_last_target_for_actor
  4269.           end
  4270.         elsif @parameters[4] == -1
  4271.           if battler.is_a?(Game_Enemy)
  4272.             battler.current_action.decide_random_target_for_enemy
  4273.           else
  4274.             battler.current_action.decide_random_target_for_actor
  4275.           end
  4276.         elsif @parameters[4] >= 0
  4277.           battler.current_action.target_index = @parameters[4]
  4278.         end
  4279.         # アクションが有効かつ [すぐに実行] の場合
  4280.         if battler.current_action.valid? and @parameters[5] == 1
  4281.           # 強制対象のバトラーを設定
  4282.           $game_temp.forcing_battler = battler
  4283.           # インデックスを進める
  4284.           @index += 1
  4285.           # 終了
  4286.           return false
  4287.         elsif battler.current_action.valid? and @parameters[5] == 0
  4288.           battler.current_action.forcing = true
  4289.         end
  4290.       end
  4291.     end
  4292.     # 継続
  4293.     return true
  4294.   end
  4295. end
  4296.  
  4297. #==============================================================================
  4298. # ■ Spriteモジュール
  4299. #------------------------------------------------------------------------------
  4300. #  アニメーションの管理を行うモジュールです。
  4301. #==============================================================================
  4302.  
  4303. module RPG
  4304.   class Sprite < ::Sprite
  4305.     def initialize(viewport = nil)
  4306.       super(viewport)
  4307.       @_whiten_duration = 0
  4308.       @_appear_duration = 0
  4309.       @_escape_duration = 0
  4310.       @_collapse_duration = 0
  4311.       @_damage = []
  4312.       @_animation = []
  4313.       @_animation_duration = 0
  4314.       @_blink = false
  4315.     end
  4316.     def damage(value, critical, type = 0)
  4317.       if value.is_a?(Numeric)
  4318.         damage_string = value.abs.to_s
  4319.       else
  4320.         damage_string = value.to_s
  4321.       end
  4322.       bitmap = Bitmap.new(160, 48)
  4323.       bitmap.font.name = "Arial Black"
  4324.       bitmap.font.size = 32
  4325.       bitmap.font.color.set(0, 0, 0)
  4326.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4327.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4328.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4329.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4330.       if value.is_a?(Numeric) and value < 0
  4331.         if type == 0
  4332.           bitmap.font.color.set(176, 255, 144)
  4333.         else
  4334.           bitmap.font.color.set(176, 144, 255)
  4335.         end
  4336.       else
  4337.         if type == 0
  4338.           bitmap.font.color.set(255, 255, 255)
  4339.         else
  4340.           bitmap.font.color.set(255, 176, 144)
  4341.         end
  4342.       end
  4343.       if type == 2
  4344.         bitmap.font.color.set(255, 224, 128)
  4345.       end
  4346.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4347.       if critical
  4348.         string = "CRITICAL"
  4349.         bitmap.font.size = 20
  4350.         bitmap.font.color.set(0, 0, 0)
  4351.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4352.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4353.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4354.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4355.         bitmap.font.color.set(255, 255, 255)
  4356.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4357.       end
  4358.       num = @_damage.size
  4359.       if type != 2
  4360.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4361.       else
  4362.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4363.       end
  4364.       @_damage[num][0].bitmap = bitmap
  4365.       @_damage[num][0].ox = 80 + self.viewport.ox
  4366.       @_damage[num][0].oy = 20 + self.viewport.oy
  4367.       if self.battler.is_a?(Game_Actor)
  4368.         @_damage[num][0].x = self.x
  4369.         @_damage[num][0].y = self.y - self.oy / 2
  4370.       else
  4371.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4372.                             self.ox + self.src_rect.width / 2
  4373.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4374.                             self.viewport.rect.y
  4375.         @_damage[num][0].zoom_x = self.zoom_x
  4376.         @_damage[num][0].zoom_y = self.zoom_y
  4377.         @_damage[num][0].z = 3000
  4378.       end
  4379.     end
  4380.     def animation(animation, hit)
  4381.       return if animation == nil
  4382.       num = @_animation.size
  4383.       @_animation.push([animation, hit, animation.frame_max, []])
  4384.       bitmap = RPG::Cache.animation(animation.animation_name,
  4385.                                     animation.animation_hue)
  4386.       if @@_reference_count.include?(bitmap)
  4387.         @@_reference_count[bitmap] += 1
  4388.       else
  4389.         @@_reference_count[bitmap] = 1
  4390.       end
  4391.       if @_animation[num][0].position != 3 or
  4392.           not @@_animations.include?(animation)
  4393.         for i in 0..15
  4394.           sprite = ::Sprite.new
  4395.           sprite.bitmap = bitmap
  4396.           sprite.visible = false
  4397.           @_animation[num][3].push(sprite)
  4398.         end
  4399.         unless @@_animations.include?(animation)
  4400.           @@_animations.push(animation)
  4401.         end
  4402.       end
  4403.       update_animation(@_animation[num])
  4404.     end
  4405.     def loop_animation(animation)
  4406.       return if animation == @_loop_animation
  4407.       dispose_loop_animation
  4408.       @_loop_animation = animation
  4409.       return if @_loop_animation == nil
  4410.       @_loop_animation_index = 0
  4411.       animation_name = @_loop_animation.animation_name
  4412.       animation_hue = @_loop_animation.animation_hue
  4413.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4414.       if @@_reference_count.include?(bitmap)
  4415.         @@_reference_count[bitmap] += 1
  4416.       else
  4417.         @@_reference_count[bitmap] = 1
  4418.       end
  4419.       @_loop_animation_sprites = []
  4420.       for i in 0..15
  4421.         sprite = ::Sprite.new
  4422.         sprite.bitmap = bitmap
  4423.         sprite.visible = false
  4424.         @_loop_animation_sprites.push(sprite)
  4425.       end
  4426.       # update_loop_animation
  4427.     end
  4428.     def dispose_damage
  4429.       for damage in @_damage.reverse
  4430.         damage[0].bitmap.dispose
  4431.         damage[0].dispose
  4432.         @_damage.delete(damage)
  4433.       end
  4434.     end
  4435.     def dispose_animation
  4436.       for anime in @_animation.reverse
  4437.         sprite = anime[3][0]
  4438.         if sprite != nil
  4439.           @@_reference_count[sprite.bitmap] -= 1
  4440.           if @@_reference_count[sprite.bitmap] == 0
  4441.             sprite.bitmap.dispose
  4442.           end
  4443.         end
  4444.         for sprite in anime[3]
  4445.           sprite.dispose
  4446.         end
  4447.         @_animation.delete(anime)
  4448.       end
  4449.     end
  4450.     def effect?
  4451.       @_whiten_duration > 0 or
  4452.       @_appear_duration > 0 or
  4453.       @_escape_duration > 0 or
  4454.       @_collapse_duration > 0 or
  4455.       @_damage.size == 0 or
  4456.       @_animation.size == 0
  4457.     end
  4458.     def update
  4459.       super
  4460.       if @_whiten_duration > 0
  4461.         @_whiten_duration -= 1
  4462.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4463.       end
  4464.       if @_appear_duration > 0
  4465.         @_appear_duration -= 1
  4466.         self.opacity = (16 - @_appear_duration) * 16
  4467.       end
  4468.       if @_escape_duration > 0
  4469.         @_escape_duration -= 1
  4470.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4471.       end
  4472.       if @_collapse_duration > 0
  4473.         @_collapse_duration -= 1
  4474.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4475.       end
  4476.       for damage in @_damage
  4477.         if damage[1] > 0
  4478.           damage[1] -= 1
  4479.           damage[4] -= 3
  4480.           damage[2] -= damage[4]
  4481.           if self.battler.is_a?(Game_Actor)
  4482.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4483.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4484.           else
  4485.             damage[0].x = self.x + self.viewport.rect.x -
  4486.                           self.ox + self.src_rect.width / 2 +
  4487.                           (40 - damage[1]) * damage[3] / 10
  4488.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4489.                           self.viewport.rect.y + damage[2] / 10
  4490.             damage[0].zoom_x = self.zoom_x
  4491.             damage[0].zoom_y = self.zoom_y
  4492.           end
  4493.           damage[0].z = 2960 + damage[1]
  4494.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4495.           if damage[1] == 0
  4496.             damage[0].bitmap.dispose
  4497.             damage[0].dispose
  4498.             @_damage.delete(damage)
  4499.           end
  4500.         end
  4501.       end
  4502.       for anime in @_animation
  4503.         if (Graphics.frame_count % 2 == 0)
  4504.           anime[2] -= 1
  4505.           update_animation(anime)
  4506.         end
  4507.       end
  4508.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4509.         update_loop_animation
  4510.         @_loop_animation_index += 1
  4511.         @_loop_animation_index %= @_loop_animation.frame_max
  4512.       end
  4513.       if @_blink
  4514.         @_blink_count = (@_blink_count + 1) % 32
  4515.         if @_blink_count < 16
  4516.           alpha = (16 - @_blink_count) * 6
  4517.         else
  4518.           alpha = (@_blink_count - 16) * 6
  4519.         end
  4520.         self.color.set(255, 255, 255, alpha)
  4521.       end
  4522.       @@_animations.clear
  4523.     end
  4524.     def update_animation(anime)
  4525.       if anime[2] > 0
  4526.         frame_index = anime[0].frame_max - anime[2]
  4527.         cell_data = anime[0].frames[frame_index].cell_data
  4528.         position = anime[0].position
  4529.         animation_set_sprites(anime[3], cell_data, position)
  4530.         for timing in anime[0].timings
  4531.           if timing.frame == frame_index
  4532.             animation_process_timing(timing, anime[1])
  4533.           end
  4534.         end
  4535.       else
  4536.         @@_reference_count[anime[3][0].bitmap] -= 1
  4537.         if @@_reference_count[anime[3][0].bitmap] == 0
  4538.             anime[3][0].bitmap.dispose
  4539.         end
  4540.         for sprite in anime[3]
  4541.           sprite.dispose
  4542.         end
  4543.         @_animation.delete(anime)
  4544.       end
  4545.     end
  4546.     def animation_set_sprites(sprites, cell_data, position)
  4547.       for i in 0..15
  4548.         sprite = sprites[i]
  4549.         pattern = cell_data[i, 0]
  4550.         if sprite == nil or pattern == nil or pattern == -1
  4551.           sprite.visible = false if sprite != nil
  4552.           next
  4553.         end
  4554.         sprite.visible = true
  4555.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4556.         if position == 3
  4557.           if self.viewport != nil
  4558.             sprite.x = self.viewport.rect.width / 2
  4559.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4560.               sprite.y = self.viewport.rect.height - 320
  4561.             else
  4562.               sprite.y = self.viewport.rect.height - 160
  4563.             end
  4564.           else
  4565.             sprite.x = 320
  4566.             sprite.y = 240
  4567.           end
  4568.         else
  4569.           sprite.x = self.x + self.viewport.rect.x -
  4570.                       self.ox + self.src_rect.width / 2
  4571.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4572.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4573.                         self.viewport.rect.y
  4574.             if position == 0
  4575.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4576.             elsif position == 2
  4577.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4578.             end
  4579.           else
  4580.             sprite.y = self.y + self.viewport.rect.y -
  4581.                         self.oy + self.src_rect.height / 2
  4582.             sprite.y -= self.src_rect.height / 4 if position == 0
  4583.             sprite.y += self.src_rect.height / 4 if position == 2
  4584.           end
  4585.         end
  4586.         sprite.x += cell_data[i, 1]
  4587.         sprite.y += cell_data[i, 2]
  4588.         sprite.z = 2000
  4589.         sprite.ox = 96
  4590.         sprite.oy = 96
  4591.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4592.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4593.         if position != 3
  4594.           sprite.zoom_x *= self.zoom_x
  4595.           sprite.zoom_y *= self.zoom_y
  4596.         end
  4597.         sprite.angle = cell_data[i, 4]
  4598.         sprite.mirror = (cell_data[i, 5] == 1)
  4599.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4600.         sprite.blend_type = cell_data[i, 7]
  4601.       end
  4602.     end
  4603.     def x=(x)
  4604.       sx = x - self.x
  4605.       if sx != 0
  4606.         for anime in @_animation
  4607.           if anime[3] != nil
  4608.             for i in 0..15
  4609.               anime[3][i].x += sx
  4610.             end
  4611.           end
  4612.         end
  4613.         if @_loop_animation_sprites != nil
  4614.           for i in 0..15
  4615.             @_loop_animation_sprites[i].x += sx
  4616.           end
  4617.         end
  4618.       end
  4619.       super
  4620.     end
  4621.     def y=(y)
  4622.       sy = y - self.y
  4623.       if sy != 0
  4624.         for anime in @_animation
  4625.           if anime[3] != nil
  4626.             for i in 0..15
  4627.               anime[3][i].y += sy
  4628.             end
  4629.           end
  4630.         end
  4631.         if @_loop_animation_sprites != nil
  4632.           for i in 0..15
  4633.             @_loop_animation_sprites[i].y += sy
  4634.           end
  4635.         end
  4636.       end
  4637.       super
  4638.     end
  4639.   end
  4640. end
  4641.  
  4642. #------------------------------------------------------------------------------
  4643. #  Bitmapクラスに新たな機能を追加します。
  4644. #==============================================================================
  4645.  
  4646. class Bitmap
  4647.   #--------------------------------------------------------------------------
  4648.   # ● 矩形をグラデーション表示
  4649.   #     color1 : スタートカラー
  4650.   #     color2 : エンドカラー
  4651.   #     align  :  0:横にグラデーション
  4652.   #               1:縦にグラデーション
  4653.   #               2:斜めにグラデーション(激重につき注意)
  4654.   #--------------------------------------------------------------------------
  4655.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4656.     if align == 0
  4657.       for i in x...x + width
  4658.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4659.         green = color1.green +
  4660.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4661.         blue  = color1.blue +
  4662.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4663.         alpha = color1.alpha +
  4664.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4665.         color = Color.new(red, green, blue, alpha)
  4666.         fill_rect(i, y, 1, height, color)
  4667.       end
  4668.     elsif align == 1
  4669.       for i in y...y + height
  4670.         red   = color1.red +
  4671.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4672.         green = color1.green +
  4673.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4674.         blue  = color1.blue +
  4675.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4676.         alpha = color1.alpha +
  4677.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4678.         color = Color.new(red, green, blue, alpha)
  4679.         fill_rect(x, i, width, 1, color)
  4680.       end
  4681.     elsif align == 2
  4682.       for i in x...x + width
  4683.         for j in y...y + height
  4684.           red   = color1.red + (color2.red - color1.red) *
  4685.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4686.           green = color1.green + (color2.green - color1.green) *
  4687.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4688.           blue  = color1.blue + (color2.blue - color1.blue) *
  4689.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4690.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4691.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4692.           color = Color.new(red, green, blue, alpha)
  4693.           set_pixel(i, j, color)
  4694.         end
  4695.       end
  4696.     elsif align == 3
  4697.       for i in x...x + width
  4698.         for j in y...y + height
  4699.           red   = color1.red + (color2.red - color1.red) *
  4700.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4701.           green = color1.green + (color2.green - color1.green) *
  4702.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4703.           blue  = color1.blue + (color2.blue - color1.blue) *
  4704.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4705.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4706.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4707.           color = Color.new(red, green, blue, alpha)
  4708.           set_pixel(i, j, color)
  4709.         end
  4710.       end
  4711.     end
  4712.   end
  4713. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-8 20:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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