LambdaHack-0.2.6: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Level

Contents

Description

Inhabited dungeon levels and the operations to query and change them as the game progresses.

Synopsis

The Level type and its components

type ActorDict = IntMap ActorSource

All actors on the level, indexed by actor identifier.

type InvDict = IntMap [Item]Source

Items carried by actors, indexed by actor identifier.

type SmellMap = IntMap SmellTimeSource

Current smell on map tiles.

type SecretMap = IntMap SecretTimeSource

Current secrecy value on map tiles.

type ItemMap = IntMap ([Item], [Item])Source

Actual and remembered item lists on map tiles.

type TileMap = Array Point TileKindSource

Tile kinds on the map.

data Level Source

A single, inhabited dungeon level.

Constructors

Level 

Fields

lactor :: ActorDict

all actors on the level

linv :: InvDict

items belonging to actors

lxsize :: X

width of the level

lysize :: Y

height of the level

lsmell :: SmellMap

smells

lsecret :: SecretMap

secrecy values

litem :: ItemMap

items on the ground

lmap :: TileMap

map tiles

lrmap :: TileMap

remembered map tiles

ldesc :: String

level description for the player

lmeta :: String

debug information from cave generation

lstairs :: (Point, Point)

destination of the (up, down) stairs

ltime :: Time

date of the last activity on the level

lclear :: Int

total number of clear tiles

lseen :: Int

number of clear tiles already seen

Instances

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.

updateSmell :: (SmellMap -> SmellMap) -> Level -> LevelSource

Update the smell map.

updateIMap :: (ItemMap -> ItemMap) -> Level -> LevelSource

Update the items on the ground map.

updateLMap :: (TileMap -> TileMap) -> Level -> LevelSource

Update the tile and remembered tile 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

at :: Level -> Point -> Id TileKindSource

Query for actual and remembered tile kinds on the map.

rememberAt :: Level -> Point -> Id TileKindSource

Query for actual and remembered tile kinds on the map.

atI :: Level -> Point -> [Item]Source

Query for actual and remembered items on the ground.

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.

findLocTrySource

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.