Files
Grinch-AP/worlds/stardew_valley/bundles/bundles.py
agilbert1412 52e65e208e Stardew Valley: 5.x.x - The Allsanity Update (#2764)
Major Content update for Stardew Valley, including the following features

- Major performance improvements all across the Stardew Valley apworld, including a significant reduction in the test time
- Randomized Farm Type
- Bundles rework (Remixed Bundles and Missing Bundle!)
- New Settings:
  * Shipsanity - Shipping individual items
  * Monstersanity - Slaying monsters
  * Cooksanity - Cooking individual recipes
  * Chefsanity - Learning individual recipes
  * Craftsanity - Crafting individual items
- New Goals:
  * Protector of the Valley - Complete every monster slayer goal
  * Full Shipment - Ship every item
  * Craftmaster - Craft every item
  * Gourmet Chef - Cook every recipe
  * Legend - Earn 10 000 000g
  * Mystery of the Stardrops - Find every stardrop (Maguffin Hunt)
  * Allsanity - Complete every check in your slot
- Building Shuffle: Cheaper options
- Tool Shuffle: Cheaper options
- Money rework
- New traps
- New isolated checks and items, including the farm cave, the movie theater, etc
- Mod Support: SVE [Albrekka]
- Mod Support: Distant Lands [Albrekka]
- Mod Support: Hat Mouse Lacey [Albrekka]
- Mod Support: Boarding House [Albrekka]

Co-authored-by: Witchybun <elnendil@gmail.com>
Co-authored-by: Witchybun <96719127+Witchybun@users.noreply.github.com>
Co-authored-by: Jouramie <jouramie@hotmail.com>
Co-authored-by: Alchav <59858495+Alchav@users.noreply.github.com>
2024-03-15 13:05:14 +01:00

81 lines
5.0 KiB
Python

from random import Random
from typing import List
from .bundle_room import BundleRoom
from ..data.bundle_data import pantry_vanilla, crafts_room_vanilla, fish_tank_vanilla, boiler_room_vanilla, bulletin_board_vanilla, vault_vanilla, \
pantry_thematic, crafts_room_thematic, fish_tank_thematic, boiler_room_thematic, bulletin_board_thematic, vault_thematic, pantry_remixed, \
crafts_room_remixed, fish_tank_remixed, boiler_room_remixed, bulletin_board_remixed, vault_remixed, all_bundle_items_except_money, \
abandoned_joja_mart_thematic, abandoned_joja_mart_vanilla, abandoned_joja_mart_remixed
from ..logic.logic import StardewLogic
from ..options import BundleRandomization, StardewValleyOptions, ExcludeGingerIsland
def get_all_bundles(random: Random, logic: StardewLogic, options: StardewValleyOptions) -> List[BundleRoom]:
if options.bundle_randomization == BundleRandomization.option_vanilla:
return get_vanilla_bundles(random, options)
elif options.bundle_randomization == BundleRandomization.option_thematic:
return get_thematic_bundles(random, options)
elif options.bundle_randomization == BundleRandomization.option_remixed:
return get_remixed_bundles(random, options)
elif options.bundle_randomization == BundleRandomization.option_shuffled:
return get_shuffled_bundles(random, logic, options)
raise NotImplementedError
def get_vanilla_bundles(random: Random, options: StardewValleyOptions) -> List[BundleRoom]:
pantry = pantry_vanilla.create_bundle_room(options.bundle_price, random, options)
crafts_room = crafts_room_vanilla.create_bundle_room(options.bundle_price, random, options)
fish_tank = fish_tank_vanilla.create_bundle_room(options.bundle_price, random, options)
boiler_room = boiler_room_vanilla.create_bundle_room(options.bundle_price, random, options)
bulletin_board = bulletin_board_vanilla.create_bundle_room(options.bundle_price, random, options)
vault = vault_vanilla.create_bundle_room(options.bundle_price, random, options)
abandoned_joja_mart = abandoned_joja_mart_vanilla.create_bundle_room(options.bundle_price, random, options)
return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart]
def get_thematic_bundles(random: Random, options: StardewValleyOptions) -> List[BundleRoom]:
pantry = pantry_thematic.create_bundle_room(options.bundle_price, random, options)
crafts_room = crafts_room_thematic.create_bundle_room(options.bundle_price, random, options)
fish_tank = fish_tank_thematic.create_bundle_room(options.bundle_price, random, options)
boiler_room = boiler_room_thematic.create_bundle_room(options.bundle_price, random, options)
bulletin_board = bulletin_board_thematic.create_bundle_room(options.bundle_price, random, options)
vault = vault_thematic.create_bundle_room(options.bundle_price, random, options)
abandoned_joja_mart = abandoned_joja_mart_thematic.create_bundle_room(options.bundle_price, random, options)
return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart]
def get_remixed_bundles(random: Random, options: StardewValleyOptions) -> List[BundleRoom]:
pantry = pantry_remixed.create_bundle_room(options.bundle_price, random, options)
crafts_room = crafts_room_remixed.create_bundle_room(options.bundle_price, random, options)
fish_tank = fish_tank_remixed.create_bundle_room(options.bundle_price, random, options)
boiler_room = boiler_room_remixed.create_bundle_room(options.bundle_price, random, options)
bulletin_board = bulletin_board_remixed.create_bundle_room(options.bundle_price, random, options)
vault = vault_remixed.create_bundle_room(options.bundle_price, random, options)
abandoned_joja_mart = abandoned_joja_mart_remixed.create_bundle_room(options.bundle_price, random, options)
return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart]
def get_shuffled_bundles(random: Random, logic: StardewLogic, options: StardewValleyOptions) -> List[BundleRoom]:
valid_bundle_items = [bundle_item for bundle_item in all_bundle_items_except_money if bundle_item.can_appear(options)]
rooms = [room for room in get_remixed_bundles(random, options) if room.name != "Vault"]
required_items = 0
for room in rooms:
for bundle in room.bundles:
required_items += len(bundle.items)
random.shuffle(room.bundles)
random.shuffle(rooms)
chosen_bundle_items = random.sample(valid_bundle_items, required_items)
sorted_bundle_items = sorted(chosen_bundle_items, key=lambda x: logic.has(x.item_name).get_difficulty())
for room in rooms:
for bundle in room.bundles:
num_items = len(bundle.items)
bundle.items = sorted_bundle_items[:num_items]
sorted_bundle_items = sorted_bundle_items[num_items:]
vault = vault_remixed.create_bundle_room(options.bundle_price, random, options)
return [*rooms, vault]