Safe Haskell | None |
---|
Inhabited dungeon levels and the operations to query and change them as the game progresses.
- data LevelId
- type Dungeon = EnumMap LevelId Level
- ascendInBranch :: Dungeon -> LevelId -> Int -> [LevelId]
- data Container
- type SmellMap = EnumMap Point SmellTime
- type ItemFloor = EnumMap Point ItemBag
- type TileMap = Array Point TileKind
- data Level = Level {}
- updatePrio :: (ActorPrio -> ActorPrio) -> Level -> Level
- updateSmell :: (SmellMap -> SmellMap) -> Level -> Level
- updateFloor :: (ItemFloor -> ItemFloor) -> Level -> Level
- updateTile :: (TileMap -> TileMap) -> Level -> Level
- at :: Level -> Point -> Id TileKind
- atI :: Level -> Point -> ItemBag
- accessible :: COps -> Level -> Point -> Point -> Bool
- accessibleDir :: COps -> Level -> Point -> Vector -> Bool
- hideTile :: Ops TileKind -> Point -> Level -> Id TileKind
- findPos :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd Point
- findPosTry :: Int -> TileMap -> [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.
ascendInBranch :: Dungeon -> LevelId -> Int -> [LevelId]Source
Levels in the current branch, k
levels shallower than the current.
Item containers
Item container type.
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 update
updatePrio :: (ActorPrio -> ActorPrio) -> Level -> LevelSource
Update the actor time priority queue.
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.
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.
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] | predicates to satisfy |
-> 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