- 注册时间
- 2006-6-11
- 最后登录
- 2007-3-31
⑤进阶
- 积分
- 658

|
这个RTAB1.16版,使用后发现战斗速度飙升至55~65帧- -||,攻击动画还没看清就结束了.......经本人的研究,发现问题就出在这开始的1000行中....可惜不懂Ruby,只好求高手帮忙了....
麻烦懂Ruby的神人了.....十二万分感谢.....
- # リアルタイム・アクティブバトル(RTAB) Ver 1.16
- # 配布元・サポートURL
- # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :status_window # ステータスウィンドウ
- attr_reader :spriteset # バトルスプライト
- attr_reader :scroll_time # スクリーン移動基本時間
- attr_reader :zoom_rate # 敵バトラー基本位置
- attr_reader :drive # カメラ駆動
- attr_accessor :force # アクション強制度
- attr_accessor :camera # 現在のカメラ所持者
- #--------------------------------------------------------------------------
- # ● ATB基礎セットアップ
- #--------------------------------------------------------------------------
- def atb_setup
- # ATB初期化
- # speed : バトルスピード決定。値が小さいほど早い
- # @active : アクティブ度設定
- # 3 : 常にアクティブ状態
- # 2 : スキル・アイテム選択中のみアクティブゲージが止まる
- # 1 : 2の状態に加え、ターゲット選択時もウェイトが掛かる
- # 0 : 1の状態に加え、コマンド入力時にもウェイトが掛かる
- # @action : 他人が行動中に自分も行動を起こすことを許すか
- # 3 : 自分が行動不能でない限り限り許す
- # 2 : 自分がダメージを受けていない限り許す
- # 1 : 2の状態に加え、ターゲットが行動していない限り許す
- # 0 : 行動を許さない。順番に行動し終えるまで待つ
- # @anime_wait : trueにするとバトルアニメ・ダメージ表示中はウェイトが掛かる
- # @damage_wait : ダメージ表示待ち時間(単位はフレーム)
- # @after_wait : 味方・敵全滅時、次の処理に移るまでの待ち時間
- # [a, b] a は味方全滅時、b は敵全滅時(単位はフレーム)
- # @enemy_speed : 敵の思考速度。1なら即時行動。
- # 1フレーム毎に、1/@enemy_speedの確率で行動を起こす
- # @force : 強制アクションでスキル使用時の強制具合
- # 2:スキルは全て詠唱せず、必ず即時実行
- # 1:単独スキルは詠唱し、連携スキルのみ即時実行
- # 0:全スキル詠唱を行うだけ
- # ($scene.force = x とすることにより、通常イベントのスクリプトから変更可能)
- # @drive : カメラ駆動ON/OFF。trueで駆動ON、falseで駆動OFF
- # @scroll_time : スクリーン移動に要する基本時間
- # @zoom_rate = [i, j] : エネミーのズーム率
- # i が画面最上部に配置した時の拡大率
- # j が画面最下部に配置した時の拡大率
- # 1 倍としたいときも、1.0 と必ず小数で設定すること
- speed = 150
- @active = 1
- @action = 0
- @anime_wait = false
- @damage_wait = 10
- @after_wait = [80, 0]
- @enemy_speed = 40
- @force = 2
- @drive = true
- @scroll_time = 15
- @zoom_rate = [0.2, 1.0]
- @help_time = 40
- @escape == false
- @camera = nil
- @max = 0
- @turn_cnt = 0
- @help_wait = 0
- @action_battlers = []
- @synthe = []
- @spell_p = {}
- @spell_e = {}
- @command_a = false
- @command = []
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # @party = false
- #------------------------------------------------------------------------------
- for battler in $game_party.actors + $game_troop.enemies
- spell_reset(battler)
- battler.at = battler.agi * rand(speed / 2)
- battler.damage_pop = {}
- battler.damage = {}
- battler.damage_sp = {}
- battler.critical = {}
- battler.recover_hp = {}
- battler.recover_sp = {}
- battler.state_p = {}
- battler.state_m = {}
- battler.animation = []
- if battler.is_a?(Game_Actor)
- @max += battler.agi
- end
- end
- @max *= speed
- @max /= $game_party.actors.size
- for battler in $game_party.actors + $game_troop.enemies
- battler.atp = 100 * battler.at / @max
- end
- end
- #--------------------------------------------------------------------------
- # ● ATゲージMax時SE
- #--------------------------------------------------------------------------
- def fullat_se
- Audio.se_play("Audio/SE/033-switch02", 80, 100)
- end
- #--------------------------------------------------------------------------
- # ● レベルアップSE
- #--------------------------------------------------------------------------
- def levelup_se
- Audio.se_play("Audio/SE/056-Right02", 80, 100)
- end
- #--------------------------------------------------------------------------
- # ● スキル習得SE
- #--------------------------------------------------------------------------
- def skill_se
- Audio.se_play("Audio/SE/056-Right02", 80, 150)
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● ATG の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 描画先の幅
- #--------------------------------------------------------------------------
- def draw_actor_atg(actor, x, y, width = 144)
- if @at_gauge == nil
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- @plus_x = 0
- @rate_x = 0
- @plus_y = 16
- @plus_width = 0
- @rate_width = 100
- @width = @plus_width + width * @rate_width / 100
- @height = 16
- @align1 = 0
- @align2 = 1
- @align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション)
- grade1 = 1
- grade2 = 0
- # 色設定。color1:最外枠,color2:中枠
- # color3:空枠ダークカラー,color4:空枠ライトカラー
- color1 = Color.new(0, 0, 0)
- color2 = Color.new(255, 255, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 0, 64, 192)
- # ゲージの色設定
- # 通常時の色設定
- color5 = Color.new(0, 64, 80)
- color6 = Color.new(0, 128, 160)
- # ゲージがMAXの時の色設定
- color7 = Color.new(80, 0, 0)
- color8 = Color.new(240, 0, 0)
- # 連携スキル使用時の色設定
- color9 = Color.new(80, 64, 32)
- color10 = Color.new(240, 192, 96)
- # スキル詠唱時の色設定
- color11 = Color.new(80, 0, 64)
- color12 = Color.new(240, 0, 192)
- # ゲージの描画
- gauge_rect_at(@width, @height, @align3, color1, color2,
- color3, color4, color5, color6, color7, color8,
- color9, color10, color11, color12, grade1, grade2)
- end
- # 変数atに描画するゲージの幅を代入
- if actor.rtp == 0
- at = (width + @plus_width) * actor.atp * @rate_width / 10000
- else
- at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
- end
- if at > width
- at = width
- end
- # ゲージの左詰・中央構え等の補正
- case @align1
- when 1
- x += (@rect_width - width) / 2
- when 2
- x += @rect_width - width
- end
- case @align2
- when 1
- y -= @height / 2
- when 2
- y -= @height
- end
- self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
- @at_gauge, Rect.new(0, 0, @width, @height))
- if @align3 == 0
- rect_x = 0
- else
- x += @width - at - 1
- rect_x = @width - at - 1
- end
- # ゲージの色設定
- if at == width
- # MAX時のゲージ描画
- self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
- @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
- else
- if actor.rtp == 0
- # 通常時のゲージ描画
- self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
- @at_gauge, Rect.new(rect_x, @height, at, @height))
- else
- if actor.spell == true
- # 連携スキル使用時のゲージ描画
- self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
- @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
- else
- # スキル詠唱時のゲージ描画
- self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
- @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_Battle (分割定義 1)
- #------------------------------------------------------------------------------
- # バトル画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # 戦闘用の各種一時データを初期化
- Graphics.frame_rate = 60
- $game_temp.in_battle = true
- $game_temp.battle_turn = 0
- $game_temp.battle_event_flags.clear
- $game_temp.battle_abort = false
- $game_temp.battle_main_phase = false
- $game_temp.battleback_name = $game_map.battleback_name
- $game_temp.forcing_battler = nil
- # バトルイベント用インタプリタを初期化
- $game_system.battle_interpreter.setup(nil, 0)
- # トループを準備
- @troop_id = $game_temp.battle_troop_id
- $game_troop.setup(@troop_id)
- atb_setup
- # アクターコマンドウィンドウを作成
- #==============================================================================
- #RTAB观光游第三站,战斗菜单增加逃跑选项
- #==============================================================================
- s1 = $data_system.words.attack
- s2 = $data_system.words.skill
- s3 = $data_system.words.guard
- s4 = $data_system.words.item
- s5 = "逃跑"
- @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
- # @actor_command_window.y = 160
- @actor_command_window.y = 128
- @actor_command_window.back_opacity = 160
- @actor_command_window.active = false
- @actor_command_window.visible = false
- #==============================================================================
- # その他のウィンドウを作成
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # @party_command_window = Window_PartyCommand.new
- #------------------------------------------------------------------------------
- @help_window = Window_Help.new
- @help_window.back_opacity = 160
- @help_window.visible = false
- @status_window = Window_BattleStatus.new
- @message_window = Window_Message.new
- # スプライトセットを作成
- @spriteset = Spriteset_Battle.new
- # ウェイトカウントを初期化
- @wait_count = 0
- # トランジション実行
- if $data_system.battle_transition == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $data_system.battle_transition)
- end
- # プレバトルフェーズ開始
- start_phase1
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # マップをリフレッシュ
- $game_map.refresh
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @actor_command_window.dispose
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # @party_command_window.dispose
- #------------------------------------------------------------------------------
- @help_window.dispose
- @status_window.dispose
- @message_window.dispose
- if @skill_window != nil
- @skill_window.dispose
- end
- if @item_window != nil
- @item_window.dispose
- end
- if @result_window != nil
- @result_window.dispose
- end
- # スプライトセットを解放
- @spriteset.dispose
- # タイトル画面に切り替え中の場合
- if $scene.is_a?(Scene_Title)
- # 画面をフェードアウト
- Graphics.transition
- Graphics.freeze
- end
- # 戦闘テストからゲームオーバー画面以外に切り替え中の場合
- if $BTEST and not $scene.is_a?(Scene_Gameover)
- $scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 勝敗判定
- #--------------------------------------------------------------------------
- def judge
- # 全滅判定が真、またはパーティ人数が 0 人の場合
- if $game_party.all_dead? or $game_party.actors.size == 0
- # 敗北可能の場合
- if $game_temp.battle_can_lose
- # バトル開始前の BGM に戻す
- $game_system.bgm_play($game_temp.map_bgm)
- # バトル終了
- battle_end(2)
- # true を返す
- return true
- end
- # ゲームオーバーフラグをセット
- $game_temp.gameover = true
- # true を返す
- return true
- end
- # エネミーが 1 体でも存在すれば false を返す
- for enemy in $game_troop.enemies
- if enemy.exist?
- return false
- end
- end
- # アフターバトルフェーズ開始 (勝利)
- start_phase5
- # true を返す
- return true
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # バトルイベント実行中の場合
- if $game_system.battle_interpreter.running?
- if @command.size > 0
- @command_a = false
- @command = []
- command_delete
- end
- @status_window.at_refresh
- # インタプリタを更新
- $game_system.battle_interpreter.update
- # アクションを強制されているバトラーが存在しない場合
- if $game_temp.forcing_battler == nil
- # バトルイベントの実行が終わった場合
- unless $game_system.battle_interpreter.running?
- # バトルイベントのセットアップを再実行
- @status_window.refresh
- setup_battle_event
- end
- end
- end
- # システム (タイマー)、画面を更新
- $game_system.update
- $game_screen.update
- # タイマーが 0 になった場合
- if $game_system.timer_working and $game_system.timer == 0
- # バトル中断
- $game_temp.battle_abort = true
- end
- # ウィンドウを更新
- @help_window.update
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # @party_command_window.update
- #------------------------------------------------------------------------------
- @actor_command_window.update
- @status_window.update
- @message_window.update
- # スプライトセットを更新
- @spriteset.update
- # トランジション処理中の場合
- if $game_temp.transition_processing
- # トランジション処理中フラグをクリア
- $game_temp.transition_processing = false
- # トランジション実行
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # メッセージウィンドウ表示中の場合
- if $game_temp.message_window_showing
- return
- end
- # ゲームオーバーの場合
- if $game_temp.gameover
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # タイトル画面に戻す場合
- if $game_temp.to_title
- # タイトル画面に切り替え
- $scene = Scene_Title.new
- return
- end
- # バトル中断の場合
- if $game_temp.battle_abort
- # バトル開始前の BGM に戻す
- $game_system.bgm_play($game_temp.map_bgm)
- # バトル終了
- battle_end(1)
- return
- end
- # ヘルプウィンドウ表示中の場合
- if @help_wait > 0
- @help_wait -= 1
- if @help_wait == 0
- # ヘルプウィンドウを隠す
- @help_window.visible = false
- end
- end
- # アクションを強制されているバトラーが存在せず、
- # かつバトルイベントが実行中の場合
- if $game_temp.forcing_battler == nil and
- $game_system.battle_interpreter.running?
- return
- end
- # フェーズによって分岐
- case @phase
- when 0 # ATゲージ更新フェーズ
- if anime_wait_return
- update_phase0
- end
- when 1 # プレバトルフェーズ
- update_phase1
- return
- when 2 # パーティコマンドフェーズ
- update_phase2
- return
- when 5 # アフターバトルフェーズ
- update_phase5
- return
- end
- if $scene != self
- return
- end
- if @phase == 0
- if @command.size != 0 # アクターコマンドフェーズ
- if @command_a == false
- start_phase3
- end
- update_phase3
- end
- # ウェイト中の場合
- if @wait_count > 0
- # ウェイトカウントを減らす
- @wait_count -= 1
- return
- end
- update_phase4
- end
- end
- #==============================================================================
- # ■ Scene_Battle (分割定義 2)
- #------------------------------------------------------------------------------
- # バトル画面の処理を行うクラスです。
- #==============================================================================
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ATゲージ更新フェーズ)
- #--------------------------------------------------------------------------
- def update_phase0
- if $game_temp.battle_turn == 0
- $game_temp.battle_turn = 1
- end
- # B ボタンが押された場合
- # if @command_a == false and @party == false
- # if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- # $game_system.se_play($data_system.cancel_se)
- # @party = true
- # end
- # end
- # if @party == true and
- # ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
- # (@action_battlers.empty? or @action_battlers[0].phase == 1)))
- # パーティコマンドフェーズへ
- # start_phase2
- # return
- # end
- # ATゲージ増加処理
- cnt = 0
- for battler in $game_party.actors + $game_troop.enemies
- active?(battler)
- if battler.rtp == 0
- if battler.at >= @max
- if battler.is_a?(Game_Actor)
- if battler.inputable?
- unless @action_battlers.include?(battler) or
- @command.include?(battler) or @escape == true
- if battler.current_action.forcing
- fullat_se
- force_action(battler)
- action_start(battler)
- else
- fullat_se
- @command.push(battler)
- end
- end
- else
- unless @action_battlers.include?(battler) or
- battler == @command[0]
- battler.current_action.clear
- if @command.include?(battler)
- @command.delete(battler)
- else
- if battler.movable?
- fullat_se
- end
- end
- action_start(battler)
- end
- end
- else
- unless @action_battlers.include?(battler)
- if battler.current_action.forcing
- force_action(battler)
- action_start(battler)
- else
- if @enemy_speed != 0
- if rand(@enemy_speed) == 0
- number = cnt - $game_party.actors.size
- enemy_action(number)
- end
- else
- number = cnt - $game_party.actors.size
- enemy_action(number)
- end
- end
- end
- end
- else
- battler.at += battler.agi
- if battler.guarding?
- battler.at += battler.agi
- end
- if battler.movable?
- battler.atp = 100 * battler.at / @max
- end
- end
- else
- if battler.rt >= battler.rtp
- speller = synthe?(battler)
- if speller != nil
- battler = speller[0]
- end
- unless @action_battlers.include?(battler)
- if battler.is_a?(Game_Actor)
- fullat_se
- end
- battler.rt = battler.rtp
- action_start(battler)
- end
- else
- battler.rt += battler.agi
- speller = synthe?(battler)
- if speller != nil
- for spell in speller
- if spell != battler
- spell.rt += battler.agi
- end
- end
- end
- end
- end
- cnt += 1
- end
- # ATゲージをリフレッシュ
- @status_window.at_refresh
- # 逃走処理
- if @escape == true and
- ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
- (@action_battlers.empty? or @action_battlers[0].phase == 1)))
- temp = false
- for battler in $game_party.actors
- if battler.inputable?
- temp = true
- end
- end
- if temp == true
- for battler in $game_party.actors
- if battler.at < @max and battler.inputable?
- temp = false
- break
- end
- end
- if temp == true
- @escape = false
- for battler in $game_party.actors
- battler.at %= @max
- end
- $game_temp.battle_main_phase = false
- update_phase2_escape
- end
- end
- end
- end
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- #--------------------------------------------------------------------------
- # ● パーティコマンドフェーズ開始
- #--------------------------------------------------------------------------
- # def start_phase2
- # フェーズ 2 に移行
- # @phase = 2
- # @party = false
- # パーティコマンドウィンドウを有効化
- # @party_command_window.active = true
- # @party_command_window.visible = true
- # アクターを非選択状態に設定
- # @actor_index = -1
- # アクターコマンドウィンドウを無効化
- # @actor_command_window.active = false
- # @actor_command_window.visible = false
- # if @command.size != 0
- # アクターの明滅エフェクト OFF
- # if @active_actor != nil
- # @active_actor.blink = false
- # end
- # end
- # カメラセット
- # @camera == "party"
- # @spriteset.screen_target(0, 0, 1)
- # メインフェーズフラグをクリア
- # $game_temp.battle_main_phase = false
- # end
- #------------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # ● フレーム更新 (パーティコマンドフェーズ)
- #--------------------------------------------------------------------------
- def update_phase2
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # C ボタンが押された場合
- # 去掉“战斗/逃跑”选项
- # if Input.trigger?(Input::C)
- # パーティコマンドウィンドウのカーソル位置で分岐
- # case @party_command_window.index
- # when 0 # 戦う
- # パーティコマンドウィンドウを無効化
- # @party_command_window.active = false
- # @party_command_window.visible = false
- # 決定 SE を演奏
- # $game_system.se_play($data_system.decision_se)
- #------------------------------------------------------------------------------
- @escape = false
- @phase = 0
- if $game_temp.battle_turn == 0
- $game_temp.battle_turn = 1
- end
- if @command_a == true
- # アクターコマンドフェーズ開始
- start_phase3
- else
- $game_temp.battle_main_phase = true
- end
- end
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # when 1 # 逃げる
- # 逃走可能ではない場合
- # if $game_temp.battle_can_escape == false
- # ブザー SE を演奏
- # $game_system.se_play($data_system.buzzer_se)
- # return
- # end
- # 決定 SE を演奏
- # $game_system.se_play($data_system.decision_se)
- # @phase = 0
- # パーティコマンドウィンドウを無効化
- # @party_command_window.active = false
- # @party_command_window.visible = false
- # $game_temp.battle_main_phase = true
- # if $game_temp.battle_turn == 0
- # update_phase2_escape
- # $game_temp.battle_turn = 1
- # for battler in $game_party.actors
- # battler.at -= @max / 2
- # end
- # return
- # end
- # 決定 SE を演奏
- # $game_system.se_play($data_system.decision_se)
- # @escape = true
- # for battler in $game_party.actors
- # @command_a = false
- # @command.delete(battler)
- # @action_battlers.delete(battler)
- # skill_reset(battler)
- # end
- # end
- # return
- # end
- #end
- #------------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
- #--------------------------------------------------------------------------
- def update_phase2_escape
- # エネミーの素早さ平均値を計算
- enemies_agi = 0
- enemies_number = 0
- for enemy in $game_troop.enemies
- if enemy.exist?
- enemies_agi += enemy.agi
- enemies_number += 1
- end
- end
- if enemies_number > 0
- enemies_agi /= enemies_number
- end
- # アクターの素早さ平均値を計算
- actors_agi = 0
- actors_number = 0
- for actor in $game_party.actors
- if actor.exist?
- actors_agi += actor.agi
- actors_number += 1
- end
- end
- if actors_number > 0
- actors_agi /= actors_number
- end
- # 逃走成功判定
- success = rand(100) < 50 * actors_agi / enemies_agi
- # 逃走成功の場合
- if success
- # 逃走 SE を演奏
- $game_system.se_play($data_system.escape_se)
- # バトル開始前の BGM に戻す
- $game_system.bgm_play($game_temp.map_bgm)
- # バトル終了
- battle_end(1)
- # 逃走失敗の場合
- else
- @help_window.set_text("逃走失敗", 1)
- @help_wait = @help_time
- # パーティ全員のアクションをクリア
- $game_party.clear_actions
- # メインフェーズ開始
- start_phase4
- end
- end
- #--------------------------------------------------------------------------
- # ● アフターバトルフェーズ開始
- #--------------------------------------------------------------------------
- def start_phase5
- # フェーズ 5 に移行
- @phase = 5
- # バトル終了 ME を演奏
- $game_system.me_play($game_system.battle_end_me)
- # バトル開始前の BGM に戻す
- $game_system.bgm_play($game_temp.map_bgm)
- # EXP、ゴールド、トレジャーを初期化
- exp = 0
- gold = 0
- treasures = []
- if @active_actor != nil
- @active_actor.blink = false
- end
- # メインフェーズフラグをセット
- $game_temp.battle_main_phase = true
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # パーティコマンドウィンドウを無効化
- # @party_command_window.active = false
- # @party_command_window.visible = false
- #------------------------------------------------------------------------------
- # アクターコマンドウィンドウを無効化
- @actor_command_window.active = false
- @actor_command_window.visible = false
- if @skill_window != nil
- # スキルウィンドウを解放
- @skill_window.dispose
- @skill_window = nil
- end
- if @item_window != nil
- # アイテムウィンドウを解放
- @item_window.dispose
- @item_window = nil
- end
- # ヘルプウィンドウを隠す
- @help_window.visible = false
- # ループ
- for enemy in $game_troop.enemies
- # エネミーが隠れ状態でない場合
- unless enemy.hidden
- # 獲得 EXP、ゴールドを追加
- exp += enemy.exp
- gold += enemy.gold
- # トレジャー出現判定
- if rand(100) < enemy.treasure_prob
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- end
- end
- end
- # トレジャーの数を 6 個までに限定
- treasures = treasures[0..5]
- # EXP 獲得
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp += exp
- if actor.level > last_level
- @status_window.level_up(i)
- actor.damage[[actor, -1]] = "Level up!"
- actor.up_level = actor.level - last_level
- end
- end
- end
- # ゴールド獲得
- $game_party.gain_gold(gold)
- # トレジャー獲得
- for item in treasures
- case item
- when RPG::Item
- $game_party.gain_item(item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(item.id, 1)
- end
- end
- # バトルリザルトウィンドウを作成
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- # ウェイトカウントを設定
- @phase5_wait_count = 100
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アフターバトルフェーズ)
- #--------------------------------------------------------------------------
- def update_phase5
- # ウェイトカウントが 0 より大きい場合
- if @phase5_wait_count > 0
- # ウェイトカウントを減らす
- @phase5_wait_count -= 1
- # ウェイトカウントが 0 になった場合
- if @phase5_wait_count == 0
- # リザルトウィンドウを表示
- @result_window.visible = true
- # メインフェーズフラグをクリア
- $game_temp.battle_main_phase = false
- # ステータスウィンドウをリフレッシュ
- @status_window.refresh
- for actor in $game_party.actors
- if actor.damage.include?([actor, 0])
- @phase5_wait_count = 20
- actor.damage_pop[[actor, 0]] = true
- end
- if actor.damage.include?([actor, -1])
- @phase5_wait_count = 20
- actor.damage_pop[[actor, -1]] = true
- for level in actor.level - actor.up_level + 1..actor.level
- for skill in $data_classes[actor.class_id].learnings
- if level == skill.level and not actor.skill_learn?(skill.id)
- actor.damage[[actor, 0]] = "New Skill!"
- break
- end
- end
- end
- end
- end
- end
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # バトル終了
- battle_end(0)
- end
- end
- #==============================================================================
- # ■ Scene_Battle (分割定義 3)
- #------------------------------------------------------------------------------
- # バトル画面の処理を行うクラスです。
- #==============================================================================
- #--------------------------------------------------------------------------
- # ● アクターコマンドフェーズ開始
- #--------------------------------------------------------------------------
- def start_phase3
- if victory?
- return
- end
- # メインフェーズフラグをクリア
- $game_temp.battle_main_phase = false
- @command_a = true
- @active_actor = @command[0]
- cnt = 0
- for actor in $game_party.actors
- if actor == @active_actor
- @actor_index = cnt
- end
- cnt += 1
- end
- @active_actor.blink = true
- unless @active_actor.inputable?
- @active_actor.current_action.clear
- phase3_next_actor
- return
- end
- phase3_setup_command_window
- # カメラの設定
- @camera = "command"
- plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
- y = [(plus.abs - 1.5) * 10 , 0].min
- @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
- end
- #--------------------------------------------------------------------------
- # ● アクターのコマンド入力終了
- #--------------------------------------------------------------------------
- def phase3_next_actor
- @command.shift
- @command_a = false
- # メインフェーズフラグをセット
- $game_temp.battle_main_phase = true
- # アクターコマンドウィンドウを無効化
- @actor_command_window.active = false
- @actor_command_window.visible = false
- # アクターの明滅エフェクト OFF
- if @active_actor != nil
- @active_actor.blink = false
- end
- action_start(@active_actor)
- # カメラを元に戻す
- if @camera == "command"
- @spriteset.screen_target(0, 0, 1)
- end
- return
- end
- #--------------------------------------------------------------------------
- # ● アクターコマンドウィンドウのセットアップ
- #--------------------------------------------------------------------------
- def phase3_setup_command_window
- #------------------------------------------------------------------------------
- #RTAB观光游第一站,去除“战斗/逃跑”选项部分
- # パーティコマンドウィンドウを無効化
- # @party_command_window.active = false
- # @party_command_window.visible = false
- #------------------------------------------------------------------------------
- # アクターコマンドウィンドウを有効化
- @actor_command_window.active = true
- @actor_command_window.visible = true
- # アクターコマンドウィンドウの位置を設定
- @actor_command_window.x = @actor_index * 160 +
- (4 - $game_party.actors.size) * 80
- # インデックスを 0 に設定
- @actor_command_window.index = 0
- end
- #--------------------------------------------------------------------------
- # ● エネミーアクション作成
- #--------------------------------------------------------------------------
- def enemy_action(number)
- enemy = $game_troop.enemies[number]
- unless enemy.current_action.forcing
- enemy.make_action
- end
- action_start(enemy)
- end
复制代码 |
|