From 4031f19d92f84ca8f3da863b41806ef64c75a578 Mon Sep 17 00:00:00 2001 From: massimilianodelliubaldini <8584296+massimilianodelliubaldini@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:17:25 -0400 Subject: [PATCH] Jak 1: Add Scout Fly Locations, code and style cleanup. --- worlds/jakanddaxter/GameID.py | 3 +- worlds/jakanddaxter/Items.py | 2 + worlds/jakanddaxter/Locations.py | 22 ++- worlds/jakanddaxter/Options.py | 2 + worlds/jakanddaxter/Regions.py | 114 +++++++------ worlds/jakanddaxter/Rules.py | 189 ++++++++++----------- worlds/jakanddaxter/__init__.py | 15 +- worlds/jakanddaxter/locs/ScoutLocations.py | 112 ++++++++++++ 8 files changed, 299 insertions(+), 160 deletions(-) diff --git a/worlds/jakanddaxter/GameID.py b/worlds/jakanddaxter/GameID.py index f88a02a30a..63e1bb1002 100644 --- a/worlds/jakanddaxter/GameID.py +++ b/worlds/jakanddaxter/GameID.py @@ -1 +1,2 @@ -game_id = 74680000 # All IDs will be offset by this number. \ No newline at end of file +# All Jak And Daxter IDs will be offset by this number. +game_id = 74680000 diff --git a/worlds/jakanddaxter/Items.py b/worlds/jakanddaxter/Items.py index d50810b77e..7904f54fa7 100644 --- a/worlds/jakanddaxter/Items.py +++ b/worlds/jakanddaxter/Items.py @@ -1,9 +1,11 @@ import typing from BaseClasses import Item + class JakAndDaxterItem(Item): game: str = "Jak and Daxter: The Precursor Legacy" + # Items Found Multiple Times generic_item_table = { 0: "Power Cell", diff --git a/worlds/jakanddaxter/Locations.py b/worlds/jakanddaxter/Locations.py index ee21ce079e..adfb90ea1f 100644 --- a/worlds/jakanddaxter/Locations.py +++ b/worlds/jakanddaxter/Locations.py @@ -1,10 +1,12 @@ import typing from BaseClasses import Location -from .locs import CellLocations, SpecialLocations +from .locs import CellLocations, SpecialLocations, ScoutLocations + class JakAndDaxterLocation(Location): game: str = "Jak and Daxter: The Precursor Legacy" + # All Locations location_table = { **CellLocations.locGR_cellTable, @@ -23,5 +25,21 @@ location_table = { **CellLocations.locSM_cellTable, **CellLocations.locLT_cellTable, **CellLocations.locGMC_cellTable, - **SpecialLocations.loc_specialTable + **SpecialLocations.loc_specialTable, + **ScoutLocations.locGR_scoutTable, + **ScoutLocations.locSV_scoutTable, + **ScoutLocations.locFJ_scoutTable, + **ScoutLocations.locSB_scoutTable, + **ScoutLocations.locMI_scoutTable, + **ScoutLocations.locFC_scoutTable, + **ScoutLocations.locRV_scoutTable, + **ScoutLocations.locPB_scoutTable, + **ScoutLocations.locLPC_scoutTable, + **ScoutLocations.locBS_scoutTable, + **ScoutLocations.locMP_scoutTable, + **ScoutLocations.locVC_scoutTable, + **ScoutLocations.locSC_scoutTable, + **ScoutLocations.locSM_scoutTable, + **ScoutLocations.locLT_scoutTable, + **ScoutLocations.locGMC_scoutTable } diff --git a/worlds/jakanddaxter/Options.py b/worlds/jakanddaxter/Options.py index b33e73be40..9870f10049 100644 --- a/worlds/jakanddaxter/Options.py +++ b/worlds/jakanddaxter/Options.py @@ -2,10 +2,12 @@ import typing from dataclasses import dataclass from Options import DefaultOnToggle, Range, Toggle, DeathLink, Choice, PerGameCommonOptions, OptionSet + class EnableScoutFlies(Toggle): """Enable to include each Scout Fly as a check. Adds 213 checks to the pool.""" display_name = "Enable Scout Flies" + # class EnablePrecursorOrbs(Toggle): # """Enable to include each Precursor Orb as a check. Adds 2000 checks to the pool.""" # display_name = "Enable Precursor Orbs" diff --git a/worlds/jakanddaxter/Regions.py b/worlds/jakanddaxter/Regions.py index dda46d1b18..7f37f138c4 100644 --- a/worlds/jakanddaxter/Regions.py +++ b/worlds/jakanddaxter/Regions.py @@ -1,10 +1,11 @@ import typing from enum import Enum -from BaseClasses import MultiWorld, Region, Entrance, Location +from BaseClasses import MultiWorld, Region from .Options import JakAndDaxterOptions from .Locations import JakAndDaxterLocation, location_table from .locs import CellLocations, SpecialLocations + class JakAndDaxterLevel(int, Enum): GEYSER_ROCK = 0 SANDOVER_VILLAGE = 1 @@ -23,6 +24,7 @@ class JakAndDaxterLevel(int, Enum): LAVA_TUBE = 14 GOL_AND_MAIAS_CITADEL = 15 + class JakAndDaxterSubLevel(int, Enum): MAIN_AREA = 0 FORBIDDEN_JUNGLE_PLANT_ROOM = 1 @@ -33,6 +35,7 @@ class JakAndDaxterSubLevel(int, Enum): SNOWY_MOUNTAIN_LURKER_FORT = 6 GOL_AND_MAIAS_CITADEL_ROTATING_TOWER = 7 + level_table: typing.Dict[JakAndDaxterLevel, str] = { JakAndDaxterLevel.GEYSER_ROCK: "Geyser Rock", JakAndDaxterLevel.SANDOVER_VILLAGE: "Sandover Village", @@ -63,95 +66,98 @@ subLevel_table: typing.Dict[JakAndDaxterSubLevel, str] = { JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER: "Gol and Maia's Citadel Rotating Tower" } + class JakAndDaxterRegion(Region): game: str = "Jak and Daxter: The Precursor Legacy" + def create_regions(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int): - regionMenu = create_region(player, multiworld, "Menu") + region_menu = create_region(player, multiworld, "Menu") - regionGR = create_region(player, multiworld, level_table[JakAndDaxterLevel.GEYSER_ROCK]) - create_locations(regionGR, CellLocations.locGR_cellTable) + region_gr = create_region(player, multiworld, level_table[JakAndDaxterLevel.GEYSER_ROCK]) + create_locations(region_gr, CellLocations.locGR_cellTable) - regionSV = create_region(player, multiworld, level_table[JakAndDaxterLevel.SANDOVER_VILLAGE]) - create_locations(regionSV, CellLocations.locSV_cellTable) + region_sv = create_region(player, multiworld, level_table[JakAndDaxterLevel.SANDOVER_VILLAGE]) + create_locations(region_sv, CellLocations.locSV_cellTable) - regionFJ = create_region(player, multiworld, level_table[JakAndDaxterLevel.FORBIDDEN_JUNGLE]) - create_locations(regionFJ, { + region_fj = create_region(player, multiworld, level_table[JakAndDaxterLevel.FORBIDDEN_JUNGLE]) + create_locations(region_fj, { **{k: CellLocations.locFJ_cellTable[k] for k in {10, 11, 12, 14, 15, 16, 17}}, **{k: SpecialLocations.loc_specialTable[k] for k in {2213, 2216}} - }) + }) - subRegionFJPR = create_subregion(regionFJ, subLevel_table[JakAndDaxterSubLevel.FORBIDDEN_JUNGLE_PLANT_ROOM]) - create_locations(subRegionFJPR, {k: CellLocations.locFJ_cellTable[k] for k in {13}}) + sub_region_fjpr = create_subregion(region_fj, subLevel_table[JakAndDaxterSubLevel.FORBIDDEN_JUNGLE_PLANT_ROOM]) + create_locations(sub_region_fjpr, {k: CellLocations.locFJ_cellTable[k] for k in {13}}) - regionSB = create_region(player, multiworld, level_table[JakAndDaxterLevel.SENTINEL_BEACH]) - create_locations(regionSB, { + region_sb = create_region(player, multiworld, level_table[JakAndDaxterLevel.SENTINEL_BEACH]) + create_locations(region_sb, { **{k: CellLocations.locSB_cellTable[k] for k in {18, 19, 20, 21, 23, 24, 25}}, **{k: SpecialLocations.loc_specialTable[k] for k in {2215}} - }) + }) - subRegionSBCT = create_subregion(regionSB, subLevel_table[JakAndDaxterSubLevel.SENTINEL_BEACH_CANNON_TOWER]) - create_locations(subRegionSBCT, {k: CellLocations.locSB_cellTable[k] for k in {22}}) + sub_region_sbct = create_subregion(region_sb, subLevel_table[JakAndDaxterSubLevel.SENTINEL_BEACH_CANNON_TOWER]) + create_locations(sub_region_sbct, {k: CellLocations.locSB_cellTable[k] for k in {22}}) - regionMI = create_region(player, multiworld, level_table[JakAndDaxterLevel.MISTY_ISLAND]) - create_locations(regionMI, CellLocations.locMI_cellTable) + region_mi = create_region(player, multiworld, level_table[JakAndDaxterLevel.MISTY_ISLAND]) + create_locations(region_mi, CellLocations.locMI_cellTable) - regionFC = create_region(player, multiworld, level_table[JakAndDaxterLevel.FIRE_CANYON]) - create_locations(regionFC, CellLocations.locFC_cellTable) + region_fc = create_region(player, multiworld, level_table[JakAndDaxterLevel.FIRE_CANYON]) + create_locations(region_fc, CellLocations.locFC_cellTable) - regionRV = create_region(player, multiworld, level_table[JakAndDaxterLevel.ROCK_VILLAGE]) - create_locations(regionRV, { + region_rv = create_region(player, multiworld, level_table[JakAndDaxterLevel.ROCK_VILLAGE]) + create_locations(region_rv, { **CellLocations.locRV_cellTable, **{k: SpecialLocations.loc_specialTable[k] for k in {2217}} - }) + }) - regionPB = create_region(player, multiworld, level_table[JakAndDaxterLevel.PRECURSOR_BASIN]) - create_locations(regionPB, CellLocations.locPB_cellTable) + region_pb = create_region(player, multiworld, level_table[JakAndDaxterLevel.PRECURSOR_BASIN]) + create_locations(region_pb, CellLocations.locPB_cellTable) - regionLPC = create_region(player, multiworld, level_table[JakAndDaxterLevel.LOST_PRECURSOR_CITY]) - create_locations(regionLPC, CellLocations.locLPC_cellTable) + region_lpc = create_region(player, multiworld, level_table[JakAndDaxterLevel.LOST_PRECURSOR_CITY]) + create_locations(region_lpc, CellLocations.locLPC_cellTable) - regionBS = create_region(player, multiworld, level_table[JakAndDaxterLevel.BOGGY_SWAMP]) - create_locations(regionBS, {k: CellLocations.locBS_cellTable[k] for k in {59, 60, 61, 62, 63, 64}}) + region_bs = create_region(player, multiworld, level_table[JakAndDaxterLevel.BOGGY_SWAMP]) + create_locations(region_bs, {k: CellLocations.locBS_cellTable[k] for k in {59, 60, 61, 62, 63, 64}}) - subRegionBSFF = create_subregion(regionBS, subLevel_table[JakAndDaxterSubLevel.BOGGY_SWAMP_FLUT_FLUT]) - create_locations(subRegionBSFF, {k: CellLocations.locBS_cellTable[k] for k in {58, 65}}) + sub_region_bsff = create_subregion(region_bs, subLevel_table[JakAndDaxterSubLevel.BOGGY_SWAMP_FLUT_FLUT]) + create_locations(sub_region_bsff, {k: CellLocations.locBS_cellTable[k] for k in {58, 65}}) - regionMP = create_region(player, multiworld, level_table[JakAndDaxterLevel.MOUNTAIN_PASS]) - create_locations(regionMP, {k: CellLocations.locMP_cellTable[k] for k in {66, 67, 69}}) + region_mp = create_region(player, multiworld, level_table[JakAndDaxterLevel.MOUNTAIN_PASS]) + create_locations(region_mp, {k: CellLocations.locMP_cellTable[k] for k in {66, 67, 69}}) - subRegionMPS = create_subregion(regionMP, subLevel_table[JakAndDaxterSubLevel.MOUNTAIN_PASS_SHORTCUT]) - create_locations(subRegionMPS, {k: CellLocations.locMP_cellTable[k] for k in {68}}) + sub_region_mps = create_subregion(region_mp, subLevel_table[JakAndDaxterSubLevel.MOUNTAIN_PASS_SHORTCUT]) + create_locations(sub_region_mps, {k: CellLocations.locMP_cellTable[k] for k in {68}}) - regionVC = create_region(player, multiworld, level_table[JakAndDaxterLevel.VOLCANIC_CRATER]) - create_locations(regionVC, CellLocations.locVC_cellTable) + region_vc = create_region(player, multiworld, level_table[JakAndDaxterLevel.VOLCANIC_CRATER]) + create_locations(region_vc, CellLocations.locVC_cellTable) - regionSC = create_region(player, multiworld, level_table[JakAndDaxterLevel.SPIDER_CAVE]) - create_locations(regionSC, CellLocations.locSC_cellTable) + region_sc = create_region(player, multiworld, level_table[JakAndDaxterLevel.SPIDER_CAVE]) + create_locations(region_sc, CellLocations.locSC_cellTable) - regionSM = create_region(player, multiworld, level_table[JakAndDaxterLevel.SNOWY_MOUNTAIN]) - create_locations(regionSM, { + region_sm = create_region(player, multiworld, level_table[JakAndDaxterLevel.SNOWY_MOUNTAIN]) + create_locations(region_sm, { **{k: CellLocations.locSM_cellTable[k] for k in {86, 87, 88, 89, 92}}, **{k: SpecialLocations.loc_specialTable[k] for k in {2218}} - }) + }) - subRegionSMFF = create_subregion(regionSM, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_FLUT_FLUT]) - create_locations(subRegionSMFF, { + sub_region_smff = create_subregion(region_sm, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_FLUT_FLUT]) + create_locations(sub_region_smff, { **{k: CellLocations.locSM_cellTable[k] for k in {90}}, **{k: SpecialLocations.loc_specialTable[k] for k in {2219}} - }) + }) - subRegionSMLF = create_subregion(regionSM, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_LURKER_FORT]) - create_locations(subRegionSMLF, {k: CellLocations.locSM_cellTable[k] for k in {91, 93}}) + sub_region_smlf = create_subregion(region_sm, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_LURKER_FORT]) + create_locations(sub_region_smlf, {k: CellLocations.locSM_cellTable[k] for k in {91, 93}}) - regionLT = create_region(player, multiworld, level_table[JakAndDaxterLevel.LAVA_TUBE]) - create_locations(regionLT, CellLocations.locLT_cellTable) + region_lt = create_region(player, multiworld, level_table[JakAndDaxterLevel.LAVA_TUBE]) + create_locations(region_lt, CellLocations.locLT_cellTable) - regionGMC = create_region(player, multiworld, level_table[JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL]) - create_locations(regionGMC, {k: CellLocations.locGMC_cellTable[k] for k in {96, 97, 98}}) + region_gmc = create_region(player, multiworld, level_table[JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL]) + create_locations(region_gmc, {k: CellLocations.locGMC_cellTable[k] for k in {96, 97, 98}}) + + sub_region_gmcrt = create_subregion(region_gmc, subLevel_table[JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER]) + create_locations(sub_region_gmcrt, {k: CellLocations.locGMC_cellTable[k] for k in {99, 100}}) - subRegionGMCRT = create_subregion(regionGMC, subLevel_table[JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER]) - create_locations(subRegionGMCRT, {k: CellLocations.locGMC_cellTable[k] for k in {99, 100}}) def create_region(player: int, multiworld: MultiWorld, name: str) -> JakAndDaxterRegion: region = JakAndDaxterRegion(name, player, multiworld) @@ -159,11 +165,13 @@ def create_region(player: int, multiworld: MultiWorld, name: str) -> JakAndDaxte multiworld.regions.append(region) return region + def create_subregion(parent: Region, name: str) -> JakAndDaxterRegion: region = JakAndDaxterRegion(name, parent.player, parent.multiworld) parent.multiworld.regions.append(region) return region + def create_locations(region: Region, locs: typing.Dict[int, str]): region.locations += [JakAndDaxterLocation(region.player, location_table[loc], loc, region) for loc in locs] diff --git a/worlds/jakanddaxter/Rules.py b/worlds/jakanddaxter/Rules.py index be9c16cd61..8215e4d5d5 100644 --- a/worlds/jakanddaxter/Rules.py +++ b/worlds/jakanddaxter/Rules.py @@ -1,128 +1,125 @@ import typing from BaseClasses import MultiWorld from .Options import JakAndDaxterOptions -from .Locations import JakAndDaxterLocation, location_table from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, JakAndDaxterRegion, level_table, subLevel_table from .Items import item_table + def set_rules(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int): - - menuRegion = multiworld.get_region("Menu", player) - grRegion = multiworld.get_region(level_table[JakAndDaxterLevel.GEYSER_ROCK], player) - menuRegion.connect(grRegion) + region_menu = multiworld.get_region("Menu", player) + region_gr = multiworld.get_region(level_table[JakAndDaxterLevel.GEYSER_ROCK], player) + region_menu.connect(region_gr) connect_regions(multiworld, player, - JakAndDaxterLevel.GEYSER_ROCK, - JakAndDaxterLevel.SANDOVER_VILLAGE, - lambda state: state.has(item_table[0], player, 4)) + JakAndDaxterLevel.GEYSER_ROCK, + JakAndDaxterLevel.SANDOVER_VILLAGE, + lambda state: state.has(item_table[0], player, 4)) connect_regions(multiworld, player, - JakAndDaxterLevel.SANDOVER_VILLAGE, - JakAndDaxterLevel.FORBIDDEN_JUNGLE) + JakAndDaxterLevel.SANDOVER_VILLAGE, + JakAndDaxterLevel.FORBIDDEN_JUNGLE) connect_subregions(multiworld, player, - JakAndDaxterLevel.FORBIDDEN_JUNGLE, - JakAndDaxterSubLevel.FORBIDDEN_JUNGLE_PLANT_ROOM, - lambda state: state.has(item_table[2216], player)) + JakAndDaxterLevel.FORBIDDEN_JUNGLE, + JakAndDaxterSubLevel.FORBIDDEN_JUNGLE_PLANT_ROOM, + lambda state: state.has(item_table[2216], player)) connect_regions(multiworld, player, - JakAndDaxterLevel.SANDOVER_VILLAGE, - JakAndDaxterLevel.SENTINEL_BEACH) - - connect_subregions(multiworld, player, - JakAndDaxterLevel.SENTINEL_BEACH, - JakAndDaxterSubLevel.SENTINEL_BEACH_CANNON_TOWER, - lambda state: state.has(item_table[2216], player)) - - connect_regions(multiworld, player, - JakAndDaxterLevel.SANDOVER_VILLAGE, - JakAndDaxterLevel.MISTY_ISLAND, - lambda state: state.has(item_table[2213], player)) - - connect_regions(multiworld, player, - JakAndDaxterLevel.SANDOVER_VILLAGE, - JakAndDaxterLevel.FIRE_CANYON, - lambda state: state.has(item_table[0], player, 20)) - - connect_regions(multiworld, player, - JakAndDaxterLevel.FIRE_CANYON, - JakAndDaxterLevel.ROCK_VILLAGE) - - connect_regions(multiworld, player, - JakAndDaxterLevel.ROCK_VILLAGE, - JakAndDaxterLevel.PRECURSOR_BASIN) - - connect_regions(multiworld, player, - JakAndDaxterLevel.ROCK_VILLAGE, - JakAndDaxterLevel.LOST_PRECURSOR_CITY) - - connect_regions(multiworld, player, - JakAndDaxterLevel.ROCK_VILLAGE, - JakAndDaxterLevel.BOGGY_SWAMP, - lambda state: state.has(item_table[2217], player)) - - connect_subregions(multiworld, player, - JakAndDaxterLevel.BOGGY_SWAMP, - JakAndDaxterSubLevel.BOGGY_SWAMP_FLUT_FLUT, - lambda state: state.has(item_table[2215], player)) - - connect_regions(multiworld, player, - JakAndDaxterLevel.ROCK_VILLAGE, - JakAndDaxterLevel.MOUNTAIN_PASS, - lambda state: state.has(item_table[2217], player) and state.has(item_table[0], player, 45)) + JakAndDaxterLevel.SANDOVER_VILLAGE, + JakAndDaxterLevel.SENTINEL_BEACH) connect_subregions(multiworld, player, - JakAndDaxterLevel.MOUNTAIN_PASS, - JakAndDaxterSubLevel.MOUNTAIN_PASS_SHORTCUT, - lambda state: state.has(item_table[2218], player)) + JakAndDaxterLevel.SENTINEL_BEACH, + JakAndDaxterSubLevel.SENTINEL_BEACH_CANNON_TOWER, + lambda state: state.has(item_table[2216], player)) connect_regions(multiworld, player, - JakAndDaxterLevel.MOUNTAIN_PASS, - JakAndDaxterLevel.VOLCANIC_CRATER) + JakAndDaxterLevel.SANDOVER_VILLAGE, + JakAndDaxterLevel.MISTY_ISLAND, + lambda state: state.has(item_table[2213], player)) connect_regions(multiworld, player, - JakAndDaxterLevel.VOLCANIC_CRATER, - JakAndDaxterLevel.SPIDER_CAVE) + JakAndDaxterLevel.SANDOVER_VILLAGE, + JakAndDaxterLevel.FIRE_CANYON, + lambda state: state.has(item_table[0], player, 20)) connect_regions(multiworld, player, - JakAndDaxterLevel.VOLCANIC_CRATER, - JakAndDaxterLevel.SNOWY_MOUNTAIN) + JakAndDaxterLevel.FIRE_CANYON, + JakAndDaxterLevel.ROCK_VILLAGE) + + connect_regions(multiworld, player, + JakAndDaxterLevel.ROCK_VILLAGE, + JakAndDaxterLevel.PRECURSOR_BASIN) + + connect_regions(multiworld, player, + JakAndDaxterLevel.ROCK_VILLAGE, + JakAndDaxterLevel.LOST_PRECURSOR_CITY) + + connect_regions(multiworld, player, + JakAndDaxterLevel.ROCK_VILLAGE, + JakAndDaxterLevel.BOGGY_SWAMP, + lambda state: state.has(item_table[2217], player)) connect_subregions(multiworld, player, - JakAndDaxterLevel.SNOWY_MOUNTAIN, - JakAndDaxterSubLevel.SNOWY_MOUNTAIN_FLUT_FLUT, - lambda state: state.has(item_table[2215], player)) - - connect_subregions(multiworld, player, - JakAndDaxterLevel.SNOWY_MOUNTAIN, - JakAndDaxterSubLevel.SNOWY_MOUNTAIN_LURKER_FORT, - lambda state: state.has(item_table[2219], player)) + JakAndDaxterLevel.BOGGY_SWAMP, + JakAndDaxterSubLevel.BOGGY_SWAMP_FLUT_FLUT, + lambda state: state.has(item_table[2215], player)) connect_regions(multiworld, player, - JakAndDaxterLevel.VOLCANIC_CRATER, - JakAndDaxterLevel.LAVA_TUBE, - lambda state: state.has(item_table[0], player, 72)) - - connect_regions(multiworld, player, - JakAndDaxterLevel.LAVA_TUBE, - JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL) + JakAndDaxterLevel.ROCK_VILLAGE, + JakAndDaxterLevel.MOUNTAIN_PASS, + lambda state: state.has(item_table[2217], player) and state.has(item_table[0], player, 45)) connect_subregions(multiworld, player, - JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL, - JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER, - # lambda state: state.has(item_table[96], player) and state.has(item_table[97], player) and state.has(item_table[98], player)) - lambda state: state.has(item_table[0], player, 75)) + JakAndDaxterLevel.MOUNTAIN_PASS, + JakAndDaxterSubLevel.MOUNTAIN_PASS_SHORTCUT, + lambda state: state.has(item_table[2218], player)) -def connect_regions(multiworld: MultiWorld, player: int, source: int, target: int, rule = None): - sourceRegion = multiworld.get_region(level_table[source], player) - targetRegion = multiworld.get_region(level_table[target], player) - sourceRegion.connect(targetRegion, rule = rule) + connect_regions(multiworld, player, + JakAndDaxterLevel.MOUNTAIN_PASS, + JakAndDaxterLevel.VOLCANIC_CRATER) -def connect_subregions(multiworld: MultiWorld, player: int, source: int, target: int, rule = None): - sourceRegion = multiworld.get_region(level_table[source], player) - targetRegion = multiworld.get_region(subLevel_table[target], player) - sourceRegion.connect(targetRegion, rule = rule) + connect_regions(multiworld, player, + JakAndDaxterLevel.VOLCANIC_CRATER, + JakAndDaxterLevel.SPIDER_CAVE) -def assign_subregion_access_rule(multiworld: MultiWorld, player: int, target: int, rule = None): - targetEntrance = multiworld.get_entrance(subLevel_table[target], player) - targetEntrance.access_rule = rule + connect_regions(multiworld, player, + JakAndDaxterLevel.VOLCANIC_CRATER, + JakAndDaxterLevel.SNOWY_MOUNTAIN) + + connect_subregions(multiworld, player, + JakAndDaxterLevel.SNOWY_MOUNTAIN, + JakAndDaxterSubLevel.SNOWY_MOUNTAIN_FLUT_FLUT, + lambda state: state.has(item_table[2215], player)) + + connect_subregions(multiworld, player, + JakAndDaxterLevel.SNOWY_MOUNTAIN, + JakAndDaxterSubLevel.SNOWY_MOUNTAIN_LURKER_FORT, + lambda state: state.has(item_table[2219], player)) + + connect_regions(multiworld, player, + JakAndDaxterLevel.VOLCANIC_CRATER, + JakAndDaxterLevel.LAVA_TUBE, + lambda state: state.has(item_table[0], player, 72)) + + connect_regions(multiworld, player, + JakAndDaxterLevel.LAVA_TUBE, + JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL) + + connect_subregions(multiworld, player, + JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL, + JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER, + # lambda state: state.has(item_table[96], player) and state.has(item_table[97], player) and state.has(item_table[98], player)) + lambda state: state.has(item_table[0], player, 75)) + + +def connect_regions(multiworld: MultiWorld, player: int, source: JakAndDaxterLevel, target: JakAndDaxterLevel, rule=None): + source_region = multiworld.get_region(level_table[source], player) + target_region = multiworld.get_region(level_table[target], player) + source_region.connect(target_region, rule=rule) + + +def connect_subregions(multiworld: MultiWorld, player: int, source: JakAndDaxterLevel, target: JakAndDaxterSubLevel, rule=None): + source_region = multiworld.get_region(level_table[source], player) + target_region = multiworld.get_region(subLevel_table[target], player) + source_region.connect(target_region, rule=rule) diff --git a/worlds/jakanddaxter/__init__.py b/worlds/jakanddaxter/__init__.py index ecbcbd2fa0..3b99456336 100644 --- a/worlds/jakanddaxter/__init__.py +++ b/worlds/jakanddaxter/__init__.py @@ -1,5 +1,4 @@ -import typing, os, json -from BaseClasses import Item, ItemClassification, Region, Entrance, Location +from BaseClasses import Item, ItemClassification from .Locations import JakAndDaxterLocation, location_table from .Options import JakAndDaxterOptions from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, JakAndDaxterRegion, level_table, subLevel_table, create_regions @@ -8,7 +7,6 @@ from .Items import JakAndDaxterItem, item_table, generic_item_table, special_ite from .GameID import game_id from ..AutoWorld import World -from Utils import visualize_regions class JakAndDaxterWorld(World): game: str = "Jak and Daxter: The Precursor Legacy" @@ -26,13 +24,14 @@ class JakAndDaxterWorld(World): def set_rules(self): set_rules(self.multiworld, self.options, self.player) - def create_item(self, name: str, item_id: int) -> Item: + def create_item(self, name: str) -> Item: + item_id = self.item_name_to_id[name] if "Power Cell" in name: classification = ItemClassification.progression_skip_balancing elif "Scout Fly" in name: classification = ItemClassification.progression_skip_balancing elif "Precursor Orb" in name: - classification = ItemClassification.filler # TODO + classification = ItemClassification.filler # TODO else: classification = ItemClassification.progression @@ -40,6 +39,6 @@ class JakAndDaxterWorld(World): return item def create_items(self): - self.multiworld.itempool += [self.create_item("Power Cell", game_id + k) for k in range(0, 101)] - # self.multiworld.itempool += [self.create_item(item_table[101]) for k in range(101, 212)] - self.multiworld.itempool += [self.create_item(item_table[k], game_id + k) for k in special_item_table] + self.multiworld.itempool += [self.create_item("Power Cell") for _ in range(0, 101)] + self.multiworld.itempool += [self.create_item("Scout Fly") for _ in range(101, 213)] + self.multiworld.itempool += [self.create_item(item_table[k]) for k in special_item_table] diff --git a/worlds/jakanddaxter/locs/ScoutLocations.py b/worlds/jakanddaxter/locs/ScoutLocations.py index fd1fe2f6dc..c4620a503c 100644 --- a/worlds/jakanddaxter/locs/ScoutLocations.py +++ b/worlds/jakanddaxter/locs/ScoutLocations.py @@ -2,64 +2,176 @@ # Geyser Rock locGR_scoutTable = { + 101: "GR: Scout Fly 1", + 102: "GR: Scout Fly 2", + 103: "GR: Scout Fly 3", + 104: "GR: Scout Fly 4", + 105: "GR: Scout Fly 5", + 106: "GR: Scout Fly 6", + 107: "GR: Scout Fly 7" } # Sandover Village locSV_scoutTable = { + 108: "SV: Scout Fly 1", + 109: "SV: Scout Fly 2", + 110: "SV: Scout Fly 3", + 111: "SV: Scout Fly 4", + 112: "SV: Scout Fly 5", + 113: "SV: Scout Fly 6", + 114: "SV: Scout Fly 7" } # Forbidden Jungle locFJ_scoutTable = { + 115: "FJ: Scout Fly 1", + 116: "FJ: Scout Fly 2", + 117: "FJ: Scout Fly 3", + 118: "FJ: Scout Fly 4", + 119: "FJ: Scout Fly 5", + 120: "FJ: Scout Fly 6", + 121: "FJ: Scout Fly 7" } # Sentinel Beach locSB_scoutTable = { + 122: "SB: Scout Fly 1", + 123: "SB: Scout Fly 2", + 124: "SB: Scout Fly 3", + 125: "SB: Scout Fly 4", + 126: "SB: Scout Fly 5", + 127: "SB: Scout Fly 6", + 128: "SB: Scout Fly 7" } # Misty Island locMI_scoutTable = { + 129: "MI: Scout Fly 1", + 130: "MI: Scout Fly 2", + 131: "MI: Scout Fly 3", + 132: "MI: Scout Fly 4", + 133: "MI: Scout Fly 5", + 134: "MI: Scout Fly 6", + 135: "MI: Scout Fly 7" } # Fire Canyon locFC_scoutTable = { + 136: "FC: Scout Fly 1", + 137: "FC: Scout Fly 2", + 138: "FC: Scout Fly 3", + 139: "FC: Scout Fly 4", + 140: "FC: Scout Fly 5", + 141: "FC: Scout Fly 6", + 142: "FC: Scout Fly 7" } # Rock Village locRV_scoutTable = { + 143: "RV: Scout Fly 1", + 144: "RV: Scout Fly 2", + 145: "RV: Scout Fly 3", + 146: "RV: Scout Fly 4", + 147: "RV: Scout Fly 5", + 148: "RV: Scout Fly 6", + 149: "RV: Scout Fly 7" } # Precursor Basin locPB_scoutTable = { + 150: "PB: Scout Fly 1", + 151: "PB: Scout Fly 2", + 152: "PB: Scout Fly 3", + 153: "PB: Scout Fly 4", + 154: "PB: Scout Fly 5", + 155: "PB: Scout Fly 6", + 156: "PB: Scout Fly 7" } # Lost Precursor City locLPC_scoutTable = { + 157: "LPC: Scout Fly 1", + 158: "LPC: Scout Fly 2", + 159: "LPC: Scout Fly 3", + 160: "LPC: Scout Fly 4", + 161: "LPC: Scout Fly 5", + 162: "LPC: Scout Fly 6", + 163: "LPC: Scout Fly 7" } # Boggy Swamp locBS_scoutTable = { + 164: "BS: Scout Fly 1", + 165: "BS: Scout Fly 2", + 166: "BS: Scout Fly 3", + 167: "BS: Scout Fly 4", + 168: "BS: Scout Fly 5", + 169: "BS: Scout Fly 6", + 170: "BS: Scout Fly 7" } # Mountain Pass locMP_scoutTable = { + 171: "MP: Scout Fly 1", + 172: "MP: Scout Fly 2", + 173: "MP: Scout Fly 3", + 174: "MP: Scout Fly 4", + 175: "MP: Scout Fly 5", + 176: "MP: Scout Fly 6", + 177: "MP: Scout Fly 7" } # Volcanic Crater locVC_scoutTable = { + 178: "VC: Scout Fly 1", + 179: "VC: Scout Fly 2", + 180: "VC: Scout Fly 3", + 181: "VC: Scout Fly 4", + 182: "VC: Scout Fly 5", + 183: "VC: Scout Fly 6", + 184: "VC: Scout Fly 7" } # Spider Cave locSC_scoutTable = { + 185: "SC: Scout Fly 1", + 186: "SC: Scout Fly 2", + 187: "SC: Scout Fly 3", + 188: "SC: Scout Fly 4", + 189: "SC: Scout Fly 5", + 190: "SC: Scout Fly 6", + 191: "SC: Scout Fly 7" } # Snowy Mountain locSM_scoutTable = { + 192: "SM: Scout Fly 1", + 193: "SM: Scout Fly 2", + 194: "SM: Scout Fly 3", + 195: "SM: Scout Fly 4", + 196: "SM: Scout Fly 5", + 197: "SM: Scout Fly 6", + 198: "SM: Scout Fly 7" } # Lava Tube locLT_scoutTable = { + 199: "LT: Scout Fly 1", + 200: "LT: Scout Fly 2", + 201: "LT: Scout Fly 3", + 202: "LT: Scout Fly 4", + 203: "LT: Scout Fly 5", + 204: "LT: Scout Fly 6", + 205: "LT: Scout Fly 7" } # Gol and Maias Citadel locGMC_scoutTable = { + 206: "GMC: Scout Fly 1", + 207: "GMC: Scout Fly 2", + 208: "GMC: Scout Fly 3", + 209: "GMC: Scout Fly 4", + 210: "GMC: Scout Fly 5", + 211: "GMC: Scout Fly 6", + 212: "GMC: Scout Fly 7" }