2017-11-18 23:21:31 +00:00
from collections import namedtuple
2018-01-27 21:21:32 +00:00
import logging
2017-11-10 10:15:45 +00:00
2018-03-23 03:18:40 +00:00
from BaseClasses import Region , RegionType , Shop , ShopType , Location
2018-09-26 17:12:20 +00:00
from Bosses import place_bosses
2018-01-03 01:01:16 +00:00
from Dungeons import get_dungeon_item_pool
2018-03-23 03:18:40 +00:00
from EntranceShuffle import connect_entrance
from Fill import FillError , fill_restrictive
from Items import ItemFactory
2020-08-01 04:22:59 +00:00
# This file sets the item pools for various modes. Timed modes and triforce hunt are enforced first, and then extra items are specified per mode to fill in the remaining space.
# Some basic items that various modes require are placed here, including pendants and crystals. Medallion requirements for the two relevant entrances are also decided.
2017-12-17 05:25:46 +00:00
2020-08-01 04:22:59 +00:00
alwaysitems = [ ' Bombos ' , ' Book of Mudora ' , ' Cane of Somaria ' , ' Ether ' , ' Fire Rod ' , ' Flippers ' , ' Flute ' , ' Hammer ' ,
' Hookshot ' , ' Ice Rod ' , ' Lamp ' ,
' Cape ' , ' Magic Powder ' , ' Mushroom ' , ' Pegasus Boots ' , ' Quake ' , ' Shovel ' , ' Bug Catching Net ' ,
' Cane of Byrna ' , ' Blue Boomerang ' , ' Red Boomerang ' ]
2017-11-10 10:15:45 +00:00
progressivegloves = [ ' Progressive Glove ' ] * 2
basicgloves = [ ' Power Glove ' , ' Titans Mitts ' ]
2020-08-01 04:22:59 +00:00
normalbottles = [ ' Bottle ' , ' Bottle (Red Potion) ' , ' Bottle (Green Potion) ' , ' Bottle (Blue Potion) ' , ' Bottle (Fairy) ' ,
' Bottle (Bee) ' , ' Bottle (Good Bee) ' ]
hardbottles = [ ' Bottle ' , ' Bottle (Red Potion) ' , ' Bottle (Green Potion) ' , ' Bottle (Blue Potion) ' , ' Bottle (Bee) ' ,
' Bottle (Good Bee) ' ]
2020-08-01 14:49:46 +00:00
easybaseitems = ( [ ' Sanctuary Heart Container ' , " Lamp " ] + [ ' Rupees (300) ' ] * 5 + [ ' Magic Upgrade (1/2) ' ] * 2 +
[ ' Boss Heart Container ' ] * 10 + [ ' Piece of Heart ' ] * 24 )
easyfirst15extra = [ ' Piece of Heart ' ] * 12 + [ ' Rupees (300) ' ] * 3
easysecond15extra = [ ' Rupees (100) ' ] + [ ' Arrows (10) ' ] * 7 + [ ' Bombs (3) ' ] * 7
easythird10extra = [ ' Bombs (3) ' ] * 7 + [ ' Rupee (1) ' , ' Rupees (50) ' , ' Bombs (10) ' ]
easyfourth5extra = [ ' Rupees (50) ' ] * 2 + [ ' Bombs (3) ' ] * 2 + [ ' Arrows (10) ' ]
2020-08-01 04:22:59 +00:00
easyfinal25extra = [ ' Rupees (50) ' ] * 4 + [ ' Rupees (20) ' ] * 14 + [ ' Rupee (1) ' ] + [ ' Arrows (10) ' ] * 4 + [ ' Rupees (5) ' ] * 2
2017-11-12 02:22:44 +00:00
2019-08-10 23:37:26 +00:00
normalbaseitems = ( [ ' Magic Upgrade (1/2) ' , ' Single Arrow ' , ' Sanctuary Heart Container ' , ' Arrows (10) ' , ' Bombs (10) ' ] +
2018-03-14 18:30:11 +00:00
[ ' Rupees (300) ' ] * 4 + [ ' Boss Heart Container ' ] * 10 + [ ' Piece of Heart ' ] * 24 )
2018-09-23 02:51:54 +00:00
normalfirst15extra = [ ' Rupees (100) ' , ' Rupees (300) ' , ' Rupees (50) ' ] + [ ' Arrows (10) ' ] * 6 + [ ' Bombs (3) ' ] * 6
2019-08-10 19:30:14 +00:00
normalsecond15extra = [ ' Bombs (3) ' ] * 10 + [ ' Rupees (50) ' ] * 2 + [ ' Arrows (10) ' ] * 2 + [ ' Rupee (1) ' ]
2017-11-10 10:15:45 +00:00
normalthird10extra = [ ' Rupees (50) ' ] * 4 + [ ' Rupees (20) ' ] * 3 + [ ' Arrows (10) ' , ' Rupee (1) ' , ' Rupees (5) ' ]
normalfourth5extra = [ ' Arrows (10) ' ] * 2 + [ ' Rupees (20) ' ] * 2 + [ ' Rupees (5) ' ]
normalfinal25extra = [ ' Rupees (20) ' ] * 23 + [ ' Rupees (5) ' ] * 2
2017-11-18 23:21:31 +00:00
Difficulty = namedtuple ( ' Difficulty ' ,
2017-12-17 05:25:46 +00:00
[ ' baseitems ' , ' bottles ' , ' bottle_count ' , ' same_bottle ' , ' progressiveshield ' ,
' basicshield ' , ' progressivearmor ' , ' basicarmor ' , ' swordless ' ,
2020-06-30 21:07:44 +00:00
' progressivesword ' , ' basicsword ' , ' progressivebow ' , ' basicbow ' , ' timedohko ' , ' timedother ' ,
2020-06-07 13:22:24 +00:00
' triforcehunt ' , ' retro ' ,
2018-01-04 06:06:22 +00:00
' extras ' , ' progressive_sword_limit ' , ' progressive_shield_limit ' ,
2019-12-11 10:41:05 +00:00
' progressive_armor_limit ' , ' progressive_bottle_limit ' ,
2019-08-10 23:37:26 +00:00
' progressive_bow_limit ' , ' heart_piece_limit ' , ' boss_heart_container_limit ' ] )
2017-11-18 23:21:31 +00:00
2017-12-17 05:25:46 +00:00
total_items_to_place = 153
2017-11-18 23:21:31 +00:00
2017-12-17 05:25:46 +00:00
difficulties = {
2020-08-01 04:22:59 +00:00
' easy ' : Difficulty (
baseitems = easybaseitems ,
bottles = normalbottles ,
bottle_count = 8 ,
same_bottle = False ,
progressiveshield = [ ' Progressive Shield ' ] * 6 ,
basicshield = [ ' Blue Shield ' , ' Red Shield ' , ' Mirror Shield ' ] * 2 ,
progressivearmor = [ ' Progressive Armor ' ] * 4 ,
basicarmor = [ ' Blue Mail ' , ' Red Mail ' ] * 2 ,
swordless = [ ' Rupees (20) ' ] * 8 ,
progressivesword = [ ' Progressive Sword ' ] * 8 ,
basicsword = [ ' Master Sword ' , ' Tempered Sword ' , ' Golden Sword ' , ' Fighter Sword ' ] * 2 ,
progressivebow = [ " Progressive Bow " ] * 2 ,
basicbow = [ ' Bow ' , ' Silver Bow ' ] * 2 ,
timedohko = [ ' Green Clock ' ] * 25 ,
2020-08-01 14:49:46 +00:00
timedother = [ ' Green Clock ' ] * 20 + [ ' Blue Clock ' ] * 10 + [ ' Red Clock ' ] * 10 ,
2020-08-01 04:22:59 +00:00
triforcehunt = [ ' Triforce Piece ' ] * 30 ,
2020-08-01 14:49:46 +00:00
retro = [ ' Small Key (Universal) ' ] * 28 ,
extras = [ easyfirst15extra , easysecond15extra , easythird10extra , easyfourth5extra , easyfinal25extra ] ,
2020-08-01 04:22:59 +00:00
progressive_sword_limit = 8 ,
progressive_shield_limit = 6 ,
2020-08-01 14:49:46 +00:00
progressive_armor_limit = 4 ,
2020-08-01 04:22:59 +00:00
progressive_bow_limit = 4 ,
progressive_bottle_limit = 8 ,
boss_heart_container_limit = 10 ,
2020-08-01 14:49:46 +00:00
heart_piece_limit = 36 ,
2020-08-01 04:22:59 +00:00
) ,
2017-11-18 23:21:31 +00:00
' normal ' : Difficulty (
2020-08-01 04:22:59 +00:00
baseitems = normalbaseitems ,
2020-06-30 21:07:44 +00:00
bottles = normalbottles ,
bottle_count = 4 ,
same_bottle = False ,
progressiveshield = [ ' Progressive Shield ' ] * 3 ,
basicshield = [ ' Blue Shield ' , ' Red Shield ' , ' Mirror Shield ' ] ,
progressivearmor = [ ' Progressive Armor ' ] * 2 ,
basicarmor = [ ' Blue Mail ' , ' Red Mail ' ] ,
swordless = [ ' Rupees (20) ' ] * 4 ,
progressivesword = [ ' Progressive Sword ' ] * 4 ,
basicsword = [ ' Fighter Sword ' , ' Master Sword ' , ' Tempered Sword ' , ' Golden Sword ' ] ,
progressivebow = [ " Progressive Bow " ] * 2 ,
basicbow = [ ' Bow ' , ' Silver Bow ' ] ,
timedohko = [ ' Green Clock ' ] * 25 ,
timedother = [ ' Green Clock ' ] * 20 + [ ' Blue Clock ' ] * 10 + [ ' Red Clock ' ] * 10 ,
triforcehunt = [ ' Triforce Piece ' ] * 30 ,
retro = [ ' Small Key (Universal) ' ] * 18 + [ ' Rupees (20) ' ] * 10 ,
extras = [ normalfirst15extra , normalsecond15extra , normalthird10extra , normalfourth5extra , normalfinal25extra ] ,
progressive_sword_limit = 4 ,
progressive_shield_limit = 3 ,
progressive_armor_limit = 2 ,
progressive_bow_limit = 2 ,
2018-01-04 06:06:22 +00:00
progressive_bottle_limit = 4 ,
2020-06-18 15:49:54 +00:00
boss_heart_container_limit = 10 ,
heart_piece_limit = 24 ,
2017-11-18 23:21:31 +00:00
) ,
' hard ' : Difficulty (
2019-08-10 19:30:14 +00:00
baseitems = normalbaseitems ,
2020-06-30 21:07:44 +00:00
bottles = hardbottles ,
bottle_count = 4 ,
same_bottle = False ,
progressiveshield = [ ' Progressive Shield ' ] * 3 ,
basicshield = [ ' Blue Shield ' , ' Red Shield ' , ' Red Shield ' ] ,
progressivearmor = [ ' Progressive Armor ' ] * 2 ,
basicarmor = [ ' Progressive Armor ' ] * 2 , # neither will count
swordless = [ ' Rupees (20) ' ] * 4 ,
progressivesword = [ ' Progressive Sword ' ] * 4 ,
basicsword = [ ' Fighter Sword ' , ' Master Sword ' , ' Master Sword ' , ' Tempered Sword ' ] ,
progressivebow = [ " Progressive Bow " ] * 2 ,
basicbow = [ ' Bow ' ] * 2 ,
timedohko = [ ' Green Clock ' ] * 25 ,
timedother = [ ' Green Clock ' ] * 20 + [ ' Blue Clock ' ] * 10 + [ ' Red Clock ' ] * 10 ,
triforcehunt = [ ' Triforce Piece ' ] * 30 ,
retro = [ ' Small Key (Universal) ' ] * 12 + [ ' Rupees (5) ' ] * 16 ,
extras = [ normalfirst15extra , normalsecond15extra , normalthird10extra , normalfourth5extra , normalfinal25extra ] ,
progressive_sword_limit = 3 ,
progressive_shield_limit = 2 ,
progressive_armor_limit = 0 ,
progressive_bow_limit = 1 ,
2018-03-14 18:30:11 +00:00
progressive_bottle_limit = 4 ,
2019-08-10 23:37:26 +00:00
boss_heart_container_limit = 6 ,
heart_piece_limit = 16 ,
2017-11-18 23:21:31 +00:00
) ,
' expert ' : Difficulty (
2019-08-10 19:30:14 +00:00
baseitems = normalbaseitems ,
2020-06-30 21:07:44 +00:00
bottles = hardbottles ,
bottle_count = 4 ,
same_bottle = False ,
progressiveshield = [ ' Progressive Shield ' ] * 3 ,
basicshield = [ ' Progressive Shield ' ] * 3 ,
# only the first one will upgrade, making this equivalent to two blue shields
progressivearmor = [ ' Progressive Armor ' ] * 2 , # neither will count
basicarmor = [ ' Progressive Armor ' ] * 2 , # neither will count
swordless = [ ' Rupees (20) ' ] * 4 ,
progressivesword = [ ' Progressive Sword ' ] * 4 ,
basicsword = [ ' Fighter Sword ' , ' Fighter Sword ' , ' Master Sword ' , ' Master Sword ' ] ,
progressivebow = [ " Progressive Bow " ] * 2 ,
basicbow = [ ' Bow ' ] * 2 ,
timedohko = [ ' Green Clock ' ] * 20 + [ ' Red Clock ' ] * 5 ,
timedother = [ ' Green Clock ' ] * 20 + [ ' Blue Clock ' ] * 10 + [ ' Red Clock ' ] * 10 ,
triforcehunt = [ ' Triforce Piece ' ] * 30 ,
retro = [ ' Small Key (Universal) ' ] * 12 + [ ' Rupees (5) ' ] * 16 ,
extras = [ normalfirst15extra , normalsecond15extra , normalthird10extra , normalfourth5extra , normalfinal25extra ] ,
progressive_sword_limit = 2 ,
progressive_shield_limit = 1 ,
progressive_armor_limit = 0 ,
progressive_bow_limit = 1 ,
2020-08-01 14:49:46 +00:00
progressive_bottle_limit = 4 ,
boss_heart_container_limit = 2 ,
heart_piece_limit = 8 ,
2017-11-18 23:21:31 +00:00
) ,
}
2017-11-10 10:15:45 +00:00
2020-08-01 14:49:46 +00:00
def generate_itempool ( world , player : int ) :
2020-08-01 04:22:59 +00:00
if world . difficulty [ player ] not in difficulties :
2020-06-03 00:19:16 +00:00
raise NotImplementedError ( f " Diffulty { world . difficulty [ player ] } " )
2020-08-01 04:22:59 +00:00
if world . goal [ player ] not in { ' ganon ' , ' pedestal ' , ' dungeons ' , ' triforcehunt ' , ' localtriforcehunt ' ,
' ganontriforcehunt ' , ' localganontriforcehunt ' , ' crystals ' } :
2020-06-03 00:19:16 +00:00
raise NotImplementedError ( f " Goal { world . goal [ player ] } " )
if world . mode [ player ] not in { ' open ' , ' standard ' , ' inverted ' } :
raise NotImplementedError ( f " Mode { world . mode [ player ] } " )
if world . timer [ player ] not in { False , ' display ' , ' timed ' , ' timed-ohko ' , ' ohko ' , ' timed-countdown ' } :
raise NotImplementedError ( f " Timer { world . mode [ player ] } " )
2020-02-03 01:10:56 +00:00
if world . timer [ player ] in [ ' ohko ' , ' timed-ohko ' ] :
2020-02-04 10:13:42 +00:00
world . can_take_damage [ player ] = False
2020-06-03 00:19:16 +00:00
if world . goal [ player ] in [ ' pedestal ' , ' triforcehunt ' , ' localtriforcehunt ' ] :
2019-08-04 21:40:13 +00:00
world . push_item ( world . get_location ( ' Ganon ' , player ) , ItemFactory ( ' Nothing ' , player ) , False )
else :
world . push_item ( world . get_location ( ' Ganon ' , player ) , ItemFactory ( ' Triforce ' , player ) , False )
2019-12-11 10:41:05 +00:00
2020-06-03 00:19:16 +00:00
if world . goal [ player ] in [ ' triforcehunt ' , ' localtriforcehunt ' ] :
region = world . get_region ( ' Light World ' , player )
2019-08-29 01:12:44 +00:00
loc = Location ( player , " Murahdahla " , parent = region )
2020-06-26 14:18:53 +00:00
loc . access_rule = lambda state : state . has_triforce_pieces ( state . world . treasure_hunt_count [ player ] , player )
2019-08-29 01:12:44 +00:00
region . locations . append ( loc )
world . dynamic_locations . append ( loc )
world . clear_location_cache ( )
world . push_item ( loc , ItemFactory ( ' Triforce ' , player ) , False )
loc . event = True
loc . locked = True
2019-12-11 10:41:05 +00:00
2019-04-18 09:23:24 +00:00
world . get_location ( ' Ganon ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Ganon ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Agahnim 1 ' , player ) , ItemFactory ( ' Beat Agahnim 1 ' , player ) , False )
world . get_location ( ' Agahnim 1 ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Agahnim 1 ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Agahnim 2 ' , player ) , ItemFactory ( ' Beat Agahnim 2 ' , player ) , False )
world . get_location ( ' Agahnim 2 ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Agahnim 2 ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Dark Blacksmith Ruins ' , player ) , ItemFactory ( ' Pick Up Purple Chest ' , player ) , False )
world . get_location ( ' Dark Blacksmith Ruins ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Dark Blacksmith Ruins ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Frog ' , player ) , ItemFactory ( ' Get Frog ' , player ) , False )
world . get_location ( ' Frog ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Frog ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Missing Smith ' , player ) , ItemFactory ( ' Return Smith ' , player ) , False )
world . get_location ( ' Missing Smith ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Missing Smith ' , player ) . locked = True
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( ' Floodgate ' , player ) , ItemFactory ( ' Open Floodgate ' , player ) , False )
world . get_location ( ' Floodgate ' , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( ' Floodgate ' , player ) . locked = True
2017-11-10 10:15:45 +00:00
# set up item pool
2018-01-22 02:43:44 +00:00
if world . custom :
2020-08-01 04:26:30 +00:00
( pool , placed_items , precollected_items , clock_mode , treasure_hunt_count ,
treasure_hunt_icon ) = make_custom_item_pool ( world , player )
2019-10-24 02:31:02 +00:00
world . rupoor_cost = min ( world . customitemarray [ 69 ] , 9999 )
2018-01-22 02:43:44 +00:00
else :
2020-08-01 04:26:30 +00:00
( pool , placed_items , precollected_items , clock_mode , treasure_hunt_count , treasure_hunt_icon ) = get_pool_core (
world , player )
2019-12-11 10:41:05 +00:00
2019-08-10 19:30:14 +00:00
for item in precollected_items :
world . push_precollected ( ItemFactory ( item , player ) )
2019-12-11 10:41:05 +00:00
2020-04-20 17:17:10 +00:00
if world . mode [ player ] == ' standard ' and not world . state . has_melee_weapon ( player ) :
2019-12-30 05:42:45 +00:00
if " Link ' s Uncle " not in placed_items :
found_sword = False
found_bow = False
possible_weapons = [ ]
for item in pool :
if item in [ ' Progressive Sword ' , ' Fighter Sword ' , ' Master Sword ' , ' Tempered Sword ' , ' Golden Sword ' ] :
if not found_sword and world . swords [ player ] != ' swordless ' :
found_sword = True
possible_weapons . append ( item )
if item in [ ' Progressive Bow ' , ' Bow ' ] and not found_bow :
found_bow = True
2019-12-11 10:41:05 +00:00
possible_weapons . append ( item )
2019-12-30 05:42:45 +00:00
if item in [ ' Hammer ' , ' Bombs (10) ' , ' Fire Rod ' , ' Cane of Somaria ' , ' Cane of Byrna ' ] :
if item not in possible_weapons :
possible_weapons . append ( item )
2020-07-14 05:01:51 +00:00
starting_weapon = world . random . choice ( possible_weapons )
2019-12-30 05:42:45 +00:00
placed_items [ " Link ' s Uncle " ] = starting_weapon
pool . remove ( starting_weapon )
if placed_items [ " Link ' s Uncle " ] in [ ' Bow ' , ' Progressive Bow ' , ' Bombs (10) ' , ' Cane of Somaria ' , ' Cane of Byrna ' ] and world . enemy_health [ player ] not in [ ' default ' , ' easy ' ] :
world . escape_assist [ player ] . append ( ' bombs ' )
2019-12-11 10:41:05 +00:00
2019-12-10 20:21:38 +00:00
for ( location , item ) in placed_items . items ( ) :
2019-04-18 09:23:24 +00:00
world . push_item ( world . get_location ( location , player ) , ItemFactory ( item , player ) , False )
world . get_location ( location , player ) . event = True
2019-08-04 16:32:35 +00:00
world . get_location ( location , player ) . locked = True
2019-12-11 10:41:05 +00:00
2019-12-30 19:28:33 +00:00
items = ItemFactory ( pool , player )
2019-12-11 10:41:05 +00:00
2017-11-18 23:21:31 +00:00
if clock_mode is not None :
2020-02-03 01:10:56 +00:00
world . clock_mode [ player ] = clock_mode
2019-12-11 10:41:05 +00:00
2017-11-18 23:21:31 +00:00
if treasure_hunt_count is not None :
2019-12-21 09:42:59 +00:00
world . treasure_hunt_count [ player ] = treasure_hunt_count
2017-11-18 23:21:31 +00:00
if treasure_hunt_icon is not None :
2019-12-21 09:42:59 +00:00
world . treasure_hunt_icon [ player ] = treasure_hunt_icon
2017-11-10 10:15:45 +00:00
2019-12-13 21:37:52 +00:00
world . itempool . extend ( [ item for item in get_dungeon_item_pool ( world ) if item . player == player
2019-12-16 20:46:47 +00:00
and ( ( item . smallkey and world . keyshuffle [ player ] )
or ( item . bigkey and world . bigkeyshuffle [ player ] )
or ( item . map and world . mapshuffle [ player ] )
or ( item . compass and world . compassshuffle [ player ] ) ) ] )
2018-01-03 01:01:16 +00:00
2018-01-06 18:39:22 +00:00
# logic has some branches where having 4 hearts is one possible requirement (of several alternatives)
# rather than making all hearts/heart pieces progression items (which slows down generation considerably)
2018-01-22 02:43:44 +00:00
# We mark one random heart container as an advancement item (or 4 heart pieces in expert mode)
2019-12-16 16:46:21 +00:00
if world . difficulty [ player ] in [ ' normal ' , ' hard ' ] and not ( world . custom and world . customitemarray [ 30 ] == 0 ) :
2019-12-30 19:28:33 +00:00
[ item for item in items if item . name == ' Boss Heart Container ' ] [ 0 ] . advancement = True
2019-12-16 16:46:21 +00:00
elif world . difficulty [ player ] in [ ' expert ' ] and not ( world . custom and world . customitemarray [ 29 ] < 4 ) :
2019-12-30 19:28:33 +00:00
adv_heart_pieces = [ item for item in items if item . name == ' Piece of Heart ' ] [ 0 : 4 ]
2018-01-06 18:39:22 +00:00
for hp in adv_heart_pieces :
hp . advancement = True
2019-12-30 19:28:33 +00:00
beeweights = { 0 : { None : 100 } ,
1 : { None : 75 , ' trap ' : 25 } ,
2 : { None : 40 , ' trap ' : 40 , ' bee ' : 20 } ,
3 : { ' trap ' : 50 , ' bee ' : 50 } ,
4 : { ' trap ' : 100 } }
def beemizer ( item ) :
if world . beemizer [ item . player ] and not item . advancement and not item . priority and not item . type :
2020-07-14 05:01:51 +00:00
choice = world . random . choices ( list ( beeweights [ world . beemizer [ item . player ] ] . keys ( ) ) ,
weights = list ( beeweights [ world . beemizer [ item . player ] ] . values ( ) ) ) [ 0 ]
2019-12-30 19:28:33 +00:00
return item if not choice else ItemFactory ( " Bee Trap " , player ) if choice == ' trap ' else ItemFactory ( " Bee " , player )
return item
2020-06-11 18:53:10 +00:00
progressionitems = [ item for item in items if item . advancement or item . priority or item . type ]
nonprogressionitems = [ beemizer ( item ) for item in items if not item . advancement and not item . priority and not item . type ]
2020-07-14 05:01:51 +00:00
world . random . shuffle ( nonprogressionitems )
2020-06-11 18:53:10 +00:00
2020-06-17 08:02:54 +00:00
triforce_pieces = world . triforce_pieces_available [ player ]
2020-06-26 14:18:53 +00:00
if ' triforcehunt ' in world . goal [ player ] and triforce_pieces > 30 :
2020-06-17 08:02:54 +00:00
progressionitems + = [ ItemFactory ( " Triforce Piece " , player ) ] * ( triforce_pieces - 30 )
2020-07-14 05:01:51 +00:00
nonprogressionitems = nonprogressionitems [ ( triforce_pieces - 30 ) : ]
2020-06-11 18:53:10 +00:00
world . itempool + = progressionitems + nonprogressionitems
2019-12-30 19:28:33 +00:00
2017-11-10 10:15:45 +00:00
# shuffle medallions
2020-07-14 05:01:51 +00:00
mm_medallion = [ ' Ether ' , ' Quake ' , ' Bombos ' ] [ world . random . randint ( 0 , 2 ) ]
tr_medallion = [ ' Ether ' , ' Quake ' , ' Bombos ' ] [ world . random . randint ( 0 , 2 ) ]
2019-04-18 09:23:24 +00:00
world . required_medallions [ player ] = ( mm_medallion , tr_medallion )
2017-11-10 10:15:45 +00:00
2019-04-18 09:23:24 +00:00
place_bosses ( world , player )
set_up_shops ( world , player )
2018-02-17 23:38:54 +00:00
2019-12-16 23:16:02 +00:00
if world . retro [ player ] :
2019-04-18 09:23:24 +00:00
set_up_take_anys ( world , player )
2018-03-23 03:18:40 +00:00
2019-04-18 09:23:24 +00:00
create_dynamic_shop_locations ( world , player )
2018-03-23 03:18:40 +00:00
take_any_locations = [
' Snitch Lady (East) ' , ' Snitch Lady (West) ' , ' Bush Covered House ' , ' Light World Bomb Hut ' ,
' Fortune Teller (Light) ' , ' Lake Hylia Fortune Teller ' , ' Lumberjack House ' , ' Bonk Fairy (Light) ' ,
' Bonk Fairy (Dark) ' , ' Lake Hylia Healer Fairy ' , ' Swamp Healer Fairy ' , ' Desert Healer Fairy ' ,
' Dark Lake Hylia Healer Fairy ' , ' Dark Lake Hylia Ledge Healer Fairy ' , ' Dark Desert Healer Fairy ' ,
' Dark Death Mountain Healer Fairy ' , ' Long Fairy Cave ' , ' Good Bee Cave ' , ' 20 Rupee Cave ' ,
2020-01-02 05:23:03 +00:00
' Kakariko Gamble Game ' , ' 50 Rupee Cave ' , ' Lost Woods Gamble ' , ' Hookshot Fairy ' ,
2018-03-23 03:18:40 +00:00
' Palace of Darkness Hint ' , ' East Dark World Hint ' , ' Archery Game ' , ' Dark Lake Hylia Ledge Hint ' ,
' Dark Lake Hylia Ledge Spike Cave ' , ' Fortune Teller (Dark) ' , ' Dark Sanctuary Hint ' , ' Dark Desert Hint ' ]
2019-04-18 09:23:24 +00:00
def set_up_take_anys ( world , player ) :
2019-12-16 15:54:46 +00:00
if world . mode [ player ] == ' inverted ' and ' Dark Sanctuary Hint ' in take_any_locations :
2019-09-11 16:25:46 +00:00
take_any_locations . remove ( ' Dark Sanctuary Hint ' )
2019-12-11 10:41:05 +00:00
2020-07-14 05:01:51 +00:00
regions = world . random . sample ( take_any_locations , 5 )
2018-03-23 03:18:40 +00:00
2019-04-18 09:23:24 +00:00
old_man_take_any = Region ( " Old Man Sword Cave " , RegionType . Cave , ' the sword cave ' , player )
2018-03-23 03:18:40 +00:00
world . regions . append ( old_man_take_any )
world . dynamic_regions . append ( old_man_take_any )
reg = regions . pop ( )
2019-04-18 09:23:24 +00:00
entrance = world . get_region ( reg , player ) . entrances [ 0 ]
2020-03-03 13:37:58 +00:00
connect_entrance ( world , entrance . name , old_man_take_any . name , player )
2018-03-23 03:18:40 +00:00
entrance . target = 0x58
2020-01-10 10:41:22 +00:00
old_man_take_any . shop = Shop ( old_man_take_any , 0x0112 , ShopType . TakeAny , 0xE2 , True , True )
2018-03-23 03:18:40 +00:00
world . shops . append ( old_man_take_any . shop )
2019-04-18 09:23:24 +00:00
swords = [ item for item in world . itempool if item . type == ' Sword ' and item . player == player ]
2018-03-23 03:18:40 +00:00
if swords :
2020-07-14 05:01:51 +00:00
sword = world . random . choice ( swords )
2018-03-23 03:18:40 +00:00
world . itempool . remove ( sword )
2019-04-18 09:23:24 +00:00
world . itempool . append ( ItemFactory ( ' Rupees (20) ' , player ) )
2018-03-26 23:32:19 +00:00
old_man_take_any . shop . add_inventory ( 0 , sword . name , 0 , 0 , create_location = True )
2018-03-23 03:18:40 +00:00
else :
2018-03-26 23:32:19 +00:00
old_man_take_any . shop . add_inventory ( 0 , ' Rupees (300) ' , 0 , 0 )
2018-03-23 03:18:40 +00:00
for num in range ( 4 ) :
2019-04-18 09:23:24 +00:00
take_any = Region ( " Take-Any # {} " . format ( num + 1 ) , RegionType . Cave , ' a cave of choice ' , player )
2018-03-23 03:18:40 +00:00
world . regions . append ( take_any )
world . dynamic_regions . append ( take_any )
2020-07-14 05:01:51 +00:00
target , room_id = world . random . choice ( [ ( 0x58 , 0x0112 ) , ( 0x60 , 0x010F ) , ( 0x46 , 0x011F ) ] )
2018-03-23 03:18:40 +00:00
reg = regions . pop ( )
2019-04-18 09:23:24 +00:00
entrance = world . get_region ( reg , player ) . entrances [ 0 ]
2020-03-03 13:37:58 +00:00
connect_entrance ( world , entrance . name , take_any . name , player )
2018-03-23 03:18:40 +00:00
entrance . target = target
2020-01-10 10:41:22 +00:00
take_any . shop = Shop ( take_any , room_id , ShopType . TakeAny , 0xE3 , True , True )
2018-03-23 03:18:40 +00:00
world . shops . append ( take_any . shop )
2018-03-26 23:32:19 +00:00
take_any . shop . add_inventory ( 0 , ' Blue Potion ' , 0 , 0 )
take_any . shop . add_inventory ( 1 , ' Boss Heart Container ' , 0 , 0 )
2018-03-23 03:18:40 +00:00
2019-12-14 18:19:08 +00:00
world . initialize_regions ( )
2018-03-23 03:18:40 +00:00
2019-04-18 09:23:24 +00:00
def create_dynamic_shop_locations ( world , player ) :
2018-03-23 03:18:40 +00:00
for shop in world . shops :
2019-04-18 09:23:24 +00:00
if shop . region . player == player :
for i , item in enumerate ( shop . inventory ) :
if item is None :
continue
if item [ ' create_location ' ] :
loc = Location ( player , " {} Item {} " . format ( shop . region . name , i + 1 ) , parent = shop . region )
shop . region . locations . append ( loc )
world . dynamic_locations . append ( loc )
2018-03-23 03:18:40 +00:00
2019-04-18 09:23:24 +00:00
world . clear_location_cache ( )
2018-03-23 03:18:40 +00:00
2019-04-18 09:23:24 +00:00
world . push_item ( loc , ItemFactory ( item [ ' item ' ] , player ) , False )
loc . event = True
2019-08-04 16:32:35 +00:00
loc . locked = True
2018-03-23 03:18:40 +00:00
2018-01-27 21:21:32 +00:00
def fill_prizes ( world , attempts = 15 ) :
2019-04-18 09:23:24 +00:00
all_state = world . get_all_state ( keys = True )
for player in range ( 1 , world . players + 1 ) :
crystals = ItemFactory ( [ ' Red Pendant ' , ' Blue Pendant ' , ' Green Pendant ' , ' Crystal 1 ' , ' Crystal 2 ' , ' Crystal 3 ' , ' Crystal 4 ' , ' Crystal 7 ' , ' Crystal 5 ' , ' Crystal 6 ' ] , player )
crystal_locations = [ world . get_location ( ' Turtle Rock - Prize ' , player ) , world . get_location ( ' Eastern Palace - Prize ' , player ) , world . get_location ( ' Desert Palace - Prize ' , player ) , world . get_location ( ' Tower of Hera - Prize ' , player ) , world . get_location ( ' Palace of Darkness - Prize ' , player ) ,
world . get_location ( ' Thieves \' Town - Prize ' , player ) , world . get_location ( ' Skull Woods - Prize ' , player ) , world . get_location ( ' Swamp Palace - Prize ' , player ) , world . get_location ( ' Ice Palace - Prize ' , player ) ,
world . get_location ( ' Misery Mire - Prize ' , player ) ]
placed_prizes = [ loc . item . name for loc in crystal_locations if loc . item is not None ]
unplaced_prizes = [ crystal for crystal in crystals if crystal . name not in placed_prizes ]
empty_crystal_locations = [ loc for loc in crystal_locations if loc . item is None ]
for attempt in range ( attempts ) :
try :
prizepool = list ( unplaced_prizes )
prize_locs = list ( empty_crystal_locations )
2020-07-14 05:01:51 +00:00
world . random . shuffle ( prizepool )
world . random . shuffle ( prize_locs )
2019-12-11 10:37:05 +00:00
fill_restrictive ( world , all_state , prize_locs , prizepool , True )
2019-04-18 09:23:24 +00:00
except FillError as e :
2020-04-14 16:57:39 +00:00
logging . getLogger ( ' ' ) . exception ( " Failed to place dungeon prizes ( %s ). Will retry %s more times " , e ,
2020-04-25 00:24:37 +00:00
attempts - attempt )
2019-04-18 09:23:24 +00:00
for location in empty_crystal_locations :
location . item = None
continue
break
else :
raise FillError ( ' Unable to place dungeon prizes ' )
2018-01-27 21:21:32 +00:00
2017-11-10 10:15:45 +00:00
2019-04-18 09:23:24 +00:00
def set_up_shops ( world , player ) :
2018-02-17 23:38:54 +00:00
# TODO: move hard+ mode changes for sheilds here, utilizing the new shops
2019-12-16 23:16:02 +00:00
if world . retro [ player ] :
2019-04-18 09:23:24 +00:00
rss = world . get_region ( ' Red Shield Shop ' , player ) . shop
2020-01-10 10:41:22 +00:00
if not rss . locked :
rss . add_inventory ( 2 , ' Single Arrow ' , 80 )
2020-07-14 05:01:51 +00:00
for shop in world . random . sample ( [ s for s in world . shops if
s . custom and not s . locked and s . type == ShopType . Shop and s . region . player == player ] ,
5 ) :
2020-01-10 10:41:22 +00:00
shop . locked = True
2018-02-17 23:38:54 +00:00
shop . add_inventory ( 0 , ' Single Arrow ' , 80 )
shop . add_inventory ( 1 , ' Small Key (Universal) ' , 100 )
2018-03-24 03:01:55 +00:00
shop . add_inventory ( 2 , ' Bombs (10) ' , 50 )
2020-01-10 10:41:22 +00:00
rss . locked = True
2017-11-10 10:15:45 +00:00
2017-11-18 23:21:31 +00:00
2020-04-16 09:02:16 +00:00
def get_pool_core ( world , player : int ) :
progressive = world . progressive [ player ]
shuffle = world . shuffle [ player ]
difficulty = world . difficulty [ player ]
timer = world . timer [ player ]
goal = world . goal [ player ]
mode = world . mode [ player ]
swords = world . swords [ player ]
retro = world . retro [ player ]
logic = world . logic [ player ]
2017-12-17 05:25:46 +00:00
pool = [ ]
2019-12-10 20:21:38 +00:00
placed_items = { }
2019-08-10 19:30:14 +00:00
precollected_items = [ ]
2017-12-17 05:25:46 +00:00
clock_mode = None
treasure_hunt_count = None
treasure_hunt_icon = None
2017-11-18 23:21:31 +00:00
pool . extend ( alwaysitems )
2019-12-10 20:21:38 +00:00
def place_item ( loc , item ) :
assert loc not in placed_items
placed_items [ loc ] = item
2017-12-17 05:25:46 +00:00
def want_progressives ( ) :
2020-07-14 05:01:51 +00:00
return world . random . choice ( [ True , False ] ) if progressive == ' random ' else progressive == ' on '
2017-11-18 23:21:31 +00:00
2020-01-03 05:09:21 +00:00
# provide boots to major glitch dependent seeds
2020-04-16 09:02:16 +00:00
if logic in { ' owglitches ' , ' nologic ' } and world . glitch_boots [ player ] :
2020-01-03 05:09:21 +00:00
precollected_items . append ( ' Pegasus Boots ' )
pool . remove ( ' Pegasus Boots ' )
2020-08-01 14:49:46 +00:00
pool . append ( ' Rupees (20) ' )
2020-01-03 05:09:21 +00:00
2017-12-17 05:25:46 +00:00
if want_progressives ( ) :
2017-11-18 23:21:31 +00:00
pool . extend ( progressivegloves )
else :
pool . extend ( basicgloves )
2020-08-01 14:49:46 +00:00
# insanity legacy shuffle doesn't have fake LW/DW logic so for now guaranteed Mirror and Moon Pearl at the start
2020-03-04 12:55:03 +00:00
if shuffle == ' insanity_legacy ' :
2019-12-10 20:21:38 +00:00
place_item ( ' Link \' s House ' , ' Magic Mirror ' )
place_item ( ' Sanctuary ' , ' Moon Pearl ' )
2017-11-18 23:21:31 +00:00
else :
pool . extend ( [ ' Magic Mirror ' , ' Moon Pearl ' ] )
if timer == ' display ' :
clock_mode = ' stopwatch '
2017-11-19 01:36:42 +00:00
elif timer == ' ohko ' :
clock_mode = ' ohko '
2017-11-18 23:21:31 +00:00
diff = difficulties [ difficulty ]
pool . extend ( diff . baseitems )
# expert+ difficulties produce the same contents for
# all bottles, since only one bottle is available
if diff . same_bottle :
2020-07-14 05:01:51 +00:00
thisbottle = world . random . choice ( diff . bottles )
2017-12-17 05:25:46 +00:00
for _ in range ( diff . bottle_count ) :
2017-11-18 23:21:31 +00:00
if not diff . same_bottle :
2020-07-14 05:01:51 +00:00
thisbottle = world . random . choice ( diff . bottles )
2017-11-18 23:21:31 +00:00
pool . append ( thisbottle )
2017-12-17 05:25:46 +00:00
if want_progressives ( ) :
2017-11-18 23:21:31 +00:00
pool . extend ( diff . progressiveshield )
else :
pool . extend ( diff . basicshield )
2017-12-17 05:25:46 +00:00
if want_progressives ( ) :
2017-11-18 23:21:31 +00:00
pool . extend ( diff . progressivearmor )
else :
pool . extend ( diff . basicarmor )
2020-01-06 18:13:42 +00:00
if want_progressives ( ) :
2020-06-30 21:07:44 +00:00
pool . extend ( diff . progressivebow )
2020-01-06 18:13:42 +00:00
elif swords != ' swordless ' :
pool . extend ( diff . basicbow )
else :
2020-08-01 14:49:46 +00:00
swordless_bows = [ ' Bow ' , ' Silver Bow ' ]
if difficulty == " easy " :
swordless_bows * = 2
pool . extend ( swordless_bows )
2019-08-10 23:37:26 +00:00
2019-08-04 16:32:35 +00:00
if swords == ' swordless ' :
2017-11-18 23:21:31 +00:00
pool . extend ( diff . swordless )
2019-08-10 19:30:14 +00:00
elif swords == ' vanilla ' :
2020-01-06 18:13:42 +00:00
swords_to_use = diff . progressivesword . copy ( ) if want_progressives ( ) else diff . basicsword . copy ( )
2020-07-14 05:01:51 +00:00
world . random . shuffle ( swords_to_use )
2019-08-10 19:30:14 +00:00
2019-12-10 20:21:38 +00:00
place_item ( ' Link \' s Uncle ' , swords_to_use . pop ( ) )
place_item ( ' Blacksmith ' , swords_to_use . pop ( ) )
place_item ( ' Pyramid Fairy - Left ' , swords_to_use . pop ( ) )
2019-08-10 19:30:14 +00:00
if goal != ' pedestal ' :
2019-12-10 20:21:38 +00:00
place_item ( ' Master Sword Pedestal ' , swords_to_use . pop ( ) )
2019-08-10 19:30:14 +00:00
else :
2019-12-10 20:21:38 +00:00
place_item ( ' Master Sword Pedestal ' , ' Triforce ' )
2017-11-18 23:21:31 +00:00
else :
2020-01-23 23:06:00 +00:00
progressive_swords = want_progressives ( )
pool . extend ( diff . progressivesword if progressive_swords else diff . basicsword )
2020-01-06 18:13:42 +00:00
if swords == ' assured ' :
2020-01-23 23:06:00 +00:00
if progressive_swords :
2020-01-06 18:13:42 +00:00
precollected_items . append ( ' Progressive Sword ' )
pool . remove ( ' Progressive Sword ' )
else :
precollected_items . append ( ' Fighter Sword ' )
pool . remove ( ' Fighter Sword ' )
pool . extend ( [ ' Rupees (50) ' ] )
2017-11-18 23:21:31 +00:00
2017-12-17 05:25:46 +00:00
extraitems = total_items_to_place - len ( pool ) - len ( placed_items )
2017-11-18 23:21:31 +00:00
if timer in [ ' timed ' , ' timed-countdown ' ] :
pool . extend ( diff . timedother )
extraitems - = len ( diff . timedother )
clock_mode = ' stopwatch ' if timer == ' timed ' else ' countdown '
elif timer == ' timed-ohko ' :
pool . extend ( diff . timedohko )
extraitems - = len ( diff . timedohko )
2017-11-19 01:36:42 +00:00
clock_mode = ' countdown-ohko '
2020-06-26 14:18:53 +00:00
if ' triforcehunt ' in goal :
2020-06-17 08:02:54 +00:00
while len ( diff . triforcehunt ) > world . triforce_pieces_available [ player ] :
diff . triforcehunt . pop ( )
2017-11-18 23:21:31 +00:00
pool . extend ( diff . triforcehunt )
extraitems - = len ( diff . triforcehunt )
2020-06-07 13:22:24 +00:00
treasure_hunt_count = world . triforce_pieces_required [ player ]
2017-11-18 23:21:31 +00:00
treasure_hunt_icon = ' Triforce Piece '
for extra in diff . extras :
2020-08-01 14:49:46 +00:00
if extraitems > = len ( extra ) :
2017-12-17 05:25:46 +00:00
pool . extend ( extra )
2017-11-18 23:21:31 +00:00
extraitems - = len ( extra )
2020-08-01 14:49:46 +00:00
elif extraitems > 0 :
pool . extend ( world . random . sample ( extra , extraitems ) )
break
2017-11-18 23:21:31 +00:00
2019-08-10 19:30:14 +00:00
if goal == ' pedestal ' and swords != ' vanilla ' :
2019-12-10 20:21:38 +00:00
place_item ( ' Master Sword Pedestal ' , ' Triforce ' )
2020-08-01 14:49:46 +00:00
pool . remove ( " Rupees (20) " )
2018-03-15 21:23:02 +00:00
if retro :
2020-08-01 14:49:46 +00:00
pool = [ item . replace ( ' Single Arrow ' , ' Rupees (5) ' ) for item in pool ]
pool = [ item . replace ( ' Arrows (10) ' , ' Rupees (5) ' ) for item in pool ]
pool = [ item . replace ( ' Arrow Upgrade (+5) ' , ' Rupees (5) ' ) for item in pool ]
pool = [ item . replace ( ' Arrow Upgrade (+10) ' , ' Rupees (5) ' ) for item in pool ]
2018-03-15 21:23:02 +00:00
pool . extend ( diff . retro )
2018-03-16 17:26:14 +00:00
if mode == ' standard ' :
2020-07-14 05:01:51 +00:00
key_location = world . random . choice (
[ ' Secret Passage ' , ' Hyrule Castle - Boomerang Chest ' , ' Hyrule Castle - Map Chest ' ,
' Hyrule Castle - Zelda \' s Chest ' , ' Sewers - Dark Cross ' ] )
2019-12-10 20:21:38 +00:00
place_item ( key_location , ' Small Key (Universal) ' )
2018-03-16 17:26:14 +00:00
else :
pool . extend ( [ ' Small Key (Universal) ' ] )
2020-08-01 04:26:30 +00:00
return ( pool , placed_items , precollected_items , clock_mode , treasure_hunt_count , treasure_hunt_icon )
2017-11-18 23:21:31 +00:00
2020-07-14 05:01:51 +00:00
def make_custom_item_pool ( world , player ) :
shuffle = world . shuffle [ player ]
difficulty = world . difficulty [ player ]
timer = world . timer [ player ]
goal = world . goal [ player ]
mode = world . mode [ player ]
retro = world . retro [ player ]
customitemarray = world . customitemarray [ player ]
2018-01-22 02:43:44 +00:00
pool = [ ]
2019-12-10 20:21:38 +00:00
placed_items = { }
2019-08-10 19:30:14 +00:00
precollected_items = [ ]
2018-01-22 02:43:44 +00:00
clock_mode = None
treasure_hunt_count = None
treasure_hunt_icon = None
2019-12-10 20:21:38 +00:00
def place_item ( loc , item ) :
assert loc not in placed_items
placed_items [ loc ] = item
2018-01-22 02:43:44 +00:00
# Correct for insanely oversized item counts and take initial steps to handle undersized pools.
2019-10-24 02:31:02 +00:00
for x in range ( 0 , 66 ) :
2018-01-22 02:43:44 +00:00
if customitemarray [ x ] > total_items_to_place :
customitemarray [ x ] = total_items_to_place
2019-10-24 02:31:02 +00:00
if customitemarray [ 68 ] > total_items_to_place :
customitemarray [ 68 ] = total_items_to_place
2018-01-22 02:43:44 +00:00
itemtotal = 0
2019-10-24 02:31:02 +00:00
for x in range ( 0 , 66 ) :
2018-01-22 02:43:44 +00:00
itemtotal = itemtotal + customitemarray [ x ]
2018-03-15 21:53:42 +00:00
itemtotal = itemtotal + customitemarray [ 68 ]
2019-10-24 02:31:02 +00:00
itemtotal = itemtotal + customitemarray [ 70 ]
2018-01-22 02:43:44 +00:00
pool . extend ( [ ' Bow ' ] * customitemarray [ 0 ] )
2020-06-30 07:51:11 +00:00
pool . extend ( [ ' Silver Bow ' ] * customitemarray [ 1 ] )
2018-01-22 02:43:44 +00:00
pool . extend ( [ ' Blue Boomerang ' ] * customitemarray [ 2 ] )
pool . extend ( [ ' Red Boomerang ' ] * customitemarray [ 3 ] )
pool . extend ( [ ' Hookshot ' ] * customitemarray [ 4 ] )
pool . extend ( [ ' Mushroom ' ] * customitemarray [ 5 ] )
pool . extend ( [ ' Magic Powder ' ] * customitemarray [ 6 ] )
pool . extend ( [ ' Fire Rod ' ] * customitemarray [ 7 ] )
pool . extend ( [ ' Ice Rod ' ] * customitemarray [ 8 ] )
pool . extend ( [ ' Bombos ' ] * customitemarray [ 9 ] )
pool . extend ( [ ' Ether ' ] * customitemarray [ 10 ] )
pool . extend ( [ ' Quake ' ] * customitemarray [ 11 ] )
pool . extend ( [ ' Lamp ' ] * customitemarray [ 12 ] )
pool . extend ( [ ' Hammer ' ] * customitemarray [ 13 ] )
pool . extend ( [ ' Shovel ' ] * customitemarray [ 14 ] )
2020-02-17 09:08:03 +00:00
pool . extend ( [ ' Flute ' ] * customitemarray [ 15 ] )
2018-01-22 02:43:44 +00:00
pool . extend ( [ ' Bug Catching Net ' ] * customitemarray [ 16 ] )
pool . extend ( [ ' Book of Mudora ' ] * customitemarray [ 17 ] )
pool . extend ( [ ' Cane of Somaria ' ] * customitemarray [ 19 ] )
pool . extend ( [ ' Cane of Byrna ' ] * customitemarray [ 20 ] )
pool . extend ( [ ' Cape ' ] * customitemarray [ 21 ] )
pool . extend ( [ ' Pegasus Boots ' ] * customitemarray [ 23 ] )
pool . extend ( [ ' Power Glove ' ] * customitemarray [ 24 ] )
pool . extend ( [ ' Titans Mitts ' ] * customitemarray [ 25 ] )
pool . extend ( [ ' Progressive Glove ' ] * customitemarray [ 26 ] )
pool . extend ( [ ' Flippers ' ] * customitemarray [ 27 ] )
pool . extend ( [ ' Piece of Heart ' ] * customitemarray [ 29 ] )
pool . extend ( [ ' Boss Heart Container ' ] * customitemarray [ 30 ] )
pool . extend ( [ ' Sanctuary Heart Container ' ] * customitemarray [ 31 ] )
pool . extend ( [ ' Master Sword ' ] * customitemarray [ 33 ] )
pool . extend ( [ ' Tempered Sword ' ] * customitemarray [ 34 ] )
pool . extend ( [ ' Golden Sword ' ] * customitemarray [ 35 ] )
pool . extend ( [ ' Blue Shield ' ] * customitemarray [ 37 ] )
pool . extend ( [ ' Red Shield ' ] * customitemarray [ 38 ] )
pool . extend ( [ ' Mirror Shield ' ] * customitemarray [ 39 ] )
pool . extend ( [ ' Progressive Shield ' ] * customitemarray [ 40 ] )
pool . extend ( [ ' Blue Mail ' ] * customitemarray [ 41 ] )
pool . extend ( [ ' Red Mail ' ] * customitemarray [ 42 ] )
pool . extend ( [ ' Progressive Armor ' ] * customitemarray [ 43 ] )
pool . extend ( [ ' Magic Upgrade (1/2) ' ] * customitemarray [ 44 ] )
pool . extend ( [ ' Magic Upgrade (1/4) ' ] * customitemarray [ 45 ] )
pool . extend ( [ ' Bomb Upgrade (+5) ' ] * customitemarray [ 46 ] )
pool . extend ( [ ' Bomb Upgrade (+10) ' ] * customitemarray [ 47 ] )
pool . extend ( [ ' Arrow Upgrade (+5) ' ] * customitemarray [ 48 ] )
pool . extend ( [ ' Arrow Upgrade (+10) ' ] * customitemarray [ 49 ] )
pool . extend ( [ ' Single Arrow ' ] * customitemarray [ 50 ] )
pool . extend ( [ ' Arrows (10) ' ] * customitemarray [ 51 ] )
pool . extend ( [ ' Single Bomb ' ] * customitemarray [ 52 ] )
pool . extend ( [ ' Bombs (3) ' ] * customitemarray [ 53 ] )
pool . extend ( [ ' Rupee (1) ' ] * customitemarray [ 54 ] )
pool . extend ( [ ' Rupees (5) ' ] * customitemarray [ 55 ] )
pool . extend ( [ ' Rupees (20) ' ] * customitemarray [ 56 ] )
pool . extend ( [ ' Rupees (50) ' ] * customitemarray [ 57 ] )
pool . extend ( [ ' Rupees (100) ' ] * customitemarray [ 58 ] )
pool . extend ( [ ' Rupees (300) ' ] * customitemarray [ 59 ] )
pool . extend ( [ ' Rupoor ' ] * customitemarray [ 60 ] )
pool . extend ( [ ' Blue Clock ' ] * customitemarray [ 61 ] )
pool . extend ( [ ' Green Clock ' ] * customitemarray [ 62 ] )
pool . extend ( [ ' Red Clock ' ] * customitemarray [ 63 ] )
2019-10-24 02:31:02 +00:00
pool . extend ( [ ' Progressive Bow ' ] * customitemarray [ 64 ] )
pool . extend ( [ ' Bombs (10) ' ] * customitemarray [ 65 ] )
pool . extend ( [ ' Triforce Piece ' ] * customitemarray [ 66 ] )
pool . extend ( [ ' Triforce ' ] * customitemarray [ 68 ] )
2018-01-22 02:43:44 +00:00
diff = difficulties [ difficulty ]
2018-02-24 21:16:50 +00:00
2018-01-22 02:43:44 +00:00
# expert+ difficulties produce the same contents for
# all bottles, since only one bottle is available
if diff . same_bottle :
2020-07-14 05:01:51 +00:00
thisbottle = world . random . choice ( diff . bottles )
2018-01-22 02:43:44 +00:00
for _ in range ( customitemarray [ 18 ] ) :
if not diff . same_bottle :
2020-07-14 05:01:51 +00:00
thisbottle = world . random . choice ( diff . bottles )
2018-01-22 02:43:44 +00:00
pool . append ( thisbottle )
2019-10-24 02:31:02 +00:00
if customitemarray [ 66 ] > 0 or customitemarray [ 67 ] > 0 :
treasure_hunt_count = max ( min ( customitemarray [ 67 ] , 99 ) , 1 ) #To display, count must be between 1 and 99.
2018-01-22 02:43:44 +00:00
treasure_hunt_icon = ' Triforce Piece '
# Ensure game is always possible to complete here, force sufficient pieces if the player is unwilling.
2020-06-26 14:18:53 +00:00
if ( customitemarray [ 66 ] < treasure_hunt_count ) and ( ' triforcehunt ' in goal ) and ( customitemarray [ 68 ] == 0 ) :
2019-10-24 02:31:02 +00:00
extrapieces = treasure_hunt_count - customitemarray [ 66 ]
2018-01-22 02:43:44 +00:00
pool . extend ( [ ' Triforce Piece ' ] * extrapieces )
itemtotal = itemtotal + extrapieces
if timer in [ ' display ' , ' timed ' , ' timed-countdown ' ] :
clock_mode = ' countdown ' if timer == ' timed-countdown ' else ' stopwatch '
elif timer == ' timed-ohko ' :
clock_mode = ' countdown-ohko '
elif timer == ' ohko ' :
clock_mode = ' ohko '
if goal == ' pedestal ' :
2019-12-10 20:21:38 +00:00
place_item ( ' Master Sword Pedestal ' , ' Triforce ' )
2018-01-22 02:43:44 +00:00
itemtotal = itemtotal + 1
if mode == ' standard ' :
2018-03-16 17:26:14 +00:00
if retro :
2020-07-14 05:01:51 +00:00
key_location = world . random . choice (
[ ' Secret Passage ' , ' Hyrule Castle - Boomerang Chest ' , ' Hyrule Castle - Map Chest ' ,
' Hyrule Castle - Zelda \' s Chest ' , ' Sewers - Dark Cross ' ] )
2019-12-10 20:21:38 +00:00
place_item ( key_location , ' Small Key (Universal) ' )
2019-10-24 02:31:02 +00:00
pool . extend ( [ ' Small Key (Universal) ' ] * max ( ( customitemarray [ 70 ] - 1 ) , 0 ) )
2018-03-16 17:26:14 +00:00
else :
2019-10-24 02:31:02 +00:00
pool . extend ( [ ' Small Key (Universal) ' ] * customitemarray [ 70 ] )
2018-01-22 02:43:44 +00:00
else :
2019-10-24 02:31:02 +00:00
pool . extend ( [ ' Small Key (Universal) ' ] * customitemarray [ 70 ] )
2018-01-22 02:43:44 +00:00
2019-08-07 01:36:45 +00:00
pool . extend ( [ ' Fighter Sword ' ] * customitemarray [ 32 ] )
pool . extend ( [ ' Progressive Sword ' ] * customitemarray [ 36 ] )
2019-08-10 19:30:14 +00:00
2018-02-18 19:52:34 +00:00
if shuffle == ' insanity_legacy ' :
2019-12-10 20:21:38 +00:00
place_item ( ' Link \' s House ' , ' Magic Mirror ' )
place_item ( ' Sanctuary ' , ' Moon Pearl ' )
2018-01-22 02:43:44 +00:00
pool . extend ( [ ' Magic Mirror ' ] * max ( ( customitemarray [ 22 ] - 1 ) , 0 ) )
pool . extend ( [ ' Moon Pearl ' ] * max ( ( customitemarray [ 28 ] - 1 ) , 0 ) )
else :
pool . extend ( [ ' Magic Mirror ' ] * customitemarray [ 22 ] )
pool . extend ( [ ' Moon Pearl ' ] * customitemarray [ 28 ] )
2018-03-15 21:53:42 +00:00
if retro :
itemtotal = itemtotal - 28 # Corrects for small keys not being in item pool in Retro Mode
2018-01-22 02:43:44 +00:00
if itemtotal < total_items_to_place :
pool . extend ( [ ' Nothing ' ] * ( total_items_to_place - itemtotal ) )
2020-08-01 04:26:30 +00:00
return ( pool , placed_items , precollected_items , clock_mode , treasure_hunt_count , treasure_hunt_icon )