DKC3: Long-overdue World code cleanup (#2820)

Co-authored-by: Silvris <58583688+Silvris@users.noreply.github.com>
This commit is contained in:
PoryGone 2024-02-27 22:53:13 -05:00 committed by GitHub
parent 59a6e4a1b5
commit 36cee91a2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 287 additions and 280 deletions

View File

@ -2,6 +2,7 @@ import typing
from BaseClasses import Location from BaseClasses import Location
from .Names import LocationName from .Names import LocationName
from worlds.AutoWorld import World
class DKC3Location(Location): class DKC3Location(Location):
@ -321,13 +322,13 @@ all_locations = {
location_table = {} location_table = {}
def setup_locations(world, player: int): def setup_locations(world: World):
location_table = {**level_location_table, **boss_location_table, **secret_cave_location_table} location_table = {**level_location_table, **boss_location_table, **secret_cave_location_table}
if False:#world.include_trade_sequence[player].value: if False:#world.options.include_trade_sequence:
location_table.update({**brothers_bear_location_table}) location_table.update({**brothers_bear_location_table})
if world.kongsanity[player].value: if world.options.kongsanity:
location_table.update({**kong_location_table}) location_table.update({**kong_location_table})
return location_table return location_table

View File

@ -1,6 +1,7 @@
from dataclasses import dataclass
import typing import typing
from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionList from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionList, PerGameCommonOptions
class Goal(Choice): class Goal(Choice):
@ -158,21 +159,21 @@ class StartingLifeCount(Range):
default = 5 default = 5
dkc3_options: typing.Dict[str, type(Option)] = { @dataclass
#"death_link": DeathLink, # Disabled class DKC3Options(PerGameCommonOptions):
"goal": Goal, #death_link: DeathLink # Disabled
#"include_trade_sequence": IncludeTradeSequence, # Disabled goal: Goal
"dk_coins_for_gyrocopter": DKCoinsForGyrocopter, #include_trade_sequence: IncludeTradeSequence # Disabled
"krematoa_bonus_coin_cost": KrematoaBonusCoinCost, dk_coins_for_gyrocopter: DKCoinsForGyrocopter
"percentage_of_extra_bonus_coins": PercentageOfExtraBonusCoins, krematoa_bonus_coin_cost: KrematoaBonusCoinCost
"number_of_banana_birds": NumberOfBananaBirds, percentage_of_extra_bonus_coins: PercentageOfExtraBonusCoins
"percentage_of_banana_birds": PercentageOfBananaBirds, number_of_banana_birds: NumberOfBananaBirds
"kongsanity": KONGsanity, percentage_of_banana_birds: PercentageOfBananaBirds
"level_shuffle": LevelShuffle, kongsanity: KONGsanity
"difficulty": Difficulty, level_shuffle: LevelShuffle
"autosave": Autosave, difficulty: Difficulty
"merry": MERRY, autosave: Autosave
"music_shuffle": MusicShuffle, merry: MERRY
"kong_palette_swap": KongPaletteSwap, music_shuffle: MusicShuffle
"starting_life_count": StartingLifeCount, kong_palette_swap: KongPaletteSwap
} starting_life_count: StartingLifeCount

View File

@ -4,38 +4,39 @@ from BaseClasses import MultiWorld, Region, Entrance
from .Items import DKC3Item from .Items import DKC3Item
from .Locations import DKC3Location from .Locations import DKC3Location
from .Names import LocationName, ItemName from .Names import LocationName, ItemName
from worlds.AutoWorld import World
def create_regions(world, player: int, active_locations): def create_regions(world: World, active_locations):
menu_region = create_region(world, player, active_locations, 'Menu', None) menu_region = create_region(world, active_locations, 'Menu', None)
overworld_1_region_locations = {} overworld_1_region_locations = {}
if world.goal[player] != "knautilus": if world.options.goal != "knautilus":
overworld_1_region_locations.update({LocationName.banana_bird_mother: []}) overworld_1_region_locations.update({LocationName.banana_bird_mother: []})
overworld_1_region = create_region(world, player, active_locations, LocationName.overworld_1_region, overworld_1_region = create_region(world, active_locations, LocationName.overworld_1_region,
overworld_1_region_locations) overworld_1_region_locations)
overworld_2_region_locations = {} overworld_2_region_locations = {}
overworld_2_region = create_region(world, player, active_locations, LocationName.overworld_2_region, overworld_2_region = create_region(world, active_locations, LocationName.overworld_2_region,
overworld_2_region_locations) overworld_2_region_locations)
overworld_3_region_locations = {} overworld_3_region_locations = {}
overworld_3_region = create_region(world, player, active_locations, LocationName.overworld_3_region, overworld_3_region = create_region(world, active_locations, LocationName.overworld_3_region,
overworld_3_region_locations) overworld_3_region_locations)
overworld_4_region_locations = {} overworld_4_region_locations = {}
overworld_4_region = create_region(world, player, active_locations, LocationName.overworld_4_region, overworld_4_region = create_region(world, active_locations, LocationName.overworld_4_region,
overworld_4_region_locations) overworld_4_region_locations)
lake_orangatanga_region = create_region(world, player, active_locations, LocationName.lake_orangatanga_region, None) lake_orangatanga_region = create_region(world, active_locations, LocationName.lake_orangatanga_region, None)
kremwood_forest_region = create_region(world, player, active_locations, LocationName.kremwood_forest_region, None) kremwood_forest_region = create_region(world, active_locations, LocationName.kremwood_forest_region, None)
cotton_top_cove_region = create_region(world, player, active_locations, LocationName.cotton_top_cove_region, None) cotton_top_cove_region = create_region(world, active_locations, LocationName.cotton_top_cove_region, None)
mekanos_region = create_region(world, player, active_locations, LocationName.mekanos_region, None) mekanos_region = create_region(world, active_locations, LocationName.mekanos_region, None)
k3_region = create_region(world, player, active_locations, LocationName.k3_region, None) k3_region = create_region(world, active_locations, LocationName.k3_region, None)
razor_ridge_region = create_region(world, player, active_locations, LocationName.razor_ridge_region, None) razor_ridge_region = create_region(world, active_locations, LocationName.razor_ridge_region, None)
kaos_kore_region = create_region(world, player, active_locations, LocationName.kaos_kore_region, None) kaos_kore_region = create_region(world, active_locations, LocationName.kaos_kore_region, None)
krematoa_region = create_region(world, player, active_locations, LocationName.krematoa_region, None) krematoa_region = create_region(world, active_locations, LocationName.krematoa_region, None)
lakeside_limbo_region_locations = { lakeside_limbo_region_locations = {
@ -44,9 +45,9 @@ def create_regions(world, player: int, active_locations):
LocationName.lakeside_limbo_bonus_2 : [0x657, 3], LocationName.lakeside_limbo_bonus_2 : [0x657, 3],
LocationName.lakeside_limbo_dk : [0x657, 5], LocationName.lakeside_limbo_dk : [0x657, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
lakeside_limbo_region_locations[LocationName.lakeside_limbo_kong] = [] lakeside_limbo_region_locations[LocationName.lakeside_limbo_kong] = []
lakeside_limbo_region = create_region(world, player, active_locations, LocationName.lakeside_limbo_region, lakeside_limbo_region = create_region(world, active_locations, LocationName.lakeside_limbo_region,
lakeside_limbo_region_locations) lakeside_limbo_region_locations)
doorstop_dash_region_locations = { doorstop_dash_region_locations = {
@ -55,9 +56,9 @@ def create_regions(world, player: int, active_locations):
LocationName.doorstop_dash_bonus_2 : [0x65A, 3], LocationName.doorstop_dash_bonus_2 : [0x65A, 3],
LocationName.doorstop_dash_dk : [0x65A, 5], LocationName.doorstop_dash_dk : [0x65A, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
doorstop_dash_region_locations[LocationName.doorstop_dash_kong] = [] doorstop_dash_region_locations[LocationName.doorstop_dash_kong] = []
doorstop_dash_region = create_region(world, player, active_locations, LocationName.doorstop_dash_region, doorstop_dash_region = create_region(world, active_locations, LocationName.doorstop_dash_region,
doorstop_dash_region_locations) doorstop_dash_region_locations)
tidal_trouble_region_locations = { tidal_trouble_region_locations = {
@ -66,9 +67,9 @@ def create_regions(world, player: int, active_locations):
LocationName.tidal_trouble_bonus_2 : [0x659, 3], LocationName.tidal_trouble_bonus_2 : [0x659, 3],
LocationName.tidal_trouble_dk : [0x659, 5], LocationName.tidal_trouble_dk : [0x659, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
tidal_trouble_region_locations[LocationName.tidal_trouble_kong] = [] tidal_trouble_region_locations[LocationName.tidal_trouble_kong] = []
tidal_trouble_region = create_region(world, player, active_locations, LocationName.tidal_trouble_region, tidal_trouble_region = create_region(world, active_locations, LocationName.tidal_trouble_region,
tidal_trouble_region_locations) tidal_trouble_region_locations)
skiddas_row_region_locations = { skiddas_row_region_locations = {
@ -77,9 +78,9 @@ def create_regions(world, player: int, active_locations):
LocationName.skiddas_row_bonus_2 : [0x65D, 3], LocationName.skiddas_row_bonus_2 : [0x65D, 3],
LocationName.skiddas_row_dk : [0x65D, 5], LocationName.skiddas_row_dk : [0x65D, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
skiddas_row_region_locations[LocationName.skiddas_row_kong] = [] skiddas_row_region_locations[LocationName.skiddas_row_kong] = []
skiddas_row_region = create_region(world, player, active_locations, LocationName.skiddas_row_region, skiddas_row_region = create_region(world, active_locations, LocationName.skiddas_row_region,
skiddas_row_region_locations) skiddas_row_region_locations)
murky_mill_region_locations = { murky_mill_region_locations = {
@ -88,9 +89,9 @@ def create_regions(world, player: int, active_locations):
LocationName.murky_mill_bonus_2 : [0x65C, 3], LocationName.murky_mill_bonus_2 : [0x65C, 3],
LocationName.murky_mill_dk : [0x65C, 5], LocationName.murky_mill_dk : [0x65C, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
murky_mill_region_locations[LocationName.murky_mill_kong] = [] murky_mill_region_locations[LocationName.murky_mill_kong] = []
murky_mill_region = create_region(world, player, active_locations, LocationName.murky_mill_region, murky_mill_region = create_region(world, active_locations, LocationName.murky_mill_region,
murky_mill_region_locations) murky_mill_region_locations)
barrel_shield_bust_up_region_locations = { barrel_shield_bust_up_region_locations = {
@ -99,9 +100,9 @@ def create_regions(world, player: int, active_locations):
LocationName.barrel_shield_bust_up_bonus_2 : [0x662, 3], LocationName.barrel_shield_bust_up_bonus_2 : [0x662, 3],
LocationName.barrel_shield_bust_up_dk : [0x662, 5], LocationName.barrel_shield_bust_up_dk : [0x662, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
barrel_shield_bust_up_region_locations[LocationName.barrel_shield_bust_up_kong] = [] barrel_shield_bust_up_region_locations[LocationName.barrel_shield_bust_up_kong] = []
barrel_shield_bust_up_region = create_region(world, player, active_locations, barrel_shield_bust_up_region = create_region(world, active_locations,
LocationName.barrel_shield_bust_up_region, LocationName.barrel_shield_bust_up_region,
barrel_shield_bust_up_region_locations) barrel_shield_bust_up_region_locations)
@ -111,9 +112,9 @@ def create_regions(world, player: int, active_locations):
LocationName.riverside_race_bonus_2 : [0x664, 3], LocationName.riverside_race_bonus_2 : [0x664, 3],
LocationName.riverside_race_dk : [0x664, 5], LocationName.riverside_race_dk : [0x664, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
riverside_race_region_locations[LocationName.riverside_race_kong] = [] riverside_race_region_locations[LocationName.riverside_race_kong] = []
riverside_race_region = create_region(world, player, active_locations, LocationName.riverside_race_region, riverside_race_region = create_region(world, active_locations, LocationName.riverside_race_region,
riverside_race_region_locations) riverside_race_region_locations)
squeals_on_wheels_region_locations = { squeals_on_wheels_region_locations = {
@ -122,9 +123,9 @@ def create_regions(world, player: int, active_locations):
LocationName.squeals_on_wheels_bonus_2 : [0x65B, 3], LocationName.squeals_on_wheels_bonus_2 : [0x65B, 3],
LocationName.squeals_on_wheels_dk : [0x65B, 5], LocationName.squeals_on_wheels_dk : [0x65B, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
squeals_on_wheels_region_locations[LocationName.squeals_on_wheels_kong] = [] squeals_on_wheels_region_locations[LocationName.squeals_on_wheels_kong] = []
squeals_on_wheels_region = create_region(world, player, active_locations, LocationName.squeals_on_wheels_region, squeals_on_wheels_region = create_region(world, active_locations, LocationName.squeals_on_wheels_region,
squeals_on_wheels_region_locations) squeals_on_wheels_region_locations)
springin_spiders_region_locations = { springin_spiders_region_locations = {
@ -133,9 +134,9 @@ def create_regions(world, player: int, active_locations):
LocationName.springin_spiders_bonus_2 : [0x661, 3], LocationName.springin_spiders_bonus_2 : [0x661, 3],
LocationName.springin_spiders_dk : [0x661, 5], LocationName.springin_spiders_dk : [0x661, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
springin_spiders_region_locations[LocationName.springin_spiders_kong] = [] springin_spiders_region_locations[LocationName.springin_spiders_kong] = []
springin_spiders_region = create_region(world, player, active_locations, LocationName.springin_spiders_region, springin_spiders_region = create_region(world, active_locations, LocationName.springin_spiders_region,
springin_spiders_region_locations) springin_spiders_region_locations)
bobbing_barrel_brawl_region_locations = { bobbing_barrel_brawl_region_locations = {
@ -144,9 +145,9 @@ def create_regions(world, player: int, active_locations):
LocationName.bobbing_barrel_brawl_bonus_2 : [0x666, 3], LocationName.bobbing_barrel_brawl_bonus_2 : [0x666, 3],
LocationName.bobbing_barrel_brawl_dk : [0x666, 5], LocationName.bobbing_barrel_brawl_dk : [0x666, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
bobbing_barrel_brawl_region_locations[LocationName.bobbing_barrel_brawl_kong] = [] bobbing_barrel_brawl_region_locations[LocationName.bobbing_barrel_brawl_kong] = []
bobbing_barrel_brawl_region = create_region(world, player, active_locations, bobbing_barrel_brawl_region = create_region(world, active_locations,
LocationName.bobbing_barrel_brawl_region, LocationName.bobbing_barrel_brawl_region,
bobbing_barrel_brawl_region_locations) bobbing_barrel_brawl_region_locations)
@ -156,9 +157,9 @@ def create_regions(world, player: int, active_locations):
LocationName.bazzas_blockade_bonus_2 : [0x667, 3], LocationName.bazzas_blockade_bonus_2 : [0x667, 3],
LocationName.bazzas_blockade_dk : [0x667, 5], LocationName.bazzas_blockade_dk : [0x667, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
bazzas_blockade_region_locations[LocationName.bazzas_blockade_kong] = [] bazzas_blockade_region_locations[LocationName.bazzas_blockade_kong] = []
bazzas_blockade_region = create_region(world, player, active_locations, LocationName.bazzas_blockade_region, bazzas_blockade_region = create_region(world, active_locations, LocationName.bazzas_blockade_region,
bazzas_blockade_region_locations) bazzas_blockade_region_locations)
rocket_barrel_ride_region_locations = { rocket_barrel_ride_region_locations = {
@ -167,9 +168,9 @@ def create_regions(world, player: int, active_locations):
LocationName.rocket_barrel_ride_bonus_2 : [0x66A, 3], LocationName.rocket_barrel_ride_bonus_2 : [0x66A, 3],
LocationName.rocket_barrel_ride_dk : [0x66A, 5], LocationName.rocket_barrel_ride_dk : [0x66A, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
rocket_barrel_ride_region_locations[LocationName.rocket_barrel_ride_kong] = [] rocket_barrel_ride_region_locations[LocationName.rocket_barrel_ride_kong] = []
rocket_barrel_ride_region = create_region(world, player, active_locations, LocationName.rocket_barrel_ride_region, rocket_barrel_ride_region = create_region(world, active_locations, LocationName.rocket_barrel_ride_region,
rocket_barrel_ride_region_locations) rocket_barrel_ride_region_locations)
kreeping_klasps_region_locations = { kreeping_klasps_region_locations = {
@ -178,9 +179,9 @@ def create_regions(world, player: int, active_locations):
LocationName.kreeping_klasps_bonus_2 : [0x658, 3], LocationName.kreeping_klasps_bonus_2 : [0x658, 3],
LocationName.kreeping_klasps_dk : [0x658, 5], LocationName.kreeping_klasps_dk : [0x658, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
kreeping_klasps_region_locations[LocationName.kreeping_klasps_kong] = [] kreeping_klasps_region_locations[LocationName.kreeping_klasps_kong] = []
kreeping_klasps_region = create_region(world, player, active_locations, LocationName.kreeping_klasps_region, kreeping_klasps_region = create_region(world, active_locations, LocationName.kreeping_klasps_region,
kreeping_klasps_region_locations) kreeping_klasps_region_locations)
tracker_barrel_trek_region_locations = { tracker_barrel_trek_region_locations = {
@ -189,9 +190,9 @@ def create_regions(world, player: int, active_locations):
LocationName.tracker_barrel_trek_bonus_2 : [0x66B, 3], LocationName.tracker_barrel_trek_bonus_2 : [0x66B, 3],
LocationName.tracker_barrel_trek_dk : [0x66B, 5], LocationName.tracker_barrel_trek_dk : [0x66B, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
tracker_barrel_trek_region_locations[LocationName.tracker_barrel_trek_kong] = [] tracker_barrel_trek_region_locations[LocationName.tracker_barrel_trek_kong] = []
tracker_barrel_trek_region = create_region(world, player, active_locations, LocationName.tracker_barrel_trek_region, tracker_barrel_trek_region = create_region(world, active_locations, LocationName.tracker_barrel_trek_region,
tracker_barrel_trek_region_locations) tracker_barrel_trek_region_locations)
fish_food_frenzy_region_locations = { fish_food_frenzy_region_locations = {
@ -200,9 +201,9 @@ def create_regions(world, player: int, active_locations):
LocationName.fish_food_frenzy_bonus_2 : [0x668, 3], LocationName.fish_food_frenzy_bonus_2 : [0x668, 3],
LocationName.fish_food_frenzy_dk : [0x668, 5], LocationName.fish_food_frenzy_dk : [0x668, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
fish_food_frenzy_region_locations[LocationName.fish_food_frenzy_kong] = [] fish_food_frenzy_region_locations[LocationName.fish_food_frenzy_kong] = []
fish_food_frenzy_region = create_region(world, player, active_locations, LocationName.fish_food_frenzy_region, fish_food_frenzy_region = create_region(world, active_locations, LocationName.fish_food_frenzy_region,
fish_food_frenzy_region_locations) fish_food_frenzy_region_locations)
fire_ball_frenzy_region_locations = { fire_ball_frenzy_region_locations = {
@ -211,9 +212,9 @@ def create_regions(world, player: int, active_locations):
LocationName.fire_ball_frenzy_bonus_2 : [0x66D, 3], LocationName.fire_ball_frenzy_bonus_2 : [0x66D, 3],
LocationName.fire_ball_frenzy_dk : [0x66D, 5], LocationName.fire_ball_frenzy_dk : [0x66D, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
fire_ball_frenzy_region_locations[LocationName.fire_ball_frenzy_kong] = [] fire_ball_frenzy_region_locations[LocationName.fire_ball_frenzy_kong] = []
fire_ball_frenzy_region = create_region(world, player, active_locations, LocationName.fire_ball_frenzy_region, fire_ball_frenzy_region = create_region(world, active_locations, LocationName.fire_ball_frenzy_region,
fire_ball_frenzy_region_locations) fire_ball_frenzy_region_locations)
demolition_drain_pipe_region_locations = { demolition_drain_pipe_region_locations = {
@ -222,9 +223,9 @@ def create_regions(world, player: int, active_locations):
LocationName.demolition_drain_pipe_bonus_2 : [0x672, 3], LocationName.demolition_drain_pipe_bonus_2 : [0x672, 3],
LocationName.demolition_drain_pipe_dk : [0x672, 5], LocationName.demolition_drain_pipe_dk : [0x672, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
demolition_drain_pipe_region_locations[LocationName.demolition_drain_pipe_kong] = [] demolition_drain_pipe_region_locations[LocationName.demolition_drain_pipe_kong] = []
demolition_drain_pipe_region = create_region(world, player, active_locations, demolition_drain_pipe_region = create_region(world, active_locations,
LocationName.demolition_drain_pipe_region, LocationName.demolition_drain_pipe_region,
demolition_drain_pipe_region_locations) demolition_drain_pipe_region_locations)
@ -234,9 +235,9 @@ def create_regions(world, player: int, active_locations):
LocationName.ripsaw_rage_bonus_2 : [0x660, 3], LocationName.ripsaw_rage_bonus_2 : [0x660, 3],
LocationName.ripsaw_rage_dk : [0x660, 5], LocationName.ripsaw_rage_dk : [0x660, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
ripsaw_rage_region_locations[LocationName.ripsaw_rage_kong] = [] ripsaw_rage_region_locations[LocationName.ripsaw_rage_kong] = []
ripsaw_rage_region = create_region(world, player, active_locations, LocationName.ripsaw_rage_region, ripsaw_rage_region = create_region(world, active_locations, LocationName.ripsaw_rage_region,
ripsaw_rage_region_locations) ripsaw_rage_region_locations)
blazing_bazookas_region_locations = { blazing_bazookas_region_locations = {
@ -245,9 +246,9 @@ def create_regions(world, player: int, active_locations):
LocationName.blazing_bazookas_bonus_2 : [0x66E, 3], LocationName.blazing_bazookas_bonus_2 : [0x66E, 3],
LocationName.blazing_bazookas_dk : [0x66E, 5], LocationName.blazing_bazookas_dk : [0x66E, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
blazing_bazookas_region_locations[LocationName.blazing_bazookas_kong] = [] blazing_bazookas_region_locations[LocationName.blazing_bazookas_kong] = []
blazing_bazookas_region = create_region(world, player, active_locations, LocationName.blazing_bazookas_region, blazing_bazookas_region = create_region(world, active_locations, LocationName.blazing_bazookas_region,
blazing_bazookas_region_locations) blazing_bazookas_region_locations)
low_g_labyrinth_region_locations = { low_g_labyrinth_region_locations = {
@ -256,9 +257,9 @@ def create_regions(world, player: int, active_locations):
LocationName.low_g_labyrinth_bonus_2 : [0x670, 3], LocationName.low_g_labyrinth_bonus_2 : [0x670, 3],
LocationName.low_g_labyrinth_dk : [0x670, 5], LocationName.low_g_labyrinth_dk : [0x670, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
low_g_labyrinth_region_locations[LocationName.low_g_labyrinth_kong] = [] low_g_labyrinth_region_locations[LocationName.low_g_labyrinth_kong] = []
low_g_labyrinth_region = create_region(world, player, active_locations, LocationName.low_g_labyrinth_region, low_g_labyrinth_region = create_region(world, active_locations, LocationName.low_g_labyrinth_region,
low_g_labyrinth_region_locations) low_g_labyrinth_region_locations)
krevice_kreepers_region_locations = { krevice_kreepers_region_locations = {
@ -267,9 +268,9 @@ def create_regions(world, player: int, active_locations):
LocationName.krevice_kreepers_bonus_2 : [0x673, 3], LocationName.krevice_kreepers_bonus_2 : [0x673, 3],
LocationName.krevice_kreepers_dk : [0x673, 5], LocationName.krevice_kreepers_dk : [0x673, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
krevice_kreepers_region_locations[LocationName.krevice_kreepers_kong] = [] krevice_kreepers_region_locations[LocationName.krevice_kreepers_kong] = []
krevice_kreepers_region = create_region(world, player, active_locations, LocationName.krevice_kreepers_region, krevice_kreepers_region = create_region(world, active_locations, LocationName.krevice_kreepers_region,
krevice_kreepers_region_locations) krevice_kreepers_region_locations)
tearaway_toboggan_region_locations = { tearaway_toboggan_region_locations = {
@ -278,9 +279,9 @@ def create_regions(world, player: int, active_locations):
LocationName.tearaway_toboggan_bonus_2 : [0x65F, 3], LocationName.tearaway_toboggan_bonus_2 : [0x65F, 3],
LocationName.tearaway_toboggan_dk : [0x65F, 5], LocationName.tearaway_toboggan_dk : [0x65F, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
tearaway_toboggan_region_locations[LocationName.tearaway_toboggan_kong] = [] tearaway_toboggan_region_locations[LocationName.tearaway_toboggan_kong] = []
tearaway_toboggan_region = create_region(world, player, active_locations, LocationName.tearaway_toboggan_region, tearaway_toboggan_region = create_region(world, active_locations, LocationName.tearaway_toboggan_region,
tearaway_toboggan_region_locations) tearaway_toboggan_region_locations)
barrel_drop_bounce_region_locations = { barrel_drop_bounce_region_locations = {
@ -289,9 +290,9 @@ def create_regions(world, player: int, active_locations):
LocationName.barrel_drop_bounce_bonus_2 : [0x66C, 3], LocationName.barrel_drop_bounce_bonus_2 : [0x66C, 3],
LocationName.barrel_drop_bounce_dk : [0x66C, 5], LocationName.barrel_drop_bounce_dk : [0x66C, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
barrel_drop_bounce_region_locations[LocationName.barrel_drop_bounce_kong] = [] barrel_drop_bounce_region_locations[LocationName.barrel_drop_bounce_kong] = []
barrel_drop_bounce_region = create_region(world, player, active_locations, LocationName.barrel_drop_bounce_region, barrel_drop_bounce_region = create_region(world, active_locations, LocationName.barrel_drop_bounce_region,
barrel_drop_bounce_region_locations) barrel_drop_bounce_region_locations)
krack_shot_kroc_region_locations = { krack_shot_kroc_region_locations = {
@ -300,9 +301,9 @@ def create_regions(world, player: int, active_locations):
LocationName.krack_shot_kroc_bonus_2 : [0x66F, 3], LocationName.krack_shot_kroc_bonus_2 : [0x66F, 3],
LocationName.krack_shot_kroc_dk : [0x66F, 5], LocationName.krack_shot_kroc_dk : [0x66F, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
krack_shot_kroc_region_locations[LocationName.krack_shot_kroc_kong] = [] krack_shot_kroc_region_locations[LocationName.krack_shot_kroc_kong] = []
krack_shot_kroc_region = create_region(world, player, active_locations, LocationName.krack_shot_kroc_region, krack_shot_kroc_region = create_region(world, active_locations, LocationName.krack_shot_kroc_region,
krack_shot_kroc_region_locations) krack_shot_kroc_region_locations)
lemguin_lunge_region_locations = { lemguin_lunge_region_locations = {
@ -311,9 +312,9 @@ def create_regions(world, player: int, active_locations):
LocationName.lemguin_lunge_bonus_2 : [0x65E, 3], LocationName.lemguin_lunge_bonus_2 : [0x65E, 3],
LocationName.lemguin_lunge_dk : [0x65E, 5], LocationName.lemguin_lunge_dk : [0x65E, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
lemguin_lunge_region_locations[LocationName.lemguin_lunge_kong] = [] lemguin_lunge_region_locations[LocationName.lemguin_lunge_kong] = []
lemguin_lunge_region = create_region(world, player, active_locations, LocationName.lemguin_lunge_region, lemguin_lunge_region = create_region(world, active_locations, LocationName.lemguin_lunge_region,
lemguin_lunge_region_locations) lemguin_lunge_region_locations)
buzzer_barrage_region_locations = { buzzer_barrage_region_locations = {
@ -322,9 +323,9 @@ def create_regions(world, player: int, active_locations):
LocationName.buzzer_barrage_bonus_2 : [0x676, 3], LocationName.buzzer_barrage_bonus_2 : [0x676, 3],
LocationName.buzzer_barrage_dk : [0x676, 5], LocationName.buzzer_barrage_dk : [0x676, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
buzzer_barrage_region_locations[LocationName.buzzer_barrage_kong] = [] buzzer_barrage_region_locations[LocationName.buzzer_barrage_kong] = []
buzzer_barrage_region = create_region(world, player, active_locations, LocationName.buzzer_barrage_region, buzzer_barrage_region = create_region(world, active_locations, LocationName.buzzer_barrage_region,
buzzer_barrage_region_locations) buzzer_barrage_region_locations)
kong_fused_cliffs_region_locations = { kong_fused_cliffs_region_locations = {
@ -333,9 +334,9 @@ def create_regions(world, player: int, active_locations):
LocationName.kong_fused_cliffs_bonus_2 : [0x674, 3], LocationName.kong_fused_cliffs_bonus_2 : [0x674, 3],
LocationName.kong_fused_cliffs_dk : [0x674, 5], LocationName.kong_fused_cliffs_dk : [0x674, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
kong_fused_cliffs_region_locations[LocationName.kong_fused_cliffs_kong] = [] kong_fused_cliffs_region_locations[LocationName.kong_fused_cliffs_kong] = []
kong_fused_cliffs_region = create_region(world, player, active_locations, LocationName.kong_fused_cliffs_region, kong_fused_cliffs_region = create_region(world, active_locations, LocationName.kong_fused_cliffs_region,
kong_fused_cliffs_region_locations) kong_fused_cliffs_region_locations)
floodlit_fish_region_locations = { floodlit_fish_region_locations = {
@ -344,9 +345,9 @@ def create_regions(world, player: int, active_locations):
LocationName.floodlit_fish_bonus_2 : [0x669, 3], LocationName.floodlit_fish_bonus_2 : [0x669, 3],
LocationName.floodlit_fish_dk : [0x669, 5], LocationName.floodlit_fish_dk : [0x669, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
floodlit_fish_region_locations[LocationName.floodlit_fish_kong] = [] floodlit_fish_region_locations[LocationName.floodlit_fish_kong] = []
floodlit_fish_region = create_region(world, player, active_locations, LocationName.floodlit_fish_region, floodlit_fish_region = create_region(world, active_locations, LocationName.floodlit_fish_region,
floodlit_fish_region_locations) floodlit_fish_region_locations)
pothole_panic_region_locations = { pothole_panic_region_locations = {
@ -355,9 +356,9 @@ def create_regions(world, player: int, active_locations):
LocationName.pothole_panic_bonus_2 : [0x677, 3], LocationName.pothole_panic_bonus_2 : [0x677, 3],
LocationName.pothole_panic_dk : [0x677, 5], LocationName.pothole_panic_dk : [0x677, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
pothole_panic_region_locations[LocationName.pothole_panic_kong] = [] pothole_panic_region_locations[LocationName.pothole_panic_kong] = []
pothole_panic_region = create_region(world, player, active_locations, LocationName.pothole_panic_region, pothole_panic_region = create_region(world, active_locations, LocationName.pothole_panic_region,
pothole_panic_region_locations) pothole_panic_region_locations)
ropey_rumpus_region_locations = { ropey_rumpus_region_locations = {
@ -366,9 +367,9 @@ def create_regions(world, player: int, active_locations):
LocationName.ropey_rumpus_bonus_2 : [0x675, 3], LocationName.ropey_rumpus_bonus_2 : [0x675, 3],
LocationName.ropey_rumpus_dk : [0x675, 5], LocationName.ropey_rumpus_dk : [0x675, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
ropey_rumpus_region_locations[LocationName.ropey_rumpus_kong] = [] ropey_rumpus_region_locations[LocationName.ropey_rumpus_kong] = []
ropey_rumpus_region = create_region(world, player, active_locations, LocationName.ropey_rumpus_region, ropey_rumpus_region = create_region(world, active_locations, LocationName.ropey_rumpus_region,
ropey_rumpus_region_locations) ropey_rumpus_region_locations)
konveyor_rope_clash_region_locations = { konveyor_rope_clash_region_locations = {
@ -377,9 +378,9 @@ def create_regions(world, player: int, active_locations):
LocationName.konveyor_rope_clash_bonus_2 : [0x657, 3], LocationName.konveyor_rope_clash_bonus_2 : [0x657, 3],
LocationName.konveyor_rope_clash_dk : [0x657, 5], LocationName.konveyor_rope_clash_dk : [0x657, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
konveyor_rope_clash_region_locations[LocationName.konveyor_rope_clash_kong] = [] konveyor_rope_clash_region_locations[LocationName.konveyor_rope_clash_kong] = []
konveyor_rope_clash_region = create_region(world, player, active_locations, LocationName.konveyor_rope_clash_region, konveyor_rope_clash_region = create_region(world, active_locations, LocationName.konveyor_rope_clash_region,
konveyor_rope_clash_region_locations) konveyor_rope_clash_region_locations)
creepy_caverns_region_locations = { creepy_caverns_region_locations = {
@ -388,9 +389,9 @@ def create_regions(world, player: int, active_locations):
LocationName.creepy_caverns_bonus_2 : [0x678, 3], LocationName.creepy_caverns_bonus_2 : [0x678, 3],
LocationName.creepy_caverns_dk : [0x678, 5], LocationName.creepy_caverns_dk : [0x678, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
creepy_caverns_region_locations[LocationName.creepy_caverns_kong] = [] creepy_caverns_region_locations[LocationName.creepy_caverns_kong] = []
creepy_caverns_region = create_region(world, player, active_locations, LocationName.creepy_caverns_region, creepy_caverns_region = create_region(world, active_locations, LocationName.creepy_caverns_region,
creepy_caverns_region_locations) creepy_caverns_region_locations)
lightning_lookout_region_locations = { lightning_lookout_region_locations = {
@ -399,9 +400,9 @@ def create_regions(world, player: int, active_locations):
LocationName.lightning_lookout_bonus_2 : [0x665, 3], LocationName.lightning_lookout_bonus_2 : [0x665, 3],
LocationName.lightning_lookout_dk : [0x665, 5], LocationName.lightning_lookout_dk : [0x665, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
lightning_lookout_region_locations[LocationName.lightning_lookout_kong] = [] lightning_lookout_region_locations[LocationName.lightning_lookout_kong] = []
lightning_lookout_region = create_region(world, player, active_locations, LocationName.lightning_lookout_region, lightning_lookout_region = create_region(world, active_locations, LocationName.lightning_lookout_region,
lightning_lookout_region_locations) lightning_lookout_region_locations)
koindozer_klamber_region_locations = { koindozer_klamber_region_locations = {
@ -410,9 +411,9 @@ def create_regions(world, player: int, active_locations):
LocationName.koindozer_klamber_bonus_2 : [0x679, 3], LocationName.koindozer_klamber_bonus_2 : [0x679, 3],
LocationName.koindozer_klamber_dk : [0x679, 5], LocationName.koindozer_klamber_dk : [0x679, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
koindozer_klamber_region_locations[LocationName.koindozer_klamber_kong] = [] koindozer_klamber_region_locations[LocationName.koindozer_klamber_kong] = []
koindozer_klamber_region = create_region(world, player, active_locations, LocationName.koindozer_klamber_region, koindozer_klamber_region = create_region(world, active_locations, LocationName.koindozer_klamber_region,
koindozer_klamber_region_locations) koindozer_klamber_region_locations)
poisonous_pipeline_region_locations = { poisonous_pipeline_region_locations = {
@ -421,9 +422,9 @@ def create_regions(world, player: int, active_locations):
LocationName.poisonous_pipeline_bonus_2 : [0x671, 3], LocationName.poisonous_pipeline_bonus_2 : [0x671, 3],
LocationName.poisonous_pipeline_dk : [0x671, 5], LocationName.poisonous_pipeline_dk : [0x671, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
poisonous_pipeline_region_locations[LocationName.poisonous_pipeline_kong] = [] poisonous_pipeline_region_locations[LocationName.poisonous_pipeline_kong] = []
poisonous_pipeline_region = create_region(world, player, active_locations, LocationName.poisonous_pipeline_region, poisonous_pipeline_region = create_region(world, active_locations, LocationName.poisonous_pipeline_region,
poisonous_pipeline_region_locations) poisonous_pipeline_region_locations)
stampede_sprint_region_locations = { stampede_sprint_region_locations = {
@ -433,9 +434,9 @@ def create_regions(world, player: int, active_locations):
LocationName.stampede_sprint_bonus_3 : [0x67B, 4], LocationName.stampede_sprint_bonus_3 : [0x67B, 4],
LocationName.stampede_sprint_dk : [0x67B, 5], LocationName.stampede_sprint_dk : [0x67B, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
stampede_sprint_region_locations[LocationName.stampede_sprint_kong] = [] stampede_sprint_region_locations[LocationName.stampede_sprint_kong] = []
stampede_sprint_region = create_region(world, player, active_locations, LocationName.stampede_sprint_region, stampede_sprint_region = create_region(world, active_locations, LocationName.stampede_sprint_region,
stampede_sprint_region_locations) stampede_sprint_region_locations)
criss_cross_cliffs_region_locations = { criss_cross_cliffs_region_locations = {
@ -444,9 +445,9 @@ def create_regions(world, player: int, active_locations):
LocationName.criss_cross_cliffs_bonus_2 : [0x67C, 3], LocationName.criss_cross_cliffs_bonus_2 : [0x67C, 3],
LocationName.criss_cross_cliffs_dk : [0x67C, 5], LocationName.criss_cross_cliffs_dk : [0x67C, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
criss_cross_cliffs_region_locations[LocationName.criss_cross_cliffs_kong] = [] criss_cross_cliffs_region_locations[LocationName.criss_cross_cliffs_kong] = []
criss_cross_cliffs_region = create_region(world, player, active_locations, LocationName.criss_cross_cliffs_region, criss_cross_cliffs_region = create_region(world, active_locations, LocationName.criss_cross_cliffs_region,
criss_cross_cliffs_region_locations) criss_cross_cliffs_region_locations)
tyrant_twin_tussle_region_locations = { tyrant_twin_tussle_region_locations = {
@ -456,9 +457,9 @@ def create_regions(world, player: int, active_locations):
LocationName.tyrant_twin_tussle_bonus_3 : [0x67D, 4], LocationName.tyrant_twin_tussle_bonus_3 : [0x67D, 4],
LocationName.tyrant_twin_tussle_dk : [0x67D, 5], LocationName.tyrant_twin_tussle_dk : [0x67D, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
tyrant_twin_tussle_region_locations[LocationName.tyrant_twin_tussle_kong] = [] tyrant_twin_tussle_region_locations[LocationName.tyrant_twin_tussle_kong] = []
tyrant_twin_tussle_region = create_region(world, player, active_locations, LocationName.tyrant_twin_tussle_region, tyrant_twin_tussle_region = create_region(world, active_locations, LocationName.tyrant_twin_tussle_region,
tyrant_twin_tussle_region_locations) tyrant_twin_tussle_region_locations)
swoopy_salvo_region_locations = { swoopy_salvo_region_locations = {
@ -468,147 +469,147 @@ def create_regions(world, player: int, active_locations):
LocationName.swoopy_salvo_bonus_3 : [0x663, 4], LocationName.swoopy_salvo_bonus_3 : [0x663, 4],
LocationName.swoopy_salvo_dk : [0x663, 5], LocationName.swoopy_salvo_dk : [0x663, 5],
} }
if world.kongsanity[player]: if world.options.kongsanity:
swoopy_salvo_region_locations[LocationName.swoopy_salvo_kong] = [] swoopy_salvo_region_locations[LocationName.swoopy_salvo_kong] = []
swoopy_salvo_region = create_region(world, player, active_locations, LocationName.swoopy_salvo_region, swoopy_salvo_region = create_region(world, active_locations, LocationName.swoopy_salvo_region,
swoopy_salvo_region_locations) swoopy_salvo_region_locations)
rocket_rush_region_locations = { rocket_rush_region_locations = {
LocationName.rocket_rush_flag : [0x67E, 1], LocationName.rocket_rush_flag : [0x67E, 1],
LocationName.rocket_rush_dk : [0x67E, 5], LocationName.rocket_rush_dk : [0x67E, 5],
} }
rocket_rush_region = create_region(world, player, active_locations, LocationName.rocket_rush_region, rocket_rush_region = create_region(world, active_locations, LocationName.rocket_rush_region,
rocket_rush_region_locations) rocket_rush_region_locations)
belchas_barn_region_locations = { belchas_barn_region_locations = {
LocationName.belchas_barn: [0x64F, 1], LocationName.belchas_barn: [0x64F, 1],
} }
belchas_barn_region = create_region(world, player, active_locations, LocationName.belchas_barn_region, belchas_barn_region = create_region(world, active_locations, LocationName.belchas_barn_region,
belchas_barn_region_locations) belchas_barn_region_locations)
arichs_ambush_region_locations = { arichs_ambush_region_locations = {
LocationName.arichs_ambush: [0x650, 1], LocationName.arichs_ambush: [0x650, 1],
} }
arichs_ambush_region = create_region(world, player, active_locations, LocationName.arichs_ambush_region, arichs_ambush_region = create_region(world, active_locations, LocationName.arichs_ambush_region,
arichs_ambush_region_locations) arichs_ambush_region_locations)
squirts_showdown_region_locations = { squirts_showdown_region_locations = {
LocationName.squirts_showdown: [0x651, 1], LocationName.squirts_showdown: [0x651, 1],
} }
squirts_showdown_region = create_region(world, player, active_locations, LocationName.squirts_showdown_region, squirts_showdown_region = create_region(world, active_locations, LocationName.squirts_showdown_region,
squirts_showdown_region_locations) squirts_showdown_region_locations)
kaos_karnage_region_locations = { kaos_karnage_region_locations = {
LocationName.kaos_karnage: [0x652, 1], LocationName.kaos_karnage: [0x652, 1],
} }
kaos_karnage_region = create_region(world, player, active_locations, LocationName.kaos_karnage_region, kaos_karnage_region = create_region(world, active_locations, LocationName.kaos_karnage_region,
kaos_karnage_region_locations) kaos_karnage_region_locations)
bleaks_house_region_locations = { bleaks_house_region_locations = {
LocationName.bleaks_house: [0x653, 1], LocationName.bleaks_house: [0x653, 1],
} }
bleaks_house_region = create_region(world, player, active_locations, LocationName.bleaks_house_region, bleaks_house_region = create_region(world, active_locations, LocationName.bleaks_house_region,
bleaks_house_region_locations) bleaks_house_region_locations)
barboss_barrier_region_locations = { barboss_barrier_region_locations = {
LocationName.barboss_barrier: [0x654, 1], LocationName.barboss_barrier: [0x654, 1],
} }
barboss_barrier_region = create_region(world, player, active_locations, LocationName.barboss_barrier_region, barboss_barrier_region = create_region(world, active_locations, LocationName.barboss_barrier_region,
barboss_barrier_region_locations) barboss_barrier_region_locations)
kastle_kaos_region_locations = { kastle_kaos_region_locations = {
LocationName.kastle_kaos: [0x655, 1], LocationName.kastle_kaos: [0x655, 1],
} }
kastle_kaos_region = create_region(world, player, active_locations, LocationName.kastle_kaos_region, kastle_kaos_region = create_region(world, active_locations, LocationName.kastle_kaos_region,
kastle_kaos_region_locations) kastle_kaos_region_locations)
knautilus_region_locations = { knautilus_region_locations = {
LocationName.knautilus: [0x656, 1], LocationName.knautilus: [0x656, 1],
} }
knautilus_region = create_region(world, player, active_locations, LocationName.knautilus_region, knautilus_region = create_region(world, active_locations, LocationName.knautilus_region,
knautilus_region_locations) knautilus_region_locations)
belchas_burrow_region_locations = { belchas_burrow_region_locations = {
LocationName.belchas_burrow: [0x647, 1], LocationName.belchas_burrow: [0x647, 1],
} }
belchas_burrow_region = create_region(world, player, active_locations, LocationName.belchas_burrow_region, belchas_burrow_region = create_region(world, active_locations, LocationName.belchas_burrow_region,
belchas_burrow_region_locations) belchas_burrow_region_locations)
kong_cave_region_locations = { kong_cave_region_locations = {
LocationName.kong_cave: [0x645, 1], LocationName.kong_cave: [0x645, 1],
} }
kong_cave_region = create_region(world, player, active_locations, LocationName.kong_cave_region, kong_cave_region = create_region(world, active_locations, LocationName.kong_cave_region,
kong_cave_region_locations) kong_cave_region_locations)
undercover_cove_region_locations = { undercover_cove_region_locations = {
LocationName.undercover_cove: [0x644, 1], LocationName.undercover_cove: [0x644, 1],
} }
undercover_cove_region = create_region(world, player, active_locations, LocationName.undercover_cove_region, undercover_cove_region = create_region(world, active_locations, LocationName.undercover_cove_region,
undercover_cove_region_locations) undercover_cove_region_locations)
ks_cache_region_locations = { ks_cache_region_locations = {
LocationName.ks_cache: [0x642, 1], LocationName.ks_cache: [0x642, 1],
} }
ks_cache_region = create_region(world, player, active_locations, LocationName.ks_cache_region, ks_cache_region = create_region(world, active_locations, LocationName.ks_cache_region,
ks_cache_region_locations) ks_cache_region_locations)
hill_top_hoard_region_locations = { hill_top_hoard_region_locations = {
LocationName.hill_top_hoard: [0x643, 1], LocationName.hill_top_hoard: [0x643, 1],
} }
hill_top_hoard_region = create_region(world, player, active_locations, LocationName.hill_top_hoard_region, hill_top_hoard_region = create_region(world, active_locations, LocationName.hill_top_hoard_region,
hill_top_hoard_region_locations) hill_top_hoard_region_locations)
bounty_beach_region_locations = { bounty_beach_region_locations = {
LocationName.bounty_beach: [0x646, 1], LocationName.bounty_beach: [0x646, 1],
} }
bounty_beach_region = create_region(world, player, active_locations, LocationName.bounty_beach_region, bounty_beach_region = create_region(world, active_locations, LocationName.bounty_beach_region,
bounty_beach_region_locations) bounty_beach_region_locations)
smugglers_cove_region_locations = { smugglers_cove_region_locations = {
LocationName.smugglers_cove: [0x648, 1], LocationName.smugglers_cove: [0x648, 1],
} }
smugglers_cove_region = create_region(world, player, active_locations, LocationName.smugglers_cove_region, smugglers_cove_region = create_region(world, active_locations, LocationName.smugglers_cove_region,
smugglers_cove_region_locations) smugglers_cove_region_locations)
arichs_hoard_region_locations = { arichs_hoard_region_locations = {
LocationName.arichs_hoard: [0x649, 1], LocationName.arichs_hoard: [0x649, 1],
} }
arichs_hoard_region = create_region(world, player, active_locations, LocationName.arichs_hoard_region, arichs_hoard_region = create_region(world, active_locations, LocationName.arichs_hoard_region,
arichs_hoard_region_locations) arichs_hoard_region_locations)
bounty_bay_region_locations = { bounty_bay_region_locations = {
LocationName.bounty_bay: [0x64A, 1], LocationName.bounty_bay: [0x64A, 1],
} }
bounty_bay_region = create_region(world, player, active_locations, LocationName.bounty_bay_region, bounty_bay_region = create_region(world, active_locations, LocationName.bounty_bay_region,
bounty_bay_region_locations) bounty_bay_region_locations)
sky_high_secret_region_locations = {} sky_high_secret_region_locations = {}
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
sky_high_secret_region_locations[LocationName.sky_high_secret] = [0x64B, 1] sky_high_secret_region_locations[LocationName.sky_high_secret] = [0x64B, 1]
sky_high_secret_region = create_region(world, player, active_locations, LocationName.sky_high_secret_region, sky_high_secret_region = create_region(world, active_locations, LocationName.sky_high_secret_region,
sky_high_secret_region_locations) sky_high_secret_region_locations)
glacial_grotto_region_locations = { glacial_grotto_region_locations = {
LocationName.glacial_grotto: [0x64C, 1], LocationName.glacial_grotto: [0x64C, 1],
} }
glacial_grotto_region = create_region(world, player, active_locations, LocationName.glacial_grotto_region, glacial_grotto_region = create_region(world, active_locations, LocationName.glacial_grotto_region,
glacial_grotto_region_locations) glacial_grotto_region_locations)
cifftop_cache_region_locations = {} cifftop_cache_region_locations = {}
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
cifftop_cache_region_locations[LocationName.cifftop_cache] = [0x64D, 1] cifftop_cache_region_locations[LocationName.cifftop_cache] = [0x64D, 1]
cifftop_cache_region = create_region(world, player, active_locations, LocationName.cifftop_cache_region, cifftop_cache_region = create_region(world, active_locations, LocationName.cifftop_cache_region,
cifftop_cache_region_locations) cifftop_cache_region_locations)
sewer_stockpile_region_locations = { sewer_stockpile_region_locations = {
LocationName.sewer_stockpile: [0x64E, 1], LocationName.sewer_stockpile: [0x64E, 1],
} }
sewer_stockpile_region = create_region(world, player, active_locations, LocationName.sewer_stockpile_region, sewer_stockpile_region = create_region(world, active_locations, LocationName.sewer_stockpile_region,
sewer_stockpile_region_locations) sewer_stockpile_region_locations)
# Set up the regions correctly. # Set up the regions correctly.
world.regions += [ world.multiworld.regions += [
menu_region, menu_region,
overworld_1_region, overworld_1_region,
overworld_2_region, overworld_2_region,
@ -693,7 +694,7 @@ def create_regions(world, player: int, active_locations):
blue_region_locations = {} blue_region_locations = {}
blizzard_region_locations = {} blizzard_region_locations = {}
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
bazaar_region_locations.update({ bazaar_region_locations.update({
LocationName.bazaars_general_store_1: [0x615, 2, True], LocationName.bazaars_general_store_1: [0x615, 2, True],
LocationName.bazaars_general_store_2: [0x615, 3, True], LocationName.bazaars_general_store_2: [0x615, 3, True],
@ -713,19 +714,19 @@ def create_regions(world, player: int, active_locations):
blizzard_region_locations[LocationName.blizzards_basecamp] = [0x625, 4, True] blizzard_region_locations[LocationName.blizzards_basecamp] = [0x625, 4, True]
bazaar_region = create_region(world, player, active_locations, LocationName.bazaar_region, bazaar_region_locations) bazaar_region = create_region(world, active_locations, LocationName.bazaar_region, bazaar_region_locations)
bramble_region = create_region(world, player, active_locations, LocationName.bramble_region, bramble_region = create_region(world, active_locations, LocationName.bramble_region,
bramble_region_locations) bramble_region_locations)
flower_spot_region = create_region(world, player, active_locations, LocationName.flower_spot_region, flower_spot_region = create_region(world, active_locations, LocationName.flower_spot_region,
flower_spot_region_locations) flower_spot_region_locations)
barter_region = create_region(world, player, active_locations, LocationName.barter_region, barter_region_locations) barter_region = create_region(world, active_locations, LocationName.barter_region, barter_region_locations)
barnacle_region = create_region(world, player, active_locations, LocationName.barnacle_region, barnacle_region = create_region(world, active_locations, LocationName.barnacle_region,
barnacle_region_locations) barnacle_region_locations)
blue_region = create_region(world, player, active_locations, LocationName.blue_region, blue_region_locations) blue_region = create_region(world, active_locations, LocationName.blue_region, blue_region_locations)
blizzard_region = create_region(world, player, active_locations, LocationName.blizzard_region, blizzard_region = create_region(world, active_locations, LocationName.blizzard_region,
blizzard_region_locations) blizzard_region_locations)
world.regions += [ world.multiworld.regions += [
bazaar_region, bazaar_region,
bramble_region, bramble_region,
flower_spot_region, flower_spot_region,
@ -736,41 +737,41 @@ def create_regions(world, player: int, active_locations):
] ]
def connect_regions(world, player, level_list): def connect_regions(world: World, level_list):
names: typing.Dict[str, int] = {} names: typing.Dict[str, int] = {}
# Overworld # Overworld
connect(world, player, names, 'Menu', LocationName.overworld_1_region) connect(world, world.player, names, 'Menu', LocationName.overworld_1_region)
connect(world, player, names, LocationName.overworld_1_region, LocationName.overworld_2_region, connect(world, world.player, names, LocationName.overworld_1_region, LocationName.overworld_2_region,
lambda state: (state.has(ItemName.progressive_boat, player, 1))) lambda state: (state.has(ItemName.progressive_boat, world.player, 1)))
connect(world, player, names, LocationName.overworld_2_region, LocationName.overworld_3_region, connect(world, world.player, names, LocationName.overworld_2_region, LocationName.overworld_3_region,
lambda state: (state.has(ItemName.progressive_boat, player, 3))) lambda state: (state.has(ItemName.progressive_boat, world.player, 3)))
connect(world, player, names, LocationName.overworld_1_region, LocationName.overworld_4_region, connect(world, world.player, names, LocationName.overworld_1_region, LocationName.overworld_4_region,
lambda state: (state.has(ItemName.dk_coin, player, world.dk_coins_for_gyrocopter[player].value) and lambda state: (state.has(ItemName.dk_coin, world.player, world.options.dk_coins_for_gyrocopter.value) and
state.has(ItemName.progressive_boat, player, 3))) state.has(ItemName.progressive_boat, world.player, 3)))
# World Connections # World Connections
connect(world, player, names, LocationName.overworld_1_region, LocationName.lake_orangatanga_region) connect(world, world.player, names, LocationName.overworld_1_region, LocationName.lake_orangatanga_region)
connect(world, player, names, LocationName.overworld_1_region, LocationName.kremwood_forest_region) connect(world, world.player, names, LocationName.overworld_1_region, LocationName.kremwood_forest_region)
connect(world, player, names, LocationName.overworld_1_region, LocationName.bounty_beach_region) connect(world, world.player, names, LocationName.overworld_1_region, LocationName.bounty_beach_region)
connect(world, player, names, LocationName.overworld_1_region, LocationName.bazaar_region) connect(world, world.player, names, LocationName.overworld_1_region, LocationName.bazaar_region)
connect(world, player, names, LocationName.overworld_2_region, LocationName.cotton_top_cove_region) connect(world, world.player, names, LocationName.overworld_2_region, LocationName.cotton_top_cove_region)
connect(world, player, names, LocationName.overworld_2_region, LocationName.mekanos_region) connect(world, world.player, names, LocationName.overworld_2_region, LocationName.mekanos_region)
connect(world, player, names, LocationName.overworld_2_region, LocationName.kong_cave_region) connect(world, world.player, names, LocationName.overworld_2_region, LocationName.kong_cave_region)
connect(world, player, names, LocationName.overworld_2_region, LocationName.bramble_region) connect(world, world.player, names, LocationName.overworld_2_region, LocationName.bramble_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.k3_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.k3_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.razor_ridge_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.razor_ridge_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.kaos_kore_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.kaos_kore_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.krematoa_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.krematoa_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.undercover_cove_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.undercover_cove_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.flower_spot_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.flower_spot_region)
connect(world, player, names, LocationName.overworld_3_region, LocationName.barter_region) connect(world, world.player, names, LocationName.overworld_3_region, LocationName.barter_region)
connect(world, player, names, LocationName.overworld_4_region, LocationName.belchas_burrow_region) connect(world, world.player, names, LocationName.overworld_4_region, LocationName.belchas_burrow_region)
connect(world, player, names, LocationName.overworld_4_region, LocationName.ks_cache_region) connect(world, world.player, names, LocationName.overworld_4_region, LocationName.ks_cache_region)
connect(world, player, names, LocationName.overworld_4_region, LocationName.hill_top_hoard_region) connect(world, world.player, names, LocationName.overworld_4_region, LocationName.hill_top_hoard_region)
# Lake Orangatanga Connections # Lake Orangatanga Connections
@ -786,7 +787,7 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(lake_orangatanga_levels)): for i in range(0, len(lake_orangatanga_levels)):
connect(world, player, names, LocationName.lake_orangatanga_region, lake_orangatanga_levels[i]) connect(world, world.player, names, LocationName.lake_orangatanga_region, lake_orangatanga_levels[i])
# Kremwood Forest Connections # Kremwood Forest Connections
kremwood_forest_levels = [ kremwood_forest_levels = [
@ -800,10 +801,10 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(kremwood_forest_levels) - 1): for i in range(0, len(kremwood_forest_levels) - 1):
connect(world, player, names, LocationName.kremwood_forest_region, kremwood_forest_levels[i]) connect(world, world.player, names, LocationName.kremwood_forest_region, kremwood_forest_levels[i])
connect(world, player, names, LocationName.kremwood_forest_region, kremwood_forest_levels[-1], connect(world, world.player, names, LocationName.kremwood_forest_region, kremwood_forest_levels[-1],
lambda state: (state.can_reach(LocationName.riverside_race_flag, "Location", player))) lambda state: (state.can_reach(LocationName.riverside_race_flag, "Location", world.player)))
# Cotton-Top Cove Connections # Cotton-Top Cove Connections
cotton_top_cove_levels = [ cotton_top_cove_levels = [
@ -818,7 +819,7 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(cotton_top_cove_levels)): for i in range(0, len(cotton_top_cove_levels)):
connect(world, player, names, LocationName.cotton_top_cove_region, cotton_top_cove_levels[i]) connect(world, world.player, names, LocationName.cotton_top_cove_region, cotton_top_cove_levels[i])
# Mekanos Connections # Mekanos Connections
mekanos_levels = [ mekanos_levels = [
@ -831,14 +832,14 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(mekanos_levels)): for i in range(0, len(mekanos_levels)):
connect(world, player, names, LocationName.mekanos_region, mekanos_levels[i]) connect(world, world.player, names, LocationName.mekanos_region, mekanos_levels[i])
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
connect(world, player, names, LocationName.mekanos_region, LocationName.sky_high_secret_region, connect(world, world.player, names, LocationName.mekanos_region, LocationName.sky_high_secret_region,
lambda state: (state.has(ItemName.bowling_ball, player, 1))) lambda state: (state.has(ItemName.bowling_ball, world.player, 1)))
else: else:
connect(world, player, names, LocationName.mekanos_region, LocationName.sky_high_secret_region, connect(world, world.player, names, LocationName.mekanos_region, LocationName.sky_high_secret_region,
lambda state: (state.can_reach(LocationName.bleaks_house, "Location", player))) lambda state: (state.can_reach(LocationName.bleaks_house, "Location", world.player)))
# K3 Connections # K3 Connections
k3_levels = [ k3_levels = [
@ -853,7 +854,7 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(k3_levels)): for i in range(0, len(k3_levels)):
connect(world, player, names, LocationName.k3_region, k3_levels[i]) connect(world, world.player, names, LocationName.k3_region, k3_levels[i])
# Razor Ridge Connections # Razor Ridge Connections
razor_ridge_levels = [ razor_ridge_levels = [
@ -866,13 +867,13 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(razor_ridge_levels)): for i in range(0, len(razor_ridge_levels)):
connect(world, player, names, LocationName.razor_ridge_region, razor_ridge_levels[i]) connect(world, world.player, names, LocationName.razor_ridge_region, razor_ridge_levels[i])
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
connect(world, player, names, LocationName.razor_ridge_region, LocationName.cifftop_cache_region, connect(world, world.player, names, LocationName.razor_ridge_region, LocationName.cifftop_cache_region,
lambda state: (state.has(ItemName.wrench, player, 1))) lambda state: (state.has(ItemName.wrench, world.player, 1)))
else: else:
connect(world, player, names, LocationName.razor_ridge_region, LocationName.cifftop_cache_region) connect(world, world.player, names, LocationName.razor_ridge_region, LocationName.cifftop_cache_region)
# KAOS Kore Connections # KAOS Kore Connections
kaos_kore_levels = [ kaos_kore_levels = [
@ -885,7 +886,7 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(kaos_kore_levels)): for i in range(0, len(kaos_kore_levels)):
connect(world, player, names, LocationName.kaos_kore_region, kaos_kore_levels[i]) connect(world, world.player, names, LocationName.kaos_kore_region, kaos_kore_levels[i])
# Krematoa Connections # Krematoa Connections
krematoa_levels = [ krematoa_levels = [
@ -897,22 +898,22 @@ def connect_regions(world, player, level_list):
] ]
for i in range(0, len(krematoa_levels)): for i in range(0, len(krematoa_levels)):
connect(world, player, names, LocationName.krematoa_region, krematoa_levels[i], connect(world, world.player, names, LocationName.krematoa_region, krematoa_levels[i],
lambda state, i=i: (state.has(ItemName.bonus_coin, player, world.krematoa_bonus_coin_cost[player].value * (i+1)))) lambda state, i=i: (state.has(ItemName.bonus_coin, world.player, world.options.krematoa_bonus_coin_cost.value * (i+1))))
if world.goal[player] == "knautilus": if world.options.goal == "knautilus":
connect(world, player, names, LocationName.kaos_kore_region, LocationName.knautilus_region) connect(world, world.player, names, LocationName.kaos_kore_region, LocationName.knautilus_region)
connect(world, player, names, LocationName.krematoa_region, LocationName.kastle_kaos_region, connect(world, world.player, names, LocationName.krematoa_region, LocationName.kastle_kaos_region,
lambda state: (state.has(ItemName.krematoa_cog, player, 5))) lambda state: (state.has(ItemName.krematoa_cog, world.player, 5)))
else: else:
connect(world, player, names, LocationName.kaos_kore_region, LocationName.kastle_kaos_region) connect(world, world.player, names, LocationName.kaos_kore_region, LocationName.kastle_kaos_region)
connect(world, player, names, LocationName.krematoa_region, LocationName.knautilus_region, connect(world, world.player, names, LocationName.krematoa_region, LocationName.knautilus_region,
lambda state: (state.has(ItemName.krematoa_cog, player, 5))) lambda state: (state.has(ItemName.krematoa_cog, world.player, 5)))
def create_region(world: MultiWorld, player: int, active_locations, name: str, locations=None): def create_region(world: World, active_locations, name: str, locations=None):
# Shamelessly stolen from the ROR2 definition # Shamelessly stolen from the ROR2 definition
ret = Region(name, player, world) ret = Region(name, world.player, world.multiworld)
if locations: if locations:
for locationName, locationData in locations.items(): for locationName, locationData in locations.items():
loc_id = active_locations.get(locationName, 0) loc_id = active_locations.get(locationName, 0)
@ -921,16 +922,16 @@ def create_region(world: MultiWorld, player: int, active_locations, name: str, l
loc_bit = locationData[1] if (len(locationData) > 1) else 0 loc_bit = locationData[1] if (len(locationData) > 1) else 0
loc_invert = locationData[2] if (len(locationData) > 2) else False loc_invert = locationData[2] if (len(locationData) > 2) else False
location = DKC3Location(player, locationName, loc_id, ret, loc_byte, loc_bit, loc_invert) location = DKC3Location(world.player, locationName, loc_id, ret, loc_byte, loc_bit, loc_invert)
ret.locations.append(location) ret.locations.append(location)
return ret return ret
def connect(world: MultiWorld, player: int, used_names: typing.Dict[str, int], source: str, target: str, def connect(world: World, player: int, used_names: typing.Dict[str, int], source: str, target: str,
rule: typing.Optional[typing.Callable] = None): rule: typing.Optional[typing.Callable] = None):
source_region = world.get_region(source, player) source_region = world.multiworld.get_region(source, player)
target_region = world.get_region(target, player) target_region = world.multiworld.get_region(target, player)
if target not in used_names: if target not in used_names:
used_names[target] = 1 used_names[target] = 1

View File

@ -1,5 +1,6 @@
import Utils import Utils
from Utils import read_snes_rom from Utils import read_snes_rom
from worlds.AutoWorld import World
from worlds.Files import APDeltaPatch from worlds.Files import APDeltaPatch
from .Locations import lookup_id_to_name, all_locations from .Locations import lookup_id_to_name, all_locations
from .Levels import level_list, level_dict from .Levels import level_list, level_dict
@ -475,11 +476,10 @@ class LocalRom(object):
def patch_rom(world, rom, player, active_level_list): def patch_rom(world: World, rom: LocalRom, active_level_list):
local_random = world.per_slot_randoms[player]
# Boomer Costs # Boomer Costs
bonus_coin_cost = world.krematoa_bonus_coin_cost[player] bonus_coin_cost = world.options.krematoa_bonus_coin_cost
inverted_bonus_coin_cost = 0x100 - bonus_coin_cost inverted_bonus_coin_cost = 0x100 - bonus_coin_cost
rom.write_byte(0x3498B9, inverted_bonus_coin_cost) rom.write_byte(0x3498B9, inverted_bonus_coin_cost)
rom.write_byte(0x3498BA, inverted_bonus_coin_cost) rom.write_byte(0x3498BA, inverted_bonus_coin_cost)
@ -491,7 +491,7 @@ def patch_rom(world, rom, player, active_level_list):
rom.write_byte(0x349862, bonus_coin_cost) rom.write_byte(0x349862, bonus_coin_cost)
# Gyrocopter Costs # Gyrocopter Costs
dk_coin_cost = world.dk_coins_for_gyrocopter[player] dk_coin_cost = world.options.dk_coins_for_gyrocopter
rom.write_byte(0x3484A6, dk_coin_cost) rom.write_byte(0x3484A6, dk_coin_cost)
rom.write_byte(0x3484D5, dk_coin_cost) rom.write_byte(0x3484D5, dk_coin_cost)
rom.write_byte(0x3484D7, 0x90) rom.write_byte(0x3484D7, 0x90)
@ -508,8 +508,8 @@ def patch_rom(world, rom, player, active_level_list):
rom.write_bytes(0x34ACD0, bytearray([0xEA, 0xEA])) rom.write_bytes(0x34ACD0, bytearray([0xEA, 0xEA]))
# Banana Bird Costs # Banana Bird Costs
if world.goal[player] == "banana_bird_hunt": if world.options.goal == "banana_bird_hunt":
banana_bird_cost = math.floor(world.number_of_banana_birds[player] * world.percentage_of_banana_birds[player] / 100.0) banana_bird_cost = math.floor(world.options.number_of_banana_birds * world.options.percentage_of_banana_birds / 100.0)
rom.write_byte(0x34AB85, banana_bird_cost) rom.write_byte(0x34AB85, banana_bird_cost)
rom.write_byte(0x329FD8, banana_bird_cost) rom.write_byte(0x329FD8, banana_bird_cost)
rom.write_byte(0x32A025, banana_bird_cost) rom.write_byte(0x32A025, banana_bird_cost)
@ -528,65 +528,65 @@ def patch_rom(world, rom, player, active_level_list):
# Palette Swap # Palette Swap
rom.write_byte(0x3B96A5, 0xD0) rom.write_byte(0x3B96A5, 0xD0)
if world.kong_palette_swap[player] == "default": if world.options.kong_palette_swap == "default":
rom.write_byte(0x3B96A9, 0x00) rom.write_byte(0x3B96A9, 0x00)
rom.write_byte(0x3B96A8, 0x00) rom.write_byte(0x3B96A8, 0x00)
elif world.kong_palette_swap[player] == "purple": elif world.options.kong_palette_swap == "purple":
rom.write_byte(0x3B96A9, 0x00) rom.write_byte(0x3B96A9, 0x00)
rom.write_byte(0x3B96A8, 0x3C) rom.write_byte(0x3B96A8, 0x3C)
elif world.kong_palette_swap[player] == "spooky": elif world.options.kong_palette_swap == "spooky":
rom.write_byte(0x3B96A9, 0x00) rom.write_byte(0x3B96A9, 0x00)
rom.write_byte(0x3B96A8, 0xA0) rom.write_byte(0x3B96A8, 0xA0)
elif world.kong_palette_swap[player] == "dark": elif world.options.kong_palette_swap == "dark":
rom.write_byte(0x3B96A9, 0x05) rom.write_byte(0x3B96A9, 0x05)
rom.write_byte(0x3B96A8, 0xA0) rom.write_byte(0x3B96A8, 0xA0)
elif world.kong_palette_swap[player] == "chocolate": elif world.options.kong_palette_swap == "chocolate":
rom.write_byte(0x3B96A9, 0x1D) rom.write_byte(0x3B96A9, 0x1D)
rom.write_byte(0x3B96A8, 0xA0) rom.write_byte(0x3B96A8, 0xA0)
elif world.kong_palette_swap[player] == "shadow": elif world.options.kong_palette_swap == "shadow":
rom.write_byte(0x3B96A9, 0x45) rom.write_byte(0x3B96A9, 0x45)
rom.write_byte(0x3B96A8, 0xA0) rom.write_byte(0x3B96A8, 0xA0)
elif world.kong_palette_swap[player] == "red_gold": elif world.options.kong_palette_swap == "red_gold":
rom.write_byte(0x3B96A9, 0x5D) rom.write_byte(0x3B96A9, 0x5D)
rom.write_byte(0x3B96A8, 0xA0) rom.write_byte(0x3B96A8, 0xA0)
elif world.kong_palette_swap[player] == "gbc": elif world.options.kong_palette_swap == "gbc":
rom.write_byte(0x3B96A9, 0x20) rom.write_byte(0x3B96A9, 0x20)
rom.write_byte(0x3B96A8, 0x3C) rom.write_byte(0x3B96A8, 0x3C)
elif world.kong_palette_swap[player] == "halloween": elif world.options.kong_palette_swap == "halloween":
rom.write_byte(0x3B96A9, 0x70) rom.write_byte(0x3B96A9, 0x70)
rom.write_byte(0x3B96A8, 0x3C) rom.write_byte(0x3B96A8, 0x3C)
if world.music_shuffle[player]: if world.options.music_shuffle:
for address in music_rom_data: for address in music_rom_data:
rand_song = local_random.choice(level_music_ids) rand_song = world.random.choice(level_music_ids)
rom.write_byte(address, rand_song) rom.write_byte(address, rand_song)
# Starting Lives # Starting Lives
rom.write_byte(0x9130, world.starting_life_count[player].value) rom.write_byte(0x9130, world.options.starting_life_count.value)
rom.write_byte(0x913B, world.starting_life_count[player].value) rom.write_byte(0x913B, world.options.starting_life_count.value)
# Cheat options # Cheat options
cheat_bytes = [0x00, 0x00] cheat_bytes = [0x00, 0x00]
if world.merry[player]: if world.options.merry:
cheat_bytes[0] |= 0x01 cheat_bytes[0] |= 0x01
if world.autosave[player]: if world.options.autosave:
cheat_bytes[0] |= 0x02 cheat_bytes[0] |= 0x02
if world.difficulty[player] == "tufst": if world.options.difficulty == "tufst":
cheat_bytes[0] |= 0x80 cheat_bytes[0] |= 0x80
cheat_bytes[1] |= 0x80 cheat_bytes[1] |= 0x80
elif world.difficulty[player] == "hardr": elif world.options.difficulty == "hardr":
cheat_bytes[0] |= 0x00 cheat_bytes[0] |= 0x00
cheat_bytes[1] |= 0x00 cheat_bytes[1] |= 0x00
elif world.difficulty[player] == "norml": elif world.options.difficulty == "norml":
cheat_bytes[1] |= 0x40 cheat_bytes[1] |= 0x40
rom.write_bytes(0x8303, bytearray(cheat_bytes)) rom.write_bytes(0x8303, bytearray(cheat_bytes))
# Handle Level Shuffle Here # Handle Level Shuffle Here
if world.level_shuffle[player]: if world.options.level_shuffle:
for i in range(len(active_level_list)): for i in range(len(active_level_list)):
rom.write_byte(level_dict[level_list[i]].nameIDAddress, level_dict[active_level_list[i]].nameID) rom.write_byte(level_dict[level_list[i]].nameIDAddress, level_dict[active_level_list[i]].nameID)
rom.write_byte(level_dict[level_list[i]].levelIDAddress, level_dict[active_level_list[i]].levelID) rom.write_byte(level_dict[level_list[i]].levelIDAddress, level_dict[active_level_list[i]].levelID)
@ -611,7 +611,7 @@ def patch_rom(world, rom, player, active_level_list):
rom.write_byte(0x34C213, (0x32 + level_dict[active_level_list[25]].levelID)) rom.write_byte(0x34C213, (0x32 + level_dict[active_level_list[25]].levelID))
rom.write_byte(0x34C21B, (0x32 + level_dict[active_level_list[26]].levelID)) rom.write_byte(0x34C21B, (0x32 + level_dict[active_level_list[26]].levelID))
if world.goal[player] == "knautilus": if world.options.goal == "knautilus":
# Swap Kastle KAOS and Knautilus # Swap Kastle KAOS and Knautilus
rom.write_byte(0x34D4E1, 0xC2) rom.write_byte(0x34D4E1, 0xC2)
rom.write_byte(0x34D4E2, 0x24) rom.write_byte(0x34D4E2, 0x24)
@ -621,7 +621,7 @@ def patch_rom(world, rom, player, active_level_list):
rom.write_byte(0x32F339, 0x55) rom.write_byte(0x32F339, 0x55)
# Handle KONGsanity Here # Handle KONGsanity Here
if world.kongsanity[player]: if world.options.kongsanity:
# Arich's Hoard KONGsanity fix # Arich's Hoard KONGsanity fix
rom.write_bytes(0x34BA8C, bytearray([0xEA, 0xEA])) rom.write_bytes(0x34BA8C, bytearray([0xEA, 0xEA]))
@ -668,7 +668,7 @@ def patch_rom(world, rom, player, active_level_list):
rom.write_bytes(0x32A5EE, bytearray([0x00, 0x03, 0x50, 0x4F, 0x52, 0x59, 0x47, 0x4F, 0x4E, 0xC5])) # "PORYGONE" rom.write_bytes(0x32A5EE, bytearray([0x00, 0x03, 0x50, 0x4F, 0x52, 0x59, 0x47, 0x4F, 0x4E, 0xC5])) # "PORYGONE"
from Utils import __version__ from Utils import __version__
rom.name = bytearray(f'D3{__version__.replace(".", "")[0:3]}_{player}_{world.seed:11}\0', 'utf8')[:21] rom.name = bytearray(f'D3{__version__.replace(".", "")[0:3]}_{world.player}_{world.multiworld.seed:11}\0', 'utf8')[:21]
rom.name.extend([0] * (21 - len(rom.name))) rom.name.extend([0] * (21 - len(rom.name)))
rom.write_bytes(0x7FC0, rom.name) rom.write_bytes(0x7FC0, rom.name)

View File

@ -1,32 +1,31 @@
import math import math
from BaseClasses import MultiWorld
from .Names import LocationName, ItemName from .Names import LocationName, ItemName
from worlds.AutoWorld import LogicMixin from worlds.AutoWorld import LogicMixin, World
from worlds.generic.Rules import add_rule, set_rule from worlds.generic.Rules import add_rule, set_rule
def set_rules(world: MultiWorld, player: int): def set_rules(world: World):
if False:#world.include_trade_sequence[player]: if False:#world.options.include_trade_sequence:
add_rule(world.get_location(LocationName.barnacles_island, player), add_rule(world.multiworld.get_location(LocationName.barnacles_island, world.player),
lambda state: state.has(ItemName.shell, player)) lambda state: state.has(ItemName.shell, world.player))
add_rule(world.get_location(LocationName.blues_beach_hut, player), add_rule(world.multiworld.get_location(LocationName.blues_beach_hut, world.player),
lambda state: state.has(ItemName.present, player)) lambda state: state.has(ItemName.present, world.player))
add_rule(world.get_location(LocationName.brambles_bungalow, player), add_rule(world.multiworld.get_location(LocationName.brambles_bungalow, world.player),
lambda state: state.has(ItemName.flower, player)) lambda state: state.has(ItemName.flower, world.player))
add_rule(world.get_location(LocationName.barters_swap_shop, player), add_rule(world.multiworld.get_location(LocationName.barters_swap_shop, world.player),
lambda state: state.has(ItemName.mirror, player)) lambda state: state.has(ItemName.mirror, world.player))
if world.goal[player] != "knautilus": if world.options.goal != "knautilus":
required_banana_birds = math.floor( required_banana_birds = math.floor(
world.number_of_banana_birds[player].value * (world.percentage_of_banana_birds[player].value / 100.0)) world.options.number_of_banana_birds.value * (world.options.percentage_of_banana_birds.value / 100.0))
add_rule(world.get_location(LocationName.banana_bird_mother, player), add_rule(world.multiworld.get_location(LocationName.banana_bird_mother, world.player),
lambda state: state.has(ItemName.banana_bird, player, required_banana_birds)) lambda state: state.has(ItemName.banana_bird, world.player, required_banana_birds))
world.completion_condition[player] = lambda state: state.has(ItemName.victory, player) world.multiworld.completion_condition[world.player] = lambda state: state.has(ItemName.victory, world.player)

View File

@ -1,3 +1,4 @@
import dataclasses
import os import os
import typing import typing
import math import math
@ -5,9 +6,10 @@ import threading
import settings import settings
from BaseClasses import Item, MultiWorld, Tutorial, ItemClassification from BaseClasses import Item, MultiWorld, Tutorial, ItemClassification
from Options import PerGameCommonOptions
from .Items import DKC3Item, ItemData, item_table, inventory_table, junk_table from .Items import DKC3Item, ItemData, item_table, inventory_table, junk_table
from .Locations import DKC3Location, all_locations, setup_locations from .Locations import DKC3Location, all_locations, setup_locations
from .Options import dkc3_options from .Options import DKC3Options
from .Regions import create_regions, connect_regions from .Regions import create_regions, connect_regions
from .Levels import level_list from .Levels import level_list
from .Rules import set_rules from .Rules import set_rules
@ -50,8 +52,11 @@ class DKC3World(World):
mystery of why Donkey Kong and Diddy disappeared while on vacation. mystery of why Donkey Kong and Diddy disappeared while on vacation.
""" """
game: str = "Donkey Kong Country 3" game: str = "Donkey Kong Country 3"
option_definitions = dkc3_options
settings: typing.ClassVar[DK3Settings] settings: typing.ClassVar[DK3Settings]
options_dataclass = DKC3Options
options: DKC3Options
topology_present = False topology_present = False
data_version = 2 data_version = 2
#hint_blacklist = {LocationName.rocket_rush_flag} #hint_blacklist = {LocationName.rocket_rush_flag}
@ -74,24 +79,25 @@ class DKC3World(World):
def _get_slot_data(self): def _get_slot_data(self):
return { return {
#"death_link": self.world.death_link[self.player].value, #"death_link": self.options.death_link.value,
"active_levels": self.active_level_list, "active_levels": self.active_level_list,
} }
def fill_slot_data(self) -> dict: def fill_slot_data(self) -> dict:
slot_data = self._get_slot_data() slot_data = self._get_slot_data()
for option_name in dkc3_options: for option_name in (attr.name for attr in dataclasses.fields(DKC3Options)
option = getattr(self.multiworld, option_name)[self.player] if attr not in dataclasses.fields(PerGameCommonOptions)):
option = getattr(self.options, option_name)
slot_data[option_name] = option.value slot_data[option_name] = option.value
return slot_data return slot_data
def create_regions(self): def create_regions(self):
location_table = setup_locations(self.multiworld, self.player) location_table = setup_locations(self)
create_regions(self.multiworld, self.player, location_table) create_regions(self, location_table)
# Not generate basic # Not generate basic
self.topology_present = self.multiworld.level_shuffle[self.player].value self.topology_present = self.options.level_shuffle.value
itempool: typing.List[DKC3Item] = [] itempool: typing.List[DKC3Item] = []
# Levels # Levels
@ -103,12 +109,12 @@ class DKC3World(World):
number_of_cogs = 4 number_of_cogs = 4
self.multiworld.get_location(LocationName.rocket_rush_flag, self.player).place_locked_item(self.create_item(ItemName.krematoa_cog)) self.multiworld.get_location(LocationName.rocket_rush_flag, self.player).place_locked_item(self.create_item(ItemName.krematoa_cog))
number_of_bosses = 8 number_of_bosses = 8
if self.multiworld.goal[self.player] == "knautilus": if self.options.goal == "knautilus":
self.multiworld.get_location(LocationName.kastle_kaos, self.player).place_locked_item(self.create_item(ItemName.victory)) self.multiworld.get_location(LocationName.kastle_kaos, self.player).place_locked_item(self.create_item(ItemName.victory))
number_of_bosses = 7 number_of_bosses = 7
else: else:
self.multiworld.get_location(LocationName.banana_bird_mother, self.player).place_locked_item(self.create_item(ItemName.victory)) self.multiworld.get_location(LocationName.banana_bird_mother, self.player).place_locked_item(self.create_item(ItemName.victory))
number_of_banana_birds = self.multiworld.number_of_banana_birds[self.player] number_of_banana_birds = self.options.number_of_banana_birds
# Bosses # Bosses
total_required_locations += number_of_bosses total_required_locations += number_of_bosses
@ -116,15 +122,15 @@ class DKC3World(World):
# Secret Caves # Secret Caves
total_required_locations += 13 total_required_locations += 13
if self.multiworld.kongsanity[self.player]: if self.options.kongsanity:
total_required_locations += 39 total_required_locations += 39
## Brothers Bear ## Brothers Bear
if False:#self.world.include_trade_sequence[self.player]: if False:#self.options.include_trade_sequence:
total_required_locations += 10 total_required_locations += 10
number_of_bonus_coins = (self.multiworld.krematoa_bonus_coin_cost[self.player] * 5) number_of_bonus_coins = (self.options.krematoa_bonus_coin_cost * 5)
number_of_bonus_coins += math.ceil((85 - number_of_bonus_coins) * self.multiworld.percentage_of_extra_bonus_coins[self.player] / 100) number_of_bonus_coins += math.ceil((85 - number_of_bonus_coins) * self.options.percentage_of_extra_bonus_coins / 100)
itempool += [self.create_item(ItemName.bonus_coin) for _ in range(number_of_bonus_coins)] itempool += [self.create_item(ItemName.bonus_coin) for _ in range(number_of_bonus_coins)]
itempool += [self.create_item(ItemName.dk_coin) for _ in range(41)] itempool += [self.create_item(ItemName.dk_coin) for _ in range(41)]
@ -142,20 +148,17 @@ class DKC3World(World):
self.active_level_list = level_list.copy() self.active_level_list = level_list.copy()
if self.multiworld.level_shuffle[self.player]: if self.options.level_shuffle:
self.multiworld.random.shuffle(self.active_level_list) self.random.shuffle(self.active_level_list)
connect_regions(self.multiworld, self.player, self.active_level_list) connect_regions(self, self.active_level_list)
self.multiworld.itempool += itempool self.multiworld.itempool += itempool
def generate_output(self, output_directory: str): def generate_output(self, output_directory: str):
try: try:
world = self.multiworld
player = self.player
rom = LocalRom(get_base_rom_path()) rom = LocalRom(get_base_rom_path())
patch_rom(self.multiworld, rom, self.player, self.active_level_list) patch_rom(self, rom, self.active_level_list)
self.active_level_list.append(LocationName.rocket_rush_region) self.active_level_list.append(LocationName.rocket_rush_region)
@ -163,15 +166,15 @@ class DKC3World(World):
rom.write_to_file(rompath) rom.write_to_file(rompath)
self.rom_name = rom.name self.rom_name = rom.name
patch = DKC3DeltaPatch(os.path.splitext(rompath)[0]+DKC3DeltaPatch.patch_file_ending, player=player, patch = DKC3DeltaPatch(os.path.splitext(rompath)[0]+DKC3DeltaPatch.patch_file_ending, player=self.player,
player_name=world.player_name[player], patched_path=rompath) player_name=self.multiworld.player_name[self.player], patched_path=rompath)
patch.write() patch.write()
except: except:
raise raise
finally: finally:
self.rom_name_available_event.set() # make sure threading continues and errors are collected
if os.path.exists(rompath): if os.path.exists(rompath):
os.unlink(rompath) os.unlink(rompath)
self.rom_name_available_event.set() # make sure threading continues and errors are collected
def modify_multidata(self, multidata: dict): def modify_multidata(self, multidata: dict):
import base64 import base64
@ -183,6 +186,7 @@ class DKC3World(World):
new_name = base64.b64encode(bytes(self.rom_name)).decode() new_name = base64.b64encode(bytes(self.rom_name)).decode()
multidata["connect_names"][new_name] = multidata["connect_names"][self.multiworld.player_name[self.player]] multidata["connect_names"][new_name] = multidata["connect_names"][self.multiworld.player_name[self.player]]
def extend_hint_information(self, hint_data: typing.Dict[int, typing.Dict[int, str]]):
if self.topology_present: if self.topology_present:
world_names = [ world_names = [
LocationName.lake_orangatanga_region, LocationName.lake_orangatanga_region,
@ -200,7 +204,8 @@ class DKC3World(World):
level_region = self.multiworld.get_region(self.active_level_list[world_index * 5 + level_index], self.player) level_region = self.multiworld.get_region(self.active_level_list[world_index * 5 + level_index], self.player)
for location in level_region.locations: for location in level_region.locations:
er_hint_data[location.address] = world_names[world_index] er_hint_data[location.address] = world_names[world_index]
multidata['er_hint_data'][self.player] = er_hint_data
hint_data[self.player] = er_hint_data
def create_item(self, name: str, force_non_progression=False) -> Item: def create_item(self, name: str, force_non_progression=False) -> Item:
data = item_table[name] data = item_table[name]
@ -220,4 +225,4 @@ class DKC3World(World):
return self.multiworld.random.choice(list(junk_table.keys())) return self.multiworld.random.choice(list(junk_table.keys()))
def set_rules(self): def set_rules(self):
set_rules(self.multiworld, self.player) set_rules(self)