LambdaHack-0.4.101.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.Faction

Contents

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

gname :: !Text

individual name

gcolor :: !Color

color of actors or their frames

gplayer :: !(Player Int)

the player spec for this faction

gdipl :: !Dipl

diplomatic mode

gquit :: !(Maybe Status)

cause of game end/exit

gleader :: !(Maybe (ActorId, Maybe Target))

the leader of the faction and his target

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 Status Source

Current game status.

Constructors

Status 

Fields

stOutcome :: !Outcome

current game outcome

stDepth :: !Int

depth of the final encounter

stNewGame :: !(Maybe (GroupName ModeKind))

new game group to start, if any

data Target Source

The type of na actor target.

Constructors

TEnemy !ActorId !Bool

target an actor; cycle only trough seen foes, unless the flag is set

TEnemyPos !ActorId !LevelId !Point !Bool

last seen position of the targeted actor

TPoint !LevelId !Point

target a concrete spot

TVector !Vector

target position relative to actor

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 duel game between two hero players 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. Actors that can be summoned should have "horror" in their ifreq set.

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.

Internal operations