Safe Haskell | None |
---|---|
Language | Haskell2010 |
Weapons, treasure and all the other items in the game.
Synopsis
- data ItemId
- data Item = Item {}
- data ItemIdentity
- data ItemKindIx
- data ItemDisco
- = ItemDiscoMean KindMean
- | ItemDiscoFull { }
- data ItemFull = ItemFull {}
- type ItemFullKit = (ItemFull, ItemQuant)
- type DiscoveryKind = EnumMap ItemKindIx (ContentId ItemKind)
- type DiscoveryAspect = EnumMap ItemId AspectRecord
- type ItemIxMap = EnumMap ItemKindIx (EnumSet ItemId)
- data Benefit = Benefit {}
- type DiscoveryBenefit = EnumMap ItemId Benefit
- type ItemTimer = [Time]
- type ItemQuant = (Int, ItemTimer)
- type ItemBag = EnumMap ItemId ItemQuant
- type ItemDict = EnumMap ItemId Item
- itemToFull6 :: COps -> DiscoveryKind -> DiscoveryAspect -> ItemId -> Item -> ItemFull
- aspectRecordFull :: ItemFull -> AspectRecord
- strongestSlot :: DiscoveryBenefit -> EqpSlot -> [(ItemId, ItemFullKit)] -> [(Int, (ItemId, ItemFullKit))]
- hasCharge :: Time -> ItemFull -> ItemQuant -> Bool
- strongestMelee :: Maybe DiscoveryBenefit -> Time -> [(ItemId, ItemFullKit)] -> [(Double, (ItemId, ItemFullKit))]
- unknownMeleeBonus :: [ItemFull] -> Bool
- tmpMeleeBonus :: [ItemFullKit] -> Int
- unknownAspect :: (Aspect -> [Dice]) -> ItemFull -> Bool
Documentation
A unique identifier of an item in the dungeon.
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 aspects
is available elsewhere (both IdentityObvious
and IdentityCovered
items may or may not need identification of their aspects).
Item | |
|
Instances
Eq Item Source # | |
Show Item Source # | |
Generic Item Source # | |
Binary Item Source # | |
Hashable Item Source # | |
Defined in Game.LambdaHack.Common.Item | |
type Rep Item Source # | |
Defined in Game.LambdaHack.Common.Item type Rep Item = D1 (MetaData "Item" "Game.LambdaHack.Common.Item" "LambdaHack-0.8.0.0-F0O84Ns8lID9eizm4mHo10" False) (C1 (MetaCons "Item" PrefixI True) ((S1 (MetaSel (Just "jkind") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 ItemIdentity) :*: S1 (MetaSel (Just "jlid") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 LevelId)) :*: (S1 (MetaSel (Just "jfid") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 (Maybe FactionId)) :*: S1 (MetaSel (Just "jflavour") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Flavour)))) |
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
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
The secret part of the information about an item. If a faction
knows the aspects 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.
Full information about an item.
type ItemFullKit = (ItemFull, ItemQuant) Source #
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 aspects. 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.
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
Instances
Show Benefit Source # | |
Generic Benefit Source # | |
Binary Benefit Source # | |
type Rep Benefit Source # | |
Defined in Game.LambdaHack.Common.Item type Rep Benefit = D1 (MetaData "Benefit" "Game.LambdaHack.Common.Item" "LambdaHack-0.8.0.0-F0O84Ns8lID9eizm4mHo10" 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 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.
itemToFull6 :: COps -> DiscoveryKind -> DiscoveryAspect -> ItemId -> Item -> ItemFull Source #
strongestSlot :: DiscoveryBenefit -> EqpSlot -> [(ItemId, ItemFullKit)] -> [(Int, (ItemId, ItemFullKit))] Source #
strongestMelee :: Maybe DiscoveryBenefit -> Time -> [(ItemId, ItemFullKit)] -> [(Double, (ItemId, ItemFullKit))] Source #
unknownMeleeBonus :: [ItemFull] -> Bool Source #
tmpMeleeBonus :: [ItemFullKit] -> Int Source #