Skip to content

Commit

Permalink
Wargroove 2: Many more PR fixes. Tested by generating several WG2 gam…
Browse files Browse the repository at this point in the history
…es, booting the client and verifying the communication files.
  • Loading branch information
FlySniper committed Aug 9, 2024
1 parent 876e5e3 commit e736be0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 57 deletions.
6 changes: 2 additions & 4 deletions worlds/wargroove2/Levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class Wargroove2Level:

def __init__(self, name: str, file_name: str, location_rules: dict, victory_locations: List[str] = [],
low_victory_checks: bool = True, has_ocean: bool = True):
if victory_locations is None:
victory_locations = []
self.name = name
self.file_name = file_name
self.location_rules = location_rules
Expand All @@ -63,8 +61,8 @@ def define_access_rules(self, multiworld: MultiWorld, additional_rule=lambda sta
state.can_reach(self.region, 'Region', self.player) and rule(state) and additional_rule(state))
set_region_exit_rules(self.region, multiworld, self.player, self.victory_locations, operator='and')

def define_region(self, name: str, multiworld: MultiWorld, exits=None) -> Region:
self.region = Region(name, self.player, multiworld)
def define_region(self, name: str, world: "Wargroove2World", exits=None) -> Region:
self.region = Region(name, self.player, world.multiworld)
if self.location_rules.keys():
for location in self.location_rules.keys():
loc_id = location_table.get(location, 0)
Expand Down
40 changes: 20 additions & 20 deletions worlds/wargroove2/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"Nuru's Vengeance: Victory": 253005,
"Nuru's Vengeance: Spearman Destroys the Gate": 253006,
"Nuru's Vengeance: Defeat all Dogs": 253007,
'Cherrystone Landing: Smacked a Trebuchet': 253008,
'Cherrystone Landing: Smacked a Fortified Village': 253009,
'Cherrystone Landing: Victory': 253010,
'Den-Two-Away: Victory': 253011,
'Den-Two-Away: Commander Captures the Lumbermill': 253012,
'Skydiving: Victory': 253013,
'Skydiving: Dragon Defeats Stronghold': 253014,
"Cherrystone Landing: Smacked a Trebuchet": 253008,
"Cherrystone Landing: Smacked a Fortified Village": 253009,
"Cherrystone Landing: Victory": 253010,
"Den-Two-Away: Victory": 253011,
"Den-Two-Away: Commander Captures the Lumbermill": 253012,
"Skydiving: Victory": 253013,
"Skydiving: Dragon Defeats Stronghold": 253014,
"Terrible Tributaries: Victory": 253015,
"Terrible Tributaries: Swimming Knights": 253016,
"Terrible Tributaries: Steal Code Names": 253017,
Expand Down Expand Up @@ -44,20 +44,20 @@
"Bridge Brigade: From the Depths": 253040,
"Bridge Brigade: Back to the Depths": 253041,
#########################################################
'Slippery Bridge: Victory': 253300,
'Slippery Bridge: Control all Sea Villages': 253301,
"Slippery Bridge: Victory": 253300,
"Slippery Bridge: Control all Sea Villages": 253301,
#########################################################
'Spire Fire: Victory': 253305,
'Spire Fire: Kill Enemy Sky Rider': 253306,
'Spire Fire: Win without losing your Dragon': 253307,
"Spire Fire: Victory": 253305,
"Spire Fire: Kill Enemy Sky Rider": 253306,
"Spire Fire: Win without losing your Dragon": 253307,
#########################################################
'Sunken Forest: Victory': 253310,
'Sunken Forest: High Ground': 253311,
'Sunken Forest: Coastal Siege': 253312,
"Sunken Forest: Victory": 253310,
"Sunken Forest: High Ground": 253311,
"Sunken Forest: Coastal Siege": 253312,
#########################################################
'Tenri\'s Mistake: Victory': 253315,
'Tenri\'s Mistake: Mighty Barracks': 253316,
'Tenri\'s Mistake: Commander Arrives': 253317,
"Tenri\'s Mistake: Victory": 253315,
"Tenri\'s Mistake: Mighty Barracks": 253316,
"Tenri\'s Mistake: Commander Arrives": 253317,
#########################################################
"Enmity Cliffs: Victory": 253320,
"Enmity Cliffs: Spear Flood": 253321,
Expand Down Expand Up @@ -103,11 +103,11 @@
"Split Valley: Longshot": 253371,
"Split Valley: Ranged Trinity": 253372,
#########################################################
'Disastrous Crossing: Victory': None,
"Disastrous Crossing: Victory": None,
"Dark Mirror: Victory": None,
"Doomed Metropolis: Victory": None,
"Dementia Castle: Victory": None,
'Wargroove 2: Victory': None
"Wargroove 2: Victory": None
}

location_id_name: Dict[int, str] = {}
Expand Down
3 changes: 2 additions & 1 deletion worlds/wargroove2/Options.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import typing
from dataclasses import dataclass

from Options import Choice, Range, DeathLink, PerGameCommonOptions
from Options import Choice, Range, DeathLink, PerGameCommonOptions, StartInventoryPool


class IncomeBoost(Range):
Expand Down Expand Up @@ -65,3 +65,4 @@ class Wargroove2Options(PerGameCommonOptions):
commander_choice: CommanderChoice
final_levels: FinalLevels
death_link: DeathLink
start_inventory_from_pool: StartInventoryPool
60 changes: 30 additions & 30 deletions worlds/wargroove2/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
def create_regions(world: "Wargroove2World") -> None:
multiworld = world.multiworld
player = world.player
level_list = self.level_list
first_level = self.first_level
final_levels = self.final_levels
level_list = world.level_list
first_level = world.first_level
final_levels = world.final_levels

menu_region = Region('Menu', player, multiworld)
menu_region.exits.append(Entrance(player, 'Menu exits to Humble Beginnings Rebirth', menu_region))
first_level_region = first_level.define_region("Humble Beginnings Rebirth", world,
exits=[region_names[0], region_names[1],
region_names[2], region_names[3]])
world.regions += [menu_region, first_level_region]
multiworld.regions += [menu_region, first_level_region]

# Define Level 1s
for level_num in range(0, 4):
next_level = level_num * 4 + 4 - level_num
world.regions += [level_list[level_num].define_region(region_names[level_num], world, exits=[
multiworld.regions += [level_list[level_num].define_region(region_names[level_num], world, exits=[
region_names[next_level],
region_names[
next_level + 1],
Expand All @@ -32,7 +32,7 @@ def create_regions(world: "Wargroove2World") -> None:
# Define Level 2s
for level_num in range(4, 16):
next_level = level_num + 12
world.regions += [level_list[level_num].define_region(region_names[level_num], world,
multiworld.regions += [level_list[level_num].define_region(region_names[level_num], world,
exits=[region_names[next_level]])]
# Define Level 3s
for level_num in range(16, 28):
Expand All @@ -43,50 +43,50 @@ def create_regions(world: "Wargroove2World") -> None:
final_level_name = FINAL_LEVEL_3
elif level_num >= 19:
final_level_name = FINAL_LEVEL_2
world.regions += [level_list[level_num].define_region(region_names[level_num], world, exits=[final_level_name])]
multiworld.regions += [level_list[level_num].define_region(region_names[level_num], world, exits=[final_level_name])]

# Define Final Levels
world.regions += [final_levels[0].define_region(FINAL_LEVEL_1, world),
multiworld.regions += [final_levels[0].define_region(FINAL_LEVEL_1, world),
final_levels[1].define_region(FINAL_LEVEL_2, world),
final_levels[2].define_region(FINAL_LEVEL_3, world),
final_levels[3].define_region(FINAL_LEVEL_4, world)]

# # link up our regions with the entrances
world.get_entrance("Menu exits to Humble Beginnings Rebirth", player).connect(
world.get_region('Humble Beginnings Rebirth', player))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[0]}", player).connect(
world.get_region(region_names[0], player))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[1]}", player).connect(
world.get_region(region_names[1], player))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[2]}", player).connect(
world.get_region(region_names[2], player))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[3]}", player).connect(
world.get_region(region_names[3], player))
world.get_entrance("Menu exits to Humble Beginnings Rebirth").connect(
world.get_region('Humble Beginnings Rebirth'))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[0]}").connect(
world.get_region(region_names[0]))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[1]}").connect(
world.get_region(region_names[1]))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[2]}").connect(
world.get_region(region_names[2]))
world.get_entrance(f"Humble Beginnings Rebirth exits to {region_names[3]}").connect(
world.get_region(region_names[3]))
# Define Levels 1-4
for level_num in range(0, 4):
next_level = level_num * 4 + 4 - level_num
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level]}", player).connect(
world.get_region(region_names[next_level], player))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level + 1]}", player).connect(
world.get_region(region_names[next_level + 1], player))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level + 2]}", player).connect(
world.get_region(region_names[next_level + 2], player))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level]}").connect(
world.get_region(region_names[next_level]))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level + 1]}").connect(
world.get_region(region_names[next_level + 1]))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level + 2]}").connect(
world.get_region(region_names[next_level + 2]))

for level_num in range(4, 16):
next_level = level_num + 12
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level]}", player).connect(
world.get_region(region_names[next_level], player))
world.get_entrance(f"{region_names[level_num]} exits to {region_names[next_level]}").connect(
world.get_region(region_names[next_level]))

for level_num in range(16, 28):
if level_num >= 25:
final_level_name = f"{region_names[level_num]} exits to {FINAL_LEVEL_4}"
world.get_entrance(final_level_name, player).connect(world.get_region(FINAL_LEVEL_4, player))
world.get_entrance(final_level_name).connect(world.get_region(FINAL_LEVEL_4))
elif level_num >= 22:
final_level_name = f"{region_names[level_num]} exits to {FINAL_LEVEL_3}"
world.get_entrance(final_level_name, player).connect(world.get_region(FINAL_LEVEL_3, player))
world.get_entrance(final_level_name).connect(world.get_region(FINAL_LEVEL_3))
elif level_num >= 19:
final_level_name = f"{region_names[level_num]} exits to {FINAL_LEVEL_2}"
world.get_entrance(final_level_name, player).connect(world.get_region(FINAL_LEVEL_2, player))
world.get_entrance(final_level_name).connect(world.get_region(FINAL_LEVEL_2))
else:
final_level_name = f"{region_names[level_num]} exits to {FINAL_LEVEL_1}"
world.get_entrance(final_level_name, player).connect(world.get_region(FINAL_LEVEL_1, player))
world.get_entrance(final_level_name).connect(world.get_region(FINAL_LEVEL_1))
4 changes: 2 additions & 2 deletions worlds/wargroove2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def create_items(self) -> None:
# Fill out our pool with our items from the item table
pool = []
precollected_item_names = {item.name for item in self.multiworld.precollected_items[self.player]}
ignore_faction_items = self.options.commander_choice == 0
ignore_faction_items = self.options.commander_choice == "locked_random"
for name, data in item_table.items():
if data.code is not None and name not in precollected_item_names and \
not data.classification == ItemClassification.filler:
Expand Down Expand Up @@ -147,7 +147,7 @@ def create_items(self) -> None:
victory = Wargroove2Item("Wargroove 2 Victory", self.player)
for i in range(0, 4):
final_level = self.final_levels[i]
self.multiworld.get_location(final_level.victory_locations[0], self.player).place_locked_item(victory)
self.get_location(final_level.victory_locations[0]).place_locked_item(victory)
# Placing victory event at final location
self.multiworld.completion_condition[self.player] = lambda state: \
state.has("Wargroove 2 Victory", self.player, self.options.final_levels)
Expand Down

0 comments on commit e736be0

Please sign in to comment.