mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Fixed Safari/Bug Contest/roaming battles generating Pokémon while ignoring that Pokémon's defined form
This commit is contained in:
@@ -347,7 +347,7 @@ class WildBattle
|
|||||||
# roaming Pokémon, Safari battles, Bug Contest battles)
|
# roaming Pokémon, Safari battles, Bug Contest battles)
|
||||||
if foe_party.length == 1 && can_override
|
if foe_party.length == 1 && can_override
|
||||||
handled = [nil]
|
handled = [nil]
|
||||||
EventHandlers.trigger(:on_calling_wild_battle, foe_party[0].species, foe_party[0].level, handled)
|
EventHandlers.trigger(:on_calling_wild_battle, foe_party[0], handled)
|
||||||
return handled[0] if !handled[0].nil?
|
return handled[0] if !handled[0].nil?
|
||||||
end
|
end
|
||||||
# Perform the battle
|
# Perform the battle
|
||||||
|
|||||||
@@ -186,23 +186,23 @@ EventHandlers.add(:on_wild_species_chosen, :roaming_pokemon,
|
|||||||
)
|
)
|
||||||
|
|
||||||
EventHandlers.add(:on_calling_wild_battle, :roaming_pokemon,
|
EventHandlers.add(:on_calling_wild_battle, :roaming_pokemon,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
||||||
handled[0] = pbRoamingPokemonBattle(species, level)
|
handled[0] = pbRoamingPokemonBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbRoamingPokemonBattle(species, level)
|
def pbRoamingPokemonBattle(pkmn)
|
||||||
# Get the roaming Pokémon to encounter; generate it based on the species and
|
# Get the roaming Pokémon to encounter; generate it based on the species and
|
||||||
# level if it doesn't already exist
|
# level if it doesn't already exist
|
||||||
idxRoamer = $game_temp.roamer_index_for_encounter
|
idxRoamer = $game_temp.roamer_index_for_encounter
|
||||||
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
||||||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
||||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species, level, true)
|
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(pkmn.species_data.id, pkmn.level, true)
|
||||||
end
|
end
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("single")
|
setBattleRule("single")
|
||||||
@@ -218,7 +218,7 @@ def pbRoamingPokemonBattle(species, level)
|
|||||||
$PokemonGlobal.roamedAlready = true
|
$PokemonGlobal.roamedAlready = true
|
||||||
$game_temp.roamer_index_for_encounter = nil
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ end
|
|||||||
def pbUsePokeRadar
|
def pbUsePokeRadar
|
||||||
return false if !pbCanUsePokeRadar?
|
return false if !pbCanUsePokeRadar?
|
||||||
$stats.poke_radar_count += 1
|
$stats.poke_radar_count += 1
|
||||||
$game_temp.poke_radar_data = [0, 0, 0, [], false] if !$game_temp.poke_radar_data
|
$game_temp.poke_radar_data = [nil, 0, 0, [], false] if !$game_temp.poke_radar_data
|
||||||
$game_temp.poke_radar_data[4] = false
|
$game_temp.poke_radar_data[4] = false
|
||||||
$PokemonGlobal.pokeradarBattery = 50
|
$PokemonGlobal.pokeradarBattery = 50
|
||||||
pbPokeRadarHighlightGrass
|
pbPokeRadarHighlightGrass
|
||||||
|
|||||||
@@ -105,19 +105,18 @@ EventHandlers.add(:on_player_step_taken_can_transfer, :safari_game_counter,
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !pbInSafari?
|
next if !pbInSafari?
|
||||||
handled[0] = pbSafariBattle(species, level)
|
handled[0] = pbSafariBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbSafariBattle(species, level)
|
def pbSafariBattle(pkmn)
|
||||||
# Generate a wild Pokémon based on the species and level
|
# Generate a wild Pokémon based on the species and level
|
||||||
pkmn = pbGenerateWildPokemon(species, level)
|
|
||||||
foeParty = [pkmn]
|
foeParty = [pkmn]
|
||||||
# Calculate who the trainer is
|
# Calculate who the trainer is
|
||||||
playerTrainer = $player
|
playerTrainer = $player
|
||||||
@@ -156,7 +155,7 @@ def pbSafariBattle(species, level)
|
|||||||
end
|
end
|
||||||
pbSet(1, decision)
|
pbSet(1, decision)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return the outcome of the battle
|
# Return the outcome of the battle
|
||||||
return decision
|
return decision
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -355,22 +355,20 @@ EventHandlers.add(:on_leave_map, :end_bug_contest,
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !pbInBugContest?
|
next if !pbInBugContest?
|
||||||
handled[0] = pbBugContestBattle(species, level)
|
handled[0] = pbBugContestBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbBugContestBattle(species, level)
|
def pbBugContestBattle(pkmn)
|
||||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||||
# comparing levels for an evolution check)
|
# comparing levels for an evolution check)
|
||||||
EventHandlers.trigger(:on_start_battle)
|
EventHandlers.trigger(:on_start_battle)
|
||||||
# Generate a wild Pokémon based on the species and level
|
|
||||||
pkmn = pbGenerateWildPokemon(species, level)
|
|
||||||
foeParty = [pkmn]
|
foeParty = [pkmn]
|
||||||
# Calculate who the trainers and their party are
|
# Calculate who the trainers and their party are
|
||||||
playerTrainer = [$player]
|
playerTrainer = [$player]
|
||||||
@@ -405,7 +403,7 @@ def pbBugContestBattle(species, level)
|
|||||||
# Save the result of the battle in Game Variable 1
|
# Save the result of the battle in Game Variable 1
|
||||||
BattleCreationHelperMethods.set_outcome(decision, 1)
|
BattleCreationHelperMethods.set_outcome(decision, 1)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user