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 -> 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
data ItemId
A unique identifier of an item in the dungeon.
data Item
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 -> Item
Build an item with the given stats.
newItem :: Ops ItemKind -> FlavourMap -> DiscoRev -> Int -> Int -> Rnd (Item, Int, ItemKind)
Generate an item based on level.
Inventory search
The item discovery types
data ItemKindIx
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.
Enum ItemKindIx | |
Eq ItemKindIx | |
Ord ItemKindIx | |
Show ItemKindIx | |
Ix ItemKindIx | |
Binary ItemKindIx | |
Hashable ItemKindIx |
type Discovery = EnumMap ItemKindIx (Id ItemKind)
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) ItemKindIx
The reverse map to Discovery
, needed for item creation.
The FlavourMap
type
data FlavourMap
Flavours assigned by the server to item kinds, in this particular game.
Show FlavourMap | |
Binary FlavourMap |
dungeonFlavourMap :: Ops ItemKind -> Rnd FlavourMap
Randomly chooses flavour for all item kinds for this game.
Textual description
partItem :: Ops ItemKind -> Discovery -> Item -> (Part, Part)
The part of speech describing the item.
partItemAW :: Ops ItemKind -> Discovery -> Item -> Part