3
3
from BaseClasses import Tutorial
4
4
from worlds .AutoWorld import WebWorld , World
5
5
from .Items import KHCOMItem , KHCOMItemData , event_item_table , get_items_by_category , item_table
6
- from .Locations import KHCOMLocation , location_table
6
+ from .Locations import KHCOMLocation , location_table , get_locations_by_category
7
7
from .Options import khcom_options
8
8
from .Regions import create_regions
9
9
from .Rules import set_rules
10
10
from worlds .LauncherComponents import Component , components , Type , launch_subprocess
11
+ import random
11
12
12
13
13
14
@@ -54,15 +55,23 @@ def fill_slot_data(self) -> dict:
54
55
55
56
def create_items (self ):
56
57
item_pool : List [KHCOMItem ] = []
58
+ starting_locations = get_locations_by_category ("Starting" )
59
+ starting_locations = random .sample (list (starting_locations .keys ()),3 )
60
+ starting_worlds = get_items_by_category ("World Unlocks" )
61
+ starting_worlds = random .sample (list (starting_worlds .keys ()),3 )
62
+ i = 0
63
+ while i < 3 :
64
+ self .multiworld .get_location (starting_locations [i ], self .player ).place_locked_item (self .create_item (starting_worlds [i ]))
65
+ i = i + 1
57
66
total_locations = len (self .multiworld .get_unfilled_locations (self .player ))
58
67
for name , data in item_table .items ():
59
68
quantity = data .max_quantity
60
69
61
70
# Ignore filler, it will be added in a later stage.
62
71
if data .category == "Filler" :
63
72
continue
64
-
65
- item_pool += [self .create_item (name ) for _ in range (0 , quantity )]
73
+ if name not in starting_worlds :
74
+ item_pool += [self .create_item (name ) for _ in range (0 , quantity )]
66
75
67
76
# Fill any empty locations with filler items.
68
77
while len (item_pool ) < total_locations :
@@ -74,7 +83,7 @@ def get_filler_item_name(self) -> str:
74
83
fillers = get_items_by_category ("Filler" )
75
84
weights = [data .weight for data in fillers .values ()]
76
85
return self .multiworld .random .choices ([filler for filler in fillers .keys ()], weights , k = 1 )[0 ]
77
-
86
+
78
87
def create_item (self , name : str ) -> KHCOMItem :
79
88
data = item_table [name ]
80
89
return KHCOMItem (name , data .classification , data .code , self .player )
0 commit comments