#============================================================================== # ■ Game_Event #============================================================================== class Game_Event < Game_Character #-------------------------------------------------------------------------- # ● イベントページの条件合致判定 #-------------------------------------------------------------------------- def conditions_met?(page) c = page.condition if c.switch1_valid # スイッチ 1 return false if $game_switches[c.switch1_id] == false end if c.switch2_valid # スイッチ 2 if c.switch1_valid # スイッチ 1が有効なら通常どおりスイッチ return false if $game_switches[c.switch2_id] == false else # 有効でないなら if c.item_valid # アイテムが有効なら # 変数が有効であればIDは変数の中身、それ以外はアイテムIDを取得する id = c.variable_valid ? $game_variables[c.variable_id] : c.item_id case c.switch2_id when 1 # スイッチ 2のIDが1なら武器を返す item = $data_weapons[id] when 2 # スイッチ 2のIDが2なら防具を返す item = $data_armors[id] else # それ以外はアイテムを返す item = $data_items[id] end if c.actor_valid # アクターが有効ならそのアイテムを装備しているか actor = $game_actors[c.actor_id] return false if !actor.equips.include?(item) else # それ以外は # 変数が有効であればIDは条件の数値、それ以外は1、つまり # 持っているかどうかの判別が出来る数値を返す num = c.variable_valid ? c.variable_value : 1 return false if $game_party.item_number(item) < num end elsif c.actor_valid # アクターが有効なら # 変数が有効であればIDは変数の中身、それ以外は普通にIDを取得する id = c.variable_valid ? $game_variables[c.variable_id] : c.actor_id actor = $game_actors[id] case c.switch2_id when 1 # スイッチ 2のIDが1ならHPが満タンか return false if actor.hp != actor.maxhp when 2 # スイッチ 2のIDが2ならMPが満タンか return false if actor.mp != actor.maxmp when 3 # スイッチ 2のIDが3ならステートにかかっているか return false if actor.states.empty? else # それ以外はパーティにいるか return false unless $game_party.members.include?(actor) end elsif c.variable_valid # 変数が有効なら case c.switch2_id when 1 # スイッチ 2のIDが1なら「同値」 return false if $game_variables[c.variable_id] != c.variable_value when 2 # スイッチ 2のIDが2なら「以下」 return false if $game_variables[c.variable_id] > c.variable_value when 3 # スイッチ 2のIDが3なら「以外」 return false if $game_variables[c.variable_id] == c.variable_value else # それ以外は「以上」 return false if $game_variables[c.variable_id] < c.variable_value end else # それ以外は case c.switch2_id when 1 # スイッチ 2のIDが1ならイベントと重なっているか return false if !$game_player.pos?(self.x, self.y) when 2 # スイッチ 2のIDが2ならパーティの先頭のIDが1か return false if $game_party.members[0].id != 1 when 3 # スイッチ 2のIDが3ならゴールドが10000以上か return false if $game_party.gold < 10000 else # それ以外は普通に単スイッチとして使える return $game_switches[c.switch2_id] == false end end return true # それ以外の条件に干渉しないようにtrueを返す end end if c.variable_valid # 変数 return false if $game_variables[c.variable_id] < c.variable_value end if c.self_switch_valid # セルフスイッチ key = [@map_id, @event.id, c.self_switch_ch] return false if $game_self_switches[key] != true end if c.item_valid # アイテム item = $data_items[c.item_id] return false if $game_party.item_number(item) == 0 end if c.actor_valid # アクター actor = $game_actors[c.actor_id] return false unless $game_party.members.include?(actor) end return true # 条件合致 end end