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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
596
在线时间
797 小时
注册时间
2014-7-1
帖子
578

开拓者

跳转到指定楼层
1
发表于 2017-1-12 17:06:33 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

QQ截图20170112170342.png (312.9 KB, 下载次数: 0)

QQ截图20170112170342.png

QQ截图20170112170408.png (249.4 KB, 下载次数: 0)

QQ截图20170112170408.png
学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

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

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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