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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
148
在线时间
120 小时
注册时间
2011-9-4
帖子
91
跳转到指定楼层
1
发表于 2015-5-23 08:20:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

点评

RTAB有很多版本,不知道你用的哪一个,或者把工程拿来  发表于 2015-5-23 10:05

Lv1.梦旅人

梦石
0
星屑
148
在线时间
120 小时
注册时间
2011-9-4
帖子
91
2
 楼主| 发表于 2015-5-23 16:08:34 | 只看该作者
本帖最后由 hys111111 于 2015-6-6 07:56 编辑

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

点评

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
148
在线时间
120 小时
注册时间
2011-9-4
帖子
91
3
 楼主| 发表于 2015-5-23 16:09:00 | 只看该作者
@白鬼 ~~~~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-20 12:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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