Fixed fishing/Rock Smash/Headbutt being able to cause double wild battles

This commit is contained in:
Maruno17
2022-05-01 01:08:33 +01:00
parent 140ba4c622
commit 1b551b30f4
3 changed files with 5 additions and 5 deletions

View File

@@ -451,13 +451,13 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
end end
# Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild # Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild
# Pokémon (or two) for a triggered wild encounter. # Pokémon (or two if it's Sweet Scent) for a triggered wild encounter.
def pbEncounter(enc_type) def pbEncounter(enc_type, only_single = true)
$game_temp.encounter_type = enc_type $game_temp.encounter_type = enc_type
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type) encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
EventHandlers.trigger(:on_wild_species_chosen, encounter1) EventHandlers.trigger(:on_wild_species_chosen, encounter1)
return false if !encounter1 return false if !encounter1
if $PokemonEncounters.have_double_wild_battle? if !only_single && $PokemonEncounters.have_double_wild_battle?
encounter2 = $PokemonEncounters.choose_wild_pokemon(enc_type) encounter2 = $PokemonEncounters.choose_wild_pokemon(enc_type)
EventHandlers.trigger(:on_wild_species_chosen, encounter2) EventHandlers.trigger(:on_wild_species_chosen, encounter2)
return false if !encounter2 return false if !encounter2

View File

@@ -877,7 +877,7 @@ def pbSweetScent
viewport.dispose viewport.dispose
enctype = $PokemonEncounters.encounter_type enctype = $PokemonEncounters.encounter_type
if !enctype || !$PokemonEncounters.encounter_possible_here? || if !enctype || !$PokemonEncounters.encounter_possible_here? ||
!pbEncounter(enctype) !pbEncounter(enctype, false)
pbMessage(_INTL("There appears to be nothing here...")) pbMessage(_INTL("There appears to be nothing here..."))
end end
end end

View File

@@ -75,7 +75,7 @@ class PokemonRegionMap_Scene
@map_data = pbLoadTownMapData @map_data = pbLoadTownMapData
@fly_map = fly_map @fly_map = fly_map
@mode = fly_map ? 1 : 0 @mode = fly_map ? 1 : 0
map_metadata = GameData::MapMetadata.try_get($game_map.map_id) map_metadata = $game_map.metadata
playerpos = (map_metadata) ? map_metadata.town_map_position : nil playerpos = (map_metadata) ? map_metadata.town_map_position : nil
if !playerpos if !playerpos
mapindex = 0 mapindex = 0