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

LADX: tarins gift improvement #3970

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3c68aa3
add groups and a preset
threeandthreee Sep 12, 2024
7120f25
formatting
threeandthreee Sep 13, 2024
48d11a8
pull zig's tarin's gift improvements
threeandthreee Sep 16, 2024
19caa73
typing
threeandthreee Sep 17, 2024
501427e
alias groups for progressive items
threeandthreee Sep 17, 2024
137be4b
change tarins gift option a bit
threeandthreee Sep 17, 2024
667fc12
add bush breakers item group
threeandthreee Sep 27, 2024
e40eca8
Merge branch 'ladx/groups-and-presets' into ladx/tarins-gift-improvement
threeandthreee Sep 27, 2024
6effdd5
fix typo
threeandthreee Sep 27, 2024
80418f6
bush_breaker option, respect non_local_items
threeandthreee Sep 27, 2024
a6e0920
Merge branch 'main' into ladx/groups-and-presets
threeandthreee Sep 27, 2024
18eda4e
Merge branch 'ladx/groups-and-presets' into ladx/tarins-gift-improvement
threeandthreee Sep 27, 2024
89e45fb
review suggestions
threeandthreee Oct 5, 2024
502c1e7
Merge remote-tracking branch 'upstream/main' into ladx/tarins-gift-im…
threeandthreee Dec 5, 2024
da9c3cd
Merge remote-tracking branch 'upstream/main' into ladx/tarins-gift-im…
threeandthreee Dec 20, 2024
aed1884
Merge remote-tracking branch 'upstream/main' into ladx/tarins-gift-im…
threeandthreee Dec 20, 2024
0ab176b
cleaner
threeandthreee Dec 20, 2024
b585cea
Update worlds/ladx/__init__.py
threeandthreee Jan 16, 2025
292531c
Merge remote-tracking branch 'upstream/main' into ladx/tarins-gift-im…
threeandthreee Jan 16, 2025
9d392d0
Merge remote-tracking branch 'upstream/main' into ladx/tarins-gift-im…
threeandthreee Feb 13, 2025
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
11 changes: 0 additions & 11 deletions worlds/ladx/LADXR/locations/startItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,12 @@


class StartItem(DroppedKey):
# We need to give something here that we can use to progress.
# FEATHER
OPTIONS = [SWORD, SHIELD, POWER_BRACELET, OCARINA, BOOMERANG, MAGIC_ROD, TAIL_KEY, SHOVEL, HOOKSHOT, PEGASUS_BOOTS, MAGIC_POWDER, BOMB]
MULTIWORLD = False

def __init__(self):
super().__init__(0x2A3)
self.give_bowwow = False

def configure(self, options):
if options.bowwow != 'normal':
# When we have bowwow mode, we pretend to be a sword for logic reasons
self.OPTIONS = [SWORD]
self.give_bowwow = True
if options.randomstartlocation and options.entranceshuffle != 'none':
self.OPTIONS.append(FLIPPERS)

def patch(self, rom, option, *, multiworld=None):
assert multiworld is None

Expand Down
14 changes: 14 additions & 0 deletions worlds/ladx/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,18 @@ class AdditionalWarpPoints(DefaultOffToggle):
"""
display_name = "Additional Warp Points"


class TarinsGift(Choice):
"""
[Local Progression] Forces Tarin's gift to be an item that immediately opens up local checks.
threeandthreee marked this conversation as resolved.
Show resolved Hide resolved
Has little effect in single player games, and isn't always necessary with randomized entrances.
"""
display_name = "Tarin's Gift"
option_local_progression = 0
option_any_item = 1
default = option_local_progression


ladx_option_groups = [
OptionGroup("Goal Options", [
Goal,
Expand All @@ -521,6 +533,7 @@ class AdditionalWarpPoints(DefaultOffToggle):
OptionGroup("Miscellaneous", [
TradeQuest,
Rooster,
TarinsGift,
TrendyGame,
NagMessages,
BootsControls
Expand Down Expand Up @@ -579,3 +592,4 @@ class LinksAwakeningOptions(PerGameCommonOptions):
nag_messages: NagMessages
ap_title_screen: APTitleScreen
boots_controls: BootsControls
tarins_gift: TarinsGift
50 changes: 33 additions & 17 deletions worlds/ladx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import bsdiff4

import settings
from BaseClasses import Entrance, Item, ItemClassification, Location, Tutorial, MultiWorld
from BaseClasses import Entrance, Item, ItemClassification, Location, Tutorial, MultiWorld, CollectionState
from Fill import fill_restrictive
from worlds.AutoWorld import WebWorld, World
from .Common import *
Expand All @@ -24,7 +24,7 @@
from .LADXR.worldSetup import WorldSetup as LADXRWorldSetup
from .Locations import (LinksAwakeningLocation, LinksAwakeningRegion,
create_regions_from_ladxr, get_locations_to_id)
from .Options import DungeonItemShuffle, ShuffleInstruments, LinksAwakeningOptions, ladx_option_groups
from .Options import DungeonItemShuffle, ShuffleInstruments, TarinsGift, LinksAwakeningOptions, ladx_option_groups
from .Rom import LADXDeltaPatch, get_base_rom_path

DEVELOPER_MODE = False
Expand Down Expand Up @@ -173,6 +173,8 @@ def create_event(self, event: str):
return Item(event, ItemClassification.progression, None, self.player)

def create_items(self) -> None:
itempool = []

exclude = [item.name for item in self.multiworld.precollected_items[self.player]]

dungeon_item_types = {
Expand Down Expand Up @@ -216,7 +218,7 @@ def create_items(self) -> None:
for _ in range(count):
if item_name in exclude:
exclude.remove(item_name) # this is destructive. create unique list above
self.multiworld.itempool.append(self.create_item("Master Stalfos' Message"))
itempool.append(self.create_item("Master Stalfos' Message"))
else:
item = self.create_item(item_name)

Expand Down Expand Up @@ -255,9 +257,9 @@ def create_items(self) -> None:
self.prefill_own_dungeons.append(item)
self.pre_fill_items.append(item)
else:
self.multiworld.itempool.append(item)
itempool.append(item)
else:
self.multiworld.itempool.append(item)
itempool.append(item)

self.multi_key = self.generate_multi_key()

Expand All @@ -280,21 +282,35 @@ def create_items(self) -> None:
# Properly fill locations within dungeon
location.dungeon = r.dungeon_index

# For now, special case first item
FORCE_START_ITEM = True
if FORCE_START_ITEM:
self.force_start_item()
if self.options.tarins_gift == TarinsGift.option_local_progression:
self.force_start_item(itempool)

self.multiworld.itempool += itempool

def force_start_item(self):
def force_start_item(self, itempool):
threeandthreee marked this conversation as resolved.
Show resolved Hide resolved
start_loc = self.multiworld.get_location("Tarin's Gift (Mabe Village)", self.player)
if not start_loc.item:
possible_start_items = [index for index, item in enumerate(self.multiworld.itempool)
if item.player == self.player
and item.item_data.ladxr_id in start_loc.ladxr_item.OPTIONS and not item.location]
if possible_start_items:
index = self.random.choice(possible_start_items)
start_item = self.multiworld.itempool.pop(index)
start_loc.place_locked_item(start_item)
"""
Find an item that forces progression for the player
"""
base_collection_state = CollectionState(self.multiworld)
base_collection_state.update_reachable_regions(self.player)
reachable_count = len(base_collection_state.reachable_regions[self.player])

def gives_progression(item):
collection_state = base_collection_state.copy()
collection_state.collect(item)
# Why isn't this needed?
# collection_state.update_reachable_regions(self.player)
return len(collection_state.reachable_regions[self.player]) > reachable_count
possible_start_items = [item for item in itempool if item.advancement]
self.random.shuffle(possible_start_items)

for item in possible_start_items:
if gives_progression(item):
itempool.remove(item)
start_loc.place_locked_item(item)
return

def get_pre_fill_items(self):
return self.pre_fill_items
Expand Down
Loading