Jak 1: Fixed mistakes, need better understanding of Entrances.

This commit is contained in:
massimilianodelliubaldini
2024-04-15 00:36:17 -04:00
parent bff2d4a80b
commit ab4a5e9f75
5 changed files with 73 additions and 62 deletions

View File

@@ -1,26 +1,26 @@
import typing
from BaseClasses import Location
import locs.CellLocations
from .locs import CellLocations
class JakAndDaxterLocation(Location):
game: str = "Jak and Daxter: The Precursor Legacy"
# All Locations
location_table = {
**locGR_cellTable, \
**locSV_cellTable, \
**locFJ_cellTable, \
**locSB_cellTable, \
**locMI_cellTable, \
**locFC_cellTable, \
**locRV_cellTable, \
**locPB_cellTable, \
**locLPC_cellTable, \
**locBS_cellTable, \
**locMP_cellTable, \
**locVC_cellTable, \
**locSC_cellTable, \
**locSM_cellTable, \
**locLT_cellTable, \
**locGMC_cellTable
**CellLocations.locGR_cellTable, \
**CellLocations.locSV_cellTable, \
**CellLocations.locFJ_cellTable, \
**CellLocations.locSB_cellTable, \
**CellLocations.locMI_cellTable, \
**CellLocations.locFC_cellTable, \
**CellLocations.locRV_cellTable, \
**CellLocations.locPB_cellTable, \
**CellLocations.locLPC_cellTable, \
**CellLocations.locBS_cellTable, \
**CellLocations.locMP_cellTable, \
**CellLocations.locVC_cellTable, \
**CellLocations.locSC_cellTable, \
**CellLocations.locSM_cellTable, \
**CellLocations.locLT_cellTable, \
**CellLocations.locGMC_cellTable
}

View File

@@ -1,7 +1,6 @@
import typing
from dataclasses import dataclass
from Options import DefaultOnToggle, Range, Toggle, DeathLink, Choice, PerGameCommonOptions, OptionSet
from .Items import action_item_table
class EnableScoutFlies(Toggle):
"""Enable to include each Scout Fly as a check. Adds 213 checks to the pool."""

View File

@@ -1,8 +1,9 @@
import typing
from enum import Enum
from BaseClasses import MultiWorld, Region, Entrance, Location
from .Options import JakAndDaxterOptions
from .Locations import JakAndDaxterLocation, location_table
import locs.CellLocations
from .locs import CellLocations
class JakAndDaxterLevel(int, Enum):
GEYSER_ROCK = 0
@@ -66,76 +67,76 @@ class JakAndDaxterRegion(Region):
game: str = "Jak and Daxter: The Precursor Legacy"
def create_regions(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int):
regionMenu = Region("Menu", player, multiworld)
regionMenu = create_region(player, multiworld, "Menu")
regionGR = create_region(player, multiworld, level_table[JakAndDaxterLevel.GEYSER_ROCK])
create_locations(regionGR, locGR_cellTable)
create_locations(regionGR, CellLocations.locGR_cellTable)
regionSV = create_region(player, multiworld, level_table[JakAndDaxterLevel.SANDOVER_VILLAGE])
create_locations(regionSV, locSV_cellTable)
create_locations(regionSV, CellLocations.locSV_cellTable)
regionFJ = create_region(player, multiworld, level_table[JakAndDaxterLevel.FORBIDDEN_JUNGLE])
create_locations(regionFJ, {k: locFJ_cellTable[k] for k in {10, 11, 12, 14, 15, 16, 17}})
create_locations(regionFJ, {k: CellLocations.locFJ_cellTable[k] for k in {10, 11, 12, 14, 15, 16, 17}})
subRegionFJPR = create_subregion(regionFJ, subLevel_table[JakAndDaxterSubLevel.FORBIDDEN_JUNGLE_PLANT_ROOM])
create_locations(subRegionFJPR, {k: locFJ_cellTable[k] for k in {13}})
create_locations(subRegionFJPR, {k: CellLocations.locFJ_cellTable[k] for k in {13}})
regionSB = create_region(player, multiworld, level_table[JakAndDaxterLevel.SENTINEL_BEACH])
create_locations(regionSB, {k: locSB_cellTable[k] for k in {18, 19, 20, 21, 23, 24, 25}})
create_locations(regionSB, {k: CellLocations.locSB_cellTable[k] for k in {18, 19, 20, 21, 23, 24, 25}})
subRegionSBCT = create_subregion(regionSB, subLevel_table[JakAndDaxterSubLevel.SENTINEL_BEACH_CANNON_TOWER])
create_locations(subRegionSBCT, {k: locSB_cellTable[k] for k in {22}})
create_locations(subRegionSBCT, {k: CellLocations.locSB_cellTable[k] for k in {22}})
regionMI = create_region(player, multiworld, level_table[JakAndDaxterLevel.MISTY_ISLAND])
create_locations(regionMI, locMI_cellTable)
create_locations(regionMI, CellLocations.locMI_cellTable)
regionFC = create_region(player, multiworld, level_table[JakAndDaxterLevel.FIRE_CANYON])
create_locations(regionFC, locFC_cellTable)
create_locations(regionFC, CellLocations.locFC_cellTable)
regionRV = create_region(player, multiworld, level_table[JakAndDaxterLevel.ROCK_VILLAGE])
create_locations(regionRV, locRV_cellTable)
create_locations(regionRV, CellLocations.locRV_cellTable)
regionPB = create_region(player, multiworld, level_table[JakAndDaxterLevel.PRECURSOR_BASIN])
create_locations(regionPB, locPB_cellTable)
create_locations(regionPB, CellLocations.locPB_cellTable)
regionLPC = create_region(player, multiworld, level_table[JakAndDaxterLevel.LOST_PRECURSOR_CITY])
create_locations(regionLPC, locPB_cellTable)
create_locations(regionLPC, CellLocations.locLPC_cellTable)
regionBS = create_region(player, multiworld, level_table[JakAndDaxterLevel.BOGGY_SWAMP])
create_locations(regionBS, {k: locBS_cellTable[k] for k in {59, 60, 61, 62, 63, 64}})
create_locations(regionBS, {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: locBS_cellTable[k] for k in {58, 65}})
create_locations(subRegionBSFF, {k: CellLocations.locBS_cellTable[k] for k in {58, 65}})
regionMP = create_region(player, multiworld, level_table[JakAndDaxterLevel.MOUNTAIN_PASS])
create_locations(regionMP, {k: locMP_cellTable[k] for k in {66, 67, 69}})
create_locations(regionMP, {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: locMP_cellTable[k] for k in {68}})
create_locations(subRegionMPS, {k: CellLocations.locMP_cellTable[k] for k in {68}})
regionVC = create_region(player, multiworld, level_table[JakAndDaxterLevel.VOLCANIC_CRATER])
create_locations(regionVC, locVC_cellTable)
create_locations(regionVC, CellLocations.locVC_cellTable)
regionSC = create_region(player, multiworld, level_table[JakAndDaxterLevel.SPIDER_CAVE])
create_locations(regionSC, locSC_cellTable)
create_locations(regionSC, CellLocations.locSC_cellTable)
regionSM = create_region(player, multiworld, level_table[JakAndDaxterLevel.SNOWY_MOUNTAIN])
create_locations(regionSM, {k: locSM_cellTable[k] for k in {86, 87, 88, 89, 92}})
create_locations(regionSM, {k: CellLocations.locSM_cellTable[k] for k in {86, 87, 88, 89, 92}})
subRegionSMFF = create_subregion(regionSM, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_FLUT_FLUT])
create_locations(subRegionSMFF, {k: locSM_cellTable[k] for k in {90}})
create_locations(subRegionSMFF, {k: CellLocations.locSM_cellTable[k] for k in {90}})
subRegionSMLF = create_subregion(regionSM, subLevel_table[JakAndDaxterSubLevel.SNOWY_MOUNTAIN_LURKER_FORT])
create_locations(subRegionSMLF, {k: locSM_cellTable[k] for k in {91, 93}})
create_locations(subRegionSMLF, {k: CellLocations.locSM_cellTable[k] for k in {91, 93}})
regionLT = create_region(player, multiworld, level_table[JakAndDaxterLevel.LAVA_TUBE])
create_locations(regionLT, locLT_cellTable)
create_locations(regionLT, CellLocations.locLT_cellTable)
regionGMC = create_region(player, multiworld, level_table[JakAndDaxterLevel.GOL_AND_MAIAS_CITADEL])
create_locations(regionGMC, {k: locGMC_cellTable[k] for k in {96, 97, 98}})
create_locations(regionGMC, {k: CellLocations.locGMC_cellTable[k] for k in {96, 97, 98}})
subRegionGMCRT = create_subregion(regionSM, subLevel_table[JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER])
create_locations(subRegionGMCRT, {k: 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)
@@ -150,6 +151,10 @@ def create_subregion(parent: Region, name: str) -> JakAndDaxterRegion:
connection.connect(region)
parent.entrances.append(connection)
# connection = Entrance(parent.player, parent.name + " " + subLevel_table[JakAndDaxterSubLevel.MAIN_AREA], parent)
# connection.connect(parent)
# region.entrances.append(connection)
parent.multiworld.regions.append(region)
return region

View File

@@ -6,7 +6,10 @@ from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, JakAndDaxterRegion
from .Items import item_table
def set_rules(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int):
multiworld.get_region("Menu").connect(level_table[JakAndDaxterLevel.GEYSER_ROCK])
menuRegion = multiworld.get_region("Menu", player)
grRegion = multiworld.get_region(level_table[JakAndDaxterLevel.GEYSER_ROCK], player)
menuRegion.connect(grRegion)
connect_regions(multiworld, player,
JakAndDaxterLevel.GEYSER_ROCK,
@@ -63,7 +66,7 @@ def set_rules(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int)
connect_regions(multiworld, player,
JakAndDaxterLevel.ROCK_VILLAGE,
JakAndDaxterLevel.MOUNTAIN_PASS,
lambda state: state.has(item_table[2217], player) && state.has(item_table[0], player, 45))
lambda state: state.has(item_table[2217], player) and state.has(item_table[0], player, 45))
assign_subregion_access_rule(multiworld, player,
JakAndDaxterSubLevel.MOUNTAIN_PASS_SHORTCUT,
@@ -100,7 +103,7 @@ def set_rules(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int)
assign_subregion_access_rule(multiworld, player,
JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER,
lambda state: state.has(item_table[96], player) && state.has(item_table[97], player) && state.has(item_table[98], player))
lambda state: state.has(item_table[96], player) and state.has(item_table[97], player) and state.has(item_table[98], player))
def connect_regions(multiworld: MultiWorld, player: int, source: int, target: int, rule = None):
sourceRegion = multiworld.get_region(level_table[source], player)
@@ -108,5 +111,5 @@ def connect_regions(multiworld: MultiWorld, player: int, source: int, target: in
sourceRegion.connect(targetRegion, rule = rule)
def assign_subregion_access_rule(multiworld: MultiWorld, player: int, target: int, rule = None):
targetEntrance = multiworld.get_entrance(multiworld, player, subLevel_table[target])
targetEntrance = multiworld.get_entrance(subLevel_table[target], player)
targetEntrance.access_rule = rule

View File

@@ -1,18 +1,22 @@
import typing, os, json
from BaseClasses import Item, Region, Entrance, Location
from BaseClasses import Item, ItemClassification, Region, Entrance, Location
from .Locations import JakAndDaxterLocation, location_table
from .Options import JakAndDaxterOptions
from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, JakAndDaxterRegion, level_table, subLevel_table, create_regions
from .Rules import set_rules
from .Items import JakAndDaxterItem, item_table, generic_item_table, special_item_table
from ..AutoWorld import World
from Utils import visualize_regions
class JakAndDaxterWorld(World):
game: str = "Jak and Daxter: The Precursor Legacy"
game_id = 74680000 # All IDs will be offset by this number.
# Stored as {ID: Name} pairs, these must now be swapped to {Name: ID} pairs.
item_name_to_id = {item_table[k], game_id + k for k in item_table}
location_name_to_id = {location_table[k], game_id + k for k in location_table}
item_name_to_id = {item_table[k]: 74680000 + k for k in item_table}
location_name_to_id = {location_table[k]: 74680000 + k for k in location_table}
options_dataclass = JakAndDaxterOptions
@@ -21,20 +25,20 @@ class JakAndDaxterWorld(World):
def set_rules(self):
set_rules(self.multiworld, self.options, self.player)
visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml")
def create_item(self, name: str) -> Item:
item_id = item_name_to_id[name]
match name:
case "Power Cell":
classification = ItemClassification.progression_skip_balancing
case "Scout Fly":
classification = ItemClassification.progression_skip_balancing
case "Precursor Orb":
classification = ItemClassification.filler # TODO
case _:
classification = ItemClassification.progression
item_id = self.item_name_to_id[name]
if name == "Power Cell":
classification = ItemClassification.progression_skip_balancing
elif name == "Scout Fly":
classification = ItemClassification.progression_skip_balancing
elif name == "Precursor Orb":
classification = ItemClassification.filler # TODO
else:
classification = ItemClassification.progression
item = JakAndDaxterItem(name, classification, item_id, player)
item = JakAndDaxterItem(name, classification, item_id, self.player)
return item
def create_items(self):