LambdaHack-0.11.0.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellSafe-Inferred
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

  • gkind :: FactionKind

    the player spec for this faction, do not update! it is morally read-only, but not represented as ContentId FactionKind, because it's very small and it's looked up often enough in the code and during runtime; a side-effect is that if content changes mid-game, this stays; if we ever have thousands of factions in a single game, e.g., one for each separately spawned herd of animals, change this

  • gname :: Text

    individual name

  • gcolor :: Color

    color of numbered actors

  • gdoctrine :: Doctrine

    non-pointmen behave according to this

  • gunderAI :: Bool

    whether the faction is under AI control

  • ginitial :: [(Int, Int, GroupName ItemKind)]

    initial actors

  • gdipl :: Dipl

    diplomatic standing

  • gquit :: Maybe Status

    cause of game end/exit

  • _gleader :: Maybe ActorId

    the leader of the faction; don't use in place of sleader on clients

  • gstash :: Maybe (LevelId, Point)

    level and position of faction's shared inventory stash

  • gvictims :: EnumMap (ContentId ItemKind) Int

    members killed

Instances

Instances details
Generic Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Faction :: Type -> Type Source #

Show Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Binary Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

type Rep Faction Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

data Diplomacy Source #

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

Constructors

Unknown 
Neutral 
Alliance 
War 

Instances

Instances details
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 :: Type -> Type Source #

Show Diplomacy Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Binary 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.0-LAuGMGymHrVATYlfQ7XJX5" '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
Generic Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Status :: Type -> Type Source #

Show Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Binary Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Eq Status Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

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.0-LAuGMGymHrVATYlfQ7XJX5" '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
Generic Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Associated Types

type Rep Challenge :: Type -> Type Source #

Show Challenge Source # 
Instance details

Defined in Game.LambdaHack.Common.Faction

Binary 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

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