# ▼▲▼ バトルパーツ16. 戦闘中にメニューへ - BattleInterruptScene - ▼▲▼ # ▼▲▼ XRXS26. パーティメンバー拡張機構 ver..04.9 ▼▲▼ built 082422 # by 桜雅 在土 # by かーい #============================================================================== # □ カスタマイズポイント #============================================================================== module XRXS26 PARTYCHANGE_TEXT = "入れ替え" # メンバー入れ替えのコマンド名 MENU_STATUS_STRETCH = true # 「メニューステータスをストレッチ」(3人以下の場合) #------------------------------------------------------------------------------ # 「メニューステータスウィンドウ」に関する値の設定 #------------------------------------------------------------------------------ # 列数 COLUMN_MAX = 1 # カーソル:高さ CURSOR_HEIGHT = 96 # 一行の高さ LINE_HEIGHT = 116 #------------------------------------------------------------------------------ # 「入れ替えメニュー」稼動部分のカスタマイズ #------------------------------------------------------------------------------ MENU_MEMBER_CHANGE_KEY_GO = Input::RIGHT # 「入れ替え」移行キー MENU_MEMBER_CHANGE_KEY_END = Input::LEFT # 「入れ替え」終了キー MENU_MEMBER_CHANGE_INDEX_MIN = 0 # 「入れ替え」に移行できるコマンド位置の最低値 FORCETOBATTLE_ACTORS = [] # 待機へ送れないアクターIDの配列 UMBATTLABLE_ACTORS = [] # 戦闘へ送れないアクターIDの配列 UNMOVABLE_ACTORS = [] # 場所すら固定なアクターIDの配列 end #============================================================================== # --- XRXS.BattleInterruptScene機構 --- #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● 勝敗判定 #-------------------------------------------------------------------------- def judge # 全滅判定が真、またはパーティ人数が 0 人の場合 if $game_party.all_dead? or $game_party.actors.size == 0 bool = true for actor in $game_party.backword_actors bool = actor.dead? break unless bool end # 待機メンバーも全滅の場合 if bool # ゲームオーバーフラグをセット $game_temp.gameover = true # true を返す return true # 敗北可能の場合 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 else # 待機メンバーがいる場合、交代 for actor in $game_party.backword_actors back_actors = $game_party.actors # 生存しているアクター優先 forword_actors = $game_party.backword_actors.sort{|a, b| c = a.dead? ? -1 : 1 d = b.dead? ? -1 : 1 if c == d $game_party.backword_actors.index(a) <=> $game_party.backword_actors.index(b) else c <=> d end } $game_party.actors.clear $game_party.backword_actors.clear for i in 0...XRXS26::FRONT_MEMBER_LIMIT $game_party.actors.push(forword_actors.shift) end $game_party.backword_actors = back_actors + forword_actors end @status_window.refresh end 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 @interrupt_scene != nil # 保存 save_scene = $scene # フレーム更新 @interrupt_scene.update # シーン切り替えの判定 next_scene = nil if $scene.is_a?(Scene_Menu) next_scene = nil $scene = save_scene @interrupt_scene.dispose elsif $scene != save_scene next_scene = $scene $scene = save_scene end # 次への判定 if next_scene != nil @interrupt_scene = next_scene elsif @interrupt_scene.disposed? @interrupt_scene = nil @spriteset.viewport1.visible = true @spriteset.viewport2.visible = true @spriteset.viewport3.visible = true @spriteset.viewport4.visible = true @actor_command_window.visible= @actor_command_window_visible @party_command_window.visible= true @help_window.visible = true @status_window.visible = true $game_temp.in_battle = true @status_window.refresh @extra_sprites.each {|sprite| sprite.visible = true } end return end # 呼び戻す xrxs_bp16_update end #-------------------------------------------------------------------------- # ● フレーム更新 (パーティコマンドフェーズ) #-------------------------------------------------------------------------- def update_phase2 xrxs16ax_update_phase2 # # コマンド「装備」 # # C ボタンが押された場合 if Input.trigger?(Input::C) # アクターコマンドウィンドウのカーソル位置で分岐 case @party_command_window.index when @@xrxs16ax_index # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 割り込みメンバーチェンジメニューへ call_party_chamge end end end #-------------------------------------------------------------------------- # ○ パーティ入れ替えメニューの呼び出し #-------------------------------------------------------------------------- def call_party_chamge set_interrupt_scene(Scene_PartyChange.new) end end #============================================================================== # ■ Scene_PartyChange #============================================================================== class Scene_PartyChange #-------------------------------------------------------------------------- # ○ インクルード #-------------------------------------------------------------------------- include XRXS26 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize # 待機メンバーから一時的に復帰 $game_party.actors[$game_party.actors.size,0] = $game_party.backword_actors $game_party.backword_actors.clear # ステータスウィンドウを作成 @status_window = Window_MenuStatus.new @status_window.x = 80 @status_window.active = true @status_window.index = 0 end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update @status_window.update # B ボタンが押されたとき if Input.trigger?(Input::B) if @status_window.index2 >= 0 @status_window.index = @status_window.index2 @status_window.index2 = -1 return else # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # 仕様上、メニュー画面に切り替え $scene = Scene_Menu.new return end end # 決定キーが押されたとき if Input.trigger?(Input::C) if @status_window.index2 == -1 if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メンバーの入れ替え一人目の決定 @status_window.index2 = @status_window.index else if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # どちらかが戦闘メンバー かつ どちらかが戦闘禁止アクター の場合 if (@status_window.index < FRONT_MEMBER_LIMIT or @status_window.index2 < FRONT_MEMBER_LIMIT) and (UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index].id) or UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index2].id)) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # どちらかが待機メンバー かつ どちらかが待機禁止アクター の場合 if (@status_window.index >= FRONT_MEMBER_LIMIT or @status_window.index2 >= FRONT_MEMBER_LIMIT) and (FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index].id) or FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index2].id)) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メンバーの入れ替え二人目の決定と入れ替えの実行 actor2 = $game_party.actors[@status_window.index] actor = $game_party.actors[@status_window.index2] $game_party.actors[@status_window.index2] = actor2 $game_party.actors[@status_window.index] = actor @status_window.index = @status_window.index2 @status_window.index2 = -1 # プレイヤーをリフレッシュ $game_player.refresh # ステータスウィンドウをリフレッシュ @status_window.refresh end return end end #-------------------------------------------------------------------------- # ○ 解放したか? #-------------------------------------------------------------------------- def disposed? return @disposed end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @disposed = true @status_window.dispose # 待機メンバーを退避---------- $game_party.backword_actors[0,0] = $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT] $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT] = nil $game_party.actors.compact! end end class Window_PartyCommand < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize xrxs16ax_initialize @@xrxs16ax_index = @commands.size @commands.push(XRXS26::PARTYCHANGE_TEXT) @item_max += 1 refresh end end