add World.location_names
This commit is contained in:
parent
9821e05386
commit
ae32315bf7
47
Main.py
47
Main.py
|
@ -125,7 +125,8 @@ def main(args, seed=None):
|
|||
world.slot_seeds = {player: random.Random(world.random.randint(0, 999999999)) for player in
|
||||
range(1, world.players + 1)}
|
||||
|
||||
for player in range(1, world.players + 1):
|
||||
# system for sharing ER layouts
|
||||
for player in world.alttp_player_ids:
|
||||
world.er_seeds[player] = str(world.random.randint(0, 2 ** 64))
|
||||
|
||||
if "-" in world.shuffle[player]:
|
||||
|
@ -134,7 +135,6 @@ def main(args, seed=None):
|
|||
if shuffle == "vanilla":
|
||||
world.er_seeds[player] = "vanilla"
|
||||
elif seed.startswith("group-") or args.race:
|
||||
# renamed from team to group to not confuse with existing team name use
|
||||
world.er_seeds[player] = get_same_seed(world, (
|
||||
shuffle, seed, world.retro[player], world.mode[player], world.logic[player]))
|
||||
else: # not a race or group seed, use set seed as is.
|
||||
|
@ -145,8 +145,9 @@ def main(args, seed=None):
|
|||
logger.info('Archipelago Version %s - Seed: %s\n', __version__, world.seed)
|
||||
|
||||
logger.info("Found World Types:")
|
||||
longest_name = max(len(text) for text in AutoWorld.AutoWorldRegister.world_types)
|
||||
for name, cls in AutoWorld.AutoWorldRegister.world_types.items():
|
||||
logger.info(f" {name:30} {cls}")
|
||||
logger.info(f" {name:{longest_name}}: {len(cls.item_names):3} Items | {len(cls.location_names):3} Locations")
|
||||
|
||||
parsed_names = parse_player_names(args.names, world.players, args.teams)
|
||||
world.teams = len(parsed_names)
|
||||
|
@ -165,31 +166,31 @@ def main(args, seed=None):
|
|||
world.push_precollected(world.create_item(item_name, player))
|
||||
|
||||
for player in world.player_ids:
|
||||
if player in world.alttp_player_ids:
|
||||
# enforce pre-defined local items.
|
||||
if world.goal[player] in ["localtriforcehunt", "localganontriforcehunt"]:
|
||||
world.local_items[player].add('Triforce Piece')
|
||||
|
||||
# enforce pre-defined local items.
|
||||
if world.goal[player] in ["localtriforcehunt", "localganontriforcehunt"]:
|
||||
world.local_items[player].add('Triforce Piece')
|
||||
# dungeon items can't be in non-local if the appropriate dungeon item shuffle setting is not set.
|
||||
if not world.mapshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Maps']
|
||||
|
||||
if not world.compassshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Compasses']
|
||||
|
||||
if not world.keyshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Small Keys']
|
||||
|
||||
if not world.bigkeyshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Big Keys']
|
||||
|
||||
# Not possible to place pendants/crystals out side of boss prizes yet.
|
||||
world.non_local_items[player] -= item_name_groups['Pendants']
|
||||
world.non_local_items[player] -= item_name_groups['Crystals']
|
||||
|
||||
# items can't be both local and non-local, prefer local
|
||||
world.non_local_items[player] -= world.local_items[player]
|
||||
|
||||
# dungeon items can't be in non-local if the appropriate dungeon item shuffle setting is not set.
|
||||
if not world.mapshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Maps']
|
||||
|
||||
if not world.compassshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Compasses']
|
||||
|
||||
if not world.keyshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Small Keys']
|
||||
|
||||
if not world.bigkeyshuffle[player]:
|
||||
world.non_local_items[player] -= item_name_groups['Big Keys']
|
||||
|
||||
# Not possible to place pendants/crystals out side of boss prizes yet.
|
||||
world.non_local_items[player] -= item_name_groups['Pendants']
|
||||
world.non_local_items[player] -= item_name_groups['Crystals']
|
||||
|
||||
AutoWorld.call_all(world, "create_regions")
|
||||
|
||||
for player in world.alttp_player_ids:
|
||||
|
|
|
@ -31,9 +31,10 @@ class World(metaclass=AutoWorldRegister):
|
|||
player: int
|
||||
options: dict = {}
|
||||
topology_present: bool = False # indicate if world type has any meaningful layout/pathing
|
||||
item_names: Set[str] = frozenset()
|
||||
item_names: Set[str] = frozenset() # set of all potential item names
|
||||
# maps item group names to sets of items. Example: "Weapons" -> {"Sword", "Bow"}
|
||||
item_name_groups: Dict[str, Set[str]] = {}
|
||||
location_names: Set[str] = frozenset() # set of all potential location names
|
||||
|
||||
def __init__(self, world: MultiWorld, player: int):
|
||||
self.world = world
|
||||
|
|
|
@ -2,7 +2,7 @@ from collections import namedtuple
|
|||
import logging
|
||||
|
||||
from BaseClasses import Region, RegionType
|
||||
from worlds.alttp import ALttPLocation
|
||||
from worlds.alttp.SubClasses import ALttPLocation
|
||||
from worlds.alttp.Shops import TakeAny, total_shop_slots, set_up_shops, shuffle_shops
|
||||
from worlds.alttp.Bosses import place_bosses
|
||||
from worlds.alttp.Dungeons import get_dungeon_item_pool
|
||||
|
|
|
@ -2,7 +2,6 @@ import collections
|
|||
import typing
|
||||
|
||||
from BaseClasses import Region, Entrance, RegionType
|
||||
from worlds.alttp import ALttPLocation
|
||||
|
||||
|
||||
def create_regions(world, player):
|
||||
|
@ -323,6 +322,7 @@ def create_dungeon_region(player: int, name: str, hint: str, locations=None, exi
|
|||
|
||||
|
||||
def _create_region(player: int, name: str, type: RegionType, hint: str, locations=None, exits=None):
|
||||
from worlds.alttp.SubClasses import ALttPLocation
|
||||
ret = Region(name, type, hint, player)
|
||||
if locations is None:
|
||||
locations = []
|
||||
|
|
|
@ -18,7 +18,7 @@ import bsdiff4
|
|||
from typing import Optional
|
||||
|
||||
from BaseClasses import CollectionState, Region
|
||||
from worlds.alttp import ALttPLocation
|
||||
from worlds.alttp.SubClasses import ALttPLocation
|
||||
from worlds.alttp.Shops import ShopType
|
||||
from worlds.alttp.Dungeons import dungeon_music_addresses
|
||||
from worlds.alttp.Regions import location_table, old_location_address_to_new_location_address
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from __future__ import annotations
|
||||
from enum import unique, Enum
|
||||
from typing import List, Union, Optional, Set, NamedTuple, Dict
|
||||
from typing import List, Optional, Set, NamedTuple, Dict
|
||||
import logging
|
||||
|
||||
from worlds.alttp import ALttPLocation
|
||||
from worlds.alttp.SubClasses import ALttPLocation
|
||||
from worlds.alttp.EntranceShuffle import door_addresses
|
||||
from worlds.alttp.Items import item_name_groups, item_table, ItemFactory, trap_replaceable, GetBeemizerItem
|
||||
from Utils import int16_as_bytes
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
"""Module extending BaseClasses.py for aLttP"""
|
||||
from typing import Optional
|
||||
|
||||
from BaseClasses import Location, Item
|
||||
|
||||
|
||||
class ALttPLocation(Location):
|
||||
game: str = "A Link to the Past"
|
||||
|
||||
def __init__(self, player: int, name: str = '', address=None, crystal: bool = False,
|
||||
hint_text: Optional[str] = None, parent=None,
|
||||
player_address=None):
|
||||
super(ALttPLocation, self).__init__(player, name, address, parent)
|
||||
self.crystal = crystal
|
||||
self.player_address = player_address
|
||||
self._hint_text: str = hint_text
|
||||
|
||||
|
||||
class ALttPItem(Item):
|
||||
game: str = "A Link to the Past"
|
||||
|
||||
def __init__(self, name, player, advancement=False, type=None, item_code=None, pedestal_hint=None, pedestal_credit=None,
|
||||
sick_kid_credit=None, zora_credit=None, witch_credit=None, flute_boy_credit=None, hint_text=None):
|
||||
super(ALttPItem, self).__init__(name, advancement, item_code, player)
|
||||
self.type = type
|
||||
self._pedestal_hint_text = pedestal_hint
|
||||
self.pedestal_credit_text = pedestal_credit
|
||||
self.sickkid_credit_text = sick_kid_credit
|
||||
self.zora_credit_text = zora_credit
|
||||
self.magicshop_credit_text = witch_credit
|
||||
self.fluteboy_credit_text = flute_boy_credit
|
||||
self._hint_text = hint_text
|
|
@ -1,9 +1,9 @@
|
|||
from typing import Optional
|
||||
|
||||
from BaseClasses import Location, Item, CollectionState
|
||||
from BaseClasses import Item, CollectionState
|
||||
from .SubClasses import ALttPItem
|
||||
from ..AutoWorld import World
|
||||
from .Options import alttp_options
|
||||
from .Items import as_dict_item_table, item_name_groups, item_table
|
||||
from .Regions import lookup_name_to_id
|
||||
|
||||
|
||||
class ALTTPWorld(World):
|
||||
|
@ -12,6 +12,7 @@ class ALTTPWorld(World):
|
|||
topology_present = True
|
||||
item_name_groups = item_name_groups
|
||||
item_names = frozenset(item_table)
|
||||
location_names = frozenset(lookup_name_to_id)
|
||||
|
||||
def collect(self, state: CollectionState, item: Item) -> bool:
|
||||
if item.name.startswith('Progressive '):
|
||||
|
@ -74,29 +75,3 @@ class ALTTPWorld(World):
|
|||
return ALttPItem(name, self.player, **as_dict_item_table[name])
|
||||
|
||||
|
||||
class ALttPLocation(Location):
|
||||
game: str = "A Link to the Past"
|
||||
|
||||
def __init__(self, player: int, name: str = '', address=None, crystal: bool = False,
|
||||
hint_text: Optional[str] = None, parent=None,
|
||||
player_address=None):
|
||||
super(ALttPLocation, self).__init__(player, name, address, parent)
|
||||
self.crystal = crystal
|
||||
self.player_address = player_address
|
||||
self._hint_text: str = hint_text
|
||||
|
||||
|
||||
class ALttPItem(Item):
|
||||
game: str = "A Link to the Past"
|
||||
|
||||
def __init__(self, name, player, advancement=False, type=None, item_code=None, pedestal_hint=None, pedestal_credit=None,
|
||||
sick_kid_credit=None, zora_credit=None, witch_credit=None, flute_boy_credit=None, hint_text=None):
|
||||
super(ALttPItem, self).__init__(name, advancement, item_code, player)
|
||||
self.type = type
|
||||
self._pedestal_hint_text = pedestal_hint
|
||||
self.pedestal_credit_text = pedestal_credit
|
||||
self.sickkid_credit_text = sick_kid_credit
|
||||
self.zora_credit_text = zora_credit
|
||||
self.magicshop_credit_text = witch_credit
|
||||
self.fluteboy_credit_text = flute_boy_credit
|
||||
self._hint_text = hint_text
|
|
@ -20,6 +20,7 @@ class Factorio(World):
|
|||
custom_recipes = {}
|
||||
additional_advancement_technologies = set()
|
||||
item_names = frozenset(tech_table)
|
||||
location_names = frozenset(base_tech_table)
|
||||
|
||||
def generate_basic(self):
|
||||
for tech_name in base_tech_table:
|
||||
|
|
|
@ -16,6 +16,7 @@ class HKWorld(World):
|
|||
game: str = "Hollow Knight"
|
||||
options = hollow_knight_options
|
||||
item_names: Set[str] = frozenset(item_table)
|
||||
location_names: Set[str] = frozenset(lookup_name_to_id)
|
||||
|
||||
def generate_basic(self):
|
||||
# Link regions
|
||||
|
|
|
@ -17,6 +17,7 @@ class MinecraftWorld(World):
|
|||
options = minecraft_options
|
||||
topology_present = True
|
||||
item_names = frozenset(item_table)
|
||||
location_names = frozenset(advancement_table)
|
||||
|
||||
def _get_mc_data(self):
|
||||
exits = ["Overworld Structure 1", "Overworld Structure 2", "Nether Structure 1", "Nether Structure 2",
|
||||
|
|
Loading…
Reference in New Issue