From 11965f5094b1d50e803e66dff687ea67df20b474 Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:14:39 -0400 Subject: [PATCH] Fix strength puzzle --- pokemonred_puffer/data/strength_puzzles.py | 704 +++++++++++---------- pokemonred_puffer/environment.py | 71 +-- 2 files changed, 385 insertions(+), 390 deletions(-) diff --git a/pokemonred_puffer/data/strength_puzzles.py b/pokemonred_puffer/data/strength_puzzles.py index eba94c2..b37a39e 100644 --- a/pokemonred_puffer/data/strength_puzzles.py +++ b/pokemonred_puffer/data/strength_puzzles.py @@ -5,94 +5,113 @@ ################### # Seafoam 1F Left -STRENGTH_SOLUTIONS[(63, 14, 22, 18, 11, 192)] = [ - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "RIGHT", - "UP", - "LEFT", -] -STRENGTH_SOLUTIONS[(63, 14, 22, 19, 10, 192)] = ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[ - (63, 14, 22, 18, 11, 192) -] -STRENGTH_SOLUTIONS[(63, 14, 22, 18, 9, 192)] = ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 14, 22, 19, 10, 192) -] -STRENGTH_SOLUTIONS[(63, 14, 22, 17, 10, 192)] = ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 14, 22, 18, 9, 192) -] +STRENGTH_SOLUTIONS[(63, 14, 22, 18, 11, 192)] = ( + "HS_SEAFOAM_ISLANDS_1F_BOULDER_1", + [ + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "RIGHT", + "UP", + "LEFT", + ], +) +STRENGTH_SOLUTIONS[(63, 14, 22, 19, 10, 192)] = ( + STRENGTH_SOLUTIONS[(63, 14, 22, 18, 11, 192)][0], + ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[(63, 14, 22, 18, 11, 192)][1], +) +STRENGTH_SOLUTIONS[(63, 14, 22, 18, 9, 192)] = ( + STRENGTH_SOLUTIONS[(63, 14, 22, 19, 10, 192)][0], + ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 14, 22, 19, 10, 192)][1], +) +STRENGTH_SOLUTIONS[(63, 14, 22, 17, 10, 192)] = ( + STRENGTH_SOLUTIONS[(63, 14, 22, 18, 9, 192)][0], + ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 14, 22, 18, 9, 192)][1], +) # Seafoam 1F right -STRENGTH_SOLUTIONS[(63, 11, 30, 26, 8, 192)] = [ - "UP", - "RIGHT", - "UP", - "UP", - "LEFT", - "LEFT", - "LEFT", - "LEFT", -] -STRENGTH_SOLUTIONS[(63, 11, 30, 27, 7, 192)] = ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[ - (63, 11, 30, 26, 8, 192) -] -STRENGTH_SOLUTIONS[(63, 11, 30, 26, 6, 192)] = ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 11, 30, 27, 7, 192) -] -STRENGTH_SOLUTIONS[(63, 11, 30, 25, 7, 192)] = ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 11, 30, 26, 6, 192) -] +STRENGTH_SOLUTIONS[(63, 11, 30, 26, 8, 192)] = ( + "HS_SEAFOAM_ISLANDS_1F_BOULDER_2", + [ + "UP", + "RIGHT", + "UP", + "UP", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + ], +) +STRENGTH_SOLUTIONS[(63, 11, 30, 27, 7, 192)] = ( + STRENGTH_SOLUTIONS[(63, 11, 30, 26, 8, 192)][0], + ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[(63, 11, 30, 26, 8, 192)][1], +) +STRENGTH_SOLUTIONS[(63, 11, 30, 26, 6, 192)] = ( + STRENGTH_SOLUTIONS[(63, 11, 30, 27, 7, 192)][0], + ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 11, 30, 27, 7, 192)][1], +) +STRENGTH_SOLUTIONS[(63, 11, 30, 25, 7, 192)] = ( + STRENGTH_SOLUTIONS[(63, 11, 30, 26, 6, 192)][0], + ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 11, 30, 26, 6, 192)][1], +) # Seafoam B1 left -STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)] = ["RIGHT"] -STRENGTH_SOLUTIONS[(63, 10, 21, 17, 5, 159)] = ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 10, 21, 16, 6, 159) -] -STRENGTH_SOLUTIONS[(63, 10, 21, 17, 7, 159)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 10, 21, 16, 6, 159) -] +STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)] = ("HS_SEAFOAM_ISLANDS_B1F_BOULDER_1", ["RIGHT"]) +STRENGTH_SOLUTIONS[(63, 10, 21, 17, 5, 159)] = ( + STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)][0], + ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)][1], +) +STRENGTH_SOLUTIONS[(63, 10, 21, 17, 7, 159)] = ( + STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 10, 21, 16, 6, 159)][1], +) # Seafoam B1 right -STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)] = ["RIGHT"] -STRENGTH_SOLUTIONS[(63, 10, 26, 22, 5, 159)] = ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 10, 26, 21, 6, 159) -] -STRENGTH_SOLUTIONS[(63, 10, 26, 22, 7, 159)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 10, 26, 21, 6, 159) -] +STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)] = ("HS_SEAFOAM_ISLANDS_B1F_BOULDER_2", ["RIGHT"]) +STRENGTH_SOLUTIONS[(63, 10, 26, 22, 5, 159)] = ( + STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)][0], + ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)][1], +) +STRENGTH_SOLUTIONS[(63, 10, 26, 22, 7, 159)] = ( + STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 10, 26, 21, 6, 159)][1], +) # Seafoam B2 left -STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)] = ["RIGHT"] -STRENGTH_SOLUTIONS[(63, 10, 22, 18, 5, 160)] = ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 10, 22, 17, 6, 160) -] -STRENGTH_SOLUTIONS[(63, 10, 22, 18, 7, 160)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 10, 22, 17, 6, 160) -] +STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)] = ("HS_SEAFOAM_ISLANDS_B3F_BOULDER_1", ["RIGHT"]) +STRENGTH_SOLUTIONS[(63, 10, 22, 18, 5, 160)] = ( + STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)][0], + ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)][1], +) +STRENGTH_SOLUTIONS[(63, 10, 22, 18, 7, 160)] = ( + STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 10, 22, 17, 6, 160)][1], +) # Seafoam B2 right -STRENGTH_SOLUTIONS[(63, 10, 27, 24, 6, 160)] = ["LEFT"] -STRENGTH_SOLUTIONS[(63, 10, 27, 23, 7, 160)] = ["RIGHT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 10, 27, 24, 6, 160) -] +STRENGTH_SOLUTIONS[(63, 10, 27, 24, 6, 160)] = ("HS_SEAFOAM_ISLANDS_B3F_BOULDER_2", ["LEFT"]) +STRENGTH_SOLUTIONS[(63, 10, 27, 23, 7, 160)] = ( + STRENGTH_SOLUTIONS[(63, 10, 27, 24, 6, 160)][0], + ["RIGHT", "UP"] + STRENGTH_SOLUTIONS[(63, 10, 27, 24, 6, 160)][1], +) # We skip seafoam b3 since that is for articuno # TODO: Articuno @@ -102,271 +121,298 @@ ################ # 1F Switch 1 -STRENGTH_SOLUTIONS[(63, 19, 9, 5, 14, 108)] = [ - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "LEFT", - "DOWN", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "DOWN", - "RIGHT", - "RIGHT", - "UP", - "UP", - "UP", - "UP", - "UP", - "UP", - "LEFT", - "UP", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "DOWN", - "RIGHT", - "UP", - "UP", - "UP", - "LEFT", - "LEFT", - "UP", - "UP", - "UP", - "UP", - "RIGHT", - "RIGHT", - "RIGHT", - "RIGHT", - "UP", - "RIGHT", - "DOWN", -] +STRENGTH_SOLUTIONS[(63, 19, 9, 5, 14, 108)] = ( + None, + [ + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "LEFT", + "DOWN", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "DOWN", + "RIGHT", + "RIGHT", + "UP", + "UP", + "UP", + "UP", + "UP", + "UP", + "LEFT", + "UP", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "DOWN", + "RIGHT", + "UP", + "UP", + "UP", + "LEFT", + "LEFT", + "UP", + "UP", + "UP", + "UP", + "RIGHT", + "RIGHT", + "RIGHT", + "RIGHT", + "UP", + "RIGHT", + "DOWN", + ], +) -STRENGTH_SOLUTIONS[(63, 19, 9, 4, 15, 108)] = ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 19, 9, 5, 14, 108) -] -STRENGTH_SOLUTIONS[(63, 19, 9, 5, 16, 108)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 19, 9, 4, 15, 108) -] +STRENGTH_SOLUTIONS[(63, 19, 9, 4, 15, 108)] = ( + STRENGTH_SOLUTIONS[(63, 19, 9, 5, 14, 108)][0], + ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 19, 9, 5, 14, 108)][1], +) +STRENGTH_SOLUTIONS[(63, 19, 9, 5, 16, 108)] = ( + STRENGTH_SOLUTIONS[(63, 19, 9, 4, 15, 108)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 19, 9, 4, 15, 108)][1], +) # 2F Switch 1 -STRENGTH_SOLUTIONS[(63, 18, 8, 5, 14, 194)] = [ - "LEFT", - "LEFT", - "UP", - "LEFT", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "RIGHT", - "DOWN", - "LEFT", - "LEFT", - "LEFT", - "LEFT", -] +STRENGTH_SOLUTIONS[(63, 18, 8, 5, 14, 194)] = ( + None, + [ + "LEFT", + "LEFT", + "UP", + "LEFT", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "RIGHT", + "DOWN", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + ], +) -STRENGTH_SOLUTIONS[(63, 18, 8, 4, 13, 194)] = ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 18, 8, 5, 14, 194) -] -STRENGTH_SOLUTIONS[(63, 18, 8, 3, 14, 194)] = ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 18, 8, 4, 13, 194) -] -STRENGTH_SOLUTIONS[(63, 18, 8, 4, 15, 194)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 18, 8, 3, 14, 194) -] +STRENGTH_SOLUTIONS[(63, 18, 8, 4, 13, 194)] = ( + STRENGTH_SOLUTIONS[(63, 18, 8, 5, 14, 194)][0], + ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 18, 8, 5, 14, 194)][1], +) +STRENGTH_SOLUTIONS[(63, 18, 8, 3, 14, 194)] = ( + STRENGTH_SOLUTIONS[(63, 18, 8, 4, 13, 194)][0], + ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 18, 8, 4, 13, 194)][1], +) +STRENGTH_SOLUTIONS[(63, 18, 8, 4, 15, 194)] = ( + STRENGTH_SOLUTIONS[(63, 18, 8, 3, 14, 194)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 18, 8, 3, 14, 194)][1], +) # 3F Switch 3 -STRENGTH_SOLUTIONS[(63, 19, 26, 22, 4, 198)] = [ - "UP", - "UP", - "UP", - "RIGHT", - "UP", - "UP", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "UP", - "LEFT", - "DOWN", - "RIGHT", - "DOWN", - "DOWN", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "UP", - "UP", - "LEFT", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "DOWN", - "LEFT", - "DOWN", - "RIGHT", - "RIGHT", -] +STRENGTH_SOLUTIONS[(63, 7, 26, 22, 4, 198)] = ( + None, + [ + "UP", + "UP", + "UP", + "RIGHT", + "UP", + "UP", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "UP", + "LEFT", + "DOWN", + "RIGHT", + "DOWN", + "DOWN", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "UP", + "UP", + "LEFT", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "DOWN", + "LEFT", + "DOWN", + "RIGHT", + "RIGHT", + ], +) -STRENGTH_SOLUTIONS[(63, 19, 26, 23, 3, 198)] = ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[ - (63, 19, 26, 22, 4, 198) -] -STRENGTH_SOLUTIONS[(63, 19, 26, 22, 2, 198)] = ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 19, 26, 23, 3, 198) -] -STRENGTH_SOLUTIONS[(63, 19, 26, 21, 3, 198)] = ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 19, 26, 22, 2, 198) -] +STRENGTH_SOLUTIONS[(63, 7, 26, 23, 3, 198)] = ( + STRENGTH_SOLUTIONS[(63, 7, 26, 22, 4, 198)][0], + ["DOWN", "LEFT"] + STRENGTH_SOLUTIONS[(63, 7, 26, 22, 4, 198)][1], +) +STRENGTH_SOLUTIONS[(63, 7, 26, 22, 2, 198)] = ( + STRENGTH_SOLUTIONS[(63, 7, 26, 23, 3, 198)][0], + ["RIGHT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 7, 26, 23, 3, 198)][1], +) +STRENGTH_SOLUTIONS[(63, 7, 26, 21, 3, 198)] = ( + STRENGTH_SOLUTIONS[(63, 7, 26, 22, 2, 198)][0], + ["UP", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 7, 26, 22, 2, 198)][1], +) # 3F Boulder in hole -STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)] = ["RIGHT", "RIGHT", "RIGHT"] -STRENGTH_SOLUTIONS[(63, 16, 17, 22, 16, 198)] = ["LEFT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 16, 17, 21, 15, 198) -] -STRENGTH_SOLUTIONS[(63, 16, 17, 22, 14, 198)] = ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[ - (63, 16, 17, 21, 15, 198) -] +STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)] = ( + "HS_VICTORY_ROAD_3F_BOULDER", + ["RIGHT", "RIGHT", "RIGHT"], +) +STRENGTH_SOLUTIONS[(63, 16, 17, 22, 16, 198)] = ( + STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)][0], + ["LEFT", "UP"] + STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)][1], +) +STRENGTH_SOLUTIONS[(63, 16, 17, 22, 14, 198)] = ( + STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)][0], + ["LEFT", "DOWN"] + STRENGTH_SOLUTIONS[(63, 16, 17, 21, 15, 198)][1], +) # 2F final switch -STRENGTH_SOLUTIONS[(63, 20, 27, 24, 16, 194)] = [ - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", - "LEFT", -] +STRENGTH_SOLUTIONS[(63, 20, 27, 24, 16, 194)] = ( + "HS_VICTORY_ROAD_2F_BOULDER", + [ + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + "LEFT", + ], +) -STRENGTH_SOLUTIONS[(63, 20, 27, 23, 17, 194)] = ["RIGHT", "UP"] + STRENGTH_SOLUTIONS[ - (63, 20, 27, 24, 16, 194) -] -STRENGTH_SOLUTIONS[(63, 20, 27, 22, 16, 194)] = ["DOWN", "RIGHT"] + STRENGTH_SOLUTIONS[ - (63, 20, 27, 23, 17, 194) -] +STRENGTH_SOLUTIONS[(63, 20, 27, 23, 17, 194)] = ( + STRENGTH_SOLUTIONS[(63, 20, 27, 24, 16, 194)][0], + ["RIGHT", "UP"] + STRENGTH_SOLUTIONS[(63, 20, 27, 24, 16, 194)][1], +) +STRENGTH_SOLUTIONS[(63, 20, 27, 22, 16, 194)] = ( + STRENGTH_SOLUTIONS[(63, 20, 27, 23, 17, 194)][0], + ["DOWN", "RIGHT"] + STRENGTH_SOLUTIONS[(63, 20, 27, 23, 17, 194)][1], +) diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 0b6c1a9..c580cdd 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -767,8 +767,7 @@ def run_action_on_emulator(self, action): ): self.teach_hm(TmHmMoves.STRENGTH.value, 15, STRENGTH_SPECIES_IDS) if self.auto_solve_strength_puzzles: - self.solve_missable_strength_puzzle() - self.solve_switch_strength_puzzle() + self.solve_strength_puzzle() if self.events.get_event("EVENT_GOT_POKE_FLUTE") and self.auto_pokeflute: self.use_pokeflute() @@ -1102,60 +1101,7 @@ def surf_if_attempt(self, action: WindowEvent): self.pyboy.send_input(WindowEvent.RELEASE_BUTTON_A, delay=8) self.pyboy.tick(4 * self.action_freq, self.animate_scripts) - def solve_missable_strength_puzzle(self): - in_cavern = self.read_m("wCurMapTileset") == Tilesets.CAVERN.value - if self.read_m(0xD057) == 0 and in_cavern: - _, wMissableObjectFlags = self.pyboy.symbol_lookup("wMissableObjectFlags") - _, wMissableObjectList = self.pyboy.symbol_lookup("wMissableObjectList") - missable_objects_list = self.pyboy.memory[ - wMissableObjectList : wMissableObjectList + 34 - ] - missable_objects_list = missable_objects_list[: missable_objects_list.index(0xFF)] - missable_objects_sprite_ids = missable_objects_list[::2] - missable_objects_flags = missable_objects_list[1::2] - - for sprite_id in missable_objects_sprite_ids: - flags_bit = missable_objects_flags[missable_objects_sprite_ids.index(sprite_id)] - flags_byte = flags_bit // 8 - flag_bit = flags_bit % 8 - flag_byte_value = self.read_bit(wMissableObjectFlags + flags_byte, flag_bit) - if not flag_byte_value: # True if missable - picture_id = self.read_m(f"wSprite{sprite_id:02}StateData1PictureID") - mapY = self.read_m(f"wSprite{sprite_id:02}StateData2MapY") - mapX = self.read_m(f"wSprite{sprite_id:02}StateData2MapX") - if solution := STRENGTH_SOLUTIONS.get( - (picture_id, mapY, mapX) + self.get_game_coords(), [] - ): - if not self.disable_wild_encounters: - self.setup_disable_wild_encounters() - # Activate strength - _, status_flags_1 = self.pyboy.symbol_lookup("wStatusFlags1") - self.pyboy.memory[status_flags_1] |= 0b0000_0001 - # Perform solution - current_repel_steps = self.read_m("wRepelRemainingSteps") - for step in solution: - self.pyboy.memory[ - self.pyboy.symbol_lookup("wRepelRemainingSteps")[1] - ] = 0xFF - match step: - case str(button): - self.pyboy.button(button, 8) - self.pyboy.tick(self.action_freq * 2, self.animate_scripts) - case (str(button), int(button_freq), int(action_freq)): - self.pyboy.button(button, button_freq) - self.pyboy.tick(action_freq, self.animate_scripts) - case _: - raise - while self.read_m("wJoyIgnore"): - self.pyboy.tick(self.action_freq, render=False) - self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = ( - current_repel_steps - ) - if not self.disable_wild_encounters: - self.setup_enable_wild_ecounters() - break - - def solve_switch_strength_puzzle(self): + def solve_strength_puzzle(self): in_cavern = self.read_m("wCurMapTileset") == Tilesets.CAVERN.value if self.read_m(0xD057) == 0 and in_cavern: for sprite_id in range(1, self.read_m("wNumSprites") + 1): @@ -1163,8 +1109,11 @@ def solve_switch_strength_puzzle(self): mapY = self.read_m(f"wSprite{sprite_id:02}StateData2MapY") mapX = self.read_m(f"wSprite{sprite_id:02}StateData2MapX") if solution := STRENGTH_SOLUTIONS.get( - (picture_id, mapY, mapX) + self.get_game_coords(), [] + (picture_id, mapY, mapX) + self.get_game_coords(), None ): + missable, steps = solution + if missable and self.missables.get_missable(missable): + break if not self.disable_wild_encounters: self.setup_disable_wild_encounters() # Activate strength @@ -1172,7 +1121,7 @@ def solve_switch_strength_puzzle(self): self.pyboy.memory[status_flags_1] |= 0b0000_0001 # Perform solution current_repel_steps = self.read_m("wRepelRemainingSteps") - for step in solution: + for step in steps: self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = ( 0xFF ) @@ -1187,9 +1136,9 @@ def solve_switch_strength_puzzle(self): raise while self.read_m("wJoyIgnore"): self.pyboy.tick(self.action_freq, render=False) - self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = ( - current_repel_steps - ) + self.pyboy.memory[self.pyboy.symbol_lookup("wRepelRemainingSteps")[1]] = ( + current_repel_steps + ) if not self.disable_wild_encounters: self.setup_enable_wild_ecounters() break