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

Safe HaskellSafe-Infered

Game.LambdaHack.ActorState

Description

Operations on the Actor type that need the State type, but not the Action type. TODO: Add an export list and document after it's rewritten according to #17.

Synopsis

Documentation

isAHero :: State -> ActorId -> BoolSource

Checks whether an actor identifier represents a hero.

isAMonster :: State -> ActorId -> BoolSource

Checks whether an actor identifier represents a monster.

smellTimeout :: State -> TimeSource

How long until an actor's smell vanishes from a tile.

findActorAnyLevel :: ActorId -> State -> (LevelId, Actor, [Item])Source

Finds an actor body on any level. Fails if not found.

tryFindActor :: State -> (Actor -> Bool) -> Maybe (ActorId, Actor)Source

Tries to finds an actor body satisfying a predicate on any level.

allHeroesAnyLevel :: State -> [ActorId]Source

The list of actors and their levels for all heroes in the dungeon.

targetToLoc :: IntSet -> State -> Point -> Maybe PointSource

Calculate the location of player's target.

memActor :: ActorId -> State -> BoolSource

Checks if the actor is present on the current level. The order of argument here and in other functions is set to allow

 b <- gets (memActor a)

getActor :: ActorId -> State -> ActorSource

Gets actor body from the current level. Error if not found.

getActorItem :: ActorId -> State -> [Item]Source

Gets actor's items from the current level. Empty list, if not found.

deleteActor :: ActorId -> State -> StateSource

Removes the actor, if present, from the current level.

insertActor :: ActorId -> Actor -> State -> StateSource

Add actor to the current level.

deletePlayer :: State -> StateSource

Removes a player from the current level.

locToActor :: Point -> State -> Maybe ActorIdSource

Finds an actor at a location on the current level. Perception irrelevant.

calculateTotal :: Ops ItemKind -> State -> ([Item], Int)Source

Calculate loot's worth for heroes on the current level.

addHero :: COps -> Point -> State -> StateSource

Create a new hero on the current level, close to the given location.

initialHeroes :: COps -> Point -> State -> StateSource

Create a set of initial heroes on the current level, at location ploc.

addMonster :: Ops TileKind -> Id ActorKind -> Int -> Point -> State -> StateSource

Create a new monster in the level, at a given position and with a given actor kind and HP.

addProjectile :: COps -> Item -> Point -> PartyId -> [Point] -> Time -> State -> StateSource

Create a projectile actor containing the given missile.