LambdaHack-0.6.1.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Common.ActorState

Description

Operations on the Actor type that need the State type, but not our custom monad types.

Synopsis

Documentation

calculateTotal :: FactionId -> State -> (ItemBag, Int) Source #

Calculate loot's worth for a given faction.

mapActorItems_ :: Monad m => (CStore -> ItemId -> ItemQuant -> m a) -> Actor -> State -> m () Source #

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)

getLocalTime :: LevelId -> State -> Time Source #

Get current time from the dungeon data.

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.

anyFoeAdj :: ActorId -> State -> Bool Source #

Require that any non-dying foe is adjacent. We include even projectiles that explode when stricken down, because they can be caught and then they don't explode, so it makes sense to focus on handling them. If there are many projectiles in a single adjacent position, we only test the first one, the one that would be hit in melee (this is not optimal if the actor would need to flee instead of meleeing, but fleeing with *many* projectiles adjacent is a possible waste of a move anyway).