Subnautica: add 'valuable' item_pool
This commit is contained in:
parent
b82e3f2a8a
commit
4e1f1551ea
|
@ -6,9 +6,17 @@ with open(os.path.join(os.path.dirname(__file__), 'items.json'), 'r') as file:
|
||||||
|
|
||||||
lookup_id_to_name = {}
|
lookup_id_to_name = {}
|
||||||
lookup_name_to_item = {}
|
lookup_name_to_item = {}
|
||||||
|
advancement_item_names = set()
|
||||||
|
non_advancement_item_names = set()
|
||||||
|
|
||||||
for item in item_table:
|
for item in item_table:
|
||||||
lookup_id_to_name[item["id"]] = item["name"]
|
item_name = item["name"]
|
||||||
lookup_name_to_item[item["name"]] = item
|
lookup_id_to_name[item["id"]] = item_name
|
||||||
|
lookup_name_to_item[item_name] = item
|
||||||
|
if item["progression"]:
|
||||||
|
advancement_item_names.add(item_name)
|
||||||
|
else:
|
||||||
|
non_advancement_item_names.add(item_name)
|
||||||
|
|
||||||
lookup_id_to_name[None] = "Victory"
|
lookup_id_to_name[None] = "Victory"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
from Options import Choice
|
||||||
|
|
||||||
|
|
||||||
|
class ItemPool(Choice):
|
||||||
|
"""Valuable item pool moves all not progression relevant items to starting inventory and
|
||||||
|
creates random duplicates of important items in their place."""
|
||||||
|
option_standard = 0
|
||||||
|
option_valuable = 1
|
||||||
|
|
||||||
|
|
||||||
|
options = {
|
||||||
|
"item_pool": ItemPool
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Set
|
|
||||||
|
|
||||||
logger = logging.getLogger("Subnautica")
|
logger = logging.getLogger("Subnautica")
|
||||||
|
|
||||||
from .Locations import lookup_name_to_id as locations_lookup_name_to_id
|
from .Locations import lookup_name_to_id as locations_lookup_name_to_id
|
||||||
from .Items import item_table, lookup_name_to_item
|
from .Items import item_table, lookup_name_to_item, advancement_item_names
|
||||||
from .Items import lookup_name_to_id as items_lookup_name_to_id
|
from .Items import lookup_name_to_id as items_lookup_name_to_id
|
||||||
|
|
||||||
from .Regions import create_regions
|
from .Regions import create_regions
|
||||||
from .Rules import set_rules
|
from .Rules import set_rules
|
||||||
|
from .Options import options
|
||||||
|
|
||||||
from BaseClasses import Region, Entrance, Location, MultiWorld, Item
|
from BaseClasses import Region, Entrance, Location, MultiWorld, Item
|
||||||
from ..AutoWorld import World
|
from ..AutoWorld import World
|
||||||
|
@ -24,6 +24,7 @@ class SubnauticaWorld(World):
|
||||||
|
|
||||||
item_name_to_id = items_lookup_name_to_id
|
item_name_to_id = items_lookup_name_to_id
|
||||||
location_name_to_id = locations_lookup_name_to_id
|
location_name_to_id = locations_lookup_name_to_id
|
||||||
|
options = options
|
||||||
|
|
||||||
def generate_basic(self):
|
def generate_basic(self):
|
||||||
# Link regions
|
# Link regions
|
||||||
|
@ -32,13 +33,21 @@ class SubnauticaWorld(World):
|
||||||
# Generate item pool
|
# Generate item pool
|
||||||
pool = []
|
pool = []
|
||||||
neptune_launch_platform = None
|
neptune_launch_platform = None
|
||||||
|
extras = 0
|
||||||
for item in item_table:
|
for item in item_table:
|
||||||
for i in range(item["count"]):
|
for i in range(item["count"]):
|
||||||
subnautica_item = self.create_item(item["name"])
|
subnautica_item = self.create_item(item["name"])
|
||||||
if item["name"] == "Neptune Launch Platform":
|
if item["name"] == "Neptune Launch Platform":
|
||||||
neptune_launch_platform = subnautica_item
|
neptune_launch_platform = subnautica_item
|
||||||
|
elif not item["progression"] and self.world.item_pool[self.player] == "valuable":
|
||||||
|
self.world.push_precollected(subnautica_item)
|
||||||
|
extras += 1
|
||||||
else:
|
else:
|
||||||
pool.append(subnautica_item)
|
pool.append(subnautica_item)
|
||||||
|
for item_name in self.world.random.choices(sorted(advancement_item_names - {"Neptune Launch Platform"}),
|
||||||
|
k=extras):
|
||||||
|
pool.append(self.create_item(item_name))
|
||||||
|
|
||||||
self.world.itempool += pool
|
self.world.itempool += pool
|
||||||
|
|
||||||
# Victory item
|
# Victory item
|
||||||
|
|
Loading…
Reference in New Issue