LambdaHack-0.9.5.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.Item

Contents

Description

Weapons, treasure and all the other items in the game.

Synopsis

Documentation

data Item Source #

Game items in actor possesion or strewn around the dungeon. The information contained in this time is available to the player from the moment the item is first seen and is never mutated.

Some items are not created identified (IdentityCovered). Then they are presented as having a template kind that is really not their own, though usually close. Full kind information about item's kind is available through the ItemKindIx index once the item is identified and full information about the value of item's aspect record is available elsewhere (both IdentityObvious and IdentityCovered items may or may not need identification of their aspect record).

Constructors

Item 

Fields

  • jkind :: ItemIdentity

    the kind of the item, or an indiretion

  • jfid :: Maybe FactionId

    the faction that created the item, if any

  • jflavour :: Flavour

    flavour, always the real one, not hidden; people may not recognize shape, but they remember colour and old vs fancy look

Instances
Eq Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

(==) :: Item -> Item -> Bool #

(/=) :: Item -> Item -> Bool #

Show Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

Generic Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Associated Types

type Rep Item :: Type -> Type #

Methods

from :: Item -> Rep Item x #

to :: Rep Item x -> Item #

Binary Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

put :: Item -> Put #

get :: Get Item #

putList :: [Item] -> Put #

Hashable Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

hashWithSalt :: Int -> Item -> Int #

hash :: Item -> Int #

type Rep Item Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemIdentity Source #

Either the explicit obvious kind of the item or the kind it's hidden under, with the details covered under the index indirection.

Instances
Eq ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Show ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Generic ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Associated Types

type Rep ItemIdentity :: Type -> Type #

Binary ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Hashable ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

type Rep ItemIdentity Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemKindIx Source #

An index of the kind identifier of an item. Clients have partial knowledge how these idexes map to kind ids. They gain knowledge by identifying items. The indexes and kind identifiers are 1-1.

Instances
Enum ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Eq ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Ord ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Show ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Ix ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Binary ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Hashable ItemKindIx Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemDisco Source #

The secret part of the information about an item. If a faction knows the aspect record of the item, this is the complete secret information. Items that don't need second identification (the kmConst flag is set) may be identified or not and both cases are OK (their display flavour will differ and that may be the point).

data ItemFull Source #

Full information about an item.

Instances
Show ItemFull Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

type DiscoveryKind = EnumMap ItemKindIx (ContentId ItemKind) Source #

The map of item kind indexes to item kind ids. The full map, as known by the server, is 1-1. Because it's sparse and changes, we don't represent it as an (unboxed) vector, until it becomes a bottleneck (if ever, likely on JS, where only vectors are fast).

type DiscoveryAspect = EnumMap ItemId AspectRecord Source #

The map of item ids to item aspect reocrd. The full map is known by the server.

type ItemIxMap = EnumMap ItemKindIx (EnumSet ItemId) Source #

The map of item kind indexes to identifiers of items that have that kind. Used to update data about items when their kinds become known, e.g., AI item use benefit data.

data Benefit Source #

The fields are, in order: 1. whether the item should be kept in equipment (not in pack nor stash) 2. the total benefit from picking the item up (to use or to put in equipment) 3. the benefit of applying the item to self 4. the (usually negative, for him) value of hitting a foe in melee with it 5. the (usually negative, for him) value of flinging the item at an opponent

Instances
Show Benefit Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Generic Benefit Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Associated Types

type Rep Benefit :: Type -> Type #

Methods

from :: Benefit -> Rep Benefit x #

to :: Rep Benefit x -> Benefit #

Binary Benefit Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

put :: Benefit -> Put #

get :: Get Benefit #

putList :: [Benefit] -> Put #

type Rep Benefit Source # 
Instance details

Defined in Game.LambdaHack.Common.Item

type ItemQuant = (Int, ItemTimer) Source #

Number of items in a bag, together with recharging timer, in case of items that need recharging, exists only temporarily or auto-activate at regular intervals.

type ItemBag = EnumMap ItemId ItemQuant Source #

A bag of items, e.g., one of the stores of an actor or the items on a particular floor position or embedded in a particular map tile.

type ItemDict = EnumMap ItemId Item Source #

All items in the dungeon (including in actor inventories), indexed by item identifier.

Internal operations