查看: 1721|回复: 2

[已经过期] 求教RTAB战斗系统为何放不出己方全体/敌方全体的技能

[复制链接]
梦石
0
星屑
153
在线时间
120 小时
注册时间
2011-9-4
回帖
70
发表于 2015-5-23 08:20:54 | 显示全部楼层 |阅读模式

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

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

×
单体魔法/技能都能放出来,但是全体技能放不出来。
求教这是什么情况

点评

RTAB有很多版本,不知道你用的哪一个,或者把工程拿来  发表于 2015-5-23 10:05
梦石
0
星屑
153
在线时间
120 小时
注册时间
2011-9-4
回帖
70
 楼主| 发表于 2015-5-23 16:08:34 | 显示全部楼层
本帖最后由 hys111111 于 2015-6-6 07:56 编辑

  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  4. class Scene_Battle
  5.   #--------------------------------------------------------------------------
  6.   # ● 公開インスタンス変数
  7.   #--------------------------------------------------------------------------
  8.   attr_reader   :status_window            # ステータスウィンドウ
  9.   attr_reader   :spriteset                # バトルスプライト
  10.   attr_reader   :scroll_time              # スクリーン移動基本時間
  11.   attr_reader   :zoom_rate                # 敵バトラー基本位置
  12.   attr_reader   :drive                    # カメラ駆動
  13.   attr_accessor :force                    # アクション強制度
  14.   attr_accessor :camera                   # 現在のカメラ所持者
  15.   #--------------------------------------------------------------------------
  16.   # ● ATB基礎セットアップ
  17.   #--------------------------------------------------------------------------
  18.   def atb_setup
  19.     # ATB初期化
  20.     # speed   : バトルスピード決定。値が小さいほど早い
  21.     # @active : アクティブ度設定
  22.     #           3 : 常にアクティブ状態
  23.     #           2 : スキル・アイテム選択中のみアクティブゲージが止まる
  24.     #           1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
  25.     #           0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
  26.     # @action : 他人が行動中に自分も行動を起こすことを許すか
  27.     #           3 : 自分が行動不能でない限り限り許す
  28.     #           2 : 自分がダメージを受けていない限り許す
  29.     #           1 : 2の状態に加え、ターゲットが行動していない限り許す
  30.     #           0 : 行動を許さない。順番に行動し終えるまで待つ
  31.     # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
  32.     # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
  33.     # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
  34.     #               [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
  35.     # @enemy_speed : 敵の思考速度。1なら即時行動。
  36.     #                1フレーム毎に、1/@enemy_speedの確率で行動を起こす
  37.     # [url=home.php?mod=space&uid=316545]@force[/url] : 強制アクションでスキル使用時の強制具合
  38.     #          2:スキルは全て詠唱せず、必ず即時実行
  39.     #          1:単独スキルは詠唱し、連携スキルのみ即時実行
  40.     #          0:全スキル詠唱を行うだけ
  41.     # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
  42.     # [url=home.php?mod=space&uid=2639411]@DRIVE[/url] : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
  43.     # @scroll_time : スクリーン移動に要する基本時間
  44.     # @zoom_rate = [i, j] : エネミーのズーム率
  45.     #                       i が画面最上部に配置した時の拡大率
  46.     #                       j が画面最下部に配置した時の拡大率
  47.     #                       1 倍としたいときも、1.0 と必ず小数で設定すること
  48.     speed = 25
  49.     @active = 0
  50.     @action = 3
  51.     @anime_wait = false
  52.     @damage_wait = 10
  53.     @after_wait = [80, 0]
  54.     @enemy_speed = 15
  55.     @force = 2
  56.     @drive = true
  57.     @scroll_time = 5
  58.     @zoom_rate = [0.2, 1.0]
  59.     @help_time = 20
  60.     @escape == false
  61.     @camera = nil
  62.     [url=home.php?mod=space&uid=25307]@Max[/url] = 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. #------------------------------------------------------------------------------   
  72. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  73. #    @party = false
  74. #------------------------------------------------------------------------------
  75.     for battler in $game_party.actors + $game_troop.enemies
  76.       spell_reset(battler)
  77.       battler.at = battler.agi * rand(speed / 2)
  78.       battler.damage_pop = {}
  79.       battler.damage = {}
  80.       battler.damage_sp = {}
  81.       battler.critical = {}
  82.       battler.recover_hp = {}
  83.       battler.recover_sp = {}
  84.       battler.state_p = {}
  85.       battler.state_m = {}
  86.       battler.animation = []
  87.       if battler.is_a?(Game_Actor)
  88.         @max += battler.agi
  89.       end
  90.     end
  91.     @max *= speed
  92.     @max /= $game_party.actors.size
  93.     for battler in $game_party.actors + $game_troop.enemies
  94.       battler.atp = 100 * battler.at / @max
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● ATゲージMax時SE
  99.   #--------------------------------------------------------------------------
  100.   def fullat_se
  101.     Audio.se_play("Audio/SE/033-switch02", 80, 100)
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● レベルアップSE
  105.   #--------------------------------------------------------------------------
  106.   def levelup_se
  107.     Audio.se_play("Audio/SE/056-Right02", 80, 100)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● スキル習得SE
  111.   #--------------------------------------------------------------------------
  112.   def skill_se
  113.     Audio.se_play("Audio/SE/056-Right02", 80, 150)
  114.   end
  115. end

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

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

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

  493. #==============================================================================
  494. # ■ Scene_Battle (分割定義 2)
  495. #------------------------------------------------------------------------------
  496. #  バトル画面の処理を行うクラスです。
  497. #==============================================================================

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

  920. #==============================================================================
  921. # ■ Scene_Battle (分割定義 3)
  922. #------------------------------------------------------------------------------
  923. #  バトル画面の処理を行うクラスです。
  924. #==============================================================================

  925.   #--------------------------------------------------------------------------
  926.   # ● アクターコマンドフェーズ開始
  927.   #--------------------------------------------------------------------------
  928.   def start_phase3
  929.     if victory?
  930.       return
  931.     end
  932.     # メインフェーズフラグをクリア
  933.     $game_temp.battle_main_phase = false
  934.     @command_a = true
  935.     @active_actor = @command[0]
  936.     @actor_command_window.y = 108
  937.     cnt = 0
  938.     for actor in $game_party.actors
  939.       if actor == @active_actor
  940.         @actor_index = cnt
  941.       end
  942.       cnt += 1
  943.     end
  944.     @active_actor.blink = true
  945.     unless @active_actor.inputable?
  946.       @active_actor.current_action.clear
  947.       phase3_next_actor
  948.       return
  949.     end
  950.     phase3_setup_command_window
  951.     # カメラの設定
  952.     @camera = "command"
  953.     plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  954.     y = [(plus.abs - 1.5) * 10 , 0].min
  955.     @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # ● アクターのコマンド入力終了
  959.   #--------------------------------------------------------------------------
  960.   def phase3_next_actor
  961.     @command.shift
  962.     @command_a = false
  963.     # メインフェーズフラグをセット
  964.     $game_temp.battle_main_phase = true
  965.     # アクターコマンドウィンドウを無効化
  966.     @actor_command_window.active = false
  967.     @actor_command_window.visible = false
  968.     # アクターの明滅エフェクト OFF
  969.     if @active_actor != nil
  970.       @active_actor.blink = false
  971.     end
  972.     action_start(@active_actor)
  973.     # カメラを元に戻す
  974.     if @camera == "command"
  975.       @spriteset.screen_target(0, 0, 1)
  976.     end
  977.     return
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● アクターコマンドウィンドウのセットアップ
  981.   #--------------------------------------------------------------------------
  982.   def phase3_setup_command_window
  983. #------------------------------------------------------------------------------
  984. #RTAB观光游第一站,去除“战斗/逃跑”选项部分   
  985.     # パーティコマンドウィンドウを無効化
  986. #    @party_command_window.active = false
  987. #    @party_command_window.visible = false
  988. #------------------------------------------------------------------------------  
  989.     # アクターコマンドウィンドウを有効化
  990.     @actor_command_window.active = true
  991.     @actor_command_window.visible = true
  992.     # アクターコマンドウィンドウの位置を設定
  993.     @actor_command_window.x = @actor_index * 160 +
  994.                               (4 - $game_party.actors.size) * 80
  995.     # インデックスを 0 に設定
  996.     @actor_command_window.index = 0
  997.   end
  998.   #--------------------------------------------------------------------------
  999.   # ● エネミーアクション作成
  1000.   #--------------------------------------------------------------------------
  1001.   def enemy_action(number)
  1002.     enemy = $game_troop.enemies[number]
  1003.     unless enemy.current_action.forcing
  1004.       enemy.make_action
  1005.     end
  1006.     action_start(enemy)
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ● フレーム更新 (アクターコマンドフェーズ)
  1010.   #--------------------------------------------------------------------------
  1011.   def update_phase3
  1012.     if victory? and @command_a
  1013.       command_delete
  1014.       @command.push(@active_actor)
  1015.       return
  1016.     end
  1017.     # エネミーアローが有効の場合
  1018.     if @enemy_arrow != nil
  1019.       update_phase3_enemy_select
  1020.     # アクターアローが有効の場合
  1021.     elsif @actor_arrow != nil
  1022.       update_phase3_actor_select
  1023.     # スキルウィンドウが有効の場合
  1024.     elsif @skill_window != nil
  1025.       update_phase3_skill_select
  1026.     # アイテムウィンドウが有効の場合
  1027.     elsif @item_window != nil
  1028.       update_phase3_item_select
  1029.     # アクターコマンドウィンドウが有効の場合
  1030.     elsif @actor_command_window.active
  1031.       update_phase3_basic_command
  1032.     end
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  1036.   #--------------------------------------------------------------------------
  1037.   def update_phase3_basic_command
  1038.     unless @active_actor.inputable?
  1039.       @active_actor.current_action.clear
  1040.       phase3_next_actor
  1041.       return
  1042.     end
  1043. #--------------------------------------------------------------------------
  1044. #RTAB观光游第一站,去除“战斗/逃跑”选项部分
  1045. # B ボタンが押された場合
  1046. #   if Input.trigger?(Input::B) and @party == false
  1047.       # キャンセル SE を演奏
  1048. #     $game_system.se_play($data_system.cancel_se)
  1049. #     @party = true
  1050. #   end
  1051. #   if @party == true and
  1052. #       ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
  1053. #       (@action_battlers.empty? or @action_battlers[0].phase == 1)))
  1054.       # パーティコマンドフェーズへ
  1055. #     start_phase2
  1056. #     return
  1057. #   end
  1058. #==============================================================================
  1059. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1060. #==============================================================================
  1061.     # A : SKILL
  1062.     if Input.trigger?(Input::X)
  1063.       # 決定 SE を演奏
  1064.       $game_system.se_play($data_system.decision_se)
  1065.       # スキルの選択を開始
  1066.       start_skill_select
  1067.       return
  1068.     end
  1069.     # S : 防御
  1070.     if Input.trigger?(Input::Y)
  1071.       # 決定 SE を演奏
  1072.       $game_system.se_play($data_system.decision_se)
  1073.       # アクションを設定
  1074.       @active_actor.current_action.kind = 0
  1075.       @active_actor.current_action.basic = 1
  1076.       # 次のアクターのコマンド入力へ
  1077.       phase3_next_actor
  1078.       return
  1079.     end
  1080.     # D : ITEM
  1081.     if Input.trigger?(Input::Z)
  1082.       # 決定 SE を演奏
  1083.       $game_system.se_play($data_system.decision_se)
  1084.       # アイテムの選択を開始
  1085.       start_item_select
  1086.       return
  1087.     end
  1088. #==============================================================================
  1089.     # C ボタンが押された場合
  1090.     if Input.trigger?(Input::C)
  1091. #------------------------------------------------------------------------------
  1092. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1093. #      @party = false
  1094. #------------------------------------------------------------------------------
  1095.       # アクターコマンドウィンドウのカーソル位置で分岐
  1096.       case @actor_command_window.index
  1097.       when 0  # 攻撃
  1098. #==============================================================================
  1099. #RTAB观光游第二站,增加战斗快捷键ASD                      这段是官方增加的脚本
  1100. #==============================================================================        
  1101.         if victory?
  1102.           # ブザー SE を演奏
  1103.           $game_system.se_play($data_system.buzzer_se)
  1104.           return
  1105.         end
  1106. #==============================================================================        
  1107.         # 決定 SE を演奏
  1108.         $game_system.se_play($data_system.decision_se)
  1109.         # エネミーの選択を開始
  1110.         start_enemy_select
  1111.       when 1  # スキル
  1112.         # 決定 SE を演奏
  1113.         $game_system.se_play($data_system.decision_se)
  1114.         # スキルの選択を開始
  1115.         start_skill_select
  1116.       when 2  # 防御
  1117.         # 決定 SE を演奏
  1118.         $game_system.se_play($data_system.decision_se)
  1119.         # アクションを設定
  1120.         @active_actor.current_action.kind = 0
  1121.         @active_actor.current_action.basic = 1
  1122.         # 次のアクターのコマンド入力へ
  1123.         phase3_next_actor
  1124.       when 3  # アイテム
  1125.         # 決定 SE を演奏
  1126.         $game_system.se_play($data_system.decision_se)
  1127.         # アイテムの選択を開始
  1128.         start_item_select
  1129. #==============================================================================
  1130. #RTAB观光游第三站,战斗菜单增加逃跑选项
  1131. #==============================================================================
  1132.       when 4 #逃跑(添加内容)
  1133.         if $game_temp.battle_can_escape == false
  1134.           # ブザー SE を演奏
  1135.           $game_system.se_play($data_system.buzzer_se)
  1136.           return
  1137.        end
  1138.         # 決定 SE を演奏
  1139.         $game_system.se_play($data_system.decision_se)
  1140.        @phase = 0
  1141.         # パーティコマンドウィンドウを無効化
  1142.         @actor_command_window.active = false
  1143.         @actor_command_window.visible = false
  1144.         $game_temp.battle_main_phase = true
  1145.         if $game_temp.battle_turn == 0
  1146.           update_phase2_escape
  1147.          $game_temp.battle_turn = 1
  1148.          for battler in $game_party.actors
  1149.             battler.at -= @max / 2
  1150.           end
  1151.           return
  1152.        end
  1153.        # 決定 SE を演奏
  1154.         $game_system.se_play($data_system.decision_se)
  1155.         @escape = true
  1156.         for battler in $game_party.actors
  1157.           @command_a = false
  1158.           @command.delete(battler)
  1159.           @action_battlers.delete(battler)
  1160.           skill_reset(battler)
  1161.         end
  1162. #==============================================================================        
  1163.       end
  1164.       return
  1165.     end
  1166.     # キャラチェンジ
  1167.     if @command.size > 1
  1168.       # R ボタンが押された場合
  1169.       if Input.trigger?(Input::L)
  1170.         $game_system.se_play($data_system.cursor_se)
  1171. #------------------------------------------------------------------------------
  1172. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1173.        # @party = false
  1174. #------------------------------------------------------------------------------      
  1175.         # アクターの明滅エフェクト OFF
  1176.         if @active_actor != nil
  1177.           @active_actor.blink = false
  1178.         end
  1179.         @command.push(@command[0])
  1180.         @command.shift
  1181.         @command_a = false
  1182.         # 新たなコマンドウィンドウの立ち上げ
  1183.         start_phase3
  1184.       end
  1185.       # L ボタンが押された場合
  1186.       if Input.trigger?(Input::R)
  1187.         $game_system.se_play($data_system.cursor_se)
  1188. #------------------------------------------------------------------------------
  1189. #RTAB观光游第一站,去除“战斗/逃跑”选项部分      
  1190.      #   @party = false
  1191. #------------------------------------------------------------------------------      
  1192.         # アクターの明滅エフェクト OFF
  1193.         if @active_actor != nil
  1194.           @active_actor.blink = false
  1195.         end
  1196.         @command.unshift(@command[@command.size - 1])
  1197.         @command.delete_at(@command.size - 1)
  1198.         @command_a = false
  1199.         # 新たなコマンドウィンドウの立ち上げ
  1200.         start_phase3
  1201.       end
  1202.       # 右 ボタンが押された場合
  1203.       if Input.trigger?(Input::RIGHT)
  1204.         $game_system.se_play($data_system.cursor_se)
  1205. #------------------------------------------------------------------------------
  1206. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1207.    #     @party = false
  1208. #------------------------------------------------------------------------------      
  1209.         # アクターの明滅エフェクト OFF
  1210.         if @active_actor != nil
  1211.           @active_actor.blink = false
  1212.         end
  1213.         actor = $game_party.actors[@actor_index]
  1214.         while actor == @command[0] or (not @command.include?(actor))
  1215.           @actor_index += 1
  1216.           @actor_index %= $game_party.actors.size
  1217.           actor = $game_party.actors[@actor_index]
  1218.           if actor == @command[0]
  1219.             break
  1220.           end
  1221.         end
  1222.         while actor != @command[0]
  1223.           @command.push(@command.shift)
  1224.         end
  1225.         @command_a = false
  1226.         # 新たなコマンドウィンドウの立ち上げ
  1227.         start_phase3
  1228.       end
  1229.       # 左 ボタンが押された場合
  1230.       if Input.trigger?(Input::LEFT)
  1231.         $game_system.se_play($data_system.cursor_se)
  1232. #------------------------------------------------------------------------------
  1233. #RTAB观光游第一站,去除“战斗/逃跑”选项部分        
  1234.    #     @party = false
  1235. #------------------------------------------------------------------------------
  1236.         # アクターの明滅エフェクト OFF
  1237.         if @active_actor != nil
  1238.           @active_actor.blink = false
  1239.         end
  1240.         actor = $game_party.actors[@actor_index]
  1241.         while actor == @command[0] or (not @command.include?(actor))
  1242.           @actor_index -= 1
  1243.           @actor_index %= $game_party.actors.size
  1244.           actor = $game_party.actors[@actor_index]
  1245.           if actor == @command[0]
  1246.             break
  1247.           end
  1248.         end
  1249.         while actor != @command[0]
  1250.           @command.push(@command.shift)
  1251.         end
  1252.         @command_a = false
  1253.         # 新たなコマンドウィンドウの立ち上げ
  1254.         start_phase3
  1255.       end
  1256.     end
  1257.   end
  1258.   #--------------------------------------------------------------------------
  1259.   # ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
  1260.   #--------------------------------------------------------------------------
  1261.   def update_phase3_skill_select
  1262.     # コマンド選択中に行動不能になった場合
  1263.     unless @active_actor.inputable?
  1264.       @active_actor.current_action.clear
  1265.       command_delete
  1266.       # 次のアクターのコマンド入力へ
  1267.       phase3_next_actor
  1268.       return
  1269.     end
  1270.     # スキルウィンドウを可視状態にする
  1271.     @skill_window.visible = true
  1272.     # スキルウィンドウを更新
  1273.     @skill_window.update
  1274.     # B ボタンが押された場合
  1275.     if Input.trigger?(Input::B)
  1276.       # キャンセル SE を演奏
  1277.       $game_system.se_play($data_system.cancel_se)
  1278.       # スキルの選択を終了
  1279.       end_skill_select
  1280.       return
  1281.     end
  1282.     # C ボタンが押された場合
  1283.     if Input.trigger?(Input::C)
  1284.       # スキルウィンドウで現在選択されているデータを取得
  1285.       @skill = @skill_window.skill
  1286.       # 使用できない場合
  1287.       if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
  1288.         # ブザー SE を演奏
  1289.         $game_system.se_play($data_system.buzzer_se)
  1290.         return
  1291.       end
  1292.       # 決定 SE を演奏
  1293.       $game_system.se_play($data_system.decision_se)
  1294.       # アクションを設定
  1295.       @active_actor.current_action.skill_id = @skill.id
  1296.       # スキルウィンドウを不可視状態にする
  1297.       @skill_window.visible = false
  1298.       # 効果範囲が敵単体の場合
  1299.       if @skill.scope == 1
  1300.         # エネミーの選択を開始
  1301.         start_enemy_select
  1302.       # 効果範囲が味方単体の場合
  1303.       elsif @skill.scope == 3 or @skill.scope == 5
  1304.         # アクターの選択を開始
  1305.         start_actor_select
  1306.       # 効果範囲が単体ではない場合
  1307.       else
  1308.         # アクションを設定
  1309.         @active_actor.current_action.kind = 1
  1310.         # スキルの選択を終了
  1311.         end_skill_select
  1312.         # 次のアクターのコマンド入力へ
  1313.         phase3_next_actor
  1314.       end
  1315.       return
  1316.     end
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
  1320.   #--------------------------------------------------------------------------
  1321.   def update_phase3_item_select
  1322.     # コマンド選択中に行動不能になった場合
  1323.     unless @active_actor.inputable?
  1324.       @active_actor.current_action.clear
  1325.       command_delete
  1326.       # 次のアクターのコマンド入力へ
  1327.       phase3_next_actor
  1328.       return
  1329.     end
  1330.     # アイテムウィンドウを可視状態にする
  1331.     @item_window.visible = true
  1332.     # アイテムウィンドウを更新
  1333.     @item_window.update
  1334.     # B ボタンが押された場合
  1335.     if Input.trigger?(Input::B)
  1336.       # キャンセル SE を演奏
  1337.       $game_system.se_play($data_system.cancel_se)
  1338.       # アイテムの選択を終了
  1339.       end_item_select
  1340.       return
  1341.     end
  1342.     # C ボタンが押された場合
  1343.     if Input.trigger?(Input::C)
  1344.       # アイテムウィンドウで現在選択されているデータを取得
  1345.       @item = @item_window.item
  1346.       # 使用できない場合
  1347.       unless $game_party.item_can_use?(@item.id)
  1348.         # ブザー SE を演奏
  1349.         $game_system.se_play($data_system.buzzer_se)
  1350.         return
  1351.       end
  1352.       # 決定 SE を演奏
  1353.       $game_system.se_play($data_system.decision_se)
  1354.       # アクションを設定
  1355.       @active_actor.current_action.item_id = @item.id
  1356.       # アイテムウィンドウを不可視状態にする
  1357.       @item_window.visible = false
  1358.       # 効果範囲が敵単体の場合
  1359.       if @item.scope == 1
  1360.         # エネミーの選択を開始
  1361.         start_enemy_select
  1362.       # 効果範囲が味方単体の場合
  1363.       elsif @item.scope == 3 or @item.scope == 5
  1364.         # アクターの選択を開始
  1365.         start_actor_select
  1366.       # 効果範囲が単体ではない場合
  1367.       else
  1368.         # アクションを設定
  1369.         @active_actor.current_action.kind = 2
  1370.         # アイテムの選択を終了
  1371.         end_item_select
  1372.         # 次のアクターのコマンド入力へ
  1373.         phase3_next_actor
  1374.       end
  1375.       return
  1376.     end
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
  1380.   #--------------------------------------------------------------------------
  1381.   def update_phase3_enemy_select
  1382.     # コマンド選択中に行動不能になった場合
  1383.     unless @active_actor.inputable?
  1384.       # カメラを元に戻す
  1385.       if @camera == "select"
  1386.         @spriteset.screen_target(0, 0, 1)
  1387.       end
  1388.       @active_actor.current_action.clear
  1389.       command_delete
  1390.       # 次のアクターのコマンド入力へ
  1391.       phase3_next_actor
  1392.       return
  1393.     end
  1394.     # エネミーアローを更新
  1395.     @enemy_arrow.update
  1396.     # B ボタンが押された場合
  1397.     if Input.trigger?(Input::B)
  1398.       # キャンセル SE を演奏
  1399.       $game_system.se_play($data_system.cancel_se)
  1400.       # カメラを元に戻す
  1401.       if @camera == "select"
  1402.         # カメラの設定
  1403.         @camera = "command"
  1404.         plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
  1405.         y = [(plus.abs - 1.5) * 10 , 0].min
  1406.         @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  1407.       end
  1408.       # エネミーの選択を終了
  1409.       end_enemy_select
  1410.       return
  1411.     end
  1412.     # C ボタンが押された場合
  1413.     if Input.trigger?(Input::C)
  1414.       # 決定 SE を演奏
  1415.       $game_system.se_play($data_system.decision_se)
  1416.       # アクションを設定
  1417.       @active_actor.current_action.kind = 0
  1418.       @active_actor.current_action.basic = 0
  1419.       @active_actor.current_action.target_index = @enemy_arrow.index
  1420.       # スキルウィンドウ表示中の場合
  1421.       if @skill_window != nil
  1422.         # アクションを再設定
  1423.         @active_actor.current_action.kind = 1
  1424.         # スキルの選択を終了
  1425.         end_skill_select
  1426.       end
  1427.       # アイテムウィンドウ表示中の場合
  1428.       if @item_window != nil
  1429.         # アクションを再設定
  1430.         @active_actor.current_action.kind = 2
  1431.         # アイテムの選択を終了
  1432.         end_item_select
  1433.       end
  1434.       # エネミーの選択を終了
  1435.       end_enemy_select
  1436.       # 次のアクターのコマンド入力へ
  1437.       phase3_next_actor
  1438.     end
  1439.   end
  1440.   #--------------------------------------------------------------------------
  1441.   # ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
  1442.   #--------------------------------------------------------------------------
  1443.   def update_phase3_actor_select
  1444.     # コマンド選択中に行動不能になった場合
  1445.     unless @active_actor.inputable?
  1446.       @active_actor.current_action.clear
  1447.       command_delete
  1448.       # 次のアクターのコマンド入力へ
  1449.       phase3_next_actor
  1450.       return
  1451.     end
  1452.     # アクターアローを更新
  1453.     @actor_arrow.update
  1454.     # B ボタンが押された場合
  1455.     if Input.trigger?(Input::B)
  1456.       # キャンセル SE を演奏
  1457.       $game_system.se_play($data_system.cancel_se)
  1458.       # アクターの選択を終了
  1459.       end_actor_select
  1460.       return
  1461.     end
  1462.     # C ボタンが押された場合
  1463.     if Input.trigger?(Input::C)
  1464.       # 決定 SE を演奏
  1465.       $game_system.se_play($data_system.decision_se)
  1466.       # アクションを設定
  1467.       @active_actor.current_action.kind = 0
  1468.       @active_actor.current_action.basic = 0
  1469.       @active_actor.current_action.target_index = @actor_arrow.index
  1470.       # アクターの選択を終了
  1471.       end_actor_select
  1472.       # スキルウィンドウ表示中の場合
  1473.       if @skill_window != nil
  1474.         # アクションを再設定
  1475.         @active_actor.current_action.kind = 1
  1476.         # スキルの選択を終了
  1477.         end_skill_select
  1478.       end
  1479.       # アイテムウィンドウ表示中の場合
  1480.       if @item_window != nil
  1481.         # アクションを再設定
  1482.         @active_actor.current_action.kind = 2
  1483.         # アイテムの選択を終了
  1484.         end_item_select
  1485.       end
  1486.       # 次のアクターのコマンド入力へ
  1487.       phase3_next_actor
  1488.     end
  1489.   end
  1490.   #--------------------------------------------------------------------------
  1491.   # ● エネミー選択開始
  1492.   #--------------------------------------------------------------------------
  1493.   alias :start_enemy_select_rtab :start_enemy_select
  1494.   def start_enemy_select
  1495.     @camera = "select"
  1496.     for enemy in $game_troop.enemies
  1497.       if enemy.exist?
  1498.         zoom = 1 / enemy.zoom
  1499.         @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
  1500.                                   enemy.attack_y(zoom) * 0.75, zoom)
  1501.         break
  1502.       end
  1503.     end
  1504.     # オリジナルの処理
  1505.     start_enemy_select_rtab
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # ● エネミー選択終了
  1509.   #--------------------------------------------------------------------------
  1510.   alias :end_enemy_select_rtab :end_enemy_select
  1511.   def end_enemy_select
  1512.     # オリジナルの処理
  1513.     end_enemy_select_rtab
  1514.     if (@action == 0 and not @action_battlers.empty?) or
  1515.           (@camera == "select" and (@active_actor.current_action.kind != 0 or
  1516.                                             @active_actor.animation1_id != 0))
  1517.       @spriteset.screen_target(0, 0, 1)
  1518.     end
  1519.   end
  1520.   #--------------------------------------------------------------------------
  1521.   # ● スキル選択開始
  1522.   #--------------------------------------------------------------------------
  1523.   def start_skill_select
  1524.     # スキルウィンドウを作成
  1525.     @skill_window = Window_Skill.new(@active_actor)
  1526.     # ヘルプウィンドウを関連付け
  1527.     @skill_window.help_window = @help_window
  1528.     # アクターコマンドウィンドウを無効化
  1529.     @actor_command_window.active = false
  1530.     @actor_command_window.visible = false
  1531.   end

  1532. #==============================================================================
  1533. # ■ Scene_Battle (分割定義 4)
  1534. #------------------------------------------------------------------------------
  1535. #  バトル画面の処理を行うクラスです。
  1536. #==============================================================================

  1537.   #--------------------------------------------------------------------------
  1538.   # ● メインフェーズ開始
  1539.   #--------------------------------------------------------------------------
  1540.   def start_phase4
  1541.     $game_temp.battle_main_phase = true
  1542.   end
  1543.   #--------------------------------------------------------------------------
  1544.   # ● フレーム更新 (メインフェーズ)
  1545.   #--------------------------------------------------------------------------
  1546.   def update_phase4
  1547.     # アクションを強制されているバトラーが存在する場合
  1548.     if $game_temp.forcing_battler != nil
  1549.       battler = $game_temp.forcing_battler
  1550.       if battler.current_action.forcing == false
  1551.         if @action_battlers.include?(battler)
  1552.           if @action > 0 or @action_battlers[0].phase == 1
  1553.             @action_battlers.delete(battler)
  1554.             @action_battlers.push(battler)
  1555.           end
  1556.           if battler.phase == 1
  1557.             battler.current_action.forcing = true
  1558.             force_action(battler)
  1559.           end
  1560.         else
  1561.           battler.current_action.forcing = true
  1562.           force_action(battler)
  1563.           action_start(battler)
  1564.           @action_battlers.delete(battler)
  1565.           @action_battlers.push(battler)
  1566.         end
  1567.         battler.at = @max
  1568.         battler.atp = 100 * battler.at / @max
  1569.       end
  1570.     end
  1571.     # action が1以上の場合、一斉に行動を起こす
  1572.     for battler in @action_battlers.reverse
  1573.       # ウェイト中の場合
  1574.       if battler.wait > 0
  1575.         # ウェイトカウントを減らす
  1576.         battler.wait -= 1
  1577.         break if @action == 0
  1578.         next
  1579.       end
  1580.       unless fin? and battler.phase < 3 and
  1581.           not $game_system.battle_interpreter.running?
  1582.         action_phase(battler)
  1583.       end
  1584.       break if @action == 0
  1585.     end
  1586.     # アクションを強制されているバトラーが存在しない場合
  1587.     if $game_temp.forcing_battler == nil
  1588.       # バトルイベントをセットアップ
  1589.       setup_battle_event
  1590.       # バトルイベント実行中の場合
  1591.       if $game_system.battle_interpreter.running?
  1592.         return
  1593.       end
  1594.     end
  1595.     # 勝敗を決した際の処理
  1596.     if fin?
  1597.       # 敗北時、指定時間ウェイト
  1598.       if $game_party.all_dead? and @after_wait[0] > 0
  1599.         @after_wait[0] -= 1
  1600.         return
  1601.       end
  1602.       # 勝利時、指定時間ウェイト
  1603.       if victory? and @after_wait[1] > 0
  1604.         @after_wait[1] -= 1
  1605.         return
  1606.       end
  1607.       # 戦闘が終了し、かつアクターが行動直前の場合はアクターの行動を消去
  1608.       for battler in @action_battlers.reverse
  1609.         if battler.phase < 3 and not $game_system.battle_interpreter.running?
  1610.           @action_battlers.delete(battler)
  1611.         end
  1612.       end
  1613.       # 勝敗判定
  1614.       if @action_battlers.empty? and
  1615.           not $game_system.battle_interpreter.running?
  1616.         judge
  1617.       end
  1618.     end
  1619.   end
  1620.   #--------------------------------------------------------------------------
  1621.   # ● アクション更新 (メインフェーズ)
  1622.   #--------------------------------------------------------------------------
  1623.   def action_phase(battler)
  1624.     # action が 1 の場合、バトラーが行動中かどうか確認
  1625.     if @action == 1 and battler.phase <= 3
  1626.       for target in battler.target
  1627.         speller = synthe?(target)
  1628.         if speller == nil
  1629.           # ターゲットが通常行動中の場合
  1630.           if @action_battlers.include?(target)
  1631.             if target.phase > 2
  1632.               return
  1633.             end
  1634.           end
  1635.         else
  1636.           # ターゲットが連携スキル発動中の場合
  1637.           for spell in speller
  1638.             if @action_battlers.include?(spell)
  1639.               if spell.phase > 2
  1640.                 return
  1641.               end
  1642.             end
  1643.           end
  1644.         end
  1645.       end
  1646.     end
  1647.     case battler.phase
  1648.     when 1
  1649.       update_phase4_step1(battler)
  1650.     when 2
  1651.       update_phase4_step2(battler)
  1652.     when 3
  1653.       update_phase4_step3(battler)
  1654.     when 4
  1655.       update_phase4_step4(battler)
  1656.     when 5
  1657.       update_phase4_step5(battler)
  1658.     when 6
  1659.       update_phase4_step6(battler)
  1660.     end
  1661.   end
  1662.   #--------------------------------------------------------------------------
  1663.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  1664.   #--------------------------------------------------------------------------
  1665.   def update_phase4_step1(battler)
  1666.     # すでに戦闘から外されている場合
  1667.     if battler.index == nil
  1668.       @action_battlers.delete(battler)
  1669.       anime_wait_return
  1670.       return
  1671.     end
  1672.     speller = synthe?(battler)
  1673.     if speller == nil
  1674.       # ダメージ食らい中の場合
  1675.       unless battler.damage.empty? or @action > 2
  1676.         return
  1677.       end
  1678.       # 行動可能かどうか判定
  1679.       unless battler.movable?
  1680.         battler.phase = 6
  1681.         return
  1682.       end
  1683.     else
  1684.       # ダメージ食らい中の場合
  1685.       for spell in speller
  1686.         unless spell.damage.empty? or @action > 2
  1687.           return
  1688.         end
  1689.         # 行動可能かどうか判定
  1690.         unless spell.movable?
  1691.           battler.phase = 6
  1692.           return
  1693.         end
  1694.       end
  1695.     end
  1696.     # スキル使用時、詠唱時間設定
  1697.     # 強制アクションかつ @force が 2 の時はスキルを即時発動
  1698.     if battler.current_action.kind == 1 and
  1699.       (not battler.current_action.forcing or @force != 2)
  1700.       if battler.rtp == 0
  1701.         # スキル詠唱中ならば、解除
  1702.         skill_reset(battler)
  1703.         # スキル詠唱時間設定
  1704.         recite_time(battler)
  1705.         # 連携技設定
  1706.         synthe_spell(battler)
  1707.         # スキルを詠唱する場合
  1708.         if battler.rtp > 0
  1709.           # 強制アクションかつ @force が 1 の時は連携スキルのみ即時発動
  1710.           speller = synthe?(battler)
  1711.           if battler.current_action.forcing and @force > 0 and speller != nil
  1712.             for spell in speller
  1713.               spell.rt = spell.rtp
  1714.             end
  1715.           else
  1716.             battler.blink = true
  1717.             if battler.current_action.forcing
  1718.               $game_temp.forcing_battler = nil
  1719.               battler.current_action.forcing = false
  1720.             end
  1721.             @action_battlers.delete(battler)
  1722.             return
  1723.           end
  1724.         end
  1725.       end
  1726.     end
  1727.     # アクターの明滅エフェクト OFF
  1728.     if battler != nil
  1729.       battler.blink = false
  1730.     end
  1731.     speller = synthe?(battler)
  1732.     if speller == nil
  1733.       @spell_p.delete(battler)
  1734.       @spell_e.delete(battler)
  1735.     else
  1736.       for spell in speller
  1737.         spell.blink = false
  1738.         @spell_p.delete(spell)
  1739.         @spell_e.delete(spell)
  1740.       end
  1741.     end
  1742.     # ステップ 2 に移行
  1743.     battler.phase = 2
  1744.   end
  1745.   #--------------------------------------------------------------------------
  1746.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  1747.   #--------------------------------------------------------------------------
  1748.   def update_phase4_step2(battler)
  1749.     # 強制アクションでなければ
  1750.     unless battler.current_action.forcing
  1751.       # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  1752.       if battler.restriction == 2 or battler.restriction == 3
  1753.         # アクションに攻撃を設定
  1754.         battler.current_action.kind = 0
  1755.         battler.current_action.basic = 0
  1756.       end
  1757.     end
  1758.     # アクションの種別で分岐
  1759.     case battler.current_action.kind
  1760.     when 0  # 基本
  1761.       if fin?
  1762.         battler.phase = 6
  1763.         return
  1764.       end
  1765.       make_basic_action_result(battler)
  1766.     when 1  # スキル
  1767.       if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
  1768.         battler.phase = 6
  1769.         return
  1770.       end
  1771.       make_skill_action_result(battler)
  1772.     when 2  # アイテム
  1773.       if fin? and $data_items[battler.current_action.item_id].scope == 1..2
  1774.         battler.phase = 6
  1775.         return
  1776.       end
  1777.       make_item_action_result(battler)
  1778.     end
  1779.     if battler.phase == 2
  1780.       # ステップ 3 に移行
  1781.       battler.phase = 3
  1782.     end
  1783.   end
  1784.   #--------------------------------------------------------------------------
  1785.   # ● 基本アクション 結果作成
  1786.   #--------------------------------------------------------------------------
  1787.   def make_basic_action_result(battler)
  1788.     # 攻撃の場合
  1789.     if battler.current_action.basic == 0
  1790.       # アニメーション ID を設定
  1791.       battler.anime1 = battler.animation1_id
  1792.       battler.anime2 = battler.animation2_id
  1793.       # 行動側バトラーがエネミーの場合
  1794.       if battler.is_a?(Game_Enemy)
  1795.         if battler.restriction == 3
  1796.           target = $game_troop.random_target_enemy
  1797.         elsif battler.restriction == 2
  1798.           target = $game_party.random_target_actor
  1799.         else
  1800.           index = battler.current_action.target_index
  1801.           target = $game_party.smooth_target_actor(index)
  1802.         end
  1803.       end
  1804.       # 行動側バトラーがアクターの場合
  1805.       if battler.is_a?(Game_Actor)
  1806.         if battler.restriction == 3
  1807.           target = $game_party.random_target_actor
  1808.         elsif battler.restriction == 2
  1809.           target = $game_troop.random_target_enemy
  1810.         else
  1811.           index = battler.current_action.target_index
  1812.           target = $game_troop.smooth_target_enemy(index)
  1813.         end
  1814.       end
  1815.       # 対象側バトラーの配列を設定
  1816.       battler.target = [target]
  1817.       # 通常攻撃の効果を適用
  1818.       for target in battler.target
  1819.         target.attack_effect(battler)
  1820.       end
  1821.       return
  1822.     end
  1823.     # 防御の場合
  1824.     if battler.current_action.basic == 1
  1825.       return
  1826.     end
  1827.     # 逃げるの場合
  1828. #    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1829.       # 逃げる
  1830. #      @help_window.set_text("逃げる", 1)
  1831. #      @help_wait = @help_time
  1832. #      battler.escape
  1833. #      return
  1834. #    end
  1835. #========RTAB 1.16=====================================================   
  1836.     # 逃げるの場合
  1837.     if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
  1838.       return
  1839.     end
  1840. #======================================================================
  1841.     # 何もしないの場合
  1842.     if battler.current_action.basic == 3
  1843.       # ステップ 6 に移行
  1844.       battler.phase = 6
  1845.       return
  1846.     end
  1847.   end
  1848.   #--------------------------------------------------------------------------
  1849.   # ● スキルまたはアイテムの対象側バトラー設定
  1850.   #     scope : スキルまたはアイテムの効果範囲
  1851.   #--------------------------------------------------------------------------
  1852.   def set_target_battlers(scope, battler)
  1853.     # 行動側バトラーがエネミーの場合
  1854.     if battler.is_a?(Game_Enemy)
  1855.       # 効果範囲で分岐
  1856.       case scope
  1857.       when 1  # 敵単体
  1858.         index =battler.current_action.target_index
  1859.         battler.target.push($game_party.smooth_target_actor(index))
  1860.       when 2  # 敵全体
  1861.         for actor in $game_party.actors
  1862.           if actor.exist?
  1863.             battler.target.push(actor)
  1864.           end
  1865.         end
  1866.       when 3  # 味方単体
  1867.         index = battler.current_action.target_index
  1868.         battler.target.push($game_troop.smooth_target_enemy(index))
  1869.       when 4  # 味方全体
  1870.         for enemy in $game_troop.enemies
  1871.           if enemy.exist?
  1872.             battler.target.push(enemy)
  1873.           end
  1874.         end
  1875.       when 5  # 味方単体 (HP 0)
  1876.         index = battler.current_action.target_index
  1877.         enemy = $game_troop.enemies[index]
  1878.         if enemy != nil and enemy.hp0?
  1879.           battler.target.push(enemy)
  1880.         end
  1881.       when 6  # 味方全体 (HP 0)
  1882.         for enemy in $game_troop.enemies
  1883.           if enemy != nil and enemy.hp0?
  1884.             battler.target.push(enemy)
  1885.           end
  1886.         end
  1887.       when 7  # 使用者
  1888.         battler.target.push(battler)
  1889.       end
  1890.     end
  1891.     # 行動側バトラーがアクターの場合
  1892.     if battler.is_a?(Game_Actor)
  1893.       # 効果範囲で分岐
  1894.       case scope
  1895.       when 1  # 敵単体
  1896.         index = battler.current_action.target_index
  1897.         battler.target.push($game_troop.smooth_target_enemy(index))
  1898.       when 2  # 敵全体
  1899.         for enemy in $game_troop.enemies
  1900.           if enemy.exist?
  1901.             battler.target.push(enemy)
  1902.           end
  1903.         end
  1904.       when 3  # 味方単体
  1905.         index = battler.current_action.target_index
  1906.         battler.target.push($game_party.smooth_target_actor(index))
  1907.       when 4  # 味方全体
  1908.         for actor in $game_party.actors
  1909.           if actor.exist?
  1910.             battler.target.push(actor)
  1911.           end
  1912.         end
  1913.       when 5  # 味方単体 (HP 0)
  1914.         index = battler.current_action.target_index
  1915.         actor = $game_party.actors[index]
  1916.         if actor != nil and actor.hp0?
  1917.           battler.target.push(actor)
  1918.         end
  1919.       when 6  # 味方全体 (HP 0)
  1920.         for actor in $game_party.actors
  1921.           if actor != nil and actor.hp0?
  1922.             battler.target.push(actor)
  1923.           end
  1924.         end
  1925.       when 7  # 使用者
  1926.         battler.target.push(battler)
  1927.       end
  1928.     end
  1929.   end
  1930.   #--------------------------------------------------------------------------
  1931.   # ● スキルアクション 結果作成
  1932.   #--------------------------------------------------------------------------
  1933.   def make_skill_action_result(battler)
  1934.     # スキルを取得
  1935.     @skill = $data_skills[battler.current_action.skill_id]
  1936.     # 連携スキルであるかどうか確認
  1937.     speller = synthe?(battler)
  1938.     # 強制アクションでなければ
  1939.     unless battler.current_action.forcing
  1940.       # SP 切れなどで使用できなくなった場合
  1941.       if speller == nil
  1942.         unless battler.skill_can_use?(@skill.id)
  1943.           # ステップ 6 に移行
  1944.           battler.phase = 6
  1945.          return
  1946.         end
  1947.       end
  1948.     end
  1949.     # SP 消費
  1950.     temp = false
  1951.     if speller != nil
  1952.       for spell in speller
  1953.         if spell.current_action.spell_id == 0
  1954.           spell.sp -= @skill.sp_cost
  1955.                                 if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  1956.             spell.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  1957.             spell.hp_store = [spell.hp_store,300].min
  1958.           end
  1959.           if @skill.element_set.include?(20) #★,消耗HP储存条
  1960.             spell.hp_store -= @skill.sp_cost
  1961.             spell.sp -= @skill.sp_cost
  1962.                       if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  1963.             spell.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  1964.             spell.hp_store = [spell.hp_store,300].min
  1965.           end
  1966.           if spell.hp_store > 200
  1967.              spell.hp_store = 200
  1968.           end   
  1969.           if @skill.element_set.include?(22) #★,消耗SP储存条
  1970.             spell.hp_store -= 100
  1971.             spell.sp -= @skill.sp_cost
  1972.                       if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  1973.             spell.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  1974.             spell.hp_store = [spell.hp_store,300].min
  1975.           end
  1976.                     if spell.hp_store > 200
  1977.              spell.hp_store = 200
  1978.           end
  1979.           end
  1980.           if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  1981.             spell.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  1982.             spell.hp_store = [spell.hp_store,300].min
  1983.           end
  1984.                     if spell.hp_store > 200
  1985.              spell.hp_store = 200
  1986.           end
  1987.           end
  1988.         else
  1989.           spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
  1990.            if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  1991.             spell.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  1992.             spell.hp_store = [spell.hp_store,300].min
  1993.           end
  1994.                     if spell.hp_store > 200
  1995.              spell.hp_store = 200
  1996.           end
  1997.           if @skill.element_set.include?(20) #★,消耗HP储存条
  1998.             spell.hp_store -= @skill.sp_cost
  1999.           end
  2000.           if @skill.element_set.include?(22) #★,消耗SP储存条
  2001.             spell.hp_store -= 100
  2002.           end
  2003.         end
  2004.         # ステータスウィンドウをリフレッシュ
  2005.         status_refresh(spell)
  2006.       end
  2007.     else
  2008.       battler.sp -= @skill.sp_cost
  2009.           if battler.is_a?(Game_Actor) # ★设定sp_store的增加
  2010.             battler.hp_store += [@skill.sp_cost*100/battler.maxsp, 0].max
  2011.             battler.hp_store = [battler.hp_store,300].min
  2012.                    if battler.hp_store > 200
  2013.              battler.hp_store = 200
  2014.           end   
  2015.           end
  2016.       if @skill.element_set.include?(20)
  2017.         battler.hp_store -= @skill.sp_cost
  2018.         battler.sp -= @skill.sp_cost
  2019.               if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  2020.             battler.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  2021.             battler.hp_store = [battler.hp_store,300].min
  2022.           end
  2023.           if battler.hp_store > 200
  2024.              battler.hp_store = 200
  2025.           end
  2026.         elsif @skill.element_set.include?(22) #★,消耗SP储存条
  2027.             battler.hp_store -= 100
  2028.             battler.sp -= @skill.sp_cost
  2029.                   if @actor.is_a?(Game_Actor) # ★设定sp_store的增加
  2030.             battler.hp_store += [@skill.sp_cost*100/@actor.maxsp, 0].max
  2031.             battler.hp_store = [battler.hp_store,300].min
  2032.           end
  2033.                     if battler.hp_store > 200
  2034.              battler.hp_store = 200
  2035.           end
  2036.           end
  2037.       # ステータスウィンドウをリフレッシュ
  2038.       status_refresh(battler)
  2039.     end
  2040.     # アニメーション ID を設定
  2041.     battler.anime1 = @skill.animation1_id
  2042.     battler.anime2 = @skill.animation2_id
  2043.     # コモンイベント ID を設定
  2044.     battler.event = @skill.common_event_id
  2045.     # 対象側バトラーを設定
  2046.     set_target_battlers(@skill.scope, battler)
  2047.     # スキルの効果を適用
  2048.     for target in battler.target
  2049.       if speller != nil
  2050.         damage = 0
  2051.         d_result = false
  2052.         effective = false
  2053.         state_p = []
  2054.         state_m = []
  2055.         for spell in speller
  2056.           if spell.current_action.spell_id != 0
  2057.             @skill = $data_skills[spell.current_action.spell_id]
  2058.           end
  2059.           effective |= target.skill_effect(spell, @skill)
  2060.           if target.damage[spell].class != String
  2061.             d_result = true
  2062.             damage += target.damage[spell]
  2063.           elsif effective
  2064.             effect = target.damage[spell]
  2065.           end
  2066.           state_p += target.state_p[spell]
  2067.           state_m += target.state_m[spell]
  2068.           target.damage.delete(spell)
  2069.           target.state_p.delete(spell)
  2070.           target.state_m.delete(spell)
  2071.         end
  2072.         if d_result
  2073.           target.damage[battler] = damage
  2074.         elsif effective
  2075.           target.damage[battler] = effect
  2076.         else
  2077.           target.damage[battler] = 0
  2078.         end
  2079.         target.state_p[battler] = state_p
  2080.         target.state_m[battler] = state_m
  2081.       else
  2082.         target.skill_effect(battler, @skill)
  2083.       end
  2084.     end
  2085.   end
  2086.   #--------------------------------------------------------------------------
  2087.   # ● アイテムアクション 結果作成
  2088.   #--------------------------------------------------------------------------
  2089.   def make_item_action_result(battler)
  2090.     # アイテムを取得
  2091.     @item = $data_items[battler.current_action.item_id]
  2092.     # アイテム切れなどで使用できなくなった場合
  2093.     unless $game_party.item_can_use?(@item.id)
  2094.       # ステップ 6 に移行
  2095.       battler.phase = 6
  2096.       return
  2097.     end
  2098.     # 消耗品の場合
  2099.     if @item.consumable
  2100.       # 使用したアイテムを 1 減らす
  2101.       $game_party.lose_item(@item.id, 1)
  2102.     end
  2103.     # アニメーション ID を設定
  2104.     battler.anime1 = @item.animation1_id
  2105.     battler.anime2 = @item.animation2_id
  2106.     # コモンイベント ID を設定
  2107.     battler.event = @item.common_event_id
  2108.     # 対象を決定
  2109.     index = battler.current_action.target_index
  2110.     target = $game_party.smooth_target_actor(index)
  2111.     # 対象側バトラーを設定
  2112.     set_target_battlers(@item.scope, battler)
  2113.     # アイテムの効果を適用
  2114.     for target in battler.target
  2115.       target.item_effect(@item, battler)
  2116.     end
  2117.   end
  2118.   #--------------------------------------------------------------------------
  2119.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  2120.   #--------------------------------------------------------------------------
  2121.   def update_phase4_step3(battler)
  2122.     # ヘルプウィンドウの更新。アクションの種別で分岐
  2123.     case battler.current_action.kind
  2124.     when 0  # 基本
  2125.       if battler.current_action.basic == 1
  2126.         @help_window.set_text($data_system.words.guard, 1)
  2127.         @help_wait = @help_time
  2128.       end
  2129. #========RTAB 1.16==================================      
  2130.       if battler.current_action.basic == 2
  2131.         # 逃げる
  2132.         @help_window.set_text("逃げる", 1)
  2133.         @help_wait = @help_time
  2134.         battler.escape
  2135.         battler.phase = 4
  2136.         return
  2137.       end
  2138. #===================================================        
  2139.     when 1  # スキル
  2140.       skill =  $data_skills[battler.current_action.skill_id]
  2141.       @help_window.set_text(skill.name, 1)
  2142.       @help_wait = @help_time
  2143.     when 2  # アイテム
  2144.       item = $data_items[battler.current_action.item_id]
  2145.       @help_window.set_text(item.name, 1)
  2146.       @help_wait = @help_time
  2147.     end
  2148.     # 行動側アニメーション (ID が 0 の場合は白フラッシュ)
  2149.     if battler.anime1 == 0
  2150.       battler.white_flash = true
  2151.       battler.wait = 5
  2152.       # カメラ設定
  2153.       if battler.target[0].is_a?(Game_Enemy)
  2154.         camera_set(battler)
  2155.       end
  2156.     else
  2157.       battler.animation.push([battler.anime1, true])
  2158.       speller = synthe?(battler)
  2159.       if speller != nil
  2160.         for spell in speller
  2161.           if spell != battler
  2162.             if spell.current_action.spell_id == 0
  2163.               spell.animation.push([battler.anime1, true])
  2164.             else
  2165.               skill = spell.current_action.spell_id
  2166.               spell.animation.push([$data_skills[skill].animation1_id, true])
  2167.               spell.current_action.spell_id = 0
  2168.             end
  2169.           end
  2170.         end
  2171.       end
  2172.       battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
  2173.     end
  2174.     # ステップ 4 に移行
  2175.     battler.phase = 4
  2176.   end
  2177.   #--------------------------------------------------------------------------
  2178.   # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  2179.   #--------------------------------------------------------------------------
  2180.   def update_phase4_step4(battler)
  2181.     # カメラ設定
  2182.     if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
  2183.        camera_set(battler)
  2184.     end
  2185.     # 対象側アニメーション
  2186.     for target in battler.target
  2187.       target.animation.push([battler.anime2,
  2188.                                           (target.damage[battler] != "Miss")])
  2189.       unless battler.anime2 == 0
  2190.         battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
  2191.       end
  2192.     end
  2193.     # ステップ 5 に移行
  2194.     battler.phase = 5
  2195.   end
  2196.   #--------------------------------------------------------------------------
  2197.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  2198.   #--------------------------------------------------------------------------
  2199.   def update_phase4_step5(battler)
  2200.     # ダメージ表示
  2201.     for target in battler.target
  2202.       if target.damage[battler] != nil
  2203.         target.damage_pop[battler] = true
  2204.         target.damage_effect(battler, battler.current_action.kind)
  2205.         battler.wait = @damage_wait
  2206.         # ステータスウィンドウをリフレッシュ
  2207.         status_refresh(target)
  2208.       end
  2209.     end
  2210.     # ステップ 6 に移行
  2211.     battler.phase = 6
  2212.   end
  2213.   #--------------------------------------------------------------------------
  2214.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  2215.   #--------------------------------------------------------------------------
  2216.   def update_phase4_step6(battler)
  2217.     # カメラを戻す
  2218.     if battler.target[0].is_a?(Game_Enemy) and @camera == battler
  2219.       @spriteset.screen_target(0, 0, 1)
  2220.     end
  2221.     # スキルラーニング
  2222.     if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
  2223.       for target in battler.target
  2224.         skill_learning(target, target.class_id,
  2225.                         battler.current_action.skill_id)
  2226.       end
  2227.     end
  2228.     # アクション強制対象のバトラーをクリア
  2229.     if battler.current_action.forcing == true and
  2230.         battler.current_action.force_kind == 0 and
  2231.         battler.current_action.force_basic == 0 and
  2232.         battler.current_action.force_skill_id == 0
  2233.       $game_temp.forcing_battler = nil
  2234.       battler.current_action.forcing = false
  2235.     end
  2236.     refresh_phase(battler)
  2237.     speller = synthe?(battler)
  2238.     if speller != nil
  2239.       for spell in speller
  2240.         if spell != battler
  2241.           refresh_phase(spell)
  2242.         end
  2243.       end
  2244.       synthe_delete(speller)
  2245.     end
  2246.     # コモンイベント ID が有効の場合
  2247.     if battler.event > 0
  2248.       # イベントをセットアップ
  2249.       common_event = $data_common_events[battler.event]
  2250.       $game_system.battle_interpreter.setup(common_event.list, 0)
  2251.     end
  2252.     act = 0
  2253.     for actor in $game_party.actors + $game_troop.enemies
  2254.       if actor.movable?
  2255.         act += 1
  2256.       end
  2257.     end
  2258.     if @turn_cnt >= act and act > 0
  2259.       @turn_cnt %= act
  2260.       $game_temp.battle_turn += 1
  2261.       # バトルイベントの全ページを検索
  2262.       for index in 0...$data_troops[@troop_id].pages.size
  2263.         # イベントページを取得
  2264.         page = $data_troops[@troop_id].pages[index]
  2265.         # このページのスパンが [ターン] の場合
  2266.         if page.span == 1
  2267.           # 実行済みフラグをクリア
  2268.           $game_temp.battle_event_flags[index] = false
  2269.         end
  2270.       end
  2271.     end
  2272.     battler.phase = 1
  2273.     @action_battlers.delete(battler)
  2274.   end
  2275.   #--------------------------------------------------------------------------
  2276.   # ● リフレッシュ
  2277.   #--------------------------------------------------------------------------
  2278.   def refresh_phase(battler)
  2279.     battler.at -= @max
  2280.     if battler.movable?
  2281.       battler.atp = 100 * battler.at / @max
  2282.     end
  2283.     spell_reset(battler)
  2284.     # スリップダメージ
  2285.     if battler.hp > 0 and battler.slip_damage?
  2286.       battler.slip_damage_effect
  2287.       battler.damage_pop["slip"] = true
  2288.     end
  2289.     # ステート自然解除
  2290.     battler.remove_states_auto
  2291.     # ステータスウィンドウをリフレッシュ
  2292.     status_refresh(battler, true)
  2293.     unless battler.movable?
  2294.       return
  2295.     end
  2296.     # ターン数カウント
  2297.     @turn_cnt += 1
  2298.   end
  2299.   #--------------------------------------------------------------------------
  2300.   # ● バトラーアクションスタート
  2301.   #--------------------------------------------------------------------------
  2302.   def action_start(battler)
  2303.     battler.phase = 1
  2304.     battler.anime1 = 0
  2305.     battler.anime2 = 0
  2306.     battler.target = []
  2307.     battler.event = 0
  2308.     @action_battlers.unshift(battler)
  2309.   end
  2310.   #--------------------------------------------------------------------------
  2311.   # ● ステータスウィンドウをリフレッシュ
  2312.   #--------------------------------------------------------------------------
  2313.   def status_refresh(battler, at = false)
  2314.     if battler.is_a?(Game_Actor)
  2315.       for i in 0...$game_party.actors.size
  2316.         if battler == $game_party.actors[i]
  2317.           number = i + 1
  2318.         end
  2319.       end
  2320.       @status_window.refresh(number)
  2321.       if at == true
  2322.         @status_window.at_refresh(number)
  2323.       end
  2324.     end
  2325.   end
  2326.   #--------------------------------------------------------------------------
  2327.   # ● アニメウェイト判断処理
  2328.   #--------------------------------------------------------------------------
  2329.   def anime_wait_return
  2330.     if (@action_battlers.empty? or @anime_wait == false) and
  2331.         not $game_system.battle_interpreter.running?
  2332.       # エネミーアローが有効の場合
  2333.       if @enemy_arrow != nil
  2334.         return [@active - 2, 0].min == 0
  2335.       # アクターアローが有効の場合
  2336.       elsif @actor_arrow != nil
  2337.         return [@active - 2, 0].min == 0
  2338.       # スキルウィンドウが有効の場合
  2339.       elsif @skill_window != nil
  2340.         return [@active - 3, 0].min == 0
  2341.       # アイテムウィンドウが有効の場合
  2342.       elsif @item_window != nil
  2343.         return [@active - 3, 0].min == 0
  2344.       # アクターコマンドウィンドウが有効の場合
  2345.       elsif @actor_command_window.active
  2346.         return [@active - 1, 0].min == 0
  2347.       else
  2348.         return true
  2349.       end
  2350.     else
  2351.       return false
  2352.     end
  2353.   end
  2354.   #--------------------------------------------------------------------------
  2355.   # ● アクターコマンド消去判断
  2356.   #--------------------------------------------------------------------------
  2357.   def command_delete
  2358.     # エネミーアローが有効の場合
  2359.     if @enemy_arrow != nil
  2360.       end_enemy_select
  2361.     # アクターアローが有効の場合
  2362.     elsif @actor_arrow != nil
  2363.       end_actor_select
  2364.     end
  2365.     # スキルウィンドウが有効の場合
  2366.     if @skill_window != nil
  2367.       end_skill_select
  2368.     # アイテムウィンドウが有効の場合
  2369.     elsif @item_window != nil
  2370.       end_item_select
  2371.     end
  2372.     # アクターコマンドウィンドウが有効の場合
  2373.     if @actor_command_window.active
  2374.       @command.shift
  2375.       @command_a = false
  2376.       # メインフェーズフラグをセット
  2377.       $game_temp.battle_main_phase = true
  2378.       # アクターコマンドウィンドウを無効化
  2379.       @actor_command_window.active = false
  2380.       @actor_command_window.visible = false
  2381.       # アクターの明滅エフェクト OFF
  2382.       if @active_actor != nil
  2383.         @active_actor.blink = false
  2384.       end
  2385.     end
  2386.   end
  2387.   #--------------------------------------------------------------------------
  2388.   # ● 強制アクション設定
  2389.   #--------------------------------------------------------------------------
  2390.   def force_action(battler)
  2391.     battler.current_action.kind = battler.current_action.force_kind
  2392.     battler.current_action.basic = battler.current_action.force_basic
  2393.     battler.current_action.skill_id = battler.current_action.force_skill_id
  2394.     battler.current_action.force_kind = 0
  2395.     battler.current_action.force_basic = 0
  2396.     battler.current_action.force_skill_id = 0
  2397.   end
  2398.   #--------------------------------------------------------------------------
  2399.   # ● カメラセット
  2400.   #--------------------------------------------------------------------------
  2401.   def camera_set(battler)
  2402.     @camera = battler
  2403.     if battler.target.size == 1
  2404.       if battler.current_action.kind == 0
  2405.         zoom = 1.2 / battler.target[0].zoom
  2406.       elsif synthe?(battler) == nil
  2407.         zoom = 1.5 / battler.target[0].zoom
  2408.       else
  2409.         zoom = 2.0 / battler.target[0].zoom
  2410.       end
  2411.       @spriteset.screen_target(battler.target[0].attack_x(zoom),
  2412.                                 battler.target[0].attack_y(zoom), zoom)
  2413.     else
  2414.       @spriteset.screen_target(0, 0, 0.75)
  2415.     end
  2416.   end
  2417.   #--------------------------------------------------------------------------
  2418.   # ● スキル詠唱タイム作成
  2419.   #--------------------------------------------------------------------------
  2420.   def recite_time(battler)
  2421.   end
  2422.   #--------------------------------------------------------------------------
  2423.   # ● 連携スキル判別
  2424.   #--------------------------------------------------------------------------
  2425.   def synthe_spell(battler)
  2426.   end
  2427.   #--------------------------------------------------------------------------
  2428.   # ● スキルラーニングシステム
  2429.   #--------------------------------------------------------------------------
  2430.   def skill_learning(actor, class_id, skill_id)
  2431.   end
  2432.   #--------------------------------------------------------------------------
  2433.   # ● 行動可能判定
  2434.   #--------------------------------------------------------------------------
  2435.   def active?(battler)
  2436.     speller = synthe?(battler)
  2437.     if speller != nil
  2438.       if synthe_delete?(speller)
  2439.         return false
  2440.       end
  2441.     else
  2442.       unless battler.inputable?
  2443.         spell_reset(battler)
  2444.         unless battler.movable?
  2445.           battler.atp = 0
  2446.           return false
  2447.         end
  2448.       end
  2449.       if battler.current_action.forcing
  2450.         spell_reset(battler)
  2451.       end
  2452.     end
  2453.     return true
  2454.   end
  2455.   #--------------------------------------------------------------------------
  2456.   # ● 合成スキル詠唱中か?
  2457.   #--------------------------------------------------------------------------
  2458.   def synthe?(battler)
  2459.     for speller in @synthe
  2460.       if speller.include?(battler)
  2461.         return speller
  2462.       end
  2463.     end
  2464.     return nil
  2465.   end
  2466.   #--------------------------------------------------------------------------
  2467.   # ● 合成スキル消去判断
  2468.   #--------------------------------------------------------------------------
  2469.   def synthe_delete?(speller)
  2470.     for battler in speller
  2471.       if not battler.inputable? and dead_ok?(battler)
  2472.         synthe_delete(speller)
  2473.         return true
  2474.       end
  2475.     end
  2476.     return false
  2477.   end
  2478.   #--------------------------------------------------------------------------
  2479.   # ● 合成スキル消去
  2480.   #--------------------------------------------------------------------------
  2481.   def synthe_delete(speller)
  2482.     for battler in speller
  2483.       spell_reset(battler)
  2484.       if dead_ok?(battler)
  2485.         @action_battlers.delete(battler)
  2486.       end
  2487.     end
  2488.     @synthe.delete(speller)
  2489.   end
  2490.   #--------------------------------------------------------------------------
  2491.   # ● 連携含むスキル詠唱解除
  2492.   #--------------------------------------------------------------------------
  2493.   def skill_reset(battler)
  2494.     speller = synthe?(battler)
  2495.     if speller != nil
  2496.       synthe_delete(speller)
  2497.     else
  2498.       spell_reset(battler)
  2499.     end
  2500.   end
  2501.   #--------------------------------------------------------------------------
  2502.   # ● スキル詠唱解除
  2503.   #--------------------------------------------------------------------------
  2504.   def spell_reset(battler)
  2505.     battler.rt = 0
  2506.     battler.rtp = 0
  2507.     battler.blink = false
  2508.     battler.spell = false
  2509.     battler.current_action.spell_id = 0
  2510.     @spell_p.delete(battler)
  2511.     @spell_e.delete(battler)
  2512.   end
  2513.   #--------------------------------------------------------------------------
  2514.   # ● 戦闘終了判定
  2515.   #--------------------------------------------------------------------------
  2516.   def fin?
  2517.    return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  2518.   end
  2519.   #--------------------------------------------------------------------------
  2520.   # ● 敵全滅判定
  2521.   #--------------------------------------------------------------------------
  2522.   def victory?
  2523.     for battler in $game_troop.enemies
  2524.       if not battler.hidden and (battler.rest_hp > 0 or
  2525.           battler.immortal or battler.damage_pop.size > 0)
  2526.         return false
  2527.       end
  2528.     end
  2529.     return true
  2530.   end
  2531.   #--------------------------------------------------------------------------
  2532.   # ● 死亡許可判定
  2533.   #--------------------------------------------------------------------------
  2534.   def dead_ok?(battler)
  2535.     speller = synthe?(battler)
  2536.     if speller == nil
  2537.       if @action_battlers.include?(battler)
  2538.         if battler.phase > 2
  2539.           return false
  2540.         end
  2541.       end
  2542.     else
  2543.       for battler in speller
  2544.         if @action_battlers.include?(battler)
  2545.           if battler.phase > 2
  2546.             return false
  2547.           end
  2548.         end
  2549.       end
  2550.     end
  2551.     return true
  2552.   end
  2553. end

  2554. #==============================================================================
  2555. # ■ Game_Actor
  2556. #------------------------------------------------------------------------------
  2557. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2558. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2559. #==============================================================================

  2560. class Game_Actor < Game_Battler
  2561.   #--------------------------------------------------------------------------
  2562.   # ● バトル画面 X 座標の取得
  2563.   #--------------------------------------------------------------------------
  2564.   def screen_x
  2565.     # パーティ内の並び順から X 座標を計算して返す
  2566.     if self.index != nil
  2567.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2568.     else
  2569.       return 0
  2570.     end
  2571.   end
  2572. end

  2573. #==============================================================================
  2574. # ■ Spriteset_Battle
  2575. #------------------------------------------------------------------------------
  2576. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2577. # スの内部で使用されます。
  2578. #==============================================================================

  2579. class Spriteset_Battle
  2580.   #--------------------------------------------------------------------------
  2581.   # ● 公開インスタンス変数
  2582.   #--------------------------------------------------------------------------
  2583.   attr_reader   :real_x                   # x座標補正(現在値)
  2584.   attr_reader   :real_y                   # y座標補正(現在値)
  2585.   attr_reader   :real_zoom                # 拡大率(現在値)
  2586.   #--------------------------------------------------------------------------
  2587.   # ● オブジェクト初期化
  2588.   #--------------------------------------------------------------------------
  2589.   def initialize
  2590.     # ビューポートを作成
  2591.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2592.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2593.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2594.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2595.     @viewport2.z = 101
  2596.     @viewport3.z = 200
  2597.     @viewport4.z = 5000
  2598.     @wait = 0
  2599.     @real_x = 0
  2600.     @real_y = 0
  2601.     @real_zoom = 1.0
  2602.     @target_x = 0
  2603.     @target_y = 0
  2604.     @target_zoom = 1.0
  2605.     @gap_x = 0
  2606.     @gap_y = 0
  2607.     @gap_zoom = 0.0
  2608.     # バトルバックスプライトを作成
  2609.     @battleback_sprite = Sprite.new(@viewport1)
  2610.     # エネミースプライトを作成
  2611.     @enemy_sprites = []
  2612.     for enemy in $game_troop.enemies.reverse
  2613.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2614.     end
  2615.     # アクタースプライトを作成
  2616.     @actor_sprites = []
  2617.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2618.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2619.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2620.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2621.     # 天候を作成
  2622.     @weather = RPG::Weather.new(@viewport1)
  2623.     # ピクチャスプライトを作成
  2624.     @picture_sprites = []
  2625.     for i in 51..100
  2626.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2627.         $game_screen.pictures[i]))
  2628.     end
  2629.     # タイマースプライトを作成
  2630.     @timer_sprite = Sprite_Timer.new
  2631.     # フレーム更新
  2632.     update
  2633.   end
  2634.   #--------------------------------------------------------------------------
  2635.   # ● フレーム更新
  2636.   #--------------------------------------------------------------------------
  2637.   def update
  2638.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2639.     @actor_sprites[0].battler = $game_party.actors[0]
  2640.     @actor_sprites[1].battler = $game_party.actors[1]
  2641.     @actor_sprites[2].battler = $game_party.actors[2]
  2642.     @actor_sprites[3].battler = $game_party.actors[3]
  2643.     # バトルバックのファイル名が現在のものと違う場合
  2644.     if @battleback_name != $game_temp.battleback_name
  2645.       make_battleback
  2646.     end
  2647.     # 画面のスクロール
  2648.     screen_scroll
  2649.     # モンスターの位置補正
  2650.     for enemy in $game_troop.enemies
  2651.       enemy.real_x = @real_x
  2652.       enemy.real_y = @real_y
  2653.       enemy.real_zoom = @real_zoom
  2654.     end
  2655.     # バトラースプライトを更新
  2656.     for sprite in @enemy_sprites + @actor_sprites
  2657.       sprite.update
  2658.     end
  2659.     # 天候グラフィックを更新
  2660.     @weather.type = $game_screen.weather_type
  2661.     @weather.max = $game_screen.weather_max
  2662.     @weather.update
  2663.     # ピクチャスプライトを更新
  2664.     for sprite in @picture_sprites
  2665.       sprite.update
  2666.     end
  2667.     # タイマースプライトを更新
  2668.     @timer_sprite.update
  2669.     # 画面の色調とシェイク位置を設定
  2670.     @viewport1.tone = $game_screen.tone
  2671.     @viewport1.ox = $game_screen.shake
  2672.     # 画面のフラッシュ色を設定
  2673.     @viewport4.color = $game_screen.flash_color
  2674.     # ビューポートを更新
  2675.     @viewport1.update
  2676.     @viewport2.update
  2677.     @viewport4.update
  2678.   end
  2679.   #--------------------------------------------------------------------------
  2680.   # ● バトル背景の設定
  2681.   #--------------------------------------------------------------------------
  2682.   def make_battleback
  2683.     @battleback_name = $game_temp.battleback_name
  2684.     if @battleback_sprite.bitmap != nil
  2685.       @battleback_sprite.bitmap.dispose
  2686.     end
  2687.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2688.     if @battleback_sprite.bitmap.width == 640 and
  2689.        @battleback_sprite.bitmap.height == 320
  2690.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2691.       @base_zoom = 2.0
  2692.       @battleback_sprite.zoom_x = @base_zoom
  2693.       @battleback_sprite.zoom_y = @base_zoom
  2694.       @real_y = 4
  2695.       @battleback_sprite.x = 320
  2696.       @battleback_sprite.y = @real_y
  2697.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2698.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2699.     elsif @battleback_sprite.bitmap.width == 640 and
  2700.           @battleback_sprite.bitmap.height == 480
  2701.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2702.       @base_zoom = 1.5
  2703.       @battleback_sprite.zoom_x = @base_zoom
  2704.       @battleback_sprite.zoom_y = @base_zoom
  2705.       @battleback_sprite.x = 320
  2706.       @battleback_sprite.y = 0
  2707.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2708.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2709.     else
  2710.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2711.                                       @battleback_sprite.bitmap.height)
  2712.       @base_zoom = 1.0
  2713.       @battleback_sprite.zoom_x = @base_zoom
  2714.       @battleback_sprite.zoom_y = @base_zoom
  2715.       @battleback_sprite.x = 320
  2716.       @battleback_sprite.y = 0
  2717.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2718.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2719.     end
  2720.   end
  2721.   #--------------------------------------------------------------------------
  2722.   # ● 画面のスクロール目標の位置・拡大率設定
  2723.   #--------------------------------------------------------------------------
  2724.   def screen_target(x, y, zoom)
  2725.     return unless $scene.drive
  2726.     @wait = $scene.scroll_time
  2727.     @target_x = x
  2728.     @target_y = y
  2729.     @target_zoom = zoom
  2730.     screen_over
  2731.     @gap_x = @target_x - @real_x
  2732.     @gap_y = @target_y - @real_y
  2733.     @gap_zoom = @target_zoom - @real_zoom
  2734.   end
  2735.   #--------------------------------------------------------------------------
  2736.   # ● 画面のスクロール
  2737.   #--------------------------------------------------------------------------
  2738.   def screen_scroll
  2739.     if @wait > 0
  2740.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2741.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2742.       @real_zoom = @target_zoom -
  2743.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2744.       @battleback_sprite.x = 320 + @real_x
  2745.       @battleback_sprite.y = @real_y
  2746.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2747.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2748.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2749.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2750.       @wait -= 1
  2751.     end
  2752.   end
  2753.   #--------------------------------------------------------------------------
  2754.   # ● スクリーンが画面外に出た時の補正処理
  2755.   #--------------------------------------------------------------------------
  2756.   def screen_over
  2757.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2758.     unless 324 + @target_x > width and 324 - @target_x > width
  2759.       if 324 + @target_x > width
  2760.         @target_x = width - 324
  2761.       elsif 324 - @target_x > width
  2762.         @target_x = 324 - width
  2763.       end
  2764.     end
  2765.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2766.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2767.       if @target_y > height - 4
  2768.         @target_y = height - 4
  2769.       elsif 484 - @target_y > 3 * height
  2770.         @target_y = 484 - 3 * height
  2771.       end
  2772.     end
  2773.   end
  2774. end

  2775. #==============================================================================
  2776. # ■ Game_Battler (分割定義 1)
  2777. #------------------------------------------------------------------------------
  2778. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2779. # スのスーパークラスとして使用されます。
  2780. #==============================================================================

  2781. class Game_Battler
  2782.   #--------------------------------------------------------------------------
  2783.   # ● 公開インスタンス変数追加
  2784.   #--------------------------------------------------------------------------
  2785.   attr_accessor :up_level                  # レベルアップ数
  2786.   attr_accessor :at                        # AT(タイムゲージ)
  2787.   attr_accessor :atp                       # AT(表示用)
  2788.   attr_accessor :rt                        # RP(詠唱ゲージ)
  2789.   attr_accessor :rtp                       # RP(詠唱必要量)
  2790.   attr_accessor :spell                     # 合成スキル発動中
  2791.   attr_accessor :recover_hp                # HP回復量
  2792.   attr_accessor :recover_sp                # SP回復量
  2793.   attr_accessor :state_p                   # ステータス異常配列
  2794.   attr_accessor :state_m                   # ステータス異常配列
  2795.   attr_accessor :damage_sp                 # SPダメージ表示フラグ
  2796.   attr_accessor :animation                 # アニメーション ID, Hitの配列
  2797.   attr_accessor :phase
  2798.   attr_accessor :wait
  2799.   attr_accessor :target
  2800.   attr_accessor :anime1
  2801.   attr_accessor :anime2
  2802.   attr_accessor :event
  2803.   #--------------------------------------------------------------------------
  2804.   # ● オブジェクト初期化
  2805.   #--------------------------------------------------------------------------
  2806.   alias :initialize_rtab :initialize
  2807.   def initialize
  2808.     initialize_rtab
  2809.     @damage_pop = {}
  2810.     @damage = {}
  2811.     @damage_sp = {}
  2812.     @critical = {}
  2813.     @recover_hp = {}
  2814.     @recover_sp = {}
  2815.     @state_p = {}
  2816.     @state_m = {}
  2817.     @animation = []
  2818.     @phase = 1
  2819.     @wait = 0
  2820.     @target = []
  2821.     @anime1 = 0
  2822.     @anime2 = 0
  2823.     @event = 0
  2824.   end
  2825.   #--------------------------------------------------------------------------
  2826.   # ● 存在判定
  2827.   #--------------------------------------------------------------------------
  2828.   def exist?
  2829.     return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
  2830.   end
  2831.   #--------------------------------------------------------------------------
  2832.   # ● 残HP予測
  2833.   #--------------------------------------------------------------------------
  2834.   def rest_hp
  2835.     # rest_hp に現HPを代入
  2836.     rest_hp = @hp
  2837.     # バトラーが受ける全ダメージをrest_hpに反映させる
  2838.     for pre_damage in @damage
  2839.       if pre_damage[1].is_a?(Numeric)
  2840.         rest_hp -= pre_damage[1]
  2841.       end
  2842.     end
  2843.     return rest_hp
  2844.   end
  2845.   #--------------------------------------------------------------------------
  2846.   # ● ステートの解除
  2847.   #     state_id : ステート ID
  2848.   #     force    : 強制解除フラグ (オートステートの処理で使用)
  2849.   #--------------------------------------------------------------------------
  2850.   def remove_state(state_id, force = false)
  2851.     # このステートが付加されている場合
  2852.     if state?(state_id)
  2853.       # 強制付加されたステートで、かつ解除が強制ではない場合
  2854.       if @states_turn[state_id] == -1 and not force
  2855.         # メソッド終了
  2856.         return
  2857.       end
  2858.       # 現在の HP が 0 かつ オプション [HP 0 の状態とみなす] が有効の場合
  2859.       if @hp == 0 and $data_states[state_id].zero_hp
  2860.         # ほかに [HP 0 の状態とみなす] ステートがあるかどうか判定
  2861.         zero_hp = false
  2862.         for i in @states
  2863.           if i != state_id and $data_states[i].zero_hp
  2864.             zero_hp = true
  2865.           end
  2866.         end
  2867.         # 戦闘不能を解除してよければ、HP を 1 に変更
  2868.         if zero_hp == false
  2869.           @hp = 1
  2870.         end
  2871.       end
  2872.       unless self.movable?
  2873.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2874.         @states.delete(state_id)
  2875.         @states_turn.delete(state_id)
  2876.         if self.movable?
  2877.           self.at = 0
  2878.         end
  2879.       else
  2880.         # ステート ID を @states 配列および @states_turn ハッシュから削除
  2881.         @states.delete(state_id)
  2882.         @states_turn.delete(state_id)
  2883.       end
  2884.     end
  2885.     # HP および SP の最大値チェック
  2886.     @hp = [@hp, self.maxhp].min
  2887.     @sp = [@sp, self.maxsp].min
  2888.   end
  2889.   #--------------------------------------------------------------------------
  2890.   # ● 通常攻撃の効果適用
  2891.   #     attacker : 攻撃者 (バトラー)
  2892.   #--------------------------------------------------------------------------
  2893.   def attack_effect(attacker)
  2894.     # クリティカルフラグをクリア
  2895.     self.critical[attacker] = false
  2896.     state_p[attacker] = []
  2897.     state_m[attacker] = []
  2898.     # 第一命中判定
  2899.     hit_result = (rand(100) < attacker.hit)
  2900.     # 命中の場合
  2901.     if hit_result == true
  2902.       # 基本ダメージを計算
  2903.       atk = [attacker.atk - self.pdef / 2, 0].max
  2904.       self.damage[attacker] = atk * (20 + attacker.str) / 20
  2905.       # 属性修正
  2906.       self.damage[attacker] *= elements_correct(attacker.element_set)
  2907.       self.damage[attacker] /= 100
  2908.       # ダメージの符号が正の場合
  2909.       if self.damage[attacker] > 0
  2910.         # クリティカル修正
  2911.         if rand(100) < 4 * attacker.dex / self.agi
  2912.           self.damage[attacker] *= 2
  2913.           self.critical[attacker] = true
  2914.         end
  2915.         # 防御修正
  2916.         if self.guarding?
  2917.           self.damage[attacker] /= 2
  2918.         end
  2919.       end
  2920.       # 分散
  2921.       if self.damage[attacker].abs > 0
  2922.         amp = [self.damage[attacker].abs * 15 / 100, 1].max
  2923.         self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
  2924.       end
  2925.       # 第二命中判定
  2926.       eva = 8 * self.agi / attacker.dex + self.eva
  2927.       hit = self.damage[attacker] < 0 ? 100 : 100 - eva
  2928.       hit = self.cant_evade? ? 100 : hit
  2929.       hit_result = (rand(100) < hit)
  2930.     end
  2931.     # 命中の場合
  2932.     if hit_result == true
  2933.       # ステート衝撃解除
  2934.       remove_states_shock
  2935.       # HP からダメージを減算
  2936.       # ステート変化
  2937.       @state_changed = false
  2938.       states_plus(attacker, attacker.plus_state_set)
  2939.       states_minus(attacker, attacker.minus_state_set)
  2940.     # ミスの場合
  2941.     else
  2942.       # ダメージに "Miss" を設定
  2943.       self.damage[attacker] = "Miss"
  2944.       # クリティカルフラグをクリア
  2945.       self.critical[attacker] = false
  2946.     end
  2947.     # メソッド終了
  2948.     return true
  2949.   end
  2950.   #--------------------------------------------------------------------------
  2951.   # ● スキルの効果適用
  2952.   #     user  : スキルの使用者 (バトラー)
  2953.   #     skill : スキル
  2954.   #--------------------------------------------------------------------------
  2955.   def skill_effect(user, skill)
  2956.     # クリティカルフラグをクリア
  2957.     self.critical[user] = false
  2958.     state_p[user] = []
  2959.     state_m[user] = []
  2960.     # スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  2961.     # またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  2962.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0)# or
  2963.   #     ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  2964.       # メソッド終了
  2965.       return false
  2966.     end
  2967.     # 有効フラグをクリア
  2968.     effective = false
  2969.     # コモンイベント ID が有効の場合は有効フラグをセット
  2970.     effective |= skill.common_event_id > 0
  2971.     # 第一命中判定
  2972.     hit = skill.hit
  2973.     if skill.atk_f > 0
  2974.       hit *= user.hit / 100
  2975.     end
  2976.     hit_result = (rand(100) < hit)
  2977.     # 不確実なスキルの場合は有効フラグをセット
  2978.     effective |= hit < 100
  2979.     # 命中の場合
  2980.     if hit_result == true
  2981.       # 威力を計算
  2982.       power = skill.power + user.atk * skill.atk_f / 100
  2983.       if power > 0
  2984.         power -= self.pdef * skill.pdef_f / 200
  2985.         power -= self.mdef * skill.mdef_f / 200
  2986.         power = [power, 0].max
  2987.       end
  2988.       # 倍率を計算
  2989.       rate = 20
  2990.       rate += (user.str * skill.str_f / 100)
  2991.       rate += (user.dex * skill.dex_f / 100)
  2992.       rate += (user.agi * skill.agi_f / 100)
  2993.       rate += (user.int * skill.int_f / 100)
  2994.       # 基本ダメージを計算
  2995.       self.damage[user] = power * rate / 20
  2996.       # 属性修正
  2997.       self.damage[user] *= elements_correct(skill.element_set)
  2998.       self.damage[user] /= 100
  2999.       # ダメージの符号が正の場合
  3000.       if self.damage[user] > 0
  3001.         # 防御修正
  3002.         if self.guarding?
  3003.           self.damage[user] /= 2
  3004.         end
  3005.       end
  3006.       # 分散
  3007.       if skill.variance > 0 and self.damage[user].abs > 0
  3008.         amp = [self.damage[user].abs * skill.variance / 100, 1].max
  3009.         self.damage[user] += rand(amp+1) + rand(amp+1) - amp
  3010.       end
  3011.       # 第二命中判定
  3012.       eva = 8 * self.agi / user.dex + self.eva
  3013.       hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
  3014.       hit = self.cant_evade? ? 100 : hit
  3015.       hit_result = (rand(100) < hit)
  3016.       # 不確実なスキルの場合は有効フラグをセット
  3017.       effective |= hit < 100
  3018.     end
  3019.     # 命中の場合
  3020.     if hit_result == true
  3021.       # 威力 0 以外の物理攻撃の場合
  3022.       if skill.power != 0 and skill.atk_f > 0
  3023.         # ステート衝撃解除
  3024.         remove_states_shock
  3025.         # 有効フラグをセット
  3026.         effective = true
  3027.       end
  3028.       # HP の変動判定
  3029.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  3030.       # 効果判定
  3031.       effective |= self.hp != last_hp
  3032.       # ステート変化
  3033.       @state_changed = false
  3034.       effective |= states_plus(user, skill.plus_state_set)
  3035.       effective |= states_minus(user, skill.minus_state_set)
  3036.       unless $game_temp.in_battle
  3037.         self.damage_effect(user, 1)
  3038.       end
  3039.       # 威力が 0 の場合
  3040.       if skill.power == 0
  3041.         # ダメージに空文字列を設定
  3042.         self.damage[user] = ""
  3043.         # ステートに変化がない場合
  3044.         unless @state_changed
  3045.           # ダメージに "Miss" を設定
  3046.           self.damage[user] = "Miss"
  3047.         end
  3048.       end
  3049.     # ミスの場合
  3050.     else
  3051.       # ダメージに "Miss" を設定
  3052.       self.damage[user] = "Miss"
  3053.     end
  3054.     # 戦闘中でない場合
  3055.     unless $game_temp.in_battle
  3056.       # ダメージに nil を設定
  3057.       self.damage[user] = nil
  3058.     end
  3059.     # メソッド終了
  3060.     return effective
  3061.   end
  3062.   #--------------------------------------------------------------------------
  3063.   # ● アイテムの効果適用
  3064.   #     item : アイテム
  3065.   #--------------------------------------------------------------------------
  3066.   def item_effect(item, user = $game_party.actors[0])
  3067.     # クリティカルフラグをクリア
  3068.     self.critical[user] = false
  3069.     state_p[user] = []
  3070.     state_m[user] = []
  3071.     self.recover_hp[user] = 0
  3072.     self.recover_sp[user] = 0
  3073.     # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
  3074.     # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
  3075.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0)# or
  3076.     #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  3077.       # メソッド終了
  3078.       return false
  3079.     end
  3080.     # 有効フラグをクリア
  3081.     effective = false
  3082.     # コモンイベント ID が有効の場合は有効フラグをセット
  3083.     effective |= item.common_event_id > 0
  3084.     # 命中判定
  3085.     hit_result = (rand(100) < item.hit)
  3086.     # 不確実なスキルの場合は有効フラグをセット
  3087.     effective |= item.hit < 100
  3088.     # 命中の場合
  3089.     if hit_result == true
  3090.       # 回復量を計算
  3091.       self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
  3092.                               item.recover_hp
  3093.       self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
  3094.                               item.recover_sp
  3095.       if self.recover_hp[user] < 0
  3096.         self.recover_hp[user] += self.pdef * item.pdef_f / 20
  3097.         self.recover_hp[user] += self.mdef * item.mdef_f / 20
  3098.         self.recover_hp[user] = [self.recover_hp[user], 0].min
  3099.       end
  3100.       # 属性修正
  3101.       self.recover_hp[user] *= elements_correct(item.element_set)
  3102.       self.recover_hp[user] /= 100
  3103.       self.recover_sp[user] *= elements_correct(item.element_set)
  3104.       self.recover_sp[user] /= 100
  3105.       # 分散
  3106.       if item.variance > 0 and self.recover_hp[user].abs > 0
  3107.         amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
  3108.         self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
  3109.       end
  3110.       if item.variance > 0 and self.recover_sp[user].abs > 0
  3111.         amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
  3112.         self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
  3113.       end
  3114.       # 回復量の符号が負の場合
  3115.       if self.recover_hp[user] < 0
  3116.         # 防御修正
  3117.         if self.guarding?
  3118.           self.recover_hp[user] /= 2
  3119.         end
  3120.       end
  3121.       # HP 回復量の符号を反転し、ダメージの値に設定
  3122.       self.damage[user] = -self.recover_hp[user]
  3123.       # HP および SP の変動判定
  3124.       last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
  3125.       last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
  3126.       effective |= self.hp != last_hp
  3127.       effective |= self.sp != last_sp
  3128.       # ステート変化
  3129.       @state_changed = false
  3130.       effective |= states_plus(user, item.plus_state_set)
  3131.       effective |= states_minus(user, item.minus_state_set)
  3132.       unless $game_temp.in_battle
  3133.         self.damage_effect(user, 2)
  3134.       end
  3135.       # パラメータ上昇値が有効の場合
  3136.       if item.parameter_type > 0 and item.parameter_points != 0
  3137.         # パラメータで分岐
  3138.         case item.parameter_type
  3139.         when 1  # MaxHP
  3140.           @maxhp_plus += item.parameter_points
  3141.         when 2  # MaxSP
  3142.           @maxsp_plus += item.parameter_points
  3143.         when 3  # 腕力
  3144.           @str_plus += item.parameter_points
  3145.         when 4  # 器用さ
  3146.           @dex_plus += item.parameter_points
  3147.         when 5  # 素早さ
  3148.           @agi_plus += item.parameter_points
  3149.         when 6  # 魔力
  3150.           @int_plus += item.parameter_points
  3151.         end
  3152.         # 有効フラグをセット
  3153.         effective = true
  3154.       end
  3155.       # HP 回復率と回復量が 0 の場合
  3156.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  3157.         # ダメージに空文字列を設定
  3158.         self.damage[user] = ""
  3159.         # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
  3160.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  3161.            (item.parameter_type == 0 or item.parameter_points == 0)
  3162.           # ステートに変化がない場合
  3163.           unless @state_changed
  3164.             # ダメージに "Miss" を設定
  3165.             self.damage[user] = "Miss"
  3166.           end
  3167.         end
  3168.       end
  3169.     # ミスの場合
  3170.     else
  3171.       # ダメージに "Miss" を設定
  3172.       self.damage[user] = "Miss"
  3173.     end
  3174.     # 戦闘中でない場合
  3175.     unless $game_temp.in_battle
  3176.       # ダメージに nil を設定
  3177.       self.damage[user] = nil
  3178.     end
  3179.     # メソッド終了
  3180.     return effective
  3181.   end
  3182.   #--------------------------------------------------------------------------
  3183.   # ● ステート変化 (+) の適用
  3184.   #     plus_state_set  : ステート変化 (+)
  3185.   #--------------------------------------------------------------------------
  3186.   def states_plus(battler, plus_state_set)
  3187.     # 有効フラグをクリア
  3188.     effective = false
  3189.     # ループ (付加するステート)
  3190.     for i in plus_state_set
  3191.       # このステートが防御されていない場合
  3192.       unless self.state_guard?(i)
  3193.         # このステートがフルでなければ有効フラグをセット
  3194.         effective |= self.state_full?(i) == false
  3195.         # ステートが [抵抗しない] の場合
  3196.         if $data_states[i].nonresistance
  3197.           # ステート変化フラグをセット
  3198.           @state_changed = true
  3199.           # ステートを付加
  3200.           self.state_p[battler].push(i)
  3201.         # このステートがフルではない場合
  3202.         elsif self.state_full?(i) == false
  3203.           # ステート有効度を確率に変換し、乱数と比較
  3204.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  3205.             # ステート変化フラグをセット
  3206.             @state_changed = true
  3207.             # ステートを付加
  3208.             self.state_p[battler].push(i)
  3209.           end
  3210.         end
  3211.       end
  3212.     end
  3213.     # メソッド終了
  3214.     return effective
  3215.   end
  3216.   #--------------------------------------------------------------------------
  3217.   # ● ステート変化 (-) の適用
  3218.   #     minus_state_set : ステート変化 (-)
  3219.   #--------------------------------------------------------------------------
  3220.   def states_minus(battler, minus_state_set)
  3221.     # 有効フラグをクリア
  3222.     effective = false
  3223.     # ループ (解除するステート)
  3224.     for i in minus_state_set
  3225.       # このステートが付加されていれば有効フラグをセット
  3226.       effective |= self.state?(i)
  3227.       # ステート変化フラグをセット
  3228.       @state_changed = true
  3229.       # ステートを解除
  3230.       self.state_m[battler].push(i)
  3231.     end
  3232.     # メソッド終了
  3233.     return effective
  3234.   end
  3235.   #--------------------------------------------------------------------------
  3236.   # ● ダメージ演算
  3237.   #--------------------------------------------------------------------------
  3238.   def damage_effect(battler, item)
  3239.     if item == 2
  3240.       self.hp += self.recover_hp[battler]
  3241.       self.sp += self.recover_sp[battler]
  3242.       if self.recover_sp[battler] != 0
  3243.         self.damage_sp[battler] = -self.recover_sp[battler]
  3244.       end
  3245.       self.recover_hp.delete(battler)
  3246.       self.recover_sp.delete(battler)
  3247.     else
  3248.       if self.damage[battler].class != String
  3249.         self.hp -= self.damage[battler]
  3250.              # if self.is_a?(Game_Actor) # ★ 挨打的时候蓄HP储存条
  3251.         #self.hp_store += [self.damage[battler]*100/self.maxhp, 0].max
  3252.         #self.hp_store = [self.hp_store,300].min
  3253.         #if self.hp_store > 200
  3254.         #   self.hp_store = 200
  3255.         #end
  3256.       #end   
  3257.       end
  3258.     end
  3259.     for i in self.state_p[battler]
  3260.       add_state(i)
  3261.     end
  3262.     for i in self.state_m[battler]
  3263.       remove_state(i)
  3264.     end
  3265.   end
  3266.   #--------------------------------------------------------------------------
  3267.   # ● スリップダメージの効果適用
  3268.   #--------------------------------------------------------------------------
  3269.   def slip_damage_effect
  3270.     # ダメージを設定
  3271.     self.damage["slip"] = self.maxhp / 10
  3272.     # 分散
  3273.     if self.damage["slip"].abs > 0
  3274.       amp = [self.damage["slip"].abs * 15 / 100, 1].max
  3275.       self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
  3276.     end
  3277.     # HP からダメージを減算
  3278.     self.hp -= self.damage["slip"]
  3279.           #if self.is_a?(Game_Actor) # ★ 挨打的时候蓄HP储存条
  3280.         #self.hp_store += [self.damage*100/self.maxhp , 0].max
  3281.         #self.hp_store = [self.hp_store,300].min
  3282.          #       if self.hp_store > 200
  3283.          #  self.hp_store = 200
  3284.         #end
  3285.       #end  
  3286.     # メソッド終了
  3287.     return true
  3288.   end
  3289. end

  3290. #==============================================================================
  3291. # ■ Game_BattleAction
  3292. #------------------------------------------------------------------------------
  3293. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3294. # スの内部で使用されます。
  3295. #==============================================================================

  3296. class Game_BattleAction
  3297.   #--------------------------------------------------------------------------
  3298.   # ● 公開インスタンス変数
  3299.   #--------------------------------------------------------------------------
  3300.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3301.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3302.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3303.   attr_accessor :force_skill_id           # スキル ID
  3304.   #--------------------------------------------------------------------------
  3305.   # ● 有効判定
  3306.   #--------------------------------------------------------------------------
  3307.   def valid?
  3308.     return (not (@force_kind == 0 and @force_basic == 3))
  3309.   end
  3310. end

  3311. #==============================================================================
  3312. # ■ Game_Actor
  3313. #------------------------------------------------------------------------------
  3314. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3315. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3316. #==============================================================================

  3317. class Game_Actor < Game_Battler
  3318.   def skill_can_use?(skill_id)
  3319.    
  3320.       if $data_skills[skill_id].element_set.include?(20) #如果是HP蓄气技能
  3321.      return false if @hp_store < $data_skills[skill_id].sp_cost
  3322.    end
  3323.          if $data_skills[skill_id].element_set.include?(22) #如果是HP蓄气技能
  3324.      return false if @hp_store < 100
  3325.    end
  3326.    
  3327.     return super
  3328.   end
  3329. end

  3330. #==============================================================================
  3331. # ■ Game_Enemy
  3332. #------------------------------------------------------------------------------
  3333. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3334. # 内部で使用されます。
  3335. #==============================================================================

  3336. class Game_Enemy < Game_Battler
  3337.   #--------------------------------------------------------------------------
  3338.   # ● 公開インスタンス変数
  3339.   #--------------------------------------------------------------------------
  3340.   attr_accessor :height                  # 画像の高さ
  3341.   attr_accessor :real_x                  # X座標補正
  3342.   attr_accessor :real_y                  # Y座標補正
  3343.   attr_accessor :real_zoom               # 拡大率
  3344.   #--------------------------------------------------------------------------
  3345.   # ● オブジェクト初期化
  3346.   #     troop_id     : トループ ID
  3347.   #     member_index : トループメンバーのインデックス
  3348.   #--------------------------------------------------------------------------
  3349.   def initialize(troop_id, member_index)
  3350.     super()
  3351.     @troop_id = troop_id
  3352.     @member_index = member_index
  3353.     troop = $data_troops[@troop_id]
  3354.     @enemy_id = troop.members[@member_index].enemy_id
  3355.     enemy = $data_enemies[@enemy_id]
  3356.     @battler_name = enemy.battler_name
  3357.     @battler_hue = enemy.battler_hue
  3358.     @hp = maxhp
  3359.     @sp = maxsp
  3360.     @real_x = 0
  3361.     @real_y = 0
  3362.     @real_zoom = 1.0
  3363.     @fly = 0
  3364.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3365.     @hidden = troop.members[@member_index].hidden
  3366.     @immortal = troop.members[@member_index].immortal
  3367.   end
  3368.   alias :true_x :screen_x
  3369.   alias :true_y :screen_y
  3370.   #--------------------------------------------------------------------------
  3371.   # ● バトル画面 X 座標の取得
  3372.   #--------------------------------------------------------------------------
  3373.   def screen_x
  3374.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3375.   end
  3376.   #--------------------------------------------------------------------------
  3377.   # ● バトル画面 Y 座標の取得
  3378.   #--------------------------------------------------------------------------
  3379.   def screen_y
  3380.     return true_y * @real_zoom + @real_y
  3381.   end
  3382.   #--------------------------------------------------------------------------
  3383.   # ● バトル画面 Z 座標の取得
  3384.   #--------------------------------------------------------------------------
  3385.   def screen_z
  3386.     return true_y + @fly
  3387.   end
  3388.   #--------------------------------------------------------------------------
  3389.   # ● バトル画面 拡大率の取得
  3390.   #--------------------------------------------------------------------------
  3391.   def zoom
  3392.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3393.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3394.   end
  3395.   #--------------------------------------------------------------------------
  3396.   # ● 攻撃用、バトル画面 X 座標の取得
  3397.   #--------------------------------------------------------------------------
  3398.   def attack_x(z)
  3399.     return (320 - true_x) * z * 0.75
  3400.   end
  3401.   #--------------------------------------------------------------------------
  3402.   # ● 攻撃用、バトル画面 Y 座標の取得
  3403.   #--------------------------------------------------------------------------
  3404.   def attack_y(z)
  3405.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3406.   end
  3407.   #--------------------------------------------------------------------------
  3408.   # ● アクション作成
  3409.   #--------------------------------------------------------------------------
  3410.   def make_action
  3411.     # カレントアクションをクリア
  3412.     self.current_action.clear
  3413.     # 動けない場合
  3414.     unless self.inputable?
  3415.       # メソッド終了
  3416.       return
  3417.     end
  3418.     # 現在有効なアクションを抽出
  3419.     available_actions = []
  3420.     rating_max = 0
  3421.     for action in self.actions
  3422.       # ターン 条件確認
  3423.       n = $game_temp.battle_turn
  3424.       a = action.condition_turn_a
  3425.       b = action.condition_turn_b
  3426.       if (b == 0 and n != a) or
  3427.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3428.         next
  3429.       end
  3430.       # HP 条件確認
  3431.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3432.         next
  3433.       end
  3434.       # レベル 条件確認
  3435.       if $game_party.max_level < action.condition_level
  3436.         next
  3437.       end
  3438.       # スイッチ 条件確認
  3439.       switch_id = action.condition_switch_id
  3440.       if switch_id > 0 and $game_switches[switch_id] == false
  3441.         next
  3442.       end
  3443.       # スキル使用可能 条件確認
  3444.       if action.kind == 1
  3445.         unless self.skill_can_use?(action.skill_id)
  3446.           next
  3447.         end
  3448.       end
  3449.       # 条件に該当 : このアクションを追加
  3450.       available_actions.push(action)
  3451.       if action.rating > rating_max
  3452.         rating_max = action.rating
  3453.       end
  3454.     end
  3455.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3456.     ratings_total = 0
  3457.     for action in available_actions
  3458.       if action.rating > rating_max - 3
  3459.         ratings_total += action.rating - (rating_max - 3)
  3460.       end
  3461.     end
  3462.     # レーティングの合計が 0 ではない場合
  3463.     if ratings_total > 0
  3464.       # 乱数を作成
  3465.       value = rand(ratings_total)
  3466.       # 作成した乱数に対応するものをカレントアクションに設定
  3467.       for action in available_actions
  3468.         if action.rating > rating_max - 3
  3469.           if value < action.rating - (rating_max - 3)
  3470.             self.current_action.kind = action.kind
  3471.             self.current_action.basic = action.basic
  3472.             self.current_action.skill_id = action.skill_id
  3473.             self.current_action.decide_random_target_for_enemy
  3474.             return
  3475.           else
  3476.             value -= action.rating - (rating_max - 3)
  3477.           end
  3478.         end
  3479.       end
  3480.     end
  3481.   end
  3482. end

  3483. #==============================================================================
  3484. # ■ Game_Party
  3485. #------------------------------------------------------------------------------
  3486. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3487. # ラスのインスタンスは $game_party で参照されます。
  3488. #==============================================================================

  3489. class Game_Party
  3490.   #--------------------------------------------------------------------------
  3491.   # ● 全滅判定
  3492.   #--------------------------------------------------------------------------
  3493.   def all_dead?
  3494.     # パーティ人数が 0 人の場合
  3495.     if $game_party.actors.size == 0
  3496.       return false
  3497.     end
  3498.     # HP 0 以上のアクターがパーティにいる場合
  3499.     for actor in @actors
  3500.       if actor.rest_hp > 0
  3501.         return false
  3502.       end
  3503.     end
  3504.     # 全滅
  3505.     return true
  3506.   end
  3507.   #--------------------------------------------------------------------------
  3508.   # ● 対象アクターのランダムな決定
  3509.   #     hp0 : HP 0 のアクターに限る
  3510.   #--------------------------------------------------------------------------
  3511.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3512.   alias :random_target_actor_rtab :random_target_actor
  3513.   def random_target_actor(hp0 = false)
  3514.     # ルーレットを初期化
  3515.     roulette = []
  3516.     # ループ
  3517.     for actor in @actors
  3518.       # 条件に該当する場合
  3519.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3520.           (hp0 and actor.hp0?)
  3521.         # アクターのクラスの [位置] を取得
  3522.         position = $data_classes[actor.class_id].position
  3523.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3524.         n = 4 - position
  3525.         # ルーレットにアクターを n 回追加
  3526.         n.times do
  3527.           roulette.push(actor)
  3528.         end
  3529.       end
  3530.     end
  3531.     # ルーレットのサイズが 0 の場合
  3532.     if roulette.size == 0
  3533.       return random_target_actor_rtab(hp0)
  3534.     end
  3535.     # ルーレットを回し、アクターを決定
  3536.     return roulette[rand(roulette.size)]
  3537.   end
  3538.   #--------------------------------------------------------------------------
  3539.   # ● 対象アクターのスムーズな決定
  3540.   #     actor_index : アクターインデックス
  3541.   #--------------------------------------------------------------------------
  3542.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3543.   alias :smooth_target_actor_rtab :smooth_target_actor
  3544.   def smooth_target_actor(actor_index)
  3545.     # アクターを取得
  3546.     actor = @actors[actor_index]
  3547.     # アクターが存在する場合
  3548.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3549.       return actor
  3550.     end
  3551.     # ループ
  3552.     for actor in @actors
  3553.       # アクターが存在する場合
  3554.       if actor.exist? and actor.rest_hp > 0
  3555.         return actor
  3556.       end
  3557.     end
  3558.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3559.     return smooth_target_actor_rtab(actor_index)
  3560.   end
  3561. end

  3562. #==============================================================================
  3563. # ■ Game_Troop
  3564. #------------------------------------------------------------------------------
  3565. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3566. # れます。
  3567. #==============================================================================

  3568. class Game_Troop
  3569.   #--------------------------------------------------------------------------
  3570.   # ● 対象エネミーのランダムな決定
  3571.   #     hp0 : HP 0 のエネミーに限る
  3572.   #--------------------------------------------------------------------------
  3573.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3574.   alias :random_target_enemy_rtab :random_target_enemy
  3575.   def random_target_enemy(hp0 = false)
  3576.     # ルーレットを初期化
  3577.     roulette = []
  3578.     # ループ
  3579.     for enemy in @enemies
  3580.       # 条件に該当する場合
  3581.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3582.           (hp0 and enemy.hp0?)
  3583.         # ルーレットにエネミーを追加
  3584.         roulette.push(enemy)
  3585.       end
  3586.     end
  3587.     # ルーレットのサイズが 0 の場合
  3588.     if roulette.size == 0
  3589.       return random_target_enemy_rtab(hp0)
  3590.     end
  3591.     # ルーレットを回し、エネミーを決定
  3592.     return roulette[rand(roulette.size)]
  3593.   end
  3594.   #--------------------------------------------------------------------------
  3595.   # ● 対象エネミーのスムーズな決定
  3596.   #     enemy_index : エネミーインデックス
  3597.   #--------------------------------------------------------------------------
  3598.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3599.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3600.   def smooth_target_enemy(enemy_index)
  3601.     # エネミーを取得
  3602.     enemy = @enemies[enemy_index]
  3603.     # エネミーが存在する場合
  3604.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3605.       return enemy
  3606.     end
  3607.     # ループ
  3608.     for enemy in @enemies
  3609.       # エネミーが存在する場合
  3610.       if enemy.exist? and enemy.rest_hp > 0
  3611.         return enemy
  3612.       end
  3613.     end
  3614.     # 敵が全滅している場合、再度敵の検索を行う
  3615.     return smooth_target_enemy_rtab(enemy_index)
  3616.   end
  3617. end

  3618. #==============================================================================
  3619. # ■ Sprite_Battler
  3620. #------------------------------------------------------------------------------
  3621. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3622. # スプライトの状態を自動的に変化させます。
  3623. #==============================================================================

  3624. class Sprite_Battler < RPG::Sprite
  3625.   #--------------------------------------------------------------------------
  3626.   # ● フレーム更新
  3627.   #--------------------------------------------------------------------------
  3628.   def update
  3629.     super
  3630.     # バトラーが nil の場合
  3631.     if @battler == nil
  3632.       self.bitmap = nil
  3633.       loop_animation(nil)
  3634.       return
  3635.     end
  3636.     # ファイル名か色相が現在のものと異なる場合
  3637.     if @battler.battler_name != @battler_name or
  3638.        @battler.battler_hue != @battler_hue
  3639.       # ビットマップを取得、設定
  3640.       @battler_name = @battler.battler_name
  3641.       @battler_hue = @battler.battler_hue
  3642.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3643.       @width = bitmap.width
  3644.       @height = bitmap.height
  3645.       self.ox = @width / 2
  3646.       self.oy = @height
  3647.       if @battler.is_a?(Game_Enemy)
  3648.         @battler.height = @height
  3649.       end
  3650.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3651.       if @battler.dead? or @battler.hidden
  3652.         self.opacity = 0
  3653.       end
  3654.     end
  3655.     # アニメーション ID が現在のものと異なる場合
  3656.     if @battler.state_animation_id != @state_animation_id
  3657.       @state_animation_id = @battler.state_animation_id
  3658.       loop_animation($data_animations[@state_animation_id])
  3659.     end
  3660.     # 表示されるべきアクターの場合
  3661.     if @battler.is_a?(Game_Actor) and @battler_visible
  3662.       # メインフェーズでないときは不透明度をやや下げる
  3663.       if $game_temp.battle_main_phase
  3664.         self.opacity += 3 if self.opacity < 255
  3665.       else
  3666.         self.opacity -= 3 if self.opacity > 207
  3667.       end
  3668.     end
  3669.     # 明滅
  3670.     if @battler.blink
  3671.       blink_on
  3672.     else
  3673.       blink_off
  3674.     end
  3675.     # 不可視の場合
  3676.     unless @battler_visible
  3677.       # 出現
  3678.       if not @battler.hidden and not @battler.dead? and
  3679.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3680.         appear
  3681.         @battler_visible = true
  3682.       end
  3683.     end
  3684.     # ダメージ
  3685.     for battler in @battler.damage_pop
  3686.       if battler[0].class == Array
  3687.         if battler[0][1] >= 0
  3688.           $scene.skill_se
  3689.         else
  3690.           $scene.levelup_se
  3691.         end
  3692.         damage(@battler.damage[battler[0]], false, 2)
  3693.       else
  3694.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3695.       end
  3696.       if @battler.damage_sp.include?(battler[0])
  3697.         damage(@battler.damage_sp[battler[0]],
  3698.                 @battler.critical[battler[0]], 1)
  3699.         @battler.damage_sp.delete(battler[0])
  3700.       end
  3701.       @battler.damage_pop.delete(battler[0])
  3702.       @battler.damage.delete(battler[0])
  3703.       @battler.critical.delete(battler[0])
  3704.     end
  3705.     # 可視の場合
  3706.     if @battler_visible
  3707.       # 逃走
  3708.       if @battler.hidden
  3709.         $game_system.se_play($data_system.escape_se)
  3710.         escape
  3711.         @battler_visible = false
  3712.       end
  3713.       # 白フラッシュ
  3714.       if @battler.white_flash
  3715.         whiten
  3716.         @battler.white_flash = false
  3717.       end
  3718.       # アニメーション
  3719.       unless @battler.animation.empty?
  3720.         for animation in @battler.animation.reverse
  3721.           animation($data_animations[animation[0]], animation[1])
  3722.           @battler.animation.delete(animation)
  3723.         end
  3724.       end
  3725.       # コラプス
  3726.       if @battler.damage.empty? and @battler.dead?
  3727.         if $scene.dead_ok?(@battler)
  3728.           if @battler.is_a?(Game_Enemy)
  3729.             $game_system.se_play($data_system.enemy_collapse_se)
  3730.           else
  3731.             $game_system.se_play($data_system.actor_collapse_se)
  3732.           end
  3733.           collapse
  3734.           @battler_visible = false
  3735.         end
  3736.       end
  3737.     end
  3738.     # スプライトの座標を設定
  3739.     self.x = @battler.screen_x
  3740.     self.y = @battler.screen_y
  3741.     self.z = @battler.screen_z
  3742.     if @battler.is_a?(Game_Enemy)
  3743.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3744.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3745.     end
  3746.   end
  3747. end

  3748. #==============================================================================
  3749. # ■ Window_Base
  3750. #------------------------------------------------------------------------------
  3751. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3752. #==============================================================================

  3753. class Window_Base < Window
  3754.   #--------------------------------------------------------------------------
  3755.   # ● ゲージの描画
  3756.   #--------------------------------------------------------------------------
  3757.   def gauge_rect_at(width, height, align3,
  3758.                     color1, color2, color3, color4, color5, color6, color7,
  3759.                     color8, color9, color10, color11, color12, grade1, grade2)
  3760.     # 枠描画
  3761.     @at_gauge = Bitmap.new(width, height * 5)
  3762.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3763.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3764.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3765.       color = color3
  3766.       color3 = color4
  3767.       color4 = color
  3768.     end
  3769.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3770.       color = color5
  3771.       color5 = color6
  3772.       color6 = color
  3773.       color = color7
  3774.       color7 = color8
  3775.       color8 = color
  3776.       color = color9
  3777.       color9 = color10
  3778.       color10 = color
  3779.       color = color11
  3780.       color11 = color12
  3781.       color12 = color
  3782.     end
  3783.     if align3 == 0
  3784.       if grade1 == 2
  3785.         grade1 = 3
  3786.       end
  3787.       if grade2 == 2
  3788.         grade2 = 3
  3789.       end
  3790.     end
  3791.     # 空ゲージの描画 縦にグラデーション表示
  3792.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3793.                                   color3, color4, grade1)
  3794.     # 実ゲージの描画
  3795.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3796.                                   color5, color6, grade2)
  3797.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3798.                                   color7, color8, grade2)
  3799.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3800.                                   color9, color10, grade2)
  3801.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3802.                                   color11, color12, grade2)
  3803.   end
  3804. end

  3805. #==============================================================================
  3806. # ■ Window_Help
  3807. #------------------------------------------------------------------------------
  3808. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3809. #==============================================================================

  3810. class Window_Help < Window_Base
  3811.   #--------------------------------------------------------------------------
  3812.   # ● エネミー設定
  3813.   #     enemy : 名前とステートを表示するエネミー
  3814.   #--------------------------------------------------------------------------
  3815.   def set_enemy(enemy)
  3816.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3817.     state_text = make_battler_state_text(enemy, 112, false)
  3818.     if state_text != ""
  3819.       text += "  " + state_text
  3820.     end
  3821.     set_text(text, 1)
  3822.   end
  3823. end

  3824. #==============================================================================
  3825. # ■ Window_BattleStatus
  3826. #------------------------------------------------------------------------------
  3827. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3828. #==============================================================================

  3829. class Window_BattleStatus < Window_Base
  3830.   #--------------------------------------------------------------------------
  3831.   # ● オブジェクト初期化
  3832.   #--------------------------------------------------------------------------
  3833.   def initialize
  3834.     x = (4 - $game_party.actors.size) * 80
  3835.     width = $game_party.actors.size * 160
  3836.     super(x, 320-20, width, 160+20)
  3837.     self.back_opacity = 160
  3838.     @actor_window = []
  3839.     for i in 0...$game_party.actors.size
  3840.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3841.     end
  3842.     @level_up_flags = [false, false, false, false]
  3843.     refresh
  3844.   end
  3845.   #--------------------------------------------------------------------------
  3846.   # ● 解放
  3847.   #--------------------------------------------------------------------------
  3848.   def dispose
  3849.     for window in @actor_window
  3850.       window.dispose
  3851.     end
  3852.     super
  3853.   end
  3854.   #--------------------------------------------------------------------------
  3855.   # ● リフレッシュ
  3856.   #--------------------------------------------------------------------------
  3857.   def refresh(number = 0)
  3858.     if number == 0
  3859.       cnt = 0
  3860.       for window in @actor_window
  3861.         window.refresh(@level_up_flags[cnt])
  3862.         cnt += 1
  3863.       end
  3864.     else
  3865.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3866.     end
  3867.   end
  3868.   #--------------------------------------------------------------------------
  3869.   # ● ATゲージリフレッシュ
  3870.   #--------------------------------------------------------------------------
  3871.   def at_refresh(number = 0)
  3872.     if number == 0
  3873.       for window in @actor_window
  3874.         window.at_refresh
  3875.       end
  3876.     else
  3877.       @actor_window[number - 1].at_refresh
  3878.     end
  3879.   end
  3880.   #--------------------------------------------------------------------------
  3881.   # ● フレーム更新
  3882.   #--------------------------------------------------------------------------
  3883.   def update
  3884.     super
  3885.     if self.x != (4 - $game_party.actors.size) * 80
  3886.       self.x = (4 - $game_party.actors.size) * 80
  3887.       self.width = $game_party.actors.size * 160
  3888.       for window in @actor_window
  3889.         window.dispose
  3890.       end
  3891.       @actor_window = []
  3892.       for i in 0...$game_party.actors.size
  3893.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3894.       end
  3895.       refresh
  3896.     end
  3897.     for window in @actor_window
  3898.       window.update
  3899.     end
  3900.   end
  3901. end

  3902. #==============================================================================
  3903. # ■ Window_ActorStatus
  3904. #------------------------------------------------------------------------------
  3905. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3906. #==============================================================================

  3907. class Window_ActorStatus < Window_Base
  3908.   #--------------------------------------------------------------------------
  3909.   # ● オブジェクト初期化
  3910.   #--------------------------------------------------------------------------
  3911.   def initialize(id, x)
  3912.     @actor_num = id
  3913.     super(x, 320, 160, 160)
  3914.     self.contents = Bitmap.new(width - 32, height - 32)
  3915.     self.opacity = 0
  3916.     self.back_opacity = 0
  3917.     actor = $game_party.actors[@actor_num]
  3918.     @actor_nm = actor.name
  3919.     @actor_mhp = actor.maxhp
  3920.     @actor_msp = actor.maxsp
  3921.     @actor_hp = actor.hp
  3922.     @actor_sp = actor.sp
  3923.     @actor_st = make_battler_state_text(actor, 120, true)
  3924.     @status_window = []
  3925.     for i in 0...5
  3926.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3927.     end
  3928.     refresh(false)
  3929.   end
  3930.   #--------------------------------------------------------------------------
  3931.   # ● 解放
  3932.   #--------------------------------------------------------------------------
  3933.   def dispose
  3934.     for i in 0...5
  3935.       @status_window[i].dispose
  3936.     end
  3937.     super
  3938.   end
  3939.   #--------------------------------------------------------------------------
  3940.   # ● リフレッシュ
  3941.   #--------------------------------------------------------------------------
  3942.   def refresh(level_up_flags)
  3943.     self.contents.clear
  3944.     actor = $game_party.actors[@actor_num]
  3945.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3946.     @status_window[1].refresh(actor) if
  3947.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3948.     @status_window[2].refresh(actor) if
  3949.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3950.     @status_window[3].refresh(actor, level_up_flags) if
  3951.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3952.     @actor_nm = actor.name
  3953.     @actor_mhp = actor.maxhp
  3954.     @actor_msp = actor.maxsp
  3955.     @actor_hp = actor.hp
  3956.     @actor_sp = actor.sp
  3957.     @actor_st = make_battler_state_text(actor, 120, true)
  3958.   end
  3959.   #--------------------------------------------------------------------------
  3960.   # ● ATゲージリフレッシュ
  3961.   #--------------------------------------------------------------------------
  3962.   def at_refresh
  3963.     @status_window[4].refresh($game_party.actors[@actor_num])
  3964.   end
  3965.   #--------------------------------------------------------------------------
  3966.   # ● フレーム更新
  3967.   #--------------------------------------------------------------------------
  3968.   def update
  3969.     for window in @status_window
  3970.       window.update
  3971.     end
  3972.   end
  3973. end

  3974. #==============================================================================
  3975. # ■ Window_DetailsStatus
  3976. #------------------------------------------------------------------------------
  3977. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3978. #==============================================================================

  3979. class Window_DetailsStatus < Window_Base
  3980.   #--------------------------------------------------------------------------
  3981.   # ● オブジェクト初期化
  3982.   #--------------------------------------------------------------------------
  3983.   def initialize(actor, id, x)
  3984.     @status_id = id
  3985.     super(x, 320 + id * 26-20, 160, 184)
  3986.     self.contents = Bitmap.new(width - 32, height - 32)
  3987.     self.opacity = 0
  3988.     self.back_opacity = 0
  3989.     refresh(actor, false)
  3990.   end
  3991.   #--------------------------------------------------------------------------
  3992.   # ● 解放
  3993.   #--------------------------------------------------------------------------
  3994.   def dispose
  3995.     super
  3996.   end
  3997.   #--------------------------------------------------------------------------
  3998.   # ● リフレッシュ
  3999.   #--------------------------------------------------------------------------
  4000.   def refresh(actor, level_up_flags = false)
  4001.     self.contents.clear
  4002.     case @status_id
  4003.     when 0
  4004.       draw_actor_name(actor, 4, 0)
  4005.       draw_actor_pic(actor, 4, -20)
  4006.     when 1
  4007.       draw_actor_hp(actor, 4, 10, 120)
  4008.     when 2
  4009.       draw_actor_sp(actor, 4, 15, 120)
  4010.       draw_actor_cp(actor, -20, -10)
  4011.     when 3
  4012.       if level_up_flags
  4013.         self.contents.font.color = normal_color
  4014.         self.contents.draw_text(4, 10, 120, 32, "LEVEL UP!")
  4015.       else
  4016.         draw_actor_state(actor, 14, 25)
  4017.       end
  4018.     when 4
  4019.       draw_actor_atg(actor, 4, 15, 120)
  4020.     end
  4021.   end
  4022.   #--------------------------------------------------------------------------
  4023.   # ● フレーム更新
  4024.   #--------------------------------------------------------------------------
  4025.   def update   
  4026.     # メインフェーズのときは不透明度をやや下げる
  4027.     if $game_temp.battle_main_phase
  4028.       self.contents_opacity -= 4 if self.contents_opacity > 191
  4029.     else
  4030.       self.contents_opacity += 4 if self.contents_opacity < 255
  4031.     end
  4032.   end
  4033. end

  4034. #==============================================================================
  4035. # ■ Arrow_Base
  4036. #------------------------------------------------------------------------------
  4037. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  4038. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  4039. #==============================================================================

  4040. class Arrow_Base < Sprite
  4041.   #--------------------------------------------------------------------------
  4042.   # ● オブジェクト初期化
  4043.   #     viewport : ビューポート
  4044.   #--------------------------------------------------------------------------
  4045.   def initialize(viewport)
  4046.     super(viewport)
  4047.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  4048.     self.ox = 16
  4049.     self.oy = 32
  4050.     self.z = 2500
  4051.     @blink_count = 0
  4052.     @index = 0
  4053.     @help_window = nil
  4054.     update
  4055.   end
  4056. end

  4057. #==============================================================================
  4058. # ■ Arrow_Enemy
  4059. #------------------------------------------------------------------------------
  4060. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  4061. # スを継承します。
  4062. #==============================================================================

  4063. class Arrow_Enemy < Arrow_Base
  4064.   #--------------------------------------------------------------------------
  4065.   # ● フレーム更新
  4066.   #--------------------------------------------------------------------------
  4067.   def update
  4068.     super
  4069.     # 存在しないエネミーを指していたら飛ばす
  4070.     $game_troop.enemies.size.times do
  4071.       break if self.enemy.exist?
  4072.       @index += 1
  4073.       @index %= $game_troop.enemies.size
  4074.     end
  4075.     # カーソル右
  4076.     if Input.repeat?(Input::RIGHT)
  4077.       $game_system.se_play($data_system.cursor_se)
  4078.       $game_troop.enemies.size.times do
  4079.         @index += 1
  4080.         @index %= $game_troop.enemies.size
  4081.         break if self.enemy.exist?
  4082.       end
  4083.       $scene.camera = "select"
  4084.       zoom = 1 / self.enemy.zoom
  4085.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4086.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4087.     end
  4088.     # カーソル左
  4089.     if Input.repeat?(Input::LEFT)
  4090.       $game_system.se_play($data_system.cursor_se)
  4091.       $game_troop.enemies.size.times do
  4092.         @index += $game_troop.enemies.size - 1
  4093.         @index %= $game_troop.enemies.size
  4094.         break if self.enemy.exist?
  4095.       end
  4096.       $scene.camera = "select"
  4097.       zoom = 1 / self.enemy.zoom
  4098.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4099.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4100.     end
  4101.     # スプライトの座標を設定
  4102.     if self.enemy != nil
  4103.       self.x = self.enemy.screen_x
  4104.       self.y = self.enemy.screen_y
  4105.     end
  4106.   end
  4107. end

  4108. #==============================================================================
  4109. # ■ Interpreter
  4110. #------------------------------------------------------------------------------
  4111. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4112. # スや Game_Event クラスの内部で使用されます。
  4113. #==============================================================================

  4114. class Interpreter
  4115.   #--------------------------------------------------------------------------
  4116.   # ● アクターの入れ替え
  4117.   #--------------------------------------------------------------------------
  4118.   def command_129
  4119.     # アクターを取得
  4120.     actor = $game_actors[@parameters[0]]
  4121.     # アクターが有効の場合
  4122.     if actor != nil
  4123.       # 操作で分岐
  4124.       if @parameters[1] == 0
  4125.         if @parameters[2] == 1
  4126.           $game_actors[@parameters[0]].setup(@parameters[0])
  4127.         end
  4128.         $game_party.add_actor(@parameters[0])
  4129.         if $game_temp.in_battle
  4130.           $game_actors[@parameters[0]].at = 0
  4131.           $game_actors[@parameters[0]].atp = 0
  4132.           $scene.spell_reset($game_actors[@parameters[0]])
  4133.           $game_actors[@parameters[0]].damage_pop = {}
  4134.           $game_actors[@parameters[0]].damage = {}
  4135.           $game_actors[@parameters[0]].damage_sp = {}
  4136.           $game_actors[@parameters[0]].critical = {}
  4137.           $game_actors[@parameters[0]].recover_hp = {}
  4138.           $game_actors[@parameters[0]].recover_sp = {}
  4139.           $game_actors[@parameters[0]].state_p = {}
  4140.           $game_actors[@parameters[0]].state_m = {}
  4141.           $game_actors[@parameters[0]].animation = []
  4142.         end
  4143.       else
  4144.         $game_party.remove_actor(@parameters[0])
  4145.       end
  4146.     end
  4147.     if $game_temp.in_battle
  4148.       $scene.status_window.update
  4149.     end
  4150.     # 継続
  4151.     return true
  4152.   end
  4153.   #--------------------------------------------------------------------------
  4154.   # ● HP の増減
  4155.   #--------------------------------------------------------------------------
  4156.   alias :command_311_rtab :command_311
  4157.   def command_311
  4158.     command_311_rtab
  4159.     if $game_temp.in_battle
  4160.       $scene.status_window.refresh
  4161.     end
  4162.   end
  4163.   #--------------------------------------------------------------------------
  4164.   # ● SP の増減
  4165.   #--------------------------------------------------------------------------
  4166.   alias :command_312_rtab :command_312
  4167.   def command_312
  4168.     command_312_rtab
  4169.     if $game_temp.in_battle
  4170.       $scene.status_window.refresh
  4171.     end
  4172.   end
  4173.   #--------------------------------------------------------------------------
  4174.   # ● ステートの変更
  4175.   #--------------------------------------------------------------------------
  4176.   alias :command_313_rtab :command_313
  4177.   def command_313
  4178.     command_313_rtab
  4179.     if $game_temp.in_battle
  4180.       $scene.status_window.refresh
  4181.     end
  4182.   end
  4183.   #--------------------------------------------------------------------------
  4184.   # ● 全回復
  4185.   #--------------------------------------------------------------------------
  4186.   alias :command_314_rtab :command_314
  4187.   def command_314
  4188.     command_314_rtab
  4189.     if $game_temp.in_battle
  4190.       $scene.status_window.refresh
  4191.     end
  4192.   end
  4193.   #--------------------------------------------------------------------------
  4194.   # ● EXP の増減
  4195.   #--------------------------------------------------------------------------
  4196.   alias :command_315_rtab :command_315
  4197.   def command_315
  4198.     command_315_rtab
  4199.     if $game_temp.in_battle
  4200.       $scene.status_window.refresh
  4201.     end
  4202.   end
  4203.   #--------------------------------------------------------------------------
  4204.   # ● レベルの増減
  4205.   #--------------------------------------------------------------------------
  4206.   alias :command_316_rtab :command_316
  4207.   def command_316
  4208.     command_316_rtab
  4209.     if $game_temp.in_battle
  4210.       $scene.status_window.refresh
  4211.     end
  4212.   end
  4213.   #--------------------------------------------------------------------------
  4214.   # ● パラメータの増減
  4215.   #--------------------------------------------------------------------------
  4216.   alias :command_317_rtab :command_317
  4217.   def command_317
  4218.     command_317_rtab
  4219.     if $game_temp.in_battle
  4220.       $scene.status_window.refresh
  4221.     end
  4222.   end
  4223.   #--------------------------------------------------------------------------
  4224.   # ● 装備の変更
  4225.   #--------------------------------------------------------------------------
  4226.   alias :command_319_rtab :command_319
  4227.   def command_319
  4228.     command_319_rtab
  4229.     if $game_temp.in_battle
  4230.       $scene.status_window.refresh
  4231.     end
  4232.   end
  4233.   #--------------------------------------------------------------------------
  4234.   # ● アクターの名前変更
  4235.   #--------------------------------------------------------------------------
  4236.   alias :command_320_rtab :command_320
  4237.   def command_320
  4238.     command_320_rtab
  4239.     if $game_temp.in_battle
  4240.       $scene.status_window.refresh
  4241.     end
  4242.   end
  4243.   #--------------------------------------------------------------------------
  4244.   # ● アクターのクラス変更
  4245.   #--------------------------------------------------------------------------
  4246.   alias :command_321_rtab :command_321
  4247.   def command_321
  4248.     command_321_rtab
  4249.     if $game_temp.in_battle
  4250.       $scene.status_window.refresh
  4251.     end
  4252.   end
  4253.   #--------------------------------------------------------------------------
  4254.   # ● アニメーションの表示
  4255.   #--------------------------------------------------------------------------
  4256.   def command_337
  4257.     # イテレータで処理
  4258.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4259.       # バトラーが存在する場合
  4260.       if battler.exist?
  4261.         # アニメーション ID を設定
  4262.         battler.animation.push([@parameters[2], true])
  4263.       end
  4264.     end
  4265.     # 継続
  4266.     return true
  4267.   end
  4268.   #--------------------------------------------------------------------------
  4269.   # ● ダメージの処理
  4270.   #--------------------------------------------------------------------------
  4271.   def command_338
  4272.     # 操作する値を取得
  4273.     value = operate_value(0, @parameters[2], @parameters[3])
  4274.     # イテレータで処理
  4275.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4276.       # バトラーが存在する場合
  4277.       if battler.exist?
  4278.         # HP を変更
  4279.         battler.hp -= value
  4280.         # 戦闘中なら
  4281.         if $game_temp.in_battle
  4282.           # ダメージを設定
  4283.           battler.damage["event"] = value
  4284.           battler.damage_pop["event"] = true
  4285.         end
  4286.       end
  4287.     end
  4288.     if $game_temp.in_battle
  4289.       $scene.status_window.refresh
  4290.     end
  4291.     # 継続
  4292.     return true
  4293.   end
  4294.   #--------------------------------------------------------------------------
  4295.   # ● アクションの強制
  4296.   #--------------------------------------------------------------------------
  4297.   def command_339
  4298.     # 戦闘中でなければ無視
  4299.     unless $game_temp.in_battle
  4300.       return true
  4301.     end
  4302.     # ターン数が 0 なら無視
  4303.     if $game_temp.battle_turn == 0
  4304.       return true
  4305.     end
  4306.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4307.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4308.       # バトラーが存在する場合
  4309.       if battler.exist?
  4310.         # アクションを設定
  4311.         battler.current_action.force_kind = @parameters[2]
  4312.         if battler.current_action.force_kind == 0
  4313.           battler.current_action.force_basic = @parameters[3]
  4314.         else
  4315.           battler.current_action.force_skill_id = @parameters[3]
  4316.         end
  4317.         # 行動対象を設定
  4318.         if @parameters[4] == -2
  4319.           if battler.is_a?(Game_Enemy)
  4320.             battler.current_action.decide_last_target_for_enemy
  4321.           else
  4322.             battler.current_action.decide_last_target_for_actor
  4323.           end
  4324.         elsif @parameters[4] == -1
  4325.           if battler.is_a?(Game_Enemy)
  4326.             battler.current_action.decide_random_target_for_enemy
  4327.           else
  4328.             battler.current_action.decide_random_target_for_actor
  4329.           end
  4330.         elsif @parameters[4] >= 0
  4331.           battler.current_action.target_index = @parameters[4]
  4332.         end
  4333.         # アクションが有効かつ [すぐに実行] の場合
  4334.         if battler.current_action.valid? and @parameters[5] == 1
  4335.           # 強制対象のバトラーを設定
  4336.           $game_temp.forcing_battler = battler
  4337.           # インデックスを進める
  4338.           @index += 1
  4339.           # 終了
  4340.           return false
  4341.         elsif battler.current_action.valid? and @parameters[5] == 0
  4342.           battler.current_action.forcing = true
  4343.         end
  4344.       end
  4345.     end
  4346.     # 継続
  4347.     return true
  4348.   end
  4349. end

  4350. #==============================================================================
  4351. # ■ Spriteモジュール
  4352. #------------------------------------------------------------------------------
  4353. #  アニメーションの管理を行うモジュールです。
  4354. #==============================================================================

  4355. module RPG
  4356.   class Sprite < ::Sprite
  4357.     def initialize(viewport = nil)
  4358.       super(viewport)
  4359.       @_whiten_duration = 0
  4360.       @_appear_duration = 0
  4361.       @_escape_duration = 0
  4362.       @_collapse_duration = 0
  4363.       @_damage = []
  4364.       @_animation = []
  4365.       @_animation_duration = 0
  4366.       @_blink = false
  4367.     end
  4368.     def damage(value, critical, type = 0)
  4369.       if value.is_a?(Numeric)
  4370.         damage_string = value.abs.to_s
  4371.       else
  4372.         damage_string = value.to_s
  4373.       end
  4374.       bitmap = Bitmap.new(160, 48)
  4375.       bitmap.font.name = "Arial Black"
  4376.       bitmap.font.size = 32
  4377.       bitmap.font.color.set(0, 0, 0)
  4378.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4379.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4380.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4381.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4382.       if value.is_a?(Numeric) and value < 0
  4383.         if type == 0
  4384.           bitmap.font.color.set(176, 255, 144)
  4385.         else
  4386.           bitmap.font.color.set(176, 144, 255)
  4387.         end
  4388.       else
  4389.         if type == 0
  4390.           bitmap.font.color.set(255, 255, 255)
  4391.         else
  4392.           bitmap.font.color.set(255, 176, 144)
  4393.         end
  4394.       end
  4395.       if type == 2
  4396.         bitmap.font.color.set(255, 224, 128)
  4397.       end
  4398.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4399.       if critical
  4400.         string = "CRITICAL"
  4401.         bitmap.font.size = 20
  4402.         bitmap.font.color.set(0, 0, 0)
  4403.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4404.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4405.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4406.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4407.         bitmap.font.color.set(255, 255, 255)
  4408.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4409.       end
  4410.       num = @_damage.size
  4411.       if type != 2
  4412.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4413.       else
  4414.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4415.       end
  4416.       @_damage[num][0].bitmap = bitmap
  4417.       @_damage[num][0].ox = 80 + self.viewport.ox
  4418.       @_damage[num][0].oy = 20 + self.viewport.oy
  4419.       if self.battler.is_a?(Game_Actor)
  4420.         @_damage[num][0].x = self.x
  4421.         @_damage[num][0].y = self.y - self.oy / 2
  4422.       else
  4423.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4424.                             self.ox + self.src_rect.width / 2
  4425.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4426.                             self.viewport.rect.y
  4427.         @_damage[num][0].zoom_x = self.zoom_x
  4428.         @_damage[num][0].zoom_y = self.zoom_y
  4429.         @_damage[num][0].z = 3000
  4430.       end
  4431.     end
  4432.     def animation(animation, hit)
  4433.       return if animation == nil
  4434.       num = @_animation.size
  4435.       @_animation.push([animation, hit, animation.frame_max, []])
  4436.       bitmap = RPG::Cache.animation(animation.animation_name,
  4437.                                     animation.animation_hue)
  4438.       if @@_reference_count.include?(bitmap)
  4439.         @@_reference_count[bitmap] += 1
  4440.       else
  4441.         @@_reference_count[bitmap] = 1
  4442.       end
  4443.       if @_animation[num][0].position != 3 or
  4444.           not @@_animations.include?(animation)
  4445.         for i in 0..15
  4446.           sprite = ::Sprite.new
  4447.           sprite.bitmap = bitmap
  4448.           sprite.visible = false
  4449.           @_animation[num][3].push(sprite)
  4450.         end
  4451.         unless @@_animations.include?(animation)
  4452.           @@_animations.push(animation)
  4453.         end
  4454.       end
  4455.       update_animation(@_animation[num])
  4456.     end
  4457.     def loop_animation(animation)
  4458.       return if animation == @_loop_animation
  4459.       dispose_loop_animation
  4460.       @_loop_animation = animation
  4461.       return if @_loop_animation == nil
  4462.       @_loop_animation_index = 0
  4463.       animation_name = @_loop_animation.animation_name
  4464.       animation_hue = @_loop_animation.animation_hue
  4465.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4466.       if @@_reference_count.include?(bitmap)
  4467.         @@_reference_count[bitmap] += 1
  4468.       else
  4469.         @@_reference_count[bitmap] = 1
  4470.       end
  4471.       @_loop_animation_sprites = []
  4472.       for i in 0..15
  4473.         sprite = ::Sprite.new
  4474.         sprite.bitmap = bitmap
  4475.         sprite.visible = false
  4476.         @_loop_animation_sprites.push(sprite)
  4477.       end
  4478.       # update_loop_animation
  4479.     end
  4480.     def dispose_damage
  4481.       for damage in @_damage.reverse
  4482.         damage[0].bitmap.dispose
  4483.         damage[0].dispose
  4484.         @_damage.delete(damage)
  4485.       end
  4486.     end
  4487.     def dispose_animation
  4488.       for anime in @_animation.reverse
  4489.         sprite = anime[3][0]
  4490.         if sprite != nil
  4491.           @@_reference_count[sprite.bitmap] -= 1
  4492.           if @@_reference_count[sprite.bitmap] == 0
  4493.             sprite.bitmap.dispose
  4494.           end
  4495.         end
  4496.         for sprite in anime[3]
  4497.           sprite.dispose
  4498.         end
  4499.         @_animation.delete(anime)
  4500.       end
  4501.     end
  4502.     def effect?
  4503.       @_whiten_duration > 0 or
  4504.       @_appear_duration > 0 or
  4505.       @_escape_duration > 0 or
  4506.       @_collapse_duration > 0 or
  4507.       @_damage.size == 0 or
  4508.       @_animation.size == 0
  4509.     end
  4510.     def update
  4511.       super
  4512.       if @_whiten_duration > 0
  4513.         @_whiten_duration -= 1
  4514.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4515.       end
  4516.       if @_appear_duration > 0
  4517.         @_appear_duration -= 1
  4518.         self.opacity = (16 - @_appear_duration) * 16
  4519.       end
  4520.       if @_escape_duration > 0
  4521.         @_escape_duration -= 1
  4522.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4523.       end
  4524.       if @_collapse_duration > 0
  4525.         @_collapse_duration -= 1
  4526.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4527.       end
  4528.       for damage in @_damage
  4529.         if damage[1] > 0
  4530.           damage[1] -= 1
  4531.           damage[4] -= 3
  4532.           damage[2] -= damage[4]
  4533.           if self.battler.is_a?(Game_Actor)
  4534.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4535.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4536.           else
  4537.             damage[0].x = self.x + self.viewport.rect.x -
  4538.                           self.ox + self.src_rect.width / 2 +
  4539.                           (40 - damage[1]) * damage[3] / 10
  4540.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4541.                           self.viewport.rect.y + damage[2] / 10
  4542.             damage[0].zoom_x = self.zoom_x
  4543.             damage[0].zoom_y = self.zoom_y
  4544.           end
  4545.           damage[0].z = 2960 + damage[1]
  4546.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4547.           if damage[1] == 0
  4548.             damage[0].bitmap.dispose
  4549.             damage[0].dispose
  4550.             @_damage.delete(damage)
  4551.           end
  4552.         end
  4553.       end
  4554.       for anime in @_animation
  4555.         if (Graphics.frame_count % 2 == 0)
  4556.           anime[2] -= 1
  4557.           update_animation(anime)
  4558.         end
  4559.       end
  4560.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4561.         update_loop_animation
  4562.         @_loop_animation_index += 1
  4563.         @_loop_animation_index %= @_loop_animation.frame_max
  4564.       end
  4565.       if @_blink
  4566.         @_blink_count = (@_blink_count + 1) % 32
  4567.         if @_blink_count < 16
  4568.           alpha = (16 - @_blink_count) * 6
  4569.         else
  4570.           alpha = (@_blink_count - 16) * 6
  4571.         end
  4572.         self.color.set(255, 255, 255, alpha)
  4573.       end
  4574.       @@_animations.clear
  4575.     end
  4576.     def update_animation(anime)
  4577.       if anime[2] > 0
  4578.         frame_index = anime[0].frame_max - anime[2]
  4579.         cell_data = anime[0].frames[frame_index].cell_data
  4580.         position = anime[0].position
  4581.         animation_set_sprites(anime[3], cell_data, position)
  4582.         for timing in anime[0].timings
  4583.           if timing.frame == frame_index
  4584.             animation_process_timing(timing, anime[1])
  4585.           end
  4586.         end
  4587.       else
  4588.         @@_reference_count[anime[3][0].bitmap] -= 1
  4589.         if @@_reference_count[anime[3][0].bitmap] == 0
  4590.             anime[3][0].bitmap.dispose
  4591.         end
  4592.         for sprite in anime[3]
  4593.           sprite.dispose
  4594.         end
  4595.         @_animation.delete(anime)
  4596.       end
  4597.     end
  4598.     def animation_set_sprites(sprites, cell_data, position)
  4599.       for i in 0..15
  4600.         sprite = sprites[i]
  4601.         pattern = cell_data[i, 0]
  4602.         if sprite == nil or pattern == nil or pattern == -1
  4603.           sprite.visible = false if sprite != nil
  4604.           next
  4605.         end
  4606.         sprite.visible = true
  4607.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4608.         if position == 3
  4609.           if self.viewport != nil
  4610.             sprite.x = self.viewport.rect.width / 2
  4611.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4612.               sprite.y = self.viewport.rect.height - 320
  4613.             else
  4614.               sprite.y = self.viewport.rect.height - 160
  4615.             end
  4616.           else
  4617.             sprite.x = 320
  4618.             sprite.y = 240
  4619.           end
  4620.         else
  4621.           sprite.x = self.x + self.viewport.rect.x -
  4622.                       self.ox + self.src_rect.width / 2
  4623.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4624.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4625.                         self.viewport.rect.y
  4626.             if position == 0
  4627.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4628.             elsif position == 2
  4629.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4630.             end
  4631.           else
  4632.             sprite.y = self.y + self.viewport.rect.y -
  4633.                         self.oy + self.src_rect.height / 2
  4634.             sprite.y -= self.src_rect.height / 4 if position == 0
  4635.             sprite.y += self.src_rect.height / 4 if position == 2
  4636.           end
  4637.         end
  4638.         sprite.x += cell_data[i, 1]
  4639.         sprite.y += cell_data[i, 2]
  4640.         sprite.z = 2000
  4641.         sprite.ox = 96
  4642.         sprite.oy = 96
  4643.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4644.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4645.         if position != 3
  4646.           sprite.zoom_x *= self.zoom_x
  4647.           sprite.zoom_y *= self.zoom_y
  4648.         end
  4649.         sprite.angle = cell_data[i, 4]
  4650.         sprite.mirror = (cell_data[i, 5] == 1)
  4651.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4652.         sprite.blend_type = cell_data[i, 7]
  4653.       end
  4654.     end
  4655.     def x=(x)
  4656.       sx = x - self.x
  4657.       if sx != 0
  4658.         for anime in @_animation
  4659.           if anime[3] != nil
  4660.             for i in 0..15
  4661.               anime[3][i].x += sx
  4662.             end
  4663.           end
  4664.         end
  4665.         if @_loop_animation_sprites != nil
  4666.           for i in 0..15
  4667.             @_loop_animation_sprites[i].x += sx
  4668.           end
  4669.         end
  4670.       end
  4671.       super
  4672.     end
  4673.     def y=(y)
  4674.       sy = y - self.y
  4675.       if sy != 0
  4676.         for anime in @_animation
  4677.           if anime[3] != nil
  4678.             for i in 0..15
  4679.               anime[3][i].y += sy
  4680.             end
  4681.           end
  4682.         end
  4683.         if @_loop_animation_sprites != nil
  4684.           for i in 0..15
  4685.             @_loop_animation_sprites[i].y += sy
  4686.           end
  4687.         end
  4688.       end
  4689.       super
  4690.     end
  4691.   end
  4692. end

  4693. #------------------------------------------------------------------------------
  4694. #  Bitmapクラスに新たな機能を追加します。
  4695. #==============================================================================

  4696. class Bitmap
  4697.   #--------------------------------------------------------------------------
  4698.   # ● 矩形をグラデーション表示
  4699.   #     color1 : スタートカラー
  4700.   #     color2 : エンドカラー
  4701.   #     align  :  0:横にグラデーション
  4702.   #               1:縦にグラデーション
  4703.   #               2:斜めにグラデーション(激重につき注意)
  4704.   #--------------------------------------------------------------------------
  4705.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4706.     if align == 0
  4707.       for i in x...x + width
  4708.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4709.         green = color1.green +
  4710.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4711.         blue  = color1.blue +
  4712.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4713.         alpha = color1.alpha +
  4714.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4715.         color = Color.new(red, green, blue, alpha)
  4716.         fill_rect(i, y, 1, height, color)
  4717.       end
  4718.     elsif align == 1
  4719.       for i in y...y + height
  4720.         red   = color1.red +
  4721.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4722.         green = color1.green +
  4723.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4724.         blue  = color1.blue +
  4725.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4726.         alpha = color1.alpha +
  4727.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4728.         color = Color.new(red, green, blue, alpha)
  4729.         fill_rect(x, i, width, 1, color)
  4730.       end
  4731.     elsif align == 2
  4732.       for i in x...x + width
  4733.         for j in y...y + height
  4734.           red   = color1.red + (color2.red - color1.red) *
  4735.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4736.           green = color1.green + (color2.green - color1.green) *
  4737.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4738.           blue  = color1.blue + (color2.blue - color1.blue) *
  4739.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4740.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4741.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4742.           color = Color.new(red, green, blue, alpha)
  4743.           set_pixel(i, j, color)
  4744.         end
  4745.       end
  4746.     elsif align == 3
  4747.       for i in x...x + width
  4748.         for j in y...y + height
  4749.           red   = color1.red + (color2.red - color1.red) *
  4750.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4751.           green = color1.green + (color2.green - color1.green) *
  4752.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4753.           blue  = color1.blue + (color2.blue - color1.blue) *
  4754.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4755.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4756.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4757.           color = Color.new(red, green, blue, alpha)
  4758.           set_pixel(i, j, color)
  4759.         end
  4760.       end
  4761.     end
  4762.   end
  4763. end
复制代码

点评

这一大堆脚本有问题,你最好还是拿工程来吧。 我在新工程插入这堆东西之后,且不说自定义内容不完整,搞得默认脚本都全是问题了。  发表于 2015-5-23 19:32
回复

使用道具 举报

梦石
0
星屑
153
在线时间
120 小时
注册时间
2011-9-4
回帖
70
 楼主| 发表于 2015-5-23 16:09:00 | 显示全部楼层
@白鬼 ~~~~
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部