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

Safe HaskellNone

Game.LambdaHack.ActorState

Description

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

Synopsis

Documentation

isProjectile :: State -> ActorId -> BoolSource

Checks whether an actor identifier represents a hero.

isAHero :: State -> ActorId -> BoolSource

Checks whether an actor identifier represents a hero.

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

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

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

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

smellTimeout :: State -> TimeSource

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

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

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

deletePlayer :: State -> StateSource

Removes a player from the current level.

allHeroesAnyLevel :: State -> [ActorId]Source

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

locToActor :: Point -> State -> Maybe ActorIdSource

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

deleteActor :: ActorId -> State -> StateSource

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

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

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

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

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

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

Add actor to the current level.

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.

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

Create a projectile actor containing the given missile.

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

Calculate the location of player's target.