Core: make early_items internal only (#1177)

Co-authored-by: beauxq <beauxq@yahoo.com>
This commit is contained in:
espeon65536
2022-11-16 10:32:33 -06:00
committed by GitHub
parent 4d79920fa6
commit edd1fff4b7
10 changed files with 61 additions and 76 deletions

View File

@@ -41,7 +41,6 @@ class RLWorld(World):
location_name_to_id = {name: data.code for name, data in location_table.items()}
item_pool: List[RLItem] = []
prefill_items: List[RLItem] = []
def setting(self, name: str):
return getattr(self.multiworld, name)[self.player]
@@ -50,8 +49,6 @@ class RLWorld(World):
return {option_name: self.setting(option_name).value for option_name in rl_options}
def generate_early(self):
self.prefill_items = []
# Check validation of names.
additional_lady_names = len(self.setting("additional_lady_names").value)
additional_sir_names = len(self.setting("additional_sir_names").value)
@@ -68,10 +65,11 @@ class RLWorld(World):
f"Expected {int(self.setting('number_of_children'))}, Got {additional_sir_names}")
if self.setting("vendors") == "early":
self.prefill_items += [self.create_item("Blacksmith"), self.create_item("Enchantress")]
self.multiworld.local_early_items[self.player]["Blacksmith"] = 1
self.multiworld.local_early_items[self.player]["Enchantress"] = 1
if self.setting("architect") == "early":
self.prefill_items += [self.create_item("Architect")]
self.multiworld.local_early_items[self.player]["Architect"] = 1
def generate_basic(self):
self.item_pool = []
@@ -83,7 +81,7 @@ class RLWorld(World):
# Architect
if name == "Architect":
if self.setting("architect") == "disabled" or self.setting("architect") == "early":
if self.setting("architect") == "disabled":
continue
if self.setting("architect") == "start_unlocked":
self.multiworld.push_precollected(self.create_item(name))
@@ -94,8 +92,6 @@ class RLWorld(World):
if self.setting("vendors") == "start_unlocked":
self.multiworld.push_precollected(self.create_item(name))
continue
if self.setting("vendors") == "early":
continue
# Haggling
if name == "Haggling" and self.setting("disable_charon"):
@@ -192,21 +188,11 @@ class RLWorld(World):
self.item_pool += [self.create_item(name) for _ in range(0, quantity)]
# Fill any empty locations with filler items.
while len(self.item_pool) + len(self.prefill_items) < total_locations:
while len(self.item_pool) < total_locations:
self.item_pool.append(self.create_item(self.get_filler_item_name()))
self.multiworld.itempool += self.item_pool
def pre_fill(self) -> None:
reachable = [loc for loc in self.multiworld.get_reachable_locations(player=self.player) if not loc.item]
self.multiworld.random.shuffle(reachable)
items = self.prefill_items.copy()
for item in items:
reachable.pop().place_locked_item(item)
def get_pre_fill_items(self) -> List[RLItem]:
return self.prefill_items
def get_filler_item_name(self) -> str:
fillers = get_items_by_category("Filler")
weights = [data.weight for data in fillers.values()]