LambdaHack-0.2.10.5: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Common.Actor

Contents

Description

Actors in the game: heroes, monsters, etc. No operation in this module involves the State or Action type.

Synopsis

Actor identifiers and related operations

data ActorId Source

A unique identifier of an actor in the dungeon.

monsterGenChance :: Int -> Int -> Int -> Rnd BoolSource

Chance that a new monster is generated. Currently depends on the number of monsters already present, and on the level. In the future, the strength of the character and the strength of the monsters present could further influence the chance, and the chance could also affect which monster is generated. How many and which monsters are generated will also depend on the cave kind used to build the level.

partActor :: Actor -> PartSource

The part of speech describing the actor.

The Actor type

data Actor Source

Actor properties that are changing throughout the game. If they are dublets of properties from ActorKind, they are usually modified temporarily, but tend to return to the original value from ActorKind over time. E.g., HP.

Constructors

Actor 

Fields

bkind :: !(Id ActorKind)

the kind of the actor

bsymbol :: !Char

individual map symbol

bname :: !Text

individual name

bcolor :: !Color

individual map color

bspeed :: !Speed

individual speed

bhp :: !Int

current hit points

bpath :: !(Maybe [Vector])

path the actor is forced to travel

bpos :: !Point

current position

boldpos :: !Point

previous position

blid :: !LevelId

current level

bbag :: !ItemBag

items carried

binv :: !ItemInv

map from letters to items

bletter :: !InvChar

next inventory letter

btime :: !Time

absolute time of next action

bwait :: !Time

last bracing expires at this time

bfid :: !FactionId

to which faction the actor belongs

bproj :: !Bool

is a projectile? (shorthand only, this can be deduced from bkind)

actorTemplate :: Id ActorKind -> Char -> Text -> Color -> Speed -> Int -> Maybe [Vector] -> Point -> LevelId -> Time -> FactionId -> Bool -> ActorSource

A template for a new actor.

timeAddFromSpeed :: Actor -> Time -> TimeSource

Add time taken by a single step at the actor's current speed.

braced :: Actor -> Time -> BoolSource

Whether an actor is braced for combat this clip. If a foe moves just after this actor in the same time moment, the actor won't block, because bwait is reset to zero in ageActorA before the condition is checked.

waitedLastTurn :: Actor -> Time -> BoolSource

The actor most probably waited at most a turn ago (unless his speed was changed, etc.)

unoccupied :: [Actor] -> Point -> BoolSource

Checks for the presence of actors in a position. Does not check if the tile is walkable.

heroKindId :: Ops ActorKind -> Id ActorKindSource

The unique kind of heroes.

projectileKindId :: Ops ActorKind -> Id ActorKindSource

The unique kind of projectiles.

Inventory management

newtype InvChar Source

Constructors

InvChar 

Fields

invChar :: Char
 

type ItemDict = EnumMap ItemId ItemSource

All items in the dungeon (including in actor inventories), indexed by item identifier.

type ItemRev = HashMap Item ItemIdSource

Reverse item map, for item creation, to keep items and item identifiers in bijection.

assignLetter :: ItemId -> Maybe InvChar -> Actor -> Maybe InvCharSource

Assigns a letter to an item, for inclusion in the inventory of a hero. Tries to to use the requested letter, if any.

Assorted

type ActorDict = EnumMap ActorId ActorSource

All actors on the level, indexed by actor identifier.

smellTimeout :: TimeSource

How long until an actor's smell vanishes from a tile.

mapActorItems_ :: Monad m => (ItemId -> Int -> m a) -> Actor -> m ()Source