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

Project1

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

[已经过期] 【求解】战斗脚本问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2013-8-13
帖子
35
跳转到指定楼层
1
发表于 2013-10-19 11:08:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x

新用了一个战斗脚本,战斗时为何会出现这种情况?
1V1和多人都这样
是脚本错还是什么问题,求解!
{:2_258:}
...

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
2
发表于 2013-10-19 11:12:13 | 只看该作者
脚本出错,如果想解决亮出脚本吧
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2013-8-13
帖子
35
3
 楼主| 发表于 2013-10-19 11:17:02 | 只看该作者
发脚本好像不能直接发的吧,好像要用什么,之前在版规看过

评分

参与人数 1星屑 +30 收起 理由
myownroc + 30 遵守版规。代码较少可以直接发.

查看全部评分

...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2013-8-13
帖子
35
4
 楼主| 发表于 2013-10-19 11:26:50 | 只看该作者
本帖最后由 一时瑜亮 于 2013-10-19 11:46 编辑

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

脚本在此  
...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
6 小时
注册时间
2013-10-31
帖子
10
5
发表于 2013-11-3 20:42:51 | 只看该作者
用别人做好的脚本工程把   我和你一样也是错误的情况
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-17 06:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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