2023-02-14 00:06:43 +00:00
|
|
|
from BaseClasses import Region, Entrance, Item, Tutorial, ItemClassification
|
2022-03-22 22:30:10 +00:00
|
|
|
from .Items import ChecksFinderItem, item_table, required_items
|
|
|
|
from .Locations import ChecksFinderAdvancement, advancement_table, exclusion_table
|
2022-06-17 01:23:27 +00:00
|
|
|
from .Options import checksfinder_options
|
2022-03-22 22:30:10 +00:00
|
|
|
from .Rules import set_rules, set_completion_rules
|
2022-05-11 18:05:53 +00:00
|
|
|
from ..AutoWorld import World, WebWorld
|
2022-03-22 22:30:10 +00:00
|
|
|
|
|
|
|
client_version = 7
|
|
|
|
|
2022-05-11 18:05:53 +00:00
|
|
|
|
|
|
|
class ChecksFinderWeb(WebWorld):
|
|
|
|
tutorials = [Tutorial(
|
|
|
|
"Multiworld Setup Tutorial",
|
|
|
|
"A guide to setting up the Archipelago ChecksFinder software on your computer. This guide covers "
|
|
|
|
"single-player, multiworld, and related software.",
|
|
|
|
"English",
|
|
|
|
"checksfinder_en.md",
|
|
|
|
"checksfinder/en",
|
|
|
|
["Mewlif"]
|
|
|
|
)]
|
|
|
|
|
|
|
|
|
2022-03-22 22:30:10 +00:00
|
|
|
class ChecksFinderWorld(World):
|
|
|
|
"""
|
|
|
|
ChecksFinder is a game where you avoid mines and find checks inside the board
|
|
|
|
with the mines! You win when you get all your items and beat the board!
|
|
|
|
"""
|
|
|
|
game: str = "ChecksFinder"
|
2022-08-15 21:46:59 +00:00
|
|
|
option_definitions = checksfinder_options
|
2022-03-22 22:30:10 +00:00
|
|
|
topology_present = True
|
2022-05-11 18:05:53 +00:00
|
|
|
web = ChecksFinderWeb()
|
2022-03-22 22:30:10 +00:00
|
|
|
|
|
|
|
item_name_to_id = {name: data.code for name, data in item_table.items()}
|
|
|
|
location_name_to_id = {name: data.id for name, data in advancement_table.items()}
|
|
|
|
|
|
|
|
data_version = 4
|
|
|
|
|
|
|
|
def _get_checksfinder_data(self):
|
|
|
|
return {
|
2023-02-02 00:14:23 +00:00
|
|
|
'world_seed': self.multiworld.per_slot_randoms[self.player].getrandbits(32),
|
2022-11-01 02:41:21 +00:00
|
|
|
'seed_name': self.multiworld.seed_name,
|
|
|
|
'player_name': self.multiworld.get_player_name(self.player),
|
2022-03-22 22:30:10 +00:00
|
|
|
'player_id': self.player,
|
|
|
|
'client_version': client_version,
|
2022-11-01 02:41:21 +00:00
|
|
|
'race': self.multiworld.is_race,
|
2022-03-22 22:30:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def generate_basic(self):
|
|
|
|
|
|
|
|
# Generate item pool
|
|
|
|
itempool = []
|
|
|
|
# Add all required progression items
|
|
|
|
for (name, num) in required_items.items():
|
|
|
|
itempool += [name] * num
|
|
|
|
# Add the map width and height stuff
|
|
|
|
itempool += ["Map Width"] * (10-5)
|
|
|
|
itempool += ["Map Height"] * (10-5)
|
|
|
|
# Add the map bombs
|
|
|
|
itempool += ["Map Bombs"] * (20-5)
|
|
|
|
# Convert itempool into real items
|
|
|
|
itempool = [item for item in map(lambda name: self.create_item(name), itempool)]
|
|
|
|
|
2022-11-01 02:41:21 +00:00
|
|
|
self.multiworld.itempool += itempool
|
2022-03-22 22:30:10 +00:00
|
|
|
|
|
|
|
def set_rules(self):
|
2022-11-01 02:41:21 +00:00
|
|
|
set_rules(self.multiworld, self.player)
|
|
|
|
set_completion_rules(self.multiworld, self.player)
|
2022-03-22 22:30:10 +00:00
|
|
|
|
|
|
|
def create_regions(self):
|
2023-02-14 00:06:43 +00:00
|
|
|
menu = Region("Menu", self.player, self.multiworld)
|
|
|
|
board = Region("Board", self.player, self.multiworld)
|
|
|
|
board.locations = [ChecksFinderAdvancement(self.player, loc_name, loc_data.id, board)
|
|
|
|
for loc_name, loc_data in advancement_table.items() if loc_data.region == board.name]
|
|
|
|
|
|
|
|
connection = Entrance(self.player, "New Board", menu)
|
|
|
|
menu.exits.append(connection)
|
|
|
|
connection.connect(board)
|
|
|
|
self.multiworld.regions += [menu, board]
|
2022-03-22 22:30:10 +00:00
|
|
|
|
|
|
|
def fill_slot_data(self):
|
|
|
|
slot_data = self._get_checksfinder_data()
|
|
|
|
for option_name in checksfinder_options:
|
2022-11-01 02:41:21 +00:00
|
|
|
option = getattr(self.multiworld, option_name)[self.player]
|
2022-03-22 22:30:10 +00:00
|
|
|
if slot_data.get(option_name, None) is None and type(option.value) in {str, int}:
|
|
|
|
slot_data[option_name] = int(option.value)
|
|
|
|
return slot_data
|
|
|
|
|
|
|
|
def create_item(self, name: str) -> Item:
|
|
|
|
item_data = item_table[name]
|
2022-06-17 01:23:27 +00:00
|
|
|
item = ChecksFinderItem(name,
|
|
|
|
ItemClassification.progression if item_data.progression else ItemClassification.filler,
|
|
|
|
item_data.code, self.player)
|
2022-03-22 22:30:10 +00:00
|
|
|
return item
|