LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Common.Perception

Description

Actors perceiving other actors and the dungeon level.

Visibility works according to KISS. Everything that player sees is real. There are no unmarked hidden tiles and only solid tiles can be marked, so there are no invisible walls and to pass through an illusory wall, you have to use a turn bumping into it first. Only tiles marked with Suspect can turn out to be another tile. (So, if all tiles are marked with Suspect, the player knows nothing for sure, but this should be avoided, because searching becomes too time-consuming.) Each actor sees adjacent tiles, even when blind, so adjacent tiles are known, so the actor can decide accurately whether to pass thorugh or alter, etc.

Items are always real and visible. Actors are real, but can be invisible. Invisible actors in walls can't be hit, but are hinted at when altering the tile, so the player can flee or block. Invisible actors in open space can be hit.

Synopsis

- newtype PerVisible = PerVisible {
  - pvisible :: EnumSet Point
  }
- newtype PerSmelled = PerSmelled {
  - psmelled :: EnumSet Point
  }
- data Perception = Perception {
  - psight :: PerVisible
  - psmell :: PerSmelled
  }
- type PerLid = EnumMap LevelId Perception
- type PerFid = EnumMap FactionId PerLid
- totalVisible :: Perception -> EnumSet Point
- totalSmelled :: Perception -> EnumSet Point
- emptyPer :: Perception
- nullPer :: Perception -> Bool
- addPer :: Perception -> Perception -> Perception
- diffPer :: Perception -> Perception -> Perception

# Documentation

newtype PerVisible Source #

Visible positions.

Constructors

PerVisible |

Fields

- pvisible :: EnumSet Point

#### Instances

Instances details

Binary PerVisible Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods put :: PerVisible -> Put Source # get :: Get PerVisible Source # putList :: [PerVisible] -> Put Source #
Show PerVisible Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods showsPrec :: Int -> PerVisible -> ShowS Source # show :: PerVisible -> String Source # showList :: [PerVisible] -> ShowS Source #
Eq PerVisible Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods (==) :: PerVisible -> PerVisible -> Bool Source # (/=) :: PerVisible -> PerVisible -> Bool Source #

newtype PerSmelled Source #

Smelled positions.

Constructors

PerSmelled |

Fields

- psmelled :: EnumSet Point

#### Instances

Instances details

Binary PerSmelled Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods put :: PerSmelled -> Put Source # get :: Get PerSmelled Source # putList :: [PerSmelled] -> Put Source #
Show PerSmelled Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods showsPrec :: Int -> PerSmelled -> ShowS Source # show :: PerSmelled -> String Source # showList :: [PerSmelled] -> ShowS Source #
Eq PerSmelled Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods (==) :: PerSmelled -> PerSmelled -> Bool Source # (/=) :: PerSmelled -> PerSmelled -> Bool Source #

data Perception Source #

The type representing the perception of a faction on a level.

Constructors

Perception |

Fields

- psight :: PerVisible
- psmell :: PerSmelled

#### Instances

Instances details

Binary Perception Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods put :: Perception -> Put Source # get :: Get Perception Source # putList :: [Perception] -> Put Source #
Generic Perception Source # |

Instance details

Defined in Game.LambdaHack.Common.Perception

Associated Types

type Rep Perception |

Instance details

Defined in Game.LambdaHack.Common.Perception

type Rep Perception = D1 ('MetaData "Perception" "Game.LambdaHack.Common.Perception" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Perception" 'PrefixI 'True) (S1 ('MetaSel ('Just "psight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PerVisible) :*: S1 ('MetaSel ('Just "psmell") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PerSmelled)))

Methods

from :: Perception -> Rep Perception x Source #

to :: Rep Perception x -> Perception Source #

Show Perception Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods showsPrec :: Int -> Perception -> ShowS Source # show :: Perception -> String Source # showList :: [Perception] -> ShowS Source #
Eq Perception Source # |
Instance details Defined in Game.LambdaHack.Common.Perception Methods (==) :: Perception -> Perception -> Bool Source # (/=) :: Perception -> Perception -> Bool Source #
type Rep Perception Source # |

Instance details

Defined in Game.LambdaHack.Common.Perception

type Rep Perception = D1 ('MetaData "Perception" "Game.LambdaHack.Common.Perception" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" 'False) (C1 ('MetaCons "Perception" 'PrefixI 'True) (S1 ('MetaSel ('Just "psight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PerVisible) :*: S1 ('MetaSel ('Just "psmell") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PerSmelled)))

type PerLid = EnumMap LevelId Perception Source #

Perception of a single faction, indexed by level identifier.

type PerFid = EnumMap FactionId PerLid Source #

Perception indexed by faction identifier. This can't be added to `FactionDict`, because clients can't see it for other factions.

totalVisible :: Perception -> EnumSet Point Source #

The set of tiles visible by at least one hero.

totalSmelled :: Perception -> EnumSet Point Source #

The set of tiles smelt by at least one hero.

emptyPer :: Perception Source #

nullPer :: Perception -> Bool Source #

addPer :: Perception -> Perception -> Perception Source #

diffPer :: Perception -> Perception -> Perception Source #