Districting considers the Tavern North entrance
Major items are counted differently Minor edits
This commit is contained in:
1
Rules.py
1
Rules.py
@@ -1222,7 +1222,6 @@ def standard_rules(world, player):
|
|||||||
for location in ['Mushroom', 'Bottle Merchant', 'Flute Spot', 'Sunken Treasure', 'Purple Chest', 'Maze Race']:
|
for location in ['Mushroom', 'Bottle Merchant', 'Flute Spot', 'Sunken Treasure', 'Purple Chest', 'Maze Race']:
|
||||||
add_rule(world.get_location(location, player), lambda state: state.has('Zelda Delivered', player))
|
add_rule(world.get_location(location, player), lambda state: state.has('Zelda Delivered', player))
|
||||||
|
|
||||||
# Bonk Fairy (Light) is a notable omission in ER shuffles/Retro
|
|
||||||
for entrance in ['Blinds Hideout', 'Zoras River', 'Kings Grave Outer Rocks', 'Dam', 'Tavern North', 'Chicken House',
|
for entrance in ['Blinds Hideout', 'Zoras River', 'Kings Grave Outer Rocks', 'Dam', 'Tavern North', 'Chicken House',
|
||||||
'Aginahs Cave', 'Sahasrahlas Hut', 'Kakariko Well Drop', 'Kakariko Well Cave', 'Blacksmiths Hut',
|
'Aginahs Cave', 'Sahasrahlas Hut', 'Kakariko Well Drop', 'Kakariko Well Cave', 'Blacksmiths Hut',
|
||||||
'Bat Cave Drop Ledge', 'Bat Cave Cave', 'Sick Kids House', 'Hobo Bridge',
|
'Bat Cave Drop Ledge', 'Bat Cave Cave', 'Sick Kids House', 'Hobo Bridge',
|
||||||
|
|||||||
8
Utils.py
8
Utils.py
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import operator as op
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import reduce
|
from math import factorial
|
||||||
|
|
||||||
|
|
||||||
def int16_as_bytes(value):
|
def int16_as_bytes(value):
|
||||||
@@ -134,10 +133,7 @@ def kth_combination(k, l, r):
|
|||||||
def ncr(n, r):
|
def ncr(n, r):
|
||||||
if r == 0:
|
if r == 0:
|
||||||
return 1
|
return 1
|
||||||
r = min(r, n-r)
|
return factorial(n) // factorial(r) // factorial(n-r)
|
||||||
numerator = reduce(op.mul, range(n, n-r, -1), 1)
|
|
||||||
denominator = reduce(op.mul, range(1, r+1), 1)
|
|
||||||
return numerator / denominator
|
|
||||||
|
|
||||||
|
|
||||||
entrance_offsets = {
|
entrance_offsets = {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ def create_district_helper(world, player):
|
|||||||
'Two Brothers House (East)', 'Two Brothers House (West)', 'Blinds Hideout', 'Chicken House',
|
'Two Brothers House (East)', 'Two Brothers House (West)', 'Blinds Hideout', 'Chicken House',
|
||||||
'Blacksmiths Hut', 'Sick Kids House', 'Snitch Lady (East)', 'Snitch Lady (West)',
|
'Blacksmiths Hut', 'Sick Kids House', 'Snitch Lady (East)', 'Snitch Lady (West)',
|
||||||
'Bush Covered House', 'Tavern (Front)', 'Light World Bomb Hut', 'Kakariko Shop', 'Library',
|
'Bush Covered House', 'Tavern (Front)', 'Light World Bomb Hut', 'Kakariko Shop', 'Library',
|
||||||
'Kakariko Gamble Game', 'Kakariko Well Drop', 'Bat Cave Drop']
|
'Kakariko Gamble Game', 'Kakariko Well Drop', 'Bat Cave Drop', 'Tavern North']
|
||||||
nw_lw_entrances = ['North Fairy Cave', 'Lost Woods Hideout Stump', 'Lumberjack Tree Cave', 'Sanctuary',
|
nw_lw_entrances = ['North Fairy Cave', 'Lost Woods Hideout Stump', 'Lumberjack Tree Cave', 'Sanctuary',
|
||||||
'Old Man Cave (West)', 'Death Mountain Return Cave (West)', 'Kings Grave', 'Lost Woods Gamble',
|
'Old Man Cave (West)', 'Death Mountain Return Cave (West)', 'Kings Grave', 'Lost Woods Gamble',
|
||||||
'Fortune Teller (Light)', 'Bonk Rock Cave', 'Lumberjack House', 'North Fairy Cave Drop',
|
'Fortune Teller (Light)', 'Bonk Rock Cave', 'Lumberjack House', 'North Fairy Cave Drop',
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ def district_item_pool_config(world):
|
|||||||
config.item_pool = {}
|
config.item_pool = {}
|
||||||
for player in range(1, world.players + 1):
|
for player in range(1, world.players + 1):
|
||||||
config.item_pool[player] = determine_major_items(world, player)
|
config.item_pool[player] = determine_major_items(world, player)
|
||||||
item_cnt += count_major_items(world, player)
|
item_cnt += count_major_items(config, world, player)
|
||||||
# set district choices
|
# set district choices
|
||||||
district_choices = {}
|
district_choices = {}
|
||||||
for p in range(1, world.players + 1):
|
for p in range(1, world.players + 1):
|
||||||
@@ -318,52 +318,8 @@ def validate_reservation(location, dungeon, world, player):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def count_major_items(world, player):
|
def count_major_items(config, world, player):
|
||||||
major_item_set = 52
|
return sum(1 for x in world.itempool if x.name in config.item_pool[player] and x.player == player)
|
||||||
if world.bigkeyshuffle[player]:
|
|
||||||
major_item_set += 11
|
|
||||||
if world.keydropshuffle[player]:
|
|
||||||
major_item_set += 1
|
|
||||||
if world.doorShuffle[player] == 'crossed':
|
|
||||||
major_item_set += 1
|
|
||||||
if world.keyshuffle[player]:
|
|
||||||
major_item_set += 29
|
|
||||||
if world.keydropshuffle[player]:
|
|
||||||
major_item_set += 32
|
|
||||||
if world.compassshuffle[player]:
|
|
||||||
major_item_set += 11
|
|
||||||
if world.doorShuffle[player] == 'crossed':
|
|
||||||
major_item_set += 2
|
|
||||||
if world.mapshuffle[player]:
|
|
||||||
major_item_set += 12
|
|
||||||
if world.doorShuffle[player] == 'crossed':
|
|
||||||
major_item_set += 1
|
|
||||||
if world.shopsanity[player]:
|
|
||||||
major_item_set += 2
|
|
||||||
if world.retro[player]:
|
|
||||||
major_item_set += 5 # the single arrow quiver
|
|
||||||
if world.goal == 'triforcehunt':
|
|
||||||
major_item_set += world.triforce_pool[player]
|
|
||||||
if world.bombbag[player]:
|
|
||||||
major_item_set += 2
|
|
||||||
if world.swords[player] != "random":
|
|
||||||
if world.swords[player] == 'assured':
|
|
||||||
major_item_set -= 1
|
|
||||||
if world.swords[player] in ['vanilla', 'swordless']:
|
|
||||||
major_item_set -= 4
|
|
||||||
if world.retro[player]:
|
|
||||||
if world.shopsanity[player]:
|
|
||||||
major_item_set -= 1 # sword in old man cave
|
|
||||||
if world.keyshuffle[player]:
|
|
||||||
major_item_set -= 29
|
|
||||||
# universal keys
|
|
||||||
major_item_set += 19 if world.difficulty[player] == 'normal' else 14
|
|
||||||
if world.mode[player] == 'standard' and world.doorShuffle[player] == 'vanilla':
|
|
||||||
major_item_set -= 1 # a key in escape
|
|
||||||
if world.doorShuffle[player] != 'vanilla':
|
|
||||||
major_item_set += 10 # tries to add up to 10 more universal keys for door rando
|
|
||||||
# todo: starting equipment?
|
|
||||||
return major_item_set
|
|
||||||
|
|
||||||
|
|
||||||
def calc_dungeon_limits(world, player):
|
def calc_dungeon_limits(world, player):
|
||||||
@@ -847,6 +803,9 @@ trash_items = {
|
|||||||
|
|
||||||
'Small Heart': 2,
|
'Small Heart': 2,
|
||||||
'Bee': 2,
|
'Bee': 2,
|
||||||
|
'Arrows (5)': 2,
|
||||||
|
'Chicken': 2,
|
||||||
|
'Single Bomb': 2,
|
||||||
|
|
||||||
'Bombs (3)': 3,
|
'Bombs (3)': 3,
|
||||||
'Arrows (10)': 3,
|
'Arrows (10)': 3,
|
||||||
|
|||||||
Reference in New Issue
Block a user