mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
DOOM 1993: Update to use new Options + logic fixes + Doc fix (#3138)
This commit is contained in:
@@ -2,9 +2,10 @@ import functools
|
||||
import logging
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from BaseClasses import Entrance, CollectionState, Item, ItemClassification, Location, MultiWorld, Region, Tutorial
|
||||
from BaseClasses import Entrance, CollectionState, Item, Location, MultiWorld, Region, Tutorial
|
||||
from worlds.AutoWorld import WebWorld, World
|
||||
from . import Items, Locations, Maps, Options, Regions, Rules
|
||||
from . import Items, Locations, Maps, Regions, Rules
|
||||
from .Options import DOOM1993Options
|
||||
|
||||
logger = logging.getLogger("DOOM 1993")
|
||||
|
||||
@@ -37,7 +38,8 @@ class DOOM1993World(World):
|
||||
Developed by id Software, and originally released in 1993, DOOM pioneered and popularized the first-person shooter,
|
||||
setting a standard for all FPS games.
|
||||
"""
|
||||
option_definitions = Options.options
|
||||
options_dataclass = DOOM1993Options
|
||||
options: DOOM1993Options
|
||||
game = "DOOM 1993"
|
||||
web = DOOM1993Web()
|
||||
data_version = 3
|
||||
@@ -78,26 +80,28 @@ class DOOM1993World(World):
|
||||
"Energy cell pack": 10
|
||||
}
|
||||
|
||||
def __init__(self, world: MultiWorld, player: int):
|
||||
def __init__(self, multiworld: MultiWorld, player: int):
|
||||
self.included_episodes = [1, 1, 1, 0]
|
||||
self.location_count = 0
|
||||
|
||||
super().__init__(world, player)
|
||||
super().__init__(multiworld, player)
|
||||
|
||||
def get_episode_count(self):
|
||||
return functools.reduce(lambda count, episode: count + episode, self.included_episodes)
|
||||
|
||||
def generate_early(self):
|
||||
# Cache which episodes are included
|
||||
for i in range(4):
|
||||
self.included_episodes[i] = getattr(self.multiworld, f"episode{i + 1}")[self.player].value
|
||||
self.included_episodes[0] = self.options.episode1.value
|
||||
self.included_episodes[1] = self.options.episode2.value
|
||||
self.included_episodes[2] = self.options.episode3.value
|
||||
self.included_episodes[3] = self.options.episode4.value
|
||||
|
||||
# If no episodes selected, select Episode 1
|
||||
if self.get_episode_count() == 0:
|
||||
self.included_episodes[0] = 1
|
||||
|
||||
def create_regions(self):
|
||||
pro = getattr(self.multiworld, "pro")[self.player].value
|
||||
pro = self.options.pro.value
|
||||
|
||||
# Main regions
|
||||
menu_region = Region("Menu", self.player, self.multiworld)
|
||||
@@ -148,7 +152,7 @@ class DOOM1993World(World):
|
||||
|
||||
def completion_rule(self, state: CollectionState):
|
||||
goal_levels = Maps.map_names
|
||||
if getattr(self.multiworld, "goal")[self.player].value:
|
||||
if self.options.goal.value:
|
||||
goal_levels = self.boss_level_for_espidoes
|
||||
|
||||
for map_name in goal_levels:
|
||||
@@ -167,8 +171,8 @@ class DOOM1993World(World):
|
||||
return True
|
||||
|
||||
def set_rules(self):
|
||||
pro = getattr(self.multiworld, "pro")[self.player].value
|
||||
allow_death_logic = getattr(self.multiworld, "allow_death_logic")[self.player].value
|
||||
pro = self.options.pro.value
|
||||
allow_death_logic = self.options.allow_death_logic.value
|
||||
|
||||
Rules.set_rules(self, self.included_episodes, pro)
|
||||
self.multiworld.completion_condition[self.player] = lambda state: self.completion_rule(state)
|
||||
@@ -185,7 +189,7 @@ class DOOM1993World(World):
|
||||
|
||||
def create_items(self):
|
||||
itempool: List[DOOM1993Item] = []
|
||||
start_with_computer_area_maps: bool = getattr(self.multiworld, "start_with_computer_area_maps")[self.player].value
|
||||
start_with_computer_area_maps: bool = self.options.start_with_computer_area_maps.value
|
||||
|
||||
# Items
|
||||
for item_id, item in Items.item_table.items():
|
||||
@@ -225,7 +229,7 @@ class DOOM1993World(World):
|
||||
self.multiworld.push_precollected(self.create_item(self.starting_level_for_episode[i]))
|
||||
|
||||
# Give Computer area maps if option selected
|
||||
if getattr(self.multiworld, "start_with_computer_area_maps")[self.player].value:
|
||||
if self.options.start_with_computer_area_maps.value:
|
||||
for item_id, item_dict in Items.item_table.items():
|
||||
item_episode = item_dict["episode"]
|
||||
if item_episode > 0:
|
||||
@@ -269,7 +273,7 @@ class DOOM1993World(World):
|
||||
itempool.append(self.create_item(item_name))
|
||||
|
||||
def fill_slot_data(self) -> Dict[str, Any]:
|
||||
slot_data = {name: getattr(self.multiworld, name)[self.player].value for name in self.option_definitions}
|
||||
slot_data = self.options.as_dict("goal", "difficulty", "random_monsters", "random_pickups", "random_music", "flip_levels", "allow_death_logic", "pro", "start_with_computer_area_maps", "death_link", "reset_level_on_death", "episode1", "episode2", "episode3", "episode4")
|
||||
|
||||
# E2M6 and E3M9 each have one way keydoor. You can enter, but required the keycard to get out.
|
||||
# We used to force place the keycard behind those doors. Limiting the randomness for those items. A change
|
||||
|
Reference in New Issue
Block a user