LambdaHack-0.8.3.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 ItemId #

A unique identifier of an item in the dungeon.

Instances
Enum ItemId # 
Instance details

Defined in Game.LambdaHack.Common.Item

Eq ItemId # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

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

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

Ord ItemId # 
Instance details

Defined in Game.LambdaHack.Common.Item

Show ItemId # 
Instance details

Defined in Game.LambdaHack.Common.Item

Binary ItemId # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

put :: ItemId -> Put #

get :: Get ItemId #

putList :: [ItemId] -> Put #

data Item #

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

  • jlid :: LevelId

    lowest level the item was created at

  • 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 # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

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

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

Show Item # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

Generic Item # 
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 # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

put :: Item -> Put #

get :: Get Item #

putList :: [Item] -> Put #

Hashable Item # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

hashWithSalt :: Int -> Item -> Int #

hash :: Item -> Int #

type Rep Item # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemIdentity #

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 # 
Instance details

Defined in Game.LambdaHack.Common.Item

Show ItemIdentity # 
Instance details

Defined in Game.LambdaHack.Common.Item

Generic ItemIdentity # 
Instance details

Defined in Game.LambdaHack.Common.Item

Associated Types

type Rep ItemIdentity :: Type -> Type #

Binary ItemIdentity # 
Instance details

Defined in Game.LambdaHack.Common.Item

Hashable ItemIdentity # 
Instance details

Defined in Game.LambdaHack.Common.Item

type Rep ItemIdentity # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemKindIx #

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 # 
Instance details

Defined in Game.LambdaHack.Common.Item

Eq ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

Ord ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

Show ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

Ix ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

Binary ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

Hashable ItemKindIx # 
Instance details

Defined in Game.LambdaHack.Common.Item

data ItemDisco #

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

The itemAspect accessor it to be used unconditionally only on the server where it's guaranteed to be safe.

data ItemFull #

Full information about an item.

Instances
Show ItemFull # 
Instance details

Defined in Game.LambdaHack.Common.Item

type DiscoveryKind = EnumMap ItemKindIx (ContentId ItemKind) #

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 #

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

type ItemIxMap = EnumMap ItemKindIx (EnumSet ItemId) #

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 #

Fields are intentionally kept non-strict, because they are recomputed often, but not used every time. 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) benefit of hitting a foe in meleeing with the item 5. the (usually negative) benefit of flinging an item at an opponent

Constructors

Benefit 
Instances
Show Benefit # 
Instance details

Defined in Game.LambdaHack.Common.Item

Generic Benefit # 
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 # 
Instance details

Defined in Game.LambdaHack.Common.Item

Methods

put :: Benefit -> Put #

get :: Get Benefit #

putList :: [Benefit] -> Put #

type Rep Benefit # 
Instance details

Defined in Game.LambdaHack.Common.Item

type Rep Benefit = D1 (MetaData "Benefit" "Game.LambdaHack.Common.Item" "LambdaHack-0.8.3.0-1NVXOytHwux3AEZcvJHaGA" False) (C1 (MetaCons "Benefit" PrefixI True) ((S1 (MetaSel (Just "benInEqp") NoSourceUnpackedness SourceLazy DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "benPickup") NoSourceUnpackedness SourceLazy DecidedLazy) (Rec0 Double)) :*: (S1 (MetaSel (Just "benApply") NoSourceUnpackedness SourceLazy DecidedLazy) (Rec0 Double) :*: (S1 (MetaSel (Just "benMelee") NoSourceUnpackedness SourceLazy DecidedLazy) (Rec0 Double) :*: S1 (MetaSel (Just "benFling") NoSourceUnpackedness SourceLazy DecidedLazy) (Rec0 Double)))))

type ItemTimer = [Time] #

type ItemQuant = (Int, ItemTimer) #

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 #

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 #

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

Internal operations