Safe Haskell | None |
---|
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.
- data ItemId
- data Item = Item {}
- jkind :: Discovery -> Item -> Maybe (Id ItemKind)
- buildItem :: FlavourMap -> DiscoRev -> Id ItemKind -> ItemKind -> Effect Int -> Item
- newItem :: Ops ItemKind -> FlavourMap -> DiscoRev -> Frequency Text -> Int -> Int -> Rnd (Item, Int, ItemKind)
- viewItem :: Item -> (Char, Color)
- strongestSearch :: [(ItemId, Item)] -> Maybe (Int, (ItemId, Item))
- strongestSword :: COps -> [(ItemId, Item)] -> Maybe (Int, (ItemId, Item))
- strongestRegen :: [(ItemId, Item)] -> Maybe (Int, (ItemId, Item))
- data ItemKindIx
- type Discovery = EnumMap ItemKindIx (Id ItemKind)
- type DiscoRev = EnumMap (Id ItemKind) ItemKindIx
- serverDiscos :: Ops ItemKind -> Rnd (Discovery, DiscoRev)
- data FlavourMap
- emptyFlavourMap :: FlavourMap
- dungeonFlavourMap :: Ops ItemKind -> Rnd FlavourMap
- partItem :: Ops ItemKind -> Discovery -> Item -> (Part, Part)
- partItemWs :: Ops ItemKind -> Discovery -> Int -> Item -> Part
- partItemAW :: Ops ItemKind -> Discovery -> Item -> Part
Teh Item
type
A unique identifier of an item in the dungeon.
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.
buildItem :: FlavourMap -> DiscoRev -> Id ItemKind -> ItemKind -> Effect Int -> ItemSource
Build an item with the given stats.
newItem :: Ops ItemKind -> FlavourMap -> DiscoRev -> Frequency Text -> Int -> Int -> Rnd (Item, Int, ItemKind)Source
Generate an item based on level.
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.