Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TUNIC: Fix combat logic poorly interacting with playthrough #4572

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions worlds/tunic/combat_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ class AreaStats(NamedTuple):
"Rooted Ziggurat": AreaStats(5, 5, 3, 5, 3, 3, 6, ["Sword", "Shield", "Magic"]),
"Boss Scavenger": AreaStats(5, 5, 3, 5, 3, 3, 6, ["Sword", "Shield", "Magic"], is_boss=True),
"Swamp": AreaStats(1, 1, 1, 1, 1, 1, 6, ["Sword", "Shield", "Magic"]),
"Cathedral": AreaStats(1, 1, 1, 1, 1, 1, 6, ["Sword", "Shield", "Magic"]),
# cathedral has the same requirements as Swamp
# marked as boss because the garden knights can't get hurt by stick
"Gauntlet": AreaStats(1, 1, 1, 1, 1, 1, 6, ["Sword", "Shield", "Magic"], is_boss=True),
"The Heir": AreaStats(5, 5, 3, 5, 3, 3, 6, ["Sword", "Shield", "Magic", "Laurels"], is_boss=True),
}


# these are used for caching which areas can currently be reached in state
# Gauntlet does not have exclusively higher stat requirements, so it will be checked separately
boss_areas: List[str] = [name for name, data in area_data.items() if data.is_boss and name != "Gauntlet"]
non_boss_areas: List[str] = [name for name, data in area_data.items() if not data.is_boss]
# Swamp does not have exclusively higher stat requirements, so it will be checked separately
non_boss_areas: List[str] = [name for name, data in area_data.items() if not data.is_boss and name != "Swamp"]


class CombatState(IntEnum):
Expand Down Expand Up @@ -89,6 +91,7 @@ def has_combat_reqs(area_name: str, state: CollectionState, player: int) -> bool
elif area_name in non_boss_areas:
area_list = non_boss_areas
else:
# this is to check Swamp and Gauntlet on their own
area_list = [area_name]

if met_combat_reqs:
Expand All @@ -114,7 +117,7 @@ def check_combat_reqs(area_name: str, state: CollectionState, player: int, alt_d
extra_att_needed = 0
extra_def_needed = 0
extra_mp_needed = 0
has_magic = state.has_any({"Magic Wand", "Gun"}, player)
has_magic = state.has_any(("Magic Wand", "Gun"), player)
stick_bool = False
sword_bool = False
for item in data.equipment:
Expand Down
8 changes: 4 additions & 4 deletions worlds/tunic/er_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,12 +1467,12 @@ def ls_connect(origin_name: str, portal_sdt: str) -> None:
set_rule(cath_entry_to_elev,
lambda state: options.entrance_rando
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or (has_ability(prayer, state, world) and has_combat_reqs("Cathedral", state, player)))
or (has_ability(prayer, state, world) and has_combat_reqs("Swamp", state, player)))

set_rule(cath_entry_to_main,
lambda state: has_combat_reqs("Cathedral", state, player))
lambda state: has_combat_reqs("Swamp", state, player))
set_rule(cath_elev_to_main,
lambda state: has_combat_reqs("Cathedral", state, player))
lambda state: has_combat_reqs("Swamp", state, player))

# for spots where you can go into and come out of an entrance to reset enemy aggro
if world.options.entrance_rando:
Expand Down Expand Up @@ -1927,4 +1927,4 @@ def combat_logic_to_loc(loc_name: str, combat_req_area: str, set_instead: bool =

# zip through the rubble to sneakily grab this chest, or just fight to it
add_rule(world.get_location("Cathedral - [1F] Near Spikes"),
lambda state: laurels_zip(state, world) or has_combat_reqs("Cathedral", state, player))
lambda state: laurels_zip(state, world) or has_combat_reqs("Swamp", state, player))
Loading