Rogue Legacy: Rename `world` to `multiworld` in local variables and function signatures. (#1169)

This commit is contained in:
Zach Parks 2022-11-01 16:14:09 -05:00 committed by GitHub
parent 05c06a57af
commit bf142b32c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 28 deletions

View File

@ -10,7 +10,7 @@ class RLRegionData(NamedTuple):
exits: Optional[List[str]]
def create_regions(world: MultiWorld, player: int):
def create_regions(multiworld: MultiWorld, player: int):
regions: Dict[str, RLRegionData] = {
"Menu": RLRegionData(None, ["Castle Hamson"]),
"The Manor": RLRegionData([], []),
@ -61,9 +61,9 @@ def create_regions(world: MultiWorld, player: int):
regions["The Fountain Room"].locations.append("Fountain Room")
# Chests
chests = int(world.chests_per_zone[player])
chests = int(multiworld.chests_per_zone[player])
for i in range(0, chests):
if world.universal_chests[player]:
if multiworld.universal_chests[player]:
regions["Castle Hamson"].locations.append(f"Chest {i + 1}")
regions["Forest Abkhazia"].locations.append(f"Chest {i + 1 + chests}")
regions["The Maya"].locations.append(f"Chest {i + 1 + (chests * 2)}")
@ -75,9 +75,9 @@ def create_regions(world: MultiWorld, player: int):
regions["Land of Darkness"].locations.append(f"Land of Darkness - Chest {i + 1}")
# Fairy Chests
chests = int(world.fairy_chests_per_zone[player])
chests = int(multiworld.fairy_chests_per_zone[player])
for i in range(0, chests):
if world.universal_fairy_chests[player]:
if multiworld.universal_fairy_chests[player]:
regions["Castle Hamson"].locations.append(f"Fairy Chest {i + 1}")
regions["Forest Abkhazia"].locations.append(f"Fairy Chest {i + 1 + chests}")
regions["The Maya"].locations.append(f"Fairy Chest {i + 1 + (chests * 2)}")
@ -90,19 +90,19 @@ def create_regions(world: MultiWorld, player: int):
# Set up the regions correctly.
for name, data in regions.items():
world.regions.append(create_region(world, player, name, data.locations, data.exits))
multiworld.regions.append(create_region(multiworld, player, name, data.locations, data.exits))
world.get_entrance("Castle Hamson", player).connect(world.get_region("Castle Hamson", player))
world.get_entrance("The Manor", player).connect(world.get_region("The Manor", player))
world.get_entrance("Forest Abkhazia", player).connect(world.get_region("Forest Abkhazia", player))
world.get_entrance("The Maya", player).connect(world.get_region("The Maya", player))
world.get_entrance("Land of Darkness", player).connect(world.get_region("Land of Darkness", player))
world.get_entrance("The Fountain Room", player).connect(world.get_region("The Fountain Room", player))
multiworld.get_entrance("Castle Hamson", player).connect(multiworld.get_region("Castle Hamson", player))
multiworld.get_entrance("The Manor", player).connect(multiworld.get_region("The Manor", player))
multiworld.get_entrance("Forest Abkhazia", player).connect(multiworld.get_region("Forest Abkhazia", player))
multiworld.get_entrance("The Maya", player).connect(multiworld.get_region("The Maya", player))
multiworld.get_entrance("Land of Darkness", player).connect(multiworld.get_region("Land of Darkness", player))
multiworld.get_entrance("The Fountain Room", player).connect(multiworld.get_region("The Fountain Room", player))
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):
def create_region(multiworld: MultiWorld, player: int, name: str, locations=None, exits=None):
ret = Region(name, RegionType.Generic, name, player)
ret.multiworld = world
ret.multiworld = multiworld
if locations:
for loc_name in locations:
loc_data = location_table.get(loc_name)
@ -121,5 +121,3 @@ def create_region(world: MultiWorld, player: int, name: str, locations=None, exi
entrance = Entrance(player, exit, ret)
ret.exits.append(entrance)
return ret

View File

@ -25,15 +25,15 @@ class LegacyLogic(LogicMixin):
self.item_count("Attack Up", player) + self.item_count("Magic Damage Up", player)
def set_rules(world: MultiWorld, player: int):
def set_rules(multiworld: MultiWorld, player: int):
# Vendors
if world.vendors[player] == "normal":
set_rule(world.get_location("Forest Abkhazia Boss Reward", player),
if multiworld.vendors[player] == "normal":
set_rule(multiworld.get_location("Forest Abkhazia Boss Reward", player),
lambda state: state.has_all_vendors(player))
# Scale each manor location.
manor_rules = {
"Defeat Khidr" if world.khidr[player] == "vanilla" else "Defeat Neo Khidr": [
"Defeat Khidr" if multiworld.khidr[player] == "vanilla" else "Defeat Neo Khidr": [
"Manor - Left Wing Window",
"Manor - Left Wing Rooftop",
"Manor - Right Wing Window",
@ -44,7 +44,7 @@ def set_rules(world: MultiWorld, player: int):
"Manor - Left Tree 2",
"Manor - Right Tree",
],
"Defeat Alexander" if world.alexander[player] == "vanilla" else "Defeat Alexander IV": [
"Defeat Alexander" if multiworld.alexander[player] == "vanilla" else "Defeat Alexander IV": [
"Manor - Left Big Upper 1",
"Manor - Left Big Upper 2",
"Manor - Left Big Windows",
@ -56,7 +56,7 @@ def set_rules(world: MultiWorld, player: int):
"Manor - Right Big Rooftop",
"Manor - Right Extension",
],
"Defeat Ponce de Leon" if world.leon[player] == "vanilla" else "Defeat Ponce de Freon": [
"Defeat Ponce de Leon" if multiworld.leon[player] == "vanilla" else "Defeat Ponce de Freon": [
"Manor - Right High Base",
"Manor - Right High Upper",
"Manor - Right High Tower",
@ -67,20 +67,20 @@ def set_rules(world: MultiWorld, player: int):
for event, locations in manor_rules.items():
for location in locations:
set_rule(world.get_location(location, player), lambda state: state.has(event, player))
set_rule(multiworld.get_location(location, player), lambda state: state.has(event, player))
# Standard Zone Progression
world.get_entrance("Forest Abkhazia", player).access_rule = \
multiworld.get_entrance("Forest Abkhazia", player).access_rule = \
(lambda state: state.has_stat_upgrades(player, 0.125 * state.total_stat_upgrades_count(player)) and
(state.has("Defeat Khidr", player) or state.has("Defeat Neo Khidr", player)))
world.get_entrance("The Maya", player).access_rule = \
multiworld.get_entrance("The Maya", player).access_rule = \
(lambda state: state.has_stat_upgrades(player, 0.25 * state.total_stat_upgrades_count(player)) and
(state.has("Defeat Alexander", player) or state.has("Defeat Alexander IV", player)))
world.get_entrance("Land of Darkness", player).access_rule = \
multiworld.get_entrance("Land of Darkness", player).access_rule = \
(lambda state: state.has_stat_upgrades(player, 0.375 * state.total_stat_upgrades_count(player)) and
(state.has("Defeat Ponce de Leon", player) or state.has("Defeat Ponce de Freon", player)))
world.get_entrance("The Fountain Room", player).access_rule = \
multiworld.get_entrance("The Fountain Room", player).access_rule = \
(lambda state: state.has_stat_upgrades(player, 0.5 * state.total_stat_upgrades_count(player)) and
(state.has("Defeat Herodotus", player) or state.has("Defeat Astrodotus", player)))
world.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)
multiworld.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)