TUNIC: Additional Combat Logic Option (#3658)

This commit is contained in:
Scipio Wright
2024-12-15 16:40:36 -05:00
committed by GitHub
parent 0fdc14bc42
commit 6282efb13c
11 changed files with 1310 additions and 257 deletions

View File

@@ -1,10 +1,11 @@
from typing import Dict, FrozenSet, Tuple, TYPE_CHECKING
from worlds.generic.Rules import set_rule, forbid_item
from .options import IceGrappling, LadderStorage
from .rules import (has_ability, has_sword, has_stick, has_ice_grapple_logic, has_lantern, has_mask, can_ladder_storage,
from worlds.generic.Rules import set_rule, add_rule, forbid_item
from .options import IceGrappling, LadderStorage, CombatLogic
from .rules import (has_ability, has_sword, has_melee, has_ice_grapple_logic, has_lantern, has_mask, can_ladder_storage,
laurels_zip, bomb_walls)
from .er_data import Portal, get_portal_outlet_region
from .ladder_storage_data import ow_ladder_groups, region_ladders, easy_ls, medium_ls, hard_ls
from .combat_logic import has_combat_reqs
from BaseClasses import Region, CollectionState
if TYPE_CHECKING:
@@ -43,6 +44,24 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
player = world.player
options = world.options
# input scene destination tag, returns portal's name and paired portal's outlet region or region
def get_portal_info(portal_sd: str) -> Tuple[str, str]:
for portal1, portal2 in portal_pairs.items():
if portal1.scene_destination() == portal_sd:
return portal1.name, get_portal_outlet_region(portal2, world)
if portal2.scene_destination() == portal_sd:
return portal2.name, get_portal_outlet_region(portal1, world)
raise Exception("No matches found in get_portal_info")
# input scene destination tag, returns paired portal's name and region
def get_paired_portal(portal_sd: str) -> Tuple[str, str]:
for portal1, portal2 in portal_pairs.items():
if portal1.scene_destination() == portal_sd:
return portal2.name, portal2.region
if portal2.scene_destination() == portal_sd:
return portal1.name, portal1.region
raise Exception("no matches found in get_paired_portal")
regions["Menu"].connect(
connecting_region=regions["Overworld"])
@@ -56,10 +75,18 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
connecting_region=regions["Overworld Beach"],
rule=lambda state: has_ladder("Ladders in Overworld Town", state, world)
or state.has_any({laurels, grapple}, player))
# regions["Overworld Beach"].connect(
# connecting_region=regions["Overworld"],
# rule=lambda state: has_ladder("Ladders in Overworld Town", state, world)
# or state.has_any({laurels, grapple}, player))
# region for combat logic, no need to connect it to beach since it would be the same as the ow -> beach cxn
ow_tunnel_beach = regions["Overworld"].connect(
connecting_region=regions["Overworld Tunnel to Beach"])
regions["Overworld Beach"].connect(
connecting_region=regions["Overworld"],
rule=lambda state: has_ladder("Ladders in Overworld Town", state, world)
or state.has_any({laurels, grapple}, player))
connecting_region=regions["Overworld Tunnel to Beach"],
rule=lambda state: state.has(laurels, player) or has_ladder("Ladders in Overworld Town", state, world))
regions["Overworld Beach"].connect(
connecting_region=regions["Overworld West Garden Laurels Entry"],
@@ -277,11 +304,17 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
connecting_region=regions["East Overworld"],
rule=lambda state: state.has(laurels, player))
regions["Overworld"].connect(
# region made for combat logic
ow_to_well_entry = regions["Overworld"].connect(
connecting_region=regions["Overworld Well Entry Area"])
regions["Overworld Well Entry Area"].connect(
connecting_region=regions["Overworld"])
regions["Overworld Well Entry Area"].connect(
connecting_region=regions["Overworld Well Ladder"],
rule=lambda state: has_ladder("Ladders in Well", state, world))
regions["Overworld Well Ladder"].connect(
connecting_region=regions["Overworld"],
connecting_region=regions["Overworld Well Entry Area"],
rule=lambda state: has_ladder("Ladders in Well", state, world))
# nmg: can ice grapple through the door
@@ -306,7 +339,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Overworld Fountain Cross Door"].connect(
connecting_region=regions["Overworld"])
regions["Overworld"].connect(
ow_to_town_portal = regions["Overworld"].connect(
connecting_region=regions["Overworld Town Portal"],
rule=lambda state: has_ability(prayer, state, world))
regions["Overworld Town Portal"].connect(
@@ -337,6 +370,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
rule=lambda state: has_ladder("Ladders in Overworld Town", state, world)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
# don't need the ice grapple rule since you can go from ow -> beach -> tunnel
regions["Overworld"].connect(
connecting_region=regions["Overworld Tunnel Turret"],
rule=lambda state: state.has(laurels, player))
@@ -473,29 +507,28 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
connecting_region=regions["Beneath the Well Ladder Exit"],
rule=lambda state: has_ladder("Ladders in Well", state, world))
regions["Beneath the Well Front"].connect(
btw_front_main = regions["Beneath the Well Front"].connect(
connecting_region=regions["Beneath the Well Main"],
rule=lambda state: has_stick(state, player) or state.has(fire_wand, player))
rule=lambda state: has_melee(state, player) or state.has(fire_wand, player))
regions["Beneath the Well Main"].connect(
connecting_region=regions["Beneath the Well Front"],
rule=lambda state: has_stick(state, player) or state.has(fire_wand, player))
connecting_region=regions["Beneath the Well Front"])
regions["Beneath the Well Main"].connect(
connecting_region=regions["Beneath the Well Back"],
rule=lambda state: has_ladder("Ladders in Well", state, world))
regions["Beneath the Well Back"].connect(
btw_back_main = regions["Beneath the Well Back"].connect(
connecting_region=regions["Beneath the Well Main"],
rule=lambda state: has_ladder("Ladders in Well", state, world)
and (has_stick(state, player) or state.has(fire_wand, player)))
and (has_melee(state, player) or state.has(fire_wand, player)))
regions["Well Boss"].connect(
well_boss_to_dt = regions["Well Boss"].connect(
connecting_region=regions["Dark Tomb Checkpoint"])
# can laurels through the gate, no setup needed
regions["Dark Tomb Checkpoint"].connect(
connecting_region=regions["Well Boss"],
rule=lambda state: laurels_zip(state, world))
regions["Dark Tomb Entry Point"].connect(
dt_entry_to_upper = regions["Dark Tomb Entry Point"].connect(
connecting_region=regions["Dark Tomb Upper"],
rule=lambda state: has_lantern(state, world))
regions["Dark Tomb Upper"].connect(
@@ -512,34 +545,57 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Dark Tomb Main"].connect(
connecting_region=regions["Dark Tomb Dark Exit"])
regions["Dark Tomb Dark Exit"].connect(
dt_exit_to_main = regions["Dark Tomb Dark Exit"].connect(
connecting_region=regions["Dark Tomb Main"],
rule=lambda state: has_lantern(state, world))
# West Garden
# combat logic regions
wg_before_to_after_terry = regions["West Garden before Terry"].connect(
connecting_region=regions["West Garden after Terry"])
wg_after_to_before_terry = regions["West Garden after Terry"].connect(
connecting_region=regions["West Garden before Terry"])
regions["West Garden after Terry"].connect(
connecting_region=regions["West Garden South Checkpoint"])
wg_checkpoint_to_after_terry = regions["West Garden South Checkpoint"].connect(
connecting_region=regions["West Garden after Terry"])
wg_checkpoint_to_dagger = regions["West Garden South Checkpoint"].connect(
connecting_region=regions["West Garden at Dagger House"])
regions["West Garden at Dagger House"].connect(
connecting_region=regions["West Garden South Checkpoint"])
wg_checkpoint_to_before_boss = regions["West Garden South Checkpoint"].connect(
connecting_region=regions["West Garden before Boss"])
regions["West Garden before Boss"].connect(
connecting_region=regions["West Garden South Checkpoint"])
regions["West Garden Laurels Exit Region"].connect(
connecting_region=regions["West Garden"],
connecting_region=regions["West Garden at Dagger House"],
rule=lambda state: state.has(laurels, player))
regions["West Garden"].connect(
regions["West Garden at Dagger House"].connect(
connecting_region=regions["West Garden Laurels Exit Region"],
rule=lambda state: state.has(laurels, player))
# you can grapple Garden Knight to aggro it, then ledge it
regions["West Garden after Boss"].connect(
connecting_region=regions["West Garden"],
# laurels past, or ice grapple it off, or ice grapple to it then fight
after_gk_to_wg = regions["West Garden after Boss"].connect(
connecting_region=regions["West Garden before Boss"],
rule=lambda state: state.has(laurels, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or (has_ice_grapple_logic(False, IceGrappling.option_easy, state, world)
and has_sword(state, player)))
# ice grapple push Garden Knight off the side
regions["West Garden"].connect(
wg_to_after_gk = regions["West Garden before Boss"].connect(
connecting_region=regions["West Garden after Boss"],
rule=lambda state: state.has(laurels, player) or has_sword(state, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
regions["West Garden"].connect(
regions["West Garden before Terry"].connect(
connecting_region=regions["West Garden Hero's Grave Region"],
rule=lambda state: has_ability(prayer, state, world))
regions["West Garden Hero's Grave Region"].connect(
connecting_region=regions["West Garden"])
connecting_region=regions["West Garden before Terry"])
regions["West Garden Portal"].connect(
connecting_region=regions["West Garden by Portal"])
@@ -556,9 +612,9 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
# can ice grapple to and from the item behind the magic dagger house
regions["West Garden Portal Item"].connect(
connecting_region=regions["West Garden"],
connecting_region=regions["West Garden at Dagger House"],
rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
regions["West Garden"].connect(
regions["West Garden at Dagger House"].connect(
connecting_region=regions["West Garden Portal Item"],
rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_medium, state, world))
@@ -596,7 +652,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Ruined Atoll Portal"].connect(
connecting_region=regions["Ruined Atoll"])
regions["Ruined Atoll"].connect(
atoll_statue = regions["Ruined Atoll"].connect(
connecting_region=regions["Ruined Atoll Statue"],
rule=lambda state: has_ability(prayer, state, world)
and (has_ladder("Ladders in South Atoll", state, world)
@@ -629,10 +685,13 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
rule=lambda state: has_ladder("Ladders to Frog's Domain", state, world))
regions["Frog's Domain Entry"].connect(
connecting_region=regions["Frog's Domain"],
connecting_region=regions["Frog's Domain Front"],
rule=lambda state: has_ladder("Ladders to Frog's Domain", state, world))
regions["Frog's Domain"].connect(
frogs_front_to_main = regions["Frog's Domain Front"].connect(
connecting_region=regions["Frog's Domain Main"])
regions["Frog's Domain Main"].connect(
connecting_region=regions["Frog's Domain Back"],
rule=lambda state: state.has(grapple, player))
@@ -752,7 +811,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
rule=lambda state: state.has(laurels, player)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
regions["Fortress Courtyard Upper"].connect(
fort_upper_lower = regions["Fortress Courtyard Upper"].connect(
connecting_region=regions["Fortress Courtyard"])
# nmg: can ice grapple to the upper ledge
regions["Fortress Courtyard"].connect(
@@ -762,12 +821,12 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Fortress Courtyard Upper"].connect(
connecting_region=regions["Fortress Exterior from Overworld"])
regions["Beneath the Vault Ladder Exit"].connect(
btv_front_to_main = regions["Beneath the Vault Ladder Exit"].connect(
connecting_region=regions["Beneath the Vault Main"],
rule=lambda state: has_ladder("Ladder to Beneath the Vault", state, world)
and has_lantern(state, world)
# there's some boxes in the way
and (has_stick(state, player) or state.has_any((gun, grapple, fire_wand, laurels), player)))
and (has_melee(state, player) or state.has_any((gun, grapple, fire_wand, laurels), player)))
# on the reverse trip, you can lure an enemy over to break the boxes if needed
regions["Beneath the Vault Main"].connect(
connecting_region=regions["Beneath the Vault Ladder Exit"],
@@ -775,11 +834,11 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Beneath the Vault Main"].connect(
connecting_region=regions["Beneath the Vault Back"])
regions["Beneath the Vault Back"].connect(
btv_back_to_main = regions["Beneath the Vault Back"].connect(
connecting_region=regions["Beneath the Vault Main"],
rule=lambda state: has_lantern(state, world))
regions["Fortress East Shortcut Upper"].connect(
fort_east_upper_lower = regions["Fortress East Shortcut Upper"].connect(
connecting_region=regions["Fortress East Shortcut Lower"])
regions["Fortress East Shortcut Lower"].connect(
connecting_region=regions["Fortress East Shortcut Upper"],
@@ -794,21 +853,31 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
connecting_region=regions["Eastern Vault Fortress"],
rule=lambda state: has_ice_grapple_logic(False, IceGrappling.option_easy, state, world))
regions["Fortress Grave Path"].connect(
connecting_region=regions["Fortress Grave Path Dusty Entrance Region"],
rule=lambda state: state.has(laurels, player))
regions["Fortress Grave Path Dusty Entrance Region"].connect(
connecting_region=regions["Fortress Grave Path"],
rule=lambda state: state.has(laurels, player))
fort_grave_entry_to_combat = regions["Fortress Grave Path Entry"].connect(
connecting_region=regions["Fortress Grave Path Combat"])
regions["Fortress Grave Path Combat"].connect(
connecting_region=regions["Fortress Grave Path Entry"])
regions["Fortress Grave Path"].connect(
regions["Fortress Grave Path Combat"].connect(
connecting_region=regions["Fortress Grave Path by Grave"])
# run past the enemies
regions["Fortress Grave Path by Grave"].connect(
connecting_region=regions["Fortress Grave Path Entry"])
regions["Fortress Grave Path by Grave"].connect(
connecting_region=regions["Fortress Hero's Grave Region"],
rule=lambda state: has_ability(prayer, state, world))
regions["Fortress Hero's Grave Region"].connect(
connecting_region=regions["Fortress Grave Path"])
connecting_region=regions["Fortress Grave Path by Grave"])
regions["Fortress Grave Path by Grave"].connect(
connecting_region=regions["Fortress Grave Path Dusty Entrance Region"],
rule=lambda state: state.has(laurels, player))
# reverse connection is conditionally made later, depending on whether combat logic is on, and the details of ER
regions["Fortress Grave Path Upper"].connect(
connecting_region=regions["Fortress Grave Path"],
connecting_region=regions["Fortress Grave Path Entry"],
rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
regions["Fortress Arena"].connect(
@@ -831,19 +900,19 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Quarry Portal"].connect(
connecting_region=regions["Quarry Entry"])
regions["Quarry Entry"].connect(
quarry_entry_to_main = regions["Quarry Entry"].connect(
connecting_region=regions["Quarry"],
rule=lambda state: state.has(fire_wand, player) or has_sword(state, player))
regions["Quarry"].connect(
connecting_region=regions["Quarry Entry"])
regions["Quarry Back"].connect(
quarry_back_to_main = regions["Quarry Back"].connect(
connecting_region=regions["Quarry"],
rule=lambda state: state.has(fire_wand, player) or has_sword(state, player))
regions["Quarry"].connect(
connecting_region=regions["Quarry Back"])
regions["Quarry Monastery Entry"].connect(
monastery_to_quarry_main = regions["Quarry Monastery Entry"].connect(
connecting_region=regions["Quarry"],
rule=lambda state: state.has(fire_wand, player) or has_sword(state, player))
regions["Quarry"].connect(
@@ -869,18 +938,24 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
rule=lambda state: has_ladder("Ladders in Lower Quarry", state, world)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
# nmg: bring a scav over, then ice grapple through the door, only with ER on to avoid soft lock
regions["Even Lower Quarry"].connect(
connecting_region=regions["Even Lower Quarry Isolated Chest"])
# you grappled down, might as well loot the rest too
lower_quarry_empty_to_combat = regions["Even Lower Quarry Isolated Chest"].connect(
connecting_region=regions["Even Lower Quarry"],
rule=lambda state: has_mask(state, world))
regions["Even Lower Quarry Isolated Chest"].connect(
connecting_region=regions["Lower Quarry Zig Door"],
rule=lambda state: state.has("Activate Quarry Fuse", player)
or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world))
# nmg: use ice grapple to get from the beginning of Quarry to the door without really needing mask only with ER on
# don't need the mask for this either, please don't complain about not needing a mask here, you know what you did
regions["Quarry"].connect(
connecting_region=regions["Lower Quarry Zig Door"],
connecting_region=regions["Even Lower Quarry Isolated Chest"],
rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world))
regions["Monastery Front"].connect(
monastery_front_to_back = regions["Monastery Front"].connect(
connecting_region=regions["Monastery Back"])
# laurels through the gate, no setup needed
regions["Monastery Back"].connect(
@@ -897,7 +972,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Rooted Ziggurat Upper Entry"].connect(
connecting_region=regions["Rooted Ziggurat Upper Front"])
regions["Rooted Ziggurat Upper Front"].connect(
zig_upper_front_back = regions["Rooted Ziggurat Upper Front"].connect(
connecting_region=regions["Rooted Ziggurat Upper Back"],
rule=lambda state: state.has(laurels, player) or has_sword(state, player))
regions["Rooted Ziggurat Upper Back"].connect(
@@ -907,13 +982,23 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Rooted Ziggurat Middle Top"].connect(
connecting_region=regions["Rooted Ziggurat Middle Bottom"])
zig_low_entry_to_front = regions["Rooted Ziggurat Lower Entry"].connect(
connecting_region=regions["Rooted Ziggurat Lower Front"])
regions["Rooted Ziggurat Lower Front"].connect(
connecting_region=regions["Rooted Ziggurat Lower Entry"])
regions["Rooted Ziggurat Lower Front"].connect(
connecting_region=regions["Rooted Ziggurat Lower Mid Checkpoint"])
zig_low_mid_to_front = regions["Rooted Ziggurat Lower Mid Checkpoint"].connect(
connecting_region=regions["Rooted Ziggurat Lower Front"])
zig_low_mid_to_back = regions["Rooted Ziggurat Lower Mid Checkpoint"].connect(
connecting_region=regions["Rooted Ziggurat Lower Back"],
rule=lambda state: state.has(laurels, player)
or (has_sword(state, player) and has_ability(prayer, state, world)))
# nmg: can ice grapple on the voidlings to the double admin fight, still need to pray at the fuse
regions["Rooted Ziggurat Lower Back"].connect(
connecting_region=regions["Rooted Ziggurat Lower Front"],
# can ice grapple to the voidlings to get to the double admin fight, still need to pray at the fuse
zig_low_back_to_mid = regions["Rooted Ziggurat Lower Back"].connect(
connecting_region=regions["Rooted Ziggurat Lower Mid Checkpoint"],
rule=lambda state: (state.has(laurels, player)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
and has_ability(prayer, state, world)
@@ -925,8 +1010,10 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Rooted Ziggurat Portal Room Entrance"].connect(
connecting_region=regions["Rooted Ziggurat Lower Back"])
regions["Zig Skip Exit"].connect(
connecting_region=regions["Rooted Ziggurat Lower Front"])
# zig skip region only gets made if entrance rando and fewer shops are on
if options.entrance_rando and options.fixed_shop:
regions["Zig Skip Exit"].connect(
connecting_region=regions["Rooted Ziggurat Lower Front"])
regions["Rooted Ziggurat Portal"].connect(
connecting_region=regions["Rooted Ziggurat Portal Room"])
@@ -952,7 +1039,6 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
or state.has(laurels, player)
or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world))
# a whole lot of stuff to basically say "you need to pray at the overworld fuse"
swamp_mid_to_cath = regions["Swamp Mid"].connect(
connecting_region=regions["Swamp to Cathedral Main Entrance Region"],
rule=lambda state: (has_ability(prayer, state, world)
@@ -965,7 +1051,9 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
"Ladder to Swamp",
"Ladders near Weathervane"}, player)
or (state.has("Ladder to Ruined Atoll", player)
and state.can_reach_region("Overworld Beach", player))))))
and state.can_reach_region("Overworld Beach", player)))))
and (not options.combat_logic
or has_combat_reqs("Swamp", state, player)))
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
if options.ladder_storage >= LadderStorage.option_hard and options.shuffle_ladders:
@@ -1017,13 +1105,23 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
regions["Swamp Hero's Grave Region"].connect(
connecting_region=regions["Back of Swamp"])
regions["Cathedral"].connect(
cath_entry_to_elev = regions["Cathedral Entry"].connect(
connecting_region=regions["Cathedral to Gauntlet"],
rule=lambda state: (has_ability(prayer, state, world)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
or options.entrance_rando) # elevator is always there in ER
regions["Cathedral to Gauntlet"].connect(
connecting_region=regions["Cathedral"])
connecting_region=regions["Cathedral Entry"])
cath_entry_to_main = regions["Cathedral Entry"].connect(
connecting_region=regions["Cathedral Main"])
regions["Cathedral Main"].connect(
connecting_region=regions["Cathedral Entry"])
cath_elev_to_main = regions["Cathedral to Gauntlet"].connect(
connecting_region=regions["Cathedral Main"])
regions["Cathedral Main"].connect(
connecting_region=regions["Cathedral to Gauntlet"])
regions["Cathedral Gauntlet Checkpoint"].connect(
connecting_region=regions["Cathedral Gauntlet"])
@@ -1075,7 +1173,7 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
connecting_region=regions["Far Shore"])
# Misc
regions["Spirit Arena"].connect(
heir_fight = regions["Spirit Arena"].connect(
connecting_region=regions["Spirit Arena Victory"],
rule=lambda state: (state.has(gold_hexagon, player, world.options.hexagon_goal.value) if
world.options.hexagon_quest else
@@ -1219,6 +1317,192 @@ def set_er_region_rules(world: "TunicWorld", regions: Dict[str, Region], portal_
for region in ladder_regions.values():
world.multiworld.regions.append(region)
# for combat logic, easiest to replace or add to existing rules
if world.options.combat_logic >= CombatLogic.option_bosses_only:
set_rule(wg_to_after_gk,
lambda state: state.has(laurels, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or has_combat_reqs("Garden Knight", state, player))
# laurels past, or ice grapple it off, or ice grapple to it and fight
set_rule(after_gk_to_wg,
lambda state: state.has(laurels, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or (has_ice_grapple_logic(False, IceGrappling.option_easy, state, world)
and has_combat_reqs("Garden Knight", state, player)))
if not world.options.hexagon_quest:
add_rule(heir_fight,
lambda state: has_combat_reqs("The Heir", state, player))
if world.options.combat_logic == CombatLogic.option_on:
# these are redundant with combat logic off
regions["Fortress Grave Path Entry"].connect(
connecting_region=regions["Fortress Grave Path Dusty Entrance Region"],
rule=lambda state: state.has(laurels, player))
regions["Rooted Ziggurat Lower Entry"].connect(
connecting_region=regions["Rooted Ziggurat Lower Mid Checkpoint"],
rule=lambda state: state.has(laurels, player))
regions["Rooted Ziggurat Lower Mid Checkpoint"].connect(
connecting_region=regions["Rooted Ziggurat Lower Entry"],
rule=lambda state: state.has(laurels, player))
add_rule(ow_to_town_portal,
lambda state: has_combat_reqs("Before Well", state, player))
# need to fight through the rudelings and turret, or just laurels from near the windmill
set_rule(ow_to_well_entry,
lambda state: state.has(laurels, player)
or has_combat_reqs("East Forest", state, player))
set_rule(ow_tunnel_beach,
lambda state: has_combat_reqs("East Forest", state, player))
add_rule(atoll_statue,
lambda state: has_combat_reqs("Ruined Atoll", state, player))
set_rule(frogs_front_to_main,
lambda state: has_combat_reqs("Frog's Domain", state, player))
set_rule(btw_front_main,
lambda state: state.has(laurels, player) or has_combat_reqs("Beneath the Well", state, player))
set_rule(btw_back_main,
lambda state: has_ladder("Ladders in Well", state, world)
and (state.has(laurels, player) or has_combat_reqs("Beneath the Well", state, player)))
set_rule(well_boss_to_dt,
lambda state: has_combat_reqs("Beneath the Well", state, player)
or laurels_zip(state, world))
add_rule(dt_entry_to_upper,
lambda state: has_combat_reqs("Dark Tomb", state, player))
add_rule(dt_exit_to_main,
lambda state: has_combat_reqs("Dark Tomb", state, player))
set_rule(wg_before_to_after_terry,
lambda state: state.has_any({laurels, ice_dagger}, player)
or has_combat_reqs("West Garden", state, player))
set_rule(wg_after_to_before_terry,
lambda state: state.has_any({laurels, ice_dagger}, player)
or has_combat_reqs("West Garden", state, player))
# laurels through, probably to the checkpoint, or just fight
set_rule(wg_checkpoint_to_after_terry,
lambda state: state.has(laurels, player) or has_combat_reqs("West Garden", state, player))
set_rule(wg_checkpoint_to_before_boss,
lambda state: has_combat_reqs("West Garden", state, player))
add_rule(btv_front_to_main,
lambda state: has_combat_reqs("Beneath the Vault", state, player))
add_rule(btv_back_to_main,
lambda state: has_combat_reqs("Beneath the Vault", state, player))
add_rule(fort_upper_lower,
lambda state: state.has(ice_dagger, player)
or has_combat_reqs("Eastern Vault Fortress", state, player))
set_rule(fort_grave_entry_to_combat,
lambda state: has_combat_reqs("Eastern Vault Fortress", state, player))
set_rule(quarry_entry_to_main,
lambda state: has_combat_reqs("Quarry", state, player))
set_rule(quarry_back_to_main,
lambda state: has_combat_reqs("Quarry", state, player))
set_rule(monastery_to_quarry_main,
lambda state: has_combat_reqs("Quarry", state, player))
set_rule(monastery_front_to_back,
lambda state: has_combat_reqs("Quarry", state, player))
set_rule(lower_quarry_empty_to_combat,
lambda state: has_combat_reqs("Quarry", state, player))
set_rule(zig_upper_front_back,
lambda state: state.has(laurels, player)
or has_combat_reqs("Rooted Ziggurat", state, player))
set_rule(zig_low_entry_to_front,
lambda state: has_combat_reqs("Rooted Ziggurat", state, player))
set_rule(zig_low_mid_to_front,
lambda state: has_combat_reqs("Rooted Ziggurat", state, player))
set_rule(zig_low_mid_to_back,
lambda state: state.has(laurels, player)
or (has_ability(prayer, state, world) and has_combat_reqs("Rooted Ziggurat", state, player)))
set_rule(zig_low_back_to_mid,
lambda state: (state.has(laurels, player)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
and has_ability(prayer, state, world)
and has_combat_reqs("Rooted Ziggurat", state, player))
# only activating the fuse requires combat logic
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)))
set_rule(cath_entry_to_main,
lambda state: has_combat_reqs("Cathedral", state, player))
set_rule(cath_elev_to_main,
lambda state: has_combat_reqs("Cathedral", state, player))
# for spots where you can go into and come out of an entrance to reset enemy aggro
if world.options.entrance_rando:
# for the chest outside of magic dagger house
dagger_entry_paired_name, dagger_entry_paired_region = (
get_paired_portal("Archipelagos Redux, archipelagos_house_"))
try:
dagger_entry_paired_entrance = world.get_entrance(dagger_entry_paired_name)
except KeyError:
# there is no paired entrance, so you must fight or dash past, which is done in the finally
pass
else:
set_rule(wg_checkpoint_to_dagger,
lambda state: dagger_entry_paired_entrance.can_reach(state))
world.multiworld.register_indirect_condition(region=regions["West Garden at Dagger House"],
entrance=dagger_entry_paired_entrance)
finally:
add_rule(wg_checkpoint_to_dagger,
lambda state: state.has(laurels, player) or has_combat_reqs("West Garden", state, player),
combine="or")
# zip past enemies in fortress grave path to enter the dusty entrance, then come back out
fort_dusty_paired_name, fort_dusty_paired_region = get_paired_portal("Fortress Reliquary, Dusty_")
try:
fort_dusty_paired_entrance = world.get_entrance(fort_dusty_paired_name)
except KeyError:
# there is no paired entrance, so you can't run past to deaggro
# the path to dusty can be done via combat, so no need to do anything here
pass
else:
# there is a paired entrance, so you can use that to deaggro enemies
regions["Fortress Grave Path Dusty Entrance Region"].connect(
connecting_region=regions["Fortress Grave Path by Grave"],
rule=lambda state: state.has(laurels, player) and fort_dusty_paired_entrance.can_reach(state))
world.multiworld.register_indirect_condition(region=regions["Fortress Grave Path by Grave"],
entrance=fort_dusty_paired_entrance)
# for activating the ladder switch to get from fortress east upper to lower
fort_east_upper_right_paired_name, fort_east_upper_right_paired_region = (
get_paired_portal("Fortress East, Fortress Courtyard_"))
try:
fort_east_upper_right_paired_entrance = (
world.get_entrance(fort_east_upper_right_paired_name))
except KeyError:
# no paired entrance, so you must fight, which is done in the finally
pass
else:
set_rule(fort_east_upper_lower,
lambda state: fort_east_upper_right_paired_entrance.can_reach(state))
world.multiworld.register_indirect_condition(region=regions["Fortress East Shortcut Lower"],
entrance=fort_east_upper_right_paired_entrance)
finally:
add_rule(fort_east_upper_lower,
lambda state: has_combat_reqs("Eastern Vault Fortress", state, player)
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world),
combine="or")
else:
# if combat logic is on and ER is off, we can make this entrance freely
regions["Fortress Grave Path Dusty Entrance Region"].connect(
connecting_region=regions["Fortress Grave Path by Grave"],
rule=lambda state: state.has(laurels, player))
else:
# if combat logic is off, we can make this entrance freely
regions["Fortress Grave Path Dusty Entrance Region"].connect(
connecting_region=regions["Fortress Grave Path by Grave"],
rule=lambda state: state.has(laurels, player))
def set_er_location_rules(world: "TunicWorld") -> None:
player = world.player
@@ -1315,6 +1599,11 @@ def set_er_location_rules(world: "TunicWorld") -> None:
set_rule(world.get_location("East Forest - Ice Rod Grapple Chest"), lambda state: (
state.has_all({grapple, ice_dagger, fire_wand}, player) and has_ability(icebolt, state, world)))
# Dark Tomb
# added to make combat logic smoother
set_rule(world.get_location("Dark Tomb - 2nd Laser Room"),
lambda state: has_lantern(state, world))
# West Garden
set_rule(world.get_location("West Garden - [North] Across From Page Pickup"),
lambda state: state.has(laurels, player))
@@ -1348,11 +1637,11 @@ def set_er_location_rules(world: "TunicWorld") -> None:
# Library Lab
set_rule(world.get_location("Library Lab - Page 1"),
lambda state: has_stick(state, player) or state.has_any((fire_wand, gun), player))
lambda state: has_melee(state, player) or state.has_any((fire_wand, gun), player))
set_rule(world.get_location("Library Lab - Page 2"),
lambda state: has_stick(state, player) or state.has_any((fire_wand, gun), player))
lambda state: has_melee(state, player) or state.has_any((fire_wand, gun), player))
set_rule(world.get_location("Library Lab - Page 3"),
lambda state: has_stick(state, player) or state.has_any((fire_wand, gun), player))
lambda state: has_melee(state, player) or state.has_any((fire_wand, gun), player))
# Eastern Vault Fortress
set_rule(world.get_location("Fortress Arena - Hexagon Red"),
@@ -1361,11 +1650,11 @@ def set_er_location_rules(world: "TunicWorld") -> None:
# gun isn't included since it can only break one leaf pile at a time, and we don't check how much mana you have
# but really, I expect the player to just throw a bomb at them if they don't have melee
set_rule(world.get_location("Fortress Leaf Piles - Secret Chest"),
lambda state: has_stick(state, player) or state.has(ice_dagger, player))
lambda state: has_melee(state, player) or state.has(ice_dagger, player))
# Beneath the Vault
set_rule(world.get_location("Beneath the Fortress - Bridge"),
lambda state: has_stick(state, player) or state.has_any({laurels, fire_wand}, player))
lambda state: has_melee(state, player) or state.has_any({laurels, fire_wand}, player))
# Quarry
set_rule(world.get_location("Quarry - [Central] Above Ladder Dash Chest"),
@@ -1421,9 +1710,9 @@ def set_er_location_rules(world: "TunicWorld") -> None:
# Events
set_rule(world.get_location("Eastern Bell"),
lambda state: (has_stick(state, player) or state.has(fire_wand, player)))
lambda state: (has_melee(state, player) or state.has(fire_wand, player)))
set_rule(world.get_location("Western Bell"),
lambda state: (has_stick(state, player) or state.has(fire_wand, player)))
lambda state: (has_melee(state, player) or state.has(fire_wand, player)))
set_rule(world.get_location("Furnace Fuse"),
lambda state: has_ability(prayer, state, world))
set_rule(world.get_location("South and West Fortress Exterior Fuses"),
@@ -1470,3 +1759,129 @@ def set_er_location_rules(world: "TunicWorld") -> None:
lambda state: has_sword(state, player))
set_rule(world.get_location("Shop - Coin 2"),
lambda state: has_sword(state, player))
def combat_logic_to_loc(loc_name: str, combat_req_area: str, set_instead: bool = False,
dagger: bool = False, laurel: bool = False) -> None:
# dagger means you can use magic dagger instead of combat for that check
# laurel means you can dodge the enemies freely with the laurels
if set_instead:
set_rule(world.get_location(loc_name),
lambda state: has_combat_reqs(combat_req_area, state, player)
or (dagger and state.has(ice_dagger, player))
or (laurel and state.has(laurels, player)))
else:
add_rule(world.get_location(loc_name),
lambda state: has_combat_reqs(combat_req_area, state, player)
or (dagger and state.has(ice_dagger, player))
or (laurel and state.has(laurels, player)))
if world.options.combat_logic >= CombatLogic.option_bosses_only:
# garden knight is in the regions part above
combat_logic_to_loc("Fortress Arena - Siege Engine/Vault Key Pickup", "Siege Engine", set_instead=True)
combat_logic_to_loc("Librarian - Hexagon Green", "The Librarian", set_instead=True)
set_rule(world.get_location("Librarian - Hexagon Green"),
rule=lambda state: has_combat_reqs("The Librarian", state, player)
and has_ladder("Ladders in Library", state, world))
combat_logic_to_loc("Rooted Ziggurat Lower - Hexagon Blue", "Boss Scavenger", set_instead=True)
if world.options.ice_grappling >= IceGrappling.option_medium:
add_rule(world.get_location("Rooted Ziggurat Lower - Hexagon Blue"),
lambda state: has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
combat_logic_to_loc("Cathedral Gauntlet - Gauntlet Reward", "Gauntlet", set_instead=True)
if world.options.combat_logic == CombatLogic.option_on:
combat_logic_to_loc("Overworld - [Northeast] Flowers Holy Cross", "Garden Knight")
combat_logic_to_loc("Overworld - [Northwest] Chest Near Quarry Gate", "Before Well", dagger=True)
combat_logic_to_loc("Overworld - [Northeast] Chest Above Patrol Cave", "Garden Knight", dagger=True)
combat_logic_to_loc("Overworld - [Southwest] West Beach Guarded By Turret", "Overworld", dagger=True)
combat_logic_to_loc("Overworld - [Southwest] West Beach Guarded By Turret 2", "Overworld")
combat_logic_to_loc("Overworld - [Southwest] Bombable Wall Near Fountain", "East Forest", dagger=True)
combat_logic_to_loc("Overworld - [Southwest] Fountain Holy Cross", "East Forest", dagger=True)
combat_logic_to_loc("Overworld - [Southwest] South Chest Near Guard", "East Forest", dagger=True)
combat_logic_to_loc("Overworld - [Southwest] Tunnel Guarded By Turret", "East Forest", dagger=True)
combat_logic_to_loc("Overworld - [Northwest] Chest Near Turret", "Before Well")
add_rule(world.get_location("Hourglass Cave - Hourglass Chest"),
lambda state: has_sword(state, player) and (state.has("Shield", player)
# kill the turrets through the wall with a longer sword
or state.has("Sword Upgrade", player, 3)))
add_rule(world.get_location("Hourglass Cave - Holy Cross Chest"),
lambda state: has_sword(state, player) and (state.has("Shield", player)
or state.has("Sword Upgrade", player, 3)))
# the first spider chest they literally do not attack you until you open the chest
# the second one, you can still just walk past them, but I guess /something/ would be wanted
combat_logic_to_loc("East Forest - Beneath Spider Chest", "East Forest", dagger=True, laurel=True)
combat_logic_to_loc("East Forest - Golden Obelisk Holy Cross", "East Forest", dagger=True)
combat_logic_to_loc("East Forest - Dancing Fox Spirit Holy Cross", "East Forest", dagger=True, laurel=True)
combat_logic_to_loc("East Forest - From Guardhouse 1 Chest", "East Forest", dagger=True, laurel=True)
combat_logic_to_loc("East Forest - Above Save Point", "East Forest", dagger=True)
combat_logic_to_loc("East Forest - Above Save Point Obscured", "East Forest", dagger=True)
combat_logic_to_loc("Forest Grave Path - Above Gate", "East Forest", dagger=True, laurel=True)
combat_logic_to_loc("Forest Grave Path - Obscured Chest", "East Forest", dagger=True, laurel=True)
# most of beneath the well is covered by the region access rule
combat_logic_to_loc("Beneath the Well - [Entryway] Chest", "Beneath the Well")
combat_logic_to_loc("Beneath the Well - [Entryway] Obscured Behind Waterfall", "Beneath the Well")
combat_logic_to_loc("Beneath the Well - [Back Corridor] Left Secret", "Beneath the Well")
combat_logic_to_loc("Beneath the Well - [Side Room] Chest By Phrends", "Overworld")
# laurels past the enemies, then use the wand or gun to take care of the fairies that chased you
add_rule(world.get_location("West Garden - [West Lowlands] Tree Holy Cross Chest"),
lambda state: state.has_any({fire_wand, "Gun"}, player))
combat_logic_to_loc("West Garden - [Central Lowlands] Chest Beneath Faeries", "West Garden")
combat_logic_to_loc("West Garden - [Central Lowlands] Chest Beneath Save Point", "West Garden")
combat_logic_to_loc("West Garden - [West Highlands] Upper Left Walkway", "West Garden")
# with combat logic on, I presume the player will want to be able to see to avoid the spiders
set_rule(world.get_location("Beneath the Fortress - Bridge"),
lambda state: has_lantern(state, world)
and (state.has_any({laurels, fire_wand, "Gun"}, player) or has_melee(state, player)))
combat_logic_to_loc("Eastern Vault Fortress - [West Wing] Candles Holy Cross", "Eastern Vault Fortress",
dagger=True)
# could just do the last two, but this outputs better in the spoiler log
# dagger is maybe viable here, but it's sketchy -- activate ladder switch, save to reset enemies, climb up
combat_logic_to_loc("Upper and Central Fortress Exterior Fuses", "Eastern Vault Fortress")
combat_logic_to_loc("Beneath the Vault Fuse", "Beneath the Vault")
combat_logic_to_loc("Eastern Vault West Fuses", "Eastern Vault Fortress")
# if you come in from the left, you only need to fight small crabs
add_rule(world.get_location("Ruined Atoll - [South] Near Birds"),
lambda state: has_melee(state, player) or state.has_any({laurels, "Gun"}, player))
# can get this one without fighting if you have laurels
add_rule(world.get_location("Frog's Domain - Above Vault"),
lambda state: state.has(laurels, player) or has_combat_reqs("Frog's Domain", state, player))
# with wand, you can get this chest. Non-ER, you need laurels to continue down. ER, you can just torch
set_rule(world.get_location("Rooted Ziggurat Upper - Near Bridge Switch"),
lambda state: (state.has(fire_wand, player)
and (state.has(laurels, player) or world.options.entrance_rando))
or has_combat_reqs("Rooted Ziggurat", state, player))
set_rule(world.get_location("Rooted Ziggurat Lower - After Guarded Fuse"),
lambda state: has_ability(prayer, state, world)
and has_combat_reqs("Rooted Ziggurat", state, player))
# replace the sword rule with this one
combat_logic_to_loc("Swamp - [South Graveyard] 4 Orange Skulls", "Swamp", set_instead=True)
combat_logic_to_loc("Swamp - [South Graveyard] Guarded By Big Skeleton", "Swamp", dagger=True)
# don't really agree with this one but eh
combat_logic_to_loc("Swamp - [South Graveyard] Above Big Skeleton", "Swamp", dagger=True, laurel=True)
# the tentacles deal with everything else reasonably, and you can hide on the island, so no rule for it
add_rule(world.get_location("Swamp - [South Graveyard] Obscured Beneath Telescope"),
lambda state: state.has(laurels, player) # can dash from swamp mid to here and grab it
or has_combat_reqs("Swamp", state, player))
add_rule(world.get_location("Swamp - [Central] South Secret Passage"),
lambda state: state.has(laurels, player) # can dash from swamp front to here and grab it
or has_combat_reqs("Swamp", state, player))
combat_logic_to_loc("Swamp - [South Graveyard] Upper Walkway On Pedestal", "Swamp")
combat_logic_to_loc("Swamp - [Central] Beneath Memorial", "Swamp")
combat_logic_to_loc("Swamp - [Central] Near Ramps Up", "Swamp")
combat_logic_to_loc("Swamp - [Upper Graveyard] Near Telescope", "Swamp")
combat_logic_to_loc("Swamp - [Upper Graveyard] Near Shield Fleemers", "Swamp")
combat_logic_to_loc("Swamp - [Upper Graveyard] Obscured Behind Hill", "Swamp")
# 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))