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
- isSecretPos :: Level -> Point -> Bool
- hideTile :: Ops TileKind -> Level -> Point -> 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
data LevelId
Abstract level identifiers.
ascendInBranch :: Dungeon -> LevelId -> Int -> [LevelId]
Levels in the current branch, k
levels shallower than the current.
Item containers
data Container
Item container type.
The Level
type and its components
data Level
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 -> Level
Update the actor time priority queue.
updateSmell :: (SmellMap -> SmellMap) -> Level -> Level
Update the smell map.
updateFloor :: (ItemFloor -> ItemFloor) -> Level -> Level
Update the items on the ground map.
updateTile :: (TileMap -> TileMap) -> Level -> Level
Update the tile map.
Level query
accessible :: COps -> Level -> Point -> Point -> Bool
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 -> Bool
Check whether actors can move from a position along a unit vector, using the formula from the standard ruleset.
isSecretPos :: Level -> Point -> Bool
findPos :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd Point
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 ()
mapDungeonActors_ :: Monad m => (ActorId -> m a) -> Dungeon -> m ()