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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Common.Kind

Contents

- Operations both internal and used in unit tests

Description

General content types and operations.

Synopsis

- data ContentData c
- data COps = COps {
  - cocave :: ContentData CaveKind
  - cofact :: ContentData FactionKind
  - coitem :: ContentData ItemKind
  - comode :: ContentData ModeKind
  - coplace :: ContentData PlaceKind
  - corule :: RuleContent
  - cotile :: ContentData TileKind
  - coItemSpeedup :: ItemSpeedup
  - coTileSpeedup :: TileSpeedup
  }
- 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.

data COps Source #

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

- cocave :: ContentData CaveKind
- cofact :: ContentData FactionKind
- coitem :: ContentData ItemKind
- comode :: ContentData ModeKind
- coplace :: ContentData PlaceKind
- corule :: RuleContent
- cotile :: ContentData TileKind
- coItemSpeedup :: ItemSpeedup
- coTileSpeedup :: TileSpeedup

#### Instances

Instances details

Show COps Source # |
Instance details Defined in Game.LambdaHack.Common.Kind Methods showsPrec :: Int -> COps -> ShowS Source # show :: COps -> String Source # showList :: [COps] -> ShowS Source #
Eq COps Source # |
Instance details Defined in Game.LambdaHack.Common.Kind Methods (==) :: COps -> COps -> Bool Source # (/=) :: COps -> COps -> Bool Source #

emptyCOps :: COps Source #

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 #

speedupItem :: ContentData ItemKind -> ItemSpeedup 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`.

linearInterpolation :: Int -> Int -> Rarity -> Int Source #

emptyMultiGroupMode :: ModeKind Source #

emptyMultiGroupItem :: ItemKind Source #

emptyUnknownTile :: TileKind Source #

emptyUIFactionGroupName :: GroupName FactionKind Source #

# Operations both internal and used in unit tests

emptyUIFaction :: FactionKind Source #