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:
parent
2a11d9fec3
commit
5927926314
|
@ -4,14 +4,17 @@ import random
|
|||
|
||||
|
||||
class ChoiceIsRandom(Choice):
|
||||
randomized: bool = False
|
||||
randomized: bool
|
||||
|
||||
def __init__(self, value: int, randomized: bool = False):
|
||||
super().__init__(value)
|
||||
self.randomized = randomized
|
||||
|
||||
@classmethod
|
||||
def from_text(cls, text: str) -> Choice:
|
||||
text = text.lower()
|
||||
if text == "random":
|
||||
cls.randomized = True
|
||||
return cls(random.choice(list(cls.name_lookup)))
|
||||
return cls(random.choice(list(cls.name_lookup)), True)
|
||||
for option_name, value in cls.options.items():
|
||||
if option_name == text:
|
||||
return cls(value)
|
||||
|
|
Loading…
Reference in New Issue