def load(self, valids: Valids, isSubEvent: bool=False): self.checks = [] valids.addCharShort(self.getCharShort()) super().load(valids, ALLCHECKCLASSES, self.checks) self.isSubEvent = isSubEvent if not self.isSubEvent: if (not any([type(check) == AliveCheck for check in self.checks])): self.checks.insert(0, AliveCheck(valids, AliveCheck.ALIVE)) if (not any([type(check) == RoundCheck for check in self.checks])): self.checks.insert(0, RoundCheck(valids, None, "!", 1))
def load(self, valids: Valids, isSub: bool = False): try: print(self.name) if self.checkSuites: mainCheckSuite = self.checkSuites[0] mainCheckSuite.load(valids, isSub) for checkSuite in self.checkSuites[1:]: checkSuite.load(valids, isSub) checkSuite.addNearbyCheckIfNeeded(valids) for effectSuite in self.effectSuites: effectSuite.load(valids) for subEvent in self.sub: subEvent.load(valids, True) for text in self.texts: valids.validateText(text) except ValidationException as e: raise Exception( f"Encountered an exception when loading Event \"{self.name}\": {e}" )
def loadGameWithSettings(self, characters: list[str], items: list[str], map: str, events: list[str]) -> Game: loadedCharacters: dict[str, Character] = All.load(characters, self.characters) loadedItems: dict[str, Item] = All.load(items, self.items) loadedMap: Map = All.loadOne(map, self.maps) loadedEvents: dict[str, Event] = All.load(events, self.events) for event in loadedEvents.values(): valids = Valids(loadedMap, loadedItems) event.load(valids) return Game(loadedItems, loadedEvents, loadedCharacters, loadedMap)
def __init__(self, valids: Valids, *args: str): _, zoneName, = args self.zone = None if zoneName: self.zone = valids.getLoadedZoneWithName(zoneName)
def __init__(self, valids: Valids, *args: str): _, self.newItemShort, troveName = args self.trove = valids.getLoadedTroveWithName(troveName)
def __init__(self, valids: Valids, *args: str): _, self.itemShort, self.itemName = args self.items = [valids.getLoadedItemWithName(self.itemName)]
def __init__(self, valids: Valids, *args: str): _, self.itemShort, *itemTags = args self.itemTags = itemTags self.items: list[Item] = valids.getLoadedItemsWithTags(self.itemTags)