about summary refs log tree commit diff stats
path: root/apworld/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'apworld/__init__.py')
-rw-r--r--apworld/__init__.py51
1 files changed, 49 insertions, 2 deletions
diff --git a/apworld/__init__.py b/apworld/__init__.py index 20c1454..54f870f 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py
@@ -1,18 +1,27 @@
1""" 1"""
2Archipelago init file for Lingo 2 2Archipelago init file for Lingo 2
3""" 3"""
4from BaseClasses import ItemClassification, Item 4from BaseClasses import ItemClassification, Item, Tutorial
5from worlds.AutoWorld import WebWorld, World 5from worlds.AutoWorld import WebWorld, World
6from .items import Lingo2Item 6from .items import Lingo2Item
7from .options import Lingo2Options 7from .options import Lingo2Options
8from .player_logic import Lingo2PlayerLogic 8from .player_logic import Lingo2PlayerLogic
9from .regions import create_regions 9from .regions import create_regions
10from .static_logic import Lingo2StaticLogic 10from .static_logic import Lingo2StaticLogic
11from .version import APWORLD_VERSION
11 12
12 13
13class Lingo2WebWorld(WebWorld): 14class Lingo2WebWorld(WebWorld):
14 rich_text_options_doc = True 15 rich_text_options_doc = True
15 theme = "grass" 16 theme = "grass"
17 tutorials = [Tutorial(
18 "Multiworld Setup Guide",
19 "A guide to playing Lingo 2 with Archipelago.",
20 "English",
21 "en_Lingo_2.md",
22 "setup/en",
23 ["hatkirby"]
24 )]
16 25
17 26
18class Lingo2World(World): 27class Lingo2World(World):
@@ -24,12 +33,16 @@ class Lingo2World(World):
24 game = "Lingo 2" 33 game = "Lingo 2"
25 web = Lingo2WebWorld() 34 web = Lingo2WebWorld()
26 35
36 topology_present = True
37
27 options_dataclass = Lingo2Options 38 options_dataclass = Lingo2Options
28 options: Lingo2Options 39 options: Lingo2Options
29 40
30 static_logic = Lingo2StaticLogic() 41 static_logic = Lingo2StaticLogic()
31 item_name_to_id = static_logic.item_name_to_id 42 item_name_to_id = static_logic.item_name_to_id
32 location_name_to_id = static_logic.location_name_to_id 43 location_name_to_id = static_logic.location_name_to_id
44 item_name_groups = static_logic.item_name_groups
45 location_name_groups = static_logic.location_name_groups
33 46
34 player_logic: Lingo2PlayerLogic 47 player_logic: Lingo2PlayerLogic
35 48
@@ -46,7 +59,41 @@ class Lingo2World(World):
46 def create_items(self): 59 def create_items(self):
47 pool = [self.create_item(name) for name in self.player_logic.real_items] 60 pool = [self.create_item(name) for name in self.player_logic.real_items]
48 61
62 total_locations = sum(len(locs) for locs in self.player_logic.locations_by_room.values())
63
64 item_difference = total_locations - len(pool)
65 for i in range(0, item_difference):
66 pool.append(self.create_item(self.get_filler_item_name()))
67
49 self.multiworld.itempool += pool 68 self.multiworld.itempool += pool
50 69
51 def create_item(self, name: str) -> Item: 70 def create_item(self, name: str) -> Item:
52 return Lingo2Item(name, ItemClassification.progression, self.item_name_to_id.get(name), self.player) 71 return Lingo2Item(name, ItemClassification.filler if name == self.get_filler_item_name() else
72 ItemClassification.progression,
73 self.item_name_to_id.get(name), self.player)
74
75 def set_rules(self):
76 self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player)
77
78 def fill_slot_data(self):
79 slot_options = [
80 "cyan_door_behavior",
81 "daedalus_roof_access",
82 "keyholder_sanity",
83 "shuffle_control_center_colors",
84 "shuffle_doors",
85 "shuffle_gallery_paintings",
86 "shuffle_letters",
87 "shuffle_symbols",
88 "victory_condition",
89 ]
90
91 slot_data = {
92 **self.options.as_dict(*slot_options),
93 "version": [self.static_logic.get_data_version(), APWORLD_VERSION],
94 }
95
96 return slot_data
97
98 def get_filler_item_name(self) -> str:
99 return "A Job Well Done"