Skip to content

Commit

Permalink
Stardew Valley: Make progressive movie theater a progression trap (#3985
Browse files Browse the repository at this point in the history
)
  • Loading branch information
agilbert1412 authored Nov 26, 2024
1 parent 0dade05 commit 7562404
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion worlds/stardew_valley/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def create_item(self, item: Union[str, ItemData], override_classification: ItemC
if override_classification is None:
override_classification = item.classification

if override_classification == ItemClassification.progression:
if override_classification & ItemClassification.progression:
self.total_progression_items += 1
return StardewItem(item.name, override_classification, item.code, self.player)

Expand Down
2 changes: 1 addition & 1 deletion worlds/stardew_valley/data/items.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ id,name,classification,groups,mod_name
19,Glittering Boulder Removed,progression,COMMUNITY_REWARD,
20,Minecarts Repair,useful,COMMUNITY_REWARD,
21,Bus Repair,progression,COMMUNITY_REWARD,
22,Progressive Movie Theater,progression,COMMUNITY_REWARD,
22,Progressive Movie Theater,"progression,trap",COMMUNITY_REWARD,
23,Stardrop,progression,,
24,Progressive Backpack,progression,,
25,Rusty Sword,filler,"WEAPON,DEPRECATED",
Expand Down
3 changes: 2 additions & 1 deletion worlds/stardew_valley/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import enum
import logging
from dataclasses import dataclass, field
from functools import reduce
from pathlib import Path
from random import Random
from typing import Dict, List, Protocol, Union, Set, Optional
Expand Down Expand Up @@ -134,7 +135,7 @@ def load_item_csv():
item_reader = csv.DictReader(file)
for item in item_reader:
id = int(item["id"]) if item["id"] else None
classification = ItemClassification[item["classification"]]
classification = reduce((lambda a, b: a | b), {ItemClassification[str_classification] for str_classification in item["classification"].split(",")})
groups = {Group[group] for group in item["groups"].split(",") if group}
mod_name = str(item["mod_name"]) if item["mod_name"] else None
items.append(ItemData(id, item["name"], classification, mod_name, groups))
Expand Down
4 changes: 2 additions & 2 deletions worlds/stardew_valley/test/TestGeneration.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_all_progression_items_are_added_to_the_pool(self):
items_to_ignore.extend(baby.name for baby in items.items_by_group[Group.BABY])
items_to_ignore.extend(resource_pack.name for resource_pack in items.items_by_group[Group.RESOURCE_PACK])
items_to_ignore.append("The Gateway Gazette")
progression_items = [item for item in items.all_items if item.classification is ItemClassification.progression and item.name not in items_to_ignore]
progression_items = [item for item in items.all_items if item.classification & ItemClassification.progression and item.name not in items_to_ignore]
for progression_item in progression_items:
with self.subTest(f"{progression_item.name}"):
self.assertIn(progression_item.name, all_created_items)
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_all_progression_items_except_island_are_added_to_the_pool(self):
items_to_ignore.extend(season.name for season in items.items_by_group[Group.WEAPON])
items_to_ignore.extend(baby.name for baby in items.items_by_group[Group.BABY])
items_to_ignore.append("The Gateway Gazette")
progression_items = [item for item in items.all_items if item.classification is ItemClassification.progression and item.name not in items_to_ignore]
progression_items = [item for item in items.all_items if item.classification & ItemClassification.progression and item.name not in items_to_ignore]
for progression_item in progression_items:
with self.subTest(f"{progression_item.name}"):
if Group.GINGER_ISLAND in progression_item.groups:
Expand Down
2 changes: 1 addition & 1 deletion worlds/stardew_valley/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def collect(self, item: Union[str, Item, Iterable[Item]], count: int = 1) -> Uni

def create_item(self, item: str) -> StardewItem:
created_item = self.world.create_item(item)
if created_item.classification == ItemClassification.progression:
if created_item.classification & ItemClassification.progression:
self.multiworld.worlds[self.player].total_progression_items -= 1
return created_item

Expand Down
4 changes: 2 additions & 2 deletions worlds/stardew_valley/test/mods/TestMods.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_all_progression_items_are_added_to_the_pool(self):
items_to_ignore.extend(baby.name for baby in items.items_by_group[Group.BABY])
items_to_ignore.extend(resource_pack.name for resource_pack in items.items_by_group[Group.RESOURCE_PACK])
items_to_ignore.append("The Gateway Gazette")
progression_items = [item for item in items.all_items if item.classification is ItemClassification.progression
progression_items = [item for item in items.all_items if item.classification & ItemClassification.progression
and item.name not in items_to_ignore]
for progression_item in progression_items:
with self.subTest(f"{progression_item.name}"):
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_all_progression_items_except_island_are_added_to_the_pool(self):
items_to_ignore.extend(baby.name for baby in items.items_by_group[Group.BABY])
items_to_ignore.extend(resource_pack.name for resource_pack in items.items_by_group[Group.RESOURCE_PACK])
items_to_ignore.append("The Gateway Gazette")
progression_items = [item for item in items.all_items if item.classification is ItemClassification.progression
progression_items = [item for item in items.all_items if item.classification & ItemClassification.progression
and item.name not in items_to_ignore]
for progression_item in progression_items:
with self.subTest(f"{progression_item.name}"):
Expand Down
2 changes: 1 addition & 1 deletion worlds/stardew_valley/test/rules/TestStateRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class TestHasProgressionPercent(unittest.TestCase):
def test_max_item_amount_is_full_collection(self):
# Not caching because it fails too often for some reason
with solo_multiworld(world_caching=False) as (multiworld, world):
progression_item_count = sum(1 for i in multiworld.get_items() if ItemClassification.progression in i.classification)
progression_item_count = sum(1 for i in multiworld.get_items() if i.classification & ItemClassification.progression)
self.assertEqual(world.total_progression_items, progression_item_count - 1) # -1 to skip Victory

0 comments on commit 7562404

Please sign in to comment.