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

Game.LambdaHack.Common.Faction

Description

Factions taking part in the game, e.g., a hero faction, a monster faction and an animal faction.

Synopsis

Documentation

type FactionDict = EnumMap FactionId Faction Source #

All factions in the game, indexed by faction identifier.

data Faction Source #

The faction datatype.

Constructors

Faction 

Fields

Instances

Instances details
Binary Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

put :: Faction -> Put

get :: Get Faction

putList :: [Faction] -> Put

Generic Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Faction 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Faction = D1 ('MetaData "Faction" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Faction" 'PrefixI 'True) (((S1 ('MetaSel ('Just "gkind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FactionKind) :*: S1 ('MetaSel ('Just "gname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "gcolor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Color) :*: (S1 ('MetaSel ('Just "gdoctrine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Doctrine) :*: S1 ('MetaSel ('Just "gunderAI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))) :*: ((S1 ('MetaSel ('Just "ginitial") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Int, Int, GroupName ItemKind)]) :*: (S1 ('MetaSel ('Just "gdipl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Dipl) :*: S1 ('MetaSel ('Just "gquit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Status)))) :*: (S1 ('MetaSel ('Just "_gleader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ActorId)) :*: (S1 ('MetaSel ('Just "gstash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (LevelId, Point))) :*: S1 ('MetaSel ('Just "gvictims") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (EnumMap (ContentId ItemKind) Int)))))))

Methods

from :: Faction -> Rep Faction x

to :: Rep Faction x -> Faction

Show Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

(==) :: Faction -> Faction -> Bool #

(/=) :: Faction -> Faction -> Bool #

type Rep Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Faction = D1 ('MetaData "Faction" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Faction" 'PrefixI 'True) (((S1 ('MetaSel ('Just "gkind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FactionKind) :*: S1 ('MetaSel ('Just "gname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "gcolor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Color) :*: (S1 ('MetaSel ('Just "gdoctrine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Doctrine) :*: S1 ('MetaSel ('Just "gunderAI") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))) :*: ((S1 ('MetaSel ('Just "ginitial") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Int, Int, GroupName ItemKind)]) :*: (S1 ('MetaSel ('Just "gdipl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Dipl) :*: S1 ('MetaSel ('Just "gquit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Status)))) :*: (S1 ('MetaSel ('Just "_gleader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ActorId)) :*: (S1 ('MetaSel ('Just "gstash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (LevelId, Point))) :*: S1 ('MetaSel ('Just "gvictims") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (EnumMap (ContentId ItemKind) Int)))))))

data Diplomacy Source #

Diplomacy states. Higher overwrite lower in case of asymmetric content.

Constructors

Unknown 
Neutral 
Alliance 
War 

Instances

Instances details
Binary Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

put :: Diplomacy -> Put

get :: Get Diplomacy

putList :: [Diplomacy] -> Put

Enum Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Generic Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Diplomacy 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Diplomacy = D1 ('MetaData "Diplomacy" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "Unknown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Neutral" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Alliance" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "War" 'PrefixI 'False) (U1 :: Type -> Type)))

Methods

from :: Diplomacy -> Rep Diplomacy x

to :: Rep Diplomacy x -> Diplomacy

Show Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Ord Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Diplomacy = D1 ('MetaData "Diplomacy" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) ((C1 ('MetaCons "Unknown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Neutral" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Alliance" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "War" 'PrefixI 'False) (U1 :: Type -> Type)))

data Status Source #

Current game status.

Constructors

Status 

Fields

Instances

Instances details
Binary Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

put :: Status -> Put

get :: Get Status

putList :: [Status] -> Put

Generic Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Status 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Status = D1 ('MetaData "Status" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Status" 'PrefixI 'True) (S1 ('MetaSel ('Just "stOutcome") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Outcome) :*: (S1 ('MetaSel ('Just "stDepth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "stNewGame") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (GroupName ModeKind))))))

Methods

from :: Status -> Rep Status x

to :: Rep Status x -> Status

Show Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

Ord Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Status = D1 ('MetaData "Status" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Status" 'PrefixI 'True) (S1 ('MetaSel ('Just "stOutcome") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Outcome) :*: (S1 ('MetaSel ('Just "stDepth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "stNewGame") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (GroupName ModeKind))))))

data Challenge Source #

The difficulty level influencess HP of either the human player or the AI. The challenges restrict some abilities of the human player only.

Constructors

Challenge 

Fields

  • cdiff :: Int

    game difficulty level (HP bonus or malus)

  • cfish :: Bool

    cold fish challenge (no healing from enemies)

  • cgoods :: Bool

    ready goods challenge (crafting disabled)

  • cwolf :: Bool

    lone wolf challenge (only one starting character)

  • ckeeper :: Bool

    finder keeper challenge (ranged attacks disabled)

Instances

Instances details
Binary Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Methods

put :: Challenge -> Put

get :: Get Challenge

putList :: [Challenge] -> Put

Generic Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Challenge 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Challenge = D1 ('MetaData "Challenge" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Challenge" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cdiff") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "cfish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "cgoods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "cwolf") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "ckeeper") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))))

Methods

from :: Challenge -> Rep Challenge x

to :: Rep Challenge x -> Challenge

Show Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Ord Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Challenge = D1 ('MetaData "Challenge" "Game.LambdaHack.Common.Faction" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Challenge" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cdiff") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "cfish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "cgoods") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "cwolf") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "ckeeper") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))))

isHorrorFact :: Faction -> Bool Source #

Tell whether the faction consists of summoned horrors only.

Horror player is special, for summoned actors that don't belong to any of the main players of a given game. E.g., animals summoned during a skirmish game between two hero factions land in the horror faction. In every game, either all factions for which summoning items exist should be present or a horror player should be added to host them.

isFoe :: FactionId -> Faction -> FactionId -> Bool Source #

Check if factions are at war. Assumes symmetry.

isFriend :: FactionId -> Faction -> FactionId -> Bool Source #

Check if factions are allied or are the same faction. Assumes symmetry.

Internal operations