Updates to Region tag

Modify Region taging to include a Dungeon Tag
Refactor to use helper methods to make it easier to see the types.
Add an underlying enum for storage on the region class
This commit is contained in:
Kevin Cathcart
2018-01-18 21:51:43 -05:00
parent 8672099a3c
commit c8f1ed28ef
2 changed files with 292 additions and 266 deletions

View File

@@ -1,4 +1,5 @@
import copy
from enum import Enum, unique
import logging
import json
from collections import OrderedDict
@@ -536,11 +537,25 @@ class CollectionState(object):
raise RuntimeError('Cannot parse %s.' % item)
@unique
class RegionType(Enum):
LightWorld = 1
DarkWorld = 2
Cave = 3 # Also includes Houses
Dungeon = 4
@property
def is_indoors(self):
"""Shorthand for checking if Cave or Dungeon"""
return self in (RegionType.Cave, RegionType.Dungeon)
class Region(object):
def __init__(self, name):
def __init__(self, name, type):
self.name = name
self.type = type
self.entrances = []
self.exits = []
self.locations = []