LambdaHack-0.2.0: A roguelike game engine in early and very 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 Party = IntMap ActorSource

All actors of a given side on the level.

type PartyItem = IntMap [Item]Source

Items carried by each party member.

type SmellMap = IntMap SmellTimeSource

Current smell on map tiles.

type SecretMap = IntMap SecretStrengthSource

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

lheroes :: Party

all heroes on the level

lheroItem :: PartyItem

hero items

lxsize :: X

width of the level

lysize :: Y

height of the level

lmonsters :: Party

all monsters on the level

lmonItem :: PartyItem

monster items

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

Instances

Level update

updateHeroes :: (Party -> Party) -> Level -> LevelSource

Update the hero and monster maps.

updateMonsters :: (Party -> Party) -> Level -> LevelSource

Update the hero and monster maps.

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.

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.

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.

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.