Districting considers the Tavern North entrance

Major items are counted differently
Minor edits
This commit is contained in:
aerinon
2022-01-13 15:13:22 -07:00
parent 481e34d2f0
commit 9fd73e08bb
4 changed files with 9 additions and 55 deletions

View File

@@ -1222,7 +1222,6 @@ def standard_rules(world, player):
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))
# 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',
'Aginahs Cave', 'Sahasrahlas Hut', 'Kakariko Well Drop', 'Kakariko Well Cave', 'Blacksmiths Hut',
'Bat Cave Drop Ledge', 'Bat Cave Cave', 'Sick Kids House', 'Hobo Bridge',

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env python3
import os
import re
import operator as op
import subprocess
import sys
import xml.etree.ElementTree as ET
from collections import defaultdict
from functools import reduce
from math import factorial
def int16_as_bytes(value):
@@ -134,10 +133,7 @@ def kth_combination(k, l, r):
def ncr(n, r):
if r == 0:
return 1
r = min(r, n-r)
numerator = reduce(op.mul, range(n, n-r, -1), 1)
denominator = reduce(op.mul, range(1, r+1), 1)
return numerator / denominator
return factorial(n) // factorial(r) // factorial(n-r)
entrance_offsets = {

View File

@@ -39,7 +39,7 @@ def create_district_helper(world, player):
'Two Brothers House (East)', 'Two Brothers House (West)', 'Blinds Hideout', 'Chicken House',
'Blacksmiths Hut', 'Sick Kids House', 'Snitch Lady (East)', 'Snitch Lady (West)',
'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',
'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',

View File

@@ -169,7 +169,7 @@ def district_item_pool_config(world):
config.item_pool = {}
for player in range(1, world.players + 1):
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
district_choices = {}
for p in range(1, world.players + 1):
@@ -318,52 +318,8 @@ def validate_reservation(location, dungeon, world, player):
return False
def count_major_items(world, player):
major_item_set = 52
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 count_major_items(config, world, player):
return sum(1 for x in world.itempool if x.name in config.item_pool[player] and x.player == player)
def calc_dungeon_limits(world, player):
@@ -847,6 +803,9 @@ trash_items = {
'Small Heart': 2,
'Bee': 2,
'Arrows (5)': 2,
'Chicken': 2,
'Single Bomb': 2,
'Bombs (3)': 3,
'Arrows (10)': 3,