From d74eedcdc4baaedb0d290f3c9169f10cf0a1fee3 Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Mon, 16 Dec 2024 21:15:08 -0500 Subject: [PATCH] Fix some dumb stuff (#21) --- worlds/tunic/__init__.py | 10 ++++------ worlds/tunic/er_rules.py | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/worlds/tunic/__init__.py b/worlds/tunic/__init__.py index 376ae270e8ae..cf1cabd58b4d 100644 --- a/worlds/tunic/__init__.py +++ b/worlds/tunic/__init__.py @@ -356,18 +356,16 @@ def remove_filler(amount: int) -> None: self.options.non_local_items.value.discard("Grass") all_filler: List[TunicItem] = [] non_filler: List[TunicItem] = [] - amount_to_local_fill = int(self.options.local_fill.value * len(all_filler) / 100) for tunic_item in tunic_items: if (tunic_item.classification in [ItemClassification.filler, ItemClassification.trap] and tunic_item.name not in self.options.local_items and tunic_item.name not in self.options.non_local_items): - if len(self.local_filler) < amount_to_local_fill: - self.local_filler.append(tunic_item) - else: - all_filler.append(tunic_item) + all_filler.append(tunic_item) else: non_filler.append(tunic_item) - + amount_to_local_fill = int(self.options.local_fill.value * len(all_filler) / 100) + self.local_filler = all_filler[:amount_to_local_fill] + del all_filler[:amount_to_local_fill] tunic_items = all_filler + non_filler self.multiworld.itempool += tunic_items diff --git a/worlds/tunic/er_rules.py b/worlds/tunic/er_rules.py index 427e5bf06968..d4ee8785f0bc 100644 --- a/worlds/tunic/er_rules.py +++ b/worlds/tunic/er_rules.py @@ -1,12 +1,12 @@ from typing import Dict, FrozenSet, Tuple, TYPE_CHECKING from worlds.generic.Rules import set_rule, add_rule, forbid_item +from BaseClasses import Region, CollectionState 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 from .grass import set_grass_location_rules if TYPE_CHECKING: @@ -535,7 +535,6 @@ def get_paired_portal(portal_sd: str) -> Tuple[str, str]: regions["Dark Tomb Upper"].connect( connecting_region=regions["Dark Tomb Entry Point"]) - # ice grapple through the wall, get the little secret sound to trigger regions["Dark Tomb Upper"].connect( connecting_region=regions["Dark Tomb Main"], rule=lambda state: has_ladder("Ladder in Dark Tomb", state, world) @@ -557,11 +556,24 @@ def get_paired_portal(portal_sd: str) -> Tuple[str, str]: 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( + wg_after_terry_to_west_combat = regions["West Garden after Terry"].connect( + connecting_region=regions["West Garden West Combat"]) + regions["West Garden West Combat"].connect( connecting_region=regions["West Garden after Terry"]) + wg_checkpoint_to_west_combat = regions["West Garden South Checkpoint"].connect( + connecting_region=regions["West Garden West Combat"]) + regions["West Garden West Combat"].connect( + connecting_region=regions["West Garden South Checkpoint"]) + + # if not laurels, it goes through the west combat region instead + regions["West Garden after Terry"].connect( + connecting_region=regions["West Garden South Checkpoint"], + rule=lambda state: state.has(laurels, player)) + regions["West Garden South Checkpoint"].connect( + connecting_region=regions["West Garden after Terry"], + rule=lambda state: state.has(laurels, player)) + 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( @@ -1382,12 +1394,16 @@ def ls_connect(origin_name: str, portal_sdt: str) -> None: 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, + + set_rule(wg_after_terry_to_west_combat, + lambda state: has_combat_reqs("West Garden", state, player)) + set_rule(wg_checkpoint_to_west_combat, lambda state: has_combat_reqs("West Garden", state, player)) + # maybe a little too generous? probably fine though + set_rule(wg_checkpoint_to_before_boss, + lambda state: state.has(laurels, player) or 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, @@ -1507,9 +1523,8 @@ def ls_connect(origin_name: str, portal_sdt: str) -> None: def set_er_location_rules(world: "TunicWorld") -> None: player = world.player - options = world.options - if options.grass_randomizer: + if world.options.grass_randomizer: set_grass_location_rules(world) forbid_item(world.get_location("Secret Gathering Place - 20 Fairy Reward"), fairies, player) @@ -1836,6 +1851,8 @@ def combat_logic_to_loc(loc_name: str, combat_req_area: str, set_instead: bool = 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") + combat_logic_to_loc("West Garden - [Central Highlands] Holy Cross (Blue Lines)", "West Garden") + combat_logic_to_loc("West Garden - [Central Highlands] Behind Guard Captain", "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"),