mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-07 15:13:52 -08:00
Major Content update for Stardew Valley ### Features - New BundleRandomization Value: Meme Bundles - Over 100 custom bundles, designed to be jokes, references, trolls, etc - New Setting: Bundles Per Room modifier - New Setting: Backpack Size - New Setting: Secretsanity - Checks for triggering easter eggs and secrets - New Setting: Moviesanity - Checks for watching movies and sharing snacks with Villagers - New Setting: Eatsanity - Checks for eating items - New Setting: Hatsanity - Checks for wearing Hats - New Setting: Start Without - Allows you to select any combination of various "starting" items, that you will actually not start with. Notably, tools, backpack slots, Day5 unlocks, etc. - New Setting: Allowed Filler Items - Allows you to customize the filler items you'll get - New Setting: Endgame Locations - Checks for various expensive endgame tasks and purchases - New Shipsanity value: Crops and Fish - New Settings: Jojapocalypse and settings to customize it - Bundle Plando: Replaced with BundleWhitelist and BundleBlacklist, for more customization freedom - Added a couple of Host.yaml settings to help hosts allow or ban specific difficult settings that could cause problems if the people don't know what they are signing up for. Plus a truckload of improvements on the mod side, not seen in this PR. ### Removed features - Integration for Stardew Valley Expanded. It is simply disabled, the code is all still there, but I'm extremely tired of providing tech support for it, plus Stardew Valley 1.7 was announced and that will break it again, so I'm done. When a maintainer steps up, it can be re-enabled.
78 lines
3.3 KiB
Python
78 lines
3.3 KiB
Python
from dataclasses import dataclass
|
|
from random import Random
|
|
from typing import List
|
|
|
|
from .bundle import Bundle, BundleTemplate
|
|
from ..content import StardewContent
|
|
from ..options import StardewValleyOptions
|
|
from ..strings.bundle_names import CCRoom
|
|
|
|
|
|
@dataclass
|
|
class BundleRoom:
|
|
name: str
|
|
bundles: List[Bundle]
|
|
|
|
def special_behavior(self, world):
|
|
for bundle in self.bundles:
|
|
bundle.special_behavior(world)
|
|
|
|
|
|
def simplify_name(name: str) -> str:
|
|
return name.lower().replace(" ", "").replace("-", "").replace("_", "").replace(".", "")
|
|
|
|
|
|
# In the context of meme bundles, some of the bundles are directly references to specific people, mostly content creators.
|
|
# This ensures that they roll their own bundle as part of their community center.
|
|
def is_bundle_related_to_player(bundle: BundleTemplate, player_name: str) -> bool:
|
|
if player_name == "":
|
|
return False
|
|
simple_bundle = simplify_name(bundle.name)
|
|
simple_player = simplify_name(player_name)
|
|
return simple_player in simple_bundle or simple_bundle in simple_player
|
|
|
|
|
|
@dataclass
|
|
class BundleRoomTemplate:
|
|
name: str
|
|
bundles: List[BundleTemplate]
|
|
number_bundles: int
|
|
|
|
def create_bundle_room(self, random: Random, content: StardewContent, options: StardewValleyOptions, player_name: str = "", is_entire_cc: bool = False):
|
|
filtered_bundles = [bundle for bundle in self.bundles if bundle.can_appear(options)]
|
|
|
|
whitelist_bundles = []
|
|
unpriority_bundles = []
|
|
blacklist_bundles = []
|
|
for bundle in filtered_bundles:
|
|
if options.bundle_whitelist.prioritizes(bundle.name) or is_bundle_related_to_player(bundle, player_name):
|
|
whitelist_bundles.append(bundle)
|
|
elif options.bundle_blacklist.allows(bundle.name):
|
|
unpriority_bundles.append(bundle)
|
|
else:
|
|
blacklist_bundles.append(bundle)
|
|
|
|
modifier = options.bundle_per_room.value
|
|
if is_entire_cc:
|
|
modifier *= 6
|
|
number_bundles = self.number_bundles + modifier
|
|
bundles_cap = max(len(filtered_bundles), self.number_bundles)
|
|
number_bundles = max(1, min(bundles_cap, number_bundles))
|
|
if number_bundles < len(whitelist_bundles):
|
|
chosen_bundles = random.sample(whitelist_bundles, number_bundles)
|
|
else:
|
|
chosen_bundles = whitelist_bundles
|
|
num_remaining_bundles = number_bundles - len(whitelist_bundles)
|
|
if num_remaining_bundles < len(unpriority_bundles):
|
|
chosen_bundles.extend(random.sample(unpriority_bundles, num_remaining_bundles))
|
|
else:
|
|
chosen_bundles.extend(unpriority_bundles)
|
|
num_remaining_bundles = num_remaining_bundles - len(unpriority_bundles)
|
|
if num_remaining_bundles > 0:
|
|
if self.name == CCRoom.raccoon_requests:
|
|
chosen_bundles.extend(random.choices(unpriority_bundles, k=num_remaining_bundles))
|
|
else:
|
|
chosen_bundles.extend(random.sample(blacklist_bundles, num_remaining_bundles))
|
|
|
|
return BundleRoom(self.name, [bundle.create_bundle(random, content, options) for bundle in chosen_bundles])
|