Skip to content

Commit 996052a

Browse files
SilvrisAustinSumigray
authored andcommitted
ALTTP: Plando (ArchipelagoMW#2904) fixes (ArchipelagoMW#3834)
1 parent 5afda4d commit 996052a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Options.py

+14
Original file line numberDiff line numberDiff line change
@@ -973,14 +973,28 @@ def from_any(cls, data: PlandoTextsFromAnyType) -> Self:
973973
if random.random() < float(text.get("percentage", 100)/100):
974974
at = text.get("at", None)
975975
if at is not None:
976+
if isinstance(at, dict):
977+
if at:
978+
at = random.choices(list(at.keys()),
979+
weights=list(at.values()), k=1)[0]
980+
else:
981+
raise OptionError("\"at\" must be a valid string or weighted list of strings!")
976982
given_text = text.get("text", [])
983+
if isinstance(given_text, dict):
984+
if not given_text:
985+
given_text = []
986+
else:
987+
given_text = random.choices(list(given_text.keys()),
988+
weights=list(given_text.values()), k=1)
977989
if isinstance(given_text, str):
978990
given_text = [given_text]
979991
texts.append(PlandoText(
980992
at,
981993
given_text,
982994
text.get("percentage", 100)
983995
))
996+
else:
997+
raise OptionError("\"at\" must be a valid string or weighted list of strings!")
984998
elif isinstance(text, PlandoText):
985999
if random.random() < float(text.percentage/100):
9861000
texts.append(text)

worlds/alttp/Options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ class ALttPPlandoConnections(PlandoConnections):
728728
entrances = set([connection[0] for connection in (
729729
*default_connections, *default_dungeon_connections, *inverted_default_connections,
730730
*inverted_default_dungeon_connections)])
731-
exits = set([connection[1] for connection in (
731+
exits = set([connection[0] for connection in (
732732
*default_connections, *default_dungeon_connections, *inverted_default_connections,
733733
*inverted_default_dungeon_connections)])
734734

0 commit comments

Comments
 (0)