From dbf04585754fd5c78ded2c313c6218c0262670ec Mon Sep 17 00:00:00 2001 From: Alchav <59858495+Alchav@users.noreply.github.com> Date: Thu, 19 May 2022 09:37:26 -0400 Subject: [PATCH] Implement get_filler_item_name for various games (#451) --- worlds/alttp/__init__.py | 9 +++++++-- worlds/archipidle/__init__.py | 2 ++ worlds/ff1/__init__.py | 2 ++ worlds/minecraft/__init__.py | 3 +++ worlds/oot/__init__.py | 3 +++ worlds/rogue-legacy/__init__.py | 3 +++ worlds/sm/__init__.py | 15 +++++++++++++++ worlds/sm64ex/__init__.py | 3 +++ worlds/soe/__init__.py | 3 +++ worlds/spire/__init__.py | 3 +++ 10 files changed, 44 insertions(+), 2 deletions(-) diff --git a/worlds/alttp/__init__.py b/worlds/alttp/__init__.py index 05b42f21..b782a15d 100644 --- a/worlds/alttp/__init__.py +++ b/worlds/alttp/__init__.py @@ -8,7 +8,7 @@ from BaseClasses import Item, CollectionState, Tutorial from .SubClasses import ALttPItem from ..AutoWorld import World, WebWorld, LogicMixin from .Options import alttp_options, smallkey_shuffle -from .Items import as_dict_item_table, item_name_groups, item_table +from .Items import as_dict_item_table, item_name_groups, item_table, GetBeemizerItem from .Regions import lookup_name_to_id, create_regions, mark_light_world_regions from .Rules import set_rules from .ItemPool import generate_itempool, difficulties @@ -17,6 +17,7 @@ from .Dungeons import create_dungeons from .Rom import LocalRom, patch_rom, patch_race_rom, patch_enemizer, apply_rom_settings, get_hash_string, \ get_base_rom_path, LttPDeltaPatch import Patch +from itertools import chain from .InvertedRegions import create_inverted_regions, mark_dark_world_regions from .EntranceShuffle import link_entrances, link_inverted_entrances, plando_connect @@ -479,7 +480,11 @@ class ALTTPWorld(World): trash_count -= 1 def get_filler_item_name(self) -> str: - return "Rupees (5)" # temporary + if self.world.goal[self.player] == "icerodhunt": + item = "Nothing" + else: + item = self.world.random.choice(chain(difficulties[self.world.difficulty[self.player]].extras[0:5])) + return GetBeemizerItem(self.world, self.player, item) def get_pre_fill_items(self): res = [] diff --git a/worlds/archipidle/__init__.py b/worlds/archipidle/__init__.py index 859b4d18..e54530af 100644 --- a/worlds/archipidle/__init__.py +++ b/worlds/archipidle/__init__.py @@ -70,6 +70,8 @@ class ArchipIDLEWorld(World): self.world.get_entrance('Entrance to IDLE Zone', self.player)\ .connect(self.world.get_region('IDLE Zone', self.player)) + def get_filler_item_name(self) -> str: + return self.world.random.choice(item_table) def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None): region = Region(name, None, name, player) diff --git a/worlds/ff1/__init__.py b/worlds/ff1/__init__.py index 8b100561..761d9fbb 100644 --- a/worlds/ff1/__init__.py +++ b/worlds/ff1/__init__.py @@ -111,6 +111,8 @@ class FF1World(World): return slot_data + def get_filler_item_name(self) -> str: + return self.world.random.choice(["Heal", "Pure", "Soft", "Tent", "Cabin", "House"]) def get_options(world: MultiWorld, name: str, player: int): return getattr(world, name, None)[player].value diff --git a/worlds/minecraft/__init__.py b/worlds/minecraft/__init__.py index 19cc9ba3..4c75e5a0 100644 --- a/worlds/minecraft/__init__.py +++ b/worlds/minecraft/__init__.py @@ -128,6 +128,9 @@ class MinecraftWorld(World): self.world.itempool += itempool + def get_filler_item_name(self) -> str: + return self.world.random.choices(list(junk_weights.keys()), weights=list(junk_weights.values()))[0] + def set_rules(self): set_advancement_rules(self.world, self.player) set_completion_rules(self.world, self.player) diff --git a/worlds/oot/__init__.py b/worlds/oot/__init__.py index 7bde676f..7a9c52d5 100644 --- a/worlds/oot/__init__.py +++ b/worlds/oot/__init__.py @@ -1038,3 +1038,6 @@ class OOTWorld(World): all_state.stale[self.player] = True return all_state + + def get_filler_item_name(self) -> str: + return get_junk_item(count=1, pool=get_junk_pool(self))[0] diff --git a/worlds/rogue-legacy/__init__.py b/worlds/rogue-legacy/__init__.py index 9cff3736..a02396d3 100644 --- a/worlds/rogue-legacy/__init__.py +++ b/worlds/rogue-legacy/__init__.py @@ -161,6 +161,9 @@ class LegacyWorld(World): self.world.itempool += itempool + def get_filler_item_name(self) -> str: + return self.world.random.choice(list(misc_items_table.keys())) + def create_regions(self): create_regions(self.world, self.player) diff --git a/worlds/sm/__init__.py b/worlds/sm/__init__.py index c08ab2dc..c3bf2d59 100644 --- a/worlds/sm/__init__.py +++ b/worlds/sm/__init__.py @@ -525,6 +525,21 @@ class SMWorld(World): item = next(x for x in ItemManager.Items.values() if x.Name == name) return SMItem(item.Name, True, item.Type, self.item_name_to_id[item.Name], player = self.player) + def get_filler_item_name(self) -> str: + if self.world.random.randint(0, 100) < self.world.minor_qty[self.player].value: + power_bombs = self.world.power_bomb_qty[self.player].value + missiles = self.world.missile_qty[self.player].value + super_missiles = self.world.super_qty[self.player].value + roll = self.world.random.randint(1, power_bombs + missiles + super_missiles) + if roll <= power_bombs: + return "Power Bomb" + elif roll <= power_bombs + missiles: + return "Missile" + else: + return "Super Missile" + else: + return "Nothing" + def pre_fill(self): if (self.variaRando.args.morphPlacement == "early") and next((item for item in self.world.itempool if item.player == self.player and item.name == "Morph Ball"), False): viable = [] diff --git a/worlds/sm64ex/__init__.py b/worlds/sm64ex/__init__.py index 7306f286..e268dcda 100644 --- a/worlds/sm64ex/__init__.py +++ b/worlds/sm64ex/__init__.py @@ -104,6 +104,9 @@ class SM64World(World): self.world.get_location("THI: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock THI")) self.world.get_location("RR: Bob-omb Buddy", self.player).place_locked_item(self.create_item("Cannon Unlock RR")) + def get_filler_item_name(self) -> str: + return "1Up Mushroom" + def fill_slot_data(self): return { "AreaRando": self.area_connections, diff --git a/worlds/soe/__init__.py b/worlds/soe/__init__.py index 0f29bad3..a30319ef 100644 --- a/worlds/soe/__init__.py +++ b/worlds/soe/__init__.py @@ -336,6 +336,9 @@ class SoEWorld(World): payload = multidata["connect_names"][self.world.player_name[self.player]] multidata["connect_names"][self.connect_name] = payload + def get_filler_item_name(self) -> str: + return self.world.random.choice(list(self.item_name_groups["Ingredients"])) + class SoEItem(Item): game: str = "Secret of Evermore" diff --git a/worlds/spire/__init__.py b/worlds/spire/__init__.py index 2b420d62..460b263a 100644 --- a/worlds/spire/__init__.py +++ b/worlds/spire/__init__.py @@ -90,6 +90,9 @@ class SpireWorld(World): slot_data[option_name] = int(option.value) return slot_data + def get_filler_item_name(self) -> str: + return self.world.random.choice(["Card Draw", "Card Draw", "Card Draw", "Relic", "Relic"]) + def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None): ret = Region(name, None, name, player)