#============================================================================== # ■ RGSS3 逃走誤選択防止機能 Ver1.01 by 星潟 #------------------------------------------------------------------------------ # プレイヤー側の操作で逃走コマンドの選択を防止する機能を追加します。 # パーティコマンド選択中に、指定のキーを押す事で # 逃走コマンドが赤く表示され、選択しても逃走処理に移行しなくなります。 # 再度同じキーを押す事で禁止状態は解除されます。 # 元々逃走できない戦闘の場合は効果がありません。 #============================================================================== module EscapeSeal #禁止状態のテキストカラーIDを指定。 ColorID = 10 #逃走封印用キーシンボルを指定。 SealKey = :Y end class Window_PartyCommand < Window_Command #-------------------------------------------------------------------------- # 項目の描画 #-------------------------------------------------------------------------- alias draw_item_escape_seal draw_item unless $! def draw_item(index) l = @list[index] @esc_c_flag_check = l[:symbol] == :escape && l[:enabled] draw_item_escape_seal(index) @esc_c_flag_check = nil end #-------------------------------------------------------------------------- # 通常文字色の指定 #-------------------------------------------------------------------------- alias normal_color_escape_seal normal_color unless $! def normal_color esc_c_flag ? escape_seal_color : normal_color_escape_seal end #-------------------------------------------------------------------------- # 逃走封印中の文字色指定 #-------------------------------------------------------------------------- def escape_seal_color text_color(EscapeSeal::ColorID) end #-------------------------------------------------------------------------- # 逃走封印文字色への切り替えフラグを取得 #-------------------------------------------------------------------------- def esc_c_flag @esc_c_flag_check && $game_party.escs_bk end #-------------------------------------------------------------------------- # 決定やキャンセルなどのハンドリング処理 #-------------------------------------------------------------------------- alias process_handling_escape_seal process_handling unless $! def process_handling if open? && active && Input.trigger?(EscapeSeal::SealKey) && escape_sealable? return call_handler(:escape_seal) end process_handling_escape_seal end #-------------------------------------------------------------------------- # 逃走封印を行えるか否かの確認 #-------------------------------------------------------------------------- def escape_sealable? @list.any? {|l| l[:symbol] == :escape && l[:enabled]} end #-------------------------------------------------------------------------- # 逃走封印状態の変更 #-------------------------------------------------------------------------- def escape_seal_change $game_party.escs_bk = $game_party.escs_bk ? false : true refresh activate end end class Game_Party < Game_Unit attr_accessor :escs_bk end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # パーティコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_party_command_window_escape_seal create_party_command_window def create_party_command_window create_party_command_window_escape_seal @party_command_window.set_handler(:escape_seal, method(:escape_seal)) end #-------------------------------------------------------------------------- # 逃走封印/封印解除 #-------------------------------------------------------------------------- def escape_seal Sound.play_ok @party_command_window.escape_seal_change end #-------------------------------------------------------------------------- # コマンド[逃げる] #-------------------------------------------------------------------------- alias command_escape_escape_seal command_escape def command_escape if $game_party.escs_bk @party_command_window.activate return end command_escape_escape_seal end end