TUNIC: Logic Rules Redux (#3544)

* Clean these functions up, get the hell out of here 5 parameter function

* Clean up a bunch of rules that no longer need to be multi-lined since the functions are shorter

* Clean up some range functions

* Update to use world instead of player like Vi recommended

* Fix merge conflict

* Create new options

* Slightly revise ls rule

* Update options.py

* Update options.py

* Add tedious option for ls

* Update laurels zips description

* Create new options

* Slightly revise ls rule

* Update options.py

* Update options.py

* Add tedious option for ls

* Update laurels zips description

* Creating structures to redo ladder storage rules

* Put together overworld ladder groups, remove tedious

* Write up the rules for the regular rules

* Update slot data and UT stuff

* Put new ice grapple stuff in er rules

* Ice grapple hard to get to fountain cross room

* More ladder data

* Wrote majority of overworld ladder rules

* Finish the ladder storage rules

* Update notes

* Add note

* Add well rail to the rules

* More rules

* Comment out logically irrelevant entrances

* Update with laurels_zip helper

* Add parameter to has_ice_grapple_logic for difficulty

* Add new parameter to has_ice_grapple_logic

* Move ice grapple chest to lower forest in ER/ladders

* Fix rule

* Finishing out hooking the new rules into the code

* Fix bugs

* Add more hard ice grapples

* Fix more bugs

* Shops my beloved

* Change victory condition back

* Remove debug stuff

* Update plando connections description

* Fix extremely rare bug

* Add well front -> back hard ladder storages

* Note in ls rules about knocking yourself down with bombs being out of logic

* Add atoll fuse with wand + hard ls

* Add some nonsense that boils down to activating the fuse in overworld

* Further update LS description

* Fix missing logic on bridge switch chest in upper zig

* Revise upper zig rule change to account for ER

* Fix merge conflict

* Fix formatting, fix rule for heir access after merge

* Add the shop sword logic stuff in

* Remove todo that was already done

* Fill out a to-do with some cursed nonsense

* Fix event in wrong region

* Fix missing cathedral -> elevator connection

* Fix missing cathedral -> elevator connection

* Add ER exception to cathedral -> elevator

* Fix secret gathering place issue

* Fix incorrect ls rule

* Move 3 locations to Quarry Back since they're easily accessible from the back

* Also update non-er region

* Remove redundant parentheses

* Add new test for a weird edge case in ER

* Slight option description updates

* Use has_ladder in spots where it wasn't used for some reason, add a comment

* Fix unit test for ER

* Update per exempt's suggestion

* Add back LogicRules as an invisible option, to not break old yamls

* Remove unused elevation from portal class

* Update ladder storage without items description

* Remove shop_scene stuff since it's no longer relevant in the mod by the time this version comes out

* Remove shop scene stuff from game info since it's no longer relevant in the mod by the time this comes out

* Update portal list to match main

* god I love github merging things

* Remove note

* Add ice grapple hard path from upper overworld to temple rafters entrance

* Actually that should be medium

* Remove outdated note

* Add ice grapple hard for swamp mid to the ledge

* Add missing laurels zip in swamp

* Some fixes to the ladder storage data while reviewing it

* Add unit test for weird edge case

* Backport outlet region system to fix ls bug

* Fix incorrect ls, add todo

* Add missing swamp ladder storage connections

* Add swamp zip to er data

* Add swamp zip to er rules

* Add hard ice grapple for forest grave path main to upper

* Add ice grapple logic for all bomb walls except the east quarry one

* Add ice grapple logic for frog stairs eye to mouth without the ladder

* Add hard ice grapple for overworld to the stairs to west garden

* Add the ice grapple boss quick kills to medium ice grappling

* Add the reverse connection for the ice grapple kill on Garden Knight

* Add atoll house ice grapple push, and add west garden ice grapple entry to the regular rules
This commit is contained in:
Scipio Wright
2024-09-08 08:42:59 -04:00
committed by GitHub
parent a652108472
commit dad228cd4a
12 changed files with 1042 additions and 698 deletions

View File

@@ -7,8 +7,9 @@ from .rules import set_location_rules, set_region_rules, randomize_ability_unloc
from .er_rules import set_er_location_rules
from .regions import tunic_regions
from .er_scripts import create_er_regions
from .er_data import portal_mapping
from .options import TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections
from .er_data import portal_mapping, RegionInfo, tunic_er_regions
from .options import (TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections,
LaurelsLocation, LogicRules, LaurelsZips, IceGrappling, LadderStorage)
from worlds.AutoWorld import WebWorld, World
from Options import PlandoConnection
from decimal import Decimal, ROUND_HALF_UP
@@ -48,10 +49,12 @@ class TunicLocation(Location):
class SeedGroup(TypedDict):
logic_rules: int # logic rules value
laurels_zips: bool # laurels_zips value
ice_grappling: int # ice_grappling value
ladder_storage: int # ls value
laurels_at_10_fairies: bool # laurels location value
fixed_shop: bool # fixed shop value
plando: TunicPlandoConnections # consolidated of plando connections for the seed group
plando: TunicPlandoConnections # consolidated plando connections for the seed group
class TunicWorld(World):
@@ -77,8 +80,17 @@ class TunicWorld(World):
tunic_portal_pairs: Dict[str, str]
er_portal_hints: Dict[int, str]
seed_groups: Dict[str, SeedGroup] = {}
shop_num: int = 1 # need to make it so that you can walk out of shops, but also that they aren't all connected
er_regions: Dict[str, RegionInfo] # absolutely needed so outlet regions work
def generate_early(self) -> None:
if self.options.logic_rules >= LogicRules.option_no_major_glitches:
self.options.laurels_zips.value = LaurelsZips.option_true
self.options.ice_grappling.value = IceGrappling.option_medium
if self.options.logic_rules.value == LogicRules.option_unrestricted:
self.options.ladder_storage.value = LadderStorage.option_medium
self.er_regions = tunic_er_regions.copy()
if self.options.plando_connections:
for index, cxn in enumerate(self.options.plando_connections):
# making shops second to simplify other things later
@@ -99,7 +111,10 @@ class TunicWorld(World):
self.options.keys_behind_bosses.value = passthrough["keys_behind_bosses"]
self.options.sword_progression.value = passthrough["sword_progression"]
self.options.ability_shuffling.value = passthrough["ability_shuffling"]
self.options.logic_rules.value = passthrough["logic_rules"]
self.options.laurels_zips.value = passthrough["laurels_zips"]
self.options.ice_grappling.value = passthrough["ice_grappling"]
self.options.ladder_storage.value = passthrough["ladder_storage"]
self.options.ladder_storage_without_items = passthrough["ladder_storage_without_items"]
self.options.lanternless.value = passthrough["lanternless"]
self.options.maskless.value = passthrough["maskless"]
self.options.hexagon_quest.value = passthrough["hexagon_quest"]
@@ -118,19 +133,28 @@ class TunicWorld(World):
group = tunic.options.entrance_rando.value
# if this is the first world in the group, set the rules equal to its rules
if group not in cls.seed_groups:
cls.seed_groups[group] = SeedGroup(logic_rules=tunic.options.logic_rules.value,
laurels_at_10_fairies=tunic.options.laurels_location == 3,
fixed_shop=bool(tunic.options.fixed_shop),
plando=tunic.options.plando_connections)
cls.seed_groups[group] = \
SeedGroup(laurels_zips=bool(tunic.options.laurels_zips),
ice_grappling=tunic.options.ice_grappling.value,
ladder_storage=tunic.options.ladder_storage.value,
laurels_at_10_fairies=tunic.options.laurels_location == LaurelsLocation.option_10_fairies,
fixed_shop=bool(tunic.options.fixed_shop),
plando=tunic.options.plando_connections)
continue
# off is more restrictive
if not tunic.options.laurels_zips:
cls.seed_groups[group]["laurels_zips"] = False
# lower value is more restrictive
if tunic.options.logic_rules.value < cls.seed_groups[group]["logic_rules"]:
cls.seed_groups[group]["logic_rules"] = tunic.options.logic_rules.value
if tunic.options.ice_grappling < cls.seed_groups[group]["ice_grappling"]:
cls.seed_groups[group]["ice_grappling"] = tunic.options.ice_grappling.value
# lower value is more restrictive
if tunic.options.ladder_storage.value < cls.seed_groups[group]["ladder_storage"]:
cls.seed_groups[group]["ladder_storage"] = tunic.options.ladder_storage.value
# laurels at 10 fairies changes logic for secret gathering place placement
if tunic.options.laurels_location == 3:
cls.seed_groups[group]["laurels_at_10_fairies"] = True
# fewer shops, one at windmill
# more restrictive, overrides the option for others in the same group, which is better than failing imo
if tunic.options.fixed_shop:
cls.seed_groups[group]["fixed_shop"] = True
@@ -366,7 +390,10 @@ class TunicWorld(World):
"ability_shuffling": self.options.ability_shuffling.value,
"hexagon_quest": self.options.hexagon_quest.value,
"fool_traps": self.options.fool_traps.value,
"logic_rules": self.options.logic_rules.value,
"laurels_zips": self.options.laurels_zips.value,
"ice_grappling": self.options.ice_grappling.value,
"ladder_storage": self.options.ladder_storage.value,
"ladder_storage_without_items": self.options.ladder_storage_without_items.value,
"lanternless": self.options.lanternless.value,
"maskless": self.options.maskless.value,
"entrance_rando": int(bool(self.options.entrance_rando.value)),