Item Plando Support

This commit is contained in:
Fabian Dill
2021-01-02 12:49:43 +01:00
parent 3d53adf45c
commit f3b6be2b20
9 changed files with 171 additions and 74 deletions

View File

@@ -5,7 +5,7 @@ from enum import Enum, unique
import logging
import json
from collections import OrderedDict, Counter, deque
from typing import Union, Optional, List, Set, Dict
from typing import Union, Optional, List, Set, Dict, NamedTuple
import secrets
import random
@@ -16,7 +16,7 @@ from Items import item_name_groups
class World(object):
debug_types = False
player_names: list
player_names: Dict[int, List[str]]
_region_cache: dict
difficulty_requirements: dict
required_medallions: dict
@@ -135,6 +135,7 @@ class World(object):
set_player_attr('sprite_pool', [])
set_player_attr('dark_room_logic', "lamp")
set_player_attr('restrict_dungeon_item_on_boss', False)
set_player_attr('plando_items', [])
def secure(self):
self.random = secrets.SystemRandom()
@@ -1037,6 +1038,9 @@ class Item(object):
self.world = None
self.player = player
def __eq__(self, other):
return self.name == other.name and self.player == other.player
@property
def crystal(self) -> bool:
return self.type == 'Crystal'
@@ -1452,3 +1456,10 @@ class Spoiler(object):
path_listings.append("{}\n {}".format(location, "\n => ".join(path_lines)))
outfile.write('\n'.join(path_listings))
class PlandoItem(NamedTuple):
item: str
location: str
world: Union[bool, str] = False # False -> own world, True -> not own world
from_pool: bool = True # if item should be removed from item pool