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

Project1

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

[已经解决] 请教一个RMXP的问题,如何把RTAB停下来等待

[复制链接]

Lv2.观梦者

梦石
0
星屑
564
在线时间
169 小时
注册时间
2008-10-29
帖子
431
跳转到指定楼层
1
发表于 2017-1-4 19:27:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
很久没有用RMXP了,记得以前用过这个横版的RTAB系统,
看了一下默认状态下是动态的
就是当你再打开动作菜单,选择攻击目标的时候 RTAB进度条还在走
其中有个参数@active当把它改成0以后,你选择技能,选择目标的时候 RTAB进度就停止了
现在我想改一下  当人物的RT条满了 弹出命令面板的时候 RTAB进度条就停下来等待
请问该怎么改  
我以前改成功过 但现在完全忘记了  请大神帮看一下
工程再附件里

rtabinhengban.zip

1.24 MB, 下载次数: 36

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

2
发表于 2017-1-12 15:22:46 | 只看该作者
在我测试的 RTAB 版本中,只要把@active参数改成0,就是楼主想要的效果。
不知道是不是 RTAB 脚本版本的问题。

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
564
在线时间
169 小时
注册时间
2008-10-29
帖子
431
3
 楼主| 发表于 2017-1-12 15:26:07 | 只看该作者
RyanBern 发表于 2017-1-12 15:22
在我测试的 RTAB 版本中,只要把@active参数改成0,就是楼主想要的效果。
不知道是不是 RTAB 脚本版本的问 ...

是啦是啦 我今天改成了0 发现又可以了 应该是上次试的时候BUG了吧 谢谢你哈
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 22:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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