查看: 950|回复: 0

[已经过期] 请教一下RTAB动画的问题

[复制链接]
梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2017-1-12 17:06:33 | 显示全部楼层 |阅读模式

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

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

×
如下图片所示
左边的是我军  右边是敌军
在技能动画显示的时候  敌军释放技能没有问题
但是在我军释放技能的时候,技能动画的中间被切开了 这是什么原因照成的!
还是本身技能动画素材的问题  如果是 那为什么敌军那里显示没问题  而我军却有问题呢?

  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
  3. # ————————————————————————————————————

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

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

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

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

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

  477. #==============================================================================
  478. # ■ Scene_Battle (分割定義 2)
  479. #------------------------------------------------------------------------------
  480. #  バトル画面の処理を行うクラスです。
  481. #==============================================================================

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

  844. #==============================================================================
  845. # ■ Scene_Battle (分割定義 3)
  846. #------------------------------------------------------------------------------
  847. #  バトル画面の処理を行うクラスです。
  848. #==============================================================================

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

  1369. #==============================================================================
  1370. # ■ Scene_Battle (分割定義 4)
  1371. #------------------------------------------------------------------------------
  1372. #  バトル画面の処理を行うクラスです。
  1373. #==============================================================================

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

  2289. #==============================================================================
  2290. # ■ Game_Actor
  2291. #------------------------------------------------------------------------------
  2292. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2293. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2294. #==============================================================================

  2295. #class Game_Actor < Game_Battler
  2296.   #--------------------------------------------------------------------------
  2297.   # ● バトル画面 X 座標の取得
  2298.   #--------------------------------------------------------------------------
  2299. #  def screen_x
  2300.     # パーティ内の並び順から X 座標を計算して返す
  2301. #    if self.index != nil
  2302. #      return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2303. #    else
  2304. #      return 0
  2305. #    end
  2306. #  end
  2307. #end

  2308. #==============================================================================
  2309. # ■ Spriteset_Battle
  2310. #------------------------------------------------------------------------------
  2311. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2312. # スの内部で使用されます。
  2313. #==============================================================================

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

  2510. #==============================================================================
  2511. # ■ Game_Battler (分割定義 1)
  2512. #------------------------------------------------------------------------------
  2513. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2514. # スのスーパークラスとして使用されます。
  2515. #==============================================================================

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

  3000. #==============================================================================
  3001. # ■ Game_BattleAction
  3002. #------------------------------------------------------------------------------
  3003. #  アクション (戦闘中の行動) を扱うクラスです。このクラスは Game_Battler クラ
  3004. # スの内部で使用されます。
  3005. #==============================================================================

  3006. class Game_BattleAction
  3007.   #--------------------------------------------------------------------------
  3008.   # ● 公開インスタンス変数
  3009.   #--------------------------------------------------------------------------
  3010.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3011.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3012.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3013.   attr_accessor :force_skill_id           # スキル ID
  3014.   #--------------------------------------------------------------------------
  3015.   # ● 有効判定
  3016.   #--------------------------------------------------------------------------
  3017.   def valid?
  3018.     return (not (@force_kind == 0 and @force_basic == 3))
  3019.   end
  3020. end

  3021. #==============================================================================
  3022. # ■ Game_Actor
  3023. #------------------------------------------------------------------------------
  3024. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3025. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3026. #==============================================================================

  3027. class Game_Actor < Game_Battler
  3028.   def skill_can_use?(skill_id)
  3029.     return super
  3030.   end
  3031. end

  3032. #==============================================================================
  3033. # ■ Game_Enemy
  3034. #------------------------------------------------------------------------------
  3035. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3036. # 内部で使用されます。
  3037. #==============================================================================

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

  3185. #==============================================================================
  3186. # ■ Game_Party
  3187. #------------------------------------------------------------------------------
  3188. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3189. # ラスのインスタンスは $game_party で参照されます。
  3190. #==============================================================================

  3191. class Game_Party
  3192.   #--------------------------------------------------------------------------
  3193.   # ● 全滅判定
  3194.   #--------------------------------------------------------------------------
  3195.   def all_dead?
  3196.     # パーティ人数が 0 人の場合
  3197.     if $game_party.actors.size == 0
  3198.       return false
  3199.     end
  3200.     # HP 0 以上のアクターがパーティにいる場合
  3201.     for actor in @actors
  3202.       if actor.hp > 0 or actor.damage.size > 0
  3203.         return false
  3204.       end
  3205.     end
  3206.     # 全滅
  3207.     return true
  3208.   end
  3209. end

  3210. #==============================================================================
  3211. # ■ Sprite_Battler
  3212. #------------------------------------------------------------------------------
  3213. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3214. # スプライトの状態を自動的に変化させます。
  3215. #==============================================================================

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

  3348. #==============================================================================
  3349. # ■ Window_Base
  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. # ■ Window_Help
  3407. #------------------------------------------------------------------------------
  3408. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3409. #==============================================================================

  3410. class Window_Help < Window_Base
  3411.   #--------------------------------------------------------------------------
  3412.   # ● エネミー設定
  3413.   #     enemy : 名前とステートを表示するエネミー
  3414.   #--------------------------------------------------------------------------
  3415.   def set_enemy(enemy)
  3416.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3417.     state_text = make_battler_state_text(enemy, 112, false)
  3418.     if state_text != ""
  3419.       text += "  " + state_text
  3420.     end
  3421.     set_text(text, 1)
  3422.   end
  3423. end

  3424. #==============================================================================
  3425. # ■ Window_BattleStatus
  3426. #------------------------------------------------------------------------------
  3427. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3428. #==============================================================================

  3429. class Window_BattleStatus < Window_Base
  3430.   #--------------------------------------------------------------------------
  3431.   # ● オブジェクト初期化
  3432.   #--------------------------------------------------------------------------
  3433.   def initialize
  3434.     x = 0#(3 - $game_party.actors.size) * 80
  3435.     width = 640#$game_party.actors.size * 160
  3436.     super(x, 380, width, 100)
  3437.     self.back_opacity = 0
  3438.     @actor_window = []
  3439.     for i in 0...$game_party.actors.size
  3440.       @actor_window.push(Window_ActorStatus.new(i, x + i * 240))
  3441.     end
  3442.     @level_up_flags = [false, false, false, false]
  3443.     refresh
  3444.   end
  3445.   #--------------------------------------------------------------------------
  3446.   # ● 解放
  3447.   #--------------------------------------------------------------------------
  3448.   def dispose
  3449.     for window in @actor_window
  3450.       window.dispose
  3451.     end
  3452.     super
  3453.   end
  3454.   #--------------------------------------------------------------------------
  3455.   # ● リフレッシュ
  3456.   #--------------------------------------------------------------------------
  3457.   def refresh(number = 0)
  3458.     if number == 0
  3459.       cnt = 0
  3460.       for window in @actor_window
  3461.         window.refresh(@level_up_flags[cnt])
  3462.         cnt += 1
  3463.       end
  3464.     else
  3465.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3466.     end
  3467.   end
  3468.   #--------------------------------------------------------------------------
  3469.   # ● ATゲージリフレッシュ
  3470.   #--------------------------------------------------------------------------
  3471.   def at_refresh(number = 0)
  3472.     if number == 0
  3473.       for window in @actor_window
  3474.         window.at_refresh
  3475.       end
  3476.     else
  3477.       @actor_window[number - 1].at_refresh
  3478.     end
  3479.   end
  3480.   #--------------------------------------------------------------------------
  3481.   # ● フレーム更新
  3482.   #--------------------------------------------------------------------------
  3483.   def update
  3484.     super
  3485.     if self.x != (3 - $game_party.actors.size) * 80
  3486.       self.x = 0#(3 - $game_party.actors.size) * 80
  3487.       self.width = 640#$game_party.actors.size * 160
  3488.       for window in @actor_window
  3489.         window.dispose
  3490.       end
  3491.       @actor_window = []
  3492.       for i in 0...$game_party.actors.size
  3493.         @actor_window.push(Window_ActorStatus.new(i, x + i * 240))
  3494.       end
  3495.       refresh
  3496.     end
  3497.     for window in @actor_window
  3498.       window.update
  3499.     end
  3500.   end
  3501. end

  3502. #==============================================================================
  3503. # ■ Window_ActorStatus
  3504. #------------------------------------------------------------------------------
  3505. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3506. #==============================================================================

  3507. class Window_ActorStatus < Window_Base
  3508.   #--------------------------------------------------------------------------
  3509.   # ● オブジェクト初期化
  3510.   #--------------------------------------------------------------------------
  3511.   def initialize(id, x)
  3512.     @actor_num = id
  3513.     super(x, 320, 160, 160)
  3514.     self.contents = Bitmap.new(width - 32, height - 32)
  3515.     self.opacity = 0
  3516.     self.back_opacity = 0
  3517.     actor = $game_party.actors[@actor_num]
  3518.     @actor_nm = actor.name
  3519.     @actor_mhp = actor.maxhp
  3520.     @actor_msp = actor.maxsp
  3521.     @actor_hp = actor.hp
  3522.     @actor_sp = actor.sp
  3523.     @actor_st = make_battler_state_text(actor, 120, true)
  3524.     @status_window = []
  3525.     for i in 0...5
  3526.       @status_window.push(Window_DetailsStatus.new(actor, i, x))
  3527.     end
  3528.     refresh(false)
  3529.   end
  3530.   #--------------------------------------------------------------------------
  3531.   # ● 解放
  3532.   #--------------------------------------------------------------------------
  3533.   def dispose
  3534.     for i in 0...5
  3535.       @status_window[i].dispose
  3536.     end
  3537.     super
  3538.   end
  3539.   #--------------------------------------------------------------------------
  3540.   # ● リフレッシュ
  3541.   #--------------------------------------------------------------------------
  3542.   def refresh(level_up_flags)
  3543.     self.contents.clear
  3544.     actor = $game_party.actors[@actor_num]
  3545.     @status_window[0].refresh(actor) if @actor_nm != actor.name
  3546.     @status_window[1].refresh(actor) if
  3547.       @actor_mhp != actor.maxhp or @actor_hp != actor.hp
  3548.     @status_window[2].refresh(actor) if
  3549.       @actor_msp != actor.maxsp or @actor_sp != actor.sp
  3550.     @status_window[3].refresh(actor, level_up_flags) if
  3551.       @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
  3552.     @actor_nm = actor.name
  3553.     @actor_mhp = actor.maxhp
  3554.     @actor_msp = actor.maxsp
  3555.     @actor_hp = actor.hp
  3556.     @actor_sp = actor.sp
  3557.     @actor_st = make_battler_state_text(actor, 120, true)
  3558.   end
  3559.   #--------------------------------------------------------------------------
  3560.   # ● ATゲージリフレッシュ
  3561.   #--------------------------------------------------------------------------
  3562.   def at_refresh
  3563.     @status_window[4].refresh($game_party.actors[@actor_num])
  3564.   end
  3565.   #--------------------------------------------------------------------------
  3566.   # ● フレーム更新
  3567.   #--------------------------------------------------------------------------
  3568.   def update
  3569.     for window in @status_window
  3570.       window.update
  3571.     end
  3572.   end
  3573. end

  3574. #==============================================================================
  3575. # ■ Window_DetailsStatus
  3576. #------------------------------------------------------------------------------
  3577. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3578. #==============================================================================

  3579. class Window_DetailsStatus < Window_Base
  3580.   #--------------------------------------------------------------------------
  3581.   # ● オブジェクト初期化
  3582.   #--------------------------------------------------------------------------
  3583.   def initialize(actor, id, x)
  3584.     @status_id = id
  3585.     super(x, 360 + id * 15, 160, 64)# + id * 30
  3586.     self.contents = Bitmap.new(width - 32, height - 32)
  3587.     self.opacity = 0
  3588.     self.back_opacity = 0
  3589.     refresh(actor, false)
  3590.   end
  3591.   #--------------------------------------------------------------------------
  3592.   # ● 解放
  3593.   #--------------------------------------------------------------------------
  3594.   def dispose
  3595.     super
  3596.   end
  3597.   #--------------------------------------------------------------------------
  3598.   # ● リフレッシュ
  3599.   #--------------------------------------------------------------------------
  3600.   def refresh(actor, level_up_flags = false)
  3601.     self.contents.clear
  3602.     self.contents.font.size = 16
  3603.     case @status_id
  3604.     when 0
  3605.       draw_actor_name(actor, 4, 0)
  3606.     when 1
  3607.       draw_actor_hp(actor, 4, 0, 120)
  3608.    # when 2
  3609.    #   draw_actor_atg(actor, 4, 0, 120)
  3610.     when 3
  3611.       if level_up_flags
  3612.         self.contents.font.color = normal_color
  3613.         self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
  3614.       else
  3615.         draw_actor_state(actor, 4, 0)
  3616.       end
  3617.     when 4
  3618.       draw_actor_atg(actor, 4, 0, 120)
  3619.     end
  3620.   end
  3621.   #--------------------------------------------------------------------------
  3622.   # ● フレーム更新
  3623.   #--------------------------------------------------------------------------
  3624.   def update
  3625.     # メインフェーズのときは不透明度をやや下げる
  3626.     if $game_temp.battle_main_phase
  3627.       self.contents_opacity -= 4 if self.contents_opacity > 191
  3628.     else
  3629.       self.contents_opacity += 4 if self.contents_opacity < 255
  3630.     end
  3631.   end
  3632. end

  3633. #==============================================================================
  3634. # ■ Arrow_Base
  3635. #------------------------------------------------------------------------------
  3636. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3637. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3638. #==============================================================================

  3639. class Arrow_Base < Sprite
  3640.   #--------------------------------------------------------------------------
  3641.   # ● オブジェクト初期化
  3642.   #     viewport : ビューポート
  3643.   #--------------------------------------------------------------------------
  3644.   def initialize(viewport)
  3645.     super(viewport)
  3646.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3647.     self.ox = 16
  3648.     self.oy = 32
  3649.     self.z = 2500
  3650.     @blink_count = 0
  3651.     @index = 0
  3652.     @help_window = nil
  3653.     update
  3654.   end
  3655. end

  3656. #==============================================================================
  3657. # ■ Arrow_Enemy
  3658. #------------------------------------------------------------------------------
  3659. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3660. # スを継承します。
  3661. #==============================================================================

  3662. class Arrow_Enemy < Arrow_Base
  3663.   #--------------------------------------------------------------------------
  3664.   # ● フレーム更新
  3665.   #--------------------------------------------------------------------------
  3666.   def update
  3667.     super
  3668.     # 存在しないエネミーを指していたら飛ばす
  3669.     $game_troop.enemies.size.times do
  3670.       break if self.enemy.exist?
  3671.       @index += 1
  3672.       @index %= $game_troop.enemies.size
  3673.     end
  3674.     # カーソル右
  3675.     if Input.repeat?(Input::RIGHT)
  3676.       $game_system.se_play($data_system.cursor_se)
  3677.       $game_troop.enemies.size.times do
  3678.         @index += 1
  3679.         @index %= $game_troop.enemies.size
  3680.         break if self.enemy.exist?
  3681.       end
  3682.       $scene.camera = "select"
  3683.       zoom = 1 / self.enemy.zoom
  3684.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3685.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  3686.     end
  3687.     # カーソル左
  3688.     if Input.repeat?(Input::LEFT)
  3689.       $game_system.se_play($data_system.cursor_se)
  3690.       $game_troop.enemies.size.times do
  3691.         @index += $game_troop.enemies.size - 1
  3692.         @index %= $game_troop.enemies.size
  3693.         break if self.enemy.exist?
  3694.       end
  3695.       $scene.camera = "select"
  3696.       zoom = 1 / self.enemy.zoom
  3697.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  3698.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  3699.     end
  3700.     # スプライトの座標を設定
  3701.     if self.enemy != nil
  3702.       self.x = self.enemy.screen_x
  3703.       self.y = self.enemy.screen_y
  3704.     end
  3705.   end
  3706. end

  3707. #==============================================================================
  3708. # ■ Interpreter
  3709. #------------------------------------------------------------------------------
  3710. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  3711. # スや Game_Event クラスの内部で使用されます。
  3712. #==============================================================================

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

  3949. #==============================================================================
  3950. # ■ Spriteモジュール
  3951. #------------------------------------------------------------------------------
  3952. #  アニメーションの管理を行うモジュールです。
  3953. #==============================================================================

  3954. module RPG
  3955.   class Sprite < ::Sprite
  3956.     def initialize(viewport = nil)
  3957.       super(viewport)
  3958.       
  3959.       @_cp1_damage_duration = 0
  3960.       
  3961.       @_whiten_duration = 0
  3962.       @_appear_duration = 0
  3963.       @_escape_duration = 0
  3964.       @_collapse_duration = 0
  3965.       @_damage = []
  3966.       @_animation = []
  3967.       @_animation_duration = 0
  3968.       @_blink = false
  3969.     end
  3970.     def damage(value, critical, type = 0)
  3971.       if value.is_a?(Numeric)
  3972.         damage_string = value.abs.to_s
  3973.       else
  3974.         damage_string = value.to_s
  3975.       end
  3976.       bitmap = Bitmap.new(160, 48)
  3977.       bitmap.font.name = "Arial Black"
  3978.       bitmap.font.size = 32
  3979.       bitmap.font.color.set(0, 0, 0)
  3980.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  3981.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  3982.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  3983.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  3984.       if value.is_a?(Numeric) and value < 0
  3985.         if type == 0
  3986.           bitmap.font.color.set(176, 255, 144)
  3987.         else
  3988.           bitmap.font.color.set(176, 144, 255)
  3989.         end
  3990.       else
  3991.         if type == 0
  3992.           bitmap.font.color.set(255, 255, 255)
  3993.         else
  3994.           bitmap.font.color.set(255, 176, 144)
  3995.         end
  3996.       end
  3997.       if type == 2
  3998.         bitmap.font.color.set(255, 224, 128)
  3999.       end
  4000.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  4001.       if critical
  4002.         string = "CRITICAL"
  4003.         bitmap.font.size = 20
  4004.         bitmap.font.color.set(0, 0, 0)
  4005.         bitmap.draw_text(-1, -1, 160, 20, string, 1)
  4006.         bitmap.draw_text(+1, -1, 160, 20, string, 1)
  4007.         bitmap.draw_text(-1, +1, 160, 20, string, 1)
  4008.         bitmap.draw_text(+1, +1, 160, 20, string, 1)
  4009.         bitmap.font.color.set(255, 255, 255)
  4010.         bitmap.draw_text(0, 0, 160, 20, string, 1)
  4011.       end
  4012.       num = @_damage.size
  4013.       if type != 2
  4014.         @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
  4015.       else
  4016.         @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
  4017.       end
  4018.       @_damage[num][0].bitmap = bitmap
  4019.       @_damage[num][0].ox = 80 + self.viewport.ox
  4020.       @_damage[num][0].oy = 20 + self.viewport.oy
  4021.       if self.battler.is_a?(Game_Actor)
  4022.         @_damage[num][0].x = self.x
  4023.         @_damage[num][0].y = self.y - self.oy / 2
  4024.       else
  4025.         @_damage[num][0].x = self.x + self.viewport.rect.x -
  4026.                             self.ox + self.src_rect.width / 2
  4027.         @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
  4028.                             self.viewport.rect.y
  4029.         @_damage[num][0].zoom_x = self.zoom_x
  4030.         @_damage[num][0].zoom_y = self.zoom_y
  4031.         @_damage[num][0].z = 3000
  4032.       end
  4033.     end
  4034.    
  4035.    def cp1_damage(value)  #
  4036.      dispose_cp1_damage
  4037.      if value.is_a?(Numeric)
  4038.        damage_string = value.abs.to_s
  4039.      else
  4040.        damage_string = value.to_s
  4041.      end
  4042.      #bitmap = Bitmap.new("Graphics/Pictures/cp1")
  4043.      bitmap = Bitmap.new(160+1000, 48)
  4044.      bitmap.font.name = ["方正楷体繁体","方正隶变_GBK"]
  4045.      bitmap.font.size = 20
  4046.      bitmap.font.color.set(0, 0, 0)
  4047.      bitmap.draw_text(10, 10, 160+1000, 36, damage_string, 0)
  4048.      bitmap.draw_text(10, 10, 160+1000, 36, damage_string, 0)
  4049.      bitmap.draw_text(10, 10, 160+1000, 36, damage_string, 0)
  4050.      bitmap.draw_text(10, 10, 160+1000, 36, damage_string, 0)
  4051.      if value.is_a?(Numeric) and value < 0
  4052.        bitmap.font.color.set(255, 40, 40)   
  4053.      else
  4054.        bitmap.font.color.set(245, 0, 40)
  4055.      end
  4056.      bitmap.draw_text(10, 10, 160+1000, 36, damage_string, 0)
  4057.      @_cp1_damage_sprite = ::Sprite.new(Viewport.new(0, 0, 640, 480))
  4058.      @_cp1_damage_sprite.bitmap = bitmap
  4059.      @_cp1_damage_sprite.ox = 80
  4060.      @_cp1_damage_sprite.oy = 100
  4061.      @_cp1_damage_sprite.x = self.x
  4062.      @_cp1_damage_sprite.y = self.y
  4063.      @_cp1_damage_sprite.z = 9995
  4064.      @_cp1_damage_sprite.viewport.z = self.viewport.z + 1
  4065.      @_cp1_damage_duration = 100
  4066.    end
  4067.    def dispose_cp1_damage
  4068.      if @_cp1_damage_sprite != nil
  4069.        @_cp1_damage_sprite.viewport.dispose
  4070.        @_cp1_damage_sprite.bitmap.dispose
  4071.        @_cp1_damage_sprite.dispose
  4072.        @_cp1_damage_sprite = nil
  4073.        @_cp1_damage_duration = 0
  4074.      end
  4075.    end
  4076.    
  4077.    
  4078.    
  4079.     def animation(animation, hit)
  4080.       return if animation == nil
  4081.       num = @_animation.size
  4082.       @_animation.push([animation, hit, animation.frame_max, []])
  4083.       bitmap = RPG::Cache.animation(animation.animation_name,
  4084.                                     animation.animation_hue)
  4085.       if @@_reference_count.include?(bitmap)
  4086.         @@_reference_count[bitmap] += 1
  4087.       else
  4088.         @@_reference_count[bitmap] = 1
  4089.       end
  4090.       if @_animation[num][0] != 3 or not @@_animations.include?(animation)
  4091.         for i in 0..15
  4092.           sprite = ::Sprite.new
  4093.           sprite.bitmap = bitmap
  4094.           sprite.visible = false
  4095.           @_animation[num][3].push(sprite)
  4096.         end
  4097.         unless @@_animations.include?(animation)
  4098.           @@_animations.push(animation)
  4099.         end
  4100.       end
  4101.       update_animation(@_animation[num])
  4102.     end
  4103.     def loop_animation(animation)
  4104.       return if animation == @_loop_animation
  4105.       dispose_loop_animation
  4106.       @_loop_animation = animation
  4107.       return if @_loop_animation == nil
  4108.       @_loop_animation_index = 0
  4109.       animation_name = @_loop_animation.animation_name
  4110.       animation_hue = @_loop_animation.animation_hue
  4111.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  4112.       if @@_reference_count.include?(bitmap)
  4113.         @@_reference_count[bitmap] += 1
  4114.       else
  4115.         @@_reference_count[bitmap] = 1
  4116.       end
  4117.       @_loop_animation_sprites = []
  4118.       for i in 0..15
  4119.         sprite = ::Sprite.new
  4120.         sprite.bitmap = bitmap
  4121.         sprite.visible = false
  4122.         @_loop_animation_sprites.push(sprite)
  4123.       end
  4124.       update_loop_animation
  4125.     end
  4126.     def dispose_damage
  4127.       dispose_cp1_damage
  4128.       for damage in @_damage.reverse
  4129.         damage[0].bitmap.dispose
  4130.         damage[0].dispose
  4131.         @_damage.delete(damage)
  4132.       end
  4133.     end
  4134.     def dispose_animation
  4135.       for anime in @_animation.reverse
  4136.         sprite = anime[3][0]
  4137.         if sprite != nil
  4138.           @@_reference_count[sprite.bitmap] -= 1
  4139.           if @@_reference_count[sprite.bitmap] == 0
  4140.             sprite.bitmap.dispose
  4141.           end
  4142.         end
  4143.         for sprite in anime[3]
  4144.           sprite.dispose
  4145.         end
  4146.         @_animation.delete(anime)
  4147.       end
  4148.     end
  4149.     def effect?
  4150.       @_whiten_duration > 0 or
  4151.       @_appear_duration > 0 or
  4152.       @_escape_duration > 0 or
  4153.       @_collapse_duration > 0 or
  4154.       @_damage.size == 0 or
  4155.       @_animation.size == 0
  4156.     end
  4157.     def update
  4158.       super
  4159.       if @_whiten_duration > 0
  4160.         @_whiten_duration -= 1
  4161.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  4162.       end
  4163.       if @_appear_duration > 0
  4164.         @_appear_duration -= 1
  4165.         self.opacity = (16 - @_appear_duration) * 16
  4166.       end
  4167.       if @_escape_duration > 0
  4168.         @_escape_duration -= 1
  4169.         self.opacity = 256 - (32 - @_escape_duration) * 10
  4170.       end
  4171.       if @_collapse_duration > 0
  4172.         @_collapse_duration -= 1
  4173.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  4174.       end
  4175.       
  4176.     if @_cp1_damage_duration > 0
  4177.        @_cp1_damage_duration -= 1
  4178.        @_cp1_damage_sprite.opacity = 256 - (12 - @_cp1_damage_duration) * 32
  4179.        if @_cp1_damage_duration == 0
  4180.          dispose_cp1_damage
  4181.        end
  4182.      end   
  4183.       
  4184.       
  4185.       for damage in @_damage
  4186.         if damage[1] > 0
  4187.           damage[1] -= 1
  4188.           damage[4] -= 3
  4189.           damage[2] -= damage[4]
  4190.           if self.battler.is_a?(Game_Actor)
  4191.             damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
  4192.             damage[0].y = self.y - self.oy / 2 + damage[2] / 10
  4193.           else
  4194.             damage[0].x = self.x + self.viewport.rect.x -
  4195.                           self.ox + self.src_rect.width / 2 +
  4196.                           (40 - damage[1]) * damage[3] / 10
  4197.             damage[0].y = self.y - self.oy * self.zoom_y / 2 +
  4198.                           self.viewport.rect.y + damage[2] / 10
  4199.             damage[0].zoom_x = self.zoom_x
  4200.             damage[0].zoom_y = self.zoom_y
  4201.           end
  4202.           damage[0].z = 2960 + damage[1]
  4203.           damage[0].opacity = 256 - (12 - damage[1]) * 32
  4204.           if damage[1] == 0
  4205.             damage[0].bitmap.dispose
  4206.             damage[0].dispose
  4207.             @_damage.delete(damage)
  4208.           end
  4209.         end
  4210.       end
  4211.       for anime in @_animation
  4212.         if (Graphics.frame_count % 2 == 0)
  4213.           anime[2] -= 1
  4214.           update_animation(anime)
  4215.         end
  4216.       end
  4217.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  4218.         update_loop_animation
  4219.         @_loop_animation_index += 1
  4220.         @_loop_animation_index %= @_loop_animation.frame_max
  4221.       end
  4222.       if @_blink
  4223.         @_blink_count = (@_blink_count + 1) % 32
  4224.         if @_blink_count < 16
  4225.           alpha = (16 - @_blink_count) * 6
  4226.         else
  4227.           alpha = (@_blink_count - 16) * 6
  4228.         end
  4229.         self.color.set(255, 255, 255, alpha)
  4230.       end
  4231.       @@_animations.clear
  4232.     end
  4233.     def update_animation(anime)
  4234.       if anime[2] > 0
  4235.         frame_index = anime[0].frame_max - anime[2]
  4236.         cell_data = anime[0].frames[frame_index].cell_data
  4237.         position = anime[0].position
  4238.         animation_set_sprites(anime[3], cell_data, position)
  4239.         for timing in anime[0].timings
  4240.           if timing.frame == frame_index
  4241.             animation_process_timing(timing, anime[1])
  4242.           end
  4243.         end
  4244.       else
  4245.         @@_reference_count[anime[3][0].bitmap] -= 1
  4246.         if @@_reference_count[anime[3][0].bitmap] == 0
  4247.             anime[3][0].bitmap.dispose
  4248.         end
  4249.         for sprite in anime[3]
  4250.           sprite.dispose
  4251.         end
  4252.         @_animation.delete(anime)
  4253.       end
  4254.     end
  4255.     def animation_set_sprites(sprites, cell_data, position)
  4256.       for i in 0..15
  4257.         sprite = sprites[i]
  4258.         pattern = cell_data[i, 0]
  4259.         if sprite == nil or pattern == nil or pattern == -1
  4260.           sprite.visible = false if sprite != nil
  4261.           next
  4262.         end
  4263.         sprite.visible = true
  4264.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  4265.         if position == 3
  4266.           if self.viewport != nil
  4267.             sprite.x = self.viewport.rect.width / 2
  4268.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4269.               sprite.y = self.viewport.rect.height - 320
  4270.             else
  4271.               sprite.y = self.viewport.rect.height - 160
  4272.             end
  4273.           else
  4274.             sprite.x = 320
  4275.             sprite.y = 240
  4276.           end
  4277.         else
  4278.           sprite.x = self.x + self.viewport.rect.x -
  4279.                       self.ox + self.src_rect.width / 2
  4280.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  4281.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  4282.                         self.viewport.rect.y
  4283.             if position == 0
  4284.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  4285.             elsif position == 2
  4286.               sprite.y += self.src_rect.height * self.zoom_y / 4
  4287.             end
  4288.           else
  4289.             sprite.y = self.y + self.viewport.rect.y -
  4290.                         self.oy + self.src_rect.height / 2
  4291.             sprite.y -= self.src_rect.height / 4 if position == 0
  4292.             sprite.y += self.src_rect.height / 4 if position == 2
  4293.           end
  4294.         end
  4295.         sprite.x += cell_data[i, 1]
  4296.         sprite.y += cell_data[i, 2]
  4297.         sprite.z = 2000
  4298.         sprite.ox = 96
  4299.         sprite.oy = 96
  4300.         sprite.zoom_x = cell_data[i, 3] / 100.0
  4301.         sprite.zoom_y = cell_data[i, 3] / 100.0
  4302.         if position != 3
  4303.           sprite.zoom_x *= self.zoom_x
  4304.           sprite.zoom_y *= self.zoom_y
  4305.         end
  4306.         sprite.angle = cell_data[i, 4]
  4307.         sprite.mirror = (cell_data[i, 5] == 1)
  4308.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  4309.         sprite.blend_type = cell_data[i, 7]
  4310.       end
  4311.     end
  4312.     def x=(x)
  4313.       sx = x - self.x
  4314.       if sx != 0
  4315.         for anime in @_animation
  4316.           if anime[3] != nil
  4317.             for i in 0..15
  4318.               anime[3][i].x += sx
  4319.             end
  4320.           end
  4321.         end
  4322.         if @_loop_animation_sprites != nil
  4323.           for i in 0..15
  4324.             @_loop_animation_sprites[i].x += sx
  4325.           end
  4326.         end
  4327.       end
  4328.       super
  4329.     end
  4330.     def y=(y)
  4331.       sy = y - self.y
  4332.       if sy != 0
  4333.         for anime in @_animation
  4334.           if anime[3] != nil
  4335.             for i in 0..15
  4336.               anime[3][i].y += sy
  4337.             end
  4338.           end
  4339.         end
  4340.         if @_loop_animation_sprites != nil
  4341.           for i in 0..15
  4342.             @_loop_animation_sprites[i].y += sy
  4343.           end
  4344.         end
  4345.       end
  4346.       super
  4347.     end
  4348.   end
  4349. end

  4350. #------------------------------------------------------------------------------
  4351. #  Bitmapクラスに新たな機能を追加します。
  4352. #==============================================================================

  4353. class Bitmap
  4354.   #--------------------------------------------------------------------------
  4355.   # ● 矩形をグラデーション表示
  4356.   #     color1 : スタートカラー
  4357.   #     color2 : エンドカラー
  4358.   #     align  :  0:横にグラデーション
  4359.   #               1:縦にグラデーション
  4360.   #               2:斜めにグラデーション(激重につき注意)
  4361.   #--------------------------------------------------------------------------
  4362.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4363.     if align == 0
  4364.       for i in x...x + width
  4365.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4366.         green = color1.green +
  4367.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4368.         blue  = color1.blue +
  4369.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4370.         alpha = color1.alpha +
  4371.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4372.         color = Color.new(red, green, blue, alpha)
  4373.         fill_rect(i, y, 1, height, color)
  4374.       end
  4375.     elsif align == 1
  4376.       for i in y...y + height
  4377.         red   = color1.red +
  4378.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4379.         green = color1.green +
  4380.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4381.         blue  = color1.blue +
  4382.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4383.         alpha = color1.alpha +
  4384.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4385.         color = Color.new(red, green, blue, alpha)
  4386.         fill_rect(x, i, width, 1, color)
  4387.       end
  4388.     elsif align == 2
  4389.       for i in x...x + width
  4390.         for j in y...y + height
  4391.           red   = color1.red + (color2.red - color1.red) *
  4392.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4393.           green = color1.green + (color2.green - color1.green) *
  4394.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4395.           blue  = color1.blue + (color2.blue - color1.blue) *
  4396.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4397.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4398.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4399.           color = Color.new(red, green, blue, alpha)
  4400.           set_pixel(i, j, color)
  4401.         end
  4402.       end
  4403.     elsif align == 3
  4404.       for i in x...x + width
  4405.         for j in y...y + height
  4406.           red   = color1.red + (color2.red - color1.red) *
  4407.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4408.           green = color1.green + (color2.green - color1.green) *
  4409.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4410.           blue  = color1.blue + (color2.blue - color1.blue) *
  4411.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4412.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4413.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4414.           color = Color.new(red, green, blue, alpha)
  4415.           set_pixel(i, j, color)
  4416.         end
  4417.       end
  4418.     end
  4419.   end
  4420. end
复制代码
QQ截图20170112170342.png
QQ截图20170112170408.png
学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部