Skip to content

Commit

Permalink
RoR2: bug fixes (ArchipelagoMW#1891)
Browse files Browse the repository at this point in the history
* adding back parens that got deleted by accident.

* Void Locus and The Planetarium ids backwards

* change required client version

* beads of fealty was missing for A Moment, whole victory

* found another logic bug

* Update worlds/ror2/__init__.py

Co-authored-by: Zach Parks <[email protected]>

* Remove unnecessary comment

---------

Co-authored-by: Zach Parks <[email protected]>
  • Loading branch information
kindasneaki and ThePhar authored Jun 27, 2023
1 parent 125ee8b commit a7bc884
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
3 changes: 2 additions & 1 deletion worlds/ror2/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class RiskOfRainItem(Item):
"Item Scrap, Green": 37009,
"Item Scrap, Red": 37010,
"Item Scrap, Yellow": 37011,
"Void Item": 37012
"Void Item": 37012,
"Beads of Fealty": 37013
}

# 37700 - 37699
Expand Down
5 changes: 2 additions & 3 deletions worlds/ror2/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def create_regions(multiworld: MultiWorld, player: int):
"Hidden Realm: Gilded Coast": RoRRegionData(None, None)
}
dlc_other_regions: Dict[str, RoRRegionData] = {
"The Planetarium": RoRRegionData(None, ["Victory"]),
"Void Locus": RoRRegionData(None, ["The Planetarium"])
"The Planetarium": RoRRegionData(None, ["Victory"]),
"Void Locus": RoRRegionData(None, ["The Planetarium"])
}
# Totals of each item
chests = int(multiworld.chests_per_stage[player])
Expand Down Expand Up @@ -92,7 +92,6 @@ def create_regions(multiworld: MultiWorld, player: int):
non_dlc_regions["Menu"].region_exits.append("Siphoned Forest")
other_regions["OrderedStage_2"].region_exits.append("Aphelian Sanctuary")
other_regions["OrderedStage_3"].region_exits.append("Sulfur Pools")
other_regions["Commencement"].region_exits.append("The Planetarium")
other_regions["Void Fields"].region_exits.append("Void Locus")
regions_pool: Dict = {**all_location_regions, **other_regions, **dlc_other_regions}

Expand Down
4 changes: 2 additions & 2 deletions worlds/ror2/RoR2Environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
}

environment_sotv_special_table: Dict[str, int] = {
"Void Locus": 45, # voidstage
"The Planetarium": 46, # voidraid
"Void Locus": 46, # voidstage
"The Planetarium": 45, # voidraid
}

X = TypeVar("X")
Expand Down
27 changes: 15 additions & 12 deletions worlds/ror2/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def check_location(state, environment: str, player: int, item_number: int, item_
# unlock event to next set of stages
def get_stage_event(multiworld: MultiWorld, player: int, stage_number: int):
if not multiworld.dlc_sotv[player]:
environment_name = multiworld.random.choices(list(environment_vanilla_orderedstages_table[stage_number].keys()), k=1)
environment_name = multiworld.random.choices(list(environment_vanilla_orderedstages_table[stage_number].keys()),
k=1)
else:
environment_name = multiworld.random.choices(list(environment_orderedstages_table[stage_number].keys()), k=1)
multiworld.get_location(f"Stage_{stage_number+1}", player).access_rule = \
multiworld.get_location(f"Stage_{stage_number + 1}", player).access_rule = \
lambda state: get_one_of_the_stages(state, environment_name[0], player)


Expand All @@ -43,7 +44,6 @@ def get_one_of_the_stages(state: CollectionState, stage: str, player: int):


def set_rules(multiworld: MultiWorld, player: int) -> None:

if multiworld.goal[player] == "classic":
# classic mode
total_locations = multiworld.total_locations[player].value # total locations for current player
Expand Down Expand Up @@ -72,21 +72,22 @@ def set_rules(multiworld: MultiWorld, player: int) -> None:
event_loc = multiworld.get_location(f"Pickup{i * event_location_step}", player)
set_rule(event_loc,
lambda state, i=i: state.can_reach(f"ItemPickup{i * event_location_step - 1}", "Location", player))
for n in range(i * event_location_step, (i + 1) * event_location_step + 1): # we want to create a rule for each of the 25 locations per division
# we want to create a rule for each of the 25 locations per division
for n in range(i * event_location_step, (i + 1) * event_location_step + 1):
if n > total_locations:
break
if n == i * event_location_step:
set_rule(multiworld.get_location(f"ItemPickup{n}", player),
lambda state, event_item=event_loc.item.name: state.has(event_item, player))
lambda state, event_item=event_loc.item.name: state.has(event_item, player))
else:
set_rule(multiworld.get_location(f"ItemPickup{n}", player),
lambda state, n=n: state.can_reach(f"ItemPickup{n - 1}", "Location", player))
lambda state, n=n: state.can_reach(f"ItemPickup{n - 1}", "Location", player))
set_rule(multiworld.get_location("Victory", player),
lambda state: state.can_reach(f"ItemPickup{total_locations}", "Location", player))
lambda state: state.can_reach(f"ItemPickup{total_locations}", "Location", player))
if total_revivals or multiworld.start_with_revive[player].value:
add_rule(multiworld.get_location("Victory", player),
lambda state: state.has("Dio's Best Friend", player,
total_revivals + multiworld.start_with_revive[player]))
lambda state: state.has("Dio's Best Friend", player,
total_revivals + multiworld.start_with_revive[player]))

elif multiworld.goal[player] == "explore":
# When explore_mode is used,
Expand All @@ -96,10 +97,10 @@ def set_rules(multiworld: MultiWorld, player: int) -> None:
# help prevent being stuck in the same stages until that point.)

for location in multiworld.get_locations():
if location.player != player: continue # ignore all checks that don't belong to this player
if location.player != player: continue # ignore all checks that don't belong to this player
if "Scavenger" in location.name:
add_rule(location, lambda state: state.has("Stage_5", player))
# Regions
# Regions
chests = multiworld.chests_per_stage[player]
shrines = multiworld.shrines_per_stage[player]
newts = multiworld.altars_per_stage[player]
Expand Down Expand Up @@ -140,11 +141,13 @@ def set_rules(multiworld: MultiWorld, player: int) -> None:
has_location_access_rule(multiworld, environment_name, player, newt, "Newt Altar")
if i > 0:
has_entrance_access_rule(multiworld, f"Stage_{i}", environment_name, player)
has_entrance_access_rule(multiworld, f"Hidden Realm: A Moment, Fractured", "Hidden Realm: A Moment, Whole", player)
has_entrance_access_rule(multiworld, f"Hidden Realm: A Moment, Fractured", "Hidden Realm: A Moment, Whole",
player)
has_entrance_access_rule(multiworld, f"Stage_1", "Hidden Realm: Bazaar Between Time", player)
has_entrance_access_rule(multiworld, f"Hidden Realm: Bazaar Between Time", "Void Fields", player)
has_entrance_access_rule(multiworld, f"Stage_5", "Commencement", player)
has_entrance_access_rule(multiworld, f"Stage_5", "Hidden Realm: A Moment, Fractured", player)
has_entrance_access_rule(multiworld, "Beads of Fealty", "Hidden Realm: A Moment, Whole", player)
if multiworld.dlc_sotv[player]:
has_entrance_access_rule(multiworld, f"Stage_5", "Void Locus", player)
has_entrance_access_rule(multiworld, f"Void Locus", "The Planetarium", player)
Expand Down
14 changes: 7 additions & 7 deletions worlds/ror2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class RiskOfRainWorld(World):
item_name_to_id = item_table
location_name_to_id = item_pickups

data_version = 6
required_client_version = (0, 3, 7)
data_version = 7
required_client_version = (0, 4, 2)
web = RiskOfWeb()
total_revivals: int

Expand Down Expand Up @@ -113,22 +113,22 @@ def create_items(self) -> None:
}

# remove lunar items from the pool if they're disabled in the yaml unless lunartic is rolled
if not self.multiworld.enable_lunar[self.player] or pool_option == ItemWeights.option_lunartic:
if not (self.multiworld.enable_lunar[self.player] or pool_option == ItemWeights.option_lunartic):
junk_pool.pop("Lunar Item")
# remove void items from the pool
if not self.multiworld.dlc_sotv[self.player] or pool_option == ItemWeights.option_void:
if not (self.multiworld.dlc_sotv[self.player] or pool_option == ItemWeights.option_void):
junk_pool.pop("Void Item")

# Generate item pool
itempool: List = []
# Add revive items for the player
itempool += ["Dio's Best Friend"] * self.total_revivals
itempool += ["Beads of Fealty"]

for env_name, _ in environments_pool.items():
itempool += [env_name]

# precollected environments are popped from the pool so counting like this is valid
nonjunk_item_count = self.total_revivals + len(environments_pool)
nonjunk_item_count = len(itempool)
if self.multiworld.goal[self.player] == "classic":
# classic mode
total_locations = self.multiworld.total_locations[self.player].value
Expand Down Expand Up @@ -205,7 +205,7 @@ def fill_slot_data(self):
def create_item(self, name: str) -> Item:
item_id = item_table[name]
classification = ItemClassification.filler
if name == "Dio's Best Friend":
if name in {"Dio's Best Friend", "Beads of Fealty"}:
classification = ItemClassification.progression
elif name in {"Legendary Item", "Boss Item"}:
classification = ItemClassification.useful
Expand Down

0 comments on commit a7bc884

Please sign in to comment.