Safe Haskell | None |
---|
Game.LambdaHack.Level
Description
Inhabited dungeon levels and the operations to query and change them as the game progresses.
- type Party = IntMap Actor
- type PartyItem = IntMap [Item]
- type SmellMap = IntMap SmellTime
- type SecretMap = IntMap SecretStrength
- type ItemMap = IntMap ([Item], [Item])
- type TileMap = Array Point TileKind
- data Level = Level {}
- updateHeroes :: (Party -> Party) -> Level -> Level
- updateMonsters :: (Party -> Party) -> Level -> Level
- updateHeroItem :: (PartyItem -> PartyItem) -> Level -> Level
- updateMonItem :: (PartyItem -> PartyItem) -> 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]
- stdRuleset :: Ops RuleKind -> RuleKind
- accessible :: COps -> Level -> Point -> Point -> Bool
- openable :: Ops TileKind -> Level -> SecretStrength -> 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 SecretStrengthSource
Current secrecy value on map tiles.
A single, inhabited dungeon level.
Constructors
Level | |
Fields
|
Level update
updateHeroItem :: (PartyItem -> PartyItem) -> Level -> LevelSource
Update the hero items and monster items maps.
updateMonItem :: (PartyItem -> PartyItem) -> 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.
stdRuleset :: Ops RuleKind -> RuleKindSource
The standard ruleset used for level operations.
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 -> SecretStrength -> 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.
Arguments
:: 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.