Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024 This includes randomization for pretty much all of the new content, including but not limited to - Raccoon Bundles - Booksanity - Skill Masteries - New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit. In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update - Walnutsanity - Player Buffs - More customizability in settings, such as shorter special orders, ER without farmhouse - New Remixed Bundles
This commit is contained in:
@@ -3,6 +3,7 @@ from random import Random
|
||||
from typing import List
|
||||
|
||||
from .bundle import Bundle, BundleTemplate
|
||||
from ..content import StardewContent
|
||||
from ..options import BundlePrice, StardewValleyOptions
|
||||
|
||||
|
||||
@@ -18,7 +19,25 @@ class BundleRoomTemplate:
|
||||
bundles: List[BundleTemplate]
|
||||
number_bundles: int
|
||||
|
||||
def create_bundle_room(self, bundle_price_option: BundlePrice, random: Random, options: StardewValleyOptions):
|
||||
def create_bundle_room(self, random: Random, content: StardewContent, options: StardewValleyOptions):
|
||||
filtered_bundles = [bundle for bundle in self.bundles if bundle.can_appear(options)]
|
||||
chosen_bundles = random.sample(filtered_bundles, self.number_bundles)
|
||||
return BundleRoom(self.name, [bundle.create_bundle(bundle_price_option, random, options) for bundle in chosen_bundles])
|
||||
|
||||
priority_bundles = []
|
||||
unpriority_bundles = []
|
||||
for bundle in filtered_bundles:
|
||||
if bundle.name in options.bundle_plando:
|
||||
priority_bundles.append(bundle)
|
||||
else:
|
||||
unpriority_bundles.append(bundle)
|
||||
|
||||
if self.number_bundles <= len(priority_bundles):
|
||||
chosen_bundles = random.sample(priority_bundles, self.number_bundles)
|
||||
else:
|
||||
chosen_bundles = priority_bundles
|
||||
num_remaining_bundles = self.number_bundles - len(priority_bundles)
|
||||
if num_remaining_bundles > len(unpriority_bundles):
|
||||
chosen_bundles.extend(random.choices(unpriority_bundles, k=num_remaining_bundles))
|
||||
else:
|
||||
chosen_bundles.extend(random.sample(unpriority_bundles, num_remaining_bundles))
|
||||
|
||||
return BundleRoom(self.name, [bundle.create_bundle(random, content, options) for bundle in chosen_bundles])
|
||||
|
||||
Reference in New Issue
Block a user