Safe Haskell | None |
---|
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 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.
- data Perception = Perception {}
- newtype PerceptionVisible = PerceptionVisible {}
- type PerActor = EnumMap ActorId PerceptionVisible
- totalVisible :: Perception -> EnumSet Point
- smellVisible :: Perception -> EnumSet Point
- actorSeesPos :: Perception -> ActorId -> Point -> Bool
- nullPer :: Perception -> Bool
- addPer :: Perception -> Perception -> Perception
- diffPer :: Perception -> Perception -> Perception
- smellFromActors :: COps -> State -> PerActor -> PerceptionVisible
- type FactionPers = EnumMap LevelId Perception
- type Pers = EnumMap FactionId FactionPers
Documentation
data Perception
The type representing the perception of a faction on a level. The total visibility holds the sum of FOVs of all actors of a given faction on the level and serves only as a speedup. The fields are not strict because often not all are used.
Perception | |
|
newtype PerceptionVisible
type PerActor = EnumMap ActorId PerceptionVisible
totalVisible :: Perception -> EnumSet Point
The set of tiles visible by at least one hero.
smellVisible :: Perception -> EnumSet Point
The set of tiles smelled by at least one hero.
actorSeesPos :: Perception -> ActorId -> Point -> Bool
Whether an actor can see a position.
nullPer :: Perception -> Bool
addPer :: Perception -> Perception -> Perception
diffPer :: Perception -> Perception -> Perception
smellFromActors :: COps -> State -> PerActor -> PerceptionVisible
type FactionPers = EnumMap LevelId Perception
Perception of a single faction, indexed by level identifier.
type Pers = EnumMap FactionId FactionPers
Perception indexed by faction identifier.
This can't be added to FactionDict
, because clients can't see it.