Fixes roaming weather appearing even when legendaries have been caught

This commit is contained in:
infinitefusion
2024-06-30 17:37:28 -04:00
parent ad1be384ce
commit e6d133f7a6
4 changed files with 17 additions and 4 deletions

Binary file not shown.

View File

@@ -72,7 +72,7 @@ end
def applyRoamWeather() def applyRoamWeather()
return if $game_screen.weather_type != :None return if $game_screen.weather_type != :None
currently_roaming = $PokemonGlobal.roamPosition.keys currently_roaming = getAllCurrentlyRoamingPokemon()
currently_roaming.each do |roamer_id| currently_roaming.each do |roamer_id|
roamerOnCurrentMap = $PokemonGlobal.roamPosition[roamer_id] == $game_map.map_id roamerOnCurrentMap = $PokemonGlobal.roamPosition[roamer_id] == $game_map.map_id
if roamerOnCurrentMap if roamerOnCurrentMap

View File

@@ -1868,13 +1868,27 @@ ItemHandlers::UseInField.add(:DEVONSCOPE, proc { |item|
#TRACKER (for roaming legendaries) #TRACKER (for roaming legendaries)
ItemHandlers::UseInField.add(:REVEALGLASS, proc { |item| ItemHandlers::UseInField.add(:REVEALGLASS, proc { |item|
track_pokemon() track_pokemon()
next true
}) })
ItemHandlers::UseFromBag.add(:REVEALGLASS, proc { |item| ItemHandlers::UseFromBag.add(:REVEALGLASS, proc { |item|
track_pokemon() track_pokemon()
next true
}) })
def getAllCurrentlyRoamingPokemon
currently_roaming = []
Settings::ROAMING_SPECIES.each_with_index do |data, i|
next if !GameData::Species.exists?(data[0])
next if data[2] > 0 && !$game_switches[data[2]] # Isn't roaming
next if $PokemonGlobal.roamPokemon[i] == true # Roaming Pokémon has been caught
currently_roaming << i
end
return currently_roaming
end
def track_pokemon() def track_pokemon()
currently_roaming = $PokemonGlobal.roamPosition.keys currently_roaming = getAllCurrentlyRoamingPokemon()
echoln currently_roaming
weather_data = [] weather_data = []
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata") mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
currently_roaming.each do |roamer_id| currently_roaming.each do |roamer_id|
@@ -1891,12 +1905,11 @@ def track_pokemon()
end end
weather_data << forecast_msg if forecast_msg && !weather_data.include?(forecast_msg) weather_data << forecast_msg if forecast_msg && !weather_data.include?(forecast_msg)
end end
weather_data << _INTL("No unusual weather patterns have been detected.") if weather_data.empty?
weather_data.each do |message| weather_data.each do |message|
Kernel.pbMessage(message) Kernel.pbMessage(message)
end end
# nbRoaming = 0 # nbRoaming = 0
# if Settings::ROAMING_SPECIES.length == 0 # if Settings::ROAMING_SPECIES.length == 0
# Kernel.pbMessage(_INTL("No roaming Pokémon defined.")) # Kernel.pbMessage(_INTL("No roaming Pokémon defined."))

Binary file not shown.