starting inventory hats fix

This commit is contained in:
CookieCat
2024-05-15 16:44:02 -04:00
parent 39b102e58a
commit 4027d2f96d
3 changed files with 19 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ from BaseClasses import Item, ItemClassification
from .Types import HatDLC, HatType, hat_type_to_item, Difficulty, ItemData, HatInTimeItem
from .Locations import get_total_locations
from .Rules import get_difficulty
from .Options import get_total_time_pieces
from .Options import get_total_time_pieces, CTRLogic
from typing import List, Dict, TYPE_CHECKING
if TYPE_CHECKING:
@@ -39,10 +39,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
continue
else:
if name == "Scooter Badge":
if world.options.CTRLogic or get_difficulty(world) >= Difficulty.MODERATE:
item_type = ItemClassification.progression
elif name == "No Bonk Badge":
if get_difficulty(world) >= Difficulty.MODERATE:
if world.options.CTRLogic is CTRLogic.option_scooter or get_difficulty(world) >= Difficulty.MODERATE:
item_type = ItemClassification.progression
# some death wish bonuses require one hit hero + hookshot
@@ -58,8 +55,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
if name in alps_hooks.keys() and not world.options.ShuffleAlpineZiplines:
continue
if name == "Progressive Painting Unlock" \
and not world.options.ShuffleSubconPaintings:
if name == "Progressive Painting Unlock" and not world.options.ShuffleSubconPaintings:
continue
if world.options.StartWithCompassBadge and name == "Compass Badge":
@@ -85,14 +81,8 @@ def calculate_yarn_costs(world: "HatInTimeWorld"):
max_cost = 0
for i in range(5):
precollected: bool = False
hat: HatType = HatType(i)
for item in world.multiworld.precollected_items[world.player]:
if item.name == hat_type_to_item[hat]:
precollected = True
break
if not precollected:
if not world.is_hat_precollected(hat):
cost: int = world.random.randint(min_yarn_cost, max_yarn_cost)
world.hat_yarn_costs[hat] = cost
max_cost += cost

View File

@@ -91,10 +91,6 @@ def can_hit(state: CollectionState, world: "HatInTimeWorld", umbrella_only: bool
return state.has("Umbrella", world.player) or not umbrella_only and can_use_hat(state, world, HatType.BREWING)
def can_surf(state: CollectionState, world: "HatInTimeWorld"):
return state.has("No Bonk Badge", world.player)
def has_relic_combo(state: CollectionState, world: "HatInTimeWorld", relic: str) -> bool:
return state.has_group(relic, world.player, len(world.item_name_groups[relic]))

View File

@@ -6,7 +6,7 @@ from .Locations import location_table, contract_locations, is_location_valid, ge
get_total_locations
from .Rules import set_rules
from .Options import AHITOptions, slot_data_options, adjust_options, RandomizeHatOrder, EndGoal
from .Types import HatType, ChapterIndex, HatInTimeItem
from .Types import HatType, ChapterIndex, HatInTimeItem, hat_type_to_item
from .DeathWishLocations import create_dw_regions, dw_classes, death_wishes
from .DeathWishRules import set_dw_rules, create_enemy_events, hit_list, bosses
from worlds.AutoWorld import World, WebWorld, CollectionState
@@ -130,6 +130,13 @@ class HatInTimeWorld(World):
self.hat_craft_order.remove(HatType.TIME_STOP)
self.hat_craft_order.append(HatType.TIME_STOP)
# move precollected hats to the start of the list
for i in range(5):
hat = HatType(i)
if self.is_hat_precollected(hat):
self.hat_craft_order.remove(hat)
self.hat_craft_order.insert(0, hat)
self.multiworld.itempool += create_itempool(self)
def set_rules(self):
@@ -329,6 +336,13 @@ class HatInTimeWorld(World):
def has_yarn(self) -> bool:
return not self.is_dw_only() and not self.options.HatItems
def is_hat_precollected(self, hat: HatType) -> bool:
for item in self.multiworld.precollected_items[self.player]:
if item.name == hat_type_to_item[hat]:
return True
return False
def is_dlc1(self) -> bool:
return bool(self.options.EnableDLC1)