diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-08 18:35:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-08 17:35:12 -0600 |
| commit | bbbbc71bee25cfd22c5304f98f5a7881383585a3 (patch) | |
| tree | d27581db7b8db03da4b731fe8c2d5072d3162cf8 /__init__.py | |
| download | lingo-apworld-bbbbc71bee25cfd22c5304f98f5a7881383585a3.tar.gz lingo-apworld-bbbbc71bee25cfd22c5304f98f5a7881383585a3.tar.bz2 lingo-apworld-bbbbc71bee25cfd22c5304f98f5a7881383585a3.zip | |
Lingo: New game (#1806)
Co-authored-by: Aaron Wagener <mmmcheese158@gmail.com> Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> Co-authored-by: Phar <zach@alliware.com>
Diffstat (limited to '__init__.py')
| -rw-r--r-- | __init__.py | 112 |
1 files changed, 112 insertions, 0 deletions
| diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..1f426c9 --- /dev/null +++ b/__init__.py | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | """ | ||
| 2 | Archipelago init file for Lingo | ||
| 3 | """ | ||
| 4 | from BaseClasses import Item, Tutorial | ||
| 5 | from worlds.AutoWorld import WebWorld, World | ||
| 6 | from .items import ALL_ITEM_TABLE, LingoItem | ||
| 7 | from .locations import ALL_LOCATION_TABLE | ||
| 8 | from .options import LingoOptions | ||
| 9 | from .player_logic import LingoPlayerLogic | ||
| 10 | from .regions import create_regions | ||
| 11 | from .static_logic import Room, RoomEntrance | ||
| 12 | from .testing import LingoTestOptions | ||
| 13 | |||
| 14 | |||
| 15 | class LingoWebWorld(WebWorld): | ||
| 16 | theme = "grass" | ||
| 17 | tutorials = [Tutorial( | ||
| 18 | "Multiworld Setup Guide", | ||
| 19 | "A guide to playing Lingo with Archipelago.", | ||
| 20 | "English", | ||
| 21 | "setup_en.md", | ||
| 22 | "setup/en", | ||
| 23 | ["hatkirby"] | ||
| 24 | )] | ||
| 25 | |||
| 26 | |||
| 27 | class LingoWorld(World): | ||
| 28 | """ | ||
| 29 | Lingo is a first person indie puzzle game in the vein of The Witness. You find yourself in a mazelike, non-Euclidean | ||
| 30 | world filled with 800 word puzzles that use a variety of different mechanics. | ||
| 31 | """ | ||
| 32 | game = "Lingo" | ||
| 33 | web = LingoWebWorld() | ||
| 34 | |||
| 35 | base_id = 444400 | ||
| 36 | topology_present = True | ||
| 37 | data_version = 1 | ||
| 38 | |||
| 39 | options_dataclass = LingoOptions | ||
| 40 | options: LingoOptions | ||
| 41 | |||
| 42 | item_name_to_id = { | ||
| 43 | name: data.code for name, data in ALL_ITEM_TABLE.items() | ||
| 44 | } | ||
| 45 | location_name_to_id = { | ||
| 46 | name: data.code for name, data in ALL_LOCATION_TABLE.items() | ||
| 47 | } | ||
| 48 | |||
| 49 | player_logic: LingoPlayerLogic | ||
| 50 | |||
| 51 | def generate_early(self): | ||
| 52 | self.player_logic = LingoPlayerLogic(self) | ||
| 53 | |||
| 54 | def create_regions(self): | ||
| 55 | create_regions(self, self.player_logic) | ||
| 56 | |||
| 57 | def create_items(self): | ||
| 58 | pool = [self.create_item(name) for name in self.player_logic.REAL_ITEMS] | ||
| 59 | |||
| 60 | if self.player_logic.FORCED_GOOD_ITEM != "": | ||
| 61 | new_item = self.create_item(self.player_logic.FORCED_GOOD_ITEM) | ||
| 62 | location_obj = self.multiworld.get_location("Second Room - Good Luck", self.player) | ||
| 63 | location_obj.place_locked_item(new_item) | ||
| 64 | |||
| 65 | item_difference = len(self.player_logic.REAL_LOCATIONS) - len(pool) | ||
| 66 | if item_difference: | ||
| 67 | trap_percentage = self.options.trap_percentage | ||
| 68 | traps = int(item_difference * trap_percentage / 100.0) | ||
| 69 | non_traps = item_difference - traps | ||
| 70 | |||
| 71 | if non_traps: | ||
| 72 | skip_percentage = self.options.puzzle_skip_percentage | ||
| 73 | skips = int(non_traps * skip_percentage / 100.0) | ||
| 74 | non_skips = non_traps - skips | ||
| 75 | |||
| 76 | filler_list = [":)", "The Feeling of Being Lost", "Wanderlust", "Empty White Hallways"] | ||
| 77 | for i in range(0, non_skips): | ||
| 78 | pool.append(self.create_item(filler_list[i % len(filler_list)])) | ||
| 79 | |||
| 80 | for i in range(0, skips): | ||
| 81 | pool.append(self.create_item("Puzzle Skip")) | ||
| 82 | |||
| 83 | if traps: | ||
| 84 | traps_list = ["Slowness Trap", "Iceland Trap", "Atbash Trap"] | ||
| 85 | |||
| 86 | for i in range(0, traps): | ||
| 87 | pool.append(self.create_item(traps_list[i % len(traps_list)])) | ||
| 88 | |||
| 89 | self.multiworld.itempool += pool | ||
| 90 | |||
| 91 | def create_item(self, name: str) -> Item: | ||
| 92 | item = ALL_ITEM_TABLE[name] | ||
| 93 | return LingoItem(name, item.classification, item.code, self.player) | ||
| 94 | |||
| 95 | def set_rules(self): | ||
| 96 | self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player) | ||
| 97 | |||
| 98 | def fill_slot_data(self): | ||
| 99 | slot_options = [ | ||
| 100 | "death_link", "victory_condition", "shuffle_colors", "shuffle_doors", "shuffle_paintings", "shuffle_panels", | ||
| 101 | "mastery_achievements", "level_2_requirement", "location_checks", "early_color_hallways" | ||
| 102 | ] | ||
| 103 | |||
| 104 | slot_data = { | ||
| 105 | "seed": self.random.randint(0, 1000000), | ||
| 106 | **self.options.as_dict(*slot_options), | ||
| 107 | } | ||
| 108 | |||
| 109 | if self.options.shuffle_paintings: | ||
| 110 | slot_data["painting_entrance_to_exit"] = self.player_logic.PAINTING_MAPPING | ||
| 111 | |||
| 112 | return slot_data | ||
