LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone



Server and client game state types and operations.



data StateClient Source

Client state, belonging to a single faction. Some of the data, e.g, the history, carries over from game to game, even across playing sessions. Data invariant: if _sleader is Nothing then so is srunning.




stgtMode :: !(Maybe TgtMode)

targeting mode

scursor :: !Target

the common, cursor target

seps :: !Int

a parameter of the tgt digital line

stargetD :: !(EM.EnumMap ActorId (Target, Maybe PathEtc))

targets of our actors in the dungeon

sexplored :: !(ES.EnumSet LevelId)

the set of fully explored levels

sbfsD :: !(EM.EnumMap ActorId (Array BfsDistance, Point, Int, Maybe [Point]))

pathfinding distances for our actors and paths to their targets, if any

sselected :: !(ES.EnumSet ActorId)

the set of currently selected actors

srunning :: !(Maybe RunParams)

parameters of the current run, if any

sreport :: !Report

current messages

shistory :: !History

history of messages

sdisplayed :: !(EM.EnumMap LevelId Time)

moves are displayed up to this time

sundo :: ![CmdAtomic]

atomic commands performed to date

sdiscoKind :: !DiscoveryKind

remembered item discoveries

sdiscoEffect :: !DiscoveryEffect

remembered effects&Co of items

sfper :: !FactionPers

faction perception indexed by levels

srandom :: !R.StdGen

current random generator

slastRecord :: !LastRecord

state of key sequence recording

slastPlay :: ![KM]

state of key sequence playback

slastLost :: !(ES.EnumSet ActorId)

actors that just got out of sight

swaitTimes :: !Int

player just waited this many times

_sleader :: !(Maybe ActorId)

current picked party leader

_sside :: !FactionId

faction controlled by the client

squit :: !Bool

exit the game loop

sisAI :: !Bool

whether it's an AI client

smarkVision :: !Bool

mark leader and party FOV

smarkSmell :: !Bool

mark smell, if the leader can smell

smarkSuspect :: !Bool

mark suspect features

scurDifficulty :: !Int

current game difficulty level

sslots :: !ItemSlots

map from slots to items

slastSlot :: !SlotChar

last used slot

sgameMode :: !(GroupName ModeKind)

current game mode

sescAI :: !EscAI

just canceled AI control with ESC

sdebugCli :: !DebugModeCli

client debugging mode

defStateClient :: History -> Report -> FactionId -> Bool -> StateClient Source

Initial game client state.

updateTarget :: ActorId -> (Maybe Target -> Maybe Target) -> StateClient -> StateClient Source

Update target parameters within client state.

getTarget :: ActorId -> StateClient -> Maybe Target Source

Get target parameters from client state.

updateLeader :: ActorId -> State -> StateClient -> StateClient Source

Update picked leader within state. Verify actor's faction.

type PathEtc = ([Point], (Point, Int)) Source

newtype TgtMode Source

Current targeting mode of a client.




tgtLevelId :: LevelId

data RunParams Source

Parameters of the current run.




runLeader :: !ActorId

the original leader from run start

runMembers :: ![ActorId]

the list of actors that take part

runDist :: !Int

distance of the run so far (plus one, if multiple runners)

runStopMsg :: !(Maybe T.Text)

message with the next stop reason

runInitDir :: !(Maybe Vector)

the direction of the initial step

type LastRecord = ([KM], [KM], Int) Source