LambdaHack-0.2.1: A roguelike game engine in early and very active development

Safe HaskellSafe-Infered

Game.LambdaHack.State

Contents

Description

Game state and persistent player diary types and operations.

Synopsis

Game state

data State Source

The state of a single game that can be save and restored. In practice, we maintain some extra state, but it's temporary for a single turn or relevant only to the current session.

Constructors

State 

Fields

splayer :: ActorId

represents the player-controlled actor

scursor :: Cursor

cursor location and level to return to

sflavour :: FlavourMap

association of flavour to items

sdisco :: Discoveries

items (kinds) that have been discovered

sdungeon :: Dungeon

all dungeon levels

slid :: LevelId

identifier of the current level

scounter :: Int

stores next actor index

srandom :: StdGen

current random generator

sconfig :: CP

game config

snoTime :: Bool

last command unexpectedly took no time

squit :: Maybe (Bool, Status)

cause of game shutdown

sdebug :: DebugMode

debugging mode

data TgtMode Source

Current targeting mode of the player.

Constructors

TgtOff

not in targeting mode

TgtExplicit

the player requested targeting mode explicitly

TgtAuto

the mode was entered (and will be exited) automatically

data Cursor Source

Current targeting cursor parameters.

Constructors

Cursor 

Fields

ctargeting :: TgtMode

targeting mode

clocLn :: LevelId

cursor level

clocation :: Point

cursor coordinates

creturnLn :: LevelId

the level current player resides on

ceps :: Int

a parameter of the tgt digital line

Instances

Accessor

slevel :: State -> LevelSource

Get current level from the dungeon data.

stime :: State -> TimeSource

Get current time from the dungeon data.

Constructor

defaultState :: CP -> FlavourMap -> Dungeon -> LevelId -> Point -> StdGen -> StateSource

Initial game state.

State update

updateCursor :: (Cursor -> Cursor) -> State -> StateSource

Update cursor parameters within state.

updateTime :: (Time -> Time) -> State -> StateSource

Update time within state.

updateDiscoveries :: (Discoveries -> Discoveries) -> State -> StateSource

Update item discoveries within state.

updateLevel :: (Level -> Level) -> State -> StateSource

Update level data within state.

updateDungeon :: (Dungeon -> Dungeon) -> State -> StateSource

Update dungeon data within state.

Player diary

data Diary Source

The diary contains all the player data that carries over from game to game. That includes the last message, previous messages and otherwise recorded history of past games. This can be used for calculating player achievements, unlocking advanced game features and general data mining.

Constructors

Diary 

Instances

defaultDiary :: IO DiarySource

Initial player diary.

Debug flags

data DebugMode Source

Constructors

DebugMode 

Instances