查看: 1407|回复: 4

[已经解决] 这个脚本我把数字1删掉后就能用了,不会有后遗症吧

[复制链接]
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2014-11-2 21:48:43 | 显示全部楼层 |阅读模式

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

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

×
这个是RTAB系统的其中一段。
我发现在非战斗状态使用回血技能会报错。
self.damage_effect(user,  1, skill)
这里中间有个1,我把1删掉后就正常了。
可我根本不懂这个是什么意思。
就这么删掉不会有后遗症吧。
  1. # HP の変動判定
  2.       last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
  3.       # 効果判定
  4.       effective |= self.hp != last_hp
  5.       # ステート変化
  6.       @state_changed = false
  7.       effective |= states_plus(user, skill.plus_state_set)
  8.       effective |= states_minus(user, skill.minus_state_set)
  9.       unless $game_temp.in_battle
  10.         self.damage_effect(user,  1, skill)
  11.       end
复制代码

故九江太守

梦石
0
星屑
334
在线时间
2159 小时
注册时间
2012-12-5
回帖
4323
发表于 2014-11-2 22:10:42 | 显示全部楼层
全局搜索def damage_effect
这样看不出来
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-11-3 00:36:22 | 显示全部楼层
本帖最后由 RyanBern 于 2014-11-4 12:24 编辑

     
第3075巷的2去掉了使用物品就不会出错了。  self.damage_effect(user,2, nil)
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

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

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

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

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

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

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

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

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

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

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

  2480. #==============================================================================
  2481. # ■ Game_Actor
  2482. #------------------------------------------------------------------------------
  2483. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2484. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2485. #==============================================================================

  2486. class Game_Actor < Game_Battler
  2487.   #--------------------------------------------------------------------------
  2488.   # ● バトル画面 X 座標の取得
  2489.   #--------------------------------------------------------------------------
  2490.   def screen_x
  2491.     # パーティ内の並び順から X 座標を計算して返す
  2492.     if self.index != nil
  2493.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2494.     else
  2495.       return 0
  2496.     end
  2497.   end
  2498. end

  2499. #==============================================================================
  2500. # ■ Spriteset_Battle
  2501. #------------------------------------------------------------------------------
  2502. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2503. # スの内部で使用されます。
  2504. #==============================================================================

  2505. class Spriteset_Battle
  2506.   #--------------------------------------------------------------------------
  2507.   # ● 公開インスタンス変数
  2508.   #--------------------------------------------------------------------------
  2509.   attr_reader   :real_x                   # x座標補正(現在値)
  2510.   attr_reader   :real_y                   # y座標補正(現在値)
  2511.   attr_reader   :real_zoom                # 拡大率(現在値)
  2512.   #--------------------------------------------------------------------------
  2513.   # ● オブジェクト初期化
  2514.   #--------------------------------------------------------------------------
  2515.   def initialize
  2516.     # ビューポートを作成
  2517.     @viewport1 = Viewport.new(0, 0, 640, 480)
  2518.     @viewport2 = Viewport.new(0, 0, 640, 480)
  2519.     @viewport3 = Viewport.new(0, 0, 640, 480)
  2520.     @viewport4 = Viewport.new(0, 0, 640, 480)
  2521.     @viewport2.z = 101
  2522.     @viewport3.z = 200
  2523.     @viewport4.z = 5000
  2524.     @wait = 0
  2525.     @real_x = 0
  2526.     @real_y = 0
  2527.     @real_zoom = 1.0
  2528.     @target_x = 0
  2529.     @target_y = 0
  2530.     @target_zoom = 1.0
  2531.     @gap_x = 0
  2532.     @gap_y = 0
  2533.     @gap_zoom = 0.0
  2534.     # バトルバックスプライトを作成
  2535.     @battleback_sprite = Sprite.new(@viewport1)
  2536.     # エネミースプライトを作成
  2537.     @enemy_sprites = []
  2538.     for enemy in $game_troop.enemies.reverse
  2539.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  2540.     end
  2541.     # アクタースプライトを作成
  2542.     @actor_sprites = []
  2543.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2544.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2545.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2546.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  2547.     # 天候を作成
  2548.     @weather = RPG::Weather.new(@viewport1)
  2549.     # ピクチャスプライトを作成
  2550.     @picture_sprites = []
  2551.     for i in 51..100
  2552.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  2553.         $game_screen.pictures[i]))
  2554.     end
  2555.     # タイマースプライトを作成
  2556.     @timer_sprite = Sprite_Timer.new
  2557.     # フレーム更新
  2558.     update
  2559.   end
  2560.   #--------------------------------------------------------------------------
  2561.   # ● フレーム更新
  2562.   #--------------------------------------------------------------------------
  2563.   def update
  2564.     # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
  2565.     @actor_sprites[0].battler = $game_party.actors[0]
  2566.     @actor_sprites[1].battler = $game_party.actors[1]
  2567.     @actor_sprites[2].battler = $game_party.actors[2]
  2568.     @actor_sprites[3].battler = $game_party.actors[3]
  2569.     # バトルバックのファイル名が現在のものと違う場合
  2570.     if @battleback_name != $game_temp.battleback_name
  2571.       make_battleback
  2572.     end
  2573.     # 画面のスクロール
  2574.     screen_scroll
  2575.     # モンスターの位置補正
  2576.     for enemy in $game_troop.enemies
  2577.       enemy.real_x = @real_x
  2578.       enemy.real_y = @real_y
  2579.       enemy.real_zoom = @real_zoom
  2580.     end
  2581.     # バトラースプライトを更新
  2582.     for sprite in @enemy_sprites + @actor_sprites
  2583.       sprite.update
  2584.     end
  2585.     # 天候グラフィックを更新
  2586.     @weather.type = $game_screen.weather_type
  2587.     @weather.max = $game_screen.weather_max
  2588.     @weather.update
  2589.     # ピクチャスプライトを更新
  2590.     for sprite in @picture_sprites
  2591.       sprite.update
  2592.     end
  2593.     # タイマースプライトを更新
  2594.     @timer_sprite.update
  2595.     # 画面の色調とシェイク位置を設定
  2596.     @viewport1.tone = $game_screen.tone
  2597.     @viewport1.ox = $game_screen.shake
  2598.     # 画面のフラッシュ色を設定
  2599.     @viewport4.color = $game_screen.flash_color
  2600.     # ビューポートを更新
  2601.     @viewport1.update
  2602.     @viewport2.update
  2603.     @viewport4.update
  2604.   end
  2605.   #--------------------------------------------------------------------------
  2606.   # ● バトル背景の設定
  2607.   #--------------------------------------------------------------------------
  2608.   def make_battleback
  2609.     @battleback_name = $game_temp.battleback_name
  2610.     if @battleback_sprite.bitmap != nil
  2611.       @battleback_sprite.bitmap.dispose
  2612.     end
  2613.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  2614.     if @battleback_sprite.bitmap.width == 640 and
  2615.        @battleback_sprite.bitmap.height == 320
  2616.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  2617.       @base_zoom = 2.0
  2618.       @battleback_sprite.zoom_x = @base_zoom
  2619.       @battleback_sprite.zoom_y = @base_zoom
  2620.       @real_y = 4
  2621.       @battleback_sprite.x = 320
  2622.       @battleback_sprite.y = @real_y
  2623.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2624.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2625.     elsif @battleback_sprite.bitmap.width == 640 and
  2626.           @battleback_sprite.bitmap.height == 480
  2627.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  2628.       @base_zoom = 1.5
  2629.       @battleback_sprite.zoom_x = @base_zoom
  2630.       @battleback_sprite.zoom_y = @base_zoom
  2631.       @battleback_sprite.x = 320
  2632.       @battleback_sprite.y = 0
  2633.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2634.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2635.     else
  2636.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  2637.                                       @battleback_sprite.bitmap.height)
  2638.       @base_zoom = 1.0
  2639.       @battleback_sprite.zoom_x = @base_zoom
  2640.       @battleback_sprite.zoom_y = @base_zoom
  2641.       @battleback_sprite.x = 320
  2642.       @battleback_sprite.y = 0
  2643.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2644.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2645.     end
  2646.   end
  2647.   #--------------------------------------------------------------------------
  2648.   # ● 画面のスクロール目標の位置・拡大率設定
  2649.   #--------------------------------------------------------------------------
  2650.   def screen_target(x, y, zoom)
  2651.     return unless $scene.drive
  2652.     @wait = $scene.scroll_time
  2653.     @target_x = x
  2654.     @target_y = y
  2655.     @target_zoom = zoom
  2656.     screen_over
  2657.     @gap_x = @target_x - @real_x
  2658.     @gap_y = @target_y - @real_y
  2659.     @gap_zoom = @target_zoom - @real_zoom
  2660.   end
  2661.   #--------------------------------------------------------------------------
  2662.   # ● 画面のスクロール
  2663.   #--------------------------------------------------------------------------
  2664.   def screen_scroll
  2665.     if @wait > 0
  2666.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  2667.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  2668.       @real_zoom = @target_zoom -
  2669.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  2670.       @battleback_sprite.x = 320 + @real_x
  2671.       @battleback_sprite.y = @real_y
  2672.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  2673.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  2674.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  2675.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  2676.       @wait -= 1
  2677.     end
  2678.   end
  2679.   #--------------------------------------------------------------------------
  2680.   # ● スクリーンが画面外に出た時の補正処理
  2681.   #--------------------------------------------------------------------------
  2682.   def screen_over
  2683.     width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
  2684.     unless 324 + @target_x > width and 324 - @target_x > width
  2685.       if 324 + @target_x > width
  2686.         @target_x = width - 324
  2687.       elsif 324 - @target_x > width
  2688.         @target_x = 324 - width
  2689.       end
  2690.     end
  2691.     height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
  2692.     unless @target_y > height - 4 and 484 - @target_y > 3 * height
  2693.       if @target_y > height - 4
  2694.         @target_y = height - 4
  2695.       elsif 484 - @target_y > 3 * height
  2696.         @target_y = 484 - 3 * height
  2697.       end
  2698.     end
  2699.   end
  2700. end

  2701. #==============================================================================
  2702. # ■ Game_Battler (分割定義 1)
  2703. #------------------------------------------------------------------------------
  2704. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2705. # スのスーパークラスとして使用されます。
  2706. #==============================================================================

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

  3245. class Game_BattleAction
  3246.   #--------------------------------------------------------------------------
  3247.   # ● 公開インスタンス変数
  3248.   #--------------------------------------------------------------------------
  3249.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3250.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3251.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3252.   attr_accessor :force_skill_id           # スキル ID
  3253.   #--------------------------------------------------------------------------
  3254.   # ● 有効判定
  3255.   #--------------------------------------------------------------------------
  3256.   def valid?
  3257.     return (not (@force_kind == 0 and @force_basic == 3))
  3258.   end
  3259. end

  3260. #==============================================================================
  3261. # ■ Game_Actor
  3262. #------------------------------------------------------------------------------
  3263. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3264. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3265. #==============================================================================

  3266. class Game_Actor < Game_Battler
  3267.   def skill_can_use?(skill_id)
  3268.     return super
  3269.   end
  3270. end

  3271. #==============================================================================
  3272. # ■ Game_Enemy
  3273. #------------------------------------------------------------------------------
  3274. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3275. # 内部で使用されます。
  3276. #==============================================================================

  3277. class Game_Enemy < Game_Battler
  3278.   #--------------------------------------------------------------------------
  3279.   # ● 公開インスタンス変数
  3280.   #--------------------------------------------------------------------------
  3281.   attr_accessor :height                  # 画像の高さ
  3282.   attr_accessor :real_x                  # X座標補正
  3283.   attr_accessor :real_y                  # Y座標補正
  3284.   attr_accessor :real_zoom               # 拡大率
  3285.   #--------------------------------------------------------------------------
  3286.   # ● オブジェクト初期化
  3287.   #     troop_id     : トループ ID
  3288.   #     member_index : トループメンバーのインデックス
  3289.   #--------------------------------------------------------------------------
  3290.   def initialize(troop_id, member_index)
  3291.     super()
  3292.     @troop_id = troop_id
  3293.     @member_index = member_index
  3294.     troop = $data_troops[@troop_id]
  3295.     @enemy_id = troop.members[@member_index].enemy_id
  3296.     enemy = $data_enemies[@enemy_id]
  3297.     @battler_name = enemy.battler_name
  3298.     @battler_hue = enemy.battler_hue
  3299.     @hp = maxhp
  3300.     @sp = maxsp
  3301.     @real_x = 0
  3302.     @real_y = 0
  3303.     @real_zoom = 1.0
  3304.     @fly = 0
  3305.     enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
  3306.     @hidden = troop.members[@member_index].hidden
  3307.     @immortal = troop.members[@member_index].immortal
  3308.   end
  3309.   alias :true_x :screen_x
  3310.   alias :true_y :screen_y
  3311.   #--------------------------------------------------------------------------
  3312.   # ● バトル画面 X 座標の取得
  3313.   #--------------------------------------------------------------------------
  3314.   def screen_x
  3315.     return 320 + (true_x - 320) * @real_zoom + @real_x
  3316.   end
  3317.   #--------------------------------------------------------------------------
  3318.   # ● バトル画面 Y 座標の取得
  3319.   #--------------------------------------------------------------------------
  3320.   def screen_y
  3321.     return true_y * @real_zoom + @real_y
  3322.   end
  3323.   #--------------------------------------------------------------------------
  3324.   # ● バトル画面 Z 座標の取得
  3325.   #--------------------------------------------------------------------------
  3326.   def screen_z
  3327.     return true_y + @fly
  3328.   end
  3329.   #--------------------------------------------------------------------------
  3330.   # ● バトル画面 拡大率の取得
  3331.   #--------------------------------------------------------------------------
  3332.   def zoom
  3333.     return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
  3334.                           (true_y + @fly) / 320 + $scene.zoom_rate[0]
  3335.   end
  3336.   #--------------------------------------------------------------------------
  3337.   # ● 攻撃用、バトル画面 X 座標の取得
  3338.   #--------------------------------------------------------------------------
  3339.   def attack_x(z)
  3340.     return (320 - true_x) * z * 0.75
  3341.   end
  3342.   #--------------------------------------------------------------------------
  3343.   # ● 攻撃用、バトル画面 Y 座標の取得
  3344.   #--------------------------------------------------------------------------
  3345.   def attack_y(z)
  3346.     return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
  3347.   end
  3348.   #--------------------------------------------------------------------------
  3349.   # ● アクション作成
  3350.   #--------------------------------------------------------------------------
  3351.   def make_action
  3352.     # カレントアクションをクリア
  3353.     self.current_action.clear
  3354.     # 動けない場合
  3355.     unless self.inputable?
  3356.       # メソッド終了
  3357.       return
  3358.     end
  3359.     # 現在有効なアクションを抽出
  3360.     available_actions = []
  3361.     rating_max = 0
  3362.     for action in self.actions
  3363.       # ターン 条件確認
  3364.       n = $game_temp.battle_turn
  3365.       a = action.condition_turn_a
  3366.       b = action.condition_turn_b
  3367.       if (b == 0 and n != a) or
  3368.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  3369.         next
  3370.       end
  3371.       # HP 条件確認
  3372.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  3373.         next
  3374.       end
  3375.       # レベル 条件確認
  3376.       if $game_party.max_level < action.condition_level
  3377.         next
  3378.       end
  3379.       # スイッチ 条件確認
  3380.       switch_id = action.condition_switch_id
  3381.       if switch_id > 0 and $game_switches[switch_id] == false
  3382.         next
  3383.       end
  3384.       # スキル使用可能 条件確認
  3385.       if action.kind == 1
  3386.         unless self.skill_can_use?(action.skill_id)
  3387.           next
  3388.         end
  3389.       end
  3390.       # 条件に該当 : このアクションを追加
  3391.       available_actions.push(action)
  3392.       if action.rating > rating_max
  3393.         rating_max = action.rating
  3394.       end
  3395.     end
  3396.     # 最大のレーティング値を 3 として合計を計算 (0 以下は除外)
  3397.     ratings_total = 0
  3398.     for action in available_actions
  3399.       if action.rating > rating_max - 3
  3400.         ratings_total += action.rating - (rating_max - 3)
  3401.       end
  3402.     end
  3403.     # レーティングの合計が 0 ではない場合
  3404.     if ratings_total > 0
  3405.       # 乱数を作成
  3406.       value = rand(ratings_total)
  3407.       # 作成した乱数に対応するものをカレントアクションに設定
  3408.       for action in available_actions
  3409.         if action.rating > rating_max - 3
  3410.           if value < action.rating - (rating_max - 3)
  3411.             self.current_action.kind = action.kind
  3412.             self.current_action.basic = action.basic
  3413.             self.current_action.skill_id = action.skill_id
  3414.             self.current_action.decide_random_target_for_enemy
  3415.             return
  3416.           else
  3417.             value -= action.rating - (rating_max - 3)
  3418.           end
  3419.         end
  3420.       end
  3421.     end
  3422.   end
  3423. end

  3424. #==============================================================================
  3425. # ■ Game_Party
  3426. #------------------------------------------------------------------------------
  3427. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3428. # ラスのインスタンスは $game_party で参照されます。
  3429. #==============================================================================

  3430. class Game_Party
  3431.   #--------------------------------------------------------------------------
  3432.   # ● 全滅判定
  3433.   #--------------------------------------------------------------------------
  3434.   def all_dead?
  3435.     # パーティ人数が 0 人の場合
  3436.     if $game_party.actors.size == 0
  3437.       return false
  3438.     end
  3439.     # HP 0 以上のアクターがパーティにいる場合
  3440.     for actor in @actors
  3441.       if actor.rest_hp > 0
  3442.         return false
  3443.       end
  3444.     end
  3445.     # 全滅
  3446.     return true
  3447.   end
  3448.   #--------------------------------------------------------------------------
  3449.   # ● 対象アクターのランダムな決定
  3450.   #     hp0 : HP 0 のアクターに限る
  3451.   #--------------------------------------------------------------------------
  3452.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3453.   alias :random_target_actor_rtab :random_target_actor
  3454.   def random_target_actor(hp0 = false)
  3455.     # ルーレットを初期化
  3456.     roulette = []
  3457.     # ループ
  3458.     for actor in @actors
  3459.       # 条件に該当する場合
  3460.       if (not hp0 and actor.exist? and actor.rest_hp > 0) or
  3461.           (hp0 and actor.hp0?)
  3462.         # アクターのクラスの [位置] を取得
  3463.         position = $data_classes[actor.class_id].position
  3464.         # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
  3465.         n = 4 - position
  3466.         # ルーレットにアクターを n 回追加
  3467.         n.times do
  3468.           roulette.push(actor)
  3469.         end
  3470.       end
  3471.     end
  3472.     # ルーレットのサイズが 0 の場合
  3473.     if roulette.size == 0
  3474.       return random_target_actor_rtab(hp0)
  3475.     end
  3476.     # ルーレットを回し、アクターを決定
  3477.     return roulette[rand(roulette.size)]
  3478.   end
  3479.   #--------------------------------------------------------------------------
  3480.   # ● 対象アクターのスムーズな決定
  3481.   #     actor_index : アクターインデックス
  3482.   #--------------------------------------------------------------------------
  3483.   # オリジナルのターゲット決定ルーチンを smooth_target_actor_rtab と名前変更
  3484.   alias :smooth_target_actor_rtab :smooth_target_actor
  3485.   def smooth_target_actor(actor_index)
  3486.     # アクターを取得
  3487.     actor = @actors[actor_index]
  3488.     # アクターが存在する場合
  3489.     if actor != nil and actor.exist? and actor.rest_hp > 0
  3490.       return actor
  3491.     end
  3492.     # ループ
  3493.     for actor in @actors
  3494.       # アクターが存在する場合
  3495.       if actor.exist? and actor.rest_hp > 0
  3496.         return actor
  3497.       end
  3498.     end
  3499.     # 味方が全滅している場合、オリジナルのターゲット決定ルーチンを実行する
  3500.     return smooth_target_actor_rtab(actor_index)
  3501.   end
  3502. end

  3503. #==============================================================================
  3504. # ■ Game_Troop
  3505. #------------------------------------------------------------------------------
  3506. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3507. # れます。
  3508. #==============================================================================

  3509. class Game_Troop
  3510.   #--------------------------------------------------------------------------
  3511.   # ● 対象エネミーのランダムな決定
  3512.   #     hp0 : HP 0 のエネミーに限る
  3513.   #--------------------------------------------------------------------------
  3514.   # オリジナルのターゲット決定ルーチンを random_target_enemy_rtab と名前変更
  3515.   alias :random_target_enemy_rtab :random_target_enemy
  3516.   def random_target_enemy(hp0 = false)
  3517.     # ルーレットを初期化
  3518.     roulette = []
  3519.     # ループ
  3520.     for enemy in @enemies
  3521.       # 条件に該当する場合
  3522.       if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
  3523.           (hp0 and enemy.hp0?)
  3524.         # ルーレットにエネミーを追加
  3525.         roulette.push(enemy)
  3526.       end
  3527.     end
  3528.     # ルーレットのサイズが 0 の場合
  3529.     if roulette.size == 0
  3530.       return random_target_enemy_rtab(hp0)
  3531.     end
  3532.     # ルーレットを回し、エネミーを決定
  3533.     return roulette[rand(roulette.size)]
  3534.   end
  3535.   #--------------------------------------------------------------------------
  3536.   # ● 対象エネミーのスムーズな決定
  3537.   #     enemy_index : エネミーインデックス
  3538.   #--------------------------------------------------------------------------
  3539.   # オリジナルのターゲット決定ルーチンを smooth_target_enemy_rtab と名前変更
  3540.   alias :smooth_target_enemy_rtab :smooth_target_enemy
  3541.   def smooth_target_enemy(enemy_index)
  3542.     # エネミーを取得
  3543.     enemy = @enemies[enemy_index]
  3544.     # エネミーが存在する場合
  3545.     if enemy != nil and enemy.exist? and enemy.rest_hp > 0
  3546.       return enemy
  3547.     end
  3548.     # ループ
  3549.     for enemy in @enemies
  3550.       # エネミーが存在する場合
  3551.       if enemy.exist? and enemy.rest_hp > 0
  3552.         return enemy
  3553.       end
  3554.     end
  3555.     # 敵が全滅している場合、再度敵の検索を行う
  3556.     return smooth_target_enemy_rtab(enemy_index)
  3557.   end
  3558. end

  3559. #==============================================================================
  3560. # ■ Sprite_Battler
  3561. #------------------------------------------------------------------------------
  3562. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3563. # スプライトの状態を自動的に変化させます。
  3564. #==============================================================================

  3565. class Sprite_Battler < RPG::Sprite
  3566.   #--------------------------------------------------------------------------
  3567.   # ● フレーム更新
  3568.   #--------------------------------------------------------------------------
  3569.   def update
  3570.     super
  3571.     # バトラーが nil の場合
  3572.     if @battler == nil
  3573.       self.bitmap = nil
  3574.       loop_animation(nil)
  3575.       return
  3576.     end
  3577.     # ファイル名か色相が現在のものと異なる場合
  3578.     if @battler.battler_name != @battler_name or
  3579.        @battler.battler_hue != @battler_hue
  3580.       # ビットマップを取得、設定
  3581.       @battler_name = @battler.battler_name
  3582.       @battler_hue = @battler.battler_hue
  3583.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  3584.       @width = bitmap.width
  3585.       @height = bitmap.height
  3586.       self.ox = @width / 2
  3587.       self.oy = @height
  3588.       if @battler.is_a?(Game_Enemy)
  3589.         @battler.height = @height
  3590.       end
  3591.       # 戦闘不能または隠れ状態なら不透明度を 0 にする
  3592.       if @battler.dead? or @battler.hidden
  3593.         self.opacity = 0
  3594.       end
  3595.     end
  3596.     # アニメーション ID が現在のものと異なる場合
  3597.     if @battler.state_animation_id != @state_animation_id
  3598.       @state_animation_id = @battler.state_animation_id
  3599.       loop_animation($data_animations[@state_animation_id])
  3600.     end
  3601.     # 表示されるべきアクターの場合
  3602.     if @battler.is_a?(Game_Actor) and @battler_visible
  3603.       # メインフェーズでないときは不透明度をやや下げる
  3604.       if $game_temp.battle_main_phase
  3605.         self.opacity += 3 if self.opacity < 255
  3606.       else
  3607.         self.opacity -= 3 if self.opacity > 207
  3608.       end
  3609.     end
  3610.     # 明滅
  3611.     if @battler.blink
  3612.       blink_on
  3613.     else
  3614.       blink_off
  3615.     end
  3616.     # 不可視の場合
  3617.     unless @battler_visible
  3618.       # 出現
  3619.       if not @battler.hidden and not @battler.dead? and
  3620.          (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
  3621.         appear
  3622.         @battler_visible = true
  3623.       end
  3624.     end
  3625.     # ダメージ
  3626.     for battler in @battler.damage_pop
  3627.       if battler[0].class == Array
  3628.         if battler[0][1] >= 0
  3629.           $scene.skill_se
  3630.         else
  3631.           $scene.levelup_se
  3632.         end
  3633.         damage(@battler.damage[battler[0]], false, 2)
  3634.       else
  3635.         damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
  3636.       end
  3637.       if @battler.damage_sp.include?(battler[0])
  3638.         damage(@battler.damage_sp[battler[0]],
  3639.                 @battler.critical[battler[0]], 1)
  3640.         @battler.damage_sp.delete(battler[0])
  3641.       end
  3642.       @battler.damage_pop.delete(battler[0])
  3643.       @battler.damage.delete(battler[0])
  3644.       @battler.critical.delete(battler[0])
  3645.     end
  3646.     # 可視の場合
  3647.     if @battler_visible
  3648.       # 逃走
  3649.       if @battler.hidden
  3650.         $game_system.se_play($data_system.escape_se)
  3651.         escape
  3652.         @battler_visible = false
  3653.       end
  3654.       # 白フラッシュ
  3655.       if @battler.white_flash
  3656.         whiten
  3657.         @battler.white_flash = false
  3658.       end
  3659.       # アニメーション
  3660.       unless @battler.animation.empty?
  3661.         for animation in @battler.animation.reverse
  3662.           animation($data_animations[animation[0]], animation[1])
  3663.           @battler.animation.delete(animation)
  3664.         end
  3665.       end
  3666.       # コラプス
  3667.       if @battler.damage.empty? and @battler.dead?
  3668.         if $scene.dead_ok?(@battler)
  3669.           if @battler.is_a?(Game_Enemy)
  3670.             $game_system.se_play($data_system.enemy_collapse_se)
  3671.           else
  3672.             $game_system.se_play($data_system.actor_collapse_se)
  3673.           end
  3674.           collapse
  3675.           @battler_visible = false
  3676.         end
  3677.       end
  3678.     end
  3679.     # スプライトの座標を設定
  3680.     self.x = @battler.screen_x
  3681.     self.y = @battler.screen_y
  3682.     self.z = @battler.screen_z
  3683.     if @battler.is_a?(Game_Enemy)
  3684.       self.zoom_x = @battler.real_zoom * @battler.zoom
  3685.       self.zoom_y = @battler.real_zoom * @battler.zoom
  3686.     end
  3687.   end
  3688. end

  3689. #==============================================================================
  3690. # ■ Window_Base
  3691. #------------------------------------------------------------------------------
  3692. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3693. #==============================================================================

  3694. class Window_Base < Window
  3695.   #--------------------------------------------------------------------------
  3696.   # ● ゲージの描画
  3697.   #--------------------------------------------------------------------------
  3698.   def gauge_rect_at(width, height, align3,
  3699.                     color1, color2, color3, color4, color5, color6, color7,
  3700.                     color8, color9, color10, color11, color12, grade1, grade2)
  3701.     # 枠描画
  3702.     @at_gauge = Bitmap.new(width, height * 5)
  3703.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3704.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3705.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3706.       color = color3
  3707.       color3 = color4
  3708.       color4 = color
  3709.     end
  3710.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3711.       color = color5
  3712.       color5 = color6
  3713.       color6 = color
  3714.       color = color7
  3715.       color7 = color8
  3716.       color8 = color
  3717.       color = color9
  3718.       color9 = color10
  3719.       color10 = color
  3720.       color = color11
  3721.       color11 = color12
  3722.       color12 = color
  3723.     end
  3724.     if align3 == 0
  3725.       if grade1 == 2
  3726.         grade1 = 3
  3727.       end
  3728.       if grade2 == 2
  3729.         grade2 = 3
  3730.       end
  3731.     end
  3732.     # 空ゲージの描画 縦にグラデーション表示
  3733.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3734.                                   color3, color4, grade1)
  3735.     # 実ゲージの描画
  3736.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3737.                                   color5, color6, grade2)
  3738.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3739.                                   color7, color8, grade2)
  3740.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3741.                                   color9, color10, grade2)
  3742.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3743.                                   color11, color12, grade2)
  3744.   end
  3745. end

  3746. #==============================================================================
  3747. # ■ Window_Help
  3748. #------------------------------------------------------------------------------
  3749. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3750. #==============================================================================

  3751. class Window_Help < Window_Base
  3752.   #--------------------------------------------------------------------------
  3753.   # ● エネミー設定
  3754.   #     enemy : 名前とステートを表示するエネミー
  3755.   #--------------------------------------------------------------------------
  3756.   def set_enemy(enemy)
  3757.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3758.     state_text = make_battler_state_text(enemy, 112, false)
  3759.     if state_text != ""
  3760.       text += "  " + state_text
  3761.     end
  3762.     set_text(text, 1)
  3763.   end
  3764. end

  3765. #==============================================================================
  3766. # ■ Window_BattleStatus
  3767. #------------------------------------------------------------------------------
  3768. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3769. #==============================================================================

  3770. class Window_BattleStatus < Window_Base
  3771.   #--------------------------------------------------------------------------
  3772.   # ● オブジェクト初期化
  3773.   #--------------------------------------------------------------------------
  3774.   def initialize
  3775.     x = (4 - $game_party.actors.size) * 80
  3776.     width = $game_party.actors.size * 160
  3777.     super(x, 320, width, 160)
  3778.     self.back_opacity = 160
  3779.     @actor_window = []
  3780.     for i in 0...$game_party.actors.size
  3781.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3782.     end
  3783.     @level_up_flags = [false, false, false, false]
  3784.     refresh
  3785.   end
  3786.   #--------------------------------------------------------------------------
  3787.   # ● 解放
  3788.   #--------------------------------------------------------------------------
  3789.   def dispose
  3790.     for window in @actor_window
  3791.       window.dispose
  3792.     end
  3793.     super
  3794.   end
  3795.   #--------------------------------------------------------------------------
  3796.   # ● リフレッシュ
  3797.   #--------------------------------------------------------------------------
  3798.   def refresh(number = 0)
  3799.     if number == 0
  3800.       cnt = 0
  3801.       for window in @actor_window
  3802.         window.refresh(@level_up_flags[cnt])
  3803.         cnt += 1
  3804.       end
  3805.     else
  3806.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3807.     end
  3808.   end
  3809.   #--------------------------------------------------------------------------
  3810.   # ● ATゲージリフレッシュ
  3811.   #--------------------------------------------------------------------------
  3812.   def at_refresh(number = 0)
  3813.     if number == 0
  3814.       for window in @actor_window
  3815.         window.at_refresh
  3816.       end
  3817.     else
  3818.       @actor_window[number - 1].at_refresh
  3819.     end
  3820.   end
  3821.   #--------------------------------------------------------------------------
  3822.   # ● フレーム更新
  3823.   #--------------------------------------------------------------------------
  3824.   def update
  3825.     super
  3826.     if self.x != (4 - $game_party.actors.size) * 80
  3827.       self.x = (4 - $game_party.actors.size) * 80
  3828.       self.width = $game_party.actors.size * 160
  3829.       for window in @actor_window
  3830.         window.dispose
  3831.       end
  3832.       @actor_window = []
  3833.       for i in 0...$game_party.actors.size
  3834.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3835.       end
  3836.       refresh
  3837.     end
  3838.     for window in @actor_window
  3839.       window.update
  3840.     end
  3841.   end
  3842. end

  3843. #==============================================================================
  3844. # ■ Window_ActorStatus
  3845. #------------------------------------------------------------------------------
  3846. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3847. #==============================================================================

  3848. class Window_ActorStatus < Window_Base
  3849.   #--------------------------------------------------------------------------
  3850.   # ● オブジェクト初期化
  3851.   #--------------------------------------------------------------------------
  3852.   def initialize(id, x)
  3853.     @actor_num = id
  3854.     super(x, 320, 160, 160)
  3855.     self.contents = Bitmap.new(width - 32, height - 32)
  3856.     self.opacity = 0
  3857.     self.back_opacity = 0
  3858.     actor = $game_party.actors[@actor_num]
  3859.     @actor_nm = actor.name
  3860.     @actor_mhp = actor.maxhp
  3861.     @actor_msp = actor.maxsp
  3862.     @actor_hp = actor.hp
  3863.     @actor_sp = actor.sp
  3864.     @actor_st = make_battler_state_text(actor, 120, true)
  3865.     @status_window = []
  3866.     for i in 0...5
  3867.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3868.     end
  3869.     refresh(false)
  3870.   end
  3871.   #--------------------------------------------------------------------------
  3872.   # ● 解放
  3873.   #--------------------------------------------------------------------------
  3874.   def dispose
  3875.     for i in 0...5
  3876.       @status_window[i].dispose
  3877.     end
  3878.     super
  3879.   end
  3880.   #--------------------------------------------------------------------------
  3881.   # ● リフレッシュ
  3882.   #--------------------------------------------------------------------------
  3883.   def refresh(level_up_flags)
  3884.     self.contents.clear
  3885.     actor = $game_party.actors[@actor_num]
  3886.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3887.     @status_window[1].refresh(actor) if
  3888.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3889.     @status_window[2].refresh(actor) if
  3890.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3891.     @status_window[3].refresh(actor, level_up_flags) if
  3892.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3893.     @actor_nm = actor.name
  3894.     @actor_mhp = actor.maxhp
  3895.     @actor_msp = actor.maxsp
  3896.     @actor_hp = actor.hp
  3897.     @actor_sp = actor.sp
  3898.     @actor_st = make_battler_state_text(actor, 120, true)
  3899.   end
  3900.   #--------------------------------------------------------------------------
  3901.   # ● ATゲージリフレッシュ
  3902.   #--------------------------------------------------------------------------
  3903.   def at_refresh
  3904.     @status_window[4].refresh($game_party.actors[@actor_num])
  3905.   end
  3906.   #--------------------------------------------------------------------------
  3907.   # ● フレーム更新
  3908.   #--------------------------------------------------------------------------
  3909.   def update
  3910.     for window in @status_window
  3911.       window.update
  3912.     end
  3913.   end
  3914. end

  3915. #==============================================================================
  3916. # ■ Window_DetailsStatus
  3917. #------------------------------------------------------------------------------
  3918. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3919. #==============================================================================

  3920. class Window_DetailsStatus < Window_Base
  3921.   #--------------------------------------------------------------------------
  3922.   # ● オブジェクト初期化
  3923.   #--------------------------------------------------------------------------
  3924.   def initialize(actor, id, x)
  3925.     @status_id = id
  3926.     super(x, 320 + id * 26, 160, 64)
  3927.     self.contents = Bitmap.new(width - 32, height - 32)
  3928.     self.opacity = 0
  3929.     self.back_opacity = 0
  3930.     refresh(actor, false)
  3931.   end
  3932.   #--------------------------------------------------------------------------
  3933.   # ● 解放
  3934.   #--------------------------------------------------------------------------
  3935.   def dispose
  3936.     super
  3937.   end
  3938.   #--------------------------------------------------------------------------
  3939.   # ● リフレッシュ
  3940.   #--------------------------------------------------------------------------
  3941.   def refresh(actor, level_up_flags = false)
  3942.     self.contents.clear
  3943.     case @status_id
  3944.     when 0
  3945.       draw_actor_name(actor, 4, 0)
  3946.     when 1
  3947.       draw_actor_hp(actor, 4, 0, 120)
  3948.     when 2
  3949.       draw_actor_sp(actor, 4, 0, 120)
  3950.     when 3
  3951.       if level_up_flags
  3952.         self.contents.font.color = normal_color
  3953.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3954.       else
  3955.         draw_actor_state(actor, 4, 0)
  3956.       end
  3957.     when 4
  3958.       draw_actor_atg(actor, 4, 0, 120)
  3959.     end
  3960.   end
  3961.   #--------------------------------------------------------------------------
  3962.   # ● フレーム更新
  3963.   #--------------------------------------------------------------------------
  3964.   def update
  3965.     # メインフェーズのときは不透明度をやや下げる
  3966.     if $game_temp.battle_main_phase
  3967.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3968.     else
  3969.       self.contents_opacity += 4 if self.contents_opacity < 255
  3970.     end
  3971.   end
  3972. end

  3973. #==============================================================================
  3974. # ■ Arrow_Base
  3975. #------------------------------------------------------------------------------
  3976. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3977. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3978. #==============================================================================

  3979. class Arrow_Base < Sprite
  3980.   #--------------------------------------------------------------------------
  3981.   # ● オブジェクト初期化
  3982.   #     viewport : ビューポート
  3983.   #--------------------------------------------------------------------------
  3984.   def initialize(viewport)
  3985.     super(viewport)
  3986.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3987.     self.ox = 16
  3988.     self.oy = 32
  3989.     self.z = 2500
  3990.     @blink_count = 0
  3991.     @index = 0
  3992.     @help_window = nil
  3993.     update
  3994.   end
  3995. end

  3996. #==============================================================================
  3997. # ■ Arrow_Enemy
  3998. #------------------------------------------------------------------------------
  3999. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  4000. # スを継承します。
  4001. #==============================================================================

  4002. class Arrow_Enemy < Arrow_Base
  4003.   #--------------------------------------------------------------------------
  4004.   # ● フレーム更新
  4005.   #--------------------------------------------------------------------------
  4006.   def update
  4007.     super
  4008.     # 存在しないエネミーを指していたら飛ばす
  4009.     $game_troop.enemies.size.times do
  4010.       break if self.enemy.exist?
  4011.       @index += 1
  4012.       @index %= $game_troop.enemies.size
  4013.     end
  4014.     # カーソル右
  4015.     if Input.repeat?(Input::RIGHT)
  4016.       $game_system.se_play($data_system.cursor_se)
  4017.       $game_troop.enemies.size.times do
  4018.         @index += 1
  4019.         @index %= $game_troop.enemies.size
  4020.         break if self.enemy.exist?
  4021.       end
  4022.       $scene.camera = "select"
  4023.       zoom = 1 / self.enemy.zoom
  4024.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4025.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4026.     end
  4027.     # カーソル左
  4028.     if Input.repeat?(Input::LEFT)
  4029.       $game_system.se_play($data_system.cursor_se)
  4030.       $game_troop.enemies.size.times do
  4031.         @index += $game_troop.enemies.size - 1
  4032.         @index %= $game_troop.enemies.size
  4033.         break if self.enemy.exist?
  4034.       end
  4035.       $scene.camera = "select"
  4036.       zoom = 1 / self.enemy.zoom
  4037.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4038.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4039.     end
  4040.     # スプライトの座標を設定
  4041.     if self.enemy != nil
  4042.       self.x = self.enemy.screen_x
  4043.       self.y = self.enemy.screen_y
  4044.     end
  4045.   end
  4046. end

  4047. #==============================================================================
  4048. # ■ Interpreter
  4049. #------------------------------------------------------------------------------
  4050. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4051. # スや Game_Event クラスの内部で使用されます。
  4052. #==============================================================================

  4053. class Interpreter
  4054.   #--------------------------------------------------------------------------
  4055.   # ● アクターの入れ替え
  4056.   #--------------------------------------------------------------------------
  4057.   def command_129
  4058.     # アクターを取得
  4059.     actor = $game_actors[@parameters[0]]
  4060.     # アクターが有効の場合
  4061.     if actor != nil
  4062.       # 操作で分岐
  4063.       if @parameters[1] == 0
  4064.         if @parameters[2] == 1
  4065.           $game_actors[@parameters[0]].setup(@parameters[0])
  4066.         end
  4067.         $game_party.add_actor(@parameters[0])
  4068.         if $game_temp.in_battle
  4069.           $game_actors[@parameters[0]].at = 0
  4070.           $game_actors[@parameters[0]].atp = 0
  4071.           $scene.spell_reset($game_actors[@parameters[0]])
  4072.           $game_actors[@parameters[0]].damage_pop = {}
  4073.           $game_actors[@parameters[0]].damage = {}
  4074.           $game_actors[@parameters[0]].damage_sp = {}
  4075.           $game_actors[@parameters[0]].critical = {}
  4076.           $game_actors[@parameters[0]].recover_hp = {}
  4077.           $game_actors[@parameters[0]].recover_sp = {}
  4078.           $game_actors[@parameters[0]].state_p = {}
  4079.           $game_actors[@parameters[0]].state_m = {}
  4080.           $game_actors[@parameters[0]].animation = []
  4081.         end
  4082.       else
  4083.         $game_party.remove_actor(@parameters[0])
  4084.       end
  4085.     end
  4086.     if $game_temp.in_battle
  4087.       $scene.status_window.update
  4088.     end
  4089.     # 継続
  4090.     return true
  4091.   end
  4092.   #--------------------------------------------------------------------------
  4093.   # ● HP の増減
  4094.   #--------------------------------------------------------------------------
  4095.   alias :command_311_rtab :command_311
  4096.   def command_311
  4097.     command_311_rtab
  4098.     if $game_temp.in_battle
  4099.       $scene.status_window.refresh
  4100.     end
  4101.   end
  4102.   #--------------------------------------------------------------------------
  4103.   # ● SP の増減
  4104.   #--------------------------------------------------------------------------
  4105.   alias :command_312_rtab :command_312
  4106.   def command_312
  4107.     command_312_rtab
  4108.     if $game_temp.in_battle
  4109.       $scene.status_window.refresh
  4110.     end
  4111.   end
  4112.   #--------------------------------------------------------------------------
  4113.   # ● ステートの変更
  4114.   #--------------------------------------------------------------------------
  4115.   alias :command_313_rtab :command_313
  4116.   def command_313
  4117.     command_313_rtab
  4118.     if $game_temp.in_battle
  4119.       $scene.status_window.refresh
  4120.     end
  4121.   end
  4122.   #--------------------------------------------------------------------------
  4123.   # ● 全回復
  4124.   #--------------------------------------------------------------------------
  4125.   alias :command_314_rtab :command_314
  4126.   def command_314
  4127.     command_314_rtab
  4128.     if $game_temp.in_battle
  4129.       $scene.status_window.refresh
  4130.     end
  4131.   end
  4132.   #--------------------------------------------------------------------------
  4133.   # ● EXP の増減
  4134.   #--------------------------------------------------------------------------
  4135.   alias :command_315_rtab :command_315
  4136.   def command_315
  4137.     command_315_rtab
  4138.     if $game_temp.in_battle
  4139.       $scene.status_window.refresh
  4140.     end
  4141.   end
  4142.   #--------------------------------------------------------------------------
  4143.   # ● レベルの増減
  4144.   #--------------------------------------------------------------------------
  4145.   alias :command_316_rtab :command_316
  4146.   def command_316
  4147.     command_316_rtab
  4148.     if $game_temp.in_battle
  4149.       $scene.status_window.refresh
  4150.     end
  4151.   end
  4152.   #--------------------------------------------------------------------------
  4153.   # ● パラメータの増減
  4154.   #--------------------------------------------------------------------------
  4155.   alias :command_317_rtab :command_317
  4156.   def command_317
  4157.     command_317_rtab
  4158.     if $game_temp.in_battle
  4159.       $scene.status_window.refresh
  4160.     end
  4161.   end
  4162.   #--------------------------------------------------------------------------
  4163.   # ● 装備の変更
  4164.   #--------------------------------------------------------------------------
  4165.   alias :command_319_rtab :command_319
  4166.   def command_319
  4167.     command_319_rtab
  4168.     if $game_temp.in_battle
  4169.       $scene.status_window.refresh
  4170.     end
  4171.   end
  4172.   #--------------------------------------------------------------------------
  4173.   # ● アクターの名前変更
  4174.   #--------------------------------------------------------------------------
  4175.   alias :command_320_rtab :command_320
  4176.   def command_320
  4177.     command_320_rtab
  4178.     if $game_temp.in_battle
  4179.       $scene.status_window.refresh
  4180.     end
  4181.   end
  4182.   #--------------------------------------------------------------------------
  4183.   # ● アクターのクラス変更
  4184.   #--------------------------------------------------------------------------
  4185.   alias :command_321_rtab :command_321
  4186.   def command_321
  4187.     command_321_rtab
  4188.     if $game_temp.in_battle
  4189.       $scene.status_window.refresh
  4190.     end
  4191.   end
  4192.   #--------------------------------------------------------------------------
  4193.   # ● アニメーションの表示
  4194.   #--------------------------------------------------------------------------
  4195.   def command_337
  4196.     # イテレータで処理
  4197.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4198.       # バトラーが存在する場合
  4199.       if battler.exist?
  4200.         # アニメーション ID を設定
  4201.         battler.animation.push([@parameters[2], true])
  4202.       end
  4203.     end
  4204.     # 継続
  4205.     return true
  4206.   end
  4207.   #--------------------------------------------------------------------------
  4208.   # ● ダメージの処理
  4209.   #--------------------------------------------------------------------------
  4210.   def command_338
  4211.     # 操作する値を取得
  4212.     value = operate_value(0, @parameters[2], @parameters[3])
  4213.     # イテレータで処理
  4214.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4215.       # バトラーが存在する場合
  4216.       if battler.exist?
  4217.         # HP を変更
  4218.         battler.hp -= value
  4219.         # 戦闘中なら
  4220.         if $game_temp.in_battle
  4221.           # ダメージを設定
  4222.           battler.damage["event"] = value
  4223.           battler.damage_pop["event"] = true
  4224.         end
  4225.       end
  4226.     end
  4227.     if $game_temp.in_battle
  4228.       $scene.status_window.refresh
  4229.     end
  4230.     # 継続
  4231.     return true
  4232.   end
  4233.   #--------------------------------------------------------------------------
  4234.   # ● アクションの強制
  4235.   #--------------------------------------------------------------------------
  4236.   def command_339
  4237.     # 戦闘中でなければ無視
  4238.     unless $game_temp.in_battle
  4239.       return true
  4240.     end
  4241.     # ターン数が 0 なら無視
  4242.     if $game_temp.battle_turn == 0
  4243.       return true
  4244.     end
  4245.     # イテレータで処理 (便宜的なもので、複数になることはない)
  4246.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  4247.       # バトラーが存在する場合
  4248.       if battler.exist?
  4249.         # アクションを設定
  4250.         battler.current_action.force_kind = @parameters[2]
  4251.         if battler.current_action.force_kind == 0
  4252.           battler.current_action.force_basic = @parameters[3]
  4253.         else
  4254.           battler.current_action.force_skill_id = @parameters[3]
  4255.         end
  4256.         # 行動対象を設定
  4257.         if @parameters[4] == -2
  4258.           if battler.is_a?(Game_Enemy)
  4259.             battler.current_action.decide_last_target_for_enemy
  4260.           else
  4261.             battler.current_action.decide_last_target_for_actor
  4262.           end
  4263.         elsif @parameters[4] == -1
  4264.           if battler.is_a?(Game_Enemy)
  4265.             battler.current_action.decide_random_target_for_enemy
  4266.           else
  4267.             battler.current_action.decide_random_target_for_actor
  4268.           end
  4269.         elsif @parameters[4] >= 0
  4270.           battler.current_action.target_index = @parameters[4]
  4271.         end
  4272.         # アクションが有効かつ [すぐに実行] の場合
  4273.         if battler.current_action.valid? and @parameters[5] == 1
  4274.           # 強制対象のバトラーを設定
  4275.           $game_temp.forcing_battler = battler
  4276.           # インデックスを進める
  4277.           @index += 1
  4278.           # 終了
  4279.           return false
  4280.         elsif battler.current_action.valid? and @parameters[5] == 0
  4281.           battler.current_action.forcing = true
  4282.         end
  4283.       end
  4284.     end
  4285.     # 継続
  4286.     return true
  4287.   end
  4288. end

  4289. #==============================================================================
  4290. # ■ Spriteモジュール
  4291. #------------------------------------------------------------------------------
  4292. #  アニメーションの管理を行うモジュールです。
  4293. #==============================================================================

  4294. module RPG
  4295.   class Sprite < ::Sprite
  4296.     def initialize(viewport = nil)
  4297.       super(viewport)
  4298.       @_whiten_duration = 0
  4299.       @_appear_duration = 0
  4300.       @_escape_duration = 0
  4301.       @_collapse_duration = 0
  4302.       @_damage = []
  4303.       @_animation = []
  4304.       @_animation_duration = 0
  4305.       @_blink = false
  4306.     end
  4307.     def damage(value, critical, type = 0)
  4308.       if value.is_a?(Numeric)
  4309.         damage_string = value.abs.to_s
  4310.       else
  4311.         damage_string = value.to_s
  4312.       end
  4313.       bitmap = Bitmap.new(160, 48)
  4314.       bitmap.font.name = "Arial Black"
  4315.       bitmap.font.size = 32
  4316.       bitmap.font.color.set(0, 0, 0)
  4317.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  4318.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  4319.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  4320.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  4321.       if value.is_a?(Numeric) and value < 0
  4322.         if type == 0
  4323.           bitmap.font.color.set(176, 255, 144)
  4324.         else
  4325.           bitmap.font.color.set(176, 144, 255)
  4326.         end
  4327.       else
  4328.         if type == 0
  4329.           bitmap.font.color.set(255, 255, 255)
  4330.         else
  4331.           bitmap.font.color.set(255, 176, 144)
  4332.         end
  4333.       end
  4334.       if type == 2
  4335.         bitmap.font.color.set(255, 224, 128)
  4336.       end
  4337.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4338.       if critical
  4339.         string = "CRITICAL"
  4340.         bitmap.font.size = 20
  4341.         bitmap.font.color.set(0, 0, 0)
  4342.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4343.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4344.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4345.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4346.         bitmap.font.color.set(255, 255, 255)
  4347.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4348.       end
  4349.       num = @_damage.size
  4350.       if type != 2
  4351.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4352.       else
  4353.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4354.       end
  4355.       @_damage[num][0].bitmap = bitmap
  4356.       @_damage[num][0].ox = 80 + self.viewport.ox
  4357.       @_damage[num][0].oy = 20 + self.viewport.oy
  4358.       if self.battler.is_a?(Game_Actor)
  4359.         @_damage[num][0].x = self.x
  4360.         @_damage[num][0].y = self.y - self.oy / 2
  4361.       else
  4362.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4363.                             self.ox + self.src_rect.width / 2
  4364.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4365.                             self.viewport.rect.y
  4366.         @_damage[num][0].zoom_x = self.zoom_x
  4367.         @_damage[num][0].zoom_y = self.zoom_y
  4368.         @_damage[num][0].z = 3000
  4369.       end
  4370.     end
  4371.     def animation(animation, hit)
  4372.       return if animation == nil
  4373.       num = @_animation.size
  4374.       @_animation.push([animation, hit, animation.frame_max, []])
  4375.       bitmap = RPG::Cache.animation(animation.animation_name,
  4376.                                     animation.animation_hue)
  4377.       if @@_reference_count.include?(bitmap)
  4378.         @@_reference_count[bitmap] += 1
  4379.       else
  4380.         @@_reference_count[bitmap] = 1
  4381.       end
  4382.       if @_animation[num][0].position != 3 or
  4383.           not @@_animations.include?(animation)
  4384.         for i in 0..15
  4385.           sprite = ::Sprite.new
  4386.           sprite.bitmap = bitmap
  4387.           sprite.visible = false
  4388.           @_animation[num][3].push(sprite)
  4389.         end
  4390.         unless @@_animations.include?(animation)
  4391.           @@_animations.push(animation)
  4392.         end
  4393.       end
  4394.       update_animation(@_animation[num])
  4395.     end
  4396.     def loop_animation(animation)
  4397.       return if animation == @_loop_animation
  4398.       dispose_loop_animation
  4399.       @_loop_animation = animation
  4400.       return if @_loop_animation == nil
  4401.       @_loop_animation_index = 0
  4402.       animation_name = @_loop_animation.animation_name
  4403.       animation_hue = @_loop_animation.animation_hue
  4404.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4405.       if @@_reference_count.include?(bitmap)
  4406.         @@_reference_count[bitmap] += 1
  4407.       else
  4408.         @@_reference_count[bitmap] = 1
  4409.       end
  4410.       @_loop_animation_sprites = []
  4411.       for i in 0..15
  4412.         sprite = ::Sprite.new
  4413.         sprite.bitmap = bitmap
  4414.         sprite.visible = false
  4415.         @_loop_animation_sprites.push(sprite)
  4416.       end
  4417.       # update_loop_animation
  4418.     end
  4419.     def dispose_damage
  4420.       for damage in @_damage.reverse
  4421.         damage[0].bitmap.dispose
  4422.         damage[0].dispose
  4423.         @_damage.delete(damage)
  4424.       end
  4425.     end
  4426.     def dispose_animation
  4427.       for anime in @_animation.reverse
  4428.         sprite = anime[3][0]
  4429.         if sprite != nil
  4430.           @@_reference_count[sprite.bitmap] -= 1
  4431.           if @@_reference_count[sprite.bitmap] == 0
  4432.             sprite.bitmap.dispose
  4433.           end
  4434.         end
  4435.         for sprite in anime[3]
  4436.           sprite.dispose
  4437.         end
  4438.         @_animation.delete(anime)
  4439.       end
  4440.     end
  4441.     def effect?
  4442.       @_whiten_duration > 0 or
  4443.       @_appear_duration > 0 or
  4444.       @_escape_duration > 0 or
  4445.       @_collapse_duration > 0 or
  4446.       @_damage.size == 0 or
  4447.       @_animation.size == 0
  4448.     end
  4449.     def update
  4450.       super
  4451.       if @_whiten_duration > 0
  4452.         @_whiten_duration -= 1
  4453.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4454.       end
  4455.       if @_appear_duration > 0
  4456.         @_appear_duration -= 1
  4457.         self.opacity = (16 - @_appear_duration) * 16
  4458.       end
  4459.       if @_escape_duration > 0
  4460.         @_escape_duration -= 1
  4461.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4462.       end
  4463.       if @_collapse_duration > 0
  4464.         @_collapse_duration -= 1
  4465.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4466.       end
  4467.       for damage in @_damage
  4468.         if damage[1] > 0
  4469.           damage[1] -= 1
  4470.           damage[4] -= 3
  4471.           damage[2] -= damage[4]
  4472.           if self.battler.is_a?(Game_Actor)
  4473.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4474.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4475.           else
  4476.             damage[0].x = self.x + self.viewport.rect.x -
  4477.                           self.ox + self.src_rect.width / 2 +
  4478.                           (40 - damage[1]) * damage[3] / 10
  4479.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4480.                           self.viewport.rect.y + damage[2] / 10
  4481.             damage[0].zoom_x = self.zoom_x
  4482.             damage[0].zoom_y = self.zoom_y
  4483.           end
  4484.           damage[0].z = 2960 + damage[1]
  4485.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4486.           if damage[1] == 0
  4487.             damage[0].bitmap.dispose
  4488.             damage[0].dispose
  4489.             @_damage.delete(damage)
  4490.           end
  4491.         end
  4492.       end
  4493.       for anime in @_animation
  4494.         if (Graphics.frame_count % 2 == 0)
  4495.           anime[2] -= 1
  4496.           update_animation(anime)
  4497.         end
  4498.       end
  4499.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4500.         update_loop_animation
  4501.         @_loop_animation_index += 1
  4502.         @_loop_animation_index %= @_loop_animation.frame_max
  4503.       end
  4504.       if @_blink
  4505.         @_blink_count = (@_blink_count + 1) % 32
  4506.         if @_blink_count < 16
  4507.           alpha = (16 - @_blink_count) * 6
  4508.         else
  4509.           alpha = (@_blink_count - 16) * 6
  4510.         end
  4511.         self.color.set(255, 255, 255, alpha)
  4512.       end
  4513.       @@_animations.clear
  4514.     end
  4515.     def update_animation(anime)
  4516.       if anime[2] > 0
  4517.         frame_index = anime[0].frame_max - anime[2]
  4518.         cell_data = anime[0].frames[frame_index].cell_data
  4519.         position = anime[0].position
  4520.         animation_set_sprites(anime[3], cell_data, position)
  4521.         for timing in anime[0].timings
  4522.           if timing.frame == frame_index
  4523.             animation_process_timing(timing, anime[1])
  4524.           end
  4525.         end
  4526.       else
  4527.         @@_reference_count[anime[3][0].bitmap] -= 1
  4528.         if @@_reference_count[anime[3][0].bitmap] == 0
  4529.             anime[3][0].bitmap.dispose
  4530.         end
  4531.         for sprite in anime[3]
  4532.           sprite.dispose
  4533.         end
  4534.         @_animation.delete(anime)
  4535.       end
  4536.     end
  4537.     def animation_set_sprites(sprites, cell_data, position)
  4538.       for i in 0..15
  4539.         sprite = sprites[i]
  4540.         pattern = cell_data[i, 0]
  4541.         if sprite == nil or pattern == nil or pattern == -1
  4542.           sprite.visible = false if sprite != nil
  4543.           next
  4544.         end
  4545.         sprite.visible = true
  4546.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4547.         if position == 3
  4548.           if self.viewport != nil
  4549.             sprite.x = self.viewport.rect.width / 2
  4550.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4551.               sprite.y = self.viewport.rect.height - 320
  4552.             else
  4553.               sprite.y = self.viewport.rect.height - 160
  4554.             end
  4555.           else
  4556.             sprite.x = 320
  4557.             sprite.y = 240
  4558.           end
  4559.         else
  4560.           sprite.x = self.x + self.viewport.rect.x -
  4561.                       self.ox + self.src_rect.width / 2
  4562.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4563.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4564.                         self.viewport.rect.y
  4565.             if position == 0
  4566.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4567.             elsif position == 2
  4568.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4569.             end
  4570.           else
  4571.             sprite.y = self.y + self.viewport.rect.y -
  4572.                         self.oy + self.src_rect.height / 2
  4573.             sprite.y -= self.src_rect.height / 4 if position == 0
  4574.             sprite.y += self.src_rect.height / 4 if position == 2
  4575.           end
  4576.         end
  4577.         sprite.x += cell_data[i, 1]
  4578.         sprite.y += cell_data[i, 2]
  4579.         sprite.z = 2000
  4580.         sprite.ox = 96
  4581.         sprite.oy = 96
  4582.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4583.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4584.         if position != 3
  4585.           sprite.zoom_x *= self.zoom_x
  4586.           sprite.zoom_y *= self.zoom_y
  4587.         end
  4588.         sprite.angle = cell_data[i, 4]
  4589.         sprite.mirror = (cell_data[i, 5] == 1)
  4590.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4591.         sprite.blend_type = cell_data[i, 7]
  4592.       end
  4593.     end
  4594.     def x=(x)
  4595.       sx = x - self.x
  4596.       if sx != 0
  4597.         for anime in @_animation
  4598.           if anime[3] != nil
  4599.             for i in 0..15
  4600.               anime[3][i].x += sx
  4601.             end
  4602.           end
  4603.         end
  4604.         if @_loop_animation_sprites != nil
  4605.           for i in 0..15
  4606.             @_loop_animation_sprites[i].x += sx
  4607.           end
  4608.         end
  4609.       end
  4610.       super
  4611.     end
  4612.     def y=(y)
  4613.       sy = y - self.y
  4614.       if sy != 0
  4615.         for anime in @_animation
  4616.           if anime[3] != nil
  4617.             for i in 0..15
  4618.               anime[3][i].y += sy
  4619.             end
  4620.           end
  4621.         end
  4622.         if @_loop_animation_sprites != nil
  4623.           for i in 0..15
  4624.             @_loop_animation_sprites[i].y += sy
  4625.           end
  4626.         end
  4627.       end
  4628.       super
  4629.     end
  4630.   end
  4631. end

  4632. #------------------------------------------------------------------------------
  4633. #  Bitmapクラスに新たな機能を追加します。
  4634. #==============================================================================

  4635. class Bitmap
  4636.   #--------------------------------------------------------------------------
  4637.   # ● 矩形をグラデーション表示
  4638.   #     color1 : スタートカラー
  4639.   #     color2 : エンドカラー
  4640.   #     align  :  0:横にグラデーション
  4641.   #               1:縦にグラデーション
  4642.   #               2:斜めにグラデーション(激重につき注意)
  4643.   #--------------------------------------------------------------------------
  4644.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4645.     if align == 0
  4646.       for i in x...x + width
  4647.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4648.         green = color1.green +
  4649.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4650.         blue  = color1.blue +
  4651.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4652.         alpha = color1.alpha +
  4653.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4654.         color = Color.new(red, green, blue, alpha)
  4655.         fill_rect(i, y, 1, height, color)
  4656.       end
  4657.     elsif align == 1
  4658.       for i in y...y + height
  4659.         red   = color1.red +
  4660.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4661.         green = color1.green +
  4662.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4663.         blue  = color1.blue +
  4664.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4665.         alpha = color1.alpha +
  4666.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4667.         color = Color.new(red, green, blue, alpha)
  4668.         fill_rect(x, i, width, 1, color)
  4669.       end
  4670.     elsif align == 2
  4671.       for i in x...x + width
  4672.         for j in y...y + height
  4673.           red   = color1.red + (color2.red - color1.red) *
  4674.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4675.           green = color1.green + (color2.green - color1.green) *
  4676.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4677.           blue  = color1.blue + (color2.blue - color1.blue) *
  4678.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4679.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4680.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4681.           color = Color.new(red, green, blue, alpha)
  4682.           set_pixel(i, j, color)
  4683.         end
  4684.       end
  4685.     elsif align == 3
  4686.       for i in x...x + width
  4687.         for j in y...y + height
  4688.           red   = color1.red + (color2.red - color1.red) *
  4689.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4690.           green = color1.green + (color2.green - color1.green) *
  4691.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4692.           blue  = color1.blue + (color2.blue - color1.blue) *
  4693.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4694.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4695.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4696.           color = Color.new(red, green, blue, alpha)
  4697.           set_pixel(i, j, color)
  4698.         end
  4699.       end
  4700.     end
  4701.   end
  4702. end
复制代码
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

 楼主| 发表于 2014-11-3 00:47:22 | 显示全部楼层
你最珍贵 发表于 2014-11-2 22:10
全局搜索def damage_effect
这样看不出来
  1.   def damage_effect(battler, item)
  2.     if item == 2
  3.       self.hp += self.recover_hp[battler]
  4.       self.sp += self.recover_sp[battler]
  5.       if self.recover_sp[battler] != 0
  6.         self.damage_sp[battler] = -self.recover_sp[battler]
  7.       end
  8.       self.recover_hp.delete(battler)
  9.       self.recover_sp.delete(battler)
  10.     else
  11.       if self.damage[battler].class != String
  12.         self.hp -= self.damage[battler]
  13.       end
  14.     end
  15.     for i in self.state_p[battler]
  16.       add_state(i)
  17.     end
  18.     for i in self.state_m[battler]
  19.       remove_state(i)
  20.     end
  21.   end
复制代码
回复

使用道具 举报

故九江太守

梦石
0
星屑
334
在线时间
2159 小时
注册时间
2012-12-5
回帖
4323
发表于 2014-11-3 12:23:57 | 显示全部楼层
skill应该才是多余的

点评

恩,删掉SKILL和NIL也可以不报错  发表于 2014-11-3 18:22

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 塞糖

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部