Update Minecraft to use exclusion_rules for its exclusion pools
This commit is contained in:
parent
7493b7f35e
commit
9e5e43fcd5
|
@ -114,27 +114,27 @@ advancement_table = {
|
|||
|
||||
exclusion_table = {
|
||||
"hard": {
|
||||
"Very Very Frightening": "50 XP",
|
||||
"Two by Two": "100 XP",
|
||||
"Two Birds, One Arrow": "50 XP",
|
||||
"Arbalistic": "100 XP",
|
||||
"Monsters Hunted": "100 XP",
|
||||
"Beaconator": "50 XP",
|
||||
"A Balanced Diet": "100 XP",
|
||||
"Uneasy Alliance": "100 XP",
|
||||
"Cover Me in Debris": "100 XP",
|
||||
"A Complete Catalogue": "50 XP",
|
||||
"Overpowered": "50 XP"
|
||||
"Very Very Frightening",
|
||||
"Two by Two",
|
||||
"Two Birds, One Arrow",
|
||||
"Arbalistic",
|
||||
"Monsters Hunted",
|
||||
"Beaconator",
|
||||
"A Balanced Diet",
|
||||
"Uneasy Alliance",
|
||||
"Cover Me in Debris",
|
||||
"A Complete Catalogue",
|
||||
"Overpowered",
|
||||
},
|
||||
"insane": {
|
||||
"How Did We Get Here?": "500 XP",
|
||||
"Adventuring Time": "500 XP"
|
||||
"How Did We Get Here?",
|
||||
"Adventuring Time",
|
||||
},
|
||||
"postgame": {
|
||||
"The Next Generation": "50 XP",
|
||||
"The End... Again...": "50 XP",
|
||||
"You Need a Mint": "50 XP",
|
||||
"Monsters Hunted": "100 XP"
|
||||
"The Next Generation",
|
||||
"The End... Again...",
|
||||
"You Need a Mint",
|
||||
"Monsters Hunted",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ from BaseClasses import MultiWorld
|
|||
|
||||
def set_rules(world: MultiWorld, player: int):
|
||||
def reachable_locations(state):
|
||||
postgame_advancements = set(exclusion_table['postgame'].keys())
|
||||
postgame_advancements = exclusion_table['postgame'].copy()
|
||||
postgame_advancements.add('Free the End')
|
||||
for event in events_table.keys():
|
||||
postgame_advancements.add(event)
|
||||
return [location for location in world.get_locations() if
|
||||
(player is None or location.player == player) and
|
||||
(location.name not in postgame_advancements) and
|
||||
location.player == player and
|
||||
location.name not in postgame_advancements and
|
||||
location.can_reach(state)]
|
||||
|
||||
# 92 total advancements. Goal is to complete X advancements and then Free the End.
|
||||
|
|
|
@ -5,6 +5,7 @@ from .Items import MinecraftItem, item_table, item_frequencies
|
|||
from .Locations import MinecraftAdvancement, advancement_table, exclusion_table, events_table
|
||||
from .Regions import mc_regions, link_minecraft_structures
|
||||
from .Rules import set_rules
|
||||
from worlds.generic.Rules import exclusion_rules
|
||||
|
||||
from BaseClasses import Region, Entrance, Item
|
||||
from .Options import minecraft_options
|
||||
|
@ -22,6 +23,7 @@ class MinecraftWorld(World):
|
|||
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()}
|
||||
|
||||
|
||||
def _get_mc_data(self):
|
||||
exits = ["Overworld Structure 1", "Overworld Structure 2", "Nether Structure 1", "Nether Structure 2",
|
||||
"The End Structure"]
|
||||
|
@ -35,35 +37,39 @@ class MinecraftWorld(World):
|
|||
'structures': {exit: self.world.get_entrance(exit, self.player).connected_region.name for exit in exits}
|
||||
}
|
||||
|
||||
|
||||
def generate_basic(self):
|
||||
link_minecraft_structures(self.world, self.player)
|
||||
|
||||
pool = []
|
||||
# Generate item pool
|
||||
itempool = []
|
||||
pool_counts = item_frequencies.copy()
|
||||
if getattr(self.world, "bee_traps")[self.player]:
|
||||
if getattr(self.world, "bee_traps")[self.player]: # replace Rotten Flesh by bee traps
|
||||
pool_counts.update({"Rotten Flesh": 0, "Bee Trap (Minecraft)": 4})
|
||||
for item_name in item_table:
|
||||
for count in range(pool_counts.get(item_name, 1)):
|
||||
pool.append(self.create_item(item_name))
|
||||
itempool.append(self.create_item(item_name))
|
||||
|
||||
prefill_pool = {}
|
||||
prefill_pool.update(events_table)
|
||||
exclusion_pools = ['hard', 'insane', 'postgame']
|
||||
for key in exclusion_pools:
|
||||
# Choose locations to automatically exclude based on settings
|
||||
exclusion_pool = set()
|
||||
exclusion_types = ['hard', 'insane', 'postgame']
|
||||
for key in exclusion_types:
|
||||
if not getattr(self.world, f"include_{key}_advancements")[self.player]:
|
||||
prefill_pool.update(exclusion_table[key])
|
||||
exclusion_pool.update(exclusion_table[key])
|
||||
exclusion_rules(self.world, self.player, exclusion_pool)
|
||||
|
||||
for loc_name, item_name in prefill_pool.items():
|
||||
location = self.world.get_location(loc_name, self.player)
|
||||
item = self.create_item(item_name)
|
||||
location.place_locked_item(item)
|
||||
pool.remove(item)
|
||||
# Prefill the Ender Dragon with the completion condition
|
||||
completion = self.create_item("Victory")
|
||||
self.world.get_location("Ender Dragon", self.player).place_locked_item(completion)
|
||||
itempool.remove(completion)
|
||||
|
||||
self.world.itempool += itempool
|
||||
|
||||
self.world.itempool += pool
|
||||
|
||||
def set_rules(self):
|
||||
set_rules(self.world, self.player)
|
||||
|
||||
|
||||
def create_regions(self):
|
||||
def MCRegion(region_name: str, exits=[]):
|
||||
ret = Region(region_name, None, region_name, self.player)
|
||||
|
@ -77,6 +83,7 @@ class MinecraftWorld(World):
|
|||
|
||||
self.world.regions += [MCRegion(*r) for r in mc_regions]
|
||||
|
||||
|
||||
def generate_output(self):
|
||||
import json
|
||||
from base64 import b64encode
|
||||
|
@ -87,6 +94,7 @@ class MinecraftWorld(World):
|
|||
with open(output_path(filename), 'wb') as f:
|
||||
f.write(b64encode(bytes(json.dumps(data), 'utf-8')))
|
||||
|
||||
|
||||
def fill_slot_data(self):
|
||||
slot_data = self._get_mc_data()
|
||||
for option_name in minecraft_options:
|
||||
|
@ -94,6 +102,7 @@ class MinecraftWorld(World):
|
|||
slot_data[option_name] = int(option.value)
|
||||
return slot_data
|
||||
|
||||
|
||||
def create_item(self, name: str) -> Item:
|
||||
item_data = item_table[name]
|
||||
return MinecraftItem(name, item_data.progression, item_data.code, self.player)
|
||||
return MinecraftItem(name, item_data.progression, item_data.code, self.player)
|
||||
|
|
Loading…
Reference in New Issue