LambdaHack-0.2.14: A roguelike game engine in early development

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.Faction

Description

Factions taking part in the game: e.g., two human players controlling the hero faction battling the monster and the animal factions.

Synopsis

Documentation

data FactionId Source

A unique identifier of a faction in a game.

type FactionDict = EnumMap FactionId Faction Source

All factions in the game, indexed by faction identifier.

data Faction Source

Constructors

Faction 

Fields

gkind :: !(Id FactionKind)

the kind of the faction

gname :: !Text

individual name

gcolor :: !Color

color of actors or their frames

gplayer :: !Player

the player spec for this faction

gdipl :: !Dipl

diplomatic mode

gquit :: !(Maybe Status)

cause of game end/exit

gleader :: !(Maybe ActorId)

the leader of the faction, if any

gsha :: !ItemBag

faction's shared inventory

gvictims :: !(EnumMap (Id ItemKind) Int)

members killed

data Diplomacy Source

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

Constructors

Unknown 
Neutral 
Alliance 
War 

data Outcome Source

Outcome of a game.

Constructors

Killed

the faction was eliminated

Defeated

the faction lost the game in another way

Camping

game is supended

Conquer

the player won by eliminating all rivals

Escape

the player escaped the dungeon alive

Restart

game is restarted

data Status Source

Current game status.

Constructors

Status 

Fields

stOutcome :: !Outcome

current game outcome

stDepth :: !Int

depth of the final encounter

stInfo :: !Text

extra information

isHeroFact :: Faction -> Bool Source

Tell whether the faction consists of heroes.

isCivilianFact :: COps -> Faction -> Bool Source

Tell whether the faction consists of human civilians.

isHorrorFact :: COps -> Faction -> Bool Source

Tell whether the faction consists of summoned horrors only.

isSpawnFact :: Faction -> Bool Source

Tell whether the faction is considered permanent dungeon dwellers (normally these are just spawning factions, but there are exceptions).

isSummonFact :: COps -> Faction -> Bool Source

Tell whether actors of the faction can be summoned by items, etc.

isAllMoveFact :: COps -> Faction -> Bool Source

Tell whether all moving actors of the factions can move at once.

keepArenaFact :: Faction -> Bool Source

Tell whether a faction that we know is still in game, keeps arena. Such factions win if they can escape the dungeon. Keeping arena means, if the faction is still in game, it always has a leader in the dungeon somewhere. So, leaderless factions and spawner factions do not keep an arena, even though the latter usually has a leader for most of the game.

isAtWar :: Faction -> FactionId -> Bool Source

Check if factions are at war. Assumes symmetry.

isAllied :: Faction -> FactionId -> Bool Source

Check if factions are allied. Assumes symmetry.