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

Safe HaskellNone



The effectToAction function and all it depends on. This file should not depend on Actions.hs nor ItemAction.hs. TODO: Add an export list and document after it's rewritten according to #17.



rndToAction :: Rnd a -> Action aSource

Invoke pseudo-random computation with the generator kept in the state.

updateAnyActor :: ActorId -> (Actor -> Actor) -> Action ()Source

Update actor stats. Works for actors on other levels, too.

updatePlayerBody :: (Actor -> Actor) -> Action ()Source

Update player-controlled actor stats.

effectToAction :: Effect -> Int -> ActorId -> ActorId -> Int -> Bool -> Action (Bool, Bool)Source

The source actor affects the target actor, with a given effect and power. The second argument is verbosity of the resulting message. Both actors are on the current level and can be the same actor. The first bool result indicates if the effect was spectacular enough for the actors to identify it (and the item that caused it, if any). The second bool tells if the effect was seen by or affected the party.

eff :: Effect -> Int -> ActorId -> ActorId -> Int -> Action (Bool, String)Source

The boolean part of the result says if the ation was interesting and the string part describes how the target reacted (not what the source did).

switchLevel :: LevelId -> Action ()Source

Change level and reset it's time and update the times of all actors. The player may be added to lactor of the new level only after this operation is executed.

fleeDungeon :: Action ()Source

The player leaves the dungeon.

itemEffectAction :: Int -> ActorId -> ActorId -> Item -> Bool -> Action ()Source

The source actor affects the target actor, with a given item. If the event is seen, the item may get identified.

discover :: Item -> Action ()Source

Make the item known to the player.

selectPlayer :: ActorId -> Action BoolSource

Make the actor controlled by the player. Switch level, if needed. False, if nothing to do. Should only be invoked as a direct result of a player action or the selected player actor death.

focusIfOurs :: ActorId -> Action BoolSource

Focus on the hero being woundeddisplacedetc.

checkPartyDeath :: Action ()Source

Remove dead heroes (or dead dominated monsters). Check if game is over. For now we only check the selected hero and at current level, but if poison, etc. is implemented, we'd need to check all heroes on any level.

gameOver :: Bool -> Action ()Source

End game, showing the ending screens, if requested.

itemOverlay :: Bool -> Bool -> [Item] -> Action [Overlay]Source

Create a list of item names, split into many overlays.

doLook :: ActionFrame ()Source

Perform look around in the current location of the cursor.