From bedc78d3353de929f79461cf982db9c7d1f91960 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Thu, 8 Dec 2022 08:54:49 -0600 Subject: [PATCH] Rogue Legacy: Remove relative imports and move to .apworld. (#1304) * Remove relative import and remove `set_rule` usage. * Set Rogue Legacy to be .apworld. --- setup.py | 22 ++++++++++++---------- worlds/rogue_legacy/Rules.py | 10 ++++------ worlds/rogue_legacy/__init__.py | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/setup.py b/setup.py index fa739c00..e60753d2 100644 --- a/setup.py +++ b/setup.py @@ -1,23 +1,25 @@ +import base64 +import datetime import os +import platform import shutil import sys import sysconfig -import platform -import zipfile -from pathlib import Path -from hashlib import sha3_512 -import base64 -import datetime -from Utils import version_tuple, is_windows, is_linux -from collections.abc import Iterable import typing -import setuptools -from Launcher import components, icon_paths +import zipfile +from collections.abc import Iterable +from hashlib import sha3_512 +from pathlib import Path +import setuptools + +from Launcher import components, icon_paths +from Utils import version_tuple, is_windows, is_linux apworlds: set = { "Subnautica", "Factorio", + "Rogue Legacy", } # This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it diff --git a/worlds/rogue_legacy/Rules.py b/worlds/rogue_legacy/Rules.py index 92b9ba0a..4ddf24c7 100644 --- a/worlds/rogue_legacy/Rules.py +++ b/worlds/rogue_legacy/Rules.py @@ -1,7 +1,5 @@ from BaseClasses import MultiWorld, CollectionState -from ..generic.Rules import set_rule - def get_upgrade_total(multiworld: MultiWorld, player: int) -> int: return int(multiworld.health_pool[player]) + int(multiworld.mana_pool[player]) + \ @@ -52,8 +50,8 @@ def has_defeated_dungeon(state: CollectionState, player: int) -> bool: def set_rules(multiworld: MultiWorld, player: int): # If 'vendors' are 'normal', then expect it to show up in the first half(ish) of the spheres. if multiworld.vendors[player] == "normal": - set_rule(multiworld.get_location("Forest Abkhazia Boss Reward", player), - lambda state: has_vendors(state, player)) + multiworld.get_location("Forest Abkhazia Boss Reward", player).access_rule = \ + lambda state: has_vendors(state, player) # Gate each manor location so everything isn't dumped into sphere 1. manor_rules = { @@ -92,11 +90,11 @@ def set_rules(multiworld: MultiWorld, player: int): # Set rules for manor locations. for event, locations in manor_rules.items(): for location in locations: - set_rule(multiworld.get_location(location, player), lambda state: state.has(event, player)) + multiworld.get_location(location, player).access_rule = lambda state: state.has(event, player) # Set rules for fairy chests to decrease headache of expectation to find non-movement fairy chests. for fairy_location in [location for location in multiworld.get_locations(player) if "Fairy" in location.name]: - set_rule(fairy_location, lambda state: has_fairy_progression(state, player)) + fairy_location.access_rule = lambda state: has_fairy_progression(state, player) # Region rules. multiworld.get_entrance("Forest Abkhazia", player).access_rule = \ diff --git a/worlds/rogue_legacy/__init__.py b/worlds/rogue_legacy/__init__.py index 34f7c785..9b6535b6 100644 --- a/worlds/rogue_legacy/__init__.py +++ b/worlds/rogue_legacy/__init__.py @@ -1,12 +1,12 @@ from typing import List from BaseClasses import Tutorial +from worlds.AutoWorld import World, WebWorld from .Items import RLItem, RLItemData, event_item_table, item_table, get_items_by_category from .Locations import RLLocation, location_table from .Options import rl_options from .Regions import create_regions from .Rules import set_rules -from ..AutoWorld import World, WebWorld class RLWeb(WebWorld):