Skip to content

Commit

Permalink
cleanup + act plando fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieCat45 committed Mar 20, 2024
1 parent 5ef32e3 commit 64dfb29
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 127 deletions.
20 changes: 11 additions & 9 deletions worlds/ahit/DeathWishLocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from .Regions import connect_regions, create_region
from BaseClasses import Region, LocationProgressType, ItemClassification
from worlds.generic.Rules import add_rule
from worlds.AutoWorld import World
from typing import List
from typing import List, TYPE_CHECKING
from .Locations import death_wishes

if TYPE_CHECKING:
from . import HatInTimeWorld


dw_prereqs = {
"So You're Back From Outer Space": ["Beat the Heat"],
Expand Down Expand Up @@ -81,17 +83,17 @@
"So You're Back From Outer Space",
"Encore! Encore!",
"Snatcher's Hit List",
"Vault Codes in the Wind",
"Vault Codes in the Wind",
"10 Seconds until Self-Destruct",
"Killing Two Birds",
"Zero Jumps",
"Boss Rush",
"Boss Rush",
"Bird Sanctuary",
"The Mustache Gauntlet",
"The Mustache Gauntlet",
"Wound-Up Windmill",
"Camera Tourist",
"Rift Collapse: Deep Sea",
"Cruisin' for a Bruisin'",
"Camera Tourist",
"Rift Collapse: Deep Sea",
"Cruisin' for a Bruisin'",
"Seal the Deal",
]

Expand Down Expand Up @@ -144,7 +146,7 @@
}


def create_dw_regions(world: World):
def create_dw_regions(world: "HatInTimeWorld"):
if world.options.DWExcludeAnnoyingContracts.value > 0:
for name in annoying_dws:
world.get_excluded_dws().append(name)
Expand Down
26 changes: 15 additions & 11 deletions worlds/ahit/DeathWishRules.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from worlds.AutoWorld import World, CollectionState
from worlds.AutoWorld import CollectionState
from .Rules import can_use_hat, can_use_hookshot, can_hit, zipline_logic, get_difficulty, has_paintings
from .Types import HatType, Difficulty, HatInTimeLocation, HatInTimeItem, LocData
from .DeathWishLocations import dw_prereqs, dw_candles
from BaseClasses import Entrance, Location, ItemClassification
from worlds.generic.Rules import add_rule, set_rule
from typing import List, Callable
from typing import List, Callable, TYPE_CHECKING
from .Regions import act_chapters
from .Locations import zero_jumps, zero_jumps_expert, zero_jumps_hard, death_wishes

if TYPE_CHECKING:
from . import HatInTimeWorld


# Any speedruns expect the player to have Sprint Hat
dw_requirements = {
"Beat the Heat": LocData(umbrella=True),
Expand Down Expand Up @@ -98,7 +102,7 @@
}


def set_dw_rules(world: World):
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():
set_enemy_rules(world)
Expand Down Expand Up @@ -221,7 +225,7 @@ def set_dw_rules(world: World):
world.player)


def modify_dw_rules(world: World, name: str):
def modify_dw_rules(world: "HatInTimeWorld", name: str):
difficulty: Difficulty = get_difficulty(world)
main_objective = world.multiworld.get_location(f"{name} - Main Objective", world.player)
full_clear = world.multiworld.get_location(f"{name} - All Clear", world.player)
Expand Down Expand Up @@ -267,7 +271,7 @@ def modify_dw_rules(world: World, name: str):
set_candle_dw_rules(name, world)


def get_total_dw_stamps(state: CollectionState, world: World) -> int:
def get_total_dw_stamps(state: CollectionState, world: "HatInTimeWorld") -> int:
if world.options.DWShuffle.value > 0:
return 999 # no stamp costs in death wish shuffle

Expand All @@ -290,7 +294,7 @@ def get_total_dw_stamps(state: CollectionState, world: World) -> int:
return count


def set_candle_dw_rules(name: str, world: World):
def set_candle_dw_rules(name: str, world: "HatInTimeWorld"):
main_objective = world.multiworld.get_location(f"{name} - Main Objective", world.player)
full_clear = world.multiworld.get_location(f"{name} - All Clear", world.player)

Expand Down Expand Up @@ -327,7 +331,7 @@ def set_candle_dw_rules(name: str, world: World):
add_rule(full_clear, lambda state: state.has(coin, world.player))


def get_zero_jump_clear_count(state: CollectionState, world: World) -> int:
def get_zero_jump_clear_count(state: CollectionState, world: "HatInTimeWorld") -> int:
total: int = 0

for name in act_chapters.keys():
Expand All @@ -349,7 +353,7 @@ def get_zero_jump_clear_count(state: CollectionState, world: World) -> int:
return total


def get_reachable_enemy_count(state: CollectionState, world: World) -> int:
def get_reachable_enemy_count(state: CollectionState, world: "HatInTimeWorld") -> int:
count: int = 0
for enemy in hit_list.keys():
if enemy in bosses:
Expand All @@ -361,15 +365,15 @@ def get_reachable_enemy_count(state: CollectionState, world: World) -> int:
return count


def can_reach_all_bosses(state: CollectionState, world: World) -> bool:
def can_reach_all_bosses(state: CollectionState, world: "HatInTimeWorld") -> bool:
for boss in bosses:
if not state.has(boss, world.player):
return False

return True


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

for enemy, regions in hit_list.items():
Expand Down Expand Up @@ -413,7 +417,7 @@ def create_enemy_events(world: World):
add_rule(event, lambda state: can_use_hookshot(state, world) and can_use_hat(state, world, HatType.DWELLER))


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

for enemy, regions in hit_list.items():
Expand Down
18 changes: 10 additions & 8 deletions worlds/ahit/Items.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from BaseClasses import Item, ItemClassification
from worlds.AutoWorld import World
from .Types import HatDLC, HatType, hat_type_to_item, Difficulty, ItemData, HatInTimeItem
from .Locations import get_total_locations
from .Rules import get_difficulty
from typing import Optional, List, Dict
from typing import Optional, List, Dict, TYPE_CHECKING

if TYPE_CHECKING:
from . import HatInTimeWorld

def create_itempool(world: World) -> List[Item]:

def create_itempool(world: "HatInTimeWorld") -> List[Item]:
itempool: List[Item] = []
if not world.is_dw_only() and world.options.HatItems.value == 0:
calculate_yarn_costs(world)
Expand Down Expand Up @@ -87,7 +89,7 @@ def create_itempool(world: World) -> List[Item]:
return itempool


def calculate_yarn_costs(world: World):
def calculate_yarn_costs(world: "HatInTimeWorld"):
mw = world.multiworld
min_yarn_cost = int(min(world.options.YarnCostMin.value, world.options.YarnCostMax.value))
max_yarn_cost = int(max(world.options.YarnCostMin.value, world.options.YarnCostMax.value))
Expand All @@ -107,7 +109,7 @@ def calculate_yarn_costs(world: World):
world.options.YarnAvailable.value += (max_cost + world.options.MinExtraYarn.value) - available_yarn


def item_dlc_enabled(world: World, name: str) -> bool:
def item_dlc_enabled(world: "HatInTimeWorld", name: str) -> bool:
data = item_table[name]

if data.dlc_flags == HatDLC.none:
Expand All @@ -122,12 +124,12 @@ def item_dlc_enabled(world: World, name: str) -> bool:
return False


def create_item(world: World, name: str) -> Item:
def create_item(world: "HatInTimeWorld", name: str) -> Item:
data = item_table[name]
return HatInTimeItem(name, data.classification, data.code, world.player)


def create_multiple_items(world: World, name: str, count: int = 1,
def create_multiple_items(world: "HatInTimeWorld", name: str, count: int = 1,
item_type: Optional[ItemClassification] = ItemClassification.progression) -> List[Item]:

data = item_table[name]
Expand All @@ -139,7 +141,7 @@ def create_multiple_items(world: World, name: str, count: int = 1,
return itemlist


def create_junk_items(world: World, count: int) -> List[Item]:
def create_junk_items(world: "HatInTimeWorld", count: int) -> List[Item]:
trap_chance = world.options.TrapChance.value
junk_pool: List[Item] = []
junk_list: Dict[str, int] = {}
Expand Down
13 changes: 8 additions & 5 deletions worlds/ahit/Locations.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from worlds.AutoWorld import World
from .Types import HatDLC, HatType, LocData, Difficulty
from typing import Dict
from typing import Dict, TYPE_CHECKING
from .Options import TasksanityCheckCount

if TYPE_CHECKING:
from . import HatInTimeWorld

TASKSANITY_START_ID = 2000300204

def get_total_locations(world: World) -> int:

def get_total_locations(world: "HatInTimeWorld") -> int:
total: int = 0

if not world.is_dw_only():
Expand Down Expand Up @@ -34,7 +37,7 @@ def get_total_locations(world: World) -> int:
return total


def location_dlc_enabled(world: World, location: str) -> bool:
def location_dlc_enabled(world: "HatInTimeWorld", location: str) -> bool:
data = location_table.get(location) or event_locs.get(location)

if data.dlc_flags == HatDLC.none:
Expand All @@ -53,7 +56,7 @@ def location_dlc_enabled(world: World, location: str) -> bool:
return False


def is_location_valid(world: World, location: str) -> bool:
def is_location_valid(world: "HatInTimeWorld", location: str) -> bool:
if not location_dlc_enabled(world, location):
return False

Expand Down
15 changes: 9 additions & 6 deletions worlds/ahit/Options.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from typing import List
from typing import List, TYPE_CHECKING
from dataclasses import dataclass
from worlds.AutoWorld import World, PerGameCommonOptions
from worlds.AutoWorld import PerGameCommonOptions
from Options import Range, Toggle, DeathLink, Choice, OptionDict

if TYPE_CHECKING:
from . import HatInTimeWorld


def adjust_options(world: World):
def adjust_options(world: "HatInTimeWorld"):
world.options.HighestChapterCost.value = max(
world.options.HighestChapterCost.value,
world.options.LowestChapterCost.value)
Expand Down Expand Up @@ -81,7 +84,7 @@ def adjust_options(world: World):
world.options.DWTimePieceRequirement.value = 0


def get_total_time_pieces(world: World) -> int:
def get_total_time_pieces(world: "HatInTimeWorld") -> int:
count: int = 40
if world.is_dlc1():
count += 6
Expand Down Expand Up @@ -566,13 +569,13 @@ class DWExcludeAnnoyingBonuses(Toggle):
- Zero Jumps
- Bird Sanctuary
- Wound-Up Windmill
- Vault Codes in the Wind
- Vault Codes in the Wind
- Boss Rush
- Camera Tourist
- The Mustache Gauntlet
- Rift Collapse: Deep Sea
- Cruisin' for a Bruisin'
- Seal the Deal"""
- Seal the Deal"""
display_name = "Exclude Annoying Death Wish Full Completions"
default = 1

Expand Down
Loading

0 comments on commit 64dfb29

Please sign in to comment.