查看: 2475|回复: 0

[已经过期] 有没有RTAB系统能用的,战斗中换装备,装备耐久,脚本

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

开拓者

发表于 2015-12-29 00:56:06 | 显示全部楼层 |阅读模式

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

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

×
在使用RTAB系统中。
想让装备流动起来。
让默认的装备变成消耗品。
即使得到了高级武器,耐久消耗完了就消失。


主站找到个装备耐久的脚本,网盘不能用。
芯大有个整合脚本里面有装备耐久,但是那是那群功能写在一起的,也不知道哪部分是,看不懂。
还找到了个战斗中换装备的脚本。不过结合后,提示weapon_id没有定义。
RTAB
  1. # リアルタイム・アクティブバトル(RTAB) Ver 1.16
  2. # 配布元・サポートURL
  3. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

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

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

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

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

  502. #==============================================================================
  503. # ■ Scene_Battle (分割定義 2)
  504. #------------------------------------------------------------------------------
  505. #  バトル画面の処理を行うクラスです。
  506. #==============================================================================

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

  929. #==============================================================================
  930. # ■ Scene_Battle (分割定義 3)
  931. #------------------------------------------------------------------------------
  932. #  バトル画面の処理を行うクラスです。
  933. #==============================================================================

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

  1540. #==============================================================================
  1541. # ■ Scene_Battle (分割定義 4)
  1542. #------------------------------------------------------------------------------
  1543. #  バトル画面の処理を行うクラスです。
  1544. #==============================================================================

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

  2490. #==============================================================================
  2491. # ■ Game_Actor
  2492. #------------------------------------------------------------------------------
  2493. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  2494. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  2495. #==============================================================================

  2496. class Game_Actor < Game_Battler
  2497.   #--------------------------------------------------------------------------
  2498.   # ● バトル画面 X 座標の取得
  2499.   #--------------------------------------------------------------------------
  2500.   def screen_x
  2501.     # パーティ内の並び順から X 座標を計算して返す
  2502.     if self.index != nil
  2503.       return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
  2504.     else
  2505.       return 0
  2506.     end
  2507.   end
  2508. end

  2509. #==============================================================================
  2510. # ■ Spriteset_Battle
  2511. #------------------------------------------------------------------------------
  2512. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  2513. # スの内部で使用されます。
  2514. #==============================================================================

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

  2711. #==============================================================================
  2712. # ■ Game_Battler (分割定義 1)
  2713. #------------------------------------------------------------------------------
  2714. #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
  2715. # スのスーパークラスとして使用されます。
  2716. #==============================================================================

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

  3227. class Game_BattleAction
  3228.   #--------------------------------------------------------------------------
  3229.   # ● 公開インスタンス変数
  3230.   #--------------------------------------------------------------------------
  3231.   attr_accessor :spell_id                 # 合体魔法用スキル ID
  3232.   attr_accessor :force_kind               # 種別 (基本 / スキル / アイテム)
  3233.   attr_accessor :force_basic              # 基本 (攻撃 / 防御 / 逃げる)
  3234.   attr_accessor :force_skill_id           # スキル ID
  3235.   #--------------------------------------------------------------------------
  3236.   # ● 有効判定
  3237.   #--------------------------------------------------------------------------
  3238.   def valid?
  3239.     return (not (@force_kind == 0 and @force_basic == 3))
  3240.   end
  3241. end

  3242. #==============================================================================
  3243. # ■ Game_Actor
  3244. #------------------------------------------------------------------------------
  3245. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  3246. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  3247. #==============================================================================

  3248. class Game_Actor < Game_Battler
  3249.   def skill_can_use?(skill_id)
  3250.     return super
  3251.   end
  3252. end

  3253. #==============================================================================
  3254. # ■ Game_Enemy
  3255. #------------------------------------------------------------------------------
  3256. #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
  3257. # 内部で使用されます。
  3258. #==============================================================================

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

  3406. #==============================================================================
  3407. # ■ Game_Party
  3408. #------------------------------------------------------------------------------
  3409. #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
  3410. # ラスのインスタンスは $game_party で参照されます。
  3411. #==============================================================================

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

  3485. #==============================================================================
  3486. # ■ Game_Troop
  3487. #------------------------------------------------------------------------------
  3488. #  トループを扱うクラスです。このクラスのインスタンスは $game_troop で参照さ
  3489. # れます。
  3490. #==============================================================================

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

  3541. #==============================================================================
  3542. # ■ Sprite_Battler
  3543. #------------------------------------------------------------------------------
  3544. #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
  3545. # スプライトの状態を自動的に変化させます。
  3546. #==============================================================================

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

  3671. #==============================================================================
  3672. # ■ Window_Base
  3673. #------------------------------------------------------------------------------
  3674. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  3675. #==============================================================================

  3676. class Window_Base < Window
  3677.   #--------------------------------------------------------------------------
  3678.   # ● ゲージの描画
  3679.   #--------------------------------------------------------------------------
  3680.   def gauge_rect_at(width, height, align3,
  3681.                     color1, color2, color3, color4, color5, color6, color7,
  3682.                     color8, color9, color10, color11, color12, grade1, grade2)
  3683.     # 枠描画
  3684.     @at_gauge = Bitmap.new(width, height * 5)
  3685.     @at_gauge.fill_rect(0, 0, width, height, color1)
  3686.     @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
  3687.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  3688.       color = color3
  3689.       color3 = color4
  3690.       color4 = color
  3691.     end
  3692.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  3693.       color = color5
  3694.       color5 = color6
  3695.       color6 = color
  3696.       color = color7
  3697.       color7 = color8
  3698.       color8 = color
  3699.       color = color9
  3700.       color9 = color10
  3701.       color10 = color
  3702.       color = color11
  3703.       color11 = color12
  3704.       color12 = color
  3705.     end
  3706.     if align3 == 0
  3707.       if grade1 == 2
  3708.         grade1 = 3
  3709.       end
  3710.       if grade2 == 2
  3711.         grade2 = 3
  3712.       end
  3713.     end
  3714.     # 空ゲージの描画 縦にグラデーション表示
  3715.     @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
  3716.                                   color3, color4, grade1)
  3717.     # 実ゲージの描画
  3718.     @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
  3719.                                   color5, color6, grade2)
  3720.     @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
  3721.                                   color7, color8, grade2)
  3722.     @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
  3723.                                   color9, color10, grade2)
  3724.     @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
  3725.                                   color11, color12, grade2)
  3726.   end
  3727. end

  3728. #==============================================================================
  3729. # ■ Window_Help
  3730. #------------------------------------------------------------------------------
  3731. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  3732. #==============================================================================

  3733. class Window_Help < Window_Base
  3734.   #--------------------------------------------------------------------------
  3735.   # ● エネミー設定
  3736.   #     enemy : 名前とステートを表示するエネミー
  3737.   #--------------------------------------------------------------------------
  3738.   def set_enemy(enemy)
  3739.     text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
  3740.     state_text = make_battler_state_text(enemy, 112, false)
  3741.     if state_text != ""
  3742.       text += "  " + state_text
  3743.     end
  3744.     set_text(text, 1)
  3745.   end
  3746. end

  3747. #==============================================================================
  3748. # ■ Window_BattleStatus
  3749. #------------------------------------------------------------------------------
  3750. #  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
  3751. #==============================================================================

  3752. class Window_BattleStatus < Window_Base
  3753.   #--------------------------------------------------------------------------
  3754.   # ● オブジェクト初期化
  3755.   #--------------------------------------------------------------------------
  3756.   def initialize
  3757.     x = (4 - $game_party.actors.size) * 80
  3758.     width = $game_party.actors.size * 160
  3759.     super(x, 320, width, 160)
  3760.     self.back_opacity = 160
  3761.     @actor_window = []
  3762.     for i in 0...$game_party.actors.size
  3763.       @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3764.     end
  3765.     @level_up_flags = [false, false, false, false]
  3766.     refresh
  3767.   end
  3768.   #--------------------------------------------------------------------------
  3769.   # ● 解放
  3770.   #--------------------------------------------------------------------------
  3771.   def dispose
  3772.     for window in @actor_window
  3773.       window.dispose
  3774.     end
  3775.     super
  3776.   end
  3777.   #--------------------------------------------------------------------------
  3778.   # ● リフレッシュ
  3779.   #--------------------------------------------------------------------------
  3780.   def refresh(number = 0)
  3781.     if number == 0
  3782.       cnt = 0
  3783.       for window in @actor_window
  3784.         window.refresh(@level_up_flags[cnt])
  3785.         cnt += 1
  3786.       end
  3787.     else
  3788.       @actor_window[number - 1].refresh(@level_up_flags[number - 1])
  3789.     end
  3790.   end
  3791.   #--------------------------------------------------------------------------
  3792.   # ● ATゲージリフレッシュ
  3793.   #--------------------------------------------------------------------------
  3794.   def at_refresh(number = 0)
  3795.     if number == 0
  3796.       for window in @actor_window
  3797.         window.at_refresh
  3798.       end
  3799.     else
  3800.       @actor_window[number - 1].at_refresh
  3801.     end
  3802.   end
  3803.   #--------------------------------------------------------------------------
  3804.   # ● フレーム更新
  3805.   #--------------------------------------------------------------------------
  3806.   def update
  3807.     super
  3808.     if self.x != (4 - $game_party.actors.size) * 80
  3809.       self.x = (4 - $game_party.actors.size) * 80
  3810.       self.width = $game_party.actors.size * 160
  3811.       for window in @actor_window
  3812.         window.dispose
  3813.       end
  3814.       @actor_window = []
  3815.       for i in 0...$game_party.actors.size
  3816.         @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
  3817.       end
  3818.       refresh
  3819.     end
  3820.     for window in @actor_window
  3821.       window.update
  3822.     end
  3823.   end
  3824. end

  3825. #==============================================================================
  3826. # ■ Window_ActorStatus
  3827. #------------------------------------------------------------------------------
  3828. #  バトル画面でパーティメンバーのステータスをそれぞれ表示するウィンドウです。
  3829. #==============================================================================

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

  3897. #==============================================================================
  3898. # ■ Window_DetailsStatus
  3899. #------------------------------------------------------------------------------
  3900. #  バトル画面でアクターのステータスを個々に表示するウィンドウです。
  3901. #==============================================================================

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

  3955. #==============================================================================
  3956. # ■ Arrow_Base
  3957. #------------------------------------------------------------------------------
  3958. #  バトル画面で使用するアローカーソル表示用のスプライトです。このクラスは
  3959. # Arrow_Enemy クラスと Arrow_Actor クラスのスーパークラスとして使用されます。
  3960. #==============================================================================

  3961. class Arrow_Base < Sprite
  3962.   #--------------------------------------------------------------------------
  3963.   # ● オブジェクト初期化
  3964.   #     viewport : ビューポート
  3965.   #--------------------------------------------------------------------------
  3966.   def initialize(viewport)
  3967.     super(viewport)
  3968.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  3969.     self.ox = 16
  3970.     self.oy = 32
  3971.     self.z = 2500
  3972.     @blink_count = 0
  3973.     @index = 0
  3974.     @help_window = nil
  3975.     update
  3976.   end
  3977. end

  3978. #==============================================================================
  3979. # ■ Arrow_Enemy
  3980. #------------------------------------------------------------------------------
  3981. #  エネミーを選択させるためのアローカーソルです。このクラスは Arrow_Base クラ
  3982. # スを継承します。
  3983. #==============================================================================

  3984. class Arrow_Enemy < Arrow_Base
  3985.   #--------------------------------------------------------------------------
  3986.   # ● フレーム更新
  3987.   #--------------------------------------------------------------------------
  3988.   def update
  3989.     super
  3990.     # 存在しないエネミーを指していたら飛ばす
  3991.     $game_troop.enemies.size.times do
  3992.       break if self.enemy.exist?
  3993.       @index += 1
  3994.       @index %= $game_troop.enemies.size
  3995.     end
  3996.     # カーソル右
  3997.     if Input.repeat?(Input::RIGHT)
  3998.       $game_system.se_play($data_system.cursor_se)
  3999.       $game_troop.enemies.size.times do
  4000.         @index += 1
  4001.         @index %= $game_troop.enemies.size
  4002.         break if self.enemy.exist?
  4003.       end
  4004.       $scene.camera = "select"
  4005.       zoom = 1 / self.enemy.zoom
  4006.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4007.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4008.     end
  4009.     # カーソル左
  4010.     if Input.repeat?(Input::LEFT)
  4011.       $game_system.se_play($data_system.cursor_se)
  4012.       $game_troop.enemies.size.times do
  4013.         @index += $game_troop.enemies.size - 1
  4014.         @index %= $game_troop.enemies.size
  4015.         break if self.enemy.exist?
  4016.       end
  4017.       $scene.camera = "select"
  4018.       zoom = 1 / self.enemy.zoom
  4019.       $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
  4020.                                       self.enemy.attack_y(zoom) * 0.75, zoom)
  4021.     end
  4022.     # スプライトの座標を設定
  4023.     if self.enemy != nil
  4024.       self.x = self.enemy.screen_x
  4025.       self.y = self.enemy.screen_y
  4026.     end
  4027.   end
  4028. end

  4029. #==============================================================================
  4030. # ■ Interpreter
  4031. #------------------------------------------------------------------------------
  4032. #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ
  4033. # スや Game_Event クラスの内部で使用されます。
  4034. #==============================================================================

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

  4271. #==============================================================================
  4272. # ■ Spriteモジュール
  4273. #------------------------------------------------------------------------------
  4274. #  アニメーションの管理を行うモジュールです。
  4275. #==============================================================================

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

  4614. #------------------------------------------------------------------------------
  4615. #  Bitmapクラスに新たな機能を追加します。
  4616. #==============================================================================

  4617. class Bitmap
  4618.   #--------------------------------------------------------------------------
  4619.   # ● 矩形をグラデーション表示
  4620.   #     color1 : スタートカラー
  4621.   #     color2 : エンドカラー
  4622.   #     align  :  0:横にグラデーション
  4623.   #               1:縦にグラデーション
  4624.   #               2:斜めにグラデーション(激重につき注意)
  4625.   #--------------------------------------------------------------------------
  4626.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  4627.     if align == 0
  4628.       for i in x...x + width
  4629.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  4630.         green = color1.green +
  4631.                 (color2.green - color1.green) * (i - x) / (width - 1)
  4632.         blue  = color1.blue +
  4633.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  4634.         alpha = color1.alpha +
  4635.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  4636.         color = Color.new(red, green, blue, alpha)
  4637.         fill_rect(i, y, 1, height, color)
  4638.       end
  4639.     elsif align == 1
  4640.       for i in y...y + height
  4641.         red   = color1.red +
  4642.                 (color2.red - color1.red) * (i - y) / (height - 1)
  4643.         green = color1.green +
  4644.                 (color2.green - color1.green) * (i - y) / (height - 1)
  4645.         blue  = color1.blue +
  4646.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  4647.         alpha = color1.alpha +
  4648.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  4649.         color = Color.new(red, green, blue, alpha)
  4650.         fill_rect(x, i, width, 1, color)
  4651.       end
  4652.     elsif align == 2
  4653.       for i in x...x + width
  4654.         for j in y...y + height
  4655.           red   = color1.red + (color2.red - color1.red) *
  4656.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4657.           green = color1.green + (color2.green - color1.green) *
  4658.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4659.           blue  = color1.blue + (color2.blue - color1.blue) *
  4660.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4661.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4662.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4663.           color = Color.new(red, green, blue, alpha)
  4664.           set_pixel(i, j, color)
  4665.         end
  4666.       end
  4667.     elsif align == 3
  4668.       for i in x...x + width
  4669.         for j in y...y + height
  4670.           red   = color1.red + (color2.red - color1.red) *
  4671.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4672.           green = color1.green + (color2.green - color1.green) *
  4673.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4674.           blue  = color1.blue + (color2.blue - color1.blue) *
  4675.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4676.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  4677.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  4678.           color = Color.new(red, green, blue, alpha)
  4679.           set_pixel(i, j, color)
  4680.         end
  4681.       end
  4682.     end
  4683.     end
  4684.       end
复制代码




战斗中换装备
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #============================================================================== #  「戦闘中に装備」スクリプト Ver1.00
  4. #
  5. #
  6. #戦闘中に装備が出来るようになります。以下のスクリプトをmainの上にでも挿入
  7. #して下さい。アクターコマンドの一番下に装備コマンドが出ると思います。
  8. #
  9. #なお、このスクリプトは通常時の装備画面を直接呼び出しておりますので、
  10. #画面のデザインは考慮しておりません。レイアウトの変更は各自でお願い致します。
  11. #つまり、装備画面の変更が大前提となります。一応、そのままでも動作は問題あり
  12. #ませんが・・・。
  13. #なお、呼び出している画面は「装備中のアイテム欄」と
  14. #「装備できるアイテム欄」です。
  15. #
  16. #
  17. #画面レイアウトの変更はRGSSの初歩の技術ですので、
  18. #それが出来ない方は、親切な方に教えて頂くか諦めて下さい(ぇ
  19. #勉強と思ってがんばりましょう(^^;)
  20. #※ヒント
  21. #●Window_EquipLeft
  22. #●Window_EquipRight
  23. #●Window_EquipItem
  24. #が変更場所です・・・・・。

  25. #==============================================================================
  26. # ■ Scene_Battle (分割定義 3)
  27. #------------------------------------------------------------------------------
  28. #  バトル画面の処理を行うクラスです。
  29. #==============================================================================
  30. class Scene_Battle
  31.   #--------------------------------------------------------------------------
  32.   # ● メイン処理
  33.   #--------------------------------------------------------------------------
  34.   def main
  35.     # 戦闘用の各種一時データを初期化
  36.     $game_temp.in_battle = true
  37.     $game_temp.battle_turn = 0
  38.     $game_temp.battle_event_flags.clear
  39.     $game_temp.battle_abort = false
  40.     $game_temp.battle_main_phase = false
  41.     $game_temp.battleback_name = $game_map.battleback_name
  42.     $game_temp.forcing_battler = nil
  43.     # バトルイベント用インタプリタを初期化
  44.     $game_system.battle_interpreter.setup(nil, 0)
  45.     # トループを準備
  46.     @troop_id = $game_temp.battle_troop_id
  47.     $game_troop.setup(@troop_id)
  48.     # アクターコマンドウィンドウを作成
  49.     s1 = $data_system.words.attack
  50.     s2 = $data_system.words.skill
  51.     s3 = $data_system.words.guard
  52.     s4 = $data_system.words.item
  53.     s5 = $data_system.words.equip #ーーー●●装備
  54.     @actor_command_window = Window_Command.new(128, [s1, s2, s3, s4, s5])
  55.     #@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  56.     @actor_command_window.y = 128 #160

  57.     @actor_command_window.back_opacity = 160
  58.     @actor_command_window.active = false
  59.     @actor_command_window.visible = false
  60.     # その他のウィンドウを作成
  61.     @party_command_window = Window_PartyCommand.new
  62.     @help_window = Window_Help.new
  63.     @help_window.back_opacity = 160
  64.     @help_window.visible = false
  65.     @status_window = Window_BattleStatus.new
  66.     @message_window = Window_Message.new
  67.     # スプライトセットを作成
  68.     @spriteset = Spriteset_Battle.new
  69.     # ウェイトカウントを初期化
  70.     @wait_count = 0
  71.     # トランジション実行
  72.     if $data_system.battle_transition == ""
  73.       Graphics.transition(20)
  74.     else
  75.       Graphics.transition(40, "Graphics/Transitions/" +
  76.         $data_system.battle_transition)
  77.     end
  78.     # プレバトルフェーズ開始
  79.     start_phase1
  80.     # メインループ
  81.     loop do
  82.       # ゲーム画面を更新
  83.       Graphics.update
  84.       # 入力情報を更新
  85.       Input.update
  86.       # フレーム更新
  87.       update
  88.       # 画面が切り替わったらループを中断
  89.       if $scene != self
  90.         break
  91.       end
  92.     end
  93.     # マップをリフレッシュ
  94.     $game_map.refresh
  95.     # トランジション準備
  96.     Graphics.freeze
  97.     # ウィンドウを解放
  98.     @actor_command_window.dispose
  99.     @party_command_window.dispose
  100.     @help_window.dispose
  101.     @status_window.dispose
  102.     @message_window.dispose
  103.     if @skill_window != nil
  104.       @skill_window.dispose
  105.     end
  106.     if @item_window != nil
  107.       @item_window.dispose
  108.     end
  109.     if @result_window != nil
  110.       @result_window.dispose
  111.     end
  112.     # スプライトセットを解放
  113.     @spriteset.dispose
  114.     # タイトル画面に切り替え中の場合
  115.     if $scene.is_a?(Scene_Title)
  116.       # 画面をフェードアウト
  117.       Graphics.transition
  118.       Graphics.freeze
  119.     end
  120.     # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
  121.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  122.       $scene = nil
  123.     end
  124.   end



  125.   #--------------------------------------------------------------------------
  126.   # ● フレーム更新 (アクターコマンドフェーズ)
  127.   #--------------------------------------------------------------------------
  128.   def update_phase3
  129.     # エネミーアローが有効の場合
  130.     if @enemy_arrow != nil
  131.       update_phase3_enemy_select
  132.     # アクターアローが有効の場合
  133.     elsif @actor_arrow != nil
  134.       update_phase3_actor_select
  135.     # スキルウィンドウが有効の場合
  136.     elsif @skill_window != nil
  137.       update_phase3_skill_select
  138.     # アイテムウィンドウが有効の場合
  139.     elsif @item_window != nil
  140.       update_phase3_item_select
  141.     # ★追加 装備変更ウィンドウが有効の場合
  142.     elsif @right_window != nil
  143.          update_phase3_equip_select
  144.     # アクターコマンドウィンドウが有効の場合
  145.     elsif @actor_command_window.active
  146.       update_phase3_basic_command
  147.     end
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  151.   #--------------------------------------------------------------------------
  152.   def update_phase3_basic_command
  153.     # B ボタンが押された場合
  154.     if Input.trigger?(Input::B)
  155.       # キャンセル SE を演奏
  156.       $game_system.se_play($data_system.cancel_se)
  157.       # 前のアクターのコマンド入力へ
  158.       phase3_prior_actor
  159.       return
  160.     end
  161.     # C ボタンが押された場合
  162.     if Input.trigger?(Input::C)
  163.       # アクターコマンドウィンドウのカーソル位置で分岐
  164.       case @actor_command_window.index
  165.       when 0  # 攻撃
  166.         # 決定 SE を演奏
  167.         $game_system.se_play($data_system.decision_se)
  168.         # アクションを設定
  169.         @active_battler.current_action.kind = 0
  170.         @active_battler.current_action.basic = 0
  171.         # エネミーの選択を開始
  172.         start_enemy_select
  173.       when 1  # スキル
  174.         # 決定 SE を演奏
  175.         $game_system.se_play($data_system.decision_se)
  176.         # アクションを設定
  177.         @active_battler.current_action.kind = 1
  178.         # スキルの選択を開始
  179.         start_skill_select
  180.       when 2  # 防御
  181.         # 決定 SE を演奏
  182.         $game_system.se_play($data_system.decision_se)
  183.         # アクションを設定
  184.         @active_battler.current_action.kind = 0
  185.         @active_battler.current_action.basic = 1
  186.         # 次のアクターのコマンド入力へ
  187.         phase3_next_actor
  188.       when 3  # アイテム
  189.         # 決定 SE を演奏
  190.         $game_system.se_play($data_system.decision_se)
  191.         # アクションを設定
  192.         @active_battler.current_action.kind = 2
  193.         # アイテムの選択を開始
  194.         start_item_select
  195.       when 4  #   装備
  196.         # 決定 SE を演奏
  197.         $game_system.se_play($data_system.decision_se)
  198.         # アクションを設定
  199.         #@active_battler.current_action.kind = 0
  200.         # アイテムの選択を開始
  201.         start_equip_select
  202.       end
  203.       return
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ★● 追加 フレーム更新 (アクターコマンドフェーズ : 変更装備選択)
  208.   #--------------------------------------------------------------------------
  209.   def update_phase3_equip_select
  210.     # スキルウィンドウを可視状態にする
  211.     @right_window.visible = true

  212.     # ウィンドウを更新
  213.     @right_window.update
  214.     if @right_window.index != @now_right_window
  215.       @now_right_window =@right_window.index
  216.       if @equip_item_window.index == -1
  217.         @equip_item_window.index = 0
  218.         @equip_item_window.refresh
  219.         @equip_item_window.index = -1
  220.       end
  221.     end
  222.     # ウィンドウを更新
  223.     @equip_item_window.update
  224.     equip_item_window_select      
  225.    
  226.     # アイテムウィンドウがアクティブの場合
  227.     if @equip_item_window.active
  228.       update_phase3_equip_i_select
  229.       return
  230.     end
  231.    
  232.     # B ボタンが押された場合
  233.     if Input.trigger?(Input::B)
  234.       # キャンセル SE を演奏
  235.       $game_system.se_play($data_system.cancel_se)
  236.       # 装備選択を終了
  237.       end_equip_select
  238.       return
  239.     end
  240.     # C ボタンが押された場合
  241.     if Input.trigger?(Input::C)
  242.       # 装備固定の場合
  243.       if @active_battler.equip_fix?(@right_window.index)
  244.         # ブザー SE を演奏
  245.         $game_system.se_play($data_system.buzzer_se)
  246.         return
  247.       end
  248.       # 決定 SE を演奏
  249.       $game_system.se_play($data_system.decision_se)
  250.       # アイテムウィンドウをアクティブ化
  251.       @right_window.active = false
  252.       @equip_item_window.active = true
  253.       @equip_item_window.index = 0
  254.       @now_right_window = -1
  255.       return
  256.     end
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ★● 追加 フレーム更新 (アクターコマンドフェーズ : 装備アイテム選択)
  260.   #--------------------------------------------------------------------------
  261.   def update_phase3_equip_i_select
  262.     # B ボタンが押された場合
  263.     if Input.trigger?(Input::B)
  264.       # キャンセル SE を演奏
  265.       $game_system.se_play($data_system.cancel_se)      
  266.       # 装備アイテム選択を終了
  267.       @now_item_window = -1
  268.       
  269.       @right_window.active = true
  270.       @equip_item_window.active = false
  271.       @equip_item_window.index = -1
  272.       return
  273.     end
  274.     # C ボタンが押された場合
  275.     if Input.trigger?(Input::C)
  276.       $game_system.se_play($data_system.equip_se)
  277.       # アイテムウィンドウで現在選択されているデータを取得
  278.       item = @equip_item_window.item
  279.       # 装備を変更
  280.       @active_battler.equip(@right_window.index, item == nil ? 0 : item.id)
  281.       # ライトウィンドウをアクティブ化
  282.       @right_window.active = true
  283.       @equip_item_window.active = false
  284.       @equip_item_window.index = -1
  285.       # ライトウィンドウ、アイテムウィンドウの内容を再作成
  286.       @right_window.refresh
  287.       @equip_item_window.refresh
  288.       return
  289.     end
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ★● 追加 装備選択開始
  293.   #--------------------------------------------------------------------------
  294.   def start_equip_select
  295.     # 装備ウィンドウを作成
  296.     #パラメータを呼び出したい時は注釈消す
  297.     #@left_window = Window_EquipLeft.new(@active_battler)
  298.     @right_window = Window_EquipRight.new(@active_battler)
  299.     @item_window1 = Window_EquipItem.new(@active_battler, 0)
  300.     @item_window2 = Window_EquipItem.new(@active_battler, 1)
  301.     @item_window3 = Window_EquipItem.new(@active_battler, 2)
  302.     @item_window4 = Window_EquipItem.new(@active_battler, 3)
  303.     @item_window5 = Window_EquipItem.new(@active_battler, 4)  
  304.     # ヘルプウィンドウを関連付け
  305.     @right_window.help_window = @help_window
  306.     @item_window1.help_window = @help_window
  307.     @item_window2.help_window = @help_window
  308.     @item_window3.help_window = @help_window
  309.     @item_window4.help_window = @help_window
  310.     @item_window5.help_window = @help_window
  311.    
  312.     @now_right_window = -1
  313.     @right_window.index = 0
  314.     equip_item_window_select
  315.     # アクターコマンドウィンドウを無効化
  316.     @actor_command_window.active = false
  317.     @actor_command_window.visible = false
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ★● 追加 装備選択終了
  321.   #--------------------------------------------------------------------------
  322.   def end_equip_select
  323.     # アイテムウィンドウを解放
  324.     #パラメータを呼び出したい時は注釈消す
  325.     #@left_window.dispose
  326.     @right_window.dispose
  327.     @item_window1.dispose
  328.     @item_window2.dispose
  329.     @item_window3.dispose
  330.     @item_window4.dispose
  331.     @item_window5.dispose
  332.     @right_window= nil
  333.     @item_window1= nil
  334.     @item_window2= nil
  335.     @item_window3= nil
  336.     @item_window4= nil
  337.     @item_window5= nil
  338.     # ヘルプウィンドウを隠す
  339.     @help_window.visible = false
  340.     # アクターコマンドウィンドウを有効化
  341.     @actor_command_window.active = true
  342.     @actor_command_window.visible = true
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ★● 追加 装備アイテムウインドウのチェック
  346.   #--------------------------------------------------------------------------
  347.   def equip_item_window_select  
  348.       # アイテムウィンドウの可視状態設定
  349.     @item_window1.visible = (@right_window.index == 0)
  350.     @item_window2.visible = (@right_window.index == 1)
  351.     @item_window3.visible = (@right_window.index == 2)
  352.     @item_window4.visible = (@right_window.index == 3)
  353.     @item_window5.visible = (@right_window.index == 4)
  354.     # ーーー★追加(注釈消すとアクセサリ1つ増加)
  355.     #@item_window5.visible = (@right_window.index == 4) || (@right_window.index == 5)
  356.     # ーーー終わり
  357.     # 現在のアイテムウィンドウを @item_window に設定
  358.     case @right_window.index
  359.     when 0
  360.       @equip_item_window = @item_window1
  361.     when 1
  362.       @equip_item_window = @item_window2
  363.     when 2
  364.       @equip_item_window = @item_window3
  365.     when 3
  366.       @equip_item_window = @item_window4
  367.     when 4
  368.       @equip_item_window = @item_window5
  369.     # ーーー★追加(注釈消すとアクセサリ1つ増加)
  370.     #when 5
  371.     #  @equip_item_window = @item_window5
  372.     end
  373.   end
  374. end


  375. #==============================================================================
  376. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  377. #==============================================================================
复制代码




装备耐久
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载和使用请保留此信息
  3. # ————————————————————————————————————
  4. #==============================================================================
  5. #==============================================================================
  6. # 装备耐久度 测试版
  7. # by 沉影不器
  8. #==============================================================================
  9. #主要更改:
  10. #
  11. # ① 角色的每件装备都是原数据库的克隆品,使每件装备都有唯一id
  12. # ② 角色物品窗口中所有装备单独一格
  13. # ③ 更改了商店中对装备的买卖方式,跳过输入数量,只能一件一件买卖
  14. # ④ 战斗中,打人消耗武器耐久度(非物理攻击的技能不消耗),被打消耗防具耐久度,有一定机率
  15. # ⑤ 装备耐久度降为 0 时即是装备损坏,装备能力消失,可修复
  16. # ⑥ 损坏的装备将在大地图上显示
  17. #------------------------------------------------------------------------------
  18. #使用说明
  19. #
  20. # ① 武器耐久度在[数据库-武器]一栏的武器名称后输入,格式为"武器名,耐久度最大值"
  21. #    例如"铜剑,12"表示铜剑最大耐久度为12
  22. #    防具设定同上
  23. # ② 脚本第28行设定原数据库武器最大id
  24. #    例如:默认数据库里最后一个武器是密斯利尔杖,id是32
  25. # ③ 脚本第29行设定原数据库防具最大id,同上
  26. #    ●以上两个常量为必设,须根据您自己的数据库更改,否则出错
  27. # ④ 脚本第30行设定最大耐久度,
  28. # ⑤ 角色初期装备最好没有重复id的装备,比如默认数据库中几个人物都用了铜盾(id:1)
  29. #    这将使几个人物的该铜盾共享一个耐久度
  30. #==============================================================================
  31. module DUR
  32.   DATA_WEAPON_SIZE = 999 # 原数据库武器最大id
  33.   DATA_ARMOR_SIZE = 999 # 原数据库防具最大id
  34.   DUR_SET_MAX = 999 # 最大耐久度
  35. end
  36. #==============================================================================

  37. class Game_Actor < Game_Battler
  38.   #--------------------------------------------------------------------------
  39.   def base_str
  40.     n = $data_actors[@actor_id].parameters[2, @level]
  41.     weapon = $data_weapons[@weapon_id]
  42.     armor1 = $data_armors[@armor1_id]
  43.     armor2 = $data_armors[@armor2_id]
  44.     armor3 = $data_armors[@armor3_id]
  45.     armor4 = $data_armors[@armor4_id]
  46.     n += (weapon != nil and weapon.dur > 0) ? weapon.str_plus : 0
  47.     n += (armor1 != nil and armor1.dur > 0) ? armor1.str_plus : 0
  48.     n += (armor2 != nil and armor2.dur > 0) ? armor2.str_plus : 0
  49.     n += (armor3 != nil and armor3.dur > 0) ? armor3.str_plus : 0
  50.     n += (armor4 != nil and armor4.dur > 0) ? armor4.str_plus : 0
  51.     return [[n, 1].max, 999].min
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   def base_dex
  55.     n = $data_actors[@actor_id].parameters[3, @level]
  56.     weapon = $data_weapons[@weapon_id]
  57.     armor1 = $data_armors[@armor1_id]
  58.     armor2 = $data_armors[@armor2_id]
  59.     armor3 = $data_armors[@armor3_id]
  60.     armor4 = $data_armors[@armor4_id]
  61.     n += (weapon != nil and weapon.dur > 0) ? weapon.dex_plus : 0
  62.     n += (armor1 != nil and armor1.dur > 0) ? armor1.dex_plus : 0
  63.     n += (armor2 != nil and armor2.dur > 0) ? armor2.dex_plus : 0
  64.     n += (armor3 != nil and armor3.dur > 0) ? armor3.dex_plus : 0
  65.     n += (armor4 != nil and armor4.dur > 0) ? armor4.dex_plus : 0
  66.     return [[n, 1].max, 999].min
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   def base_agi
  70.     n = $data_actors[@actor_id].parameters[4, @level]
  71.     weapon = $data_weapons[@weapon_id]
  72.     armor1 = $data_armors[@armor1_id]
  73.     armor2 = $data_armors[@armor2_id]
  74.     armor3 = $data_armors[@armor3_id]
  75.     armor4 = $data_armors[@armor4_id]
  76.     n += (weapon != nil and weapon.dur > 0) ? weapon.agi_plus : 0
  77.     n += (armor1 != nil and armor1.dur > 0) ? armor1.agi_plus : 0
  78.     n += (armor2 != nil and armor2.dur > 0) ? armor2.agi_plus : 0
  79.     n += (armor3 != nil and armor3.dur > 0) ? armor3.agi_plus : 0
  80.     n += (armor4 != nil and armor4.dur > 0) ? armor4.agi_plus : 0
  81.     return [[n, 1].max, 999].min
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   def base_int
  85.     n = $data_actors[@actor_id].parameters[5, @level]
  86.     weapon = $data_weapons[@weapon_id]
  87.     armor1 = $data_armors[@armor1_id]
  88.     armor2 = $data_armors[@armor2_id]
  89.     armor3 = $data_armors[@armor3_id]
  90.     armor4 = $data_armors[@armor4_id]
  91.     n += (weapon != nil and weapon.dur > 0) ? weapon.int_plus : 0
  92.     n += (armor1 != nil and armor1.dur > 0) ? armor1.int_plus : 0
  93.     n += (armor2 != nil and armor2.dur > 0) ? armor2.int_plus : 0
  94.     n += (armor3 != nil and armor3.dur > 0) ? armor3.int_plus : 0
  95.     n += (armor4 != nil and armor4.dur > 0) ? armor4.int_plus : 0
  96.     return [[n, 1].max, 999].min
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   def base_atk
  100.     weapon = $data_weapons[@weapon_id]
  101.     return (weapon != nil and weapon.dur > 0) ? weapon.atk : 0
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   def base_pdef
  105.     weapon = $data_weapons[@weapon_id]
  106.     armor1 = $data_armors[@armor1_id]
  107.     armor2 = $data_armors[@armor2_id]
  108.     armor3 = $data_armors[@armor3_id]
  109.     armor4 = $data_armors[@armor4_id]
  110.     pdef1 = (weapon != nil and weapon.dur > 0) ? weapon.pdef : 0
  111.     pdef2 = (armor1 != nil and armor1.dur > 0) ? armor1.pdef : 0
  112.     pdef3 = (armor2 != nil and armor2.dur > 0) ? armor2.pdef : 0
  113.     pdef4 = (armor3 != nil and armor3.dur > 0) ? armor3.pdef : 0
  114.     pdef5 = (armor4 != nil and armor4.dur > 0) ? armor4.pdef : 0
  115.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   def base_mdef
  119.     weapon = $data_weapons[@weapon_id]
  120.     armor1 = $data_armors[@armor1_id]
  121.     armor2 = $data_armors[@armor2_id]
  122.     armor3 = $data_armors[@armor3_id]
  123.     armor4 = $data_armors[@armor4_id]
  124.     mdef1 = (weapon != nil and weapon.dur > 0) ? weapon.mdef : 0
  125.     mdef2 = (armor1 != nil and armor1.dur > 0) ? armor1.mdef : 0
  126.     mdef3 = (armor2 != nil and armor2.dur > 0) ? armor2.mdef : 0
  127.     mdef4 = (armor3 != nil and armor3.dur > 0) ? armor3.mdef : 0
  128.     mdef5 = (armor4 != nil and armor4.dur > 0) ? armor4.mdef : 0
  129.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   def base_eva
  133.     armor1 = $data_armors[@armor1_id]
  134.     armor2 = $data_armors[@armor2_id]
  135.     armor3 = $data_armors[@armor3_id]
  136.     armor4 = $data_armors[@armor4_id]
  137.     eva1 = (armor1 != nil and armor1.dur > 0) ? armor1.eva : 0
  138.     eva2 = (armor2 != nil and armor2.dur > 0) ? armor2.eva : 0
  139.     eva3 = (armor3 != nil and armor3.dur > 0) ? armor3.eva : 0
  140.     eva4 = (armor4 != nil and armor4.dur > 0) ? armor4.eva : 0
  141.     return eva1 + eva2 + eva3 + eva4
  142.   end
  143. end
  144. #==============================================================================

  145. class Game_Party
  146.   #--------------------------------------------------------------------------
  147.   attr_accessor   :weapons
  148.   attr_accessor   :armors
  149.   #--------------------------------------------------------------------------
  150.   def weapon_number(weapon_id)
  151.     return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # 以下修改于<<武器攻击力波动>>(灼眼的夏娜)
  155.   def gain_weapon(weapon_id, n)
  156.     if weapon_id > 0
  157.       if n > 0 # 增加武器的情况
  158.         n = 1
  159.         # 装备栏中使用的武器不处理~
  160.         if $scene.is_a?(Scene_Equip)
  161.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  162.         else
  163.           new_weapon = $data_weapons[weapon_id].clone
  164.           new_weapon.dur_set = $data_weapons[weapon_id].dur_set
  165.           new_weapon.dur = $data_weapons[weapon_id].dur_set
  166.           new_weapon.id = $data_weapons.size
  167.           #数据库扩容
  168.           $data_weapons.push(new_weapon)
  169.           # 职业可装备武器数组更新~
  170.           for i in 1...$data_classes.size
  171.             if $data_classes[i].weapon_set.include?(weapon_id)
  172.               $data_classes[i].weapon_set.push(new_weapon.id)
  173.             end
  174.           end
  175.           # 增加武器~
  176.           @weapons[new_weapon.id] = [[weapon_number(new_weapon.id) + n, 0].max, 99].min
  177.         end
  178.       else # n < 0 减少武器的情况(未定的情况: n = 0)
  179.         n = -1
  180.         # 装备栏中卸下的武器不处理~
  181.         if $scene.is_a?(Scene_Equip)
  182.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  183.         else
  184.           lose_name = $data_weapons[weapon_id].name
  185.           dur_min = DUR::DUR_SET_MAX
  186.           for i in DUR::DATA_WEAPON_SIZE+1...$data_weapons.size
  187.             # 重新确定weapon_id,必定在原武器数据库之外
  188.             # 减少同名武器中耐久度最低的
  189.             if $data_weapons[i].name == lose_name and $data_weapons[i].dur < dur_min
  190.               weapon_id = i
  191.             end
  192.           end
  193.           # 已不存在的不做操作
  194.           if weapon_number(weapon_id) <= 0
  195.             return
  196.           end
  197.           # 减少武器
  198.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  199.           # 删除行囊拥有的武器id,后id补进
  200.           @weapons.delete(weapon_id)
  201.           weapon_keys = @weapons.keys.sort!
  202.           for i in weapon_keys
  203.             if i > weapon_id
  204.               @weapons[i-1] = @weapons[i]
  205.               @weapons.delete(i)
  206.             end
  207.           end
  208.           # 更改角色使用中的武器id
  209.           for i in [email]0...@actors.size[/email]
  210.             if @actors[i].weapon_id != nil and @actors[i].weapon_id > weapon_id
  211.               @actors[i].weapon_id -= 1
  212.             end
  213.           end
  214.           if weapon_id > DUR::DATA_WEAPON_SIZE
  215.             # 删除数据库武器id,后补进
  216.             for i in weapon_id+1...$data_weapons.size
  217.               $data_weapons[i].id -= 1
  218.             end
  219.             $data_weapons.delete_at(weapon_id)
  220.             # 职业可装备武器数组更新
  221.             for i in 1...$data_classes.size
  222.               if $data_classes[i].weapon_set.include?(weapon_id)
  223.                 $data_classes[i].weapon_set.delete(weapon_id)
  224.               end
  225.               for j in $data_classes[i].weapon_set
  226.                 if j > weapon_id
  227.                   $data_classes[i].weapon_set.delete(j)
  228.                   j -= 1
  229.                   $data_classes[i].weapon_set.push(j)
  230.                 end
  231.               end
  232.             end
  233.           end
  234.         end
  235.       end
  236.     end
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   def gain_armor(armor_id, n)
  240.     if armor_id > 0
  241.       if n > 0 # 增加防具的情况
  242.         n = 1
  243.         # 装备栏中使用的防具不处理~
  244.         if $scene.is_a?(Scene_Equip)
  245.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  246.         else
  247.           new_armor = $data_armors[armor_id].clone
  248.           new_armor.dur_set = $data_armors[armor_id].dur_set
  249.           new_armor.dur = $data_armors[armor_id].dur_set
  250.           new_armor.id = $data_armors.size
  251.           #数据库扩容
  252.           $data_armors.push(new_armor)
  253.           # 职业可装备防具数组更新~
  254.           for i in 1...$data_classes.size
  255.             if $data_classes[i].armor_set.include?(armor_id)
  256.               $data_classes[i].armor_set.push(new_armor.id)
  257.             end
  258.           end
  259.           # 增加防具
  260.           @armors[new_armor.id] = [[armor_number(new_armor.id) + n, 0].max, 99].min
  261.         end
  262.       else # n < 0 减少防具的情况(未定的情况: n = 0)
  263.         n = -1
  264.         # 装备栏中卸下的防具不处理
  265.         if $scene.is_a?(Scene_Equip)
  266.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  267.         else
  268.           lose_name = $data_armors[armor_id].name
  269.           dur_min = DUR::DUR_SET_MAX
  270.           for i in DUR::DATA_ARMOR_SIZE+1...$data_armors.size
  271.             # 重新确定armor_id,必定在原防具数据库之外
  272.             # 减少同名防具中耐久度最低的
  273.             if $data_armors[i].name == lose_name and $data_armors[i].dur < dur_min
  274.               armor_id = i
  275.             end
  276.           end
  277.           # 已不存在的不做操作
  278.           if armor_number(armor_id) <= 0
  279.             return
  280.           end
  281.           # 减少防具
  282.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  283.           # 删除行囊拥有的防具id,后id补进
  284.           @weapons.delete(armor_id)
  285.           armor_keys = @armors.keys.sort!
  286.           for i in armor_keys
  287.             if i > armor_id
  288.               @armors[i-1] = @armors[i]
  289.               @armors.delete(i)
  290.             end
  291.           end
  292.           # 更改角色使用中的防具id
  293.           for i in [email]0...@actors.size[/email]
  294.             if @actors[i].armor1_id != nil and @actors[i].armor1_id > armor_id
  295.               @actors[i].armor1_id -= 1
  296.             end
  297.             if @actors[i].armor2_id != nil and @actors[i].armor2_id > armor_id
  298.               @actors[i].armor2_id -= 1
  299.             end
  300.             if @actors[i].armor3_id != nil and @actors[i].armor3_id > armor_id
  301.               @actors[i].armor3_id -= 1
  302.             end
  303.             if @actors[i].armor4_id != nil and @actors[i].armor4_id > armor_id
  304.               @actors[i].armor4_id -= 1
  305.             end
  306.           end
  307.           if armor_id > DUR::DATA_ARMOR_SIZE
  308.             # 删除数据库防具id,后补进
  309.             for i in armor_id+1...$data_armors.size
  310.               $data_armors[i].id -= 1
  311.             end
  312.             $data_armors.delete_at(armor_id)
  313.             # 职业可装备防具数组更新
  314.             for i in 1...$data_classes.size
  315.               if $data_classes[i].armor_set.include?(armor_id)
  316.                 $data_classes[i].armor_set.delete(armor_id)
  317.               end
  318.               for j in $data_classes[i].armor_set
  319.                 if j > armor_id
  320.                   $data_classes[i].armor_set.delete(j)
  321.                   j -= 1
  322.                   $data_classes[i].armor_set.push(j)
  323.                 end
  324.               end
  325.             end
  326.           end
  327.         end
  328.       end
  329.     end
  330.   end
  331. end
  332. # ===========================================================================

  333. class Window_Item < Window_Selectable
  334.   #--------------------------------------------------------------------------
  335.   def update_help
  336.     description = ""
  337.     if self.item != nil
  338.       description = self.item.description
  339.       if !self.item.is_a? RPG::Item
  340.         dur_set = item.dur_set
  341.         dur = item.dur
  342.         description = description + " 耐久度: #{dur}/#{dur_set}"
  343.       end
  344.     end
  345.     @help_window.set_text(description)
  346.   end
  347. end
  348. # ===========================================================================

  349. class Window_EquipItem < Window_Selectable
  350.   #--------------------------------------------------------------------------
  351.   def update_help
  352.     description = ""
  353.     if self.item != nil
  354.       description = self.item.description
  355.       dur_set = item.dur_set
  356.       dur = item.dur
  357.       description = description + " 耐久度: #{dur}/#{dur_set}"
  358.     end
  359.     @help_window.set_text(description)
  360.   end
  361. end
  362. # ===========================================================================

  363. class Window_EquipRight < Window_Selectable
  364.   #--------------------------------------------------------------------------
  365.   def update_help
  366.     description = ""
  367.     if self.item != nil
  368.       description = self.item.description
  369.       dur_set = item.dur_set
  370.       dur = item.dur
  371.       description = description + " 耐久度: #{dur}/#{dur_set}"
  372.     end
  373.     @help_window.set_text(description)
  374.   end
  375. end
  376. #==============================================================================

  377. class Window_ShopBuy < Window_Selectable
  378.   #--------------------------------------------------------------------------
  379.   def update_help
  380.     description = ""
  381.     if self.item != nil
  382.       description = self.item.description
  383.       if !self.item.is_a? RPG::Item
  384.         dur_set = item.dur_set
  385.         dur = item.dur
  386.         description = description + " 耐久度: #{dur}/#{dur_set}"
  387.       end
  388.     end
  389.     @help_window.set_text(description)
  390.   end
  391. end
  392. #==============================================================================

  393. class Window_ShopSell < Window_Selectable
  394.   #--------------------------------------------------------------------------
  395.   def update_help
  396.     description = ""
  397.     if self.item != nil
  398.       description = self.item.description
  399.       if !self.item.is_a? RPG::Item
  400.         dur_set = item.dur_set
  401.         dur = item.dur
  402.         description = description + " 耐久度: #{dur}/#{dur_set}"
  403.       end
  404.     end
  405.     @help_window.set_text(description)
  406.   end
  407. end
  408. #==============================================================================

  409. class Scene_Title
  410.   #--------------------------------------------------------------------------
  411.   alias main_add_dur main
  412.   def main
  413.     main_add_dur
  414.     # 战斗测试的情况下
  415.     if $BTEST
  416.       battle_test
  417.       return
  418.     end
  419.     $data_weapons = load_data("Data/Weapons.rxdata")
  420.     $data_armors = load_data("Data/Armors.rxdata")
  421.     # 初始化耐久度
  422.     for i in 1...$data_weapons.size
  423.       $data_weapons[i].dur = $data_weapons[i].dur_set
  424.     end
  425.     for i in 1...$data_armors.size
  426.       $data_armors[i].dur = $data_armors[i].dur_set
  427.     end
  428.   end
  429. end
  430. #==============================================================================

  431. class Game_Battler
  432.   #--------------------------------------------------------------------------
  433.   def attack_effect(attacker)
  434.     self.critical = false
  435.     hit_result = (rand(100) < attacker.hit)
  436.     if hit_result == true
  437.       atk = [attacker.atk - self.pdef / 2, 0].max
  438.       self.damage = atk * (20 + attacker.str) / 20
  439.       self.damage *= elements_correct(attacker.element_set)
  440.       self.damage /= 100
  441.       if self.damage > 0
  442.         if rand(100) < 4 * attacker.dex / self.agi
  443.           self.damage *= 2
  444.           self.critical = true
  445.         end
  446.         if self.guarding?
  447.           self.damage /= 2
  448.         end
  449.       end
  450.       if self.damage.abs > 0
  451.         amp = [self.damage.abs * 15 / 100, 1].max
  452.         self.damage += rand(amp+1) + rand(amp+1) - amp
  453.       end
  454.       eva = 8 * self.agi / attacker.dex + self.eva
  455.       hit = self.damage < 0 ? 100 : 100 - eva
  456.       hit = self.cant_evade? ? 100 : hit
  457.       hit_result = (rand(100) < hit)
  458.     end
  459.     if hit_result == true
  460.       remove_states_shock
  461.       self.hp -= self.damage
  462.       @state_changed = false
  463.       states_plus(attacker.plus_state_set)
  464.       states_minus(attacker.minus_state_set)
  465.     else
  466.       self.damage = "Miss"
  467.       self.critical = false
  468.     end
  469.     # 耐久度判断
  470.     if hit_result == true
  471.       if self.is_a?(Game_Actor) # 如果挨打的是角色,减防具耐久度
  472.         armor_kind =  1 + rand(4)
  473.         case armor_kind
  474.         when 1
  475.           if self.armor1_id != nil and self.armor1_id > 0
  476.             if rand(2) == 0 and $data_armors[self.armor1_id].dur > 0
  477.               $data_armors[self.armor1_id].dur -= 1
  478.             end
  479.           end
  480.         when 2
  481.           if self.armor2_id != nil and self.armor2_id > 0
  482.             if rand(2) == 0 and $data_armors[self.armor2_id].dur > 0
  483.               $data_armors[self.armor2_id].dur -= 1
  484.             end
  485.           end
  486.         when 3
  487.           if self.armor3_id != nil and self.armor3_id > 0
  488.             if rand(2) == 0 and $data_armors[self.armor3_id].dur > 0
  489.               $data_armors[self.armor3_id].dur -= 1
  490.             end
  491.           end
  492.         when 4
  493.           if self.armor4_id != nil and self.armor4_id > 0
  494.             if rand(2) == 0 and $data_armors[self.armor4_id].dur > 0
  495.               $data_armors[self.armor4_id].dur -= 1
  496.             end
  497.           end
  498.         end
  499.       else  # 角色打人,减武器耐久度
  500.         if attacker.weapon_id != nil and attacker.weapon_id > 0
  501.           if rand(8) == 0 and $data_weapons[attacker.weapon_id].dur > 0
  502.             $data_weapons[attacker.weapon_id].dur -= 1
  503.           end
  504.         end
  505.       end
  506.     end
  507.     # 过程结束
  508.     return true
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   def skill_effect(user, skill)
  512.     self.critical = false
  513.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  514.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  515.       return false
  516.     end
  517.     effective = false
  518.     effective |= skill.common_event_id > 0
  519.     hit = skill.hit
  520.     if skill.atk_f > 0
  521.       hit *= user.hit / 100
  522.     end
  523.     hit_result = (rand(100) < hit)
  524.     effective |= hit < 100
  525.     if hit_result == true
  526.       power = skill.power + user.atk * skill.atk_f / 100
  527.       if power > 0
  528.         power -= self.pdef * skill.pdef_f / 200
  529.         power -= self.mdef * skill.mdef_f / 200
  530.         power = [power, 0].max
  531.       end
  532.       rate = 20
  533.       rate += (user.str * skill.str_f / 100)
  534.       rate += (user.dex * skill.dex_f / 100)
  535.       rate += (user.agi * skill.agi_f / 100)
  536.       rate += (user.int * skill.int_f / 100)
  537.       self.damage = power * rate / 20
  538.       self.damage *= elements_correct(skill.element_set)
  539.       self.damage /= 100
  540.       if self.damage > 0
  541.         if self.guarding?
  542.           self.damage /= 2
  543.         end
  544.       end
  545.       if skill.variance > 0 and self.damage.abs > 0
  546.         amp = [self.damage.abs * skill.variance / 100, 1].max
  547.         self.damage += rand(amp+1) + rand(amp+1) - amp
  548.       end
  549.       eva = 8 * self.agi / user.dex + self.eva
  550.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  551.       hit = self.cant_evade? ? 100 : hit
  552.       hit_result = (rand(100) < hit)
  553.       effective |= hit < 100
  554.     end
  555.     if hit_result == true
  556.       if skill.power != 0 and skill.atk_f > 0
  557.         remove_states_shock
  558.         effective = true
  559.       end
  560.       last_hp = self.hp
  561.       self.hp -= self.damage
  562.       effective |= self.hp != last_hp
  563.       @state_changed = false
  564.       effective |= states_plus(skill.plus_state_set)
  565.       effective |= states_minus(skill.minus_state_set)
  566.       if skill.power == 0
  567.         self.damage = ""
  568.         unless @state_changed
  569.           self.damage = "Miss"
  570.         end
  571.       end
  572.     else
  573.       self.damage = "Miss"
  574.     end
  575.     unless $game_temp.in_battle
  576.       self.damage = nil
  577.     end
  578.     # 耐久度判断
  579.     if hit_result == true
  580.       if self.is_a?(Game_Actor) # 如果挨打的是角色,减防具耐久度
  581.         armor_kind =  1 + rand(4)
  582.         case armor_kind
  583.         when 1
  584.           if self.armor1_id != nil and self.armor1_id > 0
  585.             if rand(2) == 0 and $data_armors[self.armor1_id].dur > 0
  586.               $data_armors[self.armor1_id].dur -= 1
  587.             end
  588.           end
  589.         when 2
  590.           if self.armor2_id != nil and self.armor2_id > 0
  591.             if rand(2) == 0 and $data_armors[self.armor2_id].dur > 0
  592.               $data_armors[self.armor2_id].dur -= 1
  593.             end
  594.           end
  595.         when 3
  596.           if self.armor3_id != nil and self.armor3_id > 0
  597.             if rand(2) == 0 and $data_armors[self.armor3_id].dur > 0
  598.               $data_armors[self.armor3_id].dur -= 1
  599.             end
  600.           end
  601.         when 4
  602.           if self.armor4_id != nil and self.armor4_id > 0
  603.             if rand(2) == 0 and $data_armors[self.armor4_id].dur > 0
  604.               $data_armors[self.armor4_id].dur -= 1
  605.             end
  606.           end
  607.         end
  608.       else  # 角色打人,减武器耐久度
  609.         if user.weapon_id != nil and user.weapon_id > 0
  610.           if rand(8) == 0 and $data_weapons[user.weapon_id].dur > 0
  611.             if skill.atk_f == 0 # 非物理技能不损武器耐久度
  612.               $data_weapons[user.weapon_id].dur -= 1
  613.             end
  614.           end
  615.         end
  616.       end
  617.     end
  618.     # 过程结束
  619.     return effective
  620.   end
  621. end
  622. #==============================================================================

  623. class Window_Dur < Window_Base
  624.   #--------------------------------------------------------------------------
  625.   def initialize
  626.     super(0,0,320,480)
  627.     self.opacity = 0
  628.     self.contents = Bitmap.new(width - 32, height - 32)
  629.     @text_dur_old = [0]
  630.     @text_dur = []
  631.     refresh
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   def draw_text_dur(index,y)
  635.     text = @text_dur[index]
  636.     tx = 0
  637.     ty = index * 24 + y
  638.     self.contents.font.color = normal_color
  639.     self.contents.draw_text(tx, ty, 320-32, 24, text)
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   def refresh
  643.     # 节省内存
  644.     if @text_dur_old == @text_dur
  645.       return
  646.     end
  647.     @text_dur.clear
  648.     # 取得空耐久度的装备名
  649.     for i in $game_party.actors
  650.       if $data_weapons[i.weapon_id] != nil and $data_weapons[i
复制代码





要是不能弄的话只好想其他办法让装备进行消耗了
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部