KDL3: RC1 Fixes and Enhancement (#3022)
* fix cloudy park 4 rule, zero deathlink message * remove redundant door_shuffle bool when generic ER gets in, this whole function gets rewritten. So just clean it a little now. * properly fix deathlink messages, fix fill error * update docs
This commit is contained in:
parent
77311719fa
commit
80d7ac4164
|
@ -36,8 +36,10 @@ KDL3_STARS_FLAG = SRAM_1_START + 0x901A
|
||||||
KDL3_GIFTING_FLAG = SRAM_1_START + 0x901C
|
KDL3_GIFTING_FLAG = SRAM_1_START + 0x901C
|
||||||
KDL3_LEVEL_ADDR = SRAM_1_START + 0x9020
|
KDL3_LEVEL_ADDR = SRAM_1_START + 0x9020
|
||||||
KDL3_IS_DEMO = SRAM_1_START + 0x5AD5
|
KDL3_IS_DEMO = SRAM_1_START + 0x5AD5
|
||||||
KDL3_GAME_STATE = SRAM_1_START + 0x36D0
|
|
||||||
KDL3_GAME_SAVE = SRAM_1_START + 0x3617
|
KDL3_GAME_SAVE = SRAM_1_START + 0x3617
|
||||||
|
KDL3_CURRENT_WORLD = SRAM_1_START + 0x363F
|
||||||
|
KDL3_CURRENT_LEVEL = SRAM_1_START + 0x3641
|
||||||
|
KDL3_GAME_STATE = SRAM_1_START + 0x36D0
|
||||||
KDL3_LIFE_COUNT = SRAM_1_START + 0x39CF
|
KDL3_LIFE_COUNT = SRAM_1_START + 0x39CF
|
||||||
KDL3_KIRBY_HP = SRAM_1_START + 0x39D1
|
KDL3_KIRBY_HP = SRAM_1_START + 0x39D1
|
||||||
KDL3_BOSS_HP = SRAM_1_START + 0x39D5
|
KDL3_BOSS_HP = SRAM_1_START + 0x39D5
|
||||||
|
@ -46,8 +48,6 @@ KDL3_LIFE_VISUAL = SRAM_1_START + 0x39E3
|
||||||
KDL3_HEART_STARS = SRAM_1_START + 0x53A7
|
KDL3_HEART_STARS = SRAM_1_START + 0x53A7
|
||||||
KDL3_WORLD_UNLOCK = SRAM_1_START + 0x53CB
|
KDL3_WORLD_UNLOCK = SRAM_1_START + 0x53CB
|
||||||
KDL3_LEVEL_UNLOCK = SRAM_1_START + 0x53CD
|
KDL3_LEVEL_UNLOCK = SRAM_1_START + 0x53CD
|
||||||
KDL3_CURRENT_WORLD = SRAM_1_START + 0x53CF
|
|
||||||
KDL3_CURRENT_LEVEL = SRAM_1_START + 0x53D3
|
|
||||||
KDL3_BOSS_STATUS = SRAM_1_START + 0x53D5
|
KDL3_BOSS_STATUS = SRAM_1_START + 0x53D5
|
||||||
KDL3_INVINCIBILITY_TIMER = SRAM_1_START + 0x54B1
|
KDL3_INVINCIBILITY_TIMER = SRAM_1_START + 0x54B1
|
||||||
KDL3_MG5_STATUS = SRAM_1_START + 0x5EE4
|
KDL3_MG5_STATUS = SRAM_1_START + 0x5EE4
|
||||||
|
@ -74,7 +74,9 @@ deathlink_messages = defaultdict(lambda: " was defeated.", {
|
||||||
0x0202: " was out-numbered by Pon & Con.",
|
0x0202: " was out-numbered by Pon & Con.",
|
||||||
0x0203: " was defeated by Ado's powerful paintings.",
|
0x0203: " was defeated by Ado's powerful paintings.",
|
||||||
0x0204: " was clobbered by King Dedede.",
|
0x0204: " was clobbered by King Dedede.",
|
||||||
0x0205: " lost their battle against Dark Matter."
|
0x0205: " lost their battle against Dark Matter.",
|
||||||
|
0x0300: " couldn't overcome the Boss Butch.",
|
||||||
|
0x0400: " is bad at jumping.",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,6 +283,11 @@ class KDL3SNIClient(SNIClient):
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
level_data = await snes_read(ctx, KDL3_LEVEL_ADDR + (14 * i), 14)
|
level_data = await snes_read(ctx, KDL3_LEVEL_ADDR + (14 * i), 14)
|
||||||
self.levels[i] = unpack("HHHHHHH", level_data)
|
self.levels[i] = unpack("HHHHHHH", level_data)
|
||||||
|
self.levels[5] = [0x0205, # Hyper Zone
|
||||||
|
0, # MG-5, can't send from here
|
||||||
|
0x0300, # Boss Butch
|
||||||
|
0x0400, # Jumping
|
||||||
|
0, 0, 0]
|
||||||
|
|
||||||
if self.consumables is None:
|
if self.consumables is None:
|
||||||
consumables = await snes_read(ctx, KDL3_CONSUMABLE_FLAG, 1)
|
consumables = await snes_read(ctx, KDL3_CONSUMABLE_FLAG, 1)
|
||||||
|
@ -314,7 +321,7 @@ class KDL3SNIClient(SNIClient):
|
||||||
current_world = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_WORLD, 2))[0]
|
current_world = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_WORLD, 2))[0]
|
||||||
current_level = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_LEVEL, 2))[0]
|
current_level = struct.unpack("H", await snes_read(ctx, KDL3_CURRENT_LEVEL, 2))[0]
|
||||||
currently_dead = current_hp[0] == 0x00
|
currently_dead = current_hp[0] == 0x00
|
||||||
message = deathlink_messages[self.levels[current_world][current_level - 1]]
|
message = deathlink_messages[self.levels[current_world][current_level]]
|
||||||
await ctx.handle_deathlink_state(currently_dead, f"{ctx.player_names[ctx.slot]}{message}")
|
await ctx.handle_deathlink_state(currently_dead, f"{ctx.player_names[ctx.slot]}{message}")
|
||||||
|
|
||||||
recv_count = await snes_read(ctx, KDL3_RECV_COUNT, 2)
|
recv_count = await snes_read(ctx, KDL3_RECV_COUNT, 2)
|
||||||
|
|
|
@ -28,16 +28,30 @@ first_stage_blacklist = {
|
||||||
0x77001C, # 5-4 needs Burning
|
0x77001C, # 5-4 needs Burning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first_world_limit = {
|
||||||
|
# We need to limit the number of very restrictive stages in level 1 on solo gens
|
||||||
|
*first_stage_blacklist, # all three of the blacklist stages need 2+ items for both checks
|
||||||
|
0x770007,
|
||||||
|
0x770008,
|
||||||
|
0x770013,
|
||||||
|
0x77001E,
|
||||||
|
|
||||||
def generate_valid_level(level, stage, possible_stages, slot_random):
|
}
|
||||||
new_stage = slot_random.choice(possible_stages)
|
|
||||||
if level == 1 and stage == 0 and new_stage in first_stage_blacklist:
|
|
||||||
return generate_valid_level(level, stage, possible_stages, slot_random)
|
|
||||||
else:
|
|
||||||
return new_stage
|
|
||||||
|
|
||||||
|
|
||||||
def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing.Dict[int, Region]):
|
def generate_valid_level(world: "KDL3World", level, stage, possible_stages, placed_stages):
|
||||||
|
new_stage = world.random.choice(possible_stages)
|
||||||
|
if level == 1:
|
||||||
|
if stage == 0 and new_stage in first_stage_blacklist:
|
||||||
|
return generate_valid_level(world, level, stage, possible_stages, placed_stages)
|
||||||
|
elif not (world.multiworld.players > 1 or world.options.consumables or world.options.starsanity) and \
|
||||||
|
new_stage in first_world_limit and \
|
||||||
|
sum(p_stage in first_world_limit for p_stage in placed_stages) >= 2:
|
||||||
|
return generate_valid_level(world, level, stage, possible_stages, placed_stages)
|
||||||
|
return new_stage
|
||||||
|
|
||||||
|
|
||||||
|
def generate_rooms(world: "KDL3World", level_regions: typing.Dict[int, Region]):
|
||||||
level_names = {LocationName.level_names[level]: level for level in LocationName.level_names}
|
level_names = {LocationName.level_names[level]: level for level in LocationName.level_names}
|
||||||
room_data = orjson.loads(get_data(__name__, os.path.join("data", "Rooms.json")))
|
room_data = orjson.loads(get_data(__name__, os.path.join("data", "Rooms.json")))
|
||||||
rooms: typing.Dict[str, KDL3Room] = dict()
|
rooms: typing.Dict[str, KDL3Room] = dict()
|
||||||
|
@ -49,8 +63,8 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing
|
||||||
room.add_locations({location: world.location_name_to_id[location] if location in world.location_name_to_id else
|
room.add_locations({location: world.location_name_to_id[location] if location in world.location_name_to_id else
|
||||||
None for location in room_entry["locations"]
|
None for location in room_entry["locations"]
|
||||||
if (not any(x in location for x in ["1-Up", "Maxim"]) or
|
if (not any(x in location for x in ["1-Up", "Maxim"]) or
|
||||||
world.options.consumables.value) and ("Star" not in location
|
world.options.consumables.value) and ("Star" not in location
|
||||||
or world.options.starsanity.value)},
|
or world.options.starsanity.value)},
|
||||||
KDL3Location)
|
KDL3Location)
|
||||||
rooms[room.name] = room
|
rooms[room.name] = room
|
||||||
for location in room.locations:
|
for location in room.locations:
|
||||||
|
@ -62,33 +76,25 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing
|
||||||
world.multiworld.regions.extend(world.rooms)
|
world.multiworld.regions.extend(world.rooms)
|
||||||
|
|
||||||
first_rooms: typing.Dict[int, KDL3Room] = dict()
|
first_rooms: typing.Dict[int, KDL3Room] = dict()
|
||||||
if door_shuffle:
|
for name, room in rooms.items():
|
||||||
# first, we need to generate the notable edge cases
|
if room.room == 0:
|
||||||
# 5-6 is the first, being the most restrictive
|
if room.stage == 7:
|
||||||
# half of its rooms are required to be vanilla, but can be in different orders
|
first_rooms[0x770200 + room.level - 1] = room
|
||||||
# the room before it *must* contain the copy ability required to unlock the room's goal
|
else:
|
||||||
|
first_rooms[0x770000 + ((room.level - 1) * 6) + room.stage] = room
|
||||||
raise NotImplementedError()
|
exits = dict()
|
||||||
else:
|
for def_exit in room.default_exits:
|
||||||
for name, room in rooms.items():
|
target = f"{level_names[room.level]} {room.stage} - {def_exit['room']}"
|
||||||
if room.room == 0:
|
access_rule = tuple(def_exit["access_rule"])
|
||||||
if room.stage == 7:
|
exits[target] = lambda state, rule=access_rule: state.has_all(rule, world.player)
|
||||||
first_rooms[0x770200 + room.level - 1] = room
|
room.add_exits(
|
||||||
else:
|
exits.keys(),
|
||||||
first_rooms[0x770000 + ((room.level - 1) * 6) + room.stage] = room
|
exits
|
||||||
exits = dict()
|
)
|
||||||
for def_exit in room.default_exits:
|
if world.options.open_world:
|
||||||
target = f"{level_names[room.level]} {room.stage} - {def_exit['room']}"
|
if any("Complete" in location.name for location in room.locations):
|
||||||
access_rule = tuple(def_exit["access_rule"])
|
room.add_locations({f"{level_names[room.level]} {room.stage} - Stage Completion": None},
|
||||||
exits[target] = lambda state, rule=access_rule: state.has_all(rule, world.player)
|
KDL3Location)
|
||||||
room.add_exits(
|
|
||||||
exits.keys(),
|
|
||||||
exits
|
|
||||||
)
|
|
||||||
if world.options.open_world:
|
|
||||||
if any("Complete" in location.name for location in room.locations):
|
|
||||||
room.add_locations({f"{level_names[room.level]} {room.stage} - Stage Completion": None},
|
|
||||||
KDL3Location)
|
|
||||||
|
|
||||||
for level in world.player_levels:
|
for level in world.player_levels:
|
||||||
for stage in range(6):
|
for stage in range(6):
|
||||||
|
@ -102,7 +108,7 @@ def generate_rooms(world: "KDL3World", door_shuffle: bool, level_regions: typing
|
||||||
if world.options.open_world or stage == 0:
|
if world.options.open_world or stage == 0:
|
||||||
level_regions[level].add_exits([first_rooms[proper_stage].name])
|
level_regions[level].add_exits([first_rooms[proper_stage].name])
|
||||||
else:
|
else:
|
||||||
world.multiworld.get_location(world.location_id_to_name[world.player_levels[level][stage-1]],
|
world.multiworld.get_location(world.location_id_to_name[world.player_levels[level][stage - 1]],
|
||||||
world.player).parent_region.add_exits([first_rooms[proper_stage].name])
|
world.player).parent_region.add_exits([first_rooms[proper_stage].name])
|
||||||
level_regions[level].add_exits([first_rooms[0x770200 + level - 1].name])
|
level_regions[level].add_exits([first_rooms[0x770200 + level - 1].name])
|
||||||
|
|
||||||
|
@ -141,8 +147,7 @@ def generate_valid_levels(world: "KDL3World", enforce_world: bool, enforce_patte
|
||||||
or (enforce_pattern and ((candidate - 1) & 0x00FFFF) % 6 == stage)
|
or (enforce_pattern and ((candidate - 1) & 0x00FFFF) % 6 == stage)
|
||||||
or (enforce_pattern == enforce_world)
|
or (enforce_pattern == enforce_world)
|
||||||
]
|
]
|
||||||
new_stage = generate_valid_level(level, stage, stage_candidates,
|
new_stage = generate_valid_level(world, level, stage, stage_candidates, levels[level])
|
||||||
world.random)
|
|
||||||
possible_stages.remove(new_stage)
|
possible_stages.remove(new_stage)
|
||||||
levels[level][stage] = new_stage
|
levels[level][stage] = new_stage
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -218,7 +223,7 @@ def create_levels(world: "KDL3World") -> None:
|
||||||
level_shuffle == 1,
|
level_shuffle == 1,
|
||||||
level_shuffle == 2)
|
level_shuffle == 2)
|
||||||
|
|
||||||
generate_rooms(world, False, levels)
|
generate_rooms(world, levels)
|
||||||
|
|
||||||
level6.add_locations({LocationName.goals[world.options.goal]: None}, KDL3Location)
|
level6.add_locations({LocationName.goals[world.options.goal]: None}, KDL3Location)
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ def set_rules(world: "KDL3World") -> None:
|
||||||
for r in [range(1, 31), range(44, 51)]:
|
for r in [range(1, 31), range(44, 51)]:
|
||||||
for i in r:
|
for i in r:
|
||||||
set_rule(world.multiworld.get_location(f"Cloudy Park 4 - Star {i}", world.player),
|
set_rule(world.multiworld.get_location(f"Cloudy Park 4 - Star {i}", world.player),
|
||||||
lambda state: can_reach_clean(state, world.player))
|
lambda state: can_reach_coo(state, world.player))
|
||||||
for i in [18, *list(range(20, 25))]:
|
for i in [18, *list(range(20, 25))]:
|
||||||
set_rule(world.multiworld.get_location(f"Cloudy Park 6 - Star {i}", world.player),
|
set_rule(world.multiworld.get_location(f"Cloudy Park 6 - Star {i}", world.player),
|
||||||
lambda state: can_reach_ice(state, world.player))
|
lambda state: can_reach_ice(state, world.player))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Kirby's Dream Land 3
|
# Kirby's Dream Land 3
|
||||||
|
|
||||||
## Where is the settings page?
|
## Where is the options page?
|
||||||
|
|
||||||
The [player settings page for this game](../player-settings) contains all the options you need to configure and export a
|
The [player options page for this game](../player-options) contains all the options you need to configure and export a
|
||||||
config file.
|
config file.
|
||||||
|
|
||||||
## What does randomization do to this game?
|
## What does randomization do to this game?
|
||||||
|
@ -15,6 +15,7 @@ as Heart Stars, 1-Ups, and Invincibility Candy will be shuffled into the pool fo
|
||||||
- Purifying a boss after acquiring a certain number of Heart Stars
|
- Purifying a boss after acquiring a certain number of Heart Stars
|
||||||
(indicated by their portrait flashing in the level select)
|
(indicated by their portrait flashing in the level select)
|
||||||
- If enabled, 1-Ups and Maxim Tomatoes
|
- If enabled, 1-Ups and Maxim Tomatoes
|
||||||
|
- If enabled, every single Star Piece within a stage
|
||||||
|
|
||||||
## When the player receives an item, what happens?
|
## When the player receives an item, what happens?
|
||||||
A sound effect will play, and Kirby will immediately receive the effects of that item, such as being able to receive Copy Abilities from enemies that
|
A sound effect will play, and Kirby will immediately receive the effects of that item, such as being able to receive Copy Abilities from enemies that
|
||||||
|
|
|
@ -43,8 +43,8 @@ guide: [Basic Multiworld Setup Guide](/tutorial/Archipelago/setup/en)
|
||||||
|
|
||||||
### Where do I get a config file?
|
### Where do I get a config file?
|
||||||
|
|
||||||
The [Player Settings](/games/Kirby's%20Dream%20Land%203/player-settings) page on the website allows you to configure
|
The [Player Options](/games/Kirby's%20Dream%20Land%203/player-options) page on the website allows you to configure
|
||||||
your personal settings and export a config file from them.
|
your personal options and export a config file from them.
|
||||||
|
|
||||||
### Verifying your config file
|
### Verifying your config file
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ If you would like to validate your config file to make sure it works, you may do
|
||||||
|
|
||||||
## Generating a Single-Player Game
|
## Generating a Single-Player Game
|
||||||
|
|
||||||
1. Navigate to the [Player Settings](/games/Kirby's%20Dream%20Land%203/player-settings) page, configure your options,
|
1. Navigate to the [Player Options](/games/Kirby's%20Dream%20Land%203/player-options) page, configure your options,
|
||||||
and click the "Generate Game" button.
|
and click the "Generate Game" button.
|
||||||
2. You will be presented with a "Seed Info" page.
|
2. You will be presented with a "Seed Info" page.
|
||||||
3. Click the "Create New Room" link.
|
3. Click the "Create New Room" link.
|
||||||
|
|
|
@ -33,7 +33,8 @@ class TestLocations(KDL3TestBase):
|
||||||
self.run_location_test(LocationName.iceberg_kogoesou, ["Burning"])
|
self.run_location_test(LocationName.iceberg_kogoesou, ["Burning"])
|
||||||
self.run_location_test(LocationName.iceberg_samus, ["Ice"])
|
self.run_location_test(LocationName.iceberg_samus, ["Ice"])
|
||||||
self.run_location_test(LocationName.iceberg_name, ["Burning", "Coo", "ChuChu"])
|
self.run_location_test(LocationName.iceberg_name, ["Burning", "Coo", "ChuChu"])
|
||||||
self.run_location_test(LocationName.iceberg_angel, ["Cutter", "Burning", "Spark", "Parasol", "Needle", "Clean", "Stone", "Ice"])
|
self.run_location_test(LocationName.iceberg_angel, ["Cutter", "Burning", "Spark", "Parasol", "Needle", "Clean",
|
||||||
|
"Stone", "Ice"])
|
||||||
|
|
||||||
def run_location_test(self, location: str, itempool: typing.List[str]):
|
def run_location_test(self, location: str, itempool: typing.List[str]):
|
||||||
items = itempool.copy()
|
items = itempool.copy()
|
||||||
|
|
Loading…
Reference in New Issue