Safe Haskell | None |
---|
Game state and persistent player diary types and operations.
- data State = State {}
- data TgtMode
- = TgtOff
- | TgtExplicit
- | TgtAuto
- data Cursor = Cursor {}
- data Status
- slevel :: State -> Level
- stime :: State -> Time
- defaultState :: Config -> Id FactionKind -> FlavourMap -> Dungeon -> LevelId -> Point -> StdGen -> State
- updateCursor :: (Cursor -> Cursor) -> State -> State
- updateTime :: (Time -> Time) -> State -> State
- updateDiscoveries :: (Discoveries -> Discoveries) -> State -> State
- updateLevel :: (Level -> Level) -> State -> State
- updateDungeon :: (Dungeon -> Dungeon) -> State -> State
- data Diary = Diary {}
- defaultDiary :: IO Diary
- lookAt :: COps -> Bool -> Bool -> State -> Level -> Point -> Text -> Text
- partItemCheat :: Bool -> Ops ItemKind -> State -> Item -> Part
- partItem :: Ops ItemKind -> State -> Item -> Part
- partItemNWs :: Ops ItemKind -> State -> Item -> Part
- data DebugMode = DebugMode {}
- cycleMarkVision :: State -> State
- toggleOmniscient :: State -> State
Game state
The state of a single game that can be saved and restored. It's completely disregarded and reset when a new game is started. In practice, we maintain some extra state (DungeonPerception), but it's only temporary, existing for a single turn and then invalidated.
State | |
|
Current targeting mode of the player.
TgtOff | not in targeting mode |
TgtExplicit | the player requested targeting mode explicitly |
TgtAuto | the mode was entered (and will be exited) automatically |
Current targeting cursor parameters.
Current result of the game.
Accessor
Constructor
defaultState :: Config -> Id FactionKind -> FlavourMap -> Dungeon -> LevelId -> Point -> StdGen -> StateSource
Initial game state.
State update
updateDiscoveries :: (Discoveries -> Discoveries) -> State -> StateSource
Update item discoveries within state.
Player diary
The diary contains all the player data that carries over from game to game, even across playing sessions. That includes the last message, previous messages and otherwise recorded history of past games. This can be extended with other data and used for calculating player achievements, unlocking advanced game features and for general data mining, e.g., augmenting AI or procedural content generation.
defaultDiary :: IO DiarySource
Initial player diary.
Textia; descriptions
:: COps | game content |
-> Bool | detailed? |
-> Bool | can be seen right now? |
-> State | game state |
-> Level | current level |
-> Point | location to describe |
-> Text | an extra sentence to print |
-> Text |
Produces a textual description of the terrain and items at an already explored location. Mute for unknown locations. The detailed variant is for use in the targeting mode.
partItemCheat :: Bool -> Ops ItemKind -> State -> Item -> PartSource
The part of speech describing the item. If cheating is allowed, full identity of the item is revealed together with its flavour (e.g. at the game over screen).
Debug flags
cycleMarkVision :: State -> StateSource
toggleOmniscient :: State -> StateSource