Skip to content

Stardew Valley: implement new game #1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e32ab60
Stardew Valley Archipelago implementation
Jouramie Jan 30, 2023
5e8b2c7
fix breaking changes
Jouramie Feb 15, 2023
7882b7a
- Added and Updated Documentation for the game
agilbert1412 Feb 15, 2023
a3d54cc
Removed fun
agilbert1412 Feb 15, 2023
f9d7bf8
Remove entire idea of step, due to possible inconsistency with the ma…
agilbert1412 Feb 16, 2023
da4ae6b
Commented out the desired steps, fix renaming after rebase
agilbert1412 Feb 16, 2023
9740afc
Fixed wording
agilbert1412 Feb 16, 2023
04ba7d6
tests now passes on 3.8
Jouramie Feb 18, 2023
e1b697e
run flake8
Jouramie Feb 18, 2023
7bf5490
remove dependency so apworld work again
Jouramie Feb 19, 2023
7b77e67
remove dependency for real
Jouramie Feb 19, 2023
f65077a
Merge branch 'main' into StardewValleyAP0.3.9-main
Jouramie Feb 19, 2023
b1d76e3
- Fix Formatting in the Game Page
agilbert1412 Feb 23, 2023
42c8308
- Removed blankspace
agilbert1412 Feb 23, 2023
5957a06
remove player field
Jouramie Feb 23, 2023
3588537
Merge branch 'StardewValleyAP0.3.9-main' of github.com:agilbert1412/A…
Jouramie Feb 23, 2023
a873411
remove None check in options
Jouramie Feb 23, 2023
7e8150c
Merge remote-tracking branch 'archipelago/main' into StardewValleyAP0…
Jouramie Feb 23, 2023
8c769d4
document the scripts
Jouramie Feb 23, 2023
5ee362e
fix pytest warning
Jouramie Feb 23, 2023
2c16722
use importlib.resources.files
Jouramie Feb 23, 2023
b24179d
fix
Jouramie Feb 23, 2023
581fe1c
add version requirement to importlib_resources
Jouramie Feb 23, 2023
a6123ec
remove __init__.py from data folder
Jouramie Feb 23, 2023
8782c3f
increment data version
Jouramie Feb 23, 2023
60ba2e9
let the __init__.py for 3.9
Jouramie Feb 23, 2023
3b9303e
use sorted() instead of list()
Jouramie Feb 25, 2023
15aa752
replace frozenset from fish_data with tuples
Jouramie Feb 25, 2023
7792a53
remove dependency on pytest
Jouramie Feb 25, 2023
96e18e8
Merge remote-tracking branch 'archipelago/main' into StardewValleyAP0…
Jouramie Feb 25, 2023
08728a9
- Add a bit of text to the guide to tell them about how to redeem som…
agilbert1412 Feb 26, 2023
6b0d126
Merge branch 'StardewValleyAP0.3.9-main' of https://github.com/agilbe…
agilbert1412 Feb 26, 2023
d25b418
- Added a comment about which mod version to use
agilbert1412 Feb 26, 2023
a01d167
change single quotes for double quotes
Jouramie Feb 26, 2023
51b95a2
Merge remote-tracking branch 'archipelago/main' into StardewValleyAP0…
Jouramie Feb 26, 2023
3976556
Minimum client version both ways
agilbert1412 Feb 26, 2023
5e02402
Merge branch 'StardewValleyAP0.3.9-main' of https://github.com/agilbe…
agilbert1412 Feb 26, 2023
caadc82
Changed version number to be more specific. The mod will handle deciding
agilbert1412 Feb 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"Rogue Legacy",
"Donkey Kong Country 3",
"Super Mario World",
"Stardew Valley",
"Timespinner",
}

Expand Down
2 changes: 1 addition & 1 deletion test/TestBase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pathlib
import typing
import unittest
import pathlib
from argparse import Namespace

import Utils
Expand Down
186 changes: 186 additions & 0 deletions worlds/stardew_valley/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
from typing import Dict, Any, Iterable, Optional, Union

from BaseClasses import Region, Entrance, Location, Item, Tutorial
from worlds.AutoWorld import World, WebWorld
from . import rules, logic, options
from .bundles import get_all_bundles, Bundle
from .items import item_table, create_items, ItemData, Group
from .locations import location_table, create_locations, LocationData
from .logic import StardewLogic, StardewRule, _True, _And
from .options import stardew_valley_options, StardewOptions, fetch_options
from .regions import create_regions
from .rules import set_rules

client_version = 0


class StardewLocation(Location):
game: str = "Stardew Valley"

def __init__(self, player: int, name: str, address: Optional[int], parent=None):
super().__init__(player, name, address, parent)
self.event = not address


class StardewItem(Item):
game: str = "Stardew Valley"


class StardewWebWorld(WebWorld):
theme = "dirt"
bug_report_page = "https://github.com/agilbert1412/StardewArchipelago/issues/new?labels=bug&title=%5BBug%5D%3A+Brief+Description+of+bug+here"

tutorials = [Tutorial(
"Multiworld Setup Guide",
"A guide to playing Stardew Valley with Archipelago.",
"English",
"setup_en.md",
"setup/en",
["KaitoKid", "Jouramie"]
)]


class StardewValleyWorld(World):
"""
Stardew Valley farming simulator game where the objective is basically to spend the least possible time on your farm.
"""
game = "Stardew Valley"
option_definitions = stardew_valley_options
topology_present = False

item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = {name: data.code for name, data in location_table.items()}

data_version = 1

options: StardewOptions
logic: StardewLogic

web = StardewWebWorld()
modified_bundles: Dict[str, Bundle]
randomized_entrances: Dict[str, str]

def generate_early(self):
self.options = fetch_options(self.multiworld, self.player)
self.logic = StardewLogic(self.player, self.options)
self.modified_bundles = get_all_bundles(self.multiworld.random,
self.logic,
self.options[options.BundleRandomization],
self.options[options.BundlePrice])

def create_regions(self):
def create_region(name: str, exits: Iterable[str]) -> Region:
region = Region(name, self.player, self.multiworld)
region.exits = [Entrance(self.player, exit_name, region) for exit_name in exits]
return region

world_regions, self.randomized_entrances = create_regions(create_region, self.multiworld.random, self.options)
self.multiworld.regions.extend(world_regions)

def add_location(name: str, code: Optional[int], region: str):
region = self.multiworld.get_region(region, self.player)
location = StardewLocation(self.player, name, code, region)
location.access_rule = lambda _: True
region.locations.append(location)

create_locations(add_location, self.options, self.multiworld.random)

def create_items(self):
locations_count = len([location
for location in self.multiworld.get_locations(self.player)
if not location.event])
items_to_exclude = [excluded_items
for excluded_items in self.multiworld.precollected_items[self.player]
if not item_table[excluded_items.name].has_any_group(Group.RESOURCE_PACK,
Group.FRIENDSHIP_PACK)]
created_items = create_items(self.create_item, locations_count + len(items_to_exclude), self.options,
self.multiworld.random)
self.multiworld.itempool += created_items

for item in items_to_exclude:
self.multiworld.itempool.remove(item)

self.setup_season_events()
self.setup_victory()

def set_rules(self):
set_rules(self.multiworld, self.player, self.options, self.logic, self.modified_bundles)

def create_item(self, item: Union[str, ItemData]) -> StardewItem:
if isinstance(item, str):
item = item_table[item]

return StardewItem(item.name, item.classification, item.code, self.player)

def setup_season_events(self):
self.multiworld.push_precollected(self.create_item("Spring"))
self.create_event_location(location_table["Summer"], self.logic.received("Spring"), "Summer")
self.create_event_location(location_table["Fall"], self.logic.received("Summer"), "Fall")
self.create_event_location(location_table["Winter"], self.logic.received("Fall"), "Winter")
self.create_event_location(location_table["Year Two"], self.logic.received("Winter"), "Year Two")

def setup_victory(self):
if self.options[options.Goal] == options.Goal.option_community_center:
self.create_event_location(location_table["Complete Community Center"],
self.logic.can_complete_community_center().simplify(),
"Victory")
elif self.options[options.Goal] == options.Goal.option_grandpa_evaluation:
self.create_event_location(location_table["Succeed Grandpa's Evaluation"],
self.logic.can_finish_grandpa_evaluation().simplify(),
"Victory")
elif self.options[options.Goal] == options.Goal.option_bottom_of_the_mines:
self.create_event_location(location_table["Reach the Bottom of The Mines"],
self.logic.can_mine_to_floor(120).simplify(),
"Victory")
elif self.options[options.Goal] == options.Goal.option_cryptic_note:
self.create_event_location(location_table["Complete Quest Cryptic Note"],
self.logic.can_complete_quest("Cryptic Note").simplify(),
"Victory")
elif self.options[options.Goal] == options.Goal.option_master_angler:
self.create_event_location(location_table["Catch Every Fish"],
self.logic.can_catch_every_fish().simplify(),
"Victory")

self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player)

def create_event_location(self, location_data: LocationData, rule: StardewRule, item: str):
region = self.multiworld.get_region(location_data.region, self.player)
location = StardewLocation(self.player, location_data.name, None, region)
location.access_rule = rule
region.locations.append(location)
location.place_locked_item(self.create_item(item))

def get_filler_item_name(self) -> str:
return "Joja Cola"

def fill_slot_data(self) -> Dict[str, Any]:

modified_bundles = {}
for bundle_key in self.modified_bundles:
key, value = self.modified_bundles[bundle_key].to_pair()
modified_bundles[key] = value

return {
"starting_money": self.options[options.StartingMoney],
"entrance_randomization": self.options[options.EntranceRandomization],
"backpack_progression": self.options[options.BackpackProgression],
"tool_progression": self.options[options.ToolProgression],
"elevator_progression": self.options[options.TheMinesElevatorsProgression],
"skill_progression": self.options[options.SkillProgression],
"building_progression": self.options[options.BuildingProgression],
"arcade_machine_progression": self.options[options.ArcadeMachineLocations],
"help_wanted_locations": self.options[options.HelpWantedLocations],
"fishsanity": self.options[options.Fishsanity],
"death_link": self.options["death_link"],
"goal": self.options[options.Goal],
"seed": self.multiworld.per_slot_randoms[self.player].randrange(1000000000), # Seed should be max 9 digits
"multiple_day_sleep_enabled": self.options[options.MultipleDaySleepEnabled],
"multiple_day_sleep_cost": self.options[options.MultipleDaySleepCost],
"experience_multiplier": self.options[options.ExperienceMultiplier],
"debris_multiplier": self.options[options.DebrisMultiplier],
"quick_start": self.options[options.QuickStart],
"gifting": self.options[options.Gifting],
"gift_tax": self.options[options.GiftTax],
"modified_bundles": modified_bundles,
"randomized_entrances": self.randomized_entrances
}
Loading