-
Notifications
You must be signed in to change notification settings - Fork 670
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
ALttP: fix dungeon fill failures properly #1812
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
482d704
alttp: remove triforce during dungeon item fill
espeon65536 fd160ed
ALttP: proper fix for minimal key failures
espeon65536 81610a7
Merge branch 'main' of https://github.com/ArchipelagoMW/Archipelago i…
espeon65536 3f0fca0
alttp: only remove items which were actually in the list
espeon65536 05f9097
do not write code at 2am
espeon65536 22d91c1
Merge branch 'main' into minimal_test
Berserker66 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
import typing | ||||||
|
||||||
from BaseClasses import Dungeon | ||||||
from BaseClasses import CollectionState, Dungeon | ||||||
from Fill import fill_restrictive | ||||||
|
||||||
from .Bosses import BossFactory | ||||||
|
@@ -154,16 +154,33 @@ def fill_dungeons_restrictive(world): | |||||
(not (item.player, item.name) in dungeon_specific or item.dungeon is dungeon) and orig_rule(item) | ||||||
|
||||||
world.random.shuffle(locations) | ||||||
all_state_base = world.get_all_state(use_cache=True) | ||||||
# Dungeon-locked items have to be placed first, to not run out of spaces for dungeon-locked items | ||||||
# subsort in the order Big Key, Small Key, Other before placing dungeon items | ||||||
|
||||||
sort_order = {"BigKey": 3, "SmallKey": 2} | ||||||
in_dungeon_items.sort( | ||||||
key=lambda item: sort_order.get(item.type, 1) + | ||||||
(5 if (item.player, item.name) in dungeon_specific else 0)) | ||||||
|
||||||
# Construct a partial all_state which contains only the items from get_pre_fill_items which aren't in_dungeon | ||||||
in_dungeon_player_ids = {item.player for item in in_dungeon_items} | ||||||
all_state_base = CollectionState(world) | ||||||
for item in world.itempool: | ||||||
world.worlds[item.player].collect(all_state_base, item) | ||||||
pre_fill_items = [] | ||||||
for player in in_dungeon_player_ids: | ||||||
subworld = world.worlds[item.player] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
pre_fill_items += subworld.get_pre_fill_items() | ||||||
for item in in_dungeon_items: | ||||||
all_state_base.remove(item) | ||||||
try: | ||||||
pre_fill_items.remove(item) | ||||||
except ValueError: | ||||||
# pre_fill_items should be a subset of in_dungeon_items, but just in case | ||||||
pass | ||||||
for item in pre_fill_items: | ||||||
subworld.collect(all_state_base, item) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Local variable 'subworld' might be referenced before assignment" |
||||||
all_state_base.sweep_for_events() | ||||||
|
||||||
|
||||||
# Remove completion condition so that minimal-accessibility worlds place keys properly | ||||||
for player in {item.player for item in in_dungeon_items}: | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Local variable 'item' might be referenced before assignment "
This one seems like a fatal mistake.