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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Content.FactionKind

Contents

- Internal operations

Description

The type of kinds of factions present in a game, both human and computer-controlled.

Synopsis

- data FactionKind = FactionKind {
  - fname :: Text
  - ffreq :: Freqs FactionKind
  - fteam :: TeamContinuity
  - fgroups :: Freqs ItemKind
  - fskillsOther :: Skills
  - fcanEscape :: Bool
  - fneverEmpty :: Bool
  - fhiCondPoly :: HiCondPoly
  - fhasGender :: Bool
  - finitDoctrine :: Doctrine
  - fspawnsFast :: Bool
  - fhasPointman :: Bool
  - fhasUI :: Bool
  - finitUnderAI :: Bool
  - fenemyTeams :: [TeamContinuity]
  - falliedTeams :: [TeamContinuity]
  }
- makeData :: [FactionKind] -> [GroupName FactionKind] -> [GroupName FactionKind] -> ContentData FactionKind
- type HiCondPoly = [HiSummand]
- type HiSummand = (HiPolynomial, [Outcome])
- type HiPolynomial = [(HiIndeterminant, Double)]
- data HiIndeterminant
  - = HiConst
  - | HiLoot
  - | HiSprint
  - | HiBlitz
  - | HiSurvival
  - | HiKill
  - | HiLoss
- newtype TeamContinuity = TeamContinuity Int
- data Outcome
  - = Escape
  - | Conquer
  - | Defeated
  - | Killed
  - | Restart
  - | Camping
- teamExplorer :: TeamContinuity
- hiHeroLong :: HiCondPoly
- hiHeroMedium :: HiCondPoly
- hiHeroShort :: HiCondPoly
- hiDweller :: HiCondPoly
- victoryOutcomes :: [Outcome]
- deafeatOutcomes :: [Outcome]
- nameOutcomePast :: Outcome -> Text
- nameOutcomeVerb :: Outcome -> Text
- endMessageOutcome :: Outcome -> Text
- validateSingle :: FactionKind -> [Text]
- validateAll :: [FactionKind] -> ContentData FactionKind -> [Text]

# Documentation

data FactionKind Source #

Properties of a particular faction.

Constructors

FactionKind |

Fields

- fname :: Text

  name of the faction

- ffreq :: Freqs FactionKind

  frequency within groups

- fteam :: TeamContinuity

  the team the faction identifies with across games and modes

- fgroups :: Freqs ItemKind

  names of actor groups that may naturally fall under faction's control, e.g., upon spawning; make sure all groups that may ever continuousely generate actors, e.g., through spawning or summoning, are mentioned in at least one faction kind; groups of initial faction actors don't need to be included

- fskillsOther :: Skills

  fixed skill modifiers to the non-leader actors; also summed with skills implied by `fdoctrine` (which is not fixed)

- fcanEscape :: Bool

  the faction can escape the dungeon

- fneverEmpty :: Bool

  the faction declared killed if no actors

- fhiCondPoly :: HiCondPoly

  score formula (conditional polynomial)

- fhasGender :: Bool

  whether actors have gender

- finitDoctrine :: Doctrine

  initial faction's non-leaders doctrine

- fspawnsFast :: Bool

  spawns fast enough that switching pointman to another level to optimize spawning is a winning tactics, which would spoil the fun, so switching is disabled in UI and AI clients

- fhasPointman :: Bool

  whether the faction can have a pointman

- fhasUI :: Bool

  does the faction have a UI client (for control or passive observation)

- finitUnderAI :: Bool

  is the faction initially under AI control

- fenemyTeams :: [TeamContinuity]

  teams starting at war with the faction

- falliedTeams :: [TeamContinuity]

  teams starting allied with the faction

#### Instances

Instances details

Binary FactionKind Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods put :: FactionKind -> Put Source # get :: Get FactionKind Source # putList :: [FactionKind] -> Put Source #
Generic FactionKind Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Associated Types

type Rep FactionKind |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep FactionKind = D1 ('MetaData "FactionKind" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "FactionKind" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "fname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "ffreq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Freqs FactionKind))) :*: (S1 ('MetaSel ('Just "fteam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 TeamContinuity) :*: S1 ('MetaSel ('Just "fgroups") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Freqs ItemKind)))) :*: ((S1 ('MetaSel ('Just "fskillsOther") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Skills) :*: S1 ('MetaSel ('Just "fcanEscape") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "fneverEmpty") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "fhiCondPoly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HiCondPoly)))) :*: (((S1 ('MetaSel ('Just "fhasGender") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "finitDoctrine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Doctrine)) :*: (S1 ('MetaSel ('Just "fspawnsFast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "fhasPointman") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "fhasUI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "finitUnderAI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "fenemyTeams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TeamContinuity]) :*: S1 ('MetaSel ('Just "falliedTeams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TeamContinuity]))))))

Methods

from :: FactionKind -> Rep FactionKind x Source #

to :: Rep FactionKind x -> FactionKind Source #

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

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep FactionKind = D1 ('MetaData "FactionKind" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "FactionKind" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "fname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "ffreq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Freqs FactionKind))) :*: (S1 ('MetaSel ('Just "fteam") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 TeamContinuity) :*: S1 ('MetaSel ('Just "fgroups") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Freqs ItemKind)))) :*: ((S1 ('MetaSel ('Just "fskillsOther") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Skills) :*: S1 ('MetaSel ('Just "fcanEscape") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "fneverEmpty") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "fhiCondPoly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HiCondPoly)))) :*: (((S1 ('MetaSel ('Just "fhasGender") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "finitDoctrine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Doctrine)) :*: (S1 ('MetaSel ('Just "fspawnsFast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "fhasPointman") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "fhasUI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "finitUnderAI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "fenemyTeams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TeamContinuity]) :*: S1 ('MetaSel ('Just "falliedTeams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TeamContinuity]))))))

makeData :: [FactionKind] -> [GroupName FactionKind] -> [GroupName FactionKind] -> ContentData FactionKind Source #

type HiCondPoly = [HiSummand] Source #

Conditional polynomial representing score calculation for this faction.

type HiSummand = (HiPolynomial, [Outcome]) Source #

type HiPolynomial = [(HiIndeterminant, Double)] Source #

data HiIndeterminant Source #

Constructors

HiConst |
HiLoot |
HiSprint |
HiBlitz |
HiSurvival |
HiKill |
HiLoss |

#### Instances

Instances details

Binary HiIndeterminant Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods put :: HiIndeterminant -> Put Source # get :: Get HiIndeterminant Source # putList :: [HiIndeterminant] -> Put Source #
Generic HiIndeterminant Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Associated Types

type Rep HiIndeterminant |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep HiIndeterminant = D1 ('MetaData "HiIndeterminant" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "HiConst" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "HiLoot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiSprint" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "HiBlitz" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiSurvival" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HiKill" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiLoss" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: HiIndeterminant -> Rep HiIndeterminant x Source #

to :: Rep HiIndeterminant x -> HiIndeterminant Source #

Show HiIndeterminant Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods showsPrec :: Int -> HiIndeterminant -> ShowS Source # show :: HiIndeterminant -> String Source # showList :: [HiIndeterminant] -> ShowS Source #
Eq HiIndeterminant Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods (==) :: HiIndeterminant -> HiIndeterminant -> Bool Source # (/=) :: HiIndeterminant -> HiIndeterminant -> Bool Source #
type Rep HiIndeterminant Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep HiIndeterminant = D1 ('MetaData "HiIndeterminant" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "HiConst" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "HiLoot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiSprint" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "HiBlitz" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiSurvival" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HiKill" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HiLoss" 'PrefixI 'False) (U1 :: Type -> Type))))

newtype TeamContinuity Source #

Team continuity index. Starting with 1. See the comment for `FactionId`.

Constructors

TeamContinuity Int |

#### Instances

Instances details

Binary TeamContinuity Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods put :: TeamContinuity -> Put Source # get :: Get TeamContinuity Source # putList :: [TeamContinuity] -> Put Source #
Enum TeamContinuity Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Methods

succ :: TeamContinuity -> TeamContinuity Source #

pred :: TeamContinuity -> TeamContinuity Source #

toEnum :: Int -> TeamContinuity Source #

fromEnum :: TeamContinuity -> Int Source #

enumFrom :: TeamContinuity -> [TeamContinuity] Source #

enumFromThen :: TeamContinuity -> TeamContinuity -> [TeamContinuity] Source #

enumFromTo :: TeamContinuity -> TeamContinuity -> [TeamContinuity] Source #

enumFromThenTo :: TeamContinuity -> TeamContinuity -> TeamContinuity -> [TeamContinuity] Source #

Generic TeamContinuity Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Associated Types

type Rep TeamContinuity |
Instance details Defined in Game.LambdaHack.Content.FactionKind type Rep TeamContinuity = D1 ('MetaData "TeamContinuity" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'True) (C1 ('MetaCons "TeamContinuity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Methods

from :: TeamContinuity -> Rep TeamContinuity x Source #

to :: Rep TeamContinuity x -> TeamContinuity Source #

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

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Methods

compare :: TeamContinuity -> TeamContinuity -> Ordering Source #

(<) :: TeamContinuity -> TeamContinuity -> Bool Source #

(<=) :: TeamContinuity -> TeamContinuity -> Bool Source #

(>) :: TeamContinuity -> TeamContinuity -> Bool Source #

(>=) :: TeamContinuity -> TeamContinuity -> Bool Source #

max :: TeamContinuity -> TeamContinuity -> TeamContinuity Source #

min :: TeamContinuity -> TeamContinuity -> TeamContinuity Source #

type Rep TeamContinuity Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind type Rep TeamContinuity = D1 ('MetaData "TeamContinuity" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'True) (C1 ('MetaCons "TeamContinuity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

data Outcome Source #

Outcome of a game.

Constructors

Escape | the faction escaped the dungeon alive
Conquer | the faction won by eliminating all rivals
Defeated | the faction lost the game in another way
Killed | the faction was eliminated
Restart | game is restarted; the quitter quit
Camping | game is supended

#### Instances

Instances details

Binary Outcome Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods put :: Outcome -> Put Source # get :: Get Outcome Source # putList :: [Outcome] -> Put Source #
Bounded Outcome Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods minBound :: Outcome Source # maxBound :: Outcome Source #
Enum Outcome Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Methods

succ :: Outcome -> Outcome Source #

pred :: Outcome -> Outcome Source #

toEnum :: Int -> Outcome Source #

fromEnum :: Outcome -> Int Source #

enumFrom :: Outcome -> [Outcome] Source #

enumFromThen :: Outcome -> Outcome -> [Outcome] Source #

enumFromTo :: Outcome -> Outcome -> [Outcome] Source #

enumFromThenTo :: Outcome -> Outcome -> Outcome -> [Outcome] Source #

Generic Outcome Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

Associated Types

type Rep Outcome |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep Outcome = D1 ('MetaData "Outcome" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "Escape" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Conquer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Defeated" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Killed" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Restart" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Camping" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: Outcome -> Rep Outcome x Source #

to :: Rep Outcome x -> Outcome Source #

Show Outcome Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods showsPrec :: Int -> Outcome -> ShowS Source # show :: Outcome -> String Source # showList :: [Outcome] -> ShowS Source #
Eq Outcome Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods (==) :: Outcome -> Outcome -> Bool Source # (/=) :: Outcome -> Outcome -> Bool Source #
Ord Outcome Source # |
Instance details Defined in Game.LambdaHack.Content.FactionKind Methods compare :: Outcome -> Outcome -> Ordering Source # (<) :: Outcome -> Outcome -> Bool Source # (<=) :: Outcome -> Outcome -> Bool Source # (>) :: Outcome -> Outcome -> Bool Source # (>=) :: Outcome -> Outcome -> Bool Source # max :: Outcome -> Outcome -> Outcome Source # min :: Outcome -> Outcome -> Outcome Source #
type Rep Outcome Source # |

Instance details

Defined in Game.LambdaHack.Content.FactionKind

type Rep Outcome = D1 ('MetaData "Outcome" "Game.LambdaHack.Content.FactionKind" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "Escape" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Conquer" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Defeated" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Killed" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Restart" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Camping" 'PrefixI 'False) (U1 :: Type -> Type))))

teamExplorer :: TeamContinuity Source #

hiHeroLong :: HiCondPoly Source #

hiHeroMedium :: HiCondPoly Source #

hiHeroShort :: HiCondPoly Source #

hiDweller :: HiCondPoly Source #

victoryOutcomes :: [Outcome] Source #

deafeatOutcomes :: [Outcome] Source #

nameOutcomePast :: Outcome -> Text Source #

nameOutcomeVerb :: Outcome -> Text Source #

endMessageOutcome :: Outcome -> Text Source #

# Internal operations

validateSingle :: FactionKind -> [Text] Source #

validateAll :: [FactionKind] -> ContentData FactionKind -> [Text] Source #

Validate game faction kinds together.