diff --git a/pokemonred_puffer/data/map.py b/pokemonred_puffer/data/map.py index 85af891..7572075 100644 --- a/pokemonred_puffer/data/map.py +++ b/pokemonred_puffer/data/map.py @@ -321,6 +321,11 @@ 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.VICTORY_ROAD_1F: ["EVENT_BEAT_CHAMPION_RIVAL"], + MapIds.VICTORY_ROAD_2F: ["EVENT_BEAT_CHAMPION_RIVAL"], + MapIds.VICTORY_ROAD_3F: ["EVENT_BEAT_CHAMPION_RIVAL"], + MapIds.INDIGO_PLATEAU: ["EVENT_BEAT_CHAMPION_RIVAL"], + MapIds.INDIGO_PLATEAU_LOBBY: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.LORELEIS_ROOM: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.BRUNOS_ROOM: ["EVENT_BEAT_CHAMPION_RIVAL"], MapIds.AGATHAS_ROOM: ["EVENT_BEAT_CHAMPION_RIVAL"], diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 0d65f8b..2f743c3 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -1244,17 +1244,19 @@ def insert_guard_drinks(self): def sign_hook(self, *args, **kwargs): sign_id = self.read_m("hSpriteIndexOrTextID") map_id = self.read_m("wCurMap") - self.seen_signs[(map_id, sign_id)] = 1.0 + self.seen_signs[(map_id, sign_id)] = 1.0 if self.scale_map_id(map_id) else 0.0 def hidden_object_hook(self, *args, **kwargs): hidden_object_id = self.pyboy.memory[self.pyboy.symbol_lookup("wHiddenObjectIndex")[1]] map_id = self.pyboy.memory[self.pyboy.symbol_lookup("wCurMap")[1]] - self.seen_hidden_objs[(map_id, hidden_object_id)] = 1.0 + self.seen_hidden_objs[(map_id, hidden_object_id)] = ( + 1.0 if self.scale_map_id(map_id) else 0.0 + ) def sprite_hook(self, *args, **kwargs): sprite_id = self.pyboy.memory[self.pyboy.symbol_lookup("hSpriteIndexOrTextID")[1]] map_id = self.pyboy.memory[self.pyboy.symbol_lookup("wCurMap")[1]] - self.seen_npcs[(map_id, sprite_id)] = 1.0 + self.seen_npcs[(map_id, sprite_id)] = 1.0 if self.scale_map_id(map_id) else 0.0 def start_menu_hook(self, *args, **kwargs): if self.read_m("wIsInBattle") == 0: @@ -1485,7 +1487,7 @@ def update_seen_coords(self): self.reward_explore_map[local_to_global(y_pos, x_pos, map_n)] = min( self.explore_map[local_to_global(y_pos, x_pos, map_n)] + inc, self.exploration_max, - ) * self.map_id_scaling(map_n) + ) * (self.map_id_scalefactor if self.scale_map_id(map_n) else 1.0) # self.seen_global_coords[local_to_global(y_pos, x_pos, map_n)] = 1 self.seen_map_ids[map_n] = 1 @@ -1712,10 +1714,10 @@ def get_events_sum(self): 0, ) - def map_id_scaling(self, map_n: int) -> float: + def scale_map_id(self, map_n: int) -> float: map_id = MapIds(map_n) if map_id not in MAP_ID_COMPLETION_EVENTS: - return 1.0 + return False if all( event_or_missable.startswith("EVENT_") @@ -1726,8 +1728,8 @@ def map_id_scaling(self, map_n: int) -> float: ) for event_or_missable in MAP_ID_COMPLETION_EVENTS[map_id] ): - return self.map_id_scalefactor - return 1.0 + return True + return False def check_num_bag_items(self): _, wBagItems = self.pyboy.symbol_lookup("wBagItems")