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

Project1

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

[已经过期] 关于连击脚本。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
103
在线时间
159 小时
注册时间
2010-7-4
帖子
44
跳转到指定楼层
1
发表于 2013-8-14 20:26:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用了这个RTAB战斗系统,和搜索到的连击效果(完美版)不能一起用啊,有没有其他的连击脚本啊?
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. # リアルタイム・アクティブバトル(RTAB) Ver 1.05
  5. # 配布元・サポートURL
  6. # http://members.jcom.home.ne.jp/cogwheel/

  7. class Scene_Battle
  8.   #--------------------------------------------------------------------------
  9.   # ● 公開インスタンス変数
  10.   #--------------------------------------------------------------------------
  11.   attr_reader   :status_window            # ステータスウィンドウ
  12.   attr_reader   :spriteset                # バトルスプライト
  13.   attr_reader   :scroll_time              # スクリーン移動基本時間
  14.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  15.   attr_reader   :drive                    # カメラ駆動
  16.   attr_accessor :force                    # アクション強制度
  17.   attr_accessor :camera                   # 現在のカメラ所持者
  18.   #--------------------------------------------------------------------------
  19.   # ● ATB基礎セットアップ
  20.   #--------------------------------------------------------------------------
  21.   def atb_setup
  22.     # ATB初期化
  23.     # speed   : バトルスピード決定。値が小さいほど早い
  24.     # @active : アクティブ度設定
  25.     #           3 : 常にアクティブ状態
  26.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  27.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  28.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  29.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  30.     #           3 : 自分が行動不能でない限り限り許す
  31.     #           2 : 自分がダメージを受けていない限り許す
  32.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  33.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  34.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  35.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  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 = 2
  52.     @anime_wait = false
  53.     @damage_wait = 10
  54.     @enemy_speed = 40
  55.     @force = 2
  56.     @drive = true
  57.     @scroll_time = 15
  58.     @zoom_rate = [0.2, 1.0]
  59.     @help_time = 40
  60.     @escape == false
  61.     @camera = nil
  62.     @max = 0
  63.     @turn_cnt = 0
  64.     @help_wait = 0
  65.     @action_battlers = []
  66.     @synthe = []
  67.     @spell_p = {}
  68.     @spell_e = {}
  69.     @command_a = false
  70.     @command = []
  71.     @party = false
  72.     for battler in $game_party.actors + $game_troop.enemies
  73.       spell_reset(battler)
  74.       battler.at = battler.agi * rand(speed / 2)
  75.       battler.damage_pop = {}
  76.       battler.damage = {}
  77.       battler.damage_sp = {}
  78.       battler.critical = {}
  79.       battler.recover_hp = {}
  80.       battler.recover_sp = {}
  81.       battler.state_p = {}
  82.       battler.state_m = {}
  83.       battler.animation = []
  84.       if battler.is_a?(Game_Actor)
  85.         @max += battler.agi
  86.       end
  87.     end
  88.     @max *= speed
  89.     @max /= $game_party.actors.size
  90.     for battler in $game_party.actors + $game_troop.enemies
  91.       battler.atp = 100 * battler.at / @max
  92.     end
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● ATゲージMax時SE
  96.   #--------------------------------------------------------------------------
  97.   def fullat_se
  98.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● レベルアップSE
  102.   #--------------------------------------------------------------------------
  103.   def levelup_se
  104.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● スキル習得SE
  108.   #--------------------------------------------------------------------------
  109.   def skill_se
  110.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  111.   end
  112. end

  113. class Window_Base < Window
  114.   #--------------------------------------------------------------------------
  115.   # ● ATG の描画
  116.   #     actor : アクター
  117.   #     x     : 描画先 X 座標
  118.   #     y     : 描画先 Y 座標
  119.   #     width : 描画先の幅
  120.   #--------------------------------------------------------------------------
  121.   def draw_actor_atg(actor, x, y, width = 144)
  122.     if @at_gauge == nil
  123.       # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  124.       # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  125.       # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  126.       # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  127.       # align3:ゲージタイプ 0:左詰め 1:右詰め
  128.       @plus_x = 0
  129.       @rate_x = 0
  130.       @plus_y = 16
  131.       @plus_width = 0
  132.       @rate_width = 100
  133.       @width = @plus_width + width * @rate_width / 100
  134.       @height = 16
  135.       @align1 = 0
  136.       @align2 = 1
  137.       @align3 = 0
  138.       # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  139.       # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
  140.       grade1 = 1
  141.       grade2 = 0
  142.       # 色設定。color1:最外枠,color2:中枠
  143.       # color3:空枠ダークカラー,color4:空枠ライトカラー
  144.       color1 = Color.new(0, 0, 0)
  145.       color2 = Color.new(255, 255, 192)
  146.       color3 = Color.new(0, 0, 0, 192)
  147.       color4 = Color.new(0, 0, 64, 192)
  148.       # ゲージの色設定
  149.       # 通常時の色設定
  150.       color5 = Color.new(0, 64, 80)
  151.       color6 = Color.new(0, 128, 160)
  152.       # ゲージがMAXの時の色設定
  153.       color7 = Color.new(80, 0, 0)
  154.       color8 = Color.new(240, 0, 0)
  155.       # 連携スキル使用時の色設定
  156.       color9 = Color.new(80, 64, 32)
  157.       color10 = Color.new(240, 192, 96)
  158.       # スキル詠唱時の色設定
  159.       color11 = Color.new(80, 0, 64)
  160.       color12 = Color.new(240, 0, 192)
  161.       # ゲージの描画
  162.       gauge_rect_at(@width, @height, @align3, color1, color2,
  163.                   color3, color4, color5, color6, color7, color8,
  164.                   color9, color10, color11, color12, grade1, grade2)
  165.     end
  166.     # 変数atに描画するゲージの幅を代入
  167.     if actor.rtp == 0
  168.       at = (width + @plus_width) * actor.atp * @rate_width / 10000
  169.     else
  170.       at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
  171.     end
  172.     if at > width
  173.       at = width
  174.     end
  175.     # ゲージの左詰・中央構え等の補正
  176.     case @align1
  177.     when 1
  178.       x += (@rect_width - width) / 2
  179.     when 2
  180.       x += @rect_width - width
  181.     end
  182.     case @align2
  183.     when 1
  184.       y -= @height / 2
  185.     when 2
  186.       y -= @height
  187.     end
  188.     self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
  189.                       @at_gauge, Rect.new(0, 0, @width, @height))
  190.     if @align3 == 0
  191.       rect_x = 0
  192.     else
  193.       x += @width - at - 1
  194.       rect_x = @width - at - 1
  195.     end
  196.     # ゲージの色設定
  197.     if at == width
  198.         # MAX時のゲージ描画
  199.       self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  200.                         @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
  201.     else
  202.       if actor.rtp == 0
  203.         # 通常時のゲージ描画
  204.         self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  205.                           @at_gauge, Rect.new(rect_x, @height, at, @height))
  206.       else
  207.         if actor.spell == true
  208.           # 連携スキル使用時のゲージ描画
  209.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  210.                         @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
  211.         else
  212.           # スキル詠唱時のゲージ描画
  213.           self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
  214.                         @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
  215.         end
  216.       end
  217.     end
  218.   end
  219. end

  220. #==============================================================================
  221. # ■ Scene_Battle (分割定義 1)
  222. #------------------------------------------------------------------------------
  223. #  バトル画面の処理を行うクラスです。
  224. #==============================================================================

  225. class Scene_Battle
  226.   #--------------------------------------------------------------------------
  227.   # ● メイン処理
  228.   #--------------------------------------------------------------------------
  229.   def main
  230.     # 戦闘用の各種一時データを初期化
  231.     $game_temp.in_battle = true
  232.     $game_temp.battle_turn = 0
  233.     $game_temp.battle_event_flags.clear
  234.     $game_temp.battle_abort = false
  235.     $game_temp.battle_main_phase = false
  236.     $game_temp.battleback_name = $game_map.battleback_name
  237.     $game_temp.forcing_battler = nil
  238.     # バトルイベント用インタプリタを初期化
  239.     $game_system.battle_interpreter.setup(nil, 0)
  240.     # トループを準備
  241.     @troop_id = $game_temp.battle_troop_id
  242.     $game_troop.setup(@troop_id)
  243.     atb_setup
  244.     # アクターコマンドウィンドウを作成
  245.     s1 = $data_system.words.attack
  246.     s2 = $data_system.words.skill
  247.     s3 = $data_system.words.guard
  248.     s4 = $data_system.words.item
  249.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  250.     @actor_command_window.y = 160
  251.     @actor_command_window.back_opacity = 160
  252.     @actor_command_window.active = false
  253.     @actor_command_window.visible = false
  254.     # その他のウィンドウを作成
  255.     @party_command_window = Window_PartyCommand.new
  256.     @help_window = Window_Help.new
  257.     @help_window.back_opacity = 160
  258.     @help_window.visible = false
  259.     @status_window = Window_BattleStatus.new
  260.     @message_window = Window_Message.new
  261.     # スプライトセットを作成
  262.     @spriteset = Spriteset_Battle.new
  263.     # ウェイトカウントを初期化
  264.     @wait_count = 0
  265.     # トランジション実行
  266.     if $data_system.battle_transition == ""
  267.       Graphics.transition(20)
  268.     else
  269.       Graphics.transition(40, "Graphics/Transitions/" +
  270.         $data_system.battle_transition)
  271.     end
  272.     # プレバトルフェーズ開始
  273.     start_phase1
  274.     # メインループ
  275.     loop do
  276.       # ゲーム画面を更新
  277.       Graphics.update
  278.       # 入力情報を更新
  279.       Input.update
  280.       # フレーム更新
  281.       update
  282.       # 画面が切り替わったらループを中断
  283.       if $scene != self
  284.         break
  285.       end
  286.     end
  287.     # マップをリフレッシュ
  288.     $game_map.refresh
  289.     # トランジション準備
  290.     Graphics.freeze
  291.     # ウィンドウを解放
  292.     @actor_command_window.dispose
  293.     @party_command_window.dispose
  294.     @help_window.dispose
  295.     @status_window.dispose
  296.     @message_window.dispose
  297.     if @skill_window != nil
  298.       @skill_window.dispose
  299.     end
  300.     if @item_window != nil
  301.       @item_window.dispose
  302.     end
  303.     if @result_window != nil
  304.       @result_window.dispose
  305.     end
  306.     # スプライトセットを解放
  307.     @spriteset.dispose
  308.     # タイトル画面に切り替え中の場合
  309.     if $scene.is_a?(Scene_Title)
  310.       # 画面をフェードアウト
  311.       Graphics.transition
  312.       Graphics.freeze
  313.     end
  314.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  315.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  316.       $scene = nil
  317.     end
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● 勝敗判定
  321.   #--------------------------------------------------------------------------
  322.   def judge
  323.     # 全滅判定が真、またはパーティ人数が 0 人の場合
  324.     if $game_party.all_dead? or $game_party.actors.size == 0
  325.       # 敗北可能の場合
  326.       if $game_temp.battle_can_lose
  327.         # バトル開始前の BGM に戻す
  328.         $game_system.bgm_play($game_temp.map_bgm)
  329.         # バトル終了
  330.         battle_end(2)
  331.         # true を返す
  332.         return true
  333.       end
  334.       # ゲームオーバーフラグをセット
  335.       $game_temp.gameover = true
  336.       # true を返す
  337.       return true
  338.     end
  339.     # エネミーが 1 体でも存在すれば false を返す
  340.     for enemy in $game_troop.enemies
  341.       if enemy.exist?
  342.         return false
  343.       end
  344.     end
  345.     # アフターバトルフェーズ開始 (勝利)
  346.     start_phase5
  347.     # true を返す
  348.     return true
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● フレーム更新
  352.   #--------------------------------------------------------------------------
  353.   def update
  354.     # バトルイベント実行中の場合
  355.     if $game_system.battle_interpreter.running?
  356.       if @command.size > 0
  357.         @command_a = false
  358.         @command = []
  359.         command_delete
  360.       end
  361.       @status_window.at_refresh
  362.       # インタプリタを更新
  363.       $game_system.battle_interpreter.update
  364.       # アクションを強制されているバトラーが存在しない場合
  365.       if $game_temp.forcing_battler == nil
  366.         # バトルイベントの実行が終わった場合
  367.         unless $game_system.battle_interpreter.running?
  368.           # バトルイベントのセットアップを再実行
  369.           @status_window.refresh
  370.           setup_battle_event
  371.         end
  372.       end
  373.     end
  374.     # システム (タイマー)、画面を更新
  375.     $game_system.update
  376.     $game_screen.update
  377.     # タイマーが 0 になった場合
  378.     if $game_system.timer_working and $game_system.timer == 0
  379.       # バトル中断
  380.       $game_temp.battle_abort = true
  381.     end
  382.     # ウィンドウを更新
  383.     @help_window.update
  384.     @party_command_window.update
  385.     @actor_command_window.update
  386.     @status_window.update
  387.     @message_window.update
  388.     # スプライトセットを更新
  389.     @spriteset.update
  390.     # トランジション処理中の場合
  391.     if $game_temp.transition_processing
  392.       # トランジション処理中フラグをクリア
  393.       $game_temp.transition_processing = false
  394.       # トランジション実行
  395.       if $game_temp.transition_name == ""
  396.         Graphics.transition(20)
  397.       else
  398.         Graphics.transition(40, "Graphics/Transitions/" +
  399.           $game_temp.transition_name)
  400.       end
  401.     end
  402.     # メッセージウィンドウ表示中の場合
  403.     if $game_temp.message_window_showing
  404.       return
  405.     end
  406.     # ゲームオーバーの場合
  407.     if $game_temp.gameover
  408.       # ゲームオーバー画面に切り替え
  409.       $scene = Scene_Gameover.new
  410.       return
  411.     end
  412.     # タイトル画面に戻す場合
  413.     if $game_temp.to_title
  414.       # タイトル画面に切り替え
  415.       $scene = Scene_Title.new
  416.       return
  417.     end
  418.     # バトル中断の場合
  419.     if $game_temp.battle_abort
  420.       # バトル開始前の BGM に戻す
  421.       $game_system.bgm_play($game_temp.map_bgm)
  422.       # バトル終了
  423.       battle_end(1)
  424.       return
  425.     end
  426.     # ヘルプウィンドウ表示中の場合
  427.     if @help_wait > 0
  428.       @help_wait -= 1
  429.       if @help_wait == 0
  430.         # ヘルプウィンドウを隠す
  431.         @help_window.visible = false
  432.       end
  433.     end
  434.     # フェーズによって分岐
  435.     case @phase
  436.     when 0  # ATゲージ更新フェーズ
  437.       if anime_wait_return
  438.         update_phase0
  439.       end
  440.     when 1  # プレバトルフェーズ
  441.       update_phase1
  442.       return
  443.     when 2  # パーティコマンドフェーズ
  444.       update_phase2
  445.       return
  446.     when 5  # アフターバトルフェーズ
  447.       update_phase5
  448.       return
  449.     end
  450.     if $scene != self
  451.       return
  452.     end
  453.     if @phase == 0
  454.       if @command.size != 0  # アクターコマンドフェーズ
  455.         if @command_a == false
  456.           start_phase3
  457.         end
  458.         update_phase3
  459.       end
  460.       # ウェイト中の場合
  461.       if @wait_count > 0
  462.         # ウェイトカウントを減らす
  463.         @wait_count -= 1
  464.         return
  465.       end
  466.       update_phase4
  467.     end
  468.   end

  469. #==============================================================================
  470. # ■ Scene_Battle (分割定義 2)
  471. #------------------------------------------------------------------------------
  472. #  バトル画面の処理を行うクラスです。
  473. #==============================================================================

  474.   #--------------------------------------------------------------------------
  475.   # ● フレーム更新 (ATゲージ更新フェーズ)
  476.   #--------------------------------------------------------------------------
  477.   def update_phase0
  478.     if $game_temp.battle_turn == 0
  479.       $game_temp.battle_turn = 1
  480.     end
  481.     # B ボタンが押された場合
  482.     if @command_a == false and @party == false
  483.       if Input.trigger?(Input::B)
  484.         # キャンセル SE を演奏
  485.         $game_system.se_play($data_system.cancel_se)
  486.         @party = true
  487.       end
  488.     end
  489.     if @party == true and
  490.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  491.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  492.       # パーティコマンドフェーズへ
  493.       start_phase2
  494.       return
  495.     end
  496.     # ATゲージ増加処理
  497.     cnt = 0
  498.     for battler in $game_party.actors + $game_troop.enemies
  499.       active?(battler)
  500.       if battler.rtp == 0
  501.         if battler.at >= @max
  502.           if battler.is_a?(Game_Actor)
  503.             if battler.inputable?
  504.               unless @action_battlers.include?(battler) or
  505.                   @command.include?(battler) or @escape == true
  506.                 if battler.current_action.forcing
  507.                   fullat_se
  508.                   force_action(battler)
  509.                   action_start(battler)
  510.                 else
  511.                   fullat_se
  512.                   @command.push(battler)
  513.                 end
  514.               end
  515.             else
  516.               unless @action_battlers.include?(battler) or
  517.                       battler == @command[0]
  518.                 battler.current_action.clear
  519.                 if @command.include?(battler)
  520.                   @command.delete(battler)
  521.                 else
  522.                   if battler.movable?
  523.                     fullat_se
  524.                   end
  525.                 end
  526.                 action_start(battler)
  527.               end
  528.             end
  529.           else
  530.             unless @action_battlers.include?(battler)
  531.               if battler.current_action.forcing
  532.                 force_action(battler)
  533.                 action_start(battler)
  534.               else
  535.                 if @enemy_speed != 0
  536.                   if rand(@enemy_speed) == 0
  537.                     number = cnt - $game_party.actors.size
  538.                     enemy_action(number)
  539.                   end
  540.                 else
  541.                   number = cnt - $game_party.actors.size
  542.                   enemy_action(number)
  543.                 end
  544.               end
  545.             end
  546.           end
  547.         else
  548.           battler.at += battler.agi
  549.           if battler.guarding?
  550.             battler.at += battler.agi
  551.           end
  552.           if battler.movable?
  553.             battler.atp = 100 * battler.at / @max
  554.           end
  555.         end
  556.       else
  557.         if battler.rt >= battler.rtp
  558.           speller = synthe?(battler)
  559.           if speller != nil
  560.             battler = speller[0]
  561.           end
  562.           unless @action_battlers.include?(battler)
  563.             if battler.is_a?(Game_Actor)
  564.               fullat_se
  565.             end
  566.             battler.rt = battler.rtp
  567.             action_start(battler)
  568.           end
  569.         else
  570.           battler.rt += battler.agi
  571.           speller = synthe?(battler)
  572.           if speller != nil
  573.             for spell in speller
  574.               if spell != battler
  575.                 spell.rt += battler.agi
  576.               end
  577.             end
  578.           end
  579.         end
  580.       end
  581.       cnt += 1
  582.     end
  583.     # ATゲージをリフレッシュ
  584.     @status_window.at_refresh
  585.     # 逃走処理
  586.     if @escape == true and
  587.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  588.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  589.       temp = false
  590.       for battler in $game_party.actors
  591.         if battler.inputable?
  592.           temp = true
  593.         end
  594.       end
  595.       if temp == true
  596.         for battler in $game_party.actors
  597.           if battler.at < @max and battler.inputable?
  598.             temp = false
  599.             break
  600.           end
  601.         end
  602.         if temp == true
  603.           @escape = false
  604.           for battler in $game_party.actors
  605.             battler.at %= @max
  606.           end
  607.           $game_temp.battle_main_phase = false
  608.           update_phase2_escape
  609.         end
  610.       end
  611.     end
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● パーティコマンドフェーズ開始
  615.   #--------------------------------------------------------------------------
  616.   def start_phase2
  617.     # フェーズ 2 に移行
  618.     @phase = 2
  619.     @party = false
  620.     # パーティコマンドウィンドウを有効化
  621.     @party_command_window.active = true
  622.     @party_command_window.visible = true
  623.     # アクターを非選択状態に設定
  624.     @actor_index = -1
  625.     # アクターコマンドウィンドウを無効化
  626.     @actor_command_window.active = false
  627.     @actor_command_window.visible = false
  628.     if @command.size != 0
  629.       # アクターの明滅エフェクト OFF
  630.       if @active_actor != nil
  631.         @active_actor.blink = false
  632.       end
  633.     end
  634.     # カメラセット
  635.     @camera == "party"
  636.     @spriteset.screen_target(0, 0, 1)
  637.     # メインフェーズフラグをクリア
  638.     $game_temp.battle_main_phase = false
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # ● フレーム更新 (パーティコマンドフェーズ)
  642.   #--------------------------------------------------------------------------
  643.   def update_phase2
  644.     # C ボタンが押された場合
  645.     if Input.trigger?(Input::C)
  646.       # パーティコマンドウィンドウのカーソル位置で分岐
  647.       case @party_command_window.index
  648.       when 0  # 戦う
  649.         # パーティコマンドウィンドウを無効化
  650.         @party_command_window.active = false
  651.         @party_command_window.visible = false
  652.         # 決定 SE を演奏
  653.         $game_system.se_play($data_system.decision_se)
  654.         @escape = false
  655.         @phase = 0
  656.         if $game_temp.battle_turn == 0
  657.           $game_temp.battle_turn = 1
  658.         end
  659.         if @command_a == true
  660.           # アクターコマンドフェーズ開始
  661.           start_phase3
  662.         else
  663.           $game_temp.battle_main_phase = true
  664.         end
  665.       when 1  # 逃げる
  666.         # 逃走可能ではない場合
  667.         if $game_temp.battle_can_escape == false
  668.           # ブザー SE を演奏
  669.           $game_system.se_play($data_system.buzzer_se)
  670.           return
  671.         end
  672.         # 決定 SE を演奏
  673.         $game_system.se_play($data_system.decision_se)
  674.         @phase = 0
  675.         # パーティコマンドウィンドウを無効化
  676.         @party_command_window.active = false
  677.         @party_command_window.visible = false
  678.         $game_temp.battle_main_phase = true
  679.         if $game_temp.battle_turn == 0
  680.           update_phase2_escape
  681.           $game_temp.battle_turn = 1
  682.           for battler in $game_party.actors
  683.             battler.at -= @max / 2
  684.           end
  685.           return
  686.         end
  687.         # 決定 SE を演奏
  688.         $game_system.se_play($data_system.decision_se)
  689.         @escape = true
  690.         for battler in $game_party.actors
  691.           @command_a = false
  692.           @command.delete(battler)
  693.           @action_battlers.delete(battler)
  694.           skill_reset(battler)
  695.         end
  696.       end
  697.       return
  698.     end
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # ● アフターバトルフェーズ開始
  702.   #--------------------------------------------------------------------------
  703.   def start_phase5
  704.     # フェーズ 5 に移行
  705.     @phase = 5
  706.     # バトル終了 ME を演奏
  707.     $game_system.me_play($game_system.battle_end_me)
  708.     # バトル開始前の BGM に戻す
  709.     $game_system.bgm_play($game_temp.map_bgm)
  710.     # EXP、ゴールド、トレジャーを初期化
  711.     exp = 0
  712.     gold = 0
  713.     treasures = []
  714.     if @active_actor != nil
  715.       @active_actor.blink = false
  716.     end
  717.     # メインフェーズフラグをセット
  718.     $game_temp.battle_main_phase = true
  719.     # パーティコマンドウィンドウを無効化
  720.     @party_command_window.active = false
  721.     @party_command_window.visible = false
  722.     # アクターコマンドウィンドウを無効化
  723.     @actor_command_window.active = false
  724.     @actor_command_window.visible = false
  725.     if @skill_window != nil
  726.       # スキルウィンドウを解放
  727.       @skill_window.dispose
  728.       @skill_window = nil
  729.     end
  730.     if @item_window != nil
  731.       # アイテムウィンドウを解放
  732.       @item_window.dispose
  733.       @item_window = nil
  734.     end
  735.     # ヘルプウィンドウを隠す
  736.     @help_window.visible = false
  737.     # ループ
  738.     for enemy in $game_troop.enemies
  739.       # エネミーが隠れ状態でない場合
  740.       unless enemy.hidden
  741.         # 獲得 EXP、ゴールドを追加
  742.         exp += enemy.exp
  743.         gold += enemy.gold
  744.         # トレジャー出現判定
  745.         if rand(100) < enemy.treasure_prob
  746.           if enemy.item_id > 0
  747.             treasures.push($data_items[enemy.item_id])
  748.           end
  749.           if enemy.weapon_id > 0
  750.             treasures.push($data_weapons[enemy.weapon_id])
  751.           end
  752.           if enemy.armor_id > 0
  753.             treasures.push($data_armors[enemy.armor_id])
  754.           end
  755.         end
  756.       end
  757.     end
  758.     # トレジャーの数を 6 個までに限定
  759.     treasures = treasures[0..5]
  760.     # EXP 獲得
  761.     for i in 0...$game_party.actors.size
  762.       actor = $game_party.actors[i]
  763.       if actor.cant_get_exp? == false
  764.         last_level = actor.level
  765.         actor.exp += exp
  766.         if actor.level > last_level
  767.           @status_window.level_up(i)
  768.           actor.damage[[actor, -1]] = "Level up!"
  769.           actor.up_level = actor.level - last_level
  770.         end
  771.       end
  772.     end
  773.     # ゴールド獲得
  774.     $game_party.gain_gold(gold)
  775.     # トレジャー獲得
  776.     for item in treasures
  777.       case item
  778.       when RPG::Item
  779.         $game_party.gain_item(item.id, 1)
  780.       when RPG::Weapon
  781.         $game_party.gain_weapon(item.id, 1)
  782.       when RPG::Armor
  783.         $game_party.gain_armor(item.id, 1)
  784.       end
  785.     end
  786.     # バトルリザルトウィンドウを作成
  787.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  788.     # ウェイトカウントを設定
  789.     @phase5_wait_count = 100
  790.   end
  791.   #--------------------------------------------------------------------------
  792.   # ● フレーム更新 (アフターバトルフェーズ)
  793.   #--------------------------------------------------------------------------
  794.   def update_phase5
  795.     # ウェイトカウントが 0 より大きい場合
  796.     if @phase5_wait_count > 0
  797.       # ウェイトカウントを減らす
  798.       @phase5_wait_count -= 1
  799.       # ウェイトカウントが 0 になった場合
  800.       if @phase5_wait_count == 0
  801.         # リザルトウィンドウを表示
  802.         @result_window.visible = true
  803.         # メインフェーズフラグをクリア
  804.         $game_temp.battle_main_phase = false
  805.         # ステータスウィンドウをリフレッシュ
  806.         @status_window.refresh
  807.         for actor in $game_party.actors
  808.           if actor.damage.include?([actor, 0])
  809.             @phase5_wait_count = 20
  810.             actor.damage_pop[[actor, 0]] = true
  811.           end
  812.           if actor.damage.include?([actor, -1])
  813.             @phase5_wait_count = 20
  814.             actor.damage_pop[[actor, -1]] = true
  815.             for level in actor.level - actor.up_level + 1..actor.level
  816.               for skill in $data_classes[actor.class_id].learnings
  817.                 if level == skill.level and not actor.skill_learn?(skill.id)
  818.                   actor.damage[[actor, 0]] = "New Skill!"
  819.                   break
  820.                 end
  821.               end
  822.             end
  823.           end
  824.         end
  825.       end
  826.       return
  827.     end
  828.     # C ボタンが押された場合
  829.     if Input.trigger?(Input::C)
  830.       # バトル終了
  831.       battle_end(0)
  832.     end
  833.   end

  834. #==============================================================================
  835. # ■ Scene_Battle (分割定義 3)
  836. #------------------------------------------------------------------------------
  837. #  バトル画面の処理を行うクラスです。
  838. #==============================================================================

  839.   #--------------------------------------------------------------------------
  840.   # ● アクターコマンドフェーズ開始
  841.   #--------------------------------------------------------------------------
  842.   def start_phase3
  843.     # メインフェーズフラグをクリア
  844.     $game_temp.battle_main_phase = false
  845.     @command_a = true
  846.     @active_actor = @command[0]
  847.     cnt = 0
  848.     for actor in $game_party.actors
  849.       if actor == @active_actor
  850.         @actor_index = cnt
  851.       end
  852.       cnt += 1
  853.     end
  854.     @active_actor.blink = true
  855.     unless @active_actor.inputable?
  856.       @active_actor.current_action.clear
  857.       phase3_next_actor
  858.       return
  859.     end
  860.     phase3_setup_command_window
  861.     # カメラの設定
  862.     @camera = "command"
  863.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  864.     y = [(plus.abs - 1.5) * 10 , 0].min
  865.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● アクターのコマンド入力終了
  869.   #--------------------------------------------------------------------------
  870.   def phase3_next_actor
  871.     @command.shift
  872.     @command_a = false
  873.     # メインフェーズフラグをセット
  874.     $game_temp.battle_main_phase = true
  875.     # アクターコマンドウィンドウを無効化
  876.     @actor_command_window.active = false
  877.     @actor_command_window.visible = false
  878.     # アクターの明滅エフェクト OFF
  879.     if @active_actor != nil
  880.       @active_actor.blink = false
  881.     end
  882.     action_start(@active_actor)
  883.     # カメラを元に戻す
  884.     if @camera == "command"
  885.       @spriteset.screen_target(0, 0, 1)
  886.     end
  887.     return
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● アクターコマンドウィンドウのセットアップ
  891.   #--------------------------------------------------------------------------
  892.   def phase3_setup_command_window
  893.     # パーティコマンドウィンドウを無効化
  894.     @party_command_window.active = false
  895.     @party_command_window.visible = false
  896.     # アクターコマンドウィンドウを有効化
  897.     @actor_command_window.active = true
  898.     @actor_command_window.visible = true
  899.     # アクターコマンドウィンドウの位置を設定
  900.     @actor_command_window.x = @actor_index * 160 +
  901.                               (4 - $game_party.actors.size) * 80
  902.     # インデックスを 0 に設定
  903.     @actor_command_window.index = 0
  904.   end
  905.   #--------------------------------------------------------------------------
  906.   # ● エネミーアクション作成
  907.   #--------------------------------------------------------------------------
  908.   def enemy_action(number)
  909.     enemy = $game_troop.enemies[number]
  910.     unless enemy.current_action.forcing
  911.       enemy.make_action
  912.     end
  913.     action_start(enemy)
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  917.   #--------------------------------------------------------------------------
  918.   def update_phase3_basic_command
  919.     unless @active_actor.inputable?
  920.       @active_actor.current_action.clear
  921.       phase3_next_actor
  922.       return
  923.     end
  924.     # B ボタンが押された場合
  925.     if Input.trigger?(Input::B) and @party == false
  926.       # キャンセル SE を演奏
  927.       $game_system.se_play($data_system.cancel_se)
  928.       @party = true
  929.     end
  930.     if @party == true and
  931.         ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  932.         (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  933.       # パーティコマンドフェーズへ
  934.       start_phase2
  935.       return
  936.     end
  937.     # C ボタンが押された場合
  938.     if Input.trigger?(Input::C)
  939.       @party = false
  940.       # アクターコマンドウィンドウのカーソル位置で分岐
  941.       case @actor_command_window.index
  942.       when 0  # 攻撃
  943.         if victory?
  944.           # ブザー SE を演奏
  945.           $game_system.se_play($data_system.buzzer_se)
  946.           return
  947.         end
  948.         # 決定 SE を演奏
  949.         $game_system.se_play($data_system.decision_se)
  950.         # エネミーの選択を開始
  951.         start_enemy_select
  952.       when 1  # スキル
  953.         # 決定 SE を演奏
  954.         $game_system.se_play($data_system.decision_se)
  955.         # スキルの選択を開始
  956.         start_skill_select
  957.       when 2  # 防御
  958.         # 決定 SE を演奏
  959.         $game_system.se_play($data_system.decision_se)
  960.         # アクションを設定
  961.         @active_actor.current_action.kind = 0
  962.         @active_actor.current_action.basic = 1
  963.         # 次のアクターのコマンド入力へ
  964.         phase3_next_actor
  965.       when 3  # アイテム
  966.         # 決定 SE を演奏
  967.         $game_system.se_play($data_system.decision_se)
  968.         # アイテムの選択を開始
  969.         start_item_select
  970.       end
  971.       return
  972.     end
  973.     # R ボタンが押された場合
  974.     if Input.trigger?(Input::R)
  975.       $game_system.se_play($data_system.cursor_se)
  976.       @party = false
  977.       # アクターの明滅エフェクト OFF
  978.       if @active_actor != nil
  979.         @active_actor.blink = false
  980.       end
  981.       @command.push(@command[0])
  982.       @command.shift
  983.       @command_a = false
  984.       # メインフェーズフラグをセット
  985.       $game_temp.battle_main_phase = true
  986.       # アクターコマンドウィンドウを無効化
  987.       @actor_command_window.active = false
  988.       @actor_command_window.visible = false
  989.     end
  990.     # L ボタンが押された場合
  991.     if Input.trigger?(Input::L)
  992.       $game_system.se_play($data_system.cursor_se)
  993.       @party = false
  994.       # アクターの明滅エフェクト OFF
  995.       if @active_actor != nil
  996.         @active_actor.blink = false
  997.       end
  998.       @command.unshift(@command[@command.size - 1])
  999.       @command.delete_at(@command.size - 1)
  1000.       @command_a = false
  1001.       # メインフェーズフラグをセット
  1002.       $game_temp.battle_main_phase = true
  1003.       # アクターコマンドウィンドウを無効化
  1004.       @actor_command_window.active = false
  1005.       @actor_command_window.visible = false
  1006.     end
  1007.     # 右 ボタンが押された場合
  1008.     if Input.trigger?(Input::RIGHT)
  1009.       $game_system.se_play($data_system.cursor_se)
  1010.       @party = false
  1011.       # アクターの明滅エフェクト OFF
  1012.       if @active_actor != nil
  1013.         @active_actor.blink = false
  1014.       end
  1015.       actor = $game_party.actors[@actor_index]
  1016.       while actor == @command[0] or (not @command.include?(actor))
  1017.         @actor_index += 1
  1018.         @actor_index %= $game_party.actors.size
  1019.         actor = $game_party.actors[@actor_index]
  1020.         if actor == @command[0]
  1021.           break
  1022.         end
  1023.       end
  1024.       while actor != @command[0]
  1025.         @command.push(@command.shift)
  1026.       end
  1027.       @command_a = false
  1028.       # メインフェーズフラグをセット
  1029.       $game_temp.battle_main_phase = true
  1030.       # アクターコマンドウィンドウを無効化
  1031.       @actor_command_window.active = false
  1032.       @actor_command_window.visible = false
  1033.     end
  1034.     # 左 ボタンが押された場合
  1035.     if Input.trigger?(Input::LEFT)
  1036.       $game_system.se_play($data_system.cursor_se)
  1037.       @party = false
  1038.       # アクターの明滅エフェクト OFF
  1039.       if @active_actor != nil
  1040.         @active_actor.blink = false
  1041.       end
  1042.       actor = $game_party.actors[@actor_index]
  1043.       while actor == @command[0] or (not @command.include?(actor))
  1044.         @actor_index -= 1
  1045.         @actor_index %= $game_party.actors.size
  1046.         actor = $game_party.actors[@actor_index]
  1047.         if actor == @command[0]
  1048.           break
  1049.         end
  1050.       end
  1051.       while actor != @command[0]
  1052.         @command.push(@command.shift)
  1053.       end
  1054.       @command_a = false
  1055.       # メインフェーズフラグをセット
  1056.       $game_temp.battle_main_phase = true
  1057.       # アクターコマンドウィンドウを無効化
  1058.       @actor_command_window.active = false
  1059.       @actor_command_window.visible = false
  1060.     end
  1061.   end
  1062.   #--------------------------------------------------------------------------
  1063.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1064.   #--------------------------------------------------------------------------
  1065.   def update_phase3_skill_select
  1066.     # コマンド選択中に行動不能になった場合
  1067.     unless @active_actor.inputable?
  1068.       @active_actor.current_action.clear
  1069.       command_delete
  1070.       # 次のアクターのコマンド入力へ
  1071.       phase3_next_actor
  1072.       return
  1073.     end
  1074.     # スキルウィンドウを可視状態にする
  1075.     @skill_window.visible = true
  1076.     # スキルウィンドウを更新
  1077.     @skill_window.update
  1078.     # B ボタンが押された場合
  1079.     if Input.trigger?(Input::B)
  1080.       # キャンセル SE を演奏
  1081.       $game_system.se_play($data_system.cancel_se)
  1082.       # スキルの選択を終了
  1083.       end_skill_select
  1084.       return
  1085.     end
  1086.     # C ボタンが押された場合
  1087.     if Input.trigger?(Input::C)
  1088.       # スキルウィンドウで現在選択されているデータを取得
  1089.       @skill = @skill_window.skill
  1090.       # 使用できない場合
  1091.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1092.         # ブザー SE を演奏
  1093.         $game_system.se_play($data_system.buzzer_se)
  1094.         return
  1095.       end
  1096.       if @skill.scope == 1 or @skill.scope == 2
  1097.         if victory?
  1098.           # ブザー SE を演奏
  1099.           $game_system.se_play($data_system.buzzer_se)
  1100.           return
  1101.         end
  1102.       end        
  1103.       # 決定 SE を演奏
  1104.       $game_system.se_play($data_system.decision_se)
  1105.       # アクションを設定
  1106.       @active_actor.current_action.skill_id = @skill.id
  1107.       # スキルウィンドウを不可視状態にする
  1108.       @skill_window.visible = false
  1109.       # 効果範囲が敵単体の場合
  1110.       if @skill.scope == 1
  1111.         # エネミーの選択を開始
  1112.         start_enemy_select
  1113.       # 効果範囲が味方単体の場合
  1114.       elsif @skill.scope == 3 or @skill.scope == 5
  1115.         # アクターの選択を開始
  1116.         start_actor_select
  1117.       # 効果範囲が単体ではない場合
  1118.       else
  1119.         # アクションを設定
  1120.         @active_actor.current_action.kind = 1
  1121.         # スキルの選択を終了
  1122.         end_skill_select
  1123.         # 次のアクターのコマンド入力へ
  1124.         phase3_next_actor
  1125.       end
  1126.       return
  1127.     end
  1128.   end
  1129.   #--------------------------------------------------------------------------
  1130.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1131.   #--------------------------------------------------------------------------
  1132.   def update_phase3_item_select
  1133.     # コマンド選択中に行動不能になった場合
  1134.     unless @active_actor.inputable?
  1135.       @active_actor.current_action.clear
  1136.       command_delete
  1137.       # 次のアクターのコマンド入力へ
  1138.       phase3_next_actor
  1139.       return
  1140.     end
  1141.     # アイテムウィンドウを可視状態にする
  1142.     @item_window.visible = true
  1143.     # アイテムウィンドウを更新
  1144.     @item_window.update
  1145.     # B ボタンが押された場合
  1146.     if Input.trigger?(Input::B)
  1147.       # キャンセル SE を演奏
  1148.       $game_system.se_play($data_system.cancel_se)
  1149.       # アイテムの選択を終了
  1150.       end_item_select
  1151.       return
  1152.     end
  1153.     # C ボタンが押された場合
  1154.     if Input.trigger?(Input::C)
  1155.       # アイテムウィンドウで現在選択されているデータを取得
  1156.       @item = @item_window.item
  1157.       # 使用できない場合
  1158.       unless $game_party.item_can_use?(@item.id)
  1159.         # ブザー SE を演奏
  1160.         $game_system.se_play($data_system.buzzer_se)
  1161.         return
  1162.       end
  1163.       if @item.scope == 1 or @item.scope == 2
  1164.         if victory?
  1165.           # ブザー SE を演奏
  1166.           $game_system.se_play($data_system.buzzer_se)
  1167.           return
  1168.         end
  1169.       end
  1170.       # 決定 SE を演奏
  1171.       $game_system.se_play($data_system.decision_se)
  1172.       # アクションを設定
  1173.       @active_actor.current_action.item_id = @item.id
  1174.       # アイテムウィンドウを不可視状態にする
  1175.       @item_window.visible = false
  1176.       # 効果範囲が敵単体の場合
  1177.       if @item.scope == 1
  1178.         # エネミーの選択を開始
  1179.         start_enemy_select
  1180.       # 効果範囲が味方単体の場合
  1181.       elsif @item.scope == 3 or @item.scope == 5
  1182.         # アクターの選択を開始
  1183.         start_actor_select
  1184.       # 効果範囲が単体ではない場合
  1185.       else
  1186.         # アクションを設定
  1187.         @active_actor.current_action.kind = 2
  1188.         # アイテムの選択を終了
  1189.         end_item_select
  1190.         # 次のアクターのコマンド入力へ
  1191.         phase3_next_actor
  1192.       end
  1193.       return
  1194.     end
  1195.   end
  1196.   #--------------------------------------------------------------------------
  1197.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1198.   #--------------------------------------------------------------------------
  1199.   def update_phase3_enemy_select
  1200.     if victory?
  1201.       # カメラを元に戻す
  1202.       if @camera == "select"
  1203.         @spriteset.screen_target(0, 0, 1)
  1204.       end
  1205.       # エネミーの選択を終了
  1206.       end_enemy_select
  1207.       return
  1208.     end
  1209.     # コマンド選択中に行動不能になった場合
  1210.     unless @active_actor.inputable?
  1211.       # カメラを元に戻す
  1212.       if @camera == "select"
  1213.         @spriteset.screen_target(0, 0, 1)
  1214.       end
  1215.       @active_actor.current_action.clear
  1216.       command_delete
  1217.       # 次のアクターのコマンド入力へ
  1218.       phase3_next_actor
  1219.       return
  1220.     end
  1221.     # エネミーアローを更新
  1222.     @enemy_arrow.update
  1223.     # B ボタンが押された場合
  1224.     if Input.trigger?(Input::B)
  1225.       # キャンセル SE を演奏
  1226.       $game_system.se_play($data_system.cancel_se)
  1227.       # カメラを元に戻す
  1228.       if @camera == "select"
  1229.         # カメラの設定
  1230.         @camera = "command"
  1231.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1232.         y = [(plus.abs - 1.5) * 10 , 0].min
  1233.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1234.       end
  1235.       # エネミーの選択を終了
  1236.       end_enemy_select
  1237.       return
  1238.     end
  1239.     # C ボタンが押された場合
  1240.     if Input.trigger?(Input::C)
  1241.       # 決定 SE を演奏
  1242.       $game_system.se_play($data_system.decision_se)
  1243.       # アクションを設定
  1244.       @active_actor.current_action.kind = 0
  1245.       @active_actor.current_action.basic = 0
  1246.       @active_actor.current_action.target_index = @enemy_arrow.index
  1247.       # スキルウィンドウ表示中の場合
  1248.       if @skill_window != nil
  1249.         # アクションを再設定
  1250.         @active_actor.current_action.kind = 1
  1251.         # スキルの選択を終了
  1252.         end_skill_select
  1253.       end
  1254.       # アイテムウィンドウ表示中の場合
  1255.       if @item_window != nil
  1256.         # アクションを再設定
  1257.         @active_actor.current_action.kind = 2
  1258.         # アイテムの選択を終了
  1259.         end_item_select
  1260.       end
  1261.       # エネミーの選択を終了
  1262.       end_enemy_select
  1263.       # 次のアクターのコマンド入力へ
  1264.       phase3_next_actor
  1265.     end
  1266.   end
  1267.   #--------------------------------------------------------------------------
  1268.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1269.   #--------------------------------------------------------------------------
  1270.   def update_phase3_actor_select
  1271.     # コマンド選択中に行動不能になった場合
  1272.     unless @active_actor.inputable?
  1273.       @active_actor.current_action.clear
  1274.       command_delete
  1275.       # 次のアクターのコマンド入力へ
  1276.       phase3_next_actor
  1277.       return
  1278.     end
  1279.     # アクターアローを更新
  1280.     @actor_arrow.update
  1281.     # B ボタンが押された場合
  1282.     if Input.trigger?(Input::B)
  1283.       # キャンセル SE を演奏
  1284.       $game_system.se_play($data_system.cancel_se)
  1285.       # アクターの選択を終了
  1286.       end_actor_select
  1287.       return
  1288.     end
  1289.     # C ボタンが押された場合
  1290.     if Input.trigger?(Input::C)
  1291.       # 決定 SE を演奏
  1292.       $game_system.se_play($data_system.decision_se)
  1293.       # アクションを設定
  1294.       @active_actor.current_action.kind = 0
  1295.       @active_actor.current_action.basic = 0
  1296.       @active_actor.current_action.target_index = @actor_arrow.index
  1297.       # アクターの選択を終了
  1298.       end_actor_select
  1299.       # スキルウィンドウ表示中の場合
  1300.       if @skill_window != nil
  1301.         # アクションを再設定
  1302.         @active_actor.current_action.kind = 1
  1303.         # スキルの選択を終了
  1304.         end_skill_select
  1305.       end
  1306.       # アイテムウィンドウ表示中の場合
  1307.       if @item_window != nil
  1308.         # アクションを再設定
  1309.         @active_actor.current_action.kind = 2
  1310.         # アイテムの選択を終了
  1311.         end_item_select
  1312.       end
  1313.       # 次のアクターのコマンド入力へ
  1314.       phase3_next_actor
  1315.     end
  1316.   end
  1317.   #--------------------------------------------------------------------------
  1318.   # ● エネミー選択開始
  1319.   #--------------------------------------------------------------------------
  1320.   alias :start_enemy_select_rtab :start_enemy_select
  1321.   def start_enemy_select
  1322.     @camera = "select"
  1323.     for enemy in $game_troop.enemies
  1324.       if enemy.exist?
  1325.         zoom = 1 / enemy.zoom
  1326.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1327.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1328.         break
  1329.       end
  1330.     end
  1331.     # オリジナルの処理
  1332.     start_enemy_select_rtab
  1333.   end
  1334.   #--------------------------------------------------------------------------
  1335.   # ● エネミー選択終了
  1336.   #--------------------------------------------------------------------------
  1337.   alias :end_enemy_select_rtab :end_enemy_select
  1338.   def end_enemy_select
  1339.     # オリジナルの処理
  1340.     end_enemy_select_rtab
  1341.     if (@action == 0 and not @action_battlers.empty?) or
  1342.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1343.                                             @active_actor.animation1_id != 0))
  1344.       @spriteset.screen_target(0, 0, 1)
  1345.     end
  1346.   end
  1347.   #--------------------------------------------------------------------------
  1348.   # ● スキル選択開始
  1349.   #--------------------------------------------------------------------------
  1350.   def start_skill_select
  1351.     # スキルウィンドウを作成
  1352.     @skill_window = Window_Skill.new(@active_actor)
  1353.     # ヘルプウィンドウを関連付け
  1354.     @skill_window.help_window = @help_window
  1355.     # アクターコマンドウィンドウを無効化
  1356.     @actor_command_window.active = false
  1357.     @actor_command_window.visible = false
  1358.   end

  1359. #==============================================================================
  1360. # ■ Scene_Battle (分割定義 4)
  1361. #------------------------------------------------------------------------------
  1362. #  バトル画面の処理を行うクラスです。
  1363. #==============================================================================

  1364.   #--------------------------------------------------------------------------
  1365.   # ● メインフェーズ開始
  1366.   #--------------------------------------------------------------------------
  1367.   def start_phase4
  1368.     $game_temp.battle_main_phase = true
  1369.   end
  1370.   #--------------------------------------------------------------------------
  1371.   # ● フレーム更新 (メインフェーズ)
  1372.   #--------------------------------------------------------------------------
  1373.   def update_phase4
  1374.     # アクションを強制されているバトラーが存在する場合
  1375.     if $game_temp.forcing_battler != nil
  1376.       battler = $game_temp.forcing_battler
  1377.       if battler.current_action.forcing == false
  1378.         if @action_battlers.include?(battler)
  1379.           if @action > 0 or @action_battlers[0].phase == 1
  1380.             @action_battlers.delete(battler)
  1381.             @action_battlers.push(battler)
  1382.           end
  1383.           if battler.phase == 1
  1384.             battler.current_action.forcing = true
  1385.             force_action(battler)
  1386.           end
  1387.         else
  1388.           battler.current_action.forcing = true
  1389.           force_action(battler)
  1390.           action_start(battler)
  1391.           @action_battlers.delete(battler)
  1392.           @action_battlers.push(battler)
  1393.         end
  1394.         battler.at = @max
  1395.         battler.atp = 100 * battler.at / @max
  1396.       end
  1397.     end
  1398.     # action が1以上の場合、一斉に行動を起こす
  1399.     for battler in @action_battlers.reverse
  1400.       # ウェイト中の場合
  1401.       if battler.wait > 0
  1402.         # ウェイトカウントを減らす
  1403.         battler.wait -= 1
  1404.         break if @action == 0
  1405.         next
  1406.       end
  1407.       unless fin? and battler.phase < 3 and
  1408.           not $game_system.battle_interpreter.running?
  1409.         action_phase(battler)
  1410.       end
  1411.       break if @action == 0
  1412.     end
  1413.     # アクションを強制されているバトラーが存在しない場合
  1414.     if $game_temp.forcing_battler == nil
  1415.       # バトルイベントをセットアップ
  1416.       setup_battle_event
  1417.       # バトルイベント実行中の場合
  1418.       if $game_system.battle_interpreter.running?
  1419.         return
  1420.       end
  1421.     end
  1422.     for battler in @action_battlers.reverse
  1423.       if fin? and battler.phase < 3 and
  1424.           not $game_system.battle_interpreter.running?
  1425.         # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1426.         @action_battlers.delete(battler)
  1427.       end
  1428.     end
  1429.     if @action_battlers.empty? and not $game_system.battle_interpreter.running?
  1430.       # 勝敗判定
  1431.       judge
  1432.     end
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   # ● アクション更新 (メインフェーズ)
  1436.   #--------------------------------------------------------------------------
  1437.   def action_phase(battler)
  1438.     # action が 1 の場合、バトラーが行動中かどうか確認
  1439.     if @action == 1 and battler.phase < 3
  1440.       for target in battler.target
  1441.         speller = synthe?(target)
  1442.         if speller == nil
  1443.           # ターゲットが通常行動中の場合
  1444.           if @action_battlers.include?(target)
  1445.             if target.phase > 2
  1446.               return
  1447.             end
  1448.           end
  1449.         else
  1450.           # ターゲットが連携スキル発動中の場合
  1451.           for spell in speller
  1452.             if @action_battlers.include?(spell)
  1453.               if spell.phase > 2
  1454.                 return
  1455.               end
  1456.             end
  1457.           end
  1458.         end
  1459.       end
  1460.     end
  1461.     case battler.phase
  1462.     when 1
  1463.       update_phase4_step1(battler)
  1464.     when 2
  1465.       update_phase4_step2(battler)
  1466.     when 3
  1467.       update_phase4_step3(battler)
  1468.     when 4
  1469.       update_phase4_step4(battler)
  1470.     when 5
  1471.       update_phase4_step5(battler)
  1472.     when 6
  1473.       update_phase4_step6(battler)
  1474.     end
  1475.   end
  1476.   #--------------------------------------------------------------------------
  1477.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1478.   #--------------------------------------------------------------------------
  1479.   def update_phase4_step1(battler)
  1480.     # すでに戦闘から外されている場合
  1481.     if battler.index == nil
  1482.       @action_battlers.delete(battler)
  1483.       anime_wait_return
  1484.       return
  1485.     end
  1486.     speller = synthe?(battler)
  1487.     if speller == nil
  1488.       # ダメージ食らい中の場合
  1489.       unless battler.damage.empty? or @action > 2
  1490.         return
  1491.       end
  1492.       # 行動可能かどうか判定
  1493.       unless battler.movable?
  1494.         battler.phase = 6
  1495.         return
  1496.       end
  1497.     else
  1498.       # ダメージ食らい中の場合
  1499.       for spell in speller
  1500.         unless spell.damage.empty? or @action > 2
  1501.           return
  1502.         end
  1503.         # 行動可能かどうか判定
  1504.         unless spell.movable?
  1505.           battler.phase = 6
  1506.           return
  1507.         end
  1508.       end
  1509.     end
  1510.     # スキル使用時、詠唱時間設定
  1511.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1512.     if battler.current_action.kind == 1 and
  1513.       (not battler.current_action.forcing or @force != 2)
  1514.       if battler.rtp == 0
  1515.         # スキル詠唱中ならば、解除
  1516.         skill_reset(battler)
  1517.         # スキル詠唱時間設定
  1518.         recite_time(battler)
  1519.         # 連携技設定
  1520.         synthe_spell(battler)
  1521.         # スキルを詠唱する場合
  1522.         if battler.rtp > 0
  1523.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1524.           speller = synthe?(battler)
  1525.           if battler.current_action.forcing and @force > 0 and speller != nil
  1526.             for spell in speller
  1527.               spell.rt = spell.rtp
  1528.             end
  1529.           else
  1530.             battler.blink = true
  1531.             if battler.current_action.forcing
  1532.               $game_temp.forcing_battler = nil
  1533.               battler.current_action.forcing = false
  1534.             end
  1535.             @action_battlers.delete(battler)
  1536.             return
  1537.           end
  1538.         end
  1539.       end
  1540.     end
  1541.     # アクターの明滅エフェクト OFF
  1542.     if battler != nil
  1543.       battler.blink = false
  1544.     end
  1545.     speller = synthe?(battler)
  1546.     if speller == nil
  1547.       @spell_p.delete(battler)
  1548.       @spell_e.delete(battler)
  1549.     else
  1550.       for spell in speller
  1551.         spell.blink = false
  1552.         @spell_p.delete(spell)
  1553.         @spell_e.delete(spell)
  1554.       end
  1555.     end
  1556.     # ステップ 2 に移行
  1557.     battler.phase = 2
  1558.   end
  1559.   #--------------------------------------------------------------------------
  1560.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1561.   #--------------------------------------------------------------------------
  1562.   def update_phase4_step2(battler)
  1563.     # 強制アクションでなければ
  1564.     unless battler.current_action.forcing
  1565.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1566.       if battler.restriction == 2 or battler.restriction == 3
  1567.         # アクションに攻撃を設定
  1568.         battler.current_action.kind = 0
  1569.         battler.current_action.basic = 0
  1570.       end
  1571.     end
  1572.     # アクションの種別で分岐
  1573.     case battler.current_action.kind
  1574.     when 0  # 基本
  1575.       if fin?
  1576.         battler.phase = 6
  1577.         return
  1578.       end
  1579.       make_basic_action_result(battler)
  1580.     when 1  # スキル
  1581.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1582.         battler.phase = 6
  1583.         return
  1584.       end
  1585.       make_skill_action_result(battler)
  1586.     when 2  # アイテム
  1587.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1588.         battler.phase = 6
  1589.         return
  1590.       end
  1591.       make_item_action_result(battler)
  1592.     end
  1593.     if battler.phase == 2
  1594.       # ステップ 3 に移行
  1595.       battler.phase = 3
  1596.     end
  1597.   end
  1598.   #--------------------------------------------------------------------------
  1599.   # ● 基本アクション 結果作成
  1600.   #--------------------------------------------------------------------------
  1601.   def make_basic_action_result(battler)
  1602.     # 攻撃の場合
  1603.     if battler.current_action.basic == 0
  1604.       # アニメーション ID を設定
  1605.       battler.anime1 = battler.animation1_id
  1606.       battler.anime2 = battler.animation2_id
  1607.       # 行動側バトラーがエネミーの場合
  1608.       if battler.is_a?(Game_Enemy)
  1609.         if battler.restriction == 3
  1610.           target = $game_troop.random_target_enemy
  1611.         elsif battler.restriction == 2
  1612.           target = $game_party.random_target_actor
  1613.         else
  1614.           index = battler.current_action.target_index
  1615.           target = $game_party.smooth_target_actor(index)
  1616.         end
  1617.       end
  1618.       # 行動側バトラーがアクターの場合
  1619.       if battler.is_a?(Game_Actor)
  1620.         if battler.restriction == 3
  1621.           target = $game_party.random_target_actor
  1622.         elsif battler.restriction == 2
  1623.           target = $game_troop.random_target_enemy
  1624.         else
  1625.           index = battler.current_action.target_index
  1626.           target = $game_troop.smooth_target_enemy(index)
  1627.         end
  1628.       end
  1629.       # 対象側バトラーの配列を設定
  1630.       battler.target = [target]
  1631.       # 通常攻撃の効果を適用
  1632.       for target in battler.target
  1633.         target.attack_effect(battler)
  1634.       end
  1635.       return
  1636.     end
  1637.     # 防御の場合
  1638.     if battler.current_action.basic == 1
  1639.       return
  1640.     end
  1641.     # 逃げるの場合
  1642.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1643.       # 逃げる
  1644.       battler.escape
  1645.       return
  1646.     end
  1647.     # 何もしないの場合
  1648.     if battler.current_action.basic == 3
  1649.       # ステップ 6 に移行
  1650.       battler.phase = 6
  1651.       return
  1652.     end
  1653.   end
  1654.   #--------------------------------------------------------------------------
  1655.   # ● スキルまたはアイテムの対象側バトラー設定
  1656.   #     scope : スキルまたはアイテムの効果範囲
  1657.   #--------------------------------------------------------------------------
  1658.   def set_target_battlers(scope, battler)
  1659.     # 行動側バトラーがエネミーの場合
  1660.     if battler.is_a?(Game_Enemy)
  1661.       # 効果範囲で分岐
  1662.       case scope
  1663.       when 1  # 敵単体
  1664.         index =battler.current_action.target_index
  1665.         battler.target.push($game_party.smooth_target_actor(index))
  1666.       when 2  # 敵全体
  1667.         for actor in $game_party.actors
  1668.           if actor.exist?
  1669.             battler.target.push(actor)
  1670.           end
  1671.         end
  1672.       when 3  # 味方単体
  1673.         index = battler.current_action.target_index
  1674.         battler.target.push($game_troop.smooth_target_enemy(index))
  1675.       when 4  # 味方全体
  1676.         for enemy in $game_troop.enemies
  1677.           if enemy.exist?
  1678.             battler.target.push(enemy)
  1679.           end
  1680.         end
  1681.       when 5  # 味方単体 (HP 0)
  1682.         index = battler.current_action.target_index
  1683.         enemy = $game_troop.enemies[index]
  1684.         if enemy != nil and enemy.hp0?
  1685.           battler.target.push(enemy)
  1686.         end
  1687.       when 6  # 味方全体 (HP 0)
  1688.         for enemy in $game_troop.enemies
  1689.           if enemy != nil and enemy.hp0?
  1690.             battler.target.push(enemy)
  1691.           end
  1692.         end
  1693.       when 7  # 使用者
  1694.         battler.target.push(battler)
  1695.       end
  1696.     end
  1697.     # 行動側バトラーがアクターの場合
  1698.     if battler.is_a?(Game_Actor)
  1699.       # 効果範囲で分岐
  1700.       case scope
  1701.       when 1  # 敵単体
  1702.         index = battler.current_action.target_index
  1703.         battler.target.push($game_troop.smooth_target_enemy(index))
  1704.       when 2  # 敵全体
  1705.         for enemy in $game_troop.enemies
  1706.           if enemy.exist?
  1707.             battler.target.push(enemy)
  1708.           end
  1709.         end
  1710.       when 3  # 味方単体
  1711.         index = battler.current_action.target_index
  1712.         battler.target.push($game_party.smooth_target_actor(index))
  1713.       when 4  # 味方全体
  1714.         for actor in $game_party.actors
  1715.           if actor.exist?
  1716.             battler.target.push(actor)
  1717.           end
  1718.         end
  1719.       when 5  # 味方単体 (HP 0)
  1720.         index = battler.current_action.target_index
  1721.         actor = $game_party.actors[index]
  1722.         if actor != nil and actor.hp0?
  1723.           battler.target.push(actor)
  1724.         end
  1725.       when 6  # 味方全体 (HP 0)
  1726.         for actor in $game_party.actors
  1727.           if actor != nil and actor.hp0?
  1728.             battler.target.push(actor)
  1729.           end
  1730.         end
  1731.       when 7  # 使用者
  1732.         battler.target.push(battler)
  1733.       end
  1734.     end
  1735.   end
  1736.   #--------------------------------------------------------------------------
  1737.   # ● スキルアクション 結果作成
  1738.   #--------------------------------------------------------------------------
  1739.   def make_skill_action_result(battler)
  1740.     # スキルを取得
  1741.     @skill = $data_skills[battler.current_action.skill_id]
  1742.     # 連携スキルであるかどうか確認
  1743.     speller = synthe?(battler)
  1744.     # 強制アクションでなければ
  1745.     unless battler.current_action.forcing
  1746.       # SP 切れなどで使用できなくなった場合
  1747.       if speller == nil
  1748.         unless battler.skill_can_use?(@skill.id)
  1749.           # ステップ 6 に移行
  1750.           battler.phase = 6
  1751.          return
  1752.         end
  1753.       end
  1754.     end
  1755.     # SP 消費
  1756.     temp = false
  1757.     if speller != nil
  1758.       for spell in speller
  1759.         if spell.current_action.spell_id == 0
  1760.           spell.sp -= @skill.sp_cost
  1761.         else
  1762.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1763.         end
  1764.         # ステータスウィンドウをリフレッシュ
  1765.         status_refresh(spell)
  1766.       end
  1767.     else
  1768.       battler.sp -= @skill.sp_cost
  1769.       # ステータスウィンドウをリフレッシュ
  1770.       status_refresh(battler)
  1771.     end
  1772.     # アニメーション ID を設定
  1773.     battler.anime1 = @skill.animation1_id
  1774.     battler.anime2 = @skill.animation2_id
  1775.     # コモンイベント ID を設定
  1776.     battler.event = @skill.common_event_id
  1777.     # 対象側バトラーを設定
  1778.     set_target_battlers(@skill.scope, battler)
  1779.     # スキルの効果を適用
  1780.     for target in battler.target
  1781.       if speller != nil
  1782.         damage = 0
  1783.         effective = false
  1784.         state_p = []
  1785.         state_m = []
  1786.         for spell in speller
  1787.           if spell.current_action.spell_id != 0
  1788.             @skill = $data_skills[spell.current_action.spell_id]
  1789.           end
  1790.           effective |= target.skill_effect(spell, @skill)
  1791.           if target.damage[spell].class != String
  1792.             damage += target.damage[spell]
  1793.           elsif effective == true
  1794.             effect = target.damage[spell]
  1795.           end
  1796.           state_p += target.state_p[spell]
  1797.           state_m += target.state_m[spell]
  1798.           target.damage.delete(spell)
  1799.           target.state_p.delete(spell)
  1800.           target.state_m.delete(spell)
  1801.         end
  1802.         if damage != 0
  1803.           target.damage[battler] = damage
  1804.         elsif effective = true
  1805.           target.damage[battler] = effect
  1806.         end
  1807.         target.state_p[battler] = state_p
  1808.         target.state_m[battler] = state_m
  1809.       else
  1810.         target.skill_effect(battler, @skill)
  1811.       end
  1812.     end
  1813.   end
  1814.   #--------------------------------------------------------------------------
  1815.   # ● アイテムアクション 結果作成
  1816.   #--------------------------------------------------------------------------
  1817.   def make_item_action_result(battler)
  1818.     # アイテムを取得
  1819.     @item = $data_items[battler.current_action.item_id]
  1820.     # アイテム切れなどで使用できなくなった場合
  1821.     unless $game_party.item_can_use?(@item.id)
  1822.       # ステップ 6 に移行
  1823.       battler.phase = 6
  1824.       return
  1825.     end
  1826.     # 消耗品の場合
  1827.     if @item.consumable
  1828.       # 使用したアイテムを 1 減らす
  1829.       $game_party.lose_item(@item.id, 1)
  1830.     end
  1831.     # アニメーション ID を設定
  1832.     battler.anime1 = @item.animation1_id
  1833.     battler.anime2 = @item.animation2_id
  1834.     # コモンイベント ID を設定
  1835.     battler.event = @item.common_event_id
  1836.     # 対象を決定
  1837.     index = battler.current_action.target_index
  1838.     target = $game_party.smooth_target_actor(index)
  1839.     # 対象側バトラーを設定
  1840.     set_target_battlers(@item.scope, battler)
  1841.     # アイテムの効果を適用
  1842.     for target in battler.target
  1843.       target.item_effect(@item, battler)
  1844.     end
  1845.   end
  1846.   #--------------------------------------------------------------------------
  1847.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  1848.   #--------------------------------------------------------------------------
  1849.   def update_phase4_step3(battler)
  1850.     # ヘルプウィンドウの更新。アクションの種別で分岐
  1851.     case battler.current_action.kind
  1852.     when 0  # 基本
  1853.       if battler.current_action.basic == 1
  1854.         @help_window.set_text($data_system.words.guard, 1)
  1855.         @help_wait = @help_time
  1856.       end
  1857.       if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1858.         @help_window.set_text("逃げる", 1)
  1859.         @help_wait = @help_time
  1860.       end
  1861.     when 1  # スキル
  1862.       skill =  $data_skills[battler.current_action.skill_id]
  1863.       @help_window.set_text(skill.name, 1)
  1864.       @help_wait = @help_time
  1865.     when 2  # アイテム
  1866.       item = $data_items[battler.current_action.item_id]
  1867.       @help_window.set_text(item.name, 1)
  1868.       @help_wait = @help_time
  1869.     end
  1870.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  1871.     if battler.anime1 == 0
  1872.       battler.white_flash = true
  1873.       battler.wait = 5
  1874.       # カメラ設定
  1875.       if battler.target[0].is_a?(Game_Enemy)
  1876.         camera_set(battler)
  1877.       end
  1878.     else
  1879.       battler.animation.push([battler.anime1, true])
  1880.       speller = synthe?(battler)
  1881.       if speller != nil
  1882.         for spell in speller
  1883.           if spell != battler
  1884.             if spell.current_action.spell_id == 0
  1885.               spell.animation.push([battler.anime1, true])
  1886.             else
  1887.               skill = spell.current_action.spell_id
  1888.               spell.animation.push([$data_skills[skill].animation1_id, true])
  1889.               spell.current_action.spell_id = 0
  1890.             end
  1891.           end
  1892.         end
  1893.       end
  1894.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  1895.     end
  1896.     # ステップ 4 に移行
  1897.     battler.phase = 4
  1898.   end
  1899.   #--------------------------------------------------------------------------
  1900.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  1901.   #--------------------------------------------------------------------------
  1902.   def update_phase4_step4(battler)
  1903.     # カメラ設定
  1904.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  1905.        camera_set(battler)
  1906.     end
  1907.     # 対象側アニメーション
  1908.     for target in battler.target
  1909.       target.animation.push([battler.anime2,
  1910.                                           (target.damage[battler] != "Miss")])
  1911.       unless battler.anime2 == 0
  1912.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  1913.       end
  1914.     end
  1915.     # ステップ 5 に移行
  1916.     battler.phase = 5
  1917.   end
  1918.   #--------------------------------------------------------------------------
  1919.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  1920.   #--------------------------------------------------------------------------
  1921.   def update_phase4_step5(battler)
  1922.     # ダメージ表示
  1923.     for target in battler.target
  1924.       if target.damage[battler] != nil
  1925.         target.damage_pop[battler] = true
  1926.         target.damage_effect(battler, battler.current_action.kind)
  1927.         battler.wait = @damage_wait
  1928.         # ステータスウィンドウをリフレッシュ
  1929.         status_refresh(target)
  1930.       end
  1931.     end
  1932.     # ステップ 6 に移行
  1933.     battler.phase = 6
  1934.   end
  1935.   #--------------------------------------------------------------------------
  1936.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  1937.   #--------------------------------------------------------------------------
  1938.   def update_phase4_step6(battler)
  1939.     # カメラを戻す
  1940.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  1941.       @spriteset.screen_target(0, 0, 1)
  1942.     end
  1943.     # スキルラーニング
  1944.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  1945.       for target in battler.target
  1946.         skill_learning(target, target.class_id,
  1947.                         battler.current_action.skill_id)
  1948.       end
  1949.     end
  1950.     # アクション強制対象のバトラーをクリア
  1951.     if battler.current_action.forcing == true and
  1952.         battler.current_action.force_kind == 0 and
  1953.         battler.current_action.force_basic == 0 and
  1954.         battler.current_action.force_skill_id == 0
  1955.       $game_temp.forcing_battler = nil
  1956.       battler.current_action.forcing = false
  1957.     end
  1958.     refresh_phase(battler)
  1959.     speller = synthe?(battler)
  1960.     if speller != nil
  1961.       for spell in speller
  1962.         if spell != battler
  1963.           refresh_phase(spell)
  1964.         end
  1965.       end
  1966.       synthe_delete(speller)
  1967.     end
  1968.     # コモンイベント ID が有効の場合
  1969.     if battler.event > 0
  1970.       # イベントをセットアップ
  1971.       common_event = $data_common_events[battler.event]
  1972.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1973.     end
  1974.     act = 0
  1975.     for actor in $game_party.actors + $game_troop.enemies
  1976.       if actor.movable?
  1977.         act += 1
  1978.       end
  1979.     end
  1980.     if @turn_cnt >= act and act > 0
  1981.       @turn_cnt %= act
  1982.       $game_temp.battle_turn += 1
  1983.       # バトルイベントの全ページを検索
  1984.       for index in 0...$data_troops[@troop_id].pages.size
  1985.         # イベントページを取得
  1986.         page = $data_troops[@troop_id].pages[index]
  1987.         # このページのスパンが [ターン] の場合
  1988.         if page.span == 1
  1989.           # 実行済みフラグをクリア
  1990.           $game_temp.battle_event_flags[index] = false
  1991.         end
  1992.       end
  1993.     end
  1994.     battler.phase = 1
  1995.     @action_battlers.delete(battler)
  1996.   end
  1997.   #--------------------------------------------------------------------------
  1998.   # ● リフレッシュ
  1999.   #--------------------------------------------------------------------------
  2000.   def refresh_phase(battler)
  2001.     battler.at %= @max
  2002.     if battler.movable?
  2003.       battler.atp = 100 * battler.at / @max
  2004.     end
  2005.     spell_reset(battler)
  2006.     # スリップダメージ
  2007.     if battler.hp > 0 and battler.slip_damage?
  2008.       battler.slip_damage_effect
  2009.       battler.damage_pop["slip"] = true
  2010.     end
  2011.     # ステート自然解除
  2012.     battler.remove_states_auto
  2013.     # ステータスウィンドウをリフレッシュ
  2014.     status_refresh(battler, true)
  2015.     unless battler.movable?
  2016.       return
  2017.     end
  2018.     # ターン数カウント
  2019.     @turn_cnt += 1
  2020.   end
  2021.   #--------------------------------------------------------------------------
  2022.   # ● バトラーアクションスタート
  2023.   #--------------------------------------------------------------------------
  2024.   def action_start(battler)
  2025.     battler.phase = 1
  2026.     battler.anime1 = 0
  2027.     battler.anime2 = 0
  2028.     battler.target = []
  2029.     battler.event = 0
  2030.     @action_battlers.unshift(battler)
  2031.   end
  2032.   #--------------------------------------------------------------------------
  2033.   # ● ステータスウィンドウをリフレッシュ
  2034.   #--------------------------------------------------------------------------
  2035.   def status_refresh(battler, at = false)
  2036.     if battler.is_a?(Game_Actor)
  2037.       for i in 0...$game_party.actors.size
  2038.         if battler == $game_party.actors[i]
  2039.           number = i + 1
  2040.         end
  2041.       end
  2042.       @status_window.refresh(number)
  2043.       if at == true
  2044.         @status_window.at_refresh(number)
  2045.       end
  2046.     end
  2047.   end
  2048.   #--------------------------------------------------------------------------
  2049.   # ● アニメウェイト判断処理
  2050.   #--------------------------------------------------------------------------
  2051.   def anime_wait_return
  2052.     if (@action_battlers.empty? or @anime_wait == false) and
  2053.         not $game_system.battle_interpreter.running? and not fin?
  2054.       # エネミーアローが有効の場合
  2055.       if @enemy_arrow != nil
  2056.         return [@active - 2, 0].min == 0
  2057.       # アクターアローが有効の場合
  2058.       elsif @actor_arrow != nil
  2059.         return [@active - 2, 0].min == 0
  2060.       # スキルウィンドウが有効の場合
  2061.       elsif @skill_window != nil
  2062.         return [@active - 3, 0].min == 0
  2063.       # アイテムウィンドウが有効の場合
  2064.       elsif @item_window != nil
  2065.         return [@active - 3, 0].min == 0
  2066.       # アクターコマンドウィンドウが有効の場合
  2067.       elsif @actor_command_window.active
  2068.         return [@active - 1, 0].min == 0
  2069.       else
  2070.         return true
  2071.       end
  2072.     else
  2073.       return false
  2074.     end
  2075.   end
  2076.   #--------------------------------------------------------------------------
  2077.   # ● アクターコマンド消去判断
  2078.   #--------------------------------------------------------------------------
  2079.   def command_delete
  2080.     # エネミーアローが有効の場合
  2081.     if @enemy_arrow != nil
  2082.       end_enemy_select
  2083.     # アクターアローが有効の場合
  2084.     elsif @actor_arrow != nil
  2085.       end_actor_select
  2086.     end
  2087.     # スキルウィンドウが有効の場合
  2088.     if @skill_window != nil
  2089.       end_skill_select
  2090.     # アイテムウィンドウが有効の場合
  2091.     elsif @item_window != nil
  2092.       end_item_select
  2093.     end
  2094.     # アクターコマンドウィンドウが有効の場合
  2095.     if @actor_command_window.active
  2096.       @command.shift
  2097.       @command_a = false
  2098.       # メインフェーズフラグをセット
  2099.       $game_temp.battle_main_phase = true
  2100.       # アクターコマンドウィンドウを無効化
  2101.       @actor_command_window.active = false
  2102.       @actor_command_window.visible = false
  2103.       # アクターの明滅エフェクト OFF
  2104.       if @active_actor != nil
  2105.         @active_actor.blink = false
  2106.       end
  2107.     end
  2108.   end
  2109.   #--------------------------------------------------------------------------
  2110.   # ● 強制アクション設定
  2111.   #--------------------------------------------------------------------------
  2112.   def force_action(battler)
  2113.     battler.current_action.kind = battler.current_action.force_kind
  2114.     battler.current_action.basic = battler.current_action.force_basic
  2115.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2116.     battler.current_action.force_kind = 0
  2117.     battler.current_action.force_basic = 0
  2118.     battler.current_action.force_skill_id = 0
  2119.   end
  2120.   #--------------------------------------------------------------------------
  2121.   # ● カメラセット
  2122.   #--------------------------------------------------------------------------
  2123.   def camera_set(battler)
  2124.     @camera = battler
  2125.     if battler.target.size == 1
  2126.       if battler.current_action.kind == 0
  2127.         zoom = 1.2 / battler.target[0].zoom
  2128.       elsif synthe?(battler) == nil
  2129.         zoom = 1.5 / battler.target[0].zoom
  2130.       else
  2131.         zoom = 2.0 / battler.target[0].zoom
  2132.       end
  2133.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2134.                                 battler.target[0].attack_y(zoom), zoom)
  2135.     else
  2136.       @spriteset.screen_target(0, 0, 0.75)
  2137.     end
  2138.   end
  2139.   #--------------------------------------------------------------------------
  2140.   # ● スキル詠唱タイム作成
  2141.   #--------------------------------------------------------------------------
  2142.   def recite_time(battler)
  2143.   end
  2144.   #--------------------------------------------------------------------------
  2145.   # ● 連携スキル判別
  2146.   #--------------------------------------------------------------------------
  2147.   def synthe_spell(battler)
  2148.   end
  2149.   #--------------------------------------------------------------------------
  2150.   # ● スキルラーニングシステム
  2151.   #--------------------------------------------------------------------------
  2152.   def skill_learning(actor, class_id, skill_id)
  2153.   end
  2154.   #--------------------------------------------------------------------------
  2155.   # ● 行動可能判定
  2156.   #--------------------------------------------------------------------------
  2157.   def active?(battler)
  2158.     speller = synthe?(battler)
  2159.     if speller != nil
  2160.       if synthe_delete?(speller)
  2161.         return false
  2162.       end
  2163.     else
  2164.       unless battler.inputable?
  2165.         spell_reset(battler)
  2166.         unless battler.movable?
  2167.           battler.atp = 0
  2168.           return false
  2169.         end
  2170.       end
  2171.       if battler.current_action.forcing
  2172.         spell_reset(battler)
  2173.       end
  2174.     end
  2175.     return true
  2176.   end
  2177.   #--------------------------------------------------------------------------
  2178.   # ● 合成スキル詠唱中か?
  2179.   #--------------------------------------------------------------------------
  2180.   def synthe?(battler)
  2181.     for speller in @synthe
  2182.       if speller.include?(battler)
  2183.         return speller
  2184.       end
  2185.     end
  2186.     return nil
  2187.   end
  2188.   #--------------------------------------------------------------------------
  2189.   # ● 合成スキル消去判断
  2190.   #--------------------------------------------------------------------------
  2191.   def synthe_delete?(speller)
  2192.     for battler in speller
  2193.       if not battler.inputable? and dead_ok?(battler)
  2194.         synthe_delete(speller)
  2195.         return true
  2196.       end
  2197.     end
  2198.     return false
  2199.   end
  2200.   #--------------------------------------------------------------------------
  2201.   # ● 合成スキル消去
  2202.   #--------------------------------------------------------------------------
  2203.   def synthe_delete(speller)
  2204.     for battler in speller
  2205.       spell_reset(battler)
  2206.       if dead_ok?(battler)
  2207.         @action_battlers.delete(battler)
  2208.       end
  2209.     end
  2210.     @synthe.delete(speller)
  2211.   end
  2212.   #--------------------------------------------------------------------------
  2213.   # ● 連携含むスキル詠唱解除
  2214.   #--------------------------------------------------------------------------
  2215.   def skill_reset(battler)
  2216.     speller = synthe?(battler)
  2217.     if speller != nil
  2218.       synthe_delete(speller)
  2219.     else
  2220.       spell_reset(battler)
  2221.     end
  2222.   end
  2223.   #--------------------------------------------------------------------------
  2224.   # ● スキル詠唱解除
  2225.   #--------------------------------------------------------------------------
  2226.   def spell_reset(battler)
  2227.     battler.rt = 0
  2228.     battler.rtp = 0
  2229.     battler.blink = false
  2230.     battler.spell = false
  2231.     battler.current_action.spell_id = 0
  2232.     @spell_p.delete(battler)
  2233.     @spell_e.delete(battler)
  2234.   end
  2235.   #--------------------------------------------------------------------------
  2236.   # ● 戦闘終了判定
  2237.   #--------------------------------------------------------------------------
  2238.   def fin?
  2239.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2240.   end
  2241.   #--------------------------------------------------------------------------
  2242.   # ● 敵全滅判定
  2243.   #--------------------------------------------------------------------------
  2244.   def victory?
  2245.     for battler in $game_troop.enemies
  2246.       if battler.exist?
  2247.         return false
  2248.       end
  2249.     end
  2250.     return true
  2251.   end
  2252.   #--------------------------------------------------------------------------
  2253.   # ● 死亡許可判定
  2254.   #--------------------------------------------------------------------------
  2255.   def dead_ok?(battler)
  2256.     speller = synthe?(battler)
  2257.     if speller == nil
  2258.       if @action_battlers.include?(battler)
  2259.         if battler.phase > 2
  2260.           return false
  2261.         end
  2262.       end
  2263.     else
  2264.       for battler in speller
  2265.         if @action_battlers.include?(battler)
  2266.           if battler.phase > 2
  2267.             return false
  2268.           end
  2269.         end
  2270.       end
  2271.     end
  2272.     return true
  2273.   end
  2274. end

  2275. #==============================================================================
  2276. # ■ Game_Actor
  2277. #------------------------------------------------------------------------------
  2278. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2279. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2280. #==============================================================================

  2281. class Game_Actor < Game_Battler
  2282.   #--------------------------------------------------------------------------
  2283.   # ● バトル画面 X 座標の取得
  2284.   #--------------------------------------------------------------------------
  2285.   def screen_x
  2286.     # パーティ内の並び順から X 座標を計算して返す
  2287.     if self.index != nil
  2288.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2289.     else
  2290.       return 0
  2291.     end
  2292.   end
  2293. end

  2294. #==============================================================================
  2295. # ■ Spriteset_Battle
  2296. #------------------------------------------------------------------------------
  2297. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2298. # スの内部で使用されます。
  2299. #==============================================================================

  2300. class Spriteset_Battle
  2301.   #--------------------------------------------------------------------------
  2302.   # ● 公開インスタンス変数
  2303.   #--------------------------------------------------------------------------
  2304.   attr_reader   :real_x                   # x座標補正(現在値)
  2305.   attr_reader   :real_y                   # y座標補正(現在値)
  2306.   attr_reader   :real_zoom                # 拡大率(現在値)
  2307.   #--------------------------------------------------------------------------
  2308.   # ● オブジェクト初期化
  2309.   #--------------------------------------------------------------------------
  2310.   def initialize
  2311.     # ビューポートを作成
  2312.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2313.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2314.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2315.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2316.     @viewport2.z = 101
  2317.     @viewport3.z = 200
  2318.     @viewport4.z = 5000
  2319.     @wait = 0
  2320.     @real_x = 0
  2321.     @real_y = 0
  2322.     @real_zoom = 1.0
  2323.     @target_x = 0
  2324.     @target_y = 0
  2325.     @target_zoom = 1.0
  2326.     @gap_x = 0
  2327.     @gap_y = 0
  2328.     @gap_zoom = 0.0
  2329.     # バトルバックスプライトを作成
  2330.     @battleback_sprite = Sprite.new(@viewport1)
  2331.     # エネミースプライトを作成
  2332.     @enemy_sprites = []
  2333.     for enemy in $game_troop.enemies.reverse
  2334.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2335.     end
  2336.     # アクタースプライトを作成
  2337.     @actor_sprites = []
  2338.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2339.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2340.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2341.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2342.     # 天候を作成
  2343.     @weather = RPG::Weather.new(@viewport1)
  2344.     # ピクチャスプライトを作成
  2345.     @picture_sprites = []
  2346.     for i in 51..100
  2347.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2348.         $game_screen.pictures[i]))
  2349.     end
  2350.     # タイマースプライトを作成
  2351.     @timer_sprite = Sprite_Timer.new
  2352.     # フレーム更新
  2353.     update
  2354.   end
  2355.   #--------------------------------------------------------------------------
  2356.   # ● フレーム更新
  2357.   #--------------------------------------------------------------------------
  2358.   def update
  2359.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2360.     @actor_sprites[0].battler = $game_party.actors[0]
  2361.     @actor_sprites[1].battler = $game_party.actors[1]
  2362.     @actor_sprites[2].battler = $game_party.actors[2]
  2363.     @actor_sprites[3].battler = $game_party.actors[3]
  2364.     # バトルバックのファイル名が現在のものと違う場合
  2365.     if @battleback_name != $game_temp.battleback_name
  2366.       make_battleback
  2367.     end
  2368.     # 画面のスクロール
  2369.     screen_scroll
  2370.     # モンスターの位置補正
  2371.     for enemy in $game_troop.enemies
  2372.       enemy.real_x = @real_x
  2373.       enemy.real_y = @real_y
  2374.       enemy.real_zoom = @real_zoom
  2375.     end
  2376.     # バトラースプライトを更新
  2377.     for sprite in @enemy_sprites + @actor_sprites
  2378.       sprite.update
  2379.     end
  2380.     # 天候グラフィックを更新
  2381.     @weather.type = $game_screen.weather_type
  2382.     @weather.max = $game_screen.weather_max
  2383.     @weather.update
  2384.     # ピクチャスプライトを更新
  2385.     for sprite in @picture_sprites
  2386.       sprite.update
  2387.     end
  2388.     # タイマースプライトを更新
  2389.     @timer_sprite.update
  2390.     # 画面の色調とシェイク位置を設定
  2391.     @viewport1.tone = $game_screen.tone
  2392.     @viewport1.ox = $game_screen.shake
  2393.     # 画面のフラッシュ色を設定
  2394.     @viewport4.color = $game_screen.flash_color
  2395.     # ビューポートを更新
  2396.     @viewport1.update
  2397.     @viewport2.update
  2398.     @viewport4.update
  2399.   end
  2400.   #--------------------------------------------------------------------------
  2401.   # ● バトル背景の設定
  2402.   #--------------------------------------------------------------------------
  2403.   def make_battleback
  2404.     @battleback_name = $game_temp.battleback_name
  2405.     if @battleback_sprite.bitmap != nil
  2406.       @battleback_sprite.bitmap.dispose
  2407.     end
  2408.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2409.     if @battleback_sprite.bitmap.width == 640 and
  2410.        @battleback_sprite.bitmap.height == 320
  2411.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2412.       @base_zoom = 2.0
  2413.       @battleback_sprite.zoom_x = @base_zoom
  2414.       @battleback_sprite.zoom_y = @base_zoom
  2415.       @real_y = 4
  2416.       @battleback_sprite.x = 320
  2417.       @battleback_sprite.y = @real_y
  2418.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2419.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2420.     elsif @battleback_sprite.bitmap.width == 640 and
  2421.           @battleback_sprite.bitmap.height == 480
  2422.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2423.       @base_zoom = 1.5
  2424.       @battleback_sprite.zoom_x = @base_zoom
  2425.       @battleback_sprite.zoom_y = @base_zoom
  2426.       @battleback_sprite.x = 320
  2427.       @battleback_sprite.y = 0
  2428.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2429.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2430.     else
  2431.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2432.                                       @battleback_sprite.bitmap.height)
  2433.       @base_zoom = 1.0
  2434.       @battleback_sprite.zoom_x = @base_zoom
  2435.       @battleback_sprite.zoom_y = @base_zoom
  2436.       @battleback_sprite.x = 320
  2437.       @battleback_sprite.y = 0
  2438.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2439.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2440.     end
  2441.   end
  2442.   #--------------------------------------------------------------------------
  2443.   # ● 画面のスクロール目標の位置・拡大率設定
  2444.   #--------------------------------------------------------------------------
  2445.   def screen_target(x, y, zoom)
  2446.     return unless $scene.drive
  2447.     @wait = $scene.scroll_time
  2448.     @target_x = x
  2449.     @target_y = y
  2450.     @target_zoom = zoom
  2451.     screen_over
  2452.     @gap_x = @target_x - @real_x
  2453.     @gap_y = @target_y - @real_y
  2454.     @gap_zoom = @target_zoom - @real_zoom
  2455.   end
  2456.   #--------------------------------------------------------------------------
  2457.   # ● 画面のスクロール
  2458.   #--------------------------------------------------------------------------
  2459.   def screen_scroll
  2460.     if @wait > 0
  2461.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2462.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2463.       @real_zoom = @target_zoom -
  2464.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2465.       @battleback_sprite.x = 320 + @real_x
  2466.       @battleback_sprite.y = @real_y
  2467.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2468.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2469.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2470.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2471.       @wait -= 1
  2472.     end
  2473.   end
  2474.   #--------------------------------------------------------------------------
  2475.   # ● スクリーンが画面外に出た時の補正処理
  2476.   #--------------------------------------------------------------------------
  2477.   def screen_over
  2478.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2479.     unless 324 + @target_x > width and 324 - @target_x > width
  2480.       if 324 + @target_x > width
  2481.         @target_x = width - 324
  2482.       elsif 324 - @target_x > width
  2483.         @target_x = 324 - width
  2484.       end
  2485.     end
  2486.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2487.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2488.       if @target_y > height - 4
  2489.         @target_y = height - 4
  2490.       elsif 484 - @target_y > 3 * height
  2491.         @target_y = 484 - 3 * height
  2492.       end
  2493.     end
  2494.   end
  2495. end

  2496. #==============================================================================
  2497. # ■ Game_Battler (分割定義 1)
  2498. #------------------------------------------------------------------------------
  2499. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2500. # スのスーパークラスとして使用されます。
  2501. #==============================================================================

  2502. class Game_Battler
  2503.   #--------------------------------------------------------------------------
  2504.   # ● 公開インスタンス変数追加
  2505.   #--------------------------------------------------------------------------
  2506.   attr_accessor :up_level                  # レベルアップ数
  2507.   attr_accessor :at                        # AT(タイムゲージ)
  2508.   attr_accessor :atp                       # AT(表示用)
  2509.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2510.   attr_accessor :rtp                       # RP(詠唱必要量)
  2511.   attr_accessor :spell                     # 合成スキル発動中
  2512.   attr_accessor :recover_hp                # HP回復量
  2513.   attr_accessor :recover_sp                # SP回復量
  2514.   attr_accessor :state_p                   # ステータス異常配列
  2515.   attr_accessor :state_m                   # ステータス異常配列
  2516.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2517.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2518.   attr_accessor :phase
  2519.   attr_accessor :wait
  2520.   attr_accessor :target
  2521.   attr_accessor :anime1
  2522.   attr_accessor :anime2
  2523.   attr_accessor :event
  2524.   #--------------------------------------------------------------------------
  2525.   # ● オブジェクト初期化
  2526.   #--------------------------------------------------------------------------
  2527.   alias :initialize_rtab :initialize
  2528.   def initialize
  2529.     initialize_rtab
  2530.     @damage_pop = {}
  2531.     @damage = {}
  2532.     @damage_sp = {}
  2533.     @critical = {}
  2534.     @recover_hp = {}
  2535.     @recover_sp = {}
  2536.     @state_p = {}
  2537.     @state_m = {}
  2538.     @animation = []
  2539.     @phase = 1
  2540.     @wait = 0
  2541.     @target = []
  2542.     @anime1 = 0
  2543.     @anime2 = 0
  2544.     @event = 0
  2545.   end
  2546.   #--------------------------------------------------------------------------
  2547.   # ● 存在判定
  2548.   #--------------------------------------------------------------------------
  2549.   def exist?
  2550.     return (not @hidden and (@hp > 0 or @immortal or @damage_pop.size > 0))
  2551.   end
  2552.   #--------------------------------------------------------------------------
  2553.   # ● ステートの解除
  2554.   #     state_id : ステート ID
  2555.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2556.   #--------------------------------------------------------------------------
  2557.   def remove_state(state_id, force = false)
  2558.     # このステートが付加されている場合
  2559.     if state?(state_id)
  2560.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2561.       if @states_turn[state_id] == -1 and not force
  2562.         # メソッド終了
  2563.         return
  2564.       end
  2565.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2566.       if @hp == 0 and $data_states[state_id].zero_hp
  2567.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2568.         zero_hp = false
  2569.         for i in @states
  2570.           if i != state_id and $data_states[i].zero_hp
  2571.             zero_hp = true
  2572.           end
  2573.         end
  2574.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2575.         if zero_hp == false
  2576.           @hp = 1
  2577.         end
  2578.       end
  2579.       unless self.movable?
  2580.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2581.         @states.delete(state_id)
  2582.         @states_turn.delete(state_id)
  2583.         if self.movable?
  2584.           self.at = 0
  2585.         end
  2586.       else
  2587.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2588.         @states.delete(state_id)
  2589.         @states_turn.delete(state_id)
  2590.       end
  2591.     end
  2592.     # HP および SP の最大値チェック
  2593.     @hp = [@hp, self.maxhp].min
  2594.     @sp = [@sp, self.maxsp].min
  2595.   end
  2596.   #--------------------------------------------------------------------------
  2597.   # ● 通常攻撃の効果適用
  2598.   #     attacker : 攻撃者 (バトラー)
  2599.   #--------------------------------------------------------------------------
  2600.   def attack_effect(attacker)
  2601.     # クリティカルフラグをクリア
  2602.     self.critical[attacker] = false
  2603.     state_p[attacker] = []
  2604.     state_m[attacker] = []
  2605.     # 第一命中判定
  2606.     hit_result = (rand(100) < attacker.hit)
  2607.     # 命中の場合
  2608.     if hit_result == true
  2609.       # 基本ダメージを計算
  2610.       atk = [attacker.atk - self.pdef / 2, 0].max
  2611.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2612.       # 属性修正
  2613.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2614.       self.damage[attacker] /= 100
  2615.       # ダメージの符号が正の場合
  2616.       if self.damage[attacker] > 0
  2617.         # クリティカル修正
  2618.         if rand(100) < 4 * attacker.dex / self.agi
  2619.           self.damage[attacker] *= 2
  2620.           self.critical[attacker] = true
  2621.         end
  2622.         # 防御修正
  2623.         if self.guarding?
  2624.           self.damage[attacker] /= 2
  2625.         end
  2626.       end
  2627.       # 分散
  2628.       if self.damage[attacker].abs > 0
  2629.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2630.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2631.       end
  2632.       # 第二命中判定
  2633.       eva = 8 * self.agi / attacker.dex + self.eva
  2634.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2635.       hit = self.cant_evade? ? 100 : hit
  2636.       hit_result = (rand(100) < hit)
  2637.     end
  2638.     # 命中の場合
  2639.     if hit_result == true
  2640.       # ステート衝撃解除
  2641.       remove_states_shock
  2642.       # HP からダメージを減算
  2643.       # ステート変化
  2644.       @state_changed = false
  2645.       states_plus(attacker, attacker.plus_state_set)
  2646.       states_minus(attacker, attacker.minus_state_set)
  2647.     # ミスの場合
  2648.     else
  2649.       # ダメージに "Miss" を設定
  2650.       self.damage[attacker] = "Miss"
  2651.       # クリティカルフラグをクリア
  2652.       self.critical[attacker] = false
  2653.     end
  2654.     # メソッド終了
  2655.     return true
  2656.   end
  2657.   #--------------------------------------------------------------------------
  2658.   # ● スキルの効果適用
  2659.   #     user  : スキルの使用者 (バトラー)
  2660.   #     skill : スキル
  2661.   #--------------------------------------------------------------------------
  2662.   def skill_effect(user, skill)
  2663.     # クリティカルフラグをクリア
  2664.     self.critical[user] = false
  2665.     state_p[user] = []
  2666.     state_m[user] = []
  2667.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2668.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2669.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  2670.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2671.       # メソッド終了
  2672.       return false
  2673.     end
  2674.     # 有効フラグをクリア
  2675.     effective = false
  2676.     # コモンイベント ID が有効の場合は有効フラグをセット
  2677.     effective |= skill.common_event_id > 0
  2678.     # 第一命中判定
  2679.     hit = skill.hit
  2680.     if skill.atk_f > 0
  2681.       hit *= user.hit / 100
  2682.     end
  2683.     hit_result = (rand(100) < hit)
  2684.     # 不確実なスキルの場合は有効フラグをセット
  2685.     effective |= hit < 100
  2686.     # 命中の場合
  2687.     if hit_result == true
  2688.       # 威力を計算
  2689.       power = skill.power + user.atk * skill.atk_f / 100
  2690.       if power > 0
  2691.         power -= self.pdef * skill.pdef_f / 200
  2692.         power -= self.mdef * skill.mdef_f / 200
  2693.         power = [power, 0].max
  2694.       end
  2695.       # 倍率を計算
  2696.       rate = 20
  2697.       rate += (user.str * skill.str_f / 100)
  2698.       rate += (user.dex * skill.dex_f / 100)
  2699.       rate += (user.agi * skill.agi_f / 100)
  2700.       rate += (user.int * skill.int_f / 100)
  2701.       # 基本ダメージを計算
  2702.       self.damage[user] = power * rate / 20
  2703.       # 属性修正
  2704.       self.damage[user] *= elements_correct(skill.element_set)
  2705.       self.damage[user] /= 100
  2706.       # ダメージの符号が正の場合
  2707.       if self.damage[user] > 0
  2708.         # 防御修正
  2709.         if self.guarding?
  2710.           self.damage[user] /= 2
  2711.         end
  2712.       end
  2713.       # 分散
  2714.       if skill.variance > 0 and self.damage[user].abs > 0
  2715.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  2716.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  2717.       end
  2718.       # 第二命中判定
  2719.       eva = 8 * self.agi / user.dex + self.eva
  2720.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  2721.       hit = self.cant_evade? ? 100 : hit
  2722.       hit_result = (rand(100) < hit)
  2723.       # 不確実なスキルの場合は有効フラグをセット
  2724.       effective |= hit < 100
  2725.     end
  2726.     # 命中の場合
  2727.     if hit_result == true
  2728.       # 威力 0 以外の物理攻撃の場合
  2729.       if skill.power != 0 and skill.atk_f > 0
  2730.         # ステート衝撃解除
  2731.         remove_states_shock
  2732.         # 有効フラグをセット
  2733.         effective = true
  2734.       end
  2735.       # HP の変動判定
  2736.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  2737.       # 効果判定
  2738.       effective |= self.hp != last_hp
  2739.       # ステート変化
  2740.       @state_changed = false
  2741.       effective |= states_plus(user, skill.plus_state_set)
  2742.       effective |= states_minus(user, skill.minus_state_set)
  2743.       unless $game_temp.in_battle
  2744.         self.damage_effect(user, 1)
  2745.       end
  2746.       # 威力が 0 の場合
  2747.       if skill.power == 0
  2748.         # ダメージに空文字列を設定
  2749.         self.damage[user] = ""
  2750.         # ステートに変化がない場合
  2751.         unless @state_changed
  2752.           # ダメージに "Miss" を設定
  2753.           self.damage[user] = "Miss"
  2754.         end
  2755.       end
  2756.     # ミスの場合
  2757.     else
  2758.       # ダメージに "Miss" を設定
  2759.       self.damage[user] = "Miss"
  2760.     end
  2761.     # 戦闘中でない場合
  2762.     unless $game_temp.in_battle
  2763.       # ダメージに nil を設定
  2764.       self.damage[user] = nil
  2765.     end
  2766.     # メソッド終了
  2767.     return effective
  2768.   end
  2769.   #--------------------------------------------------------------------------
  2770.   # ● アイテムの効果適用
  2771.   #     item : アイテム
  2772.   #--------------------------------------------------------------------------
  2773.   def item_effect(item, user = $game_party.actors[0])
  2774.     # クリティカルフラグをクリア
  2775.     self.critical[user] = false
  2776.     state_p[user] = []
  2777.     state_m[user] = []
  2778.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2779.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2780.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  2781.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  2782.       # メソッド終了
  2783.       return false
  2784.     end
  2785.     # 有効フラグをクリア
  2786.     effective = false
  2787.     # コモンイベント ID が有効の場合は有効フラグをセット
  2788.     effective |= item.common_event_id > 0
  2789.     # 命中判定
  2790.     hit_result = (rand(100) < item.hit)
  2791.     # 不確実なスキルの場合は有効フラグをセット
  2792.     effective |= item.hit < 100
  2793.     # 命中の場合
  2794.     if hit_result == true
  2795.       # 回復量を計算
  2796.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  2797.                               item.recover_hp
  2798.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  2799.                               item.recover_sp
  2800.       if self.recover_hp[user] < 0
  2801.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  2802.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  2803.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  2804.       end
  2805.       # 属性修正
  2806.       self.recover_hp[user] *= elements_correct(item.element_set)
  2807.       self.recover_hp[user] /= 100
  2808.       self.recover_sp[user] *= elements_correct(item.element_set)
  2809.       self.recover_sp[user] /= 100
  2810.       # 分散
  2811.       if item.variance > 0 and self.recover_hp[user].abs > 0
  2812.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  2813.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  2814.       end
  2815.       if item.variance > 0 and self.recover_sp[user].abs > 0
  2816.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  2817.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  2818.       end
  2819.       # 回復量の符号が負の場合
  2820.       if self.recover_hp[user] < 0
  2821.         # 防御修正
  2822.         if self.guarding?
  2823.           self.recover_hp[user] /= 2
  2824.         end
  2825.       end
  2826.       # HP 回復量の符号を反転し、ダメージの値に設定
  2827.       self.damage[user] = -self.recover_hp[user]
  2828.       # HP および SP の変動判定
  2829.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  2830.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  2831.       effective |= self.hp != last_hp
  2832.       effective |= self.sp != last_sp
  2833.       # ステート変化
  2834.       @state_changed = false
  2835.       effective |= states_plus(user, item.plus_state_set)
  2836.       effective |= states_minus(user, item.minus_state_set)
  2837.       unless $game_temp.in_battle
  2838.         self.damage_effect(user, 2)
  2839.       end
  2840.       # パラメータ上昇値が有効の場合
  2841.       if item.parameter_type > 0 and item.parameter_points != 0
  2842.         # パラメータで分岐
  2843.         case item.parameter_type
  2844.         when 1  # MaxHP
  2845.           @maxhp_plus += item.parameter_points
  2846.         when 2  # MaxSP
  2847.           @maxsp_plus += item.parameter_points
  2848.         when 3  # 腕力
  2849.           @str_plus += item.parameter_points
  2850.         when 4  # 器用さ
  2851.           @dex_plus += item.parameter_points
  2852.         when 5  # 素早さ
  2853.           @agi_plus += item.parameter_points
  2854.         when 6  # 魔力
  2855.           @int_plus += item.parameter_points
  2856.         end
  2857.         # 有効フラグをセット
  2858.         effective = true
  2859.       end
  2860.       # HP 回復率と回復量が 0 の場合
  2861.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  2862.         # ダメージに空文字列を設定
  2863.         self.damage[user] = ""
  2864.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  2865.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  2866.            (item.parameter_type == 0 or item.parameter_points == 0)
  2867.           # ステートに変化がない場合
  2868.           unless @state_changed
  2869.             # ダメージに "Miss" を設定
  2870.             self.damage[user] = "Miss"
  2871.           end
  2872.         end
  2873.       end
  2874.     # ミスの場合
  2875.     else
  2876.       # ダメージに "Miss" を設定
  2877.       self.damage[user] = "Miss"
  2878.     end
  2879.     # 戦闘中でない場合
  2880.     unless $game_temp.in_battle
  2881.       # ダメージに nil を設定
  2882.       self.damage[user] = nil
  2883.     end
  2884.     # メソッド終了
  2885.     return effective
  2886.   end
  2887.   #--------------------------------------------------------------------------
  2888.   # ● ステート変化 (+) の適用
  2889.   #     plus_state_set  : ステート変化 (+)
  2890.   #--------------------------------------------------------------------------
  2891.   def states_plus(battler, plus_state_set)
  2892.     # 有効フラグをクリア
  2893.     effective = false
  2894.     # ループ (付加するステート)
  2895.     for i in plus_state_set
  2896.       # このステートが防御されていない場合
  2897.       unless self.state_guard?(i)
  2898.         # このステートがフルでなければ有効フラグをセット
  2899.         effective |= self.state_full?(i) == false
  2900.         # ステートが [抵抗しない] の場合
  2901.         if $data_states[i].nonresistance
  2902.           # ステート変化フラグをセット
  2903.           @state_changed = true
  2904.           # ステートを付加
  2905.           add_state(i)
  2906.         # このステートがフルではない場合
  2907.         elsif self.state_full?(i) == false
  2908.           # ステート有効度を確率に変換し、乱数と比較
  2909.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  2910.             # ステート変化フラグをセット
  2911.             @state_changed = true
  2912.             # ステートを付加
  2913.             self.state_p[battler].push(i)
  2914.           end
  2915.         end
  2916.       end
  2917.     end
  2918.     # メソッド終了
  2919.     return effective
  2920.   end
  2921.   #--------------------------------------------------------------------------
  2922.   # ● ステート変化 (-) の適用
  2923.   #     minus_state_set : ステート変化 (-)
  2924.   #--------------------------------------------------------------------------
  2925.   def states_minus(battler, minus_state_set)
  2926.     # 有効フラグをクリア
  2927.     effective = false
  2928.     # ループ (解除するステート)
  2929.     for i in minus_state_set
  2930.       # このステートが付加されていれば有効フラグをセット
  2931.       effective |= self.state?(i)
  2932.       # ステート変化フラグをセット
  2933.       @state_changed = true
  2934.       # ステートを解除
  2935.       self.state_m[battler].push(i)
  2936.     end
  2937.     # メソッド終了
  2938.     return effective
  2939.   end
  2940.   #--------------------------------------------------------------------------
  2941.   # ● ダメージ演算
  2942.   #--------------------------------------------------------------------------
  2943.   def damage_effect(battler, item)
  2944.     if item == 2
  2945.       self.hp += self.recover_hp[battler]
  2946.       self.sp += self.recover_sp[battler]
  2947.       if self.recover_sp[battler] != 0
  2948.         self.damage_sp[battler] = -self.recover_sp[battler]
  2949.       end
  2950.     else
  2951.       if self.damage[battler].class != String
  2952.         self.hp -= self.damage[battler]
  2953.       end
  2954.     end
  2955.     for i in self.state_p[battler]
  2956.       add_state(i)
  2957.     end
  2958.     for i in self.state_m[battler]
  2959.       remove_state(i)
  2960.     end
  2961.   end
  2962.   #--------------------------------------------------------------------------
  2963.   # ● スリップダメージの効果適用
  2964.   #--------------------------------------------------------------------------
  2965.   def slip_damage_effect
  2966.     # ダメージを設定
  2967.     self.damage["slip"] = self.maxhp / 10
  2968.     # 分散
  2969.     if self.damage["slip"].abs > 0
  2970.       amp = [self.damage["slip"].abs * 15 / 100, 1].max
  2971.       self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
  2972.     end
  2973.     # HP からダメージを減算
  2974.     self.hp -= self.damage["slip"]
  2975.     # メソッド終了
  2976.     return true
  2977.   end
  2978. end

  2979. #==============================================================================
  2980. # ■ Game_BattleAction
  2981. #------------------------------------------------------------------------------
  2982. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  2983. # スの内部で使用されます。
  2984. #==============================================================================

  2985. class Game_BattleAction
  2986.   #--------------------------------------------------------------------------
  2987.   # ● 公開インスタンス変数
  2988.   #--------------------------------------------------------------------------
  2989.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  2990.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  2991.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  2992.   attr_accessor :force_skill_id           # スキル ID
  2993.   #--------------------------------------------------------------------------
  2994.   # ● 有効判定
  2995.   #--------------------------------------------------------------------------
  2996.   def valid?
  2997.     return (not (@force_kind == 0 and @force_basic == 3))
  2998.   end
  2999. end

  3000. #==============================================================================
  3001. # ■ Game_Actor
  3002. #------------------------------------------------------------------------------
  3003. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3004. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3005. #==============================================================================

  3006. class Game_Actor < Game_Battler
  3007.   def skill_can_use?(skill_id)
  3008.     return super
  3009.   end
  3010. end

  3011. #==============================================================================
  3012. # ■ Game_Enemy
  3013. #------------------------------------------------------------------------------
  3014. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3015. # 内部で使用されます。
  3016. #==============================================================================

  3017. class Game_Enemy < Game_Battler
  3018.   #--------------------------------------------------------------------------
  3019.   # ● 公開インスタンス変数
  3020.   #--------------------------------------------------------------------------
  3021.   attr_accessor :height                  # 画像の高さ
  3022.   attr_accessor :real_x                  # X座標補正
  3023.   attr_accessor :real_y                  # Y座標補正
  3024.   attr_accessor :real_zoom               # 拡大率
  3025.   #--------------------------------------------------------------------------
  3026.   # ● オブジェクト初期化
  3027.   #     troop_id     : トループ ID
  3028.   #     member_index : トループメンバーのインデックス
  3029.   #--------------------------------------------------------------------------
  3030.   def initialize(troop_id, member_index)
  3031.     super()
  3032.     @troop_id = troop_id
  3033.     @member_index = member_index
  3034.     troop = $data_troops[@troop_id]
  3035.     @enemy_id = troop.members[@member_index].enemy_id
  3036.     enemy = $data_enemies[@enemy_id]
  3037.     @battler_name = enemy.battler_name
  3038.     @battler_hue = enemy.battler_hue
  3039.     @hp = maxhp
  3040.     @sp = maxsp
  3041.     @real_x = 0
  3042.     @real_y = 0
  3043.     @real_zoom = 1.0
  3044.     @fly = 0
  3045.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3046.     @hidden = troop.members[@member_index].hidden
  3047.     @immortal = troop.members[@member_index].immortal
  3048.   end
  3049.   alias :true_x :screen_x
  3050.   alias :true_y :screen_y
  3051.   #--------------------------------------------------------------------------
  3052.   # ● バトル画面 X 座標の取得
  3053.   #--------------------------------------------------------------------------
  3054.   def screen_x
  3055.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3056.   end
  3057.   #--------------------------------------------------------------------------
  3058.   # ● バトル画面 Y 座標の取得
  3059.   #--------------------------------------------------------------------------
  3060.   def screen_y
  3061.     return true_y * @real_zoom + @real_y
  3062.   end
  3063.   #--------------------------------------------------------------------------
  3064.   # ● バトル画面 Z 座標の取得
  3065.   #--------------------------------------------------------------------------
  3066.   def screen_z
  3067.     return true_y + @fly
  3068.   end
  3069.   #--------------------------------------------------------------------------
  3070.   # ● バトル画面 拡大率の取得
  3071.   #--------------------------------------------------------------------------
  3072.   def zoom
  3073.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3074.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3075.   end
  3076.   #--------------------------------------------------------------------------
  3077.   # ● 攻撃用、バトル画面 X 座標の取得
  3078.   #--------------------------------------------------------------------------
  3079.   def attack_x(z)
  3080.     return (320 - true_x) * z * 0.75
  3081.   end
  3082.   #--------------------------------------------------------------------------
  3083.   # ● 攻撃用、バトル画面 Y 座標の取得
  3084.   #--------------------------------------------------------------------------
  3085.   def attack_y(z)
  3086.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3087.   end
  3088.   #--------------------------------------------------------------------------
  3089.   # ● アクション作成
  3090.   #--------------------------------------------------------------------------
  3091.   def make_action
  3092.     # カレントアクションをクリア
  3093.     self.current_action.clear
  3094.     # 動けない場合
  3095.     unless self.inputable?
  3096.       # メソッド終了
  3097.       return
  3098.     end
  3099.     # 現在有効なアクションを抽出
  3100.     available_actions = []
  3101.     rating_max = 0
  3102.     for action in self.actions
  3103.       # ターン 条件確認
  3104.       n = $game_temp.battle_turn
  3105.       a = action.condition_turn_a
  3106.       b = action.condition_turn_b
  3107.       if (b == 0 and n != a) or
  3108.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3109.         next
  3110.       end
  3111.       # HP 条件確認
  3112.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3113.         next
  3114.       end
  3115.       # レベル 条件確認
  3116.       if $game_party.max_level < action.condition_level
  3117.         next
  3118.       end
  3119.       # スイッチ 条件確認
  3120.       switch_id = action.condition_switch_id
  3121.       if switch_id > 0 and $game_switches[switch_id] == false
  3122.         next
  3123.       end
  3124.       # スキル使用可能 条件確認
  3125.       if action.kind == 1
  3126.         unless self.skill_can_use?(action.skill_id)
  3127.           next
  3128.         end
  3129.       end
  3130.       # 条件に該当 : このアクションを追加
  3131.       available_actions.push(action)
  3132.       if action.rating > rating_max
  3133.         rating_max = action.rating
  3134.       end
  3135.     end
  3136.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3137.     ratings_total = 0
  3138.     for action in available_actions
  3139.       if action.rating > rating_max - 3
  3140.         ratings_total += action.rating - (rating_max - 3)
  3141.       end
  3142.     end
  3143.     # レーティングの合計が 0 ではない場合
  3144.     if ratings_total > 0
  3145.       # 乱数を作成
  3146.       value = rand(ratings_total)
  3147.       # 作成した乱数に対応するものをカレントアクションに設定
  3148.       for action in available_actions
  3149.         if action.rating > rating_max - 3
  3150.           if value < action.rating - (rating_max - 3)
  3151.             self.current_action.kind = action.kind
  3152.             self.current_action.basic = action.basic
  3153.             self.current_action.skill_id = action.skill_id
  3154.             self.current_action.decide_random_target_for_enemy
  3155.             return
  3156.           else
  3157.             value -= action.rating - (rating_max - 3)
  3158.           end
  3159.         end
  3160.       end
  3161.     end
  3162.   end
  3163. end

  3164. #==============================================================================
  3165. # ■ Game_Party
  3166. #------------------------------------------------------------------------------
  3167. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3168. # ラスのインスタンスは $game_party で参照されます。
  3169. #==============================================================================

  3170. class Game_Party
  3171.   #--------------------------------------------------------------------------
  3172.   # ● 全滅判定
  3173.   #--------------------------------------------------------------------------
  3174.   def all_dead?
  3175.     # パーティ人数が 0 人の場合
  3176.     if $game_party.actors.size == 0
  3177.       return false
  3178.     end
  3179.     # HP 0 以上のアクターがパーティにいる場合
  3180.     for actor in @actors
  3181.       if actor.hp > 0 or actor.damage.size > 0
  3182.         return false
  3183.       end
  3184.     end
  3185.     # 全滅
  3186.     return true
  3187.   end
  3188. end

  3189. #==============================================================================
  3190. # ■ Sprite_Battler
  3191. #------------------------------------------------------------------------------
  3192. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3193. # スプライトの状態を自動的に変化させます。
  3194. #==============================================================================

  3195. class Sprite_Battler < RPG::Sprite
  3196.   #--------------------------------------------------------------------------
  3197.   # ● フレーム更新
  3198.   #--------------------------------------------------------------------------
  3199.   def update
  3200.     super
  3201.     # バトラーが nil の場合
  3202.     if @battler == nil
  3203.       self.bitmap = nil
  3204.       loop_animation(nil)
  3205.       return
  3206.     end
  3207.     # ファイル名か色相が現在のものと異なる場合
  3208.     if @battler.battler_name != @battler_name or
  3209.        @battler.battler_hue != @battler_hue
  3210.       # ビットマップを取得、設定
  3211.       @battler_name = @battler.battler_name
  3212.       @battler_hue = @battler.battler_hue
  3213.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3214.       @width = bitmap.width
  3215.       @height = bitmap.height
  3216.       self.ox = @width / 2
  3217.       self.oy = @height
  3218.       if @battler.is_a?(Game_Enemy)
  3219.         @battler.height = @height
  3220.       end
  3221.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3222.       if @battler.dead? or @battler.hidden
  3223.         self.opacity = 0
  3224.       end
  3225.     end
  3226.     # アニメーション ID が現在のものと異なる場合
  3227.     if @battler.state_animation_id != @state_animation_id
  3228.       @state_animation_id = @battler.state_animation_id
  3229.       loop_animation($data_animations[@state_animation_id])
  3230.     end
  3231.     # 表示されるべきアクターの場合
  3232.     if @battler.is_a?(Game_Actor) and @battler_visible
  3233.       # メインフェーズでないときは不透明度をやや下げる
  3234.       if $game_temp.battle_main_phase
  3235.         self.opacity += 3 if self.opacity < 255
  3236.       else
  3237.         self.opacity -= 3 if self.opacity > 207
  3238.       end
  3239.     end
  3240.     # 明滅
  3241.     if @battler.blink
  3242.       blink_on
  3243.     else
  3244.       blink_off
  3245.     end
  3246.     # 不可視の場合
  3247.     unless @battler_visible
  3248.       # 出現
  3249.       if not @battler.hidden and not @battler.dead? and
  3250.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3251.         appear
  3252.         @battler_visible = true
  3253.       end
  3254.     end
  3255.     # ダメージ
  3256.     for battler in @battler.damage_pop
  3257.       if battler[0].class == Array
  3258.         if battler[0][1] >= 0
  3259.           $scene.skill_se
  3260.         else
  3261.           $scene.levelup_se
  3262.         end
  3263.         damage(@battler.damage[battler[0]], false, 2)
  3264.       else
  3265.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3266.       end
  3267.       if @battler.damage_sp.include?(battler[0])
  3268.         damage(@battler.damage_sp[battler[0]],
  3269.                 @battler.critical[battler[0]], 1)
  3270.         @battler.damage_sp.delete(battler[0])
  3271.       end
  3272.       @battler.damage_pop.delete(battler[0])
  3273.       @battler.damage.delete(battler[0])
  3274.       @battler.critical.delete(battler[0])
  3275.     end
  3276.     # 可視の場合
  3277.     if @battler_visible
  3278.       # 逃走
  3279.       if @battler.hidden
  3280.         $game_system.se_play($data_system.escape_se)
  3281.         escape
  3282.         @battler_visible = false
  3283.       end
  3284.       # 白フラッシュ
  3285.       if @battler.white_flash
  3286.         whiten
  3287.         @battler.white_flash = false
  3288.       end
  3289.       # アニメーション
  3290.       unless @battler.animation.empty?
  3291.         for animation in @battler.animation.reverse
  3292.           animation($data_animations[animation[0]], animation[1])
  3293.           @battler.animation.delete(animation)
  3294.         end
  3295.       end
  3296.       # コラプス
  3297.       if @battler.damage.empty? and @battler.dead?
  3298.         if $scene.dead_ok?(@battler)
  3299.           if @battler.is_a?(Game_Enemy)
  3300.             $game_system.se_play($data_system.enemy_collapse_se)
  3301.           else
  3302.             $game_system.se_play($data_system.actor_collapse_se)
  3303.           end
  3304.           collapse
  3305.           @battler_visible = false
  3306.         end
  3307.       end
  3308.     end
  3309.     # スプライトの座標を設定
  3310.     self.x = @battler.screen_x
  3311.     self.y = @battler.screen_y
  3312.     self.z = @battler.screen_z
  3313.     if @battler.is_a?(Game_Enemy)
  3314.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3315.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3316.     end
  3317.   end
  3318. end

  3319. #==============================================================================
  3320. # ■ Window_Base
  3321. #------------------------------------------------------------------------------
  3322. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3323. #==============================================================================

  3324. class Window_Base < Window
  3325.   #--------------------------------------------------------------------------
  3326.   # ● ゲージの描画
  3327.   #--------------------------------------------------------------------------
  3328.   def gauge_rect_at(width, height, align3,
  3329.                     color1, color2, color3, color4, color5, color6, color7,
  3330.                     color8, color9, color10, color11, color12, grade1, grade2)
  3331.     # 枠描画
  3332.     @at_gauge = Bitmap.new(width, height * 5)
  3333.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3334.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3335.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3336.       color = color3
  3337.       color3 = color4
  3338.       color4 = color
  3339.     end
  3340.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3341.       color = color5
  3342.       color5 = color6
  3343.       color6 = color
  3344.       color = color7
  3345.       color7 = color8
  3346.       color8 = color
  3347.       color = color9
  3348.       color9 = color10
  3349.       color10 = color
  3350.       color = color11
  3351.       color11 = color12
  3352.       color12 = color
  3353.     end
  3354.     if align3 == 0
  3355.       if grade1 == 2
  3356.         grade1 = 3
  3357.       end
  3358.       if grade2 == 2
  3359.         grade2 = 3
  3360.       end
  3361.     end
  3362.     # 空ゲージの描画 縦にグラデーション表示
  3363.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3364.                                   color3, color4, grade1)
  3365.     # 実ゲージの描画
  3366.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3367.                                   color5, color6, grade2)
  3368.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3369.                                   color7, color8, grade2)
  3370.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3371.                                   color9, color10, grade2)
  3372.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3373.                                   color11, color12, grade2)
  3374.   end
  3375. end

  3376. #==============================================================================
  3377. # ■ Window_Help
  3378. #------------------------------------------------------------------------------
  3379. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3380. #==============================================================================

  3381. class Window_Help < Window_Base
  3382.   #--------------------------------------------------------------------------
  3383.   # ● エネミー設定
  3384.   #     enemy : 名前とステートを表示するエネミー
  3385.   #--------------------------------------------------------------------------
  3386.   def set_enemy(enemy)
  3387.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3388.     state_text = make_battler_state_text(enemy, 112, false)
  3389.     if state_text != ""
  3390.       text += "  " + state_text
  3391.     end
  3392.     set_text(text, 1)
  3393.   end
  3394. end

  3395. #==============================================================================
  3396. # ■ Window_BattleStatus
  3397. #------------------------------------------------------------------------------
  3398. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3399. #==============================================================================

  3400. class Window_BattleStatus < Window_Base
  3401.   #--------------------------------------------------------------------------
  3402.   # ● オブジェクト初期化
  3403.   #--------------------------------------------------------------------------
  3404.   def initialize
  3405.     x = (4 - $game_party.actors.size) * 80
  3406.     width = $game_party.actors.size * 160
  3407.     super(x, 320, width, 160)
  3408.     self.back_opacity = 160
  3409.     @actor_window = []
  3410.     for i in 0...$game_party.actors.size
  3411.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3412.     end
  3413.     @level_up_flags = [false, false, false, false]
  3414.     refresh
  3415.   end
  3416.   #--------------------------------------------------------------------------
  3417.   # ● 解放
  3418.   #--------------------------------------------------------------------------
  3419.   def dispose
  3420.     for window in @actor_window
  3421.       window.dispose
  3422.     end
  3423.     super
  3424.   end
  3425.   #--------------------------------------------------------------------------
  3426.   # ● リフレッシュ
  3427.   #--------------------------------------------------------------------------
  3428.   def refresh(number = 0)
  3429.     if number == 0
  3430.       cnt = 0
  3431.       for window in @actor_window
  3432.         window.refresh(@level_up_flags[cnt])
  3433.         cnt += 1
  3434.       end
  3435.     else
  3436.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3437.     end
  3438.   end
  3439.   #--------------------------------------------------------------------------
  3440.   # ● ATゲージリフレッシュ
  3441.   #--------------------------------------------------------------------------
  3442.   def at_refresh(number = 0)
  3443.     if number == 0
  3444.       for window in @actor_window
  3445.         window.at_refresh
  3446.       end
  3447.     else
  3448.       @actor_window[number - 1].at_refresh
  3449.     end
  3450.   end
  3451.   #--------------------------------------------------------------------------
  3452.   # ● フレーム更新
  3453.   #--------------------------------------------------------------------------
  3454.   def update
  3455.     super
  3456.     if self.x != (4 - $game_party.actors.size) * 80
  3457.       self.x = (4 - $game_party.actors.size) * 80
  3458.       self.width = $game_party.actors.size * 160
  3459.       for window in @actor_window
  3460.         window.dispose
  3461.       end
  3462.       @actor_window = []
  3463.       for i in 0...$game_party.actors.size
  3464.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3465.       end
  3466.       refresh
  3467.     end
  3468.     for window in @actor_window
  3469.       window.update
  3470.     end
  3471.   end
  3472. end

  3473. #==============================================================================
  3474. # ■ Window_ActorStatus
  3475. #------------------------------------------------------------------------------
  3476. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3477. #==============================================================================

  3478. class Window_ActorStatus < Window_Base
  3479.   #--------------------------------------------------------------------------
  3480.   # ● オブジェクト初期化
  3481.   #--------------------------------------------------------------------------
  3482.   def initialize(id, x)
  3483.     @actor_num = id
  3484.     super(x, 320, 160, 160)
  3485.     self.contents = Bitmap.new(width - 32, height - 32)
  3486.     self.opacity = 0
  3487.     self.back_opacity = 0
  3488.     actor = $game_party.actors[@actor_num]
  3489.     @actor_nm = actor.name
  3490.     @actor_mhp = actor.maxhp
  3491.     @actor_msp = actor.maxsp
  3492.     @actor_hp = actor.hp
  3493.     @actor_sp = actor.sp
  3494.     @actor_st = make_battler_state_text(actor, 120, true)
  3495.     @status_window = []
  3496.     for i in 0...5
  3497.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3498.     end
  3499.     refresh(false)
  3500.   end
  3501.   #--------------------------------------------------------------------------
  3502.   # ● 解放
  3503.   #--------------------------------------------------------------------------
  3504.   def dispose
  3505.     for i in 0...5
  3506.       @status_window[i].dispose
  3507.     end
  3508.     super
  3509.   end
  3510.   #--------------------------------------------------------------------------
  3511.   # ● リフレッシュ
  3512.   #--------------------------------------------------------------------------
  3513.   def refresh(level_up_flags)
  3514.     self.contents.clear
  3515.     actor = $game_party.actors[@actor_num]
  3516.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3517.     @status_window[1].refresh(actor) if
  3518.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3519.     @status_window[2].refresh(actor) if
  3520.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3521.     @status_window[3].refresh(actor, level_up_flags) if
  3522.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3523.     @actor_nm = actor.name
  3524.     @actor_mhp = actor.maxhp
  3525.     @actor_msp = actor.maxsp
  3526.     @actor_hp = actor.hp
  3527.     @actor_sp = actor.sp
  3528.     @actor_st = make_battler_state_text(actor, 120, true)
  3529.   end
  3530.   #--------------------------------------------------------------------------
  3531.   # ● ATゲージリフレッシュ
  3532.   #--------------------------------------------------------------------------
  3533.   def at_refresh
  3534.     @status_window[4].refresh($game_party.actors[@actor_num])
  3535.   end
  3536.   #--------------------------------------------------------------------------
  3537.   # ● フレーム更新
  3538.   #--------------------------------------------------------------------------
  3539.   def update
  3540.     for window in @status_window
  3541.       window.update
  3542.     end
  3543.   end
  3544. end

  3545. #==============================================================================
  3546. # ■ Window_DetailsStatus
  3547. #------------------------------------------------------------------------------
  3548. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3549. #==============================================================================

  3550. class Window_DetailsStatus < Window_Base
  3551.   #--------------------------------------------------------------------------
  3552.   # ● オブジェクト初期化
  3553.   #--------------------------------------------------------------------------
  3554.   def initialize(actor, id, x)
  3555.     @status_id = id
  3556.     super(x, 320 + id * 26, 160, 64)
  3557.     self.contents = Bitmap.new(width - 32, height - 32)
  3558.     self.opacity = 0
  3559.     self.back_opacity = 0
  3560.     refresh(actor, false)
  3561.   end
  3562.   #--------------------------------------------------------------------------
  3563.   # ● 解放
  3564.   #--------------------------------------------------------------------------
  3565.   def dispose
  3566.     super
  3567.   end
  3568.   #--------------------------------------------------------------------------
  3569.   # ● リフレッシュ
  3570.   #--------------------------------------------------------------------------
  3571.   def refresh(actor, level_up_flags = false)
  3572.     self.contents.clear
  3573.     case @status_id
  3574.     when 0
  3575.       draw_actor_name(actor, 4, 0)
  3576.     when 1
  3577.       draw_actor_hp(actor, 4, 0, 120)
  3578.     when 2
  3579.       draw_actor_sp(actor, 4, 0, 120)
  3580.     when 3
  3581.       if level_up_flags
  3582.         self.contents.font.color = normal_color
  3583.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3584.       else
  3585.         draw_actor_state(actor, 4, 0)
  3586.       end
  3587.     when 4
  3588.       draw_actor_atg(actor, 4, 0, 120)
  3589.     end
  3590.   end
  3591.   #--------------------------------------------------------------------------
  3592.   # ● フレーム更新
  3593.   #--------------------------------------------------------------------------
  3594.   def update
  3595.     # メインフェーズのときは不透明度をやや下げる
  3596.     if $game_temp.battle_main_phase
  3597.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3598.     else
  3599.       self.contents_opacity += 4 if self.contents_opacity < 255
  3600.     end
  3601.   end
  3602. end

  3603. #==============================================================================
  3604. # ■ Arrow_Base
  3605. #------------------------------------------------------------------------------
  3606. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3607. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3608. #==============================================================================

  3609. class Arrow_Base < Sprite
  3610.   #--------------------------------------------------------------------------
  3611.   # ● オブジェクト初期化
  3612.   #     viewport : ビューポート
  3613.   #--------------------------------------------------------------------------
  3614.   def initialize(viewport)
  3615.     super(viewport)
  3616.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3617.     self.ox = 16
  3618.     self.oy = 32
  3619.     self.z = 2500
  3620.     @blink_count = 0
  3621.     @index = 0
  3622.     @help_window = nil
  3623.     update
  3624.   end
  3625. end

  3626. #==============================================================================
  3627. # ■ Arrow_Enemy
  3628. #------------------------------------------------------------------------------
  3629. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3630. # スを継承します。
  3631. #==============================================================================

  3632. class Arrow_Enemy < Arrow_Base
  3633.   #--------------------------------------------------------------------------
  3634.   # ● フレーム更新
  3635.   #--------------------------------------------------------------------------
  3636.   def update
  3637.     super
  3638.     # 存在しないエネミーを指していたら飛ばす
  3639.     $game_troop.enemies.size.times do
  3640.       break if self.enemy.exist?
  3641.       @index += 1
  3642.       @index %= $game_troop.enemies.size
  3643.     end
  3644.     # カーソル右
  3645.     if Input.repeat?(Input::RIGHT)
  3646.       $game_system.se_play($data_system.cursor_se)
  3647.       $game_troop.enemies.size.times do
  3648.         @index += 1
  3649.         @index %= $game_troop.enemies.size
  3650.         break if self.enemy.exist?
  3651.       end
  3652.       $scene.camera = "select"
  3653.       zoom = 1 / self.enemy.zoom
  3654.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3655.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  3656.     end
  3657.     # カーソル左
  3658.     if Input.repeat?(Input::LEFT)
  3659.       $game_system.se_play($data_system.cursor_se)
  3660.       $game_troop.enemies.size.times do
  3661.         @index += $game_troop.enemies.size - 1
  3662.         @index %= $game_troop.enemies.size
  3663.         break if self.enemy.exist?
  3664.       end
  3665.       $scene.camera = "select"
  3666.       zoom = 1 / self.enemy.zoom
  3667.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3668.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  3669.     end
  3670.     # スプライトの座標を設定
  3671.     if self.enemy != nil
  3672.       self.x = self.enemy.screen_x
  3673.       self.y = self.enemy.screen_y
  3674.     end
  3675.   end
  3676. end

  3677. #==============================================================================
  3678. # ■ Interpreter
  3679. #------------------------------------------------------------------------------
  3680. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  3681. # スや Game_Event クラスの内部で使用されます。
  3682. #==============================================================================

  3683. class Interpreter
  3684.   #--------------------------------------------------------------------------
  3685.   # ● アクターの入れ替え
  3686.   #--------------------------------------------------------------------------
  3687.   def command_129
  3688.     # アクターを取得
  3689.     actor = $game_actors[@parameters[0]]
  3690.     # アクターが有効の場合
  3691.     if actor != nil
  3692.       # 操作で分岐
  3693.       if @parameters[1] == 0
  3694.         if @parameters[2] == 1
  3695.           $game_actors[@parameters[0]].setup(@parameters[0])
  3696.         end
  3697.         $game_party.add_actor(@parameters[0])
  3698.         if $game_temp.in_battle
  3699.           $game_actors[@parameters[0]].at = 0
  3700.           $game_actors[@parameters[0]].atp = 0
  3701.           $scene.spell_reset($game_actors[@parameters[0]])
  3702.           $game_actors[@parameters[0]].damage_pop = {}
  3703.           $game_actors[@parameters[0]].damage = {}
  3704.           $game_actors[@parameters[0]].damage_sp = {}
  3705.           $game_actors[@parameters[0]].critical = {}
  3706.           $game_actors[@parameters[0]].recover_hp = {}
  3707.           $game_actors[@parameters[0]].recover_sp = {}
  3708.           $game_actors[@parameters[0]].state_p = {}
  3709.           $game_actors[@parameters[0]].state_m = {}
  3710.           $game_actors[@parameters[0]].animation = []
  3711.         end
  3712.       else
  3713.         $game_party.remove_actor(@parameters[0])
  3714.       end
  3715.     end
  3716.     if $game_temp.in_battle
  3717.       $scene.status_window.update
  3718.     end
  3719.     # 継続
  3720.     return true
  3721.   end
  3722.   #--------------------------------------------------------------------------
  3723.   # ● HP の増減
  3724.   #--------------------------------------------------------------------------
  3725.   alias :command_311_rtab :command_311
  3726.   def command_311
  3727.     command_311_rtab
  3728.     if $game_temp.in_battle
  3729.       $scene.status_window.refresh
  3730.     end
  3731.   end
  3732.   #--------------------------------------------------------------------------
  3733.   # ● SP の増減
  3734.   #--------------------------------------------------------------------------
  3735.   alias :command_312_rtab :command_312
  3736.   def command_312
  3737.     command_312_rtab
  3738.     if $game_temp.in_battle
  3739.       $scene.status_window.refresh
  3740.     end
  3741.   end
  3742.   #--------------------------------------------------------------------------
  3743.   # ● ステートの変更
  3744.   #--------------------------------------------------------------------------
  3745.   alias :command_313_rtab :command_313
  3746.   def command_313
  3747.     command_313_rtab
  3748.     if $game_temp.in_battle
  3749.       $scene.status_window.refresh
  3750.     end
  3751.   end
  3752.   #--------------------------------------------------------------------------
  3753.   # ● 全回復
  3754.   #--------------------------------------------------------------------------
  3755.   alias :command_314_rtab :command_314
  3756.   def command_314
  3757.     command_314_rtab
  3758.     if $game_temp.in_battle
  3759.       $scene.status_window.refresh
  3760.     end
  3761.   end
  3762.   #--------------------------------------------------------------------------
  3763.   # ● EXP の増減
  3764.   #--------------------------------------------------------------------------
  3765.   alias :command_315_rtab :command_315
  3766.   def command_315
  3767.     command_315_rtab
  3768.     if $game_temp.in_battle
  3769.       $scene.status_window.refresh
  3770.     end
  3771.   end
  3772.   #--------------------------------------------------------------------------
  3773.   # ● レベルの増減
  3774.   #--------------------------------------------------------------------------
  3775.   alias :command_316_rtab :command_316
  3776.   def command_316
  3777.     command_316_rtab
  3778.     if $game_temp.in_battle
  3779.       $scene.status_window.refresh
  3780.     end
  3781.   end
  3782.   #--------------------------------------------------------------------------
  3783.   # ● パラメータの増減
  3784.   #--------------------------------------------------------------------------
  3785.   alias :command_317_rtab :command_317
  3786.   def command_317
  3787.     command_317_rtab
  3788.     if $game_temp.in_battle
  3789.       $scene.status_window.refresh
  3790.     end
  3791.   end
  3792.   #--------------------------------------------------------------------------
  3793.   # ● 装備の変更
  3794.   #--------------------------------------------------------------------------
  3795.   alias :command_319_rtab :command_319
  3796.   def command_319
  3797.     command_319_rtab
  3798.     if $game_temp.in_battle
  3799.       $scene.status_window.refresh
  3800.     end
  3801.   end
  3802.   #--------------------------------------------------------------------------
  3803.   # ● アクターの名前変更
  3804.   #--------------------------------------------------------------------------
  3805.   alias :command_320_rtab :command_320
  3806.   def command_320
  3807.     command_320_rtab
  3808.     if $game_temp.in_battle
  3809.       $scene.status_window.refresh
  3810.     end
  3811.   end
  3812.   #--------------------------------------------------------------------------
  3813.   # ● アクターのクラス変更
  3814.   #--------------------------------------------------------------------------
  3815.   alias :command_321_rtab :command_321
  3816.   def command_321
  3817.     command_321_rtab
  3818.     if $game_temp.in_battle
  3819.       $scene.status_window.refresh
  3820.     end
  3821.   end
  3822.   #--------------------------------------------------------------------------
  3823.   # ● アニメーションの表示
  3824.   #--------------------------------------------------------------------------
  3825.   def command_337
  3826.     # イテレータで処理
  3827.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  3828.       # バトラーが存在する場合
  3829.       if battler.exist?
  3830.         # アニメーション ID を設定
  3831.         battler.animation.push([@parameters[2], true])
  3832.       end
  3833.     end
  3834.     # 継続
  3835.     return true
  3836.   end
  3837.   #--------------------------------------------------------------------------
  3838.   # ● ダメージの処理
  3839.   #--------------------------------------------------------------------------
  3840.   def command_338
  3841.     # 操作する値を取得
  3842.     value = operate_value(0, @parameters[2], @parameters[3])
  3843.     # イテレータで処理
  3844.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  3845.       # バトラーが存在する場合
  3846.       if battler.exist?
  3847.         # HP を変更
  3848.         battler.hp -= value
  3849.         # 戦闘中なら
  3850.         if $game_temp.in_battle
  3851.           # ダメージを設定
  3852.           battler.damage["event"] = value
  3853.           battler.damage_pop["event"] = true
  3854.         end
  3855.       end
  3856.     end
  3857.     if $game_temp.in_battle
  3858.       $scene.status_window.refresh
  3859.     end
  3860.     # 継続
  3861.     return true
  3862.   end
  3863.   #--------------------------------------------------------------------------
  3864.   # ● アクションの強制
  3865.   #--------------------------------------------------------------------------
  3866.   def command_339
  3867.     # 戦闘中でなければ無視
  3868.     unless $game_temp.in_battle
  3869.       return true
  3870.     end
  3871.     # ターン数が 0 なら無視
  3872.     if $game_temp.battle_turn == 0
  3873.       return true
  3874.     end
  3875.     # イテレータで処理 (便宜的なもので、複数になることはない)
  3876.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  3877.       # バトラーが存在する場合
  3878.       if battler.exist?
  3879.         # アクションを設定
  3880.         battler.current_action.force_kind = @parameters[2]
  3881.         if battler.current_action.force_kind == 0
  3882.           battler.current_action.force_basic = @parameters[3]
  3883.         else
  3884.           battler.current_action.force_skill_id = @parameters[3]
  3885.         end
  3886.         # 行動対象を設定
  3887.         if @parameters[4] == -2
  3888.           if battler.is_a?(Game_Enemy)
  3889.             battler.current_action.decide_last_target_for_enemy
  3890.           else
  3891.             battler.current_action.decide_last_target_for_actor
  3892.           end
  3893.         elsif @parameters[4] == -1
  3894.           if battler.is_a?(Game_Enemy)
  3895.             battler.current_action.decide_random_target_for_enemy
  3896.           else
  3897.             battler.current_action.decide_random_target_for_actor
  3898.           end
  3899.         elsif @parameters[4] >= 0
  3900.           battler.current_action.target_index = @parameters[4]
  3901.         end
  3902.         # アクションが有効かつ [すぐに実行] の場合
  3903.         if battler.current_action.valid? and @parameters[5] == 1
  3904.           # 強制対象のバトラーを設定
  3905.           $game_temp.forcing_battler = battler
  3906.           # インデックスを進める
  3907.           @index += 1
  3908.           # 終了
  3909.           return false
  3910.         elsif battler.current_action.valid? and @parameters[5] == 0
  3911.           battler.current_action.forcing = true
  3912.         end
  3913.       end
  3914.     end
  3915.     # 継続
  3916.     return true
  3917.   end
  3918. end

  3919. #==============================================================================
  3920. # ■ Spriteモジュール
  3921. #------------------------------------------------------------------------------
  3922. #  アニメーションの管理を行うモジュールです。
  3923. #==============================================================================

  3924. module RPG
  3925.   class Sprite < ::Sprite
  3926.     def initialize(viewport = nil)
  3927.       super(viewport)
  3928.       @_whiten_duration = 0
  3929.       @_appear_duration = 0
  3930.       @_escape_duration = 0
  3931.       @_collapse_duration = 0
  3932.       @_damage = []
  3933.       @_animation = []
  3934.       @_animation_duration = 0
  3935.       @_blink = false
  3936.     end
  3937.     def damage(value, critical, type = 0)
  3938.       if value.is_a?(Numeric)
  3939.         damage_string = value.abs.to_s
  3940.       else
  3941.         damage_string = value.to_s
  3942.       end
  3943.       bitmap = Bitmap.new(160, 48)
  3944.       bitmap.font.name = "Arial Black"
  3945.       bitmap.font.size = 32
  3946.       bitmap.font.color.set(0, 0, 0)
  3947.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  3948.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  3949.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  3950.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  3951.       if value.is_a?(Numeric) and value < 0
  3952.         if type == 0
  3953.           bitmap.font.color.set(176, 255, 144)
  3954.         else
  3955.           bitmap.font.color.set(176, 144, 255)
  3956.         end
  3957.       else
  3958.         if type == 0
  3959.           bitmap.font.color.set(255, 255, 255)
  3960.         else
  3961.           bitmap.font.color.set(255, 176, 144)
  3962.         end
  3963.       end
  3964.       if type == 2
  3965.         bitmap.font.color.set(255, 224, 128)
  3966.       end
  3967.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  3968.       if critical
  3969.         string = "CRITICAL"
  3970.         bitmap.font.size = 20
  3971.         bitmap.font.color.set(0, 0, 0)
  3972.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  3973.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  3974.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  3975.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  3976.         bitmap.font.color.set(255, 255, 255)
  3977.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  3978.       end
  3979.       num = @_damage.size
  3980.       if type != 2
  3981.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  3982.       else
  3983.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  3984.       end
  3985.       @_damage[num][0].bitmap = bitmap
  3986.       @_damage[num][0].ox = 80 + self.viewport.ox
  3987.       @_damage[num][0].oy = 20 + self.viewport.oy
  3988.       if self.battler.is_a?(Game_Actor)
  3989.         @_damage[num][0].x = self.x
  3990.         @_damage[num][0].y = self.y - self.oy / 2
  3991.       else
  3992.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  3993.                             self.ox + self.src_rect.width / 2
  3994.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  3995.                             self.viewport.rect.y
  3996.         @_damage[num][0].zoom_x = self.zoom_x
  3997.         @_damage[num][0].zoom_y = self.zoom_y
  3998.         @_damage[num][0].z = 3000
  3999.       end
  4000.     end
  4001.     def animation(animation, hit)
  4002.       return if animation == nil
  4003.       num = @_animation.size
  4004.       @_animation.push([animation, hit, animation.frame_max, []])
  4005.       bitmap = RPG::Cache.animation(animation.animation_name,
  4006.                                     animation.animation_hue)
  4007.       if @@_reference_count.include?(bitmap)
  4008.         @@_reference_count[bitmap] += 1
  4009.       else
  4010.         @@_reference_count[bitmap] = 1
  4011.       end
  4012.       if @_animation[num][0] != 3 or not @@_animations.include?(animation)
  4013.         for i in 0..15
  4014.           sprite = ::Sprite.new
  4015.           sprite.bitmap = bitmap
  4016.           sprite.visible = false
  4017.           @_animation[num][3].push(sprite)
  4018.         end
  4019.         unless @@_animations.include?(animation)
  4020.           @@_animations.push(animation)
  4021.         end
  4022.       end
  4023.       update_animation(@_animation[num])
  4024.     end
  4025.     def loop_animation(animation)
  4026.       return if animation == @_loop_animation
  4027.       dispose_loop_animation
  4028.       @_loop_animation = animation
  4029.       return if @_loop_animation == nil
  4030.       @_loop_animation_index = 0
  4031.       animation_name = @_loop_animation.animation_name
  4032.       animation_hue = @_loop_animation.animation_hue
  4033.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4034.       if @@_reference_count.include?(bitmap)
  4035.         @@_reference_count[bitmap] += 1
  4036.       else
  4037.         @@_reference_count[bitmap] = 1
  4038.       end
  4039.       @_loop_animation_sprites = []
  4040.       for i in 0..15
  4041.         sprite = ::Sprite.new
  4042.         sprite.bitmap = bitmap
  4043.         sprite.visible = false
  4044.         @_loop_animation_sprites.push(sprite)
  4045.       end
  4046.       update_loop_animation
  4047.     end
  4048.     def dispose_damage
  4049.       for damage in @_damage.reverse
  4050.         damage[0].bitmap.dispose
  4051.         damage[0].dispose
  4052.         @_damage.delete(damage)
  4053.       end
  4054.     end
  4055.     def dispose_animation
  4056.       for anime in @_animation.reverse
  4057.         sprite = anime[3][0]
  4058.         if sprite != nil
  4059.           @@_reference_count[sprite.bitmap] -= 1
  4060.           if @@_reference_count[sprite.bitmap] == 0
  4061.             sprite.bitmap.dispose
  4062.           end
  4063.         end
  4064.         for sprite in anime[3]
  4065.           sprite.dispose
  4066.         end
  4067.         @_animation.delete(anime)
  4068.       end
  4069.     end
  4070.     def effect?
  4071.       @_whiten_duration > 0 or
  4072.       @_appear_duration > 0 or
  4073.       @_escape_duration > 0 or
  4074.       @_collapse_duration > 0 or
  4075.       @_damage.size == 0 or
  4076.       @_animation.size == 0
  4077.     end
  4078.     def update
  4079.       super
  4080.       if @_whiten_duration > 0
  4081.         @_whiten_duration -= 1
  4082.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4083.       end
  4084.       if @_appear_duration > 0
  4085.         @_appear_duration -= 1
  4086.         self.opacity = (16 - @_appear_duration) * 16
  4087.       end
  4088.       if @_escape_duration > 0
  4089.         @_escape_duration -= 1
  4090.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4091.       end
  4092.       if @_collapse_duration > 0
  4093.         @_collapse_duration -= 1
  4094.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4095.       end
  4096.       for damage in @_damage
  4097.         if damage[1] > 0
  4098.           damage[1] -= 1
  4099.           damage[4] -= 3
  4100.           damage[2] -= damage[4]
  4101.           if self.battler.is_a?(Game_Actor)
  4102.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4103.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4104.           else
  4105.             damage[0].x = self.x + self.viewport.rect.x -
  4106.                           self.ox + self.src_rect.width / 2 +
  4107.                           (40 - damage[1]) * damage[3] / 10
  4108.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4109.                           self.viewport.rect.y + damage[2] / 10
  4110.             damage[0].zoom_x = self.zoom_x
  4111.             damage[0].zoom_y = self.zoom_y
  4112.           end
  4113.           damage[0].z = 2960 + damage[1]
  4114.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4115.           if damage[1] == 0
  4116.             damage[0].bitmap.dispose
  4117.             damage[0].dispose
  4118.             @_damage.delete(damage)
  4119.           end
  4120.         end
  4121.       end
  4122.       for anime in @_animation
  4123.         if (Graphics.frame_count % 2 == 0)
  4124.           anime[2] -= 1
  4125.           update_animation(anime)
  4126.         end
  4127.       end
  4128.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4129.         update_loop_animation
  4130.         @_loop_animation_index += 1
  4131.         @_loop_animation_index %= @_loop_animation.frame_max
  4132.       end
  4133.       if @_blink
  4134.         @_blink_count = (@_blink_count + 1) % 32
  4135.         if @_blink_count < 16
  4136.           alpha = (16 - @_blink_count) * 6
  4137.         else
  4138.           alpha = (@_blink_count - 16) * 6
  4139.         end
  4140.         self.color.set(255, 255, 255, alpha)
  4141.       end
  4142.       @@_animations.clear
  4143.     end
  4144.     def update_animation(anime)
  4145.       if anime[2] > 0
  4146.         frame_index = anime[0].frame_max - anime[2]
  4147.         cell_data = anime[0].frames[frame_index].cell_data
  4148.         position = anime[0].position
  4149.         animation_set_sprites(anime[3], cell_data, position)
  4150.         for timing in anime[0].timings
  4151.           if timing.frame == frame_index
  4152.             animation_process_timing(timing, anime[1])
  4153.           end
  4154.         end
  4155.       else
  4156.         @@_reference_count[anime[3][0].bitmap] -= 1
  4157.         if @@_reference_count[anime[3][0].bitmap] == 0
  4158.             anime[3][0].bitmap.dispose
  4159.         end
  4160.         for sprite in anime[3]
  4161.           sprite.dispose
  4162.         end
  4163.         @_animation.delete(anime)
  4164.       end
  4165.     end
  4166.     def animation_set_sprites(sprites, cell_data, position)
  4167.       for i in 0..15
  4168.         sprite = sprites[i]
  4169.         pattern = cell_data[i, 0]
  4170.         if sprite == nil or pattern == nil or pattern == -1
  4171.           sprite.visible = false if sprite != nil
  4172.           next
  4173.         end
  4174.         sprite.visible = true
  4175.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4176.         if position == 3
  4177.           if self.viewport != nil
  4178.             sprite.x = self.viewport.rect.width / 2
  4179.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4180.               sprite.y = self.viewport.rect.height - 320
  4181.             else
  4182.               sprite.y = self.viewport.rect.height - 160
  4183.             end
  4184.           else
  4185.             sprite.x = 320
  4186.             sprite.y = 240
  4187.           end
  4188.         else
  4189.           sprite.x = self.x + self.viewport.rect.x -
  4190.                       self.ox + self.src_rect.width / 2
  4191.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4192.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4193.                         self.viewport.rect.y
  4194.             if position == 0
  4195.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4196.             elsif position == 2
  4197.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4198.             end
  4199.           else
  4200.             sprite.y = self.y + self.viewport.rect.y -
  4201.                         self.oy + self.src_rect.height / 2
  4202.             sprite.y -= self.src_rect.height / 4 if position == 0
  4203.             sprite.y += self.src_rect.height / 4 if position == 2
  4204.           end
  4205.         end
  4206.         sprite.x += cell_data[i, 1]
  4207.         sprite.y += cell_data[i, 2]
  4208.         sprite.z = 2000
  4209.         sprite.ox = 96
  4210.         sprite.oy = 96
  4211.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4212.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4213.         if position != 3
  4214.           sprite.zoom_x *= self.zoom_x
  4215.           sprite.zoom_y *= self.zoom_y
  4216.         end
  4217.         sprite.angle = cell_data[i, 4]
  4218.         sprite.mirror = (cell_data[i, 5] == 1)
  4219.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4220.         sprite.blend_type = cell_data[i, 7]
  4221.       end
  4222.     end
  4223.     def x=(x)
  4224.       sx = x - self.x
  4225.       if sx != 0
  4226.         for anime in @_animation
  4227.           if anime[3] != nil
  4228.             for i in 0..15
  4229.               anime[3][i].x += sx
  4230.             end
  4231.           end
  4232.         end
  4233.         if @_loop_animation_sprites != nil
  4234.           for i in 0..15
  4235.             @_loop_animation_sprites[i].x += sx
  4236.           end
  4237.         end
  4238.       end
  4239.       super
  4240.     end
  4241.     def y=(y)
  4242.       sy = y - self.y
  4243.       if sy != 0
  4244.         for anime in @_animation
  4245.           if anime[3] != nil
  4246.             for i in 0..15
  4247.               anime[3][i].y += sy
  4248.             end
  4249.           end
  4250.         end
  4251.         if @_loop_animation_sprites != nil
  4252.           for i in 0..15
  4253.             @_loop_animation_sprites[i].y += sy
  4254.           end
  4255.         end
  4256.       end
  4257.       super
  4258.     end
  4259.   end
  4260. end

  4261. #------------------------------------------------------------------------------
  4262. #  Bitmapクラスに新たな機能を追加します。
  4263. #==============================================================================

  4264. class Bitmap
  4265.   #--------------------------------------------------------------------------
  4266.   # ● 矩形をグラデーション表示
  4267.   #     color1 : スタートカラー
  4268.   #     color2 : エンドカラー
  4269.   #     align  :  0:横にグラデーション
  4270.   #               1:縦にグラデーション
  4271.   #               2:斜めにグラデーション(激重につき注意)
  4272.   #--------------------------------------------------------------------------
  4273.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4274.     if align == 0
  4275.       for i in x...x + width
  4276.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4277.         green = color1.green +
  4278.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4279.         blue  = color1.blue +
  4280.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4281.         alpha = color1.alpha +
  4282.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4283.         color = Color.new(red, green, blue, alpha)
  4284.         fill_rect(i, y, 1, height, color)
  4285.       end
  4286.     elsif align == 1
  4287.       for i in y...y + height
  4288.         red   = color1.red +
  4289.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4290.         green = color1.green +
  4291.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4292.         blue  = color1.blue +
  4293.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4294.         alpha = color1.alpha +
  4295.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4296.         color = Color.new(red, green, blue, alpha)
  4297.         fill_rect(x, i, width, 1, color)
  4298.       end
  4299.     elsif align == 2
  4300.       for i in x...x + width
  4301.         for j in y...y + height
  4302.           red   = color1.red + (color2.red - color1.red) *
  4303.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4304.           green = color1.green + (color2.green - color1.green) *
  4305.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4306.           blue  = color1.blue + (color2.blue - color1.blue) *
  4307.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4308.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4309.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4310.           color = Color.new(red, green, blue, alpha)
  4311.           set_pixel(i, j, color)
  4312.         end
  4313.       end
  4314.     elsif align == 3
  4315.       for i in x...x + width
  4316.         for j in y...y + height
  4317.           red   = color1.red + (color2.red - color1.red) *
  4318.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4319.           green = color1.green + (color2.green - color1.green) *
  4320.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4321.           blue  = color1.blue + (color2.blue - color1.blue) *
  4322.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4323.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4324.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4325.           color = Color.new(red, green, blue, alpha)
  4326.           set_pixel(i, j, color)
  4327.         end
  4328.       end
  4329.     end
  4330.   end
  4331. end
复制代码
  1. # ===================================================================
  2. # 连击效果(完美版) v1.2 by SailCat
  3. # ===================================================================
  4. # 数据库设定(特技):
  5. #   名称:技能名称,连击次数(要用半角逗号)
  6. #   例如:超究舞神霸斩,11
  7. #         狮子心,16
  8. #         陨石,9
  9. # 注意这是连击次数,实际攻击的回数是这个回数+1回。
  10. # 省略逗号连同后面的参数的话,连击次数默认为零。
  11. # 连击次数是负数的话,将取绝对值处理。
  12. # 视觉效果是发动动画只放1回,击中动画放N回,伤害值显示N次,
  13. # 所以,如使用了齐时战斗的话,要修改倒数第四行,该行内容为:
  14. #     @phase4_step = 4
  15. # 改为@phase4_step = 3
  16. # 其他:RTAB不适用
  17. # ===================================================================
  18. module RPG
  19. class Skill
  20.    def name
  21.      name = @name.split(/,/)[0]
  22.      return name != nil ? name : ""
  23.    end
  24.    def hit_count
  25.      name = @name.split(/,/)[1]
  26.      return name != nil ? name.to_i.abs : 0
  27.    end
  28. end
  29. class Sprite < ::Sprite
  30.    def effect?
  31.      @_whiten_duration > 0 or
  32.      @_appear_duration > 0 or
  33.      @_escape_duration > 0 or
  34.      @_animation_duration > 0
  35.    end
  36.    def damage_effect?
  37.      @_damage_duration > 0 or
  38.      @_collapse_duration > 0
  39.    end
  40. end
  41. end
  42. class Spriteset_Battle
  43. def damage_effect?
  44.    for sprite in @enemy_sprites + @actor_sprites
  45.      return true if sprite.damage_effect?
  46.    end
  47.    return false
  48. end
  49. end   
  50. class Scene_Battle
  51. alias sailcat_update_phase4_step1 update_phase4_step1
  52. alias sailcat_make_skill_action_result make_skill_action_result
  53. alias sailcat_update_phase4_step5 update_phase4_step5
  54. def update_phase4_step1
  55.    @hit_count = 0
  56.    sailcat_update_phase4_step1
  57. end
  58. def make_skill_action_result
  59.    sailcat_make_skill_action_result
  60.    @hit_count = @skill.hit_count
  61. end
  62. def update_phase4_step5
  63.    sailcat_update_phase4_step5
  64.    if @hit_count > 0
  65.      for target in @target_battlers.clone
  66.        if target.dead?
  67.          if @target_battlers.size > 1
  68.            @target_battlers.delete(target)
  69.          else
  70.            @target_battlers.delete(target)
  71.            if target.is_a?(Game_Enemy)
  72.              target = $game_troop.smooth_target_enemy(target.index)
  73.            else
  74.              target = $game_party.smooth_target_actor(target.index)
  75.            end
  76.            if target.is_a?(Game_Battler)
  77.              @target_battlers.push(target)
  78.            end
  79.          end
  80.        end
  81.      end
  82.      if @target_battlers.size == 0
  83.        return
  84.      end
  85.      for target in @target_battlers
  86.        if target.damage != nil
  87.          @phase4_step = 5
  88.          return
  89.        end
  90.        target.skill_effect(@active_battler, @skill)
  91.      end
  92.      # 如果你应用了23种战斗特效的公共事件版脚本请去掉下面几行的注释
  93.      # if @common_event_id > 0
  94.      #   common_event = $data_common_events[@common_event_id]
  95.      #   $game_system.battle_interpreter.setup(common_event.list, 0)
  96.      # end
  97.      @hit_count -= 1
  98.      @phase4_step = 4
  99.    end
  100. end
  101. end
复制代码

Lv1.梦旅人

梦石
0
星屑
103
在线时间
159 小时
注册时间
2010-7-4
帖子
44
2
 楼主| 发表于 2013-8-14 20:27:16 | 只看该作者
就是这个连击脚本,不能一起用
  1. # ===================================================================
  2. # 连击效果(完美版) v1.2 by SailCat
  3. # ===================================================================
  4. # 数据库设定(特技):
  5. #   名称:技能名称,连击次数(要用半角逗号)
  6. #   例如:超究舞神霸斩,11
  7. #         狮子心,16
  8. #         陨石,9
  9. # 注意这是连击次数,实际攻击的回数是这个回数+1回。
  10. # 省略逗号连同后面的参数的话,连击次数默认为零。
  11. # 连击次数是负数的话,将取绝对值处理。
  12. # 视觉效果是发动动画只放1回,击中动画放N回,伤害值显示N次,
  13. # 所以,如使用了齐时战斗的话,要修改倒数第四行,该行内容为:
  14. #     @phase4_step = 4
  15. # 改为@phase4_step = 3
  16. # 其他:RTAB不适用
  17. # ===================================================================
  18. module RPG
  19. class Skill
  20.    def name
  21.      name = @name.split(/,/)[0]
  22.      return name != nil ? name : ""
  23.    end
  24.    def hit_count
  25.      name = @name.split(/,/)[1]
  26.      return name != nil ? name.to_i.abs : 0
  27.    end
  28. end
  29. class Sprite < ::Sprite
  30.    def effect?
  31.      @_whiten_duration > 0 or
  32.      @_appear_duration > 0 or
  33.      @_escape_duration > 0 or
  34.      @_animation_duration > 0
  35.    end
  36.    def damage_effect?
  37.      @_damage_duration > 0 or
  38.      @_collapse_duration > 0
  39.    end
  40. end
  41. end
  42. class Spriteset_Battle
  43. def damage_effect?
  44.    for sprite in @enemy_sprites + @actor_sprites
  45.      return true if sprite.damage_effect?
  46.    end
  47.    return false
  48. end
  49. end   
  50. class Scene_Battle
  51. alias sailcat_update_phase4_step1 update_phase4_step1
  52. alias sailcat_make_skill_action_result make_skill_action_result
  53. alias sailcat_update_phase4_step5 update_phase4_step5
  54. def update_phase4_step1
  55.    @hit_count = 0
  56.    sailcat_update_phase4_step1
  57. end
  58. def make_skill_action_result
  59.    sailcat_make_skill_action_result
  60.    @hit_count = @skill.hit_count
  61. end
  62. def update_phase4_step5
  63.    sailcat_update_phase4_step5
  64.    if @hit_count > 0
  65.      for target in @target_battlers.clone
  66.        if target.dead?
  67.          if @target_battlers.size > 1
  68.            @target_battlers.delete(target)
  69.          else
  70.            @target_battlers.delete(target)
  71.            if target.is_a?(Game_Enemy)
  72.              target = $game_troop.smooth_target_enemy(target.index)
  73.            else
  74.              target = $game_party.smooth_target_actor(target.index)
  75.            end
  76.            if target.is_a?(Game_Battler)
  77.              @target_battlers.push(target)
  78.            end
  79.          end
  80.        end
  81.      end
  82.      if @target_battlers.size == 0
  83.        return
  84.      end
  85.      for target in @target_battlers
  86.        if target.damage != nil
  87.          @phase4_step = 5
  88.          return
  89.        end
  90.        target.skill_effect(@active_battler, @skill)
  91.      end
  92.      # 如果你应用了23种战斗特效的公共事件版脚本请去掉下面几行的注释
  93.      # if @common_event_id > 0
  94.      #   common_event = $data_common_events[@common_event_id]
  95.      #   $game_system.battle_interpreter.setup(common_event.list, 0)
  96.      # end
  97.      @hit_count -= 1
  98.      @phase4_step = 4
  99.    end
  100. end
  101. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
568 小时
注册时间
2012-9-7
帖子
611
3
发表于 2013-8-15 14:57:12 | 只看该作者
RTAB不是自带连击效果么……
FTM正式版已经发布,点击图片开启传送门
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-29 17:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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