| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Game.LambdaHack.Common.Kind
Description
General content types and operations.
Synopsis
- data ContentData c
- data COps = COps {}
- emptyCOps :: COps
- data ItemSpeedup
- getKindMean :: ContentId ItemKind -> ItemSpeedup -> KindMean
- speedupItem :: ContentData ItemKind -> ItemSpeedup
- okind :: ContentData a -> ContentId a -> a
- omemberGroup :: ContentData a -> GroupName a -> Bool
- oisSingletonGroup :: ContentData a -> GroupName a -> Bool
- ouniqGroup :: Show a => ContentData a -> GroupName a -> ContentId a
- opick :: Show a => ContentData a -> GroupName a -> (a -> Bool) -> Rnd (Maybe (ContentId a))
- ofoldlWithKey' :: ContentData a -> (b -> ContentId a -> a -> b) -> b -> b
- ofoldlGroup' :: ContentData a -> GroupName a -> (b -> Int -> ContentId a -> a -> b) -> b -> b
- omapVector :: ContentData a -> (a -> b) -> Vector b
- oimapVector :: ContentData a -> (ContentId a -> a -> b) -> Vector b
- olength :: ContentData a -> Int
- linearInterpolation :: Int -> Int -> Rarity -> Int
- emptyMultiGroupMode :: ModeKind
- emptyMultiGroupItem :: ItemKind
- emptyUnknownTile :: TileKind
- emptyUIFactionGroupName :: GroupName FactionKind
- emptyUIFaction :: FactionKind
Documentation
data ContentData c Source #
Verified and preprocessed content data of a particular kind.
Operations for all content types, gathered together.
Warning: this type is not abstract, but its values should not be created ad hoc, even for unit tests, but should be constructed with makeData for each particular content kind, which includes validation, and with speedupItem, etc., to ensure internal consistency.
The emptyCOps is one such valid by construction value of this type, except for the cocave field. It's suitable for bootstrapping and for tests not involving dungeon generation from cave templates.
Constructors
| COps | |
Fields | |
This is as empty, as possible, but still valid content, except for cocave which is empty and not valid (making it valid would require bloating most other contents).
data ItemSpeedup Source #
Map from an item kind identifier to the mean aspect value for the kind.
getKindMean :: ContentId ItemKind -> ItemSpeedup -> KindMean Source #
okind :: ContentData a -> ContentId a -> a Source #
Content element at given id.
omemberGroup :: ContentData a -> GroupName a -> Bool Source #
oisSingletonGroup :: ContentData a -> GroupName a -> Bool Source #
ouniqGroup :: Show a => ContentData a -> GroupName a -> ContentId a Source #
The id of the unique member of a singleton content group.
opick :: Show a => ContentData a -> GroupName a -> (a -> Bool) -> Rnd (Maybe (ContentId a)) Source #
Pick a random id belonging to a group and satisfying a predicate.
ofoldlWithKey' :: ContentData a -> (b -> ContentId a -> a -> b) -> b -> b Source #
Fold strictly over all content a.
ofoldlGroup' :: ContentData a -> GroupName a -> (b -> Int -> ContentId a -> a -> b) -> b -> b Source #
Fold over the given group only.
omapVector :: ContentData a -> (a -> b) -> Vector b Source #
oimapVector :: ContentData a -> (ContentId a -> a -> b) -> Vector b Source #
olength :: ContentData a -> Int Source #
Size of content a.