83 lines
2 KiB
Python
83 lines
2 KiB
Python
import dataclasses
|
|
import enum
|
|
|
|
from typing import List
|
|
|
|
from map.treasure_hoard import TreasureHoard
|
|
|
|
|
|
class EncounterType(enum.Enum):
|
|
INACCESSIBLE = 'inaccessible'
|
|
BATTLE_REGULAR = 'battle_regular'
|
|
BATTLE_ELITE = 'battle_elite'
|
|
BATTLE_BOSS = 'battle_boss'
|
|
TOWN_TAVERN = 'town_tavern'
|
|
TOWN_DOCKS = 'town_docks'
|
|
TOWN_MARKET = 'town_market'
|
|
TOWN_LIBRARY = 'town_library'
|
|
TOWN_WORKSHOP = 'town_workshop'
|
|
TOWN_TOWN_HALL = 'town_town_hall'
|
|
TOWN_TEMPLE = 'town_temple'
|
|
TOWN_REST = 'town_rest'
|
|
TOWN_ROAD = 'town_road'
|
|
|
|
|
|
ENCOUNTER_TYPES_BATTLE = [
|
|
EncounterType.BATTLE_REGULAR,
|
|
EncounterType.BATTLE_ELITE,
|
|
EncounterType.BATTLE_BOSS,
|
|
]
|
|
|
|
|
|
ENCOUNTER_TYPES_TOWN = [
|
|
EncounterType.TOWN_TAVERN,
|
|
EncounterType.TOWN_DOCKS,
|
|
EncounterType.TOWN_MARKET,
|
|
EncounterType.TOWN_LIBRARY,
|
|
EncounterType.TOWN_WORKSHOP,
|
|
EncounterType.TOWN_TOWN_HALL,
|
|
EncounterType.TOWN_TEMPLE,
|
|
EncounterType.TOWN_REST,
|
|
EncounterType.TOWN_ROAD,
|
|
]
|
|
|
|
|
|
class QuestPath(enum.Enum):
|
|
NO_PATH = 'no_path'
|
|
FORWARD = 'forward'
|
|
FORWARD_LEFT = 'forward_left'
|
|
FORWARD_RIGHT = 'forward_right'
|
|
|
|
@property
|
|
def description(self):
|
|
return str(self)
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class MapEncounter:
|
|
type: EncounterType
|
|
|
|
@property
|
|
def description(self) -> str:
|
|
return str(self.type)
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class BattleEncounter(MapEncounter):
|
|
treasure_hoard: TreasureHoard
|
|
|
|
@property
|
|
def description(self) -> str:
|
|
return f'{self.type} [{self.treasure_hoard.description}]'
|
|
|
|
|
|
class QuestMap:
|
|
def __init__(self):
|
|
# List of rows of encounters, each row has 3 encounters.
|
|
# Starts with earlier encounter, ends with boss encounter.
|
|
# Inaccessible encounters can be None (like in last line).
|
|
self.encounters: List[List[MapEncounter]] = []
|
|
|
|
# List of rows of straight and diagonal paths, each row has 5 paths:
|
|
# 3 on the columns and 2 between them, sorted from left to right.
|
|
self.paths: List[List[QuestPath]] = []
|