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

Safe HaskellNone

Game.LambdaHack.Actor

Contents

Description

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

Synopsis

Actor identifiers and related operations

type ActorId = IntSource

A unique identifier of an actor in a dungeon.

findHeroName :: ConfigUI -> Int -> TextSource

Find a hero name in the config file, or create a stock name.

monsterGenChance :: 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 :: Ops ActorKind -> 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 :: !(Maybe Char)

individual map symbol

bname :: !(Maybe Text)

individual name

bcolor :: !(Maybe Color)

individual map color

bspeed :: !(Maybe Speed)

individual speed

bhp :: !Int

current hit points

bdir :: !(Maybe (Vector, Int))

direction and distance of running

btarget :: Target

target for ranged attacks and AI

bloc :: !Point

current location

bletter :: !Char

next inventory letter

btime :: !Time

absolute time of next action

bwait :: !Time

last bracing expires at this time

bfaction :: !(Id FactionKind)

to which faction the actor belongs

bproj :: !Bool

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

Instances

template :: Id ActorKind -> Maybe Char -> Maybe Text -> Int -> Point -> Time -> Id FactionKind -> Bool -> ActorSource

A template for a new non-projectile actor. The initial target is invalid to force a reset ASAP.

addHp :: Ops ActorKind -> Int -> Actor -> ActorSource

Increment current hit points of an actor.

timeAddFromSpeed :: Ops ActorKind -> 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 turn.

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

Checks for the presence of actors in a location. 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.

actorSpeed :: Ops ActorKind -> Actor -> SpeedSource

Access actor speed, individual or, otherwise, stock.

Type of na actor target

data Target Source

The type of na actor target.

Constructors

TEnemy ActorId Point

target an actor with its last seen location

TLoc Point

target a given location

TPath [Vector]

target the list of locations one after another

TCursor

target current position of the cursor; default