[OC2] Remove DLC items from item pool if vanilla level order (#1323)
This commit is contained in:
		
							parent
							
								
									1a36da33b4
								
							
						
					
					
						commit
						e853fc208b
					
				|  | @ -87,6 +87,31 @@ class Overcooked2Dlc(Enum): | ||||||
| 
 | 
 | ||||||
|         return [] |         return [] | ||||||
| 
 | 
 | ||||||
|  |     def exclusive_items(self) -> List[str]: | ||||||
|  |         """Returns list of items exclusive to this DLC""" | ||||||
|  |         if self == Overcooked2Dlc.SURF_N_TURF: | ||||||
|  |             return ["Bellows"] | ||||||
|  |         if self == Overcooked2Dlc.CAMPFIRE_COOK_OFF: | ||||||
|  |             return ["Wood"] | ||||||
|  |         if self == Overcooked2Dlc.NIGHT_OF_THE_HANGRY_HORDE: | ||||||
|  |             return ["Coal Bucket"] | ||||||
|  |         if self == Overcooked2Dlc.CARNIVAL_OF_CHAOS: | ||||||
|  |             return ["Faster Condiment/Drink Switch"] | ||||||
|  |         if self == Overcooked2Dlc.SEASONAL: | ||||||
|  |             return ["Wok Wheels"] | ||||||
|  | 
 | ||||||
|  |         return [] | ||||||
|  | 
 | ||||||
|  | ITEMS_TO_EXCLUDE_IF_NO_DLC = [ | ||||||
|  |     "Wood", | ||||||
|  |     "Coal Bucket", | ||||||
|  |     "Bellows", | ||||||
|  |     "Coin Purse", | ||||||
|  |     "Wok Wheels", | ||||||
|  |     "Lightweight Backpack", | ||||||
|  |     "Faster Condiment/Drink Switch", | ||||||
|  |     "Calmer Unbread", | ||||||
|  | ] | ||||||
| 
 | 
 | ||||||
| class Overcooked2GameWorld(Enum): | class Overcooked2GameWorld(Enum): | ||||||
|     ONE = 1 |     ONE = 1 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ from typing import Callable, Dict, Any, List, Optional | ||||||
| from BaseClasses import ItemClassification, CollectionState, Region, Entrance, Location, RegionType, Tutorial | from BaseClasses import ItemClassification, CollectionState, Region, Entrance, Location, RegionType, Tutorial | ||||||
| from worlds.AutoWorld import World, WebWorld | from worlds.AutoWorld import World, WebWorld | ||||||
| 
 | 
 | ||||||
| from .Overcooked2Levels import Overcooked2Level, Overcooked2GenericLevel | from .Overcooked2Levels import Overcooked2Level, Overcooked2GenericLevel, ITEMS_TO_EXCLUDE_IF_NO_DLC | ||||||
| from .Locations import Overcooked2Location, oc2_location_name_to_id, oc2_location_id_to_name | from .Locations import Overcooked2Location, oc2_location_name_to_id, oc2_location_id_to_name | ||||||
| from .Options import overcooked_options, OC2Options, OC2OnToggle | from .Options import overcooked_options, OC2Options, OC2OnToggle | ||||||
| from .Items import item_table, Overcooked2Item, item_name_to_id, item_id_to_name, item_to_unlock_event, item_frequencies | from .Items import item_table, Overcooked2Item, item_name_to_id, item_id_to_name, item_to_unlock_event, item_frequencies | ||||||
|  | @ -259,11 +259,16 @@ class Overcooked2World(World): | ||||||
|         # filler = list() |         # filler = list() | ||||||
|         # progression = list() |         # progression = list() | ||||||
|         for item_name in item_table: |         for item_name in item_table: | ||||||
|  |             if not self.options["ShuffleLevelOrder"] and item_name in ITEMS_TO_EXCLUDE_IF_NO_DLC: | ||||||
|  |                 # skip DLC items if no DLC | ||||||
|  |                 continue | ||||||
|  | 
 | ||||||
|             if not self.options["IncludeHordeLevels"] and item_name in ["Calmer Unbread", "Coin Purse"]: |             if not self.options["IncludeHordeLevels"] and item_name in ["Calmer Unbread", "Coin Purse"]: | ||||||
|                 # skip items which are irrelevant to the seed |                 # skip horde-specific items if no horde levels | ||||||
|                 continue |                 continue | ||||||
|              |              | ||||||
|             if not self.options["KevinLevels"] and item_name.startswith("Kevin"): |             if not self.options["KevinLevels"] and item_name.startswith("Kevin"): | ||||||
|  |                 # skip kevin items if no kevin levels | ||||||
|                 continue |                 continue | ||||||
| 
 | 
 | ||||||
|             if is_item_progression(item_name, self.level_mapping, self.options["KevinLevels"]): |             if is_item_progression(item_name, self.level_mapping, self.options["KevinLevels"]): | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ import unittest | ||||||
| from random import Random | from random import Random | ||||||
| 
 | 
 | ||||||
| from worlds.overcooked2.Items import * | from worlds.overcooked2.Items import * | ||||||
| from worlds.overcooked2.Overcooked2Levels import Overcooked2Level, level_id_to_shortname | from worlds.overcooked2.Overcooked2Levels import Overcooked2Dlc, Overcooked2Level, level_id_to_shortname, ITEMS_TO_EXCLUDE_IF_NO_DLC | ||||||
| from worlds.overcooked2.Logic import level_logic, level_shuffle_factory | from worlds.overcooked2.Logic import level_logic, level_shuffle_factory | ||||||
| from worlds.overcooked2.Locations import oc2_location_name_to_id | from worlds.overcooked2.Locations import oc2_location_name_to_id | ||||||
| 
 | 
 | ||||||
|  | @ -139,3 +139,11 @@ class Overcooked2Test(unittest.TestCase): | ||||||
|                 number_of_items += 1 |                 number_of_items += 1 | ||||||
| 
 | 
 | ||||||
|         self.assertLessEqual(number_of_items, len(oc2_location_name_to_id), "Too many items (before fillers placed)") |         self.assertLessEqual(number_of_items, len(oc2_location_name_to_id), "Too many items (before fillers placed)") | ||||||
|  | 
 | ||||||
|  |     def testExclusiveItems(self): | ||||||
|  |         for dlc in Overcooked2Dlc: | ||||||
|  |             for item in dlc.exclusive_items(): | ||||||
|  |                 self.assertIn(item, item_table.keys()) | ||||||
|  | 
 | ||||||
|  |         for item in ITEMS_TO_EXCLUDE_IF_NO_DLC: | ||||||
|  |             self.assertIn(item, item_table.keys()) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue