Skip to content

Commit

Permalink
LTTP: remove multiworld = None (ArchipelagoMW#2290)
Browse files Browse the repository at this point in the history
  • Loading branch information
alwaysintreble authored and EmilyV99 committed Apr 15, 2024
1 parent 70aee40 commit d04adeb
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 122 deletions.
8 changes: 4 additions & 4 deletions test/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from worlds.AutoWorld import World, call_all

from BaseClasses import Location, MultiWorld, CollectionState, ItemClassification, Item
from worlds.alttp.Items import ItemFactory
from worlds.alttp.Items import item_factory


class TestBase(unittest.TestCase):
Expand Down Expand Up @@ -91,15 +91,15 @@ def _get_items(self, item_pool, all_except):
items = self.multiworld.itempool[:]
items = [item for item in items if
item.name not in all_except and not ("Bottle" in item.name and "AnyBottle" in all_except)]
items.extend(ItemFactory(item_pool[0], 1))
items.extend(item_factory(item_pool[0], self.multiworld.worlds[1]))
else:
items = ItemFactory(item_pool[0], 1)
items = item_factory(item_pool[0], self.multiworld.worlds[1])
return self.get_state(items)

def _get_items_partial(self, item_pool, missing_item):
new_items = item_pool[0].copy()
new_items.remove(missing_item)
items = ItemFactory(new_items, 1)
items = item_factory(new_items, self.multiworld.worlds[1])
return self.get_state(items)


Expand Down
2 changes: 1 addition & 1 deletion test/general/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestBase(unittest.TestCase):
def test_create_item(self):
"""Test that a world can successfully create all items in its datapackage"""
for game_name, world_type in AutoWorldRegister.world_types.items():
proxy_world = world_type(None, 0) # this is identical to MultiServer.py creating worlds
proxy_world = setup_solo_multiworld(world_type, ()).worlds[1]
for item_name in world_type.item_name_to_id:
with self.subTest("Create Item", item_name=item_name, game_name=game_name):
item = proxy_world.create_item(item_name)
Expand Down
1 change: 1 addition & 0 deletions worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ class World(metaclass=AutoWorldRegister):
"""path it was loaded from"""

def __init__(self, multiworld: "MultiWorld", player: int):
assert multiworld is not None
self.multiworld = multiworld
self.player = player

Expand Down
86 changes: 43 additions & 43 deletions worlds/alttp/Dungeons.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from Fill import fill_restrictive

from .Bosses import BossFactory, Boss
from .Items import ItemFactory
from .Items import item_factory
from .Regions import lookup_boss_drops, key_drop_data
from .Options import small_key_shuffle

Expand Down Expand Up @@ -81,90 +81,90 @@ def make_dungeon(name, default_boss, dungeon_regions, big_key, small_keys, dunge
return dungeon

ES = make_dungeon('Hyrule Castle', None, ['Hyrule Castle', 'Sewers', 'Sewer Drop', 'Sewers (Dark)', 'Sanctuary'],
ItemFactory('Big Key (Hyrule Castle)', player),
ItemFactory(['Small Key (Hyrule Castle)'] * 4, player),
[ItemFactory('Map (Hyrule Castle)', player)])
item_factory('Big Key (Hyrule Castle)', world),
item_factory(['Small Key (Hyrule Castle)'] * 4, world),
[item_factory('Map (Hyrule Castle)', world)])
EP = make_dungeon('Eastern Palace', 'Armos Knights', ['Eastern Palace'],
ItemFactory('Big Key (Eastern Palace)', player),
ItemFactory(['Small Key (Eastern Palace)'] * 2, player),
ItemFactory(['Map (Eastern Palace)', 'Compass (Eastern Palace)'], player))
item_factory('Big Key (Eastern Palace)', world),
item_factory(['Small Key (Eastern Palace)'] * 2, world),
item_factory(['Map (Eastern Palace)', 'Compass (Eastern Palace)'], world))
DP = make_dungeon('Desert Palace', 'Lanmolas',
['Desert Palace North', 'Desert Palace Main (Inner)', 'Desert Palace Main (Outer)',
'Desert Palace East'], ItemFactory('Big Key (Desert Palace)', player),
ItemFactory(['Small Key (Desert Palace)'] * 4, player),
ItemFactory(['Map (Desert Palace)', 'Compass (Desert Palace)'], player))
'Desert Palace East'], item_factory('Big Key (Desert Palace)', world),
item_factory(['Small Key (Desert Palace)'] * 4, world),
item_factory(['Map (Desert Palace)', 'Compass (Desert Palace)'], world))
ToH = make_dungeon('Tower of Hera', 'Moldorm',
['Tower of Hera (Bottom)', 'Tower of Hera (Basement)', 'Tower of Hera (Top)'],
ItemFactory('Big Key (Tower of Hera)', player),
[ItemFactory('Small Key (Tower of Hera)', player)],
ItemFactory(['Map (Tower of Hera)', 'Compass (Tower of Hera)'], player))
item_factory('Big Key (Tower of Hera)', world),
[item_factory('Small Key (Tower of Hera)', world)],
item_factory(['Map (Tower of Hera)', 'Compass (Tower of Hera)'], world))
PoD = make_dungeon('Palace of Darkness', 'Helmasaur King',
['Palace of Darkness (Entrance)', 'Palace of Darkness (Center)',
'Palace of Darkness (Big Key Chest)', 'Palace of Darkness (Bonk Section)',
'Palace of Darkness (North)', 'Palace of Darkness (Maze)',
'Palace of Darkness (Harmless Hellway)', 'Palace of Darkness (Final Section)'],
ItemFactory('Big Key (Palace of Darkness)', player),
ItemFactory(['Small Key (Palace of Darkness)'] * 6, player),
ItemFactory(['Map (Palace of Darkness)', 'Compass (Palace of Darkness)'], player))
item_factory('Big Key (Palace of Darkness)', world),
item_factory(['Small Key (Palace of Darkness)'] * 6, world),
item_factory(['Map (Palace of Darkness)', 'Compass (Palace of Darkness)'], world))
TT = make_dungeon('Thieves Town', 'Blind', ['Thieves Town (Entrance)', 'Thieves Town (Deep)', 'Blind Fight'],
ItemFactory('Big Key (Thieves Town)', player),
ItemFactory(['Small Key (Thieves Town)'] * 3, player),
ItemFactory(['Map (Thieves Town)', 'Compass (Thieves Town)'], player))
item_factory('Big Key (Thieves Town)', world),
item_factory(['Small Key (Thieves Town)'] * 3, world),
item_factory(['Map (Thieves Town)', 'Compass (Thieves Town)'], world))
SW = make_dungeon('Skull Woods', 'Mothula', ['Skull Woods Final Section (Entrance)', 'Skull Woods First Section',
'Skull Woods Second Section', 'Skull Woods Second Section (Drop)',
'Skull Woods Final Section (Mothula)',
'Skull Woods First Section (Right)',
'Skull Woods First Section (Left)', 'Skull Woods First Section (Top)'],
ItemFactory('Big Key (Skull Woods)', player),
ItemFactory(['Small Key (Skull Woods)'] * 5, player),
ItemFactory(['Map (Skull Woods)', 'Compass (Skull Woods)'], player))
item_factory('Big Key (Skull Woods)', world),
item_factory(['Small Key (Skull Woods)'] * 5, world),
item_factory(['Map (Skull Woods)', 'Compass (Skull Woods)'], world))
SP = make_dungeon('Swamp Palace', 'Arrghus',
['Swamp Palace (Entrance)', 'Swamp Palace (First Room)', 'Swamp Palace (Starting Area)',
'Swamp Palace (West)', 'Swamp Palace (Center)', 'Swamp Palace (North)'],
ItemFactory('Big Key (Swamp Palace)', player),
ItemFactory(['Small Key (Swamp Palace)'] * 6, player),
ItemFactory(['Map (Swamp Palace)', 'Compass (Swamp Palace)'], player))
item_factory('Big Key (Swamp Palace)', world),
item_factory(['Small Key (Swamp Palace)'] * 6, world),
item_factory(['Map (Swamp Palace)', 'Compass (Swamp Palace)'], world))
IP = make_dungeon('Ice Palace', 'Kholdstare',
['Ice Palace (Entrance)', 'Ice Palace (Second Section)', 'Ice Palace (Main)', 'Ice Palace (East)',
'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], ItemFactory('Big Key (Ice Palace)', player),
ItemFactory(['Small Key (Ice Palace)'] * 6, player),
ItemFactory(['Map (Ice Palace)', 'Compass (Ice Palace)'], player))
'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], item_factory('Big Key (Ice Palace)', world),
item_factory(['Small Key (Ice Palace)'] * 6, world),
item_factory(['Map (Ice Palace)', 'Compass (Ice Palace)'], world))
MM = make_dungeon('Misery Mire', 'Vitreous',
['Misery Mire (Entrance)', 'Misery Mire (Main)', 'Misery Mire (West)', 'Misery Mire (Final Area)',
'Misery Mire (Vitreous)'], ItemFactory('Big Key (Misery Mire)', player),
ItemFactory(['Small Key (Misery Mire)'] * 6, player),
ItemFactory(['Map (Misery Mire)', 'Compass (Misery Mire)'], player))
'Misery Mire (Vitreous)'], item_factory('Big Key (Misery Mire)', world),
item_factory(['Small Key (Misery Mire)'] * 6, world),
item_factory(['Map (Misery Mire)', 'Compass (Misery Mire)'], world))
TR = make_dungeon('Turtle Rock', 'Trinexx',
['Turtle Rock (Entrance)', 'Turtle Rock (First Section)', 'Turtle Rock (Chain Chomp Room)',
'Turtle Rock (Pokey Room)',
'Turtle Rock (Second Section)', 'Turtle Rock (Big Chest)', 'Turtle Rock (Crystaroller Room)',
'Turtle Rock (Dark Room)', 'Turtle Rock (Eye Bridge)', 'Turtle Rock (Trinexx)'],
ItemFactory('Big Key (Turtle Rock)', player),
ItemFactory(['Small Key (Turtle Rock)'] * 6, player),
ItemFactory(['Map (Turtle Rock)', 'Compass (Turtle Rock)'], player))
item_factory('Big Key (Turtle Rock)', world),
item_factory(['Small Key (Turtle Rock)'] * 6, world),
item_factory(['Map (Turtle Rock)', 'Compass (Turtle Rock)'], world))

if multiworld.mode[player] != 'inverted':
AT = make_dungeon('Agahnims Tower', 'Agahnim', ['Agahnims Tower', 'Agahnim 1'], None,
ItemFactory(['Small Key (Agahnims Tower)'] * 4, player), [])
item_factory(['Small Key (Agahnims Tower)'] * 4, world), [])
GT = make_dungeon('Ganons Tower', 'Agahnim2',
['Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)', 'Ganons Tower (Compass Room)',
'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)', 'Ganons Tower (Firesnake Room)',
'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)', 'Ganons Tower (Top)',
'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)', 'Agahnim 2'],
ItemFactory('Big Key (Ganons Tower)', player),
ItemFactory(['Small Key (Ganons Tower)'] * 8, player),
ItemFactory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'], player))
item_factory('Big Key (Ganons Tower)', world),
item_factory(['Small Key (Ganons Tower)'] * 8, world),
item_factory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'], world))
else:
AT = make_dungeon('Inverted Agahnims Tower', 'Agahnim', ['Inverted Agahnims Tower', 'Agahnim 1'], None,
ItemFactory(['Small Key (Agahnims Tower)'] * 4, player), [])
item_factory(['Small Key (Agahnims Tower)'] * 4, world), [])
GT = make_dungeon('Inverted Ganons Tower', 'Agahnim2',
['Inverted Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)',
'Ganons Tower (Compass Room)', 'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)',
'Ganons Tower (Firesnake Room)', 'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)',
'Ganons Tower (Top)', 'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)',
'Agahnim 2'], ItemFactory('Big Key (Ganons Tower)', player),
ItemFactory(['Small Key (Ganons Tower)'] * 8, player),
ItemFactory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'], player))
'Agahnim 2'], item_factory('Big Key (Ganons Tower)', world),
item_factory(['Small Key (Ganons Tower)'] * 8, world),
item_factory(['Map (Ganons Tower)', 'Compass (Ganons Tower)'], world))

GT.bosses['bottom'] = BossFactory('Armos Knights', player)
GT.bosses['middle'] = BossFactory('Lanmolas', player)
Expand Down Expand Up @@ -259,7 +259,7 @@ def fill_dungeons_restrictive(multiworld: MultiWorld):
if not key_drop_shuffle and player not in multiworld.groups:
for key_loc in key_drop_data:
key_data = key_drop_data[key_loc]
all_state_base.remove(ItemFactory(key_data[3], player))
all_state_base.remove(item_factory(key_data[3], multiworld.worlds[player]))
loc = multiworld.get_location(key_loc, player)

if loc in all_state_base.events:
Expand Down
Loading

0 comments on commit d04adeb

Please sign in to comment.