gameboy_worlds.emulation.harry_potter.test_metrics
1from typing import Optional 2 3from gameboy_worlds.emulation.harry_potter.parsers import ( 4 HarryPotterPhilosophersStoneParser, 5 HarryPotterChamberOfSecretsParser, 6) 7from gameboy_worlds.emulation.tracker import ( 8 TerminationMetric, 9 RegionMatchTerminationMetric, 10 RegionMatchTerminationOnlyMetric, 11 RegionMatchSubGoal, 12) 13import numpy as np 14 15 16class PotionsShopTerminateMetric(TerminationMetric): 17 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 18 19 def determine_terminated( 20 self, current_frame: np.ndarray, recent_frames: Optional[np.ndarray] 21 ) -> bool: 22 all_frames = [current_frame] 23 if recent_frames is not None: 24 all_frames = recent_frames 25 for frame in all_frames: 26 matches = self.state_parser.named_region_matches_target( 27 frame, "potions_shop_shelf" 28 ) 29 if matches: 30 return True 31 return False 32 33 34class OllivandersInteriorTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 35 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 36 _TERMINATION_NAMED_REGION = "ollivanders_area" 37 _TERMINATION_TARGET_NAME = "ollivanders_interior" 38 39 40class OutsideOllivandersSubgoal(RegionMatchSubGoal): 41 NAME = "outside_ollivanders_door" 42 _NAMED_REGION = "ollivanders_entrance" 43 _TARGET_NAME = "outside_ollivanders_door" 44 45 46class GetWandTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 47 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 48 _TERMINATION_NAMED_REGION = "wand_received_text" 49 _TERMINATION_TARGET_NAME = "wand_received" 50 51 52class TalkToOllivanderSubgoal(RegionMatchSubGoal): 53 NAME = "talk_to_ollivander" 54 _NAMED_REGION = "wand_dialogue_area" 55 _TARGET_NAME = "talk_to_ollivander" 56 57 58class ReceiveFolioMagiTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 59 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 60 _TERMINATION_NAMED_REGION = "choose_deck_text" 61 _TERMINATION_TARGET_NAME = "choose_deck_shown" 62 63 64class BoyApproachesSubgoal(RegionMatchSubGoal): 65 NAME = "boy_approaches" 66 _NAMED_REGION = "folio_boy_area" 67 _TARGET_NAME = "boy_approaches" 68 69 70class SelectCardDeckTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 71 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 72 _TERMINATION_NAMED_REGION = "deck_reward_icon" 73 _TERMINATION_TARGET_NAME = "deck_selected" 74 75 76class CardOptionsShownSubgoal(RegionMatchSubGoal): 77 NAME = "card_options_shown" 78 _NAMED_REGION = "choose_deck_text" 79 _TARGET_NAME = "choose_deck_shown" 80 81 82class GringottsInteriorTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 83 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 84 _TERMINATION_NAMED_REGION = "gringotts_interior_area" 85 _TERMINATION_TARGET_NAME = "gringotts_interior" 86 87 88class OutsideGringottsSubgoal(RegionMatchSubGoal): 89 NAME = "outside_gringotts_door" 90 _NAMED_REGION = "gringotts_entrance" 91 _TARGET_NAME = "outside_gringotts_door" 92 93 94class TalkHagridGringottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 95 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 96 _TERMINATION_NAMED_REGION = "vault_interior" 97 _TERMINATION_TARGET_NAME = "hagrid_vault_dialogue" 98 99 100class FindHagridGringottsSubgoal(RegionMatchSubGoal): 101 NAME = "find_hagrid_gringotts" 102 _NAMED_REGION = "hagrid_gringotts_area" 103 _TARGET_NAME = "find_hagrid_gringotts" 104 105 106class ReenterGringottsSubgoal(RegionMatchSubGoal): 107 NAME = "reenter_gringotts" 108 _NAMED_REGION = "full_screen_area" 109 _TARGET_NAME = "reenter_gringotts" 110 111 112class ExitGringottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 113 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 114 _TERMINATION_NAMED_REGION = "full_screen_area" 115 _TERMINATION_TARGET_NAME = "exit_gringotts" 116 117 118class TalkToWeasleysSubgoal(RegionMatchSubGoal): 119 NAME = "talk_to_weasleys" 120 _NAMED_REGION = "dialogue_box_full" 121 _TARGET_NAME = "talk_to_weasleys" 122 123 124class OnTrainTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 125 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 126 _TERMINATION_NAMED_REGION = "full_screen_area" 127 _TERMINATION_TARGET_NAME = "on_train" 128 129 130class TalkToRonWeasleySubgoal(RegionMatchSubGoal): 131 NAME = "talk_to_ron_weasley" 132 _NAMED_REGION = "dialogue_box_full" 133 _TARGET_NAME = "talk_to_ron_weasley" 134 135 136class ChocolateFrogs5InventoryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 137 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 138 _TERMINATION_NAMED_REGION = "chocolate_frogs_5_inventory_area" 139 _TERMINATION_TARGET_NAME = "chocolate_frogs_5_inventory" 140 141 142class SellChocolateFrogSubgoal(RegionMatchSubGoal): 143 NAME = "sell_chocolate_frog" 144 _NAMED_REGION = "full_screen_area" 145 _TARGET_NAME = "sell_chocolate_frog" 146 147 148class ChocolateFrogs4InventoryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 149 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 150 _TERMINATION_NAMED_REGION = "chocolate_frogs_5_inventory_area" 151 _TERMINATION_TARGET_NAME = "chocolate_frogs_4_inventory" 152 153 154class StartOfDuelSubgoal(RegionMatchSubGoal): 155 NAME = "start_of_duel" 156 _NAMED_REGION = "full_screen_area" 157 _TARGET_NAME = "start_of_duel" 158 159 160class LoseDuelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 161 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 162 _TERMINATION_NAMED_REGION = "full_screen_area" 163 _TERMINATION_TARGET_NAME = "lose_duel" 164 165 166class WinDuelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 167 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 168 _TERMINATION_NAMED_REGION = "full_screen_area" 169 _TERMINATION_TARGET_NAME = "win_duel" 170 171 172class GainLevelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 173 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 174 _TERMINATION_NAMED_REGION = "level_up_text" 175 _TERMINATION_TARGET_NAME = "gained_new_level" 176 177 178class GainSpellTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 179 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 180 _TERMINATION_NAMED_REGION = "spell_level_text" 181 _TERMINATION_TARGET_NAME = "gained_new_spell" 182 183 184class WinBattleTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 185 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 186 _TERMINATION_NAMED_REGION = "battle_reward_bar" 187 _TERMINATION_TARGET_NAME = "battle_won" 188 189 190class FindBossRatSubgoal(RegionMatchSubGoal): 191 NAME = "boss_rat_found" 192 _NAMED_REGION = "boss_rat_area" 193 _TARGET_NAME = "boss_rat_found" 194 195 196class RatKingSpriteSubgoal(RegionMatchSubGoal): 197 NAME = "rat_king_sprite" 198 _NAMED_REGION = "rat_king_sprite_area" 199 _TARGET_NAME = "rat_king_sprite" 200 201 202class UnableToEscapeSubgoal(RegionMatchSubGoal): 203 NAME = "unable_to_escape" 204 _NAMED_REGION = "dialogue_box_full" 205 _TARGET_NAME = "unable_to_escape" 206 207 208class RespawnDeathRatTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 209 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 210 _TERMINATION_NAMED_REGION = "full_screen_area" 211 _TERMINATION_TARGET_NAME = "respawn_death_rat_screen" 212 213 214class FullyRestoreMPSubgoal(RegionMatchSubGoal): 215 NAME = "fully_restore_your_mp" 216 _NAMED_REGION = "mp_points_area" 217 _TARGET_NAME = "fully_restore_your_mp" 218 219 220class UtilizeDeflectCardsSubgoal(RegionMatchSubGoal): 221 NAME = "utilize_deflect_cards" 222 _NAMED_REGION = "large_dialogue_box" 223 _TARGET_NAME = "large_text_content" 224 225 226# ============================================================ 227# Task 14: find_hagrid_vault_test 228# ============================================================ 229 230class FindHagridVaultTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 231 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 232 _TERMINATION_NAMED_REGION = "vault_entry_cutscene_area" 233 _TERMINATION_TARGET_NAME = "vault_entry_cutscene" 234 235 236class NavigateToHagridSubgoal(RegionMatchSubGoal): 237 NAME = "navigate_to_hagrid" 238 _NAMED_REGION = "post_boss_hagrid_area" 239 _TARGET_NAME = "navigate_to_hagrid" 240 241 242# ============================================================ 243# Madam Malkin split tasks 244# ============================================================ 245 246class EnterMalkinsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 247 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 248 _TERMINATION_NAMED_REGION = "inside_malkins_area" 249 _TERMINATION_TARGET_NAME = "inside_malkins" 250 251# ============================================================ 252# Train walk tasks 253# ============================================================ 254 255class RightmostTrainCarSubgoal(RegionMatchSubGoal): 256 NAME = "rightmost_train_car" 257 _NAMED_REGION = "rightmost_train_car" 258 _TARGET_NAME = "rightmost_train_car_capture" 259 260 261class LeftmostTrainCarSubgoal(RegionMatchSubGoal): 262 NAME = "leftmost_train_car" 263 _NAMED_REGION = "leftmost_train_car" 264 _TARGET_NAME = "leftmost_train_car_capture" 265 266 267class LeftmostTrainCarTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 268 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 269 _TERMINATION_NAMED_REGION = "leftmost_train_car" 270 _TERMINATION_TARGET_NAME = "leftmost_train_car_capture" 271 272 273class OpenMalkinsBuyMenuTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 274 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 275 _TERMINATION_NAMED_REGION = "robes_menu_area" 276 _TERMINATION_TARGET_NAME = "malkins_buy_menu_open" 277 278 279class SelectRobesTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 280 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 281 _TERMINATION_NAMED_REGION = "robes_menu_area" 282 _TERMINATION_TARGET_NAME = "selected_robes" 283 284 285class ConfirmRobesPurchaseTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 286 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 287 _TERMINATION_NAMED_REGION = "robes_purchase_area" 288 _TERMINATION_TARGET_NAME = "confirm_robes_purchase" 289 290 291class OutsideMalkinsSubgoal(RegionMatchSubGoal): 292 NAME = "outside_malkins" 293 _NAMED_REGION = "outside_malkins_area" 294 _TARGET_NAME = "outside_malkins" 295 296 297# ============================================================ 298# Flourish & Blotts split tasks 299# ============================================================ 300 301class EnterFlourishBlottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 302 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 303 _TERMINATION_NAMED_REGION = "inside_flourish_blotts_area" 304 _TERMINATION_TARGET_NAME = "inside_flourish_blotts" 305 306 307class OutsideFlourishBlottsSubgoal(RegionMatchSubGoal): 308 NAME = "outside_flourish_blotts" 309 _NAMED_REGION = "outside_flourish_blotts_area" 310 _TARGET_NAME = "outside_flourish_blotts" 311 312 313class BuyBooksTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 314 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 315 _TERMINATION_NAMED_REGION = "books_received_area" 316 _TERMINATION_TARGET_NAME = "books_received" 317 318 319class TalkToFlourishClerkSubgoal(RegionMatchSubGoal): 320 NAME = "talk_to_flourish_clerk" 321 _NAMED_REGION = "dialogue_box_full" 322 _TARGET_NAME = "talk_to_flourish_clerk" 323 324 325# ============================================================ 326# Apothecary split tasks 327# ============================================================ 328 329class EnterApothecaryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 330 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 331 _TERMINATION_NAMED_REGION = "inside_apothecary_area" 332 _TERMINATION_TARGET_NAME = "inside_apothecary" 333 334 335class BuyPotionKitTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 336 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 337 _TERMINATION_NAMED_REGION = "apothecary_purchase_area" 338 _TERMINATION_TARGET_NAME = "confirm_apothecary_purchase" 339 340 341class OutsideApothecarySubgoal(RegionMatchSubGoal): 342 NAME = "outside_apothecary" 343 _NAMED_REGION = "outside_apothecary_area" 344 _TARGET_NAME = "outside_apothecary" 345 346 347class ApothecaryBuyMenuOpenSubgoal(RegionMatchSubGoal): 348 NAME = "apothecary_buy_menu_open" 349 _NAMED_REGION = "apothecary_menu_area" 350 _TARGET_NAME = "apothecary_buy_menu_open" 351 352 353# ============================================================ 354# Cauldron shop tasks 355# ============================================================ 356 357class EnterCauldronShopTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 358 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 359 _TERMINATION_NAMED_REGION = "inside_cauldron_shop_area" 360 _TERMINATION_TARGET_NAME = "inside_cauldron_shop" 361 362 363class BuyCauldronTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 364 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 365 _TERMINATION_NAMED_REGION = "cauldron_purchase_area" 366 _TERMINATION_TARGET_NAME = "confirm_cauldron_purchase" 367 368 369class OutsideCauldronShopSubgoal(RegionMatchSubGoal): 370 NAME = "outside_cauldron_shop" 371 _NAMED_REGION = "outside_cauldron_shop_area" 372 _TARGET_NAME = "outside_cauldron_shop" 373 374 375class CauldronBuyMenuOpenSubgoal(RegionMatchSubGoal): 376 NAME = "cauldron_buy_menu_open" 377 _NAMED_REGION = "cauldron_menu_area" 378 _TARGET_NAME = "cauldron_buy_menu_open" 379 380 381# ============================================================ 382# Sugarplums Sweets filler tasks 383# ============================================================ 384 385class EnterSugarplumsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 386 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 387 _TERMINATION_NAMED_REGION = "inside_sugarplums_area" 388 _TERMINATION_TARGET_NAME = "inside_sugarplums" 389 390 391class OpenSugarplumsBuyMenuTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 392 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 393 _TERMINATION_NAMED_REGION = "sugarplums_menu_area" 394 _TERMINATION_TARGET_NAME = "sugarplums_buy_menu_open" 395 396 397class OutsideSugarplumsSubgoal(RegionMatchSubGoal): 398 NAME = "outside_sugarplums" 399 _NAMED_REGION = "outside_sugarplums_area" 400 _TARGET_NAME = "outside_sugarplums" 401 402 403# ============================================================ 404# Talk to Hagrid in Diagon Alley 405# ============================================================ 406 407class TalkToHagridDiagonTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 408 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 409 _TERMINATION_NAMED_REGION = "dialogue_box_full" 410 _TERMINATION_TARGET_NAME = "hagrid_diagon_dialogue" 411 412 413class InsideMalkinsSubgoal(RegionMatchSubGoal): 414 NAME = "inside_malkins" 415 _NAMED_REGION = "inside_malkins_area" 416 _TARGET_NAME = "inside_malkins" 417 418 419class SelectedRobesSubgoal(RegionMatchSubGoal): 420 NAME = "selected_robes" 421 _NAMED_REGION = "robes_menu_area" 422 _TARGET_NAME = "selected_robes" 423 424 425class ConfirmRobesPurchaseSubgoal(RegionMatchSubGoal): 426 NAME = "confirm_robes_purchase" 427 _NAMED_REGION = "robes_purchase_area" 428 _TARGET_NAME = "confirm_robes_purchase" 429 430 431# ============================================================ 432# CoS Task 1: find_dobby_test 433# ============================================================ 434 435class FindDobbyTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 436 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 437 _TERMINATION_NAMED_REGION = "dobby_dialogue_area" 438 _TERMINATION_TARGET_NAME = "dobby_dialogue_started" 439 440 441class FindDobbySubgoal(RegionMatchSubGoal): 442 NAME = "find_dobby" 443 _NAMED_REGION = "dobby_bed_area" 444 _TARGET_NAME = "find_dobby" 445 446 447# ============================================================ 448# CoS Task 2: select_card_deck_cos_test 449# ============================================================ 450 451class SelectCardDeckCosTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 452 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 453 _TERMINATION_NAMED_REGION = "choose_deck_cos_area" 454 _TERMINATION_TARGET_NAME = "deck_selected_cos" 455 456 457# ============================================================ 458# CoS Task 3: board_flying_car_test 459# ============================================================ 460 461class BoardFlyingCarTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 462 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 463 _TERMINATION_NAMED_REGION = "flying_car_cutscene_area" 464 _TERMINATION_TARGET_NAME = "flying_car_departure" 465 466 467class TalkToRonCosSubgoal(RegionMatchSubGoal): 468 NAME = "talk_to_ron" 469 _NAMED_REGION = "talk_to_ron_cos_area" 470 _TARGET_NAME = "talk_to_ron" 471 472 473# ============================================================ 474# CoS Task 4: enter_burrow_test 475# ============================================================ 476 477class EnterBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 478 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 479 _TERMINATION_NAMED_REGION = "mrs_weasley_dialogue_area" 480 _TERMINATION_TARGET_NAME = "mrs_weasley_table_dialogue" 481 482 483class OutsideBurrowAfterCutsceneSubgoal(RegionMatchSubGoal): 484 NAME = "outside_burrow_after_cutscene" 485 _NAMED_REGION = "burrow_arrival_dialogue_area" 486 _TARGET_NAME = "outside_burrow_after_cutscene" 487 488 489# ============================================================ 490# CoS Task 5: enter_battle_cos_test 491# ============================================================ 492 493class EnterBattleCosTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 494 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 495 _TERMINATION_NAMED_REGION = "battle_menu_cos_area" 496 _TERMINATION_TARGET_NAME = "in_battle_cos" 497 498 499# ============================================================ 500# Burrow room navigation tasks (CoS) 501# ============================================================ 502 503class EnterPercyRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 504 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 505 _TERMINATION_NAMED_REGION = "percy_room_area" 506 _TERMINATION_TARGET_NAME = "inside_percy_room" 507 508 509class EnterGinnyRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 510 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 511 _TERMINATION_NAMED_REGION = "ginny_room_area" 512 _TERMINATION_TARGET_NAME = "inside_ginny_room" 513 514 515class EnterParentsRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 516 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 517 _TERMINATION_NAMED_REGION = "parents_room_area" 518 _TERMINATION_TARGET_NAME = "inside_parents_room" 519 520 521class EnterFredGeorgeRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 522 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 523 _TERMINATION_NAMED_REGION = "fred_george_room_area" 524 _TERMINATION_TARGET_NAME = "inside_fred_george_room" 525 526 527class EnterRonsRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 528 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 529 _TERMINATION_NAMED_REGION = "rons_room_area" 530 _TERMINATION_TARGET_NAME = "inside_rons_room" 531 532 533class TalkToRonBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 534 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 535 _TERMINATION_NAMED_REGION = "dialogue_box_full" 536 _TERMINATION_TARGET_NAME = "talk_to_ron_burrow" 537 538 539class EnterKitchenBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 540 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 541 _TERMINATION_NAMED_REGION = "dialogue_box_full" 542 _TERMINATION_TARGET_NAME = "talk_to_mom_kitchen" 543 544 545class EnterBurrowGardenTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 546 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 547 _TERMINATION_NAMED_REGION = "dialogue_box_full" 548 _TERMINATION_TARGET_NAME = "talk_to_ron_garden" 549 550 551class OutsideGardenDoorSubgoal(RegionMatchSubGoal): 552 NAME = "outside_garden_door" 553 _NAMED_REGION = "garden_door_area" 554 _TARGET_NAME = "outside_garden_door" 555 556 557class NavigateToCarTerminateMetric(RegionMatchTerminationOnlyMetric): 558 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 559 _TERMINATION_NAMED_REGION = "car_area" 560 _TERMINATION_TARGET_NAME = "next_to_car" 561 562 563class DiagonAlleySubgoal(RegionMatchSubGoal): 564 NAME = "diagon_alley" 565 _NAMED_REGION = "find_location" 566 _TARGET_NAME = "diagon_alley" 567 568 569class StartMenuTerminateMetric(RegionMatchTerminationOnlyMetric): 570 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 571 _TERMINATION_NAMED_REGION = "menu" 572 _TERMINATION_TARGET_NAME = "start_menu" 573 574 575class PumpkinPastySubgoal(RegionMatchSubGoal): 576 NAME = "pumpkin_pasties" 577 _NAMED_REGION = "last_item" 578 _TARGET_NAME = "pumpkin_pasties" 579 580 581class EatPumpkinPastyTerminateMetric(RegionMatchTerminationOnlyMetric): 582 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 583 _TERMINATION_NAMED_REGION = "item_consumption" 584 _TERMINATION_TARGET_NAME = "ate_pumpkin_pasties" 585 586 587class EquippedPointedHatSubgoal(RegionMatchSubGoal): 588 NAME = "equipped_pointed_hat" 589 _NAMED_REGION = "equip_screen" 590 _TARGET_NAME = "equipped_pointed_hat" 591 592 593class EquippedPointedHatPlainWorkRobeTerminateMetric(RegionMatchTerminationOnlyMetric): 594 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 595 _TERMINATION_NAMED_REGION = "equip_screen" 596 _TERMINATION_TARGET_NAME = "equipped_pointed_hat_plain_work_robe" 597 598 599class RemoveHatSubgoal(RegionMatchSubGoal): 600 NAME = "remove_hat" 601 _NAMED_REGION = "equip_screen" 602 _TARGET_NAME = "remove_hat" 603 604 605class RemoveRobeSubgoal(RegionMatchSubGoal): 606 NAME = "remove_robe" 607 _NAMED_REGION = "equip_screen" 608 _TARGET_NAME = "remove_robe" 609 610 611class EmptyEquipCursorRobeTerminateMetric(RegionMatchTerminationOnlyMetric): 612 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 613 _TERMINATION_NAMED_REGION = "equip_screen" 614 _TERMINATION_TARGET_NAME = "empty_equip_cursor_robe" 615 616 617# ============================================================ 618# Boat Battle tasks 619# ============================================================ 620 621class TalkToHagridBeforeBoatSubgoal(RegionMatchSubGoal): 622 NAME = "talk_with_hagrid_before_boat" 623 _NAMED_REGION = "dialogue_box_full" 624 _TARGET_NAME = "talk_with_hagrid_before_boat" 625 626 627class BoatBattleTerminateMetric(RegionMatchTerminationOnlyMetric): 628 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 629 _TERMINATION_NAMED_REGION = "boat_battle" 630 _TERMINATION_TARGET_NAME = "boat_battle_target" 631 632 633# ============================================================ 634# Die task 635# ============================================================ 636 637class WeakenedHealthBarSubgoal(RegionMatchSubGoal): 638 NAME = "weakened_health_bar" 639 _NAMED_REGION = "large_dialogue_box" 640 _TARGET_NAME = "weakened_health_bar" 641 642 643class RestoredFullHealthTerminateMetric(RegionMatchTerminationOnlyMetric): 644 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 645 _TERMINATION_NAMED_REGION = "large_dialogue_box" 646 _TERMINATION_TARGET_NAME = "restored_full_health" 647 648 649# ============================================================ 650# Yellow Rat then Big Yellow Monster task 651# ============================================================ 652 653class FightYellowRatSubgoal(RegionMatchSubGoal): 654 NAME = "fight_yellow_rat" 655 _NAMED_REGION = "top_left_battle" 656 _TARGET_NAME = "yellow_rat" 657 658 659class FightBigYellowMonsterTerminateMetric(RegionMatchTerminationOnlyMetric): 660 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 661 _TERMINATION_NAMED_REGION = "top_left_battle" 662 _TERMINATION_TARGET_NAME = "big_yellow_monster" 663 664 665# ============================================================ 666# Bat then Big Yellow Monster (middle) task 667# ============================================================ 668 669class FightBatMiddleSubgoal(RegionMatchSubGoal): 670 NAME = "fight_bat_middle" 671 _NAMED_REGION = "middle_fight_area" 672 _TARGET_NAME = "bat" 673 674 675class FightBigYellowMonsterMiddleTerminateMetric(RegionMatchTerminationOnlyMetric): 676 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 677 _TERMINATION_NAMED_REGION = "middle_fight_area" 678 _TERMINATION_TARGET_NAME = "big_yellow_monster"
17class PotionsShopTerminateMetric(TerminationMetric): 18 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 19 20 def determine_terminated( 21 self, current_frame: np.ndarray, recent_frames: Optional[np.ndarray] 22 ) -> bool: 23 all_frames = [current_frame] 24 if recent_frames is not None: 25 all_frames = recent_frames 26 for frame in all_frames: 27 matches = self.state_parser.named_region_matches_target( 28 frame, "potions_shop_shelf" 29 ) 30 if matches: 31 return True 32 return False
Tracks whether the environment was terminated or truncated.
Reports:
terminated: Whether the environment was terminated.truncated: Whether the environment was truncated.
Final Reports:
episode_end_reason: List of reasons for episode endings: "terminated", "truncated", or None (None will occur only if there is a bug that leads to a premature reset).
The StateParser which implements the minimum required functionality for this MetricGroup to work.
20 def determine_terminated( 21 self, current_frame: np.ndarray, recent_frames: Optional[np.ndarray] 22 ) -> bool: 23 all_frames = [current_frame] 24 if recent_frames is not None: 25 all_frames = recent_frames 26 for frame in all_frames: 27 matches = self.state_parser.named_region_matches_target( 28 frame, "potions_shop_shelf" 29 ) 30 if matches: 31 return True 32 return False
Determines whether the environment was terminated.
Parameters
- current_frame: The current frame rendered by the emulator.
- recent_frames: The stack of frames that were rendered during the last action. Shape is [n_frames, height, width, channels]. Can be None if rendering is disabled.
Returns
True if the environment was terminated, False otherwise.
Inherited Members
35class OllivandersInteriorTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 36 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 37 _TERMINATION_NAMED_REGION = "ollivanders_area" 38 _TERMINATION_TARGET_NAME = "ollivanders_interior"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
41class OutsideOllivandersSubgoal(RegionMatchSubGoal): 42 NAME = "outside_ollivanders_door" 43 _NAMED_REGION = "ollivanders_entrance" 44 _TARGET_NAME = "outside_ollivanders_door"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
47class GetWandTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 48 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 49 _TERMINATION_NAMED_REGION = "wand_received_text" 50 _TERMINATION_TARGET_NAME = "wand_received"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
53class TalkToOllivanderSubgoal(RegionMatchSubGoal): 54 NAME = "talk_to_ollivander" 55 _NAMED_REGION = "wand_dialogue_area" 56 _TARGET_NAME = "talk_to_ollivander"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
59class ReceiveFolioMagiTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 60 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 61 _TERMINATION_NAMED_REGION = "choose_deck_text" 62 _TERMINATION_TARGET_NAME = "choose_deck_shown"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
65class BoyApproachesSubgoal(RegionMatchSubGoal): 66 NAME = "boy_approaches" 67 _NAMED_REGION = "folio_boy_area" 68 _TARGET_NAME = "boy_approaches"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
71class SelectCardDeckTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 72 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 73 _TERMINATION_NAMED_REGION = "deck_reward_icon" 74 _TERMINATION_TARGET_NAME = "deck_selected"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
77class CardOptionsShownSubgoal(RegionMatchSubGoal): 78 NAME = "card_options_shown" 79 _NAMED_REGION = "choose_deck_text" 80 _TARGET_NAME = "choose_deck_shown"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
83class GringottsInteriorTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 84 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 85 _TERMINATION_NAMED_REGION = "gringotts_interior_area" 86 _TERMINATION_TARGET_NAME = "gringotts_interior"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
89class OutsideGringottsSubgoal(RegionMatchSubGoal): 90 NAME = "outside_gringotts_door" 91 _NAMED_REGION = "gringotts_entrance" 92 _TARGET_NAME = "outside_gringotts_door"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
95class TalkHagridGringottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 96 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 97 _TERMINATION_NAMED_REGION = "vault_interior" 98 _TERMINATION_TARGET_NAME = "hagrid_vault_dialogue"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
101class FindHagridGringottsSubgoal(RegionMatchSubGoal): 102 NAME = "find_hagrid_gringotts" 103 _NAMED_REGION = "hagrid_gringotts_area" 104 _TARGET_NAME = "find_hagrid_gringotts"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
107class ReenterGringottsSubgoal(RegionMatchSubGoal): 108 NAME = "reenter_gringotts" 109 _NAMED_REGION = "full_screen_area" 110 _TARGET_NAME = "reenter_gringotts"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
113class ExitGringottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 114 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 115 _TERMINATION_NAMED_REGION = "full_screen_area" 116 _TERMINATION_TARGET_NAME = "exit_gringotts"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
119class TalkToWeasleysSubgoal(RegionMatchSubGoal): 120 NAME = "talk_to_weasleys" 121 _NAMED_REGION = "dialogue_box_full" 122 _TARGET_NAME = "talk_to_weasleys"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
125class OnTrainTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 126 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 127 _TERMINATION_NAMED_REGION = "full_screen_area" 128 _TERMINATION_TARGET_NAME = "on_train"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
131class TalkToRonWeasleySubgoal(RegionMatchSubGoal): 132 NAME = "talk_to_ron_weasley" 133 _NAMED_REGION = "dialogue_box_full" 134 _TARGET_NAME = "talk_to_ron_weasley"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
137class ChocolateFrogs5InventoryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 138 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 139 _TERMINATION_NAMED_REGION = "chocolate_frogs_5_inventory_area" 140 _TERMINATION_TARGET_NAME = "chocolate_frogs_5_inventory"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
143class SellChocolateFrogSubgoal(RegionMatchSubGoal): 144 NAME = "sell_chocolate_frog" 145 _NAMED_REGION = "full_screen_area" 146 _TARGET_NAME = "sell_chocolate_frog"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
149class ChocolateFrogs4InventoryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 150 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 151 _TERMINATION_NAMED_REGION = "chocolate_frogs_5_inventory_area" 152 _TERMINATION_TARGET_NAME = "chocolate_frogs_4_inventory"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
155class StartOfDuelSubgoal(RegionMatchSubGoal): 156 NAME = "start_of_duel" 157 _NAMED_REGION = "full_screen_area" 158 _TARGET_NAME = "start_of_duel"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
161class LoseDuelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 162 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 163 _TERMINATION_NAMED_REGION = "full_screen_area" 164 _TERMINATION_TARGET_NAME = "lose_duel"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
167class WinDuelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 168 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 169 _TERMINATION_NAMED_REGION = "full_screen_area" 170 _TERMINATION_TARGET_NAME = "win_duel"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
173class GainLevelTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 174 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 175 _TERMINATION_NAMED_REGION = "level_up_text" 176 _TERMINATION_TARGET_NAME = "gained_new_level"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
179class GainSpellTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 180 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 181 _TERMINATION_NAMED_REGION = "spell_level_text" 182 _TERMINATION_TARGET_NAME = "gained_new_spell"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
185class WinBattleTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 186 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 187 _TERMINATION_NAMED_REGION = "battle_reward_bar" 188 _TERMINATION_TARGET_NAME = "battle_won"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
191class FindBossRatSubgoal(RegionMatchSubGoal): 192 NAME = "boss_rat_found" 193 _NAMED_REGION = "boss_rat_area" 194 _TARGET_NAME = "boss_rat_found"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
197class RatKingSpriteSubgoal(RegionMatchSubGoal): 198 NAME = "rat_king_sprite" 199 _NAMED_REGION = "rat_king_sprite_area" 200 _TARGET_NAME = "rat_king_sprite"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
203class UnableToEscapeSubgoal(RegionMatchSubGoal): 204 NAME = "unable_to_escape" 205 _NAMED_REGION = "dialogue_box_full" 206 _TARGET_NAME = "unable_to_escape"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
209class RespawnDeathRatTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 210 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 211 _TERMINATION_NAMED_REGION = "full_screen_area" 212 _TERMINATION_TARGET_NAME = "respawn_death_rat_screen"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
215class FullyRestoreMPSubgoal(RegionMatchSubGoal): 216 NAME = "fully_restore_your_mp" 217 _NAMED_REGION = "mp_points_area" 218 _TARGET_NAME = "fully_restore_your_mp"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
221class UtilizeDeflectCardsSubgoal(RegionMatchSubGoal): 222 NAME = "utilize_deflect_cards" 223 _NAMED_REGION = "large_dialogue_box" 224 _TARGET_NAME = "large_text_content"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
231class FindHagridVaultTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 232 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 233 _TERMINATION_NAMED_REGION = "vault_entry_cutscene_area" 234 _TERMINATION_TARGET_NAME = "vault_entry_cutscene"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
247class EnterMalkinsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 248 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 249 _TERMINATION_NAMED_REGION = "inside_malkins_area" 250 _TERMINATION_TARGET_NAME = "inside_malkins"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
256class RightmostTrainCarSubgoal(RegionMatchSubGoal): 257 NAME = "rightmost_train_car" 258 _NAMED_REGION = "rightmost_train_car" 259 _TARGET_NAME = "rightmost_train_car_capture"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
262class LeftmostTrainCarSubgoal(RegionMatchSubGoal): 263 NAME = "leftmost_train_car" 264 _NAMED_REGION = "leftmost_train_car" 265 _TARGET_NAME = "leftmost_train_car_capture"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
268class LeftmostTrainCarTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 269 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 270 _TERMINATION_NAMED_REGION = "leftmost_train_car" 271 _TERMINATION_TARGET_NAME = "leftmost_train_car_capture"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
274class OpenMalkinsBuyMenuTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 275 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 276 _TERMINATION_NAMED_REGION = "robes_menu_area" 277 _TERMINATION_TARGET_NAME = "malkins_buy_menu_open"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
280class SelectRobesTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 281 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 282 _TERMINATION_NAMED_REGION = "robes_menu_area" 283 _TERMINATION_TARGET_NAME = "selected_robes"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
286class ConfirmRobesPurchaseTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 287 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 288 _TERMINATION_NAMED_REGION = "robes_purchase_area" 289 _TERMINATION_TARGET_NAME = "confirm_robes_purchase"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
292class OutsideMalkinsSubgoal(RegionMatchSubGoal): 293 NAME = "outside_malkins" 294 _NAMED_REGION = "outside_malkins_area" 295 _TARGET_NAME = "outside_malkins"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
302class EnterFlourishBlottsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 303 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 304 _TERMINATION_NAMED_REGION = "inside_flourish_blotts_area" 305 _TERMINATION_TARGET_NAME = "inside_flourish_blotts"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
308class OutsideFlourishBlottsSubgoal(RegionMatchSubGoal): 309 NAME = "outside_flourish_blotts" 310 _NAMED_REGION = "outside_flourish_blotts_area" 311 _TARGET_NAME = "outside_flourish_blotts"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
314class BuyBooksTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 315 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 316 _TERMINATION_NAMED_REGION = "books_received_area" 317 _TERMINATION_TARGET_NAME = "books_received"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
320class TalkToFlourishClerkSubgoal(RegionMatchSubGoal): 321 NAME = "talk_to_flourish_clerk" 322 _NAMED_REGION = "dialogue_box_full" 323 _TARGET_NAME = "talk_to_flourish_clerk"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
330class EnterApothecaryTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 331 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 332 _TERMINATION_NAMED_REGION = "inside_apothecary_area" 333 _TERMINATION_TARGET_NAME = "inside_apothecary"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
336class BuyPotionKitTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 337 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 338 _TERMINATION_NAMED_REGION = "apothecary_purchase_area" 339 _TERMINATION_TARGET_NAME = "confirm_apothecary_purchase"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
342class OutsideApothecarySubgoal(RegionMatchSubGoal): 343 NAME = "outside_apothecary" 344 _NAMED_REGION = "outside_apothecary_area" 345 _TARGET_NAME = "outside_apothecary"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
348class ApothecaryBuyMenuOpenSubgoal(RegionMatchSubGoal): 349 NAME = "apothecary_buy_menu_open" 350 _NAMED_REGION = "apothecary_menu_area" 351 _TARGET_NAME = "apothecary_buy_menu_open"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
358class EnterCauldronShopTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 359 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 360 _TERMINATION_NAMED_REGION = "inside_cauldron_shop_area" 361 _TERMINATION_TARGET_NAME = "inside_cauldron_shop"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
364class BuyCauldronTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 365 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 366 _TERMINATION_NAMED_REGION = "cauldron_purchase_area" 367 _TERMINATION_TARGET_NAME = "confirm_cauldron_purchase"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
370class OutsideCauldronShopSubgoal(RegionMatchSubGoal): 371 NAME = "outside_cauldron_shop" 372 _NAMED_REGION = "outside_cauldron_shop_area" 373 _TARGET_NAME = "outside_cauldron_shop"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
376class CauldronBuyMenuOpenSubgoal(RegionMatchSubGoal): 377 NAME = "cauldron_buy_menu_open" 378 _NAMED_REGION = "cauldron_menu_area" 379 _TARGET_NAME = "cauldron_buy_menu_open"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
386class EnterSugarplumsTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 387 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 388 _TERMINATION_NAMED_REGION = "inside_sugarplums_area" 389 _TERMINATION_TARGET_NAME = "inside_sugarplums"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
392class OpenSugarplumsBuyMenuTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 393 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 394 _TERMINATION_NAMED_REGION = "sugarplums_menu_area" 395 _TERMINATION_TARGET_NAME = "sugarplums_buy_menu_open"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
398class OutsideSugarplumsSubgoal(RegionMatchSubGoal): 399 NAME = "outside_sugarplums" 400 _NAMED_REGION = "outside_sugarplums_area" 401 _TARGET_NAME = "outside_sugarplums"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
408class TalkToHagridDiagonTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 409 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 410 _TERMINATION_NAMED_REGION = "dialogue_box_full" 411 _TERMINATION_TARGET_NAME = "hagrid_diagon_dialogue"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
414class InsideMalkinsSubgoal(RegionMatchSubGoal): 415 NAME = "inside_malkins" 416 _NAMED_REGION = "inside_malkins_area" 417 _TARGET_NAME = "inside_malkins"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
420class SelectedRobesSubgoal(RegionMatchSubGoal): 421 NAME = "selected_robes" 422 _NAMED_REGION = "robes_menu_area" 423 _TARGET_NAME = "selected_robes"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
426class ConfirmRobesPurchaseSubgoal(RegionMatchSubGoal): 427 NAME = "confirm_robes_purchase" 428 _NAMED_REGION = "robes_purchase_area" 429 _TARGET_NAME = "confirm_robes_purchase"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
436class FindDobbyTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 437 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 438 _TERMINATION_NAMED_REGION = "dobby_dialogue_area" 439 _TERMINATION_TARGET_NAME = "dobby_dialogue_started"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
442class FindDobbySubgoal(RegionMatchSubGoal): 443 NAME = "find_dobby" 444 _NAMED_REGION = "dobby_bed_area" 445 _TARGET_NAME = "find_dobby"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
452class SelectCardDeckCosTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 453 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 454 _TERMINATION_NAMED_REGION = "choose_deck_cos_area" 455 _TERMINATION_TARGET_NAME = "deck_selected_cos"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
462class BoardFlyingCarTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 463 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 464 _TERMINATION_NAMED_REGION = "flying_car_cutscene_area" 465 _TERMINATION_TARGET_NAME = "flying_car_departure"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
468class TalkToRonCosSubgoal(RegionMatchSubGoal): 469 NAME = "talk_to_ron" 470 _NAMED_REGION = "talk_to_ron_cos_area" 471 _TARGET_NAME = "talk_to_ron"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
478class EnterBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 479 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 480 _TERMINATION_NAMED_REGION = "mrs_weasley_dialogue_area" 481 _TERMINATION_TARGET_NAME = "mrs_weasley_table_dialogue"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
484class OutsideBurrowAfterCutsceneSubgoal(RegionMatchSubGoal): 485 NAME = "outside_burrow_after_cutscene" 486 _NAMED_REGION = "burrow_arrival_dialogue_area" 487 _TARGET_NAME = "outside_burrow_after_cutscene"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
494class EnterBattleCosTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 495 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 496 _TERMINATION_NAMED_REGION = "battle_menu_cos_area" 497 _TERMINATION_TARGET_NAME = "in_battle_cos"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
504class EnterPercyRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 505 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 506 _TERMINATION_NAMED_REGION = "percy_room_area" 507 _TERMINATION_TARGET_NAME = "inside_percy_room"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
510class EnterGinnyRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 511 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 512 _TERMINATION_NAMED_REGION = "ginny_room_area" 513 _TERMINATION_TARGET_NAME = "inside_ginny_room"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
516class EnterParentsRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 517 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 518 _TERMINATION_NAMED_REGION = "parents_room_area" 519 _TERMINATION_TARGET_NAME = "inside_parents_room"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
522class EnterFredGeorgeRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 523 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 524 _TERMINATION_NAMED_REGION = "fred_george_room_area" 525 _TERMINATION_TARGET_NAME = "inside_fred_george_room"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
528class EnterRonsRoomTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 529 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 530 _TERMINATION_NAMED_REGION = "rons_room_area" 531 _TERMINATION_TARGET_NAME = "inside_rons_room"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
534class TalkToRonBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 535 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 536 _TERMINATION_NAMED_REGION = "dialogue_box_full" 537 _TERMINATION_TARGET_NAME = "talk_to_ron_burrow"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
540class EnterKitchenBurrowTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 541 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 542 _TERMINATION_NAMED_REGION = "dialogue_box_full" 543 _TERMINATION_TARGET_NAME = "talk_to_mom_kitchen"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
546class EnterBurrowGardenTerminateMetric(RegionMatchTerminationMetric, TerminationMetric): 547 REQUIRED_PARSER = HarryPotterChamberOfSecretsParser 548 _TERMINATION_NAMED_REGION = "dialogue_box_full" 549 _TERMINATION_TARGET_NAME = "talk_to_ron_garden"
Terminates the episode if a specific region matches a target. Can be used to terminate episodes when specific dialogue boxes appear, etc.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
552class OutsideGardenDoorSubgoal(RegionMatchSubGoal): 553 NAME = "outside_garden_door" 554 _NAMED_REGION = "garden_door_area" 555 _TARGET_NAME = "outside_garden_door"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
564class DiagonAlleySubgoal(RegionMatchSubGoal): 565 NAME = "diagon_alley" 566 _NAMED_REGION = "find_location" 567 _TARGET_NAME = "diagon_alley"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
570class StartMenuTerminateMetric(RegionMatchTerminationOnlyMetric): 571 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 572 _TERMINATION_NAMED_REGION = "menu" 573 _TERMINATION_TARGET_NAME = "start_menu"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
576class PumpkinPastySubgoal(RegionMatchSubGoal): 577 NAME = "pumpkin_pasties" 578 _NAMED_REGION = "last_item" 579 _TARGET_NAME = "pumpkin_pasties"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
582class EatPumpkinPastyTerminateMetric(RegionMatchTerminationOnlyMetric): 583 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 584 _TERMINATION_NAMED_REGION = "item_consumption" 585 _TERMINATION_TARGET_NAME = "ate_pumpkin_pasties"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
588class EquippedPointedHatSubgoal(RegionMatchSubGoal): 589 NAME = "equipped_pointed_hat" 590 _NAMED_REGION = "equip_screen" 591 _TARGET_NAME = "equipped_pointed_hat"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
594class EquippedPointedHatPlainWorkRobeTerminateMetric(RegionMatchTerminationOnlyMetric): 595 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 596 _TERMINATION_NAMED_REGION = "equip_screen" 597 _TERMINATION_TARGET_NAME = "equipped_pointed_hat_plain_work_robe"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
600class RemoveHatSubgoal(RegionMatchSubGoal): 601 NAME = "remove_hat" 602 _NAMED_REGION = "equip_screen" 603 _TARGET_NAME = "remove_hat"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
606class RemoveRobeSubgoal(RegionMatchSubGoal): 607 NAME = "remove_robe" 608 _NAMED_REGION = "equip_screen" 609 _TARGET_NAME = "remove_robe"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
612class EmptyEquipCursorRobeTerminateMetric(RegionMatchTerminationOnlyMetric): 613 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 614 _TERMINATION_NAMED_REGION = "equip_screen" 615 _TERMINATION_TARGET_NAME = "empty_equip_cursor_robe"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
622class TalkToHagridBeforeBoatSubgoal(RegionMatchSubGoal): 623 NAME = "talk_with_hagrid_before_boat" 624 _NAMED_REGION = "dialogue_box_full" 625 _TARGET_NAME = "talk_with_hagrid_before_boat"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
628class BoatBattleTerminateMetric(RegionMatchTerminationOnlyMetric): 629 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 630 _TERMINATION_NAMED_REGION = "boat_battle" 631 _TERMINATION_TARGET_NAME = "boat_battle_target"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
638class WeakenedHealthBarSubgoal(RegionMatchSubGoal): 639 NAME = "weakened_health_bar" 640 _NAMED_REGION = "large_dialogue_box" 641 _TARGET_NAME = "weakened_health_bar"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
644class RestoredFullHealthTerminateMetric(RegionMatchTerminationOnlyMetric): 645 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 646 _TERMINATION_NAMED_REGION = "large_dialogue_box" 647 _TERMINATION_TARGET_NAME = "restored_full_health"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
654class FightYellowRatSubgoal(RegionMatchSubGoal): 655 NAME = "fight_yellow_rat" 656 _NAMED_REGION = "top_left_battle" 657 _TARGET_NAME = "yellow_rat"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
660class FightBigYellowMonsterTerminateMetric(RegionMatchTerminationOnlyMetric): 661 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 662 _TERMINATION_NAMED_REGION = "top_left_battle" 663 _TERMINATION_TARGET_NAME = "big_yellow_monster"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.
Inherited Members
670class FightBatMiddleSubgoal(RegionMatchSubGoal): 671 NAME = "fight_bat_middle" 672 _NAMED_REGION = "middle_fight_area" 673 _TARGET_NAME = "bat"
A subgoal that is completed if a specific region matches a target. Can be used to track subgoals that require specific dialogue boxes to appear, etc.
Inherited Members
676class FightBigYellowMonsterMiddleTerminateMetric(RegionMatchTerminationOnlyMetric): 677 REQUIRED_PARSER = HarryPotterPhilosophersStoneParser 678 _TERMINATION_NAMED_REGION = "middle_fight_area" 679 _TERMINATION_TARGET_NAME = "big_yellow_monster"
RegionMatchTerminationMetric with no truncation. No truncation.
The StateParser which implements the minimum required functionality for this MetricGroup to work.