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

Fix logic for Kak Granny Buy Blue Potion #2132

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

fenhl
Copy link
Collaborator

@fenhl fenhl commented Nov 8, 2023

The logic previously required actually having obtained the trade quest item even if that item comes later in the sequence than the odd mushroom. The actual in-game flag is also set if adult trade shuffle is off and the starting trade item is the odd potion or later.

See discussion in #dev-bug-reports starting here for context.

Now includes a fix contributed by @mracsys to handle adult trade items being plando'd.

@fenhl fenhl added Type: Bug Something isn't working Component: Logic Non-trivial changes to the JSON logic files labels Nov 8, 2023
@mracsys
Copy link

mracsys commented Nov 8, 2023

I have the plando fix I discussed implemented. Using that and the spoiler from the seed that prompted the bug report, I get an unbeatable world with this logic change during plando fill validation:

Kak Granny Buy Blue Potion in world 1 is not reachable without Bomb Bag in world 1!
Traceback (most recent call last):
  File "/home/mracsys/git/OoT-Randomizer-Fork/OoTRandomizer.py", line 58, in start
    main(settings)
  File "/home/mracsys/git/OoT-Randomizer-Fork/Main.py", line 46, in main
    spoiler = generate(settings)
  File "/home/mracsys/git/OoT-Randomizer-Fork/Main.py", line 115, in generate
    place_items(worlds)
  File "/home/mracsys/git/OoT-Randomizer-Fork/Main.py", line 172, in place_items
    distribute_items_restrictive(worlds)
  File "/home/mracsys/git/OoT-Randomizer-Fork/Fill.py", line 85, in distribute_items_restrictive
    worlds[0].settings.distribution.fill(worlds, [shop_locations, song_locations, fill_locations], [shopitempool, dungeon_items, songitempool, progitempool, prioitempool, restitempool])
  File "/home/mracsys/git/OoT-Randomizer-Fork/Plandomizer.py", line 1221, in fill
    world_dist.fill(worlds, location_pools, item_pools)
  File "/home/mracsys/git/OoT-Randomizer-Fork/Plandomizer.py", line 927, in fill
    raise FillError('%s in world %d is not reachable without %s in world %d!' % (location.name, self.id + 1, item.name, player_id + 1))
Fill.FillError: Kak Granny Buy Blue Potion in world 1 is not reachable without Bomb Bag in world 1!

@mracsys
Copy link

mracsys commented Nov 8, 2023

Search is a pain to debug with the move to solver IDs instead of item names. It'll take a bit for me to tease out.

@fenhl fenhl added the Component: Plandomizer Plandomizer library and functionality label Nov 8, 2023
@mracsys
Copy link

mracsys commented Nov 8, 2023

This logic fix is not working for plando because the rule parser is pre-calculating world attributes. This will also fail without plando as the parser runs before the item pool is generated and this selected_adult_trade_item is updated from an empty string.

It's not straightforward to remove that parser optimization. I think the right path is to move the check to the world constructor instead of in Item Pool. Plando checks could run at the same time instead of during fill.

Unparsed rule string for Kak Granny Buy Blue Potion for reference: "state.has_all_of((Progressive_Wallet,)) and age == 'adult' and state.has_any_of((Odd_Potion_Access,))"

@fenhl
Copy link
Collaborator Author

fenhl commented Nov 8, 2023

@mracsys how does this look?

Copy link

@mracsys mracsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that these changes work with the bug report spoiler. Still pending checks for earlier trade sequence item and full trade shuffle.

Spoiler for the bug report seed shows the trade item no longer required as expected:

"Path to Volvagia":     {
        "Sheik at Colossus":           "Zeldas Lullaby",
        "Deku Tree Map Chest":         "Progressive Wallet",
        "Kak Granny Buy Blue Potion":  "Bomb Bag",
        "Colossus Great Fairy Reward": "Megaton Hammer"
      }

Rule string ends up as "state.has_all_of((Progressive_Wallet,)) and age == 'adult'"

World.py Outdated Show resolved Hide resolved
World.py Outdated Show resolved Hide resolved
@mracsys
Copy link

mracsys commented Nov 8, 2023

To confirm, any of the following result in the following rule as expected: "state.has_all_of((Progressive_Wallet,)) and age == 'adult' and state.has_any_of((Odd_Potion_Access,))"

  • Possible trade sequence items are up to and including Odd Mushroom
  • Plando'd item is up to and including Odd Mushroom
  • Full trade shuffle is enabled

This is testing on my branch with the above review comments incorporated.

@mracsys
Copy link

mracsys commented Nov 8, 2023

For reproducibility: OoTR_1517552_UZ14LWEPET_Spoilers.txt

@mracsys
Copy link

mracsys commented Nov 8, 2023

The following scenarios were also verified by plando'ing Light Arrows on Kak Granny Buy Blue Potion:
granny_logic_check.txt

  • Full trade shuffle, all items through Odd Potion are unshuffled. Playthrough correctly collects Pocket Egg from Anju and works through the trade sequence
  • Full trade shuffle, Cojiro is shuffled and Odd Mushroom is unshuffled. Cojiro is collected and WOTH, and unshuffled Pocket Egg is ignored.
  • Full trade shuffle, Odd Mushroom is shuffled. Odd Mushroom is collected and WOTH.
  • Single item trade shuffle, no items selected to be candidate items. Vanilla trade sequence up to Granny is collected.
  • Single item trade shuffle, only items up to Odd Mushroom permitted (verifying opposite case of the bug report spoiler). Cojiro was selected, collected, and is WOTH as expected.

Seems good to go.

World.py Show resolved Hide resolved
@r0bd0g
Copy link

r0bd0g commented Nov 8, 2023

Logic Review

You should confirm this! (edit: Kirox did), but I can't think of any reason why the OoT Devs would not have left it possible to buy the blue potion as child? The Odd Potion Access event already confirms adult for actually showing the trade item, so probably the is_adult check needs to be removed from the logic for the blue potion check. This could come up in S7 if Interiors are shuffled.

@cjohnson57
Copy link
Collaborator

Thanks to everyone for their great work on this! Especially in such a short timespan, you guys rock

@cjohnson57 cjohnson57 merged commit fed3240 into OoTRandomizer:Dev Nov 8, 2023
3 checks passed
@r0bd0g
Copy link

r0bd0g commented Nov 8, 2023

This PR still has an issue per my previous comment.

@fenhl fenhl deleted the blue-potion-logic-fix branch November 8, 2023 22:56
@fenhl
Copy link
Collaborator Author

fenhl commented Nov 8, 2023

#2133

@cjohnson57
Copy link
Collaborator

This PR still has an issue per my previous comment.

Ah, I incorrectly thought the edit meant there was no issue

@r0bd0g
Copy link

r0bd0g commented Nov 8, 2023

Oh I see. No I just meant that Kirox confirmed the check is purchasable as child.

@fenhl fenhl added this to the 8.0 milestone Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Logic Non-trivial changes to the JSON logic files Component: Plandomizer Plandomizer library and functionality Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants