LambdaHack- A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone



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



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

Calculate loot's worth for a given faction.

itemPrice :: Int -> ItemKind -> Int Source #

Price an item, taking count into consideration.

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).

inMelee :: FactionId -> LevelId -> State -> Bool Source #

Check if any non-dying foe (projectile or not) is adjacent to any of our normal actors (whether they can melee or just need to flee, in which case alert is needed so that they are not slowed down by others). This is needed only by AI and computed as lazily as possible.