From 7b01f6241cf4c469ab2023cc27fbde8afbd47798 Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:15:13 -0400 Subject: [PATCH] Map ids on route 23, enable encounters in vic road --- pokemonred_puffer/data/map.py | 7 +++++++ pokemonred_puffer/environment.py | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pokemonred_puffer/data/map.py b/pokemonred_puffer/data/map.py index 7572075..afa018d 100644 --- a/pokemonred_puffer/data/map.py +++ b/pokemonred_puffer/data/map.py @@ -321,6 +321,7 @@ class MapIds(Enum): MapIds.SAFARI_ZONE_SECRET_HOUSE: ["EVENT_GOT_HM03", "HS_SAFARI_ZONE_WEST_ITEM_4"], MapIds.SAFARI_ZONE_WEST: ["EVENT_GOT_HM03", "HS_SAFARI_ZONE_WEST_ITEM_4"], MapIds.SAFARI_ZONE_WEST_REST_HOUSE: ["EVENT_GOT_HM03", "HS_SAFARI_ZONE_WEST_ITEM_4"], + MapIds.ROUTE_23: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.VICTORY_ROAD_1F: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.VICTORY_ROAD_2F: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.VICTORY_ROAD_3F: ["EVENT_BEAT_CHAMPION_RIVAL"], @@ -332,3 +333,9 @@ class MapIds(Enum): MapIds.LANCES_ROOM: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.CHAMPIONS_ROOM: ["EVENT_BEAT_CHAMPION_RIVAL"], } + +DISABLE_WILD_ENCOUNTERS_EXCEPTIONS = { + MapIds.VICTORY_ROAD_1F, + MapIds.VICTORY_ROAD_2F, + MapIds.VICTORY_ROAD_3F, +} diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 6ed7fcf..0ebe1b5 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -33,7 +33,11 @@ USEFUL_ITEMS, Items, ) -from pokemonred_puffer.data.map import MAP_ID_COMPLETION_EVENTS, MapIds +from pokemonred_puffer.data.map import ( + DISABLE_WILD_ENCOUNTERS_EXCEPTIONS, + MAP_ID_COMPLETION_EVENTS, + MapIds, +) from pokemonred_puffer.data.missable_objects import MissableFlags from pokemonred_puffer.data.party import PartyMons from pokemonred_puffer.data.strength_puzzles import STRENGTH_SOLUTIONS @@ -1332,8 +1336,9 @@ def cut_hook(self, context): self.cut_tiles[wTileInFrontOfPlayer] = 1 def disable_wild_encounter_hook(self, *args, **kwargs): - self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = 0xFF - self.pyboy.memory[self.pyboy.symbol_lookup("wCurEnemyLevel")[1]] = 0x01 + if MapIds(self.read_m("wCurMap")) not in DISABLE_WILD_ENCOUNTERS_EXCEPTIONS: + self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = 0xFF + self.pyboy.memory[self.pyboy.symbol_lookup("wCurEnemyLevel")[1]] = 0x01 def agent_stats(self, action): levels = [self.read_m(f"wPartyMon{i+1}Level") for i in range(self.read_m("wPartyCount"))]