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

Safe HaskellNone

Game.LambdaHack.ItemAction

Description

Item UI code with the Action type and everything it depends on that is not already in Action.hs and EffectAction.hs. This file should not depend on Actions.hs. TODO: Add an export list and document after it's rewritten according to #17.

Synopsis

Documentation

inventory :: ActionFrame ()Source

Display inventory

getGroupItemSource

Arguments

:: [Item]

all objects in question

-> Object

name of the group

-> [Char]

accepted item symbols

-> String

prompt

-> String

how to refer to the collection of objects

-> Action Item 

Let the player choose any item with a given group name. Note that this does not guarantee the chosen item belongs to the group, as the player can override the choice.

applyGroupItemSource

Arguments

:: ActorId

actor applying the item (is on current level)

-> Verb

how the applying is called

-> Item

the item to be applied

-> Action () 

projectGroupItemSource

Arguments

:: ActorId

actor projecting the item (is on current lvl)

-> Point

target location of the projectile

-> Verb

how the projecting is called

-> Item

the item to be projected

-> Action () 

targetMonster :: TgtMode -> ActionFrame ()Source

Start the monster targeting mode. Cycle between monster targets.

targetFloor :: TgtMode -> ActionFrame ()Source

Start the floor targeting mode or reset the cursor location to the player.

setCursor :: TgtMode -> ActionFrame ()Source

Set, activate and display cursor information.

epsIncr :: Bool -> Action ()Source

Tweak the eps parameter of the targeting digital line.

endTargeting :: Bool -> Action ()Source

End targeting mode, accepting the current location or not.

cancelCurrent :: ActionFrame () -> ActionFrame ()Source

Cancel something, e.g., targeting mode, resetting the cursor to the position of the player. Chosen target is not invalidated.

acceptCurrent :: ActionFrame () -> ActionFrame ()Source

Accept something, e.g., targeting mode, keeping cursor where it was. Or perform the default action, if nothing needs accepting.

clearCurrent :: Action ()Source

Clear current messages, show the next screen if any.

dropItem :: Action ()Source

Drop a single item.

removeFromInventory :: ActorId -> Item -> Point -> Action ()Source

Remove given item from an actor's inventory or floor. TODO: this is subtly wrong: if identical items are on the floor and in inventory, the floor one will be chosen, regardless of player intention. TODO: right now it ugly hacks (with the ploc) around removing items of dead heros/monsters. The subtle incorrectness helps here a lot, because items of dead heroes land on the floor, so we use them up in inventory, but remove them after use from the floor.

removeFromLoc :: Item -> Point -> Action BoolSource

Remove given item from the given location. Tell if successful.

getAnyItemSource

Arguments

:: String

prompt

-> [Item]

all items in question

-> String

how to refer to the collection of items

-> Action Item 

Let the player choose any item from a list of items.

getItemSource

Arguments

:: String

prompt message

-> (Item -> Bool)

which items to consider suitable

-> String

how to describe suitable items

-> [Item]

all items in question

-> String

how to refer to the collection of items

-> Action Item 

Let the player choose a single, preferably suitable, item from a list of items.