# # オートバトル(RGSS2) #  (C)2008 TYPE74RX-T # # ※:カスタマイズポイント…15行目 #============================================================================== # ★ RX_T #------------------------------------------------------------------------------ #  設定用 #============================================================================== module RX_T AutoBattleCommandName = "オート" # オートバトル用パーティコマンド名 end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● セットアップ # actor_id : アクター ID #-------------------------------------------------------------------------- alias rgss2b3_setup setup def setup(actor_id) # メソッドを呼び戻す rgss2b3_setup(actor_id) # オートバトルフラグ(コピー用) @rx_auto_battle = nil end #-------------------------------------------------------------------------- # ★ オートバトルフラグ(コピー用) #-------------------------------------------------------------------------- def rx_auto_battle return @rx_auto_battle end #-------------------------------------------------------------------------- # ★ アクターのオートバトルフラグをコピー #-------------------------------------------------------------------------- def rx_auto_battle_copy @rx_auto_battle = actor.auto_battle end #-------------------------------------------------------------------------- # ★ アクターのオートバトルフラグをオン #-------------------------------------------------------------------------- def rx_auto_battle_on actor.auto_battle = true end #-------------------------------------------------------------------------- # ★ アクターのオートバトルフラグを修復 #-------------------------------------------------------------------------- def rx_auto_battle_recover actor.auto_battle = @rx_auto_battle if @rx_auto_battle != nil end end #============================================================================== # ■ Window_PartyCommand #------------------------------------------------------------------------------ #  バトル画面で、戦うか逃げるかを選択するウィンドウです。 #============================================================================== class Window_PartyCommand < Window_Command #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize s1 = Vocab::fight s2 = Vocab::escape s3 = RX_T::AutoBattleCommandName super(128, [s1, s2, s3], 1, 4) draw_item(0, true) draw_item(1, $game_troop.can_escape) self.active = false end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 戦闘終了 # result : 結果 (0:勝利 1:逃走 2:敗北) #-------------------------------------------------------------------------- alias rgss2b3_battle_end battle_end def battle_end(result) # ★ パーティ全員の自動戦闘フラグを復元 for actor in $game_party.members actor.rx_auto_battle_recover end # ★ メソッドを呼び戻す rgss2b3_battle_end(result) end #-------------------------------------------------------------------------- # ● パーティコマンド選択の更新 #-------------------------------------------------------------------------- def update_party_command_selection if Input.trigger?(Input::C) case @party_command_window.index when 0 # 戦う # ★ 自動戦闘フラグを待避 for actor in $game_party.members actor.rx_auto_battle_copy end Sound.play_decision @status_window.index = @actor_index = -1 next_actor when 1 # 逃げる # ★ 自動戦闘フラグを待避 for actor in $game_party.members actor.rx_auto_battle_copy end if $game_troop.can_escape == false Sound.play_buzzer return end Sound.play_decision process_escape when 2 # 逃げる Sound.play_decision @status_window.index = @actor_index = -1 # ★ 自動戦闘フラグを待避した後、パーティ全員の自動戦闘フラグをON for actor in $game_party.members actor.rx_auto_battle_copy actor.rx_auto_battle_on end next_actor end end end #-------------------------------------------------------------------------- # ● ターン終了 #-------------------------------------------------------------------------- alias rgss2b3_turn_end turn_end def turn_end # ★ パーティ全員の自動戦闘フラグを復元 for actor in $game_party.members actor.rx_auto_battle_recover end # メソッドを呼び戻す rgss2b3_turn_end end end