LambdaHack- A game engine library for roguelike dungeon crawlers

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 a faction of a given actor.

whereTo Source


:: LevelId

level of the stairs

-> Point

position of the stairs

-> Int

jump up this many levels

-> Dungeon

current game dungeon

-> (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 ((ActorId, Actor), [(ItemId, Item)]) Source

Finds an actor at a position on the current level.

memActor :: ActorId -> LevelId -> State -> Bool Source

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 -> Actor Source

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

getLocalTime :: LevelId -> State -> Time Source

Get current time from the dungeon data.

itemPrice :: (Item, Int) -> Int Source

Price an item, taking count into consideration.

lidFromC :: Container -> State -> LevelId Source

Determine the dungeon level of the container. If the item is in a shared stash, the level depends on which actor asks.