LambdaHack-0.10.2.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.Level

Description

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

Synopsis

Dungeon

type Dungeon = EnumMap LevelId Level Source #

The complete dungeon is a map from level identifiers to levels.

ascendInBranch :: Dungeon -> Bool -> LevelId -> [LevelId] Source #

Levels in the current branch, one level up (or down) from the current.

whereTo Source #

Arguments

:: LevelId

level of the stairs

-> Point

position of the stairs

-> Bool

optional forced direction

-> Dungeon

current game dungeon

-> [(LevelId, Point)]

possible destinations

Compute the level identifier and stair position on the new level, after a level change.

We assume there is never a staircase up and down at the same position.

The Level type and its components

type ItemFloor = EnumMap Point ItemBag Source #

Items located on map tiles.

type BigActorMap = EnumMap Point ActorId Source #

Big actors located on map tiles.

type ProjectileMap = EnumMap Point [ActorId] Source #

Collections of projectiles located on map tiles.

type TileMap = Array (ContentId TileKind) Source #

Tile kinds on the map.

type SmellMap = EnumMap Point Time Source #

Current smell on map tiles.

data Level Source #

A view on single, inhabited dungeon level. Remembered fields carry a subset of the info in the client copies of levels.

Constructors

Level 

Fields

Instances

Instances details
Eq Level Source # 
Instance details

Defined in Game.LambdaHack.Common.Level

Methods

(==) :: Level -> Level -> Bool #

(/=) :: Level -> Level -> Bool #

Show Level Source # 
Instance details

Defined in Game.LambdaHack.Common.Level

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

Binary Level Source # 
Instance details

Defined in Game.LambdaHack.Common.Level

Methods

put :: Level -> Put #

get :: Get Level #

putList :: [Level] -> Put #

Component updates

Level query

at :: Level -> Point -> ContentId TileKind Source #

Query for tile kinds on the map.

findPosTry Source #

Arguments

:: Int

the number of tries

-> Level

look up in this level

-> (Point -> ContentId TileKind -> Bool)

mandatory predicate

-> [Point -> ContentId TileKind -> Bool]

optional predicates

-> Rnd (Maybe Point) 

Try to find a random position on the map satisfying conjunction of the mandatory and an optional predicate. If the permitted number of attempts is not enough, try again the same number of times without the next optional predicate, and fall back to trying with only the mandatory predicate.

findPosTry2 Source #

Arguments

:: Int

the number of tries

-> Level

look up in this level

-> (Point -> ContentId TileKind -> Bool)

mandatory predicate

-> [Point -> ContentId TileKind -> Bool]

optional predicates

-> (Point -> ContentId TileKind -> Bool)

good to have pred.

-> [Point -> ContentId TileKind -> Bool]

worst case predicates

-> Rnd (Maybe Point) 

nearbyPassablePoints :: COps -> Level -> Point -> [Point] Source #

Generate a list of all passable points on (connected component of) the level in the order of path distance from the starting position (BFS). The starting position needn't be passable and is always included.

Misc

Internal operations

type EntryMap = EnumMap Point PlaceEntry Source #

Entries of places on the map.