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

Safe HaskellNone




Weapons, treasure and all the other items in the game. No operation in this module involves the State or Action type. TODO: Document after it's rethought and rewritten wrt separating inventory manangement and items proper.


Teh Item type

data ItemId Source

A unique identifier of an item in the dungeon.

data Item Source

Game items in inventories or strewn around the dungeon. The fields jsymbol, jname and jflavour make it possible to refer to and draw an unidentified item. Full information about item is available through the jkindIx index as soon as the item is identified.




jkindIx :: !ItemKindIx

index pointing to the kind of the item

jsymbol :: !Char

individual map symbol

jname :: !Text

individual generic name

jflavour :: !Flavour

individual flavour

jeffect :: !(Effect Int)

the effect when activated

jkind :: Discovery -> Item -> Maybe (Id ItemKind)Source

Recover a kind id of an item, if identified.

buildItem :: FlavourMap -> DiscoRev -> Id ItemKind -> ItemKind -> Effect Int -> ItemSource

Build an item with the given stats.

newItem :: Ops ItemKind -> FlavourMap -> DiscoRev -> Int -> Int -> Rnd (Item, Int, ItemKind)Source

Generate an item based on level.

viewItem :: Item -> (Char, Color)Source

Represent an item on the map.

Inventory search

The item discovery types

data ItemKindIx Source

An index of the kind id of an item. Clients have partial knowledge how these idexes map to kind ids. They gain knowledge by identifying items.

type Discovery = EnumMap ItemKindIx (Id ItemKind)Source

The map of item kind indexes to item kind ids. The full map, as known by the server, is a bijection.

type DiscoRev = EnumMap (Id ItemKind) ItemKindIxSource

The reverse map to Discovery, needed for item creation.

The FlavourMap type

data FlavourMap Source

Flavours assigned by the server to item kinds, in this particular game.

dungeonFlavourMap :: Ops ItemKind -> Rnd FlavourMapSource

Randomly chooses flavour for all item kinds for this game.

Textual description

partItem :: Ops ItemKind -> Discovery -> Item -> (Part, Part)Source

The part of speech describing the item.