Skip to content

Commit

Permalink
Fix some dumb stuff (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScipioWright authored Dec 17, 2024
1 parent 62b6e86 commit d74eedc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
10 changes: 4 additions & 6 deletions worlds/tunic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 28 additions & 11 deletions worlds/tunic/er_rules.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit d74eedc

Please sign in to comment.