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

Game.LambdaHack.Common.ActorState

Description

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

Synopsis

# Documentation

Calculate loot's worth for a given faction.

Price an item, taking count into consideration.

mapActorItems_ :: Monad m => (CStore -> ItemId -> ItemQuant -> m a) -> Actor -> State -> m () 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)

Get current time from the dungeon data.

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

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

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.