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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Definition.ContentData

Description

A game requires the engine provided by the library, perhaps customized, and game content, defined completely afresh for the particular game. The possible kinds of content are fixed in the library and all defined within the library source code directory. On the other hand, game content, is defined in the directory hosting the particular game definition.

Content of a given kind is just a list of content items. After the list is verified and the data preprocessed, it's held in the `ContentData` datatype.

Synopsis

- data ContentData c
- validateRarity :: Rarity -> [Text]
- validFreqs :: Freqs a -> Bool
- emptyContentData :: ContentData a
- makeContentData :: Show c => String -> (c -> Text) -> (c -> Freqs c) -> (c -> [Text]) -> ([c] -> ContentData c -> [Text]) -> [c] -> [GroupName c] -> [GroupName c] -> ContentData c
- okind :: ContentData a -> ContentId a -> a
- omemberGroup :: ContentData a -> GroupName a -> Bool
- oexistsGroup :: 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

# Documentation

data ContentData c Source #

Verified and preprocessed content data of a particular kind.

validateRarity :: Rarity -> [Text] Source #

validFreqs :: Freqs a -> Bool Source #

emptyContentData :: ContentData a Source #

makeContentData Source #

Arguments

:: Show c |
=> String |
-> (c -> Text) | name of the content itme, used for validation
-> (c -> Freqs c) | frequency in groups, for validation and preprocessing
-> (c -> [Text]) | validate a content item and list all offences
-> ([c] -> ContentData c -> [Text]) | validate the whole defined content of this type and list all offence
-> [c] | all content of this type
-> [GroupName c] | singleton group names for this content
-> [GroupName c] | remaining group names for this content
-> ContentData c |

okind :: ContentData a -> ContentId a -> a Source #

Content element at given id.

omemberGroup :: ContentData a -> GroupName a -> Bool Source #

oexistsGroup :: 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`.