summary refs log tree commit diff stats
path: root/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to '__init__.py')
-rw-r--r--__init__.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/__init__.py b/__init__.py index 8d6a7fc..3b67617 100644 --- a/__init__.py +++ b/__init__.py
@@ -3,7 +3,7 @@ Archipelago init file for Lingo
3""" 3"""
4from logging import warning 4from logging import warning
5 5
6from BaseClasses import Item, ItemClassification, Tutorial 6from BaseClasses import CollectionState, Item, ItemClassification, Tutorial
7from Options import OptionError 7from Options import OptionError
8from worlds.AutoWorld import WebWorld, World 8from worlds.AutoWorld import WebWorld, World
9from .datatypes import Room, RoomEntrance 9from .datatypes import Room, RoomEntrance
@@ -68,6 +68,37 @@ class LingoWorld(World):
68 def create_regions(self): 68 def create_regions(self):
69 create_regions(self) 69 create_regions(self)
70 70
71 if not self.options.shuffle_postgame:
72 state = CollectionState(self.multiworld)
73 state.collect(LingoItem("Prevent Victory", ItemClassification.progression, None, self.player), True)
74
75 # Note: relies on the assumption that real_items is a definitive list of real progression items in this
76 # world, and is not modified after being created.
77 for item in self.player_logic.real_items:
78 state.collect(self.create_item(item), True)
79
80 # Exception to the above: a forced good item is not considered a "real item", but needs to be here anyway.
81 if self.player_logic.forced_good_item != "":
82 state.collect(self.create_item(self.player_logic.forced_good_item), True)
83
84 all_locations = self.multiworld.get_locations(self.player)
85 state.sweep_for_events(locations=all_locations)
86
87 unreachable_locations = [location for location in all_locations
88 if not state.can_reach_location(location.name, self.player)]
89
90 for location in unreachable_locations:
91 if location.name in self.player_logic.event_loc_to_item.keys():
92 continue
93
94 self.player_logic.real_locations.remove(location.name)
95 location.parent_region.locations.remove(location)
96
97 if len(self.player_logic.real_items) > len(self.player_logic.real_locations):
98 raise OptionError(f"{self.player_name}'s Lingo world does not have enough locations to fit the number"
99 f" of required items without shuffling the postgame. Either enable postgame"
100 f" shuffling, or choose different options.")
101
71 def create_items(self): 102 def create_items(self):
72 pool = [self.create_item(name) for name in self.player_logic.real_items] 103 pool = [self.create_item(name) for name in self.player_logic.real_items]
73 104