Blasphemous: Fix starting_location: random affecting all Blasphemous worlds (#4428)

Option resolution for the `StartingLocation` option (the only
`ChoiceIsRandom` subclass) was writing to the `randomized` attribute on
the class instead of on the instance, meaning that
`self.options.starting_location.randomized` would be `True` for all
Blasphemous players in the multiworld if any one of the players set
their `StartingLocation` option to `"random"`.

This patch fixes the issue by writing to the `randomized` attribute on
the new instance instead of on the class.
This commit is contained in:
Mysteryem 2025-01-03 12:03:30 +00:00 committed by GitHub
parent 2a11d9fec3
commit 5927926314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -4,14 +4,17 @@ import random
class ChoiceIsRandom(Choice): class ChoiceIsRandom(Choice):
randomized: bool = False randomized: bool
def __init__(self, value: int, randomized: bool = False):
super().__init__(value)
self.randomized = randomized
@classmethod @classmethod
def from_text(cls, text: str) -> Choice: def from_text(cls, text: str) -> Choice:
text = text.lower() text = text.lower()
if text == "random": if text == "random":
cls.randomized = True return cls(random.choice(list(cls.name_lookup)), True)
return cls(random.choice(list(cls.name_lookup)))
for option_name, value in cls.options.items(): for option_name, value in cls.options.items():
if option_name == text: if option_name == text:
return cls(value) return cls(value)