Merge pull request #122 from Beinmann/make_black_and_white_flute_persist_between_routes

Make black and white flute effects persist when entering a new route
This commit is contained in:
infinitefusion
2025-04-08 21:35:47 -04:00
committed by GitHub
2 changed files with 13 additions and 5 deletions

View File

@@ -283,7 +283,13 @@ Events.onMapChange += proc { |_sender, e|
if new_map_metadata && new_map_metadata.teleport_destination if new_map_metadata && new_map_metadata.teleport_destination
$PokemonGlobal.healingSpot = new_map_metadata.teleport_destination $PokemonGlobal.healingSpot = new_map_metadata.teleport_destination
end end
$PokemonMap.clear if $PokemonMap if $PokemonMap
blackFluteUsed = $PokemonMap.blackFluteUsed
whiteFluteUsed = $PokemonMap.whiteFluteUsed
$PokemonMap.clear
$PokemonMap.blackFluteUsed = blackFluteUsed
$PokemonMap.whiteFluteUsed = whiteFluteUsed
end
$PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters $PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters
$PokemonGlobal.visitedMaps[$game_map.map_id] = true $PokemonGlobal.visitedMaps[$game_map.map_id] = true
next if old_map_ID == 0 || old_map_ID == $game_map.map_id next if old_map_ID == 0 || old_map_ID == $game_map.map_id

View File

@@ -148,17 +148,19 @@ Events.onStepTaken += proc {
ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item| ItemHandlers::UseInField.add(:BLACKFLUTE, proc { |item|
pbUseItemMessage(item) pbUseItemMessage(item)
pbMessage(_INTL("Wild Pokémon will be repelled.")) message = $PokemonMap.blackFluteUsed ? "Wild Pokemon will no longer be repelled.": "Wild Pokémon will be repelled."
$PokemonMap.blackFluteUsed = true pbMessage(_INTL(message))
$PokemonMap.blackFluteUsed = !$PokemonMap.blackFluteUsed
$PokemonMap.whiteFluteUsed = false $PokemonMap.whiteFluteUsed = false
next 1 next 1
}) })
ItemHandlers::UseInField.add(:WHITEFLUTE, proc { |item| ItemHandlers::UseInField.add(:WHITEFLUTE, proc { |item|
pbUseItemMessage(item) pbUseItemMessage(item)
pbMessage(_INTL("Wild Pokémon will be lured.")) message = $PokemonMap.whiteFluteUsed ? "Wild Pokemon will no longer be lured.": "Wild Pokémon will be lured."
pbMessage(_INTL(message))
$PokemonMap.whiteFluteUsed = !$PokemonMap.whiteFluteUsed
$PokemonMap.blackFluteUsed = false $PokemonMap.blackFluteUsed = false
$PokemonMap.whiteFluteUsed = true
next 1 next 1
}) })