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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Common.ActorState

Description

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

Synopsis

- fidActorNotProjGlobalAssocs :: FactionId -> State -> [(ActorId, Actor)]
- actorAssocs :: (FactionId -> Bool) -> LevelId -> State -> [(ActorId, Actor)]
- fidActorRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)]
- fidActorRegularIds :: FactionId -> LevelId -> State -> [ActorId]
- foeRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)]
- foeRegularList :: FactionId -> LevelId -> State -> [Actor]
- friendRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)]
- friendRegularList :: FactionId -> LevelId -> State -> [Actor]
- bagAssocs :: State -> ItemBag -> [(ItemId, Item)]
- bagAssocsK :: State -> ItemBag -> [(ItemId, (Item, ItemQuant))]
- posToBig :: Point -> LevelId -> State -> Maybe ActorId
- posToBigAssoc :: Point -> LevelId -> State -> Maybe (ActorId, Actor)
- posToProjs :: Point -> LevelId -> State -> [ActorId]
- posToProjAssocs :: Point -> LevelId -> State -> [(ActorId, Actor)]
- posToAids :: Point -> LevelId -> State -> [ActorId]
- posToAidAssocs :: Point -> LevelId -> State -> [(ActorId, Actor)]
- calculateTotal :: FactionId -> State -> (ItemBag, Int)
- itemPrice :: Int -> ItemKind -> Int
- findIid :: ActorId -> FactionId -> ItemId -> State -> [(ActorId, (Actor, CStore))]
- combinedItems :: FactionId -> State -> ItemBag
- getActorBody :: ActorId -> State -> Actor
- getActorMaxSkills :: ActorId -> State -> Skills
- actorCurrentSkills :: Maybe ActorId -> ActorId -> State -> Skills
- canTraverse :: ActorId -> State -> Bool
- getCarriedAssocsAndTrunk :: Actor -> State -> [(ItemId, Item)]
- getContainerBag :: Container -> State -> ItemBag
- getFloorBag :: LevelId -> Point -> State -> ItemBag
- getEmbedBag :: LevelId -> Point -> State -> ItemBag
- getBodyStoreBag :: Actor -> CStore -> State -> ItemBag
- getFactionStashBag :: FactionId -> State -> ItemBag
- mapActorItems_ :: Monad m => (CStore -> ItemId -> ItemQuant -> m ()) -> Actor -> State -> m ()
- getActorAssocs :: ActorId -> CStore -> State -> [(ItemId, (Item, ItemQuant))]
- memActor :: ActorId -> LevelId -> State -> Bool
- getLocalTime :: LevelId -> State -> Time
- regenCalmDelta :: ActorId -> Actor -> State -> Int64
- actorInAmbient :: Actor -> State -> Bool
- dispEnemy :: ActorId -> ActorId -> Skills -> State -> Bool
- itemToFull :: ItemId -> State -> ItemFull
- fullAssocs :: ActorId -> [CStore] -> State -> [(ItemId, ItemFull)]
- kitAssocs :: ActorId -> [CStore] -> State -> [(ItemId, ItemFullKit)]
- getItemKindId :: Item -> State -> ContentId ItemKind
- getIidKindId :: ItemId -> State -> ContentId ItemKind
- getItemKind :: Item -> State -> ItemKind
- getIidKind :: ItemId -> State -> ItemKind
- getItemKindIdServer :: Item -> State -> ContentId ItemKind
- getIidKindIdServer :: ItemId -> State -> ContentId ItemKind
- getItemKindServer :: Item -> State -> ItemKind
- getIidKindServer :: ItemId -> State -> ItemKind
- tileAlterable :: LevelId -> Point -> State -> Bool
- lidFromC :: Container -> State -> LevelId
- posFromC :: Container -> State -> Point
- anyFoeAdj :: ActorId -> State -> Bool
- anyHarmfulFoeAdj :: ActorMaxSkills -> ActorId -> State -> Bool
- adjacentBigAssocs :: Actor -> State -> [(ActorId, Actor)]
- adjacentProjAssocs :: Actor -> State -> [(ActorId, Actor)]
- armorHurtBonus :: ActorId -> ActorId -> State -> Int
- inMelee :: ActorMaxSkills -> FactionId -> LevelId -> State -> Bool

# Documentation

fidActorNotProjGlobalAssocs :: FactionId -> State -> [(ActorId, Actor)] Source #

actorAssocs :: (FactionId -> Bool) -> LevelId -> State -> [(ActorId, Actor)] Source #

fidActorRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)] Source #

fidActorRegularIds :: FactionId -> LevelId -> State -> [ActorId] Source #

foeRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)] Source #

foeRegularList :: FactionId -> LevelId -> State -> [Actor] Source #

friendRegularAssocs :: FactionId -> LevelId -> State -> [(ActorId, Actor)] Source #

friendRegularList :: FactionId -> LevelId -> State -> [Actor] Source #

bagAssocs :: State -> ItemBag -> [(ItemId, Item)] Source #

bagAssocsK :: State -> ItemBag -> [(ItemId, (Item, ItemQuant))] Source #

posToBig :: Point -> LevelId -> State -> Maybe ActorId Source #

posToBigAssoc :: Point -> LevelId -> State -> Maybe (ActorId, Actor) Source #

posToProjs :: Point -> LevelId -> State -> [ActorId] Source #

posToProjAssocs :: Point -> LevelId -> State -> [(ActorId, Actor)] Source #

posToAids :: Point -> LevelId -> State -> [ActorId] Source #

posToAidAssocs :: Point -> LevelId -> State -> [(ActorId, Actor)] Source #

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.

findIid :: ActorId -> FactionId -> ItemId -> State -> [(ActorId, (Actor, CStore))] Source #

combinedItems :: FactionId -> State -> ItemBag Source #

getActorBody :: ActorId -> State -> Actor Source #

getActorMaxSkills :: ActorId -> State -> Skills Source #

actorCurrentSkills :: Maybe ActorId -> ActorId -> State -> Skills Source #

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

getCarriedAssocsAndTrunk :: Actor -> State -> [(ItemId, Item)] Source #

getContainerBag :: Container -> State -> ItemBag Source #

getFloorBag :: LevelId -> Point -> State -> ItemBag Source #

getEmbedBag :: LevelId -> Point -> State -> ItemBag Source #

getBodyStoreBag :: Actor -> CStore -> State -> ItemBag Source #

getFactionStashBag :: FactionId -> State -> ItemBag Source #

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

getActorAssocs :: ActorId -> CStore -> State -> [(ItemId, (Item, ItemQuant))] 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.

regenCalmDelta :: ActorId -> Actor -> State -> Int64 Source #

actorInAmbient :: Actor -> State -> Bool Source #

dispEnemy :: ActorId -> ActorId -> Skills -> State -> Bool Source #

itemToFull :: ItemId -> State -> ItemFull Source #

fullAssocs :: ActorId -> [CStore] -> State -> [(ItemId, ItemFull)] Source #

kitAssocs :: ActorId -> [CStore] -> State -> [(ItemId, ItemFullKit)] Source #

getItemKindId :: Item -> State -> ContentId ItemKind Source #

getIidKindId :: ItemId -> State -> ContentId ItemKind Source #

getItemKind :: Item -> State -> ItemKind Source #

getIidKind :: ItemId -> State -> ItemKind Source #

getItemKindIdServer :: Item -> State -> ContentId ItemKind Source #

getIidKindIdServer :: ItemId -> State -> ContentId ItemKind Source #

getItemKindServer :: Item -> State -> ItemKind Source #

getIidKindServer :: ItemId -> State -> ItemKind Source #

tileAlterable :: LevelId -> Point -> State -> Bool Source #

lidFromC :: Container -> State -> LevelId Source #

Determine the dungeon level of the container. If the item is in the shared stash, the level depends on which actor asks, not where the stash is located physically.

posFromC :: Container -> State -> Point Source #

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

anyHarmfulFoeAdj :: ActorMaxSkills -> ActorId -> State -> Bool Source #

adjacentBigAssocs :: Actor -> State -> [(ActorId, Actor)] Source #

adjacentProjAssocs :: Actor -> State -> [(ActorId, Actor)] Source #

armorHurtBonus :: ActorId -> ActorId -> State -> Int Source #

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

Check if any non-dying foe is adjacent to any of our normal actors and either can harm them via melee or can attack from a distance. Otherwise no point meleeing him. Projectiles are ignored, because they are not actively attempted to melee, see `meleeAny`. This is regardless of whether our actor can melee or just needs to flee, in which case alert is needed so that he is not slowed down by others. However, if our actor can't move nor melee, no real combat is taking place. This is needed only by AI and computed as lazily as possible.