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

Safe HaskellNone



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.



calculateTotal :: Actor -> State -> (ItemBag, Int)Source

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

Warning: scores are shown during the game, so when the server calculates then, we should be careful not to leak secret information (e.g., the nature of the items through the total worth of inventory).



:: State

game state

-> LevelId

start from this level

-> Int

jump down this many levels

-> Maybe (LevelId, Point)

target level and the position of its receiving stairs

Compute the level identifier and starting position on the level, after a level change.

posToActor :: Point -> LevelId -> State -> Maybe ActorIdSource

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

memActor :: ActorId -> LevelId -> 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 <- getsState (memActor a)

getActorBody :: ActorId -> State -> ActorSource

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

getActorItem :: ActorId -> State -> [(ItemId, Item)]Source

Gets actor's items from the current level. Warning: this does not work for viewing items of actors from remote level.