Jak 1: Reduced code smell.

This commit is contained in:
massimilianodelliubaldini
2024-04-15 22:05:51 -04:00
parent 3b197bba3a
commit e1e8c04f85
7 changed files with 16 additions and 14 deletions

View File

@@ -1,4 +1,3 @@
import typing
from BaseClasses import Item

View File

@@ -1,4 +1,3 @@
import typing
from BaseClasses import Location
from .locs import CellLocations, SpecialLocations, ScoutLocations

View File

@@ -1,10 +1,9 @@
import typing
from dataclasses import dataclass
from Options import DefaultOnToggle, Range, Toggle, DeathLink, Choice, PerGameCommonOptions, OptionSet
from Options import Toggle, PerGameCommonOptions
class EnableScoutFlies(Toggle):
"""Enable to include each Scout Fly as a check. Adds 213 checks to the pool."""
"""Enable to include each Scout Fly as a check. Adds 112 checks to the pool."""
display_name = "Enable Scout Flies"

View File

@@ -72,7 +72,7 @@ class JakAndDaxterRegion(Region):
def create_regions(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int):
region_menu = create_region(player, multiworld, "Menu")
create_region(player, multiworld, "Menu")
region_gr = create_region(player, multiworld, level_table[JakAndDaxterLevel.GEYSER_ROCK])
create_locations(region_gr, {
@@ -201,7 +201,8 @@ def create_regions(multiworld: MultiWorld, options: JakAndDaxterOptions, player:
**{k: ScoutLocations.locGMC_scoutTable[k] for k in {206, 207, 208, 209, 210, 211}}
})
sub_region_gmcrt = create_subregion(region_gmc, subLevel_table[JakAndDaxterSubLevel.GOL_AND_MAIAS_CITADEL_ROTATING_TOWER])
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}},
**{k: ScoutLocations.locGMC_scoutTable[k] for k in {212}}

View File

@@ -1,7 +1,6 @@
import typing
from BaseClasses import MultiWorld
from .Options import JakAndDaxterOptions
from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, JakAndDaxterRegion, level_table, subLevel_table
from .Regions import JakAndDaxterLevel, JakAndDaxterSubLevel, level_table, subLevel_table
from .Items import item_table
@@ -109,17 +108,21 @@ def set_rules(multiworld: MultiWorld, options: JakAndDaxterOptions, player: int)
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[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):
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):
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)

View File

@@ -1,7 +1,8 @@
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
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 .GameID import game_id

View File

@@ -8,4 +8,4 @@ loc_specialTable = {
2217: "Gladiator's Pontoons",
2218: "Yellow Eco Switch",
2219: "Lurker Fort Gate"
}
}