mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
add World.location_names
This commit is contained in:
@@ -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
|
||||
|
||||
32
worlds/alttp/SubClasses.py
Normal file
32
worlds/alttp/SubClasses.py
Normal file
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user