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):
|
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)
|
||||||
|
|
Loading…
Reference in New Issue