# # バトルセルフスイッチ(RGSS3) #  (C)2012 TYPE74RX-T # =begin ※:このスクリプト素材は Game_Interpreter クラスの   def command_111 メソッドを再定義しています。   この場所を利用者様が既に改造していたり、再定義・エイリアスした   スクリプト素材を使用するときは、競合にご注意ください。 =end #============================================================================== # ■ DataManager #------------------------------------------------------------------------------ #  データベースとゲームオブジェクトを管理するモジュールです。ゲームで使用する # ほぼ全てのグローバル変数はこのモジュールで初期化されます。 #============================================================================== class << DataManager # module内のエイリアス #-------------------------------------------------------------------------- # ● 各種ゲームオブジェクトの作成 #-------------------------------------------------------------------------- alias rx3_120121_create_game_objects create_game_objects def create_game_objects rx3_120121_create_game_objects # メソッド呼び戻し $game_battle_self_switches = Game_SelfSwitches.new end #-------------------------------------------------------------------------- # ● セーブ内容の作成 #-------------------------------------------------------------------------- alias rx3_120121_make_save_contents make_save_contents def make_save_contents contents = rx3_120121_make_save_contents # メソッド呼び戻し contents[:battle_self_switches] = $game_battle_self_switches contents end #-------------------------------------------------------------------------- # ● セーブ内容の展開 #-------------------------------------------------------------------------- alias rx3_120121_extract_save_contents extract_save_contents def extract_save_contents(contents) rx3_120121_extract_save_contents(contents) # メソッド呼び戻し $game_battle_self_switches = contents[:battle_self_switches] end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit attr_reader :troop_id # ★ 敵グループ ID end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● 条件分岐(再定義) #-------------------------------------------------------------------------- def command_111 result = false case @params[0] when 0 # スイッチ result = ($game_switches[@params[1]] == (@params[2] == 0)) when 1 # 変数 value1 = $game_variables[@params[1]] if @params[2] == 0 value2 = @params[3] else value2 = $game_variables[@params[3]] end case @params[4] when 0 # と同値 result = (value1 == value2) when 1 # 以上 result = (value1 >= value2) when 2 # 以下 result = (value1 <= value2) when 3 # 超 result = (value1 > value2) when 4 # 未満 result = (value1 < value2) when 5 # 以外 result = (value1 != value2) end when 2 # セルフスイッチ if @event_id > 0 key = [@map_id, @event_id, @params[1]] result = ($game_self_switches[key] == (@params[2] == 0)) end # ★ 戦闘中の場合 if $game_party.in_battle key = [$game_troop.troop_id, @params[1]] result = ($game_battle_self_switches[key] == (@params[2] == 0)) end when 3 # タイマー if $game_timer.working? if @params[2] == 0 result = ($game_timer.sec >= @params[1]) else result = ($game_timer.sec <= @params[1]) end end when 4 # アクター actor = $game_actors[@params[1]] if actor case @params[2] when 0 # パーティにいる result = ($game_party.members.include?(actor)) when 1 # 名前 result = (actor.name == @params[3]) when 2 # 職業 result = (actor.class_id == @params[3]) when 3 # スキル result = (actor.skill_learn?($data_skills[@params[3]])) when 4 # 武器 result = (actor.weapons.include?($data_weapons[@params[3]])) when 5 # 防具 result = (actor.armors.include?($data_armors[@params[3]])) when 6 # ステート result = (actor.state?(@params[3])) end end when 5 # 敵キャラ enemy = $game_troop.members[@params[1]] if enemy case @params[2] when 0 # 出現している result = (enemy.alive?) when 1 # ステート result = (enemy.state?(@params[3])) end end when 6 # キャラクター character = get_character(@params[1]) if character result = (character.direction == @params[2]) end when 7 # ゴールド case @params[2] when 0 # 以上 result = ($game_party.gold >= @params[1]) when 1 # 以下 result = ($game_party.gold <= @params[1]) when 2 # 未満 result = ($game_party.gold < @params[1]) end when 8 # アイテム result = $game_party.has_item?($data_items[@params[1]]) when 9 # 武器 result = $game_party.has_item?($data_weapons[@params[1]], @params[2]) when 10 # 防具 result = $game_party.has_item?($data_armors[@params[1]], @params[2]) when 11 # ボタン result = Input.press?(@params[1]) when 12 # スクリプト result = eval(@params[1]) when 13 # 乗り物 result = ($game_player.vehicle == $game_map.vehicles[@params[1]]) end @branch[@indent] = result command_skip if !@branch[@indent] end #-------------------------------------------------------------------------- # ● セルフスイッチの操作 #-------------------------------------------------------------------------- alias rx3_120121_command_123 command_123 def command_123 rx3_120121_command_123 # メソッド呼び戻し # ★ 戦闘中の場合 if $game_party.in_battle key = [$game_troop.troop_id, @params[0]] $game_battle_self_switches[key] = (@params[1] == 0) end end end