Skip to content

Commit

Permalink
More stuff from review
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieCat45 committed Mar 26, 2024
1 parent 67e8f62 commit e53e75d
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 258 deletions.
18 changes: 9 additions & 9 deletions worlds/ahit/DeathWishLocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@
def create_dw_regions(world: "HatInTimeWorld"):
if world.options.DWExcludeAnnoyingContracts.value > 0:
for name in annoying_dws:
world.get_excluded_dws().append(name)
world.excluded_dws.append(name)

if world.options.DWEnableBonus.value == 0 \
or world.options.DWAutoCompleteBonuses.value > 0:
for name in death_wishes:
world.get_excluded_bonuses().append(name)
world.excluded_bonuses.append(name)
elif world.options.DWExcludeAnnoyingBonuses.value > 0:
for name in annoying_bonuses:
world.get_excluded_bonuses().append(name)
world.excluded_bonuses.append(name)

if world.options.DWExcludeCandles.value > 0:
for name in dw_candles:
if name in world.get_excluded_dws():
if name in world.excluded_dws:
continue
world.get_excluded_dws().append(name)
world.excluded_dws.append(name)

spaceship = world.multiworld.get_region("Spaceship", world.player)
dw_map: Region = create_region(world, "Death Wish Map")
Expand Down Expand Up @@ -193,7 +193,7 @@ def create_dw_regions(world: "HatInTimeWorld"):

dw_shuffle.append("Seal the Deal")

world.set_dw_shuffle(dw_shuffle)
world.dw_shuffle = dw_shuffle
prev_dw: Region
for i in range(len(dw_shuffle)):
name = dw_shuffle[i]
Expand All @@ -220,7 +220,7 @@ def create_dw_regions(world: "HatInTimeWorld"):
bonus_stamps.place_locked_item(HatInTimeItem(f"2 Stamps - {name}",
ItemClassification.progression, None, world.player))

if name in world.get_excluded_dws():
if name in world.excluded_dws:
main_objective.progress_type = LocationProgressType.EXCLUDED
full_clear.progress_type = LocationProgressType.EXCLUDED
elif world.is_bonus_excluded(name):
Expand All @@ -232,7 +232,7 @@ def create_dw_regions(world: "HatInTimeWorld"):
else:
for key, loc_id in death_wishes.items():
if key == "Snatcher Coins in Nyakuza Metro" and not world.is_dlc2():
world.get_excluded_dws().append(key)
world.excluded_dws.append(key)
continue

dw = create_region(world, key)
Expand All @@ -258,7 +258,7 @@ def create_dw_regions(world: "HatInTimeWorld"):
bonus_stamps.place_locked_item(HatInTimeItem(f"2 Stamps - {key}",
ItemClassification.progression, None, world.player))

if key in world.get_excluded_dws():
if key in world.excluded_dws:
main_objective.progress_type = LocationProgressType.EXCLUDED
full_clear.progress_type = LocationProgressType.EXCLUDED
elif world.is_bonus_excluded(key):
Expand Down
31 changes: 18 additions & 13 deletions worlds/ahit/DeathWishRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@


def set_dw_rules(world: "HatInTimeWorld"):
if "Snatcher's Hit List" not in world.get_excluded_dws() \
or "Camera Tourist" not in world.get_excluded_dws():
if "Snatcher's Hit List" not in world.excluded_dws \
or "Camera Tourist" not in world.excluded_dws:
set_enemy_rules(world)

dw_list: List[str] = []
if world.options.DWShuffle.value > 0:
dw_list = world.get_dw_shuffle()
dw_list = world.dw_shuffle
else:
for name in death_wishes.keys():
dw_list.append(name)
Expand Down Expand Up @@ -196,13 +196,12 @@ def set_dw_rules(world: "HatInTimeWorld"):
add_rule(bonus_stamps, loc.access_rule)

if world.options.DWShuffle.value > 0:
dw_shuffle = world.get_dw_shuffle()
for i in range(len(dw_shuffle)):
for i in range(len(world.dw_shuffle)):
if i == 0:
continue

name = dw_shuffle[i]
prev_dw = world.multiworld.get_region(dw_shuffle[i-1], world.player)
name = world.dw_shuffle[i]
prev_dw = world.multiworld.get_region(world.dw_shuffle[i-1], world.player)
entrance = world.multiworld.get_entrance(f"{prev_dw.name} -> {name}", world.player)
add_rule(entrance, lambda state, n=prev_dw.name: state.has(f"1 Stamp - {n}", world.player))
else:
Expand Down Expand Up @@ -330,10 +329,16 @@ def set_candle_dw_rules(name: str, world: "HatInTimeWorld"):
and state.has("Triple Enemy Picture", world.player))

elif "Snatcher Coins" in name:
coins: List[str] = []
for coin in required_snatcher_coins[name]:
add_rule(main_objective, lambda state: state.has(coin, world.player), "or")
coins.append(coin)
add_rule(full_clear, lambda state: state.has(coin, world.player))

# any coin works for the main objective
add_rule(main_objective, lambda state: state.has(coins[0], world.player)
or state.has(coins[1], world.player)
or state.has(coins[2], world.player))


def get_zero_jump_clear_count(state: CollectionState, world: "HatInTimeWorld") -> int:
total = 0
Expand Down Expand Up @@ -378,7 +383,7 @@ def can_reach_all_bosses(state: CollectionState, world: "HatInTimeWorld") -> boo


def create_enemy_events(world: "HatInTimeWorld"):
no_tourist = "Camera Tourist" in world.get_excluded_dws() or "Camera Tourist" in world.get_excluded_bonuses()
no_tourist = "Camera Tourist" in world.excluded_dws or "Camera Tourist" in world.excluded_bonuses

for enemy, regions in hit_list.items():
if no_tourist and enemy in bosses:
Expand All @@ -395,7 +400,7 @@ def create_enemy_events(world: "HatInTimeWorld"):
if area == "Bluefin Tunnel" and not world.is_dlc2():
continue
if world.options.DWShuffle.value > 0 and area in death_wishes.keys() \
and area not in world.get_dw_shuffle():
and area not in world.dw_shuffle:
continue

region = world.multiworld.get_region(area, world.player)
Expand All @@ -409,7 +414,7 @@ def create_enemy_events(world: "HatInTimeWorld"):
continue

if world.options.DWShuffle.value > 0 and name in death_wishes.keys() \
and name not in world.get_dw_shuffle():
and name not in world.dw_shuffle:
continue

region = world.multiworld.get_region(name, world.player)
Expand All @@ -422,7 +427,7 @@ def create_enemy_events(world: "HatInTimeWorld"):


def set_enemy_rules(world: "HatInTimeWorld"):
no_tourist = "Camera Tourist" in world.get_excluded_dws() or "Camera Tourist" in world.get_excluded_bonuses()
no_tourist = "Camera Tourist" in world.excluded_dws or "Camera Tourist" in world.excluded_bonuses

for enemy, regions in hit_list.items():
if no_tourist and enemy in bosses:
Expand All @@ -440,7 +445,7 @@ def set_enemy_rules(world: "HatInTimeWorld"):
continue

if world.options.DWShuffle.value > 0 and area in death_wishes \
and area not in world.get_dw_shuffle():
and area not in world.dw_shuffle:
continue

event = world.multiworld.get_location(f"{enemy} - {area}", world.player)
Expand Down
2 changes: 1 addition & 1 deletion worlds/ahit/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def calculate_yarn_costs(world: "HatInTimeWorld"):
max_cost = 0
for i in range(5):
cost: int = mw.random.randint(min(min_yarn_cost, max_yarn_cost), max(max_yarn_cost, min_yarn_cost))
world.get_hat_yarn_costs()[HatType(i)] = cost
world.hat_yarn_costs[HatType(i)] = cost
max_cost += cost

available_yarn: int = world.options.YarnAvailable.value
Expand Down
Loading

0 comments on commit e53e75d

Please sign in to comment.