Skip to content

Commit

Permalink
Map ids on route 23, enable encounters in vic road
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Sep 19, 2024
1 parent bd3209a commit 7b01f62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions pokemonred_puffer/data/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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,
}
11 changes: 8 additions & 3 deletions pokemonred_puffer/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))]
Expand Down

0 comments on commit 7b01f62

Please sign in to comment.