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

Bug: Worlds Applying Rules After set_rules #4563

Open
1 of 7 tasks
Exempt-Medic opened this issue Jan 28, 2025 · 5 comments
Open
1 of 7 tasks

Bug: Worlds Applying Rules After set_rules #4563

Exempt-Medic opened this issue Jan 28, 2025 · 5 comments

Comments

@Exempt-Medic
Copy link
Member

Exempt-Medic commented Jan 28, 2025

What happened?

Rules are supposed to be finished by the end of set_rules

The following worlds don't do this:

  • MM2
    self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player)
  • TLOZ
    add_rule(ganon, lambda state: state.has("Silver Arrow", self.player) and state.has("Bow", self.player))
    self.multiworld.get_location("Zelda", self.player).place_locked_item(self.create_event("Rescued Zelda!"))
    add_rule(self.multiworld.get_location("Zelda", self.player),
    lambda state: state.has("Triforce of Power", self.player))
    self.multiworld.completion_condition[self.player] = lambda state: state.has("Rescued Zelda!", self.player)
  • Zillion
    self.multiworld.completion_condition[self.player] = \
    lambda state: state.has("Win", self.player)
  • Zork
    self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player)

@JusticePS @Silvris @FelicitusNeko @Rosalie-A @t3hf1gm3nt @beauxq @nbrochu

What were the expected results?

Rules to be done by set_rules

Software

Local generation

@t3hf1gm3nt
Copy link
Collaborator

t3hf1gm3nt commented Jan 28, 2025

I'll leave TLOZ's bit to Rosalie (since she's been working on a TLOZ overhaul). Should be simple enough to just move it out of generate basic and add it to the end of our set_rules in Rules.py, I think.

@Exempt-Medic
Copy link
Member Author

I'll leave TLOZ's bit to Rosalie (since she's been working on a TLOZ overhaul). Should be simple enough to just move it out of generate basic and add it to the end of our set_rules in Rules.py, I think.

Yeah, pretty much all of these should be that same simple change

@Mysteryem
Copy link
Contributor

I think HK 'all' grub hunt should be included as a note here.
Technically, HK does not change its completion condition function after set_rules, but it does change what its completion condition function checks so it can require extra grubs added by item plando or item link replacements and linked replacements.

It is impossible to know in advance exactly how many extra grubs will be added to the multiworld by set_rules. Item link replacement items specifically have a random cut-off for when the number of items to replace is not divisible by the number of players, e.g. 3 items to link together becomes 1 linked item and 2 replacements, so one player would not get a replacement item, and the player that loses out is chosen randomly.

@Exempt-Medic
Copy link
Member Author

I think HK 'all' grub hunt should be included as a note here.

Yeah I'm aware of it and don't really know what to do about it. It passes this test, but it's unclear to me whether what it's doing is supposed to be allowed.

@beauxq
Copy link
Collaborator

beauxq commented Jan 28, 2025

In case someone wonders why so many worlds do this, it's what the official documentation said to do for a long time.

This was the example code in the documentation:

def generate_basic(self) -> None:
    # place "Victory" at "Final Boss" and set collection as win condition
    self.multiworld.get_location("Final Boss", self.player)
        .place_locked_item(self.create_event("Victory"))
    self.multiworld.completion_condition[self.player] =
        lambda state: state.has("Victory", self.player)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants