Safe Haskell | None |
---|
Actors in the game: heroes, monsters, etc. No operation in this module
involves the State
or Action
type.
- data ActorId
- monsterGenChance :: Int -> Int -> Int -> Rnd Bool
- partActor :: Actor -> Part
- data Actor = Actor {}
- actorTemplate :: Id ActorKind -> Char -> Text -> Color -> Speed -> Int -> Maybe [Vector] -> Point -> LevelId -> Time -> FactionId -> Bool -> Actor
- timeAddFromSpeed :: Actor -> Time -> Time
- braced :: Actor -> Time -> Bool
- waitedLastTurn :: Actor -> Time -> Bool
- unoccupied :: [Actor] -> Point -> Bool
- heroKindId :: Ops ActorKind -> Id ActorKind
- projectileKindId :: Ops ActorKind -> Id ActorKind
- type ItemBag = EnumMap ItemId Int
- type ItemInv = EnumMap InvChar ItemId
- newtype InvChar = InvChar {}
- type ItemDict = EnumMap ItemId Item
- type ItemRev = HashMap Item ItemId
- allLetters :: [InvChar]
- assignLetter :: ItemId -> Maybe InvChar -> Actor -> Maybe InvChar
- letterLabel :: InvChar -> Part
- letterRange :: [InvChar] -> Text
- rmFromBag :: Int -> ItemId -> ItemBag -> ItemBag
- type ActorDict = EnumMap ActorId Actor
- smellTimeout :: Time
- mapActorItems_ :: Monad m => (ItemId -> Int -> m a) -> Actor -> m ()
Actor identifiers and related operations
data ActorId
A unique identifier of an actor in the dungeon.
monsterGenChance :: Int -> Int -> Int -> Rnd Bool
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.
The Acto
r type
data Actor
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.
Actor | |
|
actorTemplate :: Id ActorKind -> Char -> Text -> Color -> Speed -> Int -> Maybe [Vector] -> Point -> LevelId -> Time -> FactionId -> Bool -> Actor
A template for a new non-projectile actor.
timeAddFromSpeed :: Actor -> Time -> Time
Add time taken by a single step at the actor's current speed.
braced :: Actor -> Time -> Bool
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 -> Bool
The actor most probably waited at most a turn ago (unless his speed was changed, etc.)
unoccupied :: [Actor] -> Point -> Bool
Checks for the presence of actors in a position. Does not check if the tile is walkable.
heroKindId :: Ops ActorKind -> Id ActorKind
The unique kind of heroes.
projectileKindId :: Ops ActorKind -> Id ActorKind
The unique kind of projectiles.
Inventory management
newtype InvChar
type ItemDict = EnumMap ItemId Item
All items in the dungeon (including in actor inventories), indexed by item identifier.
type ItemRev = HashMap Item ItemId
Reverse item map, for item creation, to keep items and item identifiers in bijection.
allLetters :: [InvChar]
assignLetter :: ItemId -> Maybe InvChar -> Actor -> Maybe InvChar
Assigns a letter to an item, for inclusion in the inventory of a hero. Tries to to use the requested letter, if any.
letterLabel :: InvChar -> Part
letterRange :: [InvChar] -> Text
Assorted
smellTimeout :: Time
How long until an actor's smell vanishes from a tile.