DS3: Dark Souls 3 Major Update/Refactor (#1864)

* fix estus shard/bone shard numbers

there are only 11 estus shards in the pool, so fixed number of estus shards so everything can be collected, and upped the number of bone shards in the pool to fix datapackage numbers. new counts went from: 15(estus) + 5(bones) = 20(total) TO 11(estus) + 9(bones) = 20(total)

* Update locations_data.py

changed estus shard/bone shard counts to match the counts in items_data.py. same reasoning as the commit for that, only 11 estus in game

* added new options "Late DLC"
revampled "Late Basin of Vows" option
added the Fire Demon location in Undead Sanctuary

* first file dump

added new settings for customizing pool options
sorted all the item pools
code clean up
fixed estus/bone shard counts
still need to figure out location excluding

* bunch of changes

added new locations
put locations into specific lists
made DarkSouls3Locations for each list of items
still need to figure out how to exclude

* excluded locations from generating without options, created gotthard_region, update how the pool fills additional items, update location/item tables, create more tables

* code cleanup, remove extra tables, add grave key/eyes of a firekeeper back to key pool

* fixed some logging

* add more detailed options descriptions

* forgot to update progressive locations updates too whoops

* remove irina's tower key from items/location list. the current ID's dont work to shuffle

* fixed item-to-locations, added new weapons, added new armors, added new rings, added "eyes of a fire keeper" to key locations list to balance, adjusted tables

* added HWL: broken straight sword location, moved Greirat's ashes to  NPC items

* remove hwl: broken short sword location/item from pool (does not exist), fix item/location counts in options, general code clean up

* more code cleanup, fix Havels Ring +3 location/properly renamed item, changed Estus/Bone Shard names to not include a +| added a missing undead bone shard

* fixed npc rule, added a bunch of ring locations, fixed ring tables

* updated options

* cleaned up more code, edited some option names

* start of new items system

* DS3: Major refactor (allows for defining more items than those in vanilla locations)

* DS3: Repair changes overwritten by refactor

* DS3: Re-implement new options for location categories

* DS3: Make replacement item lists for most unique item types

* DS3: Remove accidentally added apworld

* DS3: Make option names more consistent

* DS3: Fix Pyromancer's Parting Flame location category

* DS3: Add new items

* DS3: Fix access rule for DLC/Contraption Key

* DS3: Only replace unrandomized progression items with events

Also fix some location names/categories

* DS3: Change some location names to be in line with their items

* DS3: Add randomized infusion code (only works for Broadsword)

* DS3: Make varied item pool an option

* added remaining weapons, shields, armors, rings, spells, dlc equivalents | added remaining dlc ring locations (2 in dreg heap, 5 in ringed city)

* adjusted 'Progressive Locations' counts and added new table

* added more souls + upgrade gems

* added the rest of consumables

* reverted adding an additional 'progressive location 4' table and added bulk progression locations to prog. location 3 table

* DS3: Add infusion categories and some cleanup of items

* DS3: Fix item ordering

* DS3: Fix infusion/upgrade code extra if

* DS3: Disable some unmarked cut content items

* DS3: Rename blessed red and white shield+1

* DS3: Implement guaranteed_items option

* DS3: Remove print statement

* DS3: Add extra check for trying to remove items from an empty list

* add unused content item id's

* DS3: Move cut content to its own list

* DS3: Classify spells and healing upgrades as useful

* DS3: Implement get_filler_item_name

* DS3: Change lower bounds for upgrades from +1 to +0

* DS3: Move Ancient Dragon Greatshield back to vanilla and recategorize some useful consumables

* DS3: Guaranteed items checks for number of existing items before replacing

* added remaining progressive items, fixed npc rules, adjusted option location counts

* delete extra items, add rule for dancer/late basin

* seperate PW into two parts (can access first half w/o contraption key | SKIP more unused items

* DS3: Minor linting changes

* DS3: Update required_client_version

* DS3: Remove rule for bell tower access

The key can always be purchased from the shop

* DS3: Move location category option checks to generate_early

* added "Boss Soul" option to pool

* DS3: Fix rules for boss souls and update misc location count

* DS3: Address minor review comments

* DS3: Change category enums to IntEnum

* DS3: Make apworld

---------

Co-authored-by: Brooty Johnson <83629348+Br00ty@users.noreply.github.com>
This commit is contained in:
Bryce Wilson
2023-07-03 23:46:18 -07:00
committed by GitHub
parent 532c4c068f
commit d35d3b629e
7 changed files with 2460 additions and 1502 deletions

View File

@@ -1,21 +1,15 @@
# world/dark_souls_3/__init__.py
from typing import Dict
from typing import Dict, Set, List
from .Items import DarkSouls3Item
from .Locations import DarkSouls3Location
from .Options import dark_souls_options
from .data.items_data import weapons_upgrade_5_table, weapons_upgrade_10_table, item_dictionary, key_items_list, \
dlc_weapons_upgrade_5_table, dlc_weapons_upgrade_10_table
from .data.locations_data import location_dictionary, fire_link_shrine_table, \
high_wall_of_lothric, \
undead_settlement_table, road_of_sacrifice_table, consumed_king_garden_table, cathedral_of_the_deep_table, \
farron_keep_table, catacombs_of_carthus_table, smouldering_lake_table, irithyll_of_the_boreal_valley_table, \
irithyll_dungeon_table, profaned_capital_table, anor_londo_table, lothric_castle_table, grand_archives_table, \
untended_graves_table, archdragon_peak_table, firelink_shrine_bell_tower_table, progressive_locations, \
progressive_locations_2, progressive_locations_3, painted_world_table, dreg_heap_table, ringed_city_table, dlc_progressive_locations
from ..AutoWorld import World, WebWorld
from BaseClasses import MultiWorld, Region, Item, Entrance, Tutorial, ItemClassification
from ..generic.Rules import set_rule, add_item_rule
from Options import Toggle
from worlds.AutoWorld import World, WebWorld
from worlds.generic.Rules import set_rule, add_rule, add_item_rule
from .Items import DarkSouls3Item, DS3ItemCategory, item_dictionary, key_item_names
from .Locations import DarkSouls3Location, DS3LocationCategory, location_tables, location_dictionary
from .Options import RandomizeWeaponLevelOption, PoolTypeOption, dark_souls_options
class DarkSouls3Web(WebWorld):
@@ -52,212 +46,394 @@ class DarkSouls3World(World):
option_definitions = dark_souls_options
topology_present: bool = True
web = DarkSouls3Web()
data_version = 5
data_version = 6
base_id = 100000
required_client_version = (0, 3, 7)
enabled_location_categories: Set[DS3LocationCategory]
required_client_version = (0, 4, 2)
item_name_to_id = DarkSouls3Item.get_name_to_id()
location_name_to_id = DarkSouls3Location.get_name_to_id()
def __init__(self, world: MultiWorld, player: int):
super().__init__(world, player)
def __init__(self, multiworld: MultiWorld, player: int):
super().__init__(multiworld, player)
self.locked_items = []
self.locked_locations = []
self.main_path_locations = []
self.enabled_location_categories = set()
def generate_early(self):
if self.multiworld.enable_weapon_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.WEAPON)
if self.multiworld.enable_shield_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.SHIELD)
if self.multiworld.enable_armor_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.ARMOR)
if self.multiworld.enable_ring_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.RING)
if self.multiworld.enable_spell_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.SPELL)
if self.multiworld.enable_npc_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.NPC)
if self.multiworld.enable_key_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.KEY)
if self.multiworld.enable_boss_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.BOSS)
if self.multiworld.enable_misc_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.MISC)
if self.multiworld.enable_health_upgrade_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.HEALTH)
if self.multiworld.enable_progressive_locations[self.player] == Toggle.option_true:
self.enabled_location_categories.add(DS3LocationCategory.PROGRESSIVE_ITEM)
def create_regions(self):
progressive_location_table = []
if self.multiworld.enable_progressive_locations[self.player].value:
progressive_location_table = [] + \
location_tables["Progressive Items 1"] + \
location_tables["Progressive Items 2"] + \
location_tables["Progressive Items 3"] + \
location_tables["Progressive Items 4"]
if self.multiworld.enable_dlc[self.player].value:
progressive_location_table += location_tables["Progressive Items DLC"]
# Create Vanilla Regions
regions = {}
regions["Menu"] = self.create_region("Menu", progressive_location_table)
regions.update({region_name: self.create_region(region_name, location_tables[region_name]) for region_name in [
"Firelink Shrine",
"Firelink Shrine Bell Tower",
"High Wall of Lothric",
"Undead Settlement",
"Road of Sacrifices",
"Cathedral of the Deep",
"Farron Keep",
"Catacombs of Carthus",
"Smouldering Lake",
"Irithyll of the Boreal Valley",
"Irithyll Dungeon",
"Profaned Capital",
"Anor Londo",
"Lothric Castle",
"Consumed King's Garden",
"Grand Archives",
"Untended Graves",
"Archdragon Peak",
"Kiln of the First Flame",
]})
# Create DLC Regions
if self.multiworld.enable_dlc[self.player]:
regions.update({region_name: self.create_region(region_name, location_tables[region_name]) for region_name in [
"Painted World of Ariandel 1",
"Painted World of Ariandel 2",
"Dreg Heap",
"Ringed City",
]})
# Connect Regions
def create_connection(from_region: str, to_region: str):
connection = Entrance(self.player, f"Go To {to_region}", regions[from_region])
regions[from_region].exits.append(connection)
connection.connect(regions[to_region])
regions["Menu"].exits.append(Entrance(self.player, "New Game", regions["Menu"]))
self.multiworld.get_entrance("New Game", self.player).connect(regions["Firelink Shrine"])
create_connection("Firelink Shrine", "High Wall of Lothric")
create_connection("Firelink Shrine", "Firelink Shrine Bell Tower")
create_connection("Firelink Shrine", "Kiln of the First Flame")
create_connection("High Wall of Lothric", "Undead Settlement")
create_connection("High Wall of Lothric", "Lothric Castle")
create_connection("Undead Settlement", "Road of Sacrifices")
create_connection("Road of Sacrifices", "Cathedral of the Deep")
create_connection("Road of Sacrifices", "Farron Keep")
create_connection("Farron Keep", "Catacombs of Carthus")
create_connection("Catacombs of Carthus", "Irithyll of the Boreal Valley")
create_connection("Catacombs of Carthus", "Smouldering Lake")
create_connection("Irithyll of the Boreal Valley", "Irithyll Dungeon")
create_connection("Irithyll of the Boreal Valley", "Anor Londo")
create_connection("Irithyll Dungeon", "Archdragon Peak")
create_connection("Irithyll Dungeon", "Profaned Capital")
create_connection("Lothric Castle", "Consumed King's Garden")
create_connection("Lothric Castle", "Grand Archives")
create_connection("Consumed King's Garden", "Untended Graves")
# Connect DLC Regions
if self.multiworld.enable_dlc[self.player]:
create_connection("Cathedral of the Deep", "Painted World of Ariandel 1")
create_connection("Painted World of Ariandel 1", "Painted World of Ariandel 2")
create_connection("Painted World of Ariandel 2", "Dreg Heap")
create_connection("Dreg Heap", "Ringed City")
# For each region, add the associated locations retrieved from the corresponding location_table
def create_region(self, region_name, location_table) -> Region:
new_region = Region(region_name, self.player, self.multiworld)
for location in location_table:
if location.category in self.enabled_location_categories:
new_location = DarkSouls3Location(
self.player,
location.name,
location.category,
location.default_item,
self.location_name_to_id[location.name],
new_region
)
else:
# Replace non-randomized progression items with events
event_item = self.create_item(location.default_item)
if event_item.classification != ItemClassification.progression:
continue
new_location = DarkSouls3Location(
self.player,
location.name,
location.category,
location.default_item,
None,
new_region
)
event_item.code = None
new_location.place_locked_item(event_item)
if region_name == "Menu":
add_item_rule(new_location, lambda item: not item.advancement)
new_region.locations.append(new_location)
self.multiworld.regions.append(new_region)
return new_region
def create_items(self):
dlc_enabled = self.multiworld.enable_dlc[self.player] == Toggle.option_true
itempool_by_category = {category: [] for category in self.enabled_location_categories}
# Gather all default items on randomized locations
num_required_extra_items = 0
for location in self.multiworld.get_locations(self.player):
if location.category in itempool_by_category:
if item_dictionary[location.default_item_name].category == DS3ItemCategory.SKIP:
num_required_extra_items += 1
else:
itempool_by_category[location.category].append(location.default_item_name)
# Replace each item category with a random sample of items of those types
if self.multiworld.pool_type[self.player] == PoolTypeOption.option_various:
def create_random_replacement_list(item_categories: Set[DS3ItemCategory], num_items: int):
candidates = [
item.name for item
in item_dictionary.values()
if (item.category in item_categories and (not item.is_dlc or dlc_enabled))
]
return self.multiworld.random.sample(candidates, num_items)
if DS3LocationCategory.WEAPON in self.enabled_location_categories:
itempool_by_category[DS3LocationCategory.WEAPON] = create_random_replacement_list(
{
DS3ItemCategory.WEAPON_UPGRADE_5,
DS3ItemCategory.WEAPON_UPGRADE_10,
DS3ItemCategory.WEAPON_UPGRADE_10_INFUSIBLE
},
len(itempool_by_category[DS3LocationCategory.WEAPON])
)
if DS3LocationCategory.SHIELD in self.enabled_location_categories:
itempool_by_category[DS3LocationCategory.SHIELD] = create_random_replacement_list(
{DS3ItemCategory.SHIELD, DS3ItemCategory.SHIELD_INFUSIBLE},
len(itempool_by_category[DS3LocationCategory.SHIELD])
)
if DS3LocationCategory.ARMOR in self.enabled_location_categories:
itempool_by_category[DS3LocationCategory.ARMOR] = create_random_replacement_list(
{DS3ItemCategory.ARMOR},
len(itempool_by_category[DS3LocationCategory.ARMOR])
)
if DS3LocationCategory.RING in self.enabled_location_categories:
itempool_by_category[DS3LocationCategory.RING] = create_random_replacement_list(
{DS3ItemCategory.RING},
len(itempool_by_category[DS3LocationCategory.RING])
)
if DS3LocationCategory.SPELL in self.enabled_location_categories:
itempool_by_category[DS3LocationCategory.SPELL] = create_random_replacement_list(
{DS3ItemCategory.SPELL},
len(itempool_by_category[DS3LocationCategory.SPELL])
)
itempool: List[DarkSouls3Item] = []
for category in self.enabled_location_categories:
itempool += [self.create_item(name) for name in itempool_by_category[category]]
# A list of items we can replace
removable_items = [item for item in itempool if item.classification != ItemClassification.progression]
guaranteed_items = self.multiworld.guaranteed_items[self.player].value
for item_name in guaranteed_items:
# Break early just in case nothing is removable (if user is trying to guarantee more
# items than the pool can hold, for example)
if len(removable_items) == 0:
break
num_existing_copies = len([item for item in itempool if item.name == item_name])
for _ in range(guaranteed_items[item_name]):
if num_existing_copies > 0:
num_existing_copies -= 1
continue
if num_required_extra_items > 0:
# We can just add them instead of using "Soul of an Intrepid Hero" later
num_required_extra_items -= 1
else:
if len(removable_items) == 0:
break
# Try to construct a list of items with the same category that can be removed
# If none exist, just remove something at random
removable_shortlist = [
item for item
in removable_items
if item_dictionary[item.name].category == item_dictionary[item_name].category
]
if len(removable_shortlist) == 0:
removable_shortlist = removable_items
removed_item = self.multiworld.random.choice(removable_shortlist)
removable_items.remove(removed_item) # To avoid trying to replace the same item twice
itempool.remove(removed_item)
itempool.append(self.create_item(item_name))
# Extra filler items for locations containing SKIP items
itempool += [self.create_filler() for _ in range(num_required_extra_items)]
# Add items to itempool
self.multiworld.itempool += itempool
def create_item(self, name: str) -> Item:
useful_categories = {
DS3ItemCategory.WEAPON_UPGRADE_5,
DS3ItemCategory.WEAPON_UPGRADE_10,
DS3ItemCategory.WEAPON_UPGRADE_10_INFUSIBLE,
DS3ItemCategory.SPELL,
}
data = self.item_name_to_id[name]
if name in key_items_list:
if name in key_item_names:
item_classification = ItemClassification.progression
elif name in weapons_upgrade_5_table or name in weapons_upgrade_10_table:
elif item_dictionary[name].category in useful_categories or name in {"Estus Shard", "Undead Bone Shard"}:
item_classification = ItemClassification.useful
else:
item_classification = ItemClassification.filler
return DarkSouls3Item(name, item_classification, data, self.player)
def create_regions(self):
if self.multiworld.enable_progressive_locations[self.player].value and self.multiworld.enable_dlc[self.player].value:
menu_region = self.create_region("Menu", {**progressive_locations, **progressive_locations_2,
**progressive_locations_3, **dlc_progressive_locations})
elif self.multiworld.enable_progressive_locations[self.player].value:
menu_region = self.create_region("Menu", {**progressive_locations, **progressive_locations_2,
**progressive_locations_3})
else:
menu_region = self.create_region("Menu", None)
def get_filler_item_name(self) -> str:
return "Soul of an Intrepid Hero"
# Create all Vanilla regions of Dark Souls III
firelink_shrine_region = self.create_region("Firelink Shrine", fire_link_shrine_table)
firelink_shrine_bell_tower_region = self.create_region("Firelink Shrine Bell Tower",
firelink_shrine_bell_tower_table)
high_wall_of_lothric_region = self.create_region("High Wall of Lothric", high_wall_of_lothric)
undead_settlement_region = self.create_region("Undead Settlement", undead_settlement_table)
road_of_sacrifices_region = self.create_region("Road of Sacrifices", road_of_sacrifice_table)
consumed_king_garden_region = self.create_region("Consumed King's Garden", consumed_king_garden_table)
cathedral_of_the_deep_region = self.create_region("Cathedral of the Deep", cathedral_of_the_deep_table)
farron_keep_region = self.create_region("Farron Keep", farron_keep_table)
catacombs_of_carthus_region = self.create_region("Catacombs of Carthus", catacombs_of_carthus_table)
smouldering_lake_region = self.create_region("Smouldering Lake", smouldering_lake_table)
irithyll_of_the_boreal_valley_region = self.create_region("Irithyll of the Boreal Valley",
irithyll_of_the_boreal_valley_table)
irithyll_dungeon_region = self.create_region("Irithyll Dungeon", irithyll_dungeon_table)
profaned_capital_region = self.create_region("Profaned Capital", profaned_capital_table)
anor_londo_region = self.create_region("Anor Londo", anor_londo_table)
lothric_castle_region = self.create_region("Lothric Castle", lothric_castle_table)
grand_archives_region = self.create_region("Grand Archives", grand_archives_table)
untended_graves_region = self.create_region("Untended Graves", untended_graves_table)
archdragon_peak_region = self.create_region("Archdragon Peak", archdragon_peak_table)
kiln_of_the_first_flame_region = self.create_region("Kiln Of The First Flame", None)
# DLC Down here
if self.multiworld.enable_dlc[self.player]:
painted_world_of_ariandel_region = self.create_region("Painted World of Ariandel", painted_world_table)
dreg_heap_region = self.create_region("Dreg Heap", dreg_heap_table)
ringed_city_region = self.create_region("Ringed City", ringed_city_table)
# Create the entrance to connect those regions
menu_region.exits.append(Entrance(self.player, "New Game", menu_region))
self.multiworld.get_entrance("New Game", self.player).connect(firelink_shrine_region)
firelink_shrine_region.exits.append(Entrance(self.player, "Goto High Wall of Lothric",
firelink_shrine_region))
firelink_shrine_region.exits.append(Entrance(self.player, "Goto Kiln Of The First Flame",
firelink_shrine_region))
firelink_shrine_region.exits.append(Entrance(self.player, "Goto Bell Tower",
firelink_shrine_region))
self.multiworld.get_entrance("Goto High Wall of Lothric", self.player).connect(high_wall_of_lothric_region)
self.multiworld.get_entrance("Goto Kiln Of The First Flame", self.player).connect(
kiln_of_the_first_flame_region)
self.multiworld.get_entrance("Goto Bell Tower", self.player).connect(firelink_shrine_bell_tower_region)
high_wall_of_lothric_region.exits.append(Entrance(self.player, "Goto Undead Settlement",
high_wall_of_lothric_region))
high_wall_of_lothric_region.exits.append(Entrance(self.player, "Goto Lothric Castle",
high_wall_of_lothric_region))
self.multiworld.get_entrance("Goto Undead Settlement", self.player).connect(undead_settlement_region)
self.multiworld.get_entrance("Goto Lothric Castle", self.player).connect(lothric_castle_region)
undead_settlement_region.exits.append(Entrance(self.player, "Goto Road Of Sacrifices",
undead_settlement_region))
self.multiworld.get_entrance("Goto Road Of Sacrifices", self.player).connect(road_of_sacrifices_region)
road_of_sacrifices_region.exits.append(Entrance(self.player, "Goto Cathedral", road_of_sacrifices_region))
road_of_sacrifices_region.exits.append(Entrance(self.player, "Goto Farron keep", road_of_sacrifices_region))
self.multiworld.get_entrance("Goto Cathedral", self.player).connect(cathedral_of_the_deep_region)
self.multiworld.get_entrance("Goto Farron keep", self.player).connect(farron_keep_region)
farron_keep_region.exits.append(Entrance(self.player, "Goto Carthus catacombs", farron_keep_region))
self.multiworld.get_entrance("Goto Carthus catacombs", self.player).connect(catacombs_of_carthus_region)
catacombs_of_carthus_region.exits.append(Entrance(self.player, "Goto Irithyll of the boreal",
catacombs_of_carthus_region))
catacombs_of_carthus_region.exits.append(Entrance(self.player, "Goto Smouldering Lake",
catacombs_of_carthus_region))
self.multiworld.get_entrance("Goto Irithyll of the boreal", self.player). \
connect(irithyll_of_the_boreal_valley_region)
self.multiworld.get_entrance("Goto Smouldering Lake", self.player).connect(smouldering_lake_region)
irithyll_of_the_boreal_valley_region.exits.append(Entrance(self.player, "Goto Irithyll dungeon",
irithyll_of_the_boreal_valley_region))
irithyll_of_the_boreal_valley_region.exits.append(Entrance(self.player, "Goto Anor Londo",
irithyll_of_the_boreal_valley_region))
self.multiworld.get_entrance("Goto Irithyll dungeon", self.player).connect(irithyll_dungeon_region)
self.multiworld.get_entrance("Goto Anor Londo", self.player).connect(anor_londo_region)
irithyll_dungeon_region.exits.append(Entrance(self.player, "Goto Archdragon peak", irithyll_dungeon_region))
irithyll_dungeon_region.exits.append(Entrance(self.player, "Goto Profaned capital", irithyll_dungeon_region))
self.multiworld.get_entrance("Goto Archdragon peak", self.player).connect(archdragon_peak_region)
self.multiworld.get_entrance("Goto Profaned capital", self.player).connect(profaned_capital_region)
lothric_castle_region.exits.append(Entrance(self.player, "Goto Consumed King Garden", lothric_castle_region))
lothric_castle_region.exits.append(Entrance(self.player, "Goto Grand Archives", lothric_castle_region))
self.multiworld.get_entrance("Goto Consumed King Garden", self.player).connect(consumed_king_garden_region)
self.multiworld.get_entrance("Goto Grand Archives", self.player).connect(grand_archives_region)
consumed_king_garden_region.exits.append(Entrance(self.player, "Goto Untended Graves",
consumed_king_garden_region))
self.multiworld.get_entrance("Goto Untended Graves", self.player).connect(untended_graves_region)
# DLC Connectors Below
if self.multiworld.enable_dlc[self.player]:
cathedral_of_the_deep_region.exits.append(Entrance(self.player, "Goto Painted World of Ariandel",
cathedral_of_the_deep_region))
self.multiworld.get_entrance("Goto Painted World of Ariandel", self.player).connect(painted_world_of_ariandel_region)
painted_world_of_ariandel_region.exits.append(Entrance(self.player, "Goto Dreg Heap",
painted_world_of_ariandel_region))
self.multiworld.get_entrance("Goto Dreg Heap", self.player).connect(dreg_heap_region)
dreg_heap_region.exits.append(Entrance(self.player, "Goto Ringed City", dreg_heap_region))
self.multiworld.get_entrance("Goto Ringed City", self.player).connect(ringed_city_region)
# For each region, add the associated locations retrieved from the corresponding location_table
def create_region(self, region_name, location_table) -> Region:
new_region = Region(region_name, self.player, self.multiworld)
if location_table:
for name, address in location_table.items():
location = DarkSouls3Location(self.player, name, self.location_name_to_id[name], new_region)
if region_name == "Menu":
add_item_rule(location, lambda item: not item.advancement)
new_region.locations.append(location)
self.multiworld.regions.append(new_region)
return new_region
def create_items(self):
for name, address in self.item_name_to_id.items():
# Specific items will be included in the item pool under certain conditions. See generate_basic
if name == "Basin of Vows":
continue
# Do not add progressive_items ( containing "#" ) to the itempool if the option is disabled
if (not self.multiworld.enable_progressive_locations[self.player]) and "#" in name:
continue
# Do not add DLC items if the option is disabled
if (not self.multiworld.enable_dlc[self.player]) and DarkSouls3Item.is_dlc_item(name):
continue
# Do not add DLC Progressives if both options are disabled
if ((not self.multiworld.enable_progressive_locations[self.player]) or (not self.multiworld.enable_dlc[self.player])) and DarkSouls3Item.is_dlc_progressive(name):
continue
self.multiworld.itempool += [self.create_item(name)]
def generate_early(self):
pass
def set_rules(self) -> None:
# Define the access rules to the entrances
set_rule(self.multiworld.get_entrance("Goto Bell Tower", self.player),
lambda state: state.has("Tower Key", self.player))
set_rule(self.multiworld.get_entrance("Goto Undead Settlement", self.player),
set_rule(self.multiworld.get_entrance("Go To Undead Settlement", self.player),
lambda state: state.has("Small Lothric Banner", self.player))
set_rule(self.multiworld.get_entrance("Goto Lothric Castle", self.player),
set_rule(self.multiworld.get_entrance("Go To Lothric Castle", self.player),
lambda state: state.has("Basin of Vows", self.player))
set_rule(self.multiworld.get_entrance("Goto Irithyll of the boreal", self.player),
set_rule(self.multiworld.get_entrance("Go To Irithyll of the Boreal Valley", self.player),
lambda state: state.has("Small Doll", self.player))
set_rule(self.multiworld.get_entrance("Goto Archdragon peak", self.player),
lambda state: state.can_reach("CKG: Soul of Consumed Oceiros", "Location", self.player))
set_rule(self.multiworld.get_entrance("Goto Profaned capital", self.player),
lambda state: state.has("Storm Ruler", self.player))
set_rule(self.multiworld.get_entrance("Goto Grand Archives", self.player),
set_rule(self.multiworld.get_entrance("Go To Archdragon Peak", self.player),
lambda state: state.can_reach("Go To Untended Graves", "Entrance", self.player))
set_rule(self.multiworld.get_entrance("Go To Grand Archives", self.player),
lambda state: state.has("Grand Archives Key", self.player))
set_rule(self.multiworld.get_entrance("Goto Kiln Of The First Flame", self.player),
set_rule(self.multiworld.get_entrance("Go To Kiln of the First Flame", self.player),
lambda state: state.has("Cinders of a Lord - Abyss Watcher", self.player) and
state.has("Cinders of a Lord - Yhorm the Giant", self.player) and
state.has("Cinders of a Lord - Aldrich", self.player) and
state.has("Cinders of a Lord - Lothric Prince", self.player))
if self.multiworld.late_basin_of_vows[self.player] == Toggle.option_true:
add_rule(self.multiworld.get_entrance("Go To Lothric Castle", self.player),
lambda state: state.has("Small Lothric Banner", self.player))
# DLC Access Rules Below
if self.multiworld.enable_dlc[self.player]:
set_rule(self.multiworld.get_entrance("Goto Painted World of Ariandel", self.player),
lambda state: state.has("Contraption Key", self.player))
set_rule(self.multiworld.get_entrance("Goto Ringed City", self.player),
set_rule(self.multiworld.get_entrance("Go To Ringed City", self.player),
lambda state: state.has("Small Envoy Banner", self.player))
# If key items are randomized, must have contraption key to enter DLC
# If key items are not randomized, Contraption Key is guaranteed to be accessible before it is needed
if self.multiworld.enable_key_locations[self.player] == Toggle.option_true:
add_rule(self.multiworld.get_entrance("Go To Painted World of Ariandel 2", self.player),
lambda state: state.has("Contraption Key", self.player))
if self.multiworld.late_dlc[self.player] == Toggle.option_true:
add_rule(self.multiworld.get_entrance("Go To Painted World of Ariandel 2", self.player),
lambda state: state.has("Small Doll", self.player))
# Define the access rules to some specific locations
set_rule(self.multiworld.get_location("HWL: Soul of the Dancer", self.player),
lambda state: state.has("Basin of Vows", self.player))
set_rule(self.multiworld.get_location("HWL: Greirat's Ashes", self.player),
lambda state: state.has("Cell Key", self.player))
set_rule(self.multiworld.get_location("HWL: Blue Tearstone Ring", self.player),
lambda state: state.has("Cell Key", self.player))
set_rule(self.multiworld.get_location("ID: Bellowing Dragoncrest Ring", self.player),
lambda state: state.has("Jailbreaker's Key", self.player))
set_rule(self.multiworld.get_location("ID: Prisoner Chief's Ashes", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
set_rule(self.multiworld.get_location("ID: Covetous Gold Serpent Ring", self.player),
lambda state: state.has("Old Cell Key", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Ashes", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
black_hand_gotthard_corpse_rule = lambda state: \
set_rule(self.multiworld.get_location("PC: Cinders of a Lord - Yhorm the Giant", self.player),
lambda state: state.has("Storm Ruler", self.player))
if self.multiworld.enable_ring_locations[self.player] == Toggle.option_true:
set_rule(self.multiworld.get_location("ID: Bellowing Dragoncrest Ring", self.player),
lambda state: state.has("Jailbreaker's Key", self.player))
set_rule(self.multiworld.get_location("ID: Covetous Gold Serpent Ring", self.player),
lambda state: state.has("Old Cell Key", self.player))
set_rule(self.multiworld.get_location("UG: Hornet Ring", self.player),
lambda state: state.has("Small Lothric Banner", self.player))
if self.multiworld.enable_npc_locations[self.player] == Toggle.option_true:
set_rule(self.multiworld.get_location("HWL: Greirat's Ashes", self.player),
lambda state: state.has("Cell Key", self.player))
set_rule(self.multiworld.get_location("HWL: Blue Tearstone Ring", self.player),
lambda state: state.has("Cell Key", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Ashes", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Pointed Hat", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Coat", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Gloves", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
set_rule(self.multiworld.get_location("ID: Karla's Trousers", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
if self.multiworld.enable_misc_locations[self.player] == Toggle.option_true:
set_rule(self.multiworld.get_location("ID: Prisoner Chief's Ashes", self.player),
lambda state: state.has("Jailer's Key Ring", self.player))
if self.multiworld.enable_boss_locations[self.player] == Toggle.option_true:
set_rule(self.multiworld.get_location("PC: Soul of Yhorm the Giant", self.player),
lambda state: state.has("Storm Ruler", self.player))
set_rule(self.multiworld.get_location("HWL: Soul of the Dancer", self.player),
lambda state: state.has("Basin of Vows", self.player))
# Lump Soul of the Dancer in with LC for locations that should not be reachable
# before having access to US. (Prevents requiring getting Basin to fight Dancer to get SLB to go to US)
if self.multiworld.late_basin_of_vows[self.player] == Toggle.option_true:
add_rule(self.multiworld.get_location("HWL: Soul of the Dancer", self.player),
lambda state: state.has("Small Lothric Banner", self.player))
gotthard_corpse_rule = lambda state: \
(state.can_reach("AL: Cinders of a Lord - Aldrich", "Location", self.player) and
state.can_reach("PC: Cinders of a Lord - Yhorm the Giant", "Location", self.player))
set_rule(self.multiworld.get_location("LC: Grand Archives Key", self.player), black_hand_gotthard_corpse_rule)
set_rule(self.multiworld.get_location("LC: Gotthard Twinswords", self.player), black_hand_gotthard_corpse_rule)
set_rule(self.multiworld.get_location("LC: Grand Archives Key", self.player), gotthard_corpse_rule)
if self.multiworld.enable_weapon_locations[self.player] == Toggle.option_true:
set_rule(self.multiworld.get_location("LC: Gotthard Twinswords", self.player), gotthard_corpse_rule)
self.multiworld.completion_condition[self.player] = lambda state: \
state.has("Cinders of a Lord - Abyss Watcher", self.player) and \
@@ -265,57 +441,36 @@ class DarkSouls3World(World):
state.has("Cinders of a Lord - Aldrich", self.player) and \
state.has("Cinders of a Lord - Lothric Prince", self.player)
def generate_basic(self):
# Depending on the specified option, add the Basin of Vows to a specific location or to the item pool
item = self.create_item("Basin of Vows")
if self.multiworld.late_basin_of_vows[self.player]:
self.multiworld.get_location("IBV: Soul of Pontiff Sulyvahn", self.player).place_locked_item(item)
else:
self.multiworld.itempool += [item]
# Fill item pool with additional items
item_pool_len = self.item_name_to_id.__len__()
total_required_locations = self.location_name_to_id.__len__()
for i in range(item_pool_len, total_required_locations):
self.multiworld.itempool += [self.create_item("Soul of an Intrepid Hero")]
def fill_slot_data(self) -> Dict[str, object]:
slot_data: Dict[str, object] = {}
# Depending on the specified option, modify items hexadecimal value to add an upgrade level
item_dictionary_copy = item_dictionary.copy()
if self.multiworld.randomize_weapons_level[self.player] > 0:
# Depending on the specified option, modify items hexadecimal value to add an upgrade level or infusion
name_to_ds3_code = {item.name: item.ds3_code for item in item_dictionary.values()}
# Randomize some weapon upgrades
if self.multiworld.randomize_weapon_level[self.player] != RandomizeWeaponLevelOption.option_none:
# if the user made an error and set a min higher than the max we default to the max
max_5 = self.multiworld.max_levels_in_5[self.player]
min_5 = min(self.multiworld.min_levels_in_5[self.player], max_5)
max_10 = self.multiworld.max_levels_in_10[self.player]
min_10 = min(self.multiworld.min_levels_in_10[self.player], max_10)
weapons_percentage = self.multiworld.randomize_weapons_percentage[self.player]
weapon_level_percentage = self.multiworld.randomize_weapon_level_percentage[self.player]
# Randomize some weapons upgrades
if self.multiworld.randomize_weapons_level[self.player] in [1, 3]: # Options are either all or +5
for name in weapons_upgrade_5_table.keys():
if self.multiworld.per_slot_randoms[self.player].randint(1, 100) < weapons_percentage:
value = self.multiworld.per_slot_randoms[self.player].randint(min_5, max_5)
item_dictionary_copy[name] += value
for item in item_dictionary.values():
if self.multiworld.per_slot_randoms[self.player].randint(0, 99) < weapon_level_percentage:
if item.category == DS3ItemCategory.WEAPON_UPGRADE_5:
name_to_ds3_code[item.name] += self.multiworld.per_slot_randoms[self.player].randint(min_5, max_5)
elif item.category in {DS3ItemCategory.WEAPON_UPGRADE_10, DS3ItemCategory.WEAPON_UPGRADE_10_INFUSIBLE}:
name_to_ds3_code[item.name] += self.multiworld.per_slot_randoms[self.player].randint(min_10, max_10)
if self.multiworld.randomize_weapons_level[self.player] in [1, 2]: # Options are either all or +10
for name in weapons_upgrade_10_table.keys():
if self.multiworld.per_slot_randoms[self.player].randint(1, 100) < weapons_percentage:
value = self.multiworld.per_slot_randoms[self.player].randint(min_10, max_10)
item_dictionary_copy[name] += value
if self.multiworld.randomize_weapons_level[self.player] in [1, 3]:
for name in dlc_weapons_upgrade_5_table.keys():
if self.multiworld.per_slot_randoms[self.player].randint(1, 100) < weapons_percentage:
value = self.multiworld.per_slot_randoms[self.player].randint(min_5, max_5)
item_dictionary_copy[name] += value
if self.multiworld.randomize_weapons_level[self.player] in [1, 2]:
for name in dlc_weapons_upgrade_10_table.keys():
if self.multiworld.per_slot_randoms[self.player].randint(1, 100) < weapons_percentage:
value = self.multiworld.per_slot_randoms[self.player].randint(min_10, max_10)
item_dictionary_copy[name] += value
# Randomize some weapon infusions
if self.multiworld.randomize_infusion[self.player] == Toggle.option_true:
infusion_percentage = self.multiworld.randomize_infusion_percentage[self.player]
for item in item_dictionary.values():
if item.category in {DS3ItemCategory.WEAPON_UPGRADE_10_INFUSIBLE, DS3ItemCategory.SHIELD_INFUSIBLE}:
if self.multiworld.per_slot_randoms[self.player].randint(0, 99) < infusion_percentage:
name_to_ds3_code[item.name] += 100 * self.multiworld.per_slot_randoms[self.player].randint(0, 15)
# Create the mandatory lists to generate the player's output file
items_id = []
@@ -324,15 +479,19 @@ class DarkSouls3World(World):
locations_address = []
locations_target = []
for location in self.multiworld.get_filled_locations():
# Skip events
if location.item.code is None:
continue
if location.item.player == self.player:
items_id.append(location.item.code)
items_address.append(item_dictionary_copy[location.item.name])
items_address.append(name_to_ds3_code[location.item.name])
if location.player == self.player:
locations_address.append(location_dictionary[location.name])
locations_address.append(item_dictionary[location_dictionary[location.name].default_item].ds3_code)
locations_id.append(location.address)
if location.item.player == self.player:
locations_target.append(item_dictionary_copy[location.item.name])
locations_target.append(name_to_ds3_code[location.item.name])
else:
locations_target.append(0)