Safe Haskell | None |
---|
Inhabited dungeon levels and the operations to query and change them as the game progresses.
- type ActorDict = IntMap Actor
- type InvDict = IntMap [Item]
- type SmellMap = IntMap SmellTime
- type SecretMap = IntMap SecretTime
- type ItemMap = IntMap ([Item], [Item])
- type TileMap = Array Point TileKind
- data Level = Level {}
- updateActorDict :: (ActorDict -> ActorDict) -> Level -> Level
- updateInv :: (InvDict -> InvDict) -> Level -> Level
- updateSmell :: (SmellMap -> SmellMap) -> Level -> Level
- updateIMap :: (ItemMap -> ItemMap) -> Level -> Level
- updateLMap :: (TileMap -> TileMap) -> Level -> Level
- updateLRMap :: (TileMap -> TileMap) -> Level -> Level
- dropItemsAt :: [Item] -> Point -> Level -> Level
- at :: Level -> Point -> Id TileKind
- rememberAt :: Level -> Point -> Id TileKind
- atI :: Level -> Point -> [Item]
- rememberAtI :: Level -> Point -> [Item]
- accessible :: COps -> Level -> Point -> Point -> Bool
- openable :: Ops TileKind -> Level -> SecretTime -> Point -> Bool
- findLoc :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd Point
- findLocTry :: Int -> TileMap -> [Point -> Id TileKind -> Bool] -> Rnd Point
The Level
type and its components
type SecretMap = IntMap SecretTimeSource
Current secrecy value on map tiles.
A single, inhabited dungeon level.
Level | |
|
Level update
updateActorDict :: (ActorDict -> ActorDict) -> Level -> LevelSource
Update the hero and monster maps.
updateInv :: (InvDict -> InvDict) -> Level -> LevelSource
Update the hero items and monster items maps.
updateLRMap :: (TileMap -> TileMap) -> Level -> LevelSource
Update the tile and remembered tile maps.
dropItemsAt :: [Item] -> Point -> Level -> LevelSource
Place all items on the list at a location on the level.
Level query
rememberAt :: Level -> Point -> Id TileKindSource
Query for actual and remembered tile kinds on the map.
rememberAtI :: Level -> Point -> [Item]Source
Query for actual and remembered items on the ground.
accessible :: COps -> Level -> Point -> Point -> BoolSource
Check whether one location is accessible from another, using the formula from the standard ruleset.
openable :: Ops TileKind -> Level -> SecretTime -> Point -> BoolSource
Check whether the location contains a door of secrecy lower than k
and that can be opened according to the standard ruleset.
findLoc :: TileMap -> (Point -> Id TileKind -> Bool) -> Rnd PointSource
Find a random location 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 location on the map satisfying the conjunction of the list of predicates. If the premitted 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.