Safe Haskell | None |
---|
Inhabited dungeon levels and the operations to query and change them as the game progresses.
- data LevelId
- data AbsDepth
- type Dungeon = EnumMap LevelId Level
- ascendInBranch :: Dungeon -> Int -> LevelId -> [LevelId]
- data Level = Level {
- ldepth :: !AbsDepth
- lprio :: !ActorPrio
- lfloor :: !ItemFloor
- ltile :: !TileMap
- lxsize :: !X
- lysize :: !Y
- lsmell :: !SmellMap
- ldesc :: !Text
- lstair :: !([Point], [Point])
- lseen :: !Int
- lclear :: !Int
- ltime :: !Time
- lactorCoeff :: !Int
- lactorFreq :: !Freqs
- litemNum :: !Int
- litemFreq :: !Freqs
- lsecret :: !Int
- lhidden :: !Int
- lescape :: !Bool
- type ActorPrio = EnumMap Time [ActorId]
- type ItemFloor = EnumMap Point ItemBag
- type TileMap = Array (Id TileKind)
- type SmellMap = EnumMap Point SmellTime
- at :: Level -> Point -> Id TileKind
- atI :: Level -> Point -> ItemBag
- checkAccess :: COps -> Level -> Maybe (Point -> Point -> Bool)
- checkDoorAccess :: COps -> Level -> Maybe (Point -> Point -> Bool)
- accessible :: COps -> Level -> Point -> Point -> Bool
- accessibleUnknown :: COps -> Level -> Point -> Point -> Bool
- accessibleDir :: COps -> Level -> Point -> Vector -> Bool
- knownLsecret :: Level -> Bool
- isSecretPos :: Level -> Point -> Bool
- hideTile :: COps -> Level -> Point -> Id TileKind
- findPos :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd Point
- findPosTry :: Int -> TileMap -> (Point -> Id TileKind -> Bool) -> [Point -> Id TileKind -> Bool] -> Rnd Point
- mapLevelActors_ :: Monad m => (ActorId -> m a) -> Level -> m ()
- mapDungeonActors_ :: Monad m => (ActorId -> m a) -> Dungeon -> m ()
Dungeon
Abstract level identifiers.
Absolute depth in the dungeon. When used for the maximum depth of the whole dungeon, this can be different than dungeon size, e.g., when the dungeon is branched, and it can even be different than the length of the longest branch, if levels at some depths are missing.
ascendInBranch :: Dungeon -> Int -> LevelId -> [LevelId]Source
Levels in the current branch, k
levels shallower than the current.
The Level
type and its components
A view on single, inhabited dungeon level. Remembered fields carry a subset of the info in the client copies of levels.
Level | |
|
Level query
accessible :: COps -> Level -> Point -> Point -> BoolSource
Check whether one position is accessible from another, using the formula from the standard ruleset. Precondition: the two positions are next to each other.
accessibleUnknown :: COps -> Level -> Point -> Point -> BoolSource
Check whether one position is accessible from another, using the formula from the standard ruleset, but additionally treating unknown tiles as walkable. Precondition: the two positions are next to each other.
accessibleDir :: COps -> Level -> Point -> Vector -> BoolSource
Check whether actors can move from a position along a unit vector, using the formula from the standard ruleset.
knownLsecret :: Level -> BoolSource
isSecretPos :: Level -> Point -> BoolSource
findPos :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd PointSource
Find a random position on the map satisfying a predicate.
:: Int | the number of tries |
-> TileMap | look up in this map |
-> (Point -> Id TileKind -> Bool) | mandatory predicate |
-> [Point -> Id TileKind -> Bool] | optional predicates |
-> Rnd Point |
Try to find a random position on the map satisfying the conjunction of the list of predicates. If the permitted number of attempts is not enough, try again the same number of times without the first predicate, then without the first two, etc., until only one predicate remains, at which point try as many times, as needed.
mapLevelActors_ :: Monad m => (ActorId -> m a) -> Level -> m ()Source
mapDungeonActors_ :: Monad m => (ActorId -> m a) -> Dungeon -> m ()Source