The Witness: The Secret Feature (#4370)
* Secret Feature * Fixes * Fixes and unit tests * renaming some variables * Fix the thing * unit test for elevator egg * Docstring * reword * Fix duplicate locations I think? * Remove debug thing * Add the tests back lol * Make it so that you can exclude an egg to disable it * Improve hint text for easter eggs * Update worlds/witness/options.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Update worlds/witness/player_logic.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Update worlds/witness/options.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Update worlds/witness/player_logic.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Update worlds/witness/rules.py Co-authored-by: Scipio Wright <scipiowright@gmail.com> * Update test_easter_egg_shuffle.py * This was actually not necessary, since this is the Egg requirements, nothing to do with location names * Move one of them * Improve logic * Lol * Moar * Adjust unit tests * option docstring adjustment * Recommend door shuffle * Don't overlap IDs * Option description idk * Change the way the difficulties work to reward playing higher modes * Fix merge * add some stuff to generate_data_file (this file is not imported during gen, don't review it :D) * oop * space * This can be earlier than I thought, apparently. * buffer * Comment * Make sure the option is VERY visible * Some mypy stuff * apparently ruff wants this * . * durinig * Update options.py * Explain the additional effects of each difficulty * Fix logic of flood room secret * Add Southern Peninsula Area * oop --------- Co-authored-by: Scipio Wright <scipiowright@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import dataclasses
|
||||
from logging import error, warning
|
||||
from typing import Any, Dict, List, Optional, cast
|
||||
|
||||
from BaseClasses import CollectionState, Entrance, Location, Region, Tutorial
|
||||
from BaseClasses import CollectionState, Entrance, Location, LocationProgressType, Region, Tutorial
|
||||
|
||||
from Options import OptionError, PerGameCommonOptions, Toggle
|
||||
from worlds.AutoWorld import WebWorld, World
|
||||
@@ -380,6 +380,10 @@ class WitnessWorld(World):
|
||||
if isinstance(item_name, dict):
|
||||
item_name = next(iter(item_name))
|
||||
|
||||
# Easter Egg events with arbitrary sizes
|
||||
if item_name.startswith("+") and "Easter Egg" in item_name:
|
||||
return WitnessItem.make_egg_event(item_name, self.player)
|
||||
|
||||
# this conditional is purely for unit tests, which need to be able to create an item before generate_early
|
||||
item_data: ItemData
|
||||
if hasattr(self, "player_items") and self.player_items and item_name in self.player_items.item_data:
|
||||
@@ -389,6 +393,18 @@ class WitnessWorld(World):
|
||||
|
||||
return WitnessItem(item_name, item_data.classification, item_data.ap_code, player=self.player)
|
||||
|
||||
def collect(self, state: "CollectionState", item: WitnessItem) -> bool:
|
||||
changed = super().collect(state, item)
|
||||
if changed and item.eggs:
|
||||
state.prog_items[self.player]["Egg"] += item.eggs
|
||||
return changed
|
||||
|
||||
def remove(self, state: "CollectionState", item: WitnessItem) -> bool:
|
||||
changed = super().remove(state, item)
|
||||
if changed and item.eggs:
|
||||
state.prog_items[self.player]["Egg"] -= item.eggs
|
||||
return changed
|
||||
|
||||
def get_filler_item_name(self) -> str:
|
||||
return "Speed Boost"
|
||||
|
||||
@@ -398,11 +414,9 @@ class WitnessLocation(Location):
|
||||
Archipelago Location for The Witness
|
||||
"""
|
||||
game: str = "The Witness"
|
||||
entity_hex: int = -1
|
||||
|
||||
def __init__(self, player: int, name: str, address: Optional[int], parent: Region, ch_hex: int = -1) -> None:
|
||||
def __init__(self, player: int, name: str, address: Optional[int], parent: Region) -> None:
|
||||
super().__init__(player, name, address, parent)
|
||||
self.entity_hex = ch_hex
|
||||
|
||||
|
||||
def create_region(world: WitnessWorld, name: str, player_locations: WitnessPlayerLocations,
|
||||
@@ -416,14 +430,13 @@ def create_region(world: WitnessWorld, name: str, player_locations: WitnessPlaye
|
||||
for location in region_locations:
|
||||
loc_id = player_locations.CHECK_LOCATION_TABLE[location]
|
||||
|
||||
entity_hex = -1
|
||||
location_obj = WitnessLocation(world.player, location, loc_id, ret)
|
||||
|
||||
if location in static_witness_logic.ENTITIES_BY_NAME:
|
||||
entity_hex = int(
|
||||
static_witness_logic.ENTITIES_BY_NAME[location]["entity_hex"], 0
|
||||
)
|
||||
location_obj = WitnessLocation(
|
||||
world.player, location, loc_id, ret, entity_hex
|
||||
)
|
||||
entity_hex = static_witness_logic.ENTITIES_BY_NAME[location]["entity_hex"]
|
||||
|
||||
if entity_hex in world.player_logic.EXCLUDED_ENTITIES:
|
||||
location_obj.progress_type = LocationProgressType.EXCLUDED
|
||||
|
||||
ret.locations.append(location_obj)
|
||||
if exits:
|
||||
|
||||
Reference in New Issue
Block a user