# # 全員が受けると敗北になるステート(RGSS2) #  (C)2008 TYPE74RX-T # #-------------------------------------------------------------------------- # ★ システムワードの登録:敗北 #-------------------------------------------------------------------------- module RPG class State alias rx_rgss2b7_rx_extract_sys_str_from_note rx_extract_sys_str_from_note def rx_extract_sys_str_from_note rx_get_sys = RX_T.get_system_word_in_note(@note, "敗北") unless rx_get_sys == "" @@rx_copy_str += rx_get_sys @note = @note.sub(rx_get_sys, "") @note = @note.sub("\r\n", "") end @rx_sys_str = @@rx_copy_str # メソッドを呼び戻す rx_rgss2b7_rx_extract_sys_str_from_note end end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2b7_initialize initialize def initialize # メソッドを呼び戻す rx_rgss2b7_initialize @rx_st_lose = false # ★ 敗北フラグ end #-------------------------------------------------------------------------- # ★ 敗北フラグ #-------------------------------------------------------------------------- def rx_st_lose return @rx_st_lose end #-------------------------------------------------------------------------- # ★ 敗北判定 #-------------------------------------------------------------------------- def rx_get_st_lose @rx_st_lose = false for state in states @rx_st_lose = true if state.rx_sys_str.include?("敗北") end return @rx_st_lose end #-------------------------------------------------------------------------- # ● 制約の取得 # 現在付加されているステートから最大の restriction を取得する。 #-------------------------------------------------------------------------- alias rx_rgss2b7_restriction restriction def restriction # ★ 敗北判定 rx_get_st_lose # メソッドを呼び戻す rx_rgss2b7_restriction end end #============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ #  パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク # ラスのインスタンスは $game_party で参照されます。 #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● 全滅判定 #-------------------------------------------------------------------------- alias rx_rgss2b7_all_dead? all_dead? def all_dead? rx_st_lose_count = 0 # ★ 敗北ステートにかかっているバトラー数 rx_exist_count = 0 # ★ 行動可能なバトラー数 # ★ パーティの中で敗北ステートに懸かっているバトラー数と #  存在または生存、不死身のバトラー数をカウント for actor in members rx_st_lose_count += 1 if actor.rx_st_lose and actor.hp > 0 rx_exist_count += 1 if actor.hp > 0 or actor.immortal end # ★ 戦闘中、行動できる全バトラーが敗北ステートにかかっていたら全滅判定 return true if rx_st_lose_count == rx_exist_count and $game_temp.in_battle # メソッドを呼び戻す rx_rgss2b7_all_dead? end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● 全滅判定 #-------------------------------------------------------------------------- alias rx_rgss2b7_all_dead? all_dead? def all_dead? rx_st_lose_count = 0 # ★ 敗北ステートにかかっているバトラー数 rx_exist_count = 0 # ★ 行動可能なバトラー数 # ★ パーティの中で敗北ステートに懸かっているバトラー数と #  存在または生存、不死身のバトラー数をカウント for enemy in members rx_st_lose_count += 1 if enemy.rx_st_lose and enemy.hp > 0 rx_exist_count += 1 if enemy.hp > 0 or enemy.immortal end # ★ 行動できる全バトラーが敗北ステートにかかっていたら全滅判定 return true if rx_st_lose_count == rx_exist_count # メソッドを呼び戻す rx_rgss2b7_all_dead? end end