[OC2] DeathLink (#1470)
This commit is contained in:
		
							parent
							
								
									0b12d80008
								
							
						
					
					
						commit
						b8659d28cc
					
				| 
						 | 
				
			
			@ -1,14 +1,20 @@
 | 
			
		|||
from enum import Enum
 | 
			
		||||
from enum import IntEnum
 | 
			
		||||
from typing import TypedDict
 | 
			
		||||
from Options import DefaultOnToggle, Range, Choice
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class LocationBalancingMode(Enum):
 | 
			
		||||
class LocationBalancingMode(IntEnum):
 | 
			
		||||
    disabled = 0
 | 
			
		||||
    compromise = 1
 | 
			
		||||
    full = 2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DeathLinkMode(IntEnum):
 | 
			
		||||
    disabled = 0
 | 
			
		||||
    death_only = 1
 | 
			
		||||
    death_and_overcook = 2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OC2OnToggle(DefaultOnToggle):
 | 
			
		||||
    @property
 | 
			
		||||
    def result(self) -> bool:
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +37,23 @@ class LocationBalancing(Choice):
 | 
			
		|||
    default = LocationBalancingMode.compromise.value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DeathLink(Choice):
 | 
			
		||||
    """DeathLink is an opt-in feature for Multiworlds where individual death events are propogated to all games with DeathLink enabled.
 | 
			
		||||
 | 
			
		||||
    - Disabled: Death will behave as it does in the original game.
 | 
			
		||||
 | 
			
		||||
    - Death Only: A DeathLink broadcast will be sent every time a chef falls into a stage hazard. All local chefs will be killed when any one perishes.
 | 
			
		||||
 | 
			
		||||
    - Death and Overcook: Same as above, but an additional broadcast will be sent whenever the kitchen catches on fire from burnt food.
 | 
			
		||||
    """
 | 
			
		||||
    auto_display_name = True
 | 
			
		||||
    display_name = "DeathLink"
 | 
			
		||||
    option_disabled = DeathLinkMode.disabled.value
 | 
			
		||||
    option_death_only = DeathLinkMode.death_only.value
 | 
			
		||||
    option_death_and_overcook = DeathLinkMode.death_and_overcook.value
 | 
			
		||||
    default = DeathLinkMode.disabled.value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AlwaysServeOldestOrder(OC2OnToggle):
 | 
			
		||||
    """Modifies the game so that serving an expired order doesn't target the ticket with the highest tip. This helps
 | 
			
		||||
    players dig out of a broken tip combo faster."""
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +154,9 @@ overcooked_options = {
 | 
			
		|||
    # generator options
 | 
			
		||||
    "location_balancing": LocationBalancing,
 | 
			
		||||
 | 
			
		||||
    # deathlink
 | 
			
		||||
    "deathlink": DeathLink,
 | 
			
		||||
 | 
			
		||||
    # randomization options
 | 
			
		||||
    "shuffle_level_order": ShuffleLevelOrder,
 | 
			
		||||
    "include_horde_levels": IncludeHordeLevels,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
from enum import Enum
 | 
			
		||||
from enum import Enum, IntEnum
 | 
			
		||||
from typing import List
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ ITEMS_TO_EXCLUDE_IF_NO_DLC = [
 | 
			
		|||
    "Calmer Unbread",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
class Overcooked2GameWorld(Enum):
 | 
			
		||||
class Overcooked2GameWorld(IntEnum):
 | 
			
		||||
    ONE = 1
 | 
			
		||||
    TWO = 2
 | 
			
		||||
    THREE = 3
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ class Overcooked2GameWorld(Enum):
 | 
			
		|||
        if self == Overcooked2GameWorld.KEVIN:
 | 
			
		||||
            return "Kevin"
 | 
			
		||||
 | 
			
		||||
        return str(int(self.value))
 | 
			
		||||
        return str(self.value)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def sublevel_count(self) -> int:
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ class Overcooked2GameWorld(Enum):
 | 
			
		|||
        if self == Overcooked2GameWorld.ONE:
 | 
			
		||||
            return 1
 | 
			
		||||
 | 
			
		||||
        prev = Overcooked2GameWorld(self.value - 1)
 | 
			
		||||
        prev = Overcooked2GameWorld(self - 1)
 | 
			
		||||
        return prev.base_id + prev.sublevel_count
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
| 
						 | 
				
			
			@ -195,7 +195,7 @@ class Overcooked2Level:
 | 
			
		|||
        if self.sublevel > self.world.sublevel_count:
 | 
			
		||||
            if self.world == Overcooked2GameWorld.KEVIN:
 | 
			
		||||
                raise StopIteration
 | 
			
		||||
            self.world = Overcooked2GameWorld(self.world.value + 1)
 | 
			
		||||
            self.world = Overcooked2GameWorld(self.world + 1)
 | 
			
		||||
            self.sublevel = 1
 | 
			
		||||
 | 
			
		||||
        return self
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
from enum import Enum
 | 
			
		||||
from enum import IntEnum
 | 
			
		||||
from typing import Callable, Dict, Any, List, Optional
 | 
			
		||||
 | 
			
		||||
from BaseClasses import ItemClassification, CollectionState, Region, Entrance, Location, Tutorial, LocationProgressType
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ from worlds.AutoWorld import World, WebWorld
 | 
			
		|||
 | 
			
		||||
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 .Options import overcooked_options, OC2Options, OC2OnToggle, LocationBalancingMode
 | 
			
		||||
from .Options import overcooked_options, OC2Options, OC2OnToggle, LocationBalancingMode, DeathLinkMode
 | 
			
		||||
from .Items import item_table, Overcooked2Item, item_name_to_id, item_id_to_name, item_to_unlock_event, item_frequencies
 | 
			
		||||
from .Logic import has_requirements_for_level_star, has_requirements_for_level_access, level_shuffle_factory, is_item_progression, is_useful
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ class Overcooked2Web(WebWorld):
 | 
			
		|||
    tutorials = [setup_en]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class PrepLevelMode(Enum):
 | 
			
		||||
class PrepLevelMode(IntEnum):
 | 
			
		||||
    original = 0
 | 
			
		||||
    excluded = 1
 | 
			
		||||
    ayce = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -179,7 +179,7 @@ class Overcooked2World(World):
 | 
			
		|||
 | 
			
		||||
        balancing_mode = self.get_options()["LocationBalancing"]
 | 
			
		||||
 | 
			
		||||
        if balancing_mode == LocationBalancingMode.disabled.value:
 | 
			
		||||
        if balancing_mode == LocationBalancingMode.disabled:
 | 
			
		||||
            # Location balancing is disabled, progression density is purely determined by filler
 | 
			
		||||
            return list()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -191,12 +191,12 @@ class Overcooked2World(World):
 | 
			
		|||
                game_progression_count += 1
 | 
			
		||||
        game_progression_density = game_progression_count/game_item_count
 | 
			
		||||
 | 
			
		||||
        if balancing_mode == LocationBalancingMode.full.value:
 | 
			
		||||
        if balancing_mode == LocationBalancingMode.full:
 | 
			
		||||
            # Location balancing will be employed in an attempt to keep the number of
 | 
			
		||||
            # progression locations and proression items as close to equal as possible
 | 
			
		||||
            return self.get_n_random_locations(game_progression_count)
 | 
			
		||||
 | 
			
		||||
        assert balancing_mode == LocationBalancingMode.compromise.value
 | 
			
		||||
        assert balancing_mode == LocationBalancingMode.compromise
 | 
			
		||||
 | 
			
		||||
        # Count how many progression items are shuffled between all games
 | 
			
		||||
        total_item_count = len(self.multiworld.itempool)
 | 
			
		||||
| 
						 | 
				
			
			@ -242,7 +242,7 @@ class Overcooked2World(World):
 | 
			
		|||
            self.level_mapping = \
 | 
			
		||||
                level_shuffle_factory(
 | 
			
		||||
                    self.multiworld.random,
 | 
			
		||||
                    self.options["PrepLevels"] != PrepLevelMode.excluded.value,
 | 
			
		||||
                    self.options["PrepLevels"] != PrepLevelMode.excluded,
 | 
			
		||||
                    self.options["IncludeHordeLevels"],
 | 
			
		||||
                )
 | 
			
		||||
        else:
 | 
			
		||||
| 
						 | 
				
			
			@ -508,6 +508,8 @@ class Overcooked2World(World):
 | 
			
		|||
            "SaveFolderName": mod_name,
 | 
			
		||||
            "CustomOrderTimeoutPenalty": 10,
 | 
			
		||||
            "LevelForceHide": [37, 38, 39, 40, 41, 42, 43, 44],
 | 
			
		||||
            "LocalDeathLink": self.options["DeathLink"] != DeathLinkMode.disabled,
 | 
			
		||||
            "BurnTriggersDeath": self.options["DeathLink"] == DeathLinkMode.death_and_overcook,
 | 
			
		||||
 | 
			
		||||
            # Game Modifications
 | 
			
		||||
            "LevelPurchaseRequirements": level_purchase_requirements,
 | 
			
		||||
| 
						 | 
				
			
			@ -560,7 +562,7 @@ class Overcooked2World(World):
 | 
			
		|||
        for bug in bugs:
 | 
			
		||||
            self.options[bug] = self.options["FixBugs"]
 | 
			
		||||
        self.options["PreserveCookingProgress"] = self.options["AlwaysPreserveCookingProgress"]
 | 
			
		||||
        self.options["TimerAlwaysStarts"] = self.options["PrepLevels"] == PrepLevelMode.ayce.value
 | 
			
		||||
        self.options["TimerAlwaysStarts"] = self.options["PrepLevels"] == PrepLevelMode.ayce
 | 
			
		||||
        self.options["LevelTimerScale"] = 0.666 if self.options["ShorterLevelDuration"] else 1.0
 | 
			
		||||
        self.options["LeaderboardScoreScale"] = {
 | 
			
		||||
            "FourStars": 1.0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue