Rogue Legacy: Remove relative imports and move to .apworld. (#1304)

* Remove relative import and remove `set_rule` usage.

* Set Rogue Legacy to be .apworld.
This commit is contained in:
Zach Parks 2022-12-08 08:54:49 -06:00 committed by GitHub
parent 1b582e5b09
commit bedc78d335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions

View File

@ -1,23 +1,25 @@
import base64
import datetime
import os import os
import platform
import shutil import shutil
import sys import sys
import sysconfig 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 typing
import setuptools import zipfile
from Launcher import components, icon_paths 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 = { apworlds: set = {
"Subnautica", "Subnautica",
"Factorio", "Factorio",
"Rogue Legacy",
} }
# This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it # This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it

View File

@ -1,7 +1,5 @@
from BaseClasses import MultiWorld, CollectionState from BaseClasses import MultiWorld, CollectionState
from ..generic.Rules import set_rule
def get_upgrade_total(multiworld: MultiWorld, player: int) -> int: def get_upgrade_total(multiworld: MultiWorld, player: int) -> int:
return int(multiworld.health_pool[player]) + int(multiworld.mana_pool[player]) + \ 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): 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 'vendors' are 'normal', then expect it to show up in the first half(ish) of the spheres.
if multiworld.vendors[player] == "normal": if multiworld.vendors[player] == "normal":
set_rule(multiworld.get_location("Forest Abkhazia Boss Reward", player), multiworld.get_location("Forest Abkhazia Boss Reward", player).access_rule = \
lambda state: has_vendors(state, player)) lambda state: has_vendors(state, player)
# Gate each manor location so everything isn't dumped into sphere 1. # Gate each manor location so everything isn't dumped into sphere 1.
manor_rules = { manor_rules = {
@ -92,11 +90,11 @@ def set_rules(multiworld: MultiWorld, player: int):
# Set rules for manor locations. # Set rules for manor locations.
for event, locations in manor_rules.items(): for event, locations in manor_rules.items():
for location in locations: 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. # 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]: 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. # Region rules.
multiworld.get_entrance("Forest Abkhazia", player).access_rule = \ multiworld.get_entrance("Forest Abkhazia", player).access_rule = \

View File

@ -1,12 +1,12 @@
from typing import List from typing import List
from BaseClasses import Tutorial 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 .Items import RLItem, RLItemData, event_item_table, item_table, get_items_by_category
from .Locations import RLLocation, location_table from .Locations import RLLocation, location_table
from .Options import rl_options from .Options import rl_options
from .Regions import create_regions from .Regions import create_regions
from .Rules import set_rules from .Rules import set_rules
from ..AutoWorld import World, WebWorld
class RLWeb(WebWorld): class RLWeb(WebWorld):