Skip to content

Commit

Permalink
KDL3: Ensure all abilities accessible on non-minimal (ArchipelagoMW#2929
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Silvris authored Mar 13, 2024
1 parent 72e6383 commit 3e39652
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions worlds/kdl3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def pre_fill(self) -> None:
# randomize copy abilities
valid_abilities = list(copy_ability_access_table.keys())
enemies_to_set = list(self.copy_abilities.keys())
unplaced_abilities = set(key for key in copy_ability_access_table.keys()
if key not in ("No Ability", "Cutter Ability", "Burning Ability"))
# now for the edge cases
for abilities, enemies in enemy_restrictive:
available_enemies = list()
Expand All @@ -143,6 +145,7 @@ def pre_fill(self) -> None:
chosen_ability = self.random.choice(abilities)
self.copy_abilities[chosen_enemy] = chosen_ability
enemies_to_set.remove(chosen_enemy)
unplaced_abilities.discard(chosen_ability)
# two less restrictive ones, we need to ensure Cutter and Burning appear before their required stages
sand_canyon_5 = self.get_region("Sand Canyon 5 - 9")
# this is primarily for typing, but if this ever hits it's fine to crash
Expand All @@ -160,6 +163,13 @@ def pre_fill(self) -> None:
if burning_enemy:
self.copy_abilities[burning_enemy] = "Burning Ability"
enemies_to_set.remove(burning_enemy)
# ensure we place one of every ability
if unplaced_abilities and self.options.accessibility != self.options.accessibility.option_minimal:
# failsafe, on non-minimal we need to guarantee every copy ability exists
for ability in sorted(unplaced_abilities):
enemy = self.random.choice(enemies_to_set)
self.copy_abilities[enemy] = ability
enemies_to_set.remove(enemy)
# place remaining
for enemy in enemies_to_set:
self.copy_abilities[enemy] = self.random.choice(valid_abilities)
Expand Down Expand Up @@ -283,6 +293,8 @@ def generate_basic(self) -> None:
self.boss_butch_bosses = [True for _ in range(6)]
else:
self.boss_butch_bosses = [self.random.choice([True, False]) for _ in range(6)]
else:
self.boss_butch_bosses = [False for _ in range(6)]

def generate_output(self, output_directory: str):
rom_path = ""
Expand Down

0 comments on commit 3e39652

Please sign in to comment.