LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




Creation of items on the server. Types and operations that don't involve server state nor our custom monads.



type ItemKnown = (ItemKindIx, AspectRecord, Dice, Maybe FactionId) Source #

The essential item properties, used for the ItemRev hash table from items to their ids, needed to assign ids to newly generated items. All the other meaningul properties can be derived from them. Note 1: jlid is not meaningful; it gets forgotten if items from different levels roll the same random properties and so are merged. However, the first item generated by the server wins, which is most of the time the lower jlid item, which makes sense for the client. Note 2: ItemSeed instead of AspectRecord is not enough, becaused different seeds may result in the same AspectRecord and we don't want such items to be distinct in UI and elsewhere.

type ItemRev = HashMap ItemKnown ItemId Source #

Reverse item map, for item creation, to keep items and item identifiers in bijection.

buildItem :: FlavourMap -> DiscoveryKindRev -> Id ItemKind -> ItemKind -> LevelId -> Dice -> Item Source #

Build an item with the given stats.

Item discovery types

type DiscoveryKindRev = EnumMap (Id ItemKind) ItemKindIx Source #

The reverse map to DiscoveryKind, needed for item creation.

type ItemSeedDict = EnumMap ItemId ItemSeed Source #

The map of item ids to item seeds, needed for item creation.

The FlavourMap type

data FlavourMap Source #

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

dungeonFlavourMap :: COps -> Rnd FlavourMap Source #

Randomly chooses flavour for all item kinds for this game.