antisplice-0.13.2.2: An engine for text-based dungeons.

Safe HaskellNone

Game.Antisplice.Monad.Dungeon

Contents

Description

Provides the basic data types and monads for Antisplice.

Synopsis

Context quantifiers

type DungeonM a = forall m. MonadDungeon m => m aSource

Matches any MonadDungeon context

type ChattyDungeonM a = forall m. (Functor m, ExtendedPrinter m, MonadExpand m, ExpanderEnv m, MonadDungeon m, MonadError SplErr m, MonadAtoms m, MonadClock m, MonadVocab m, MonadRandom m, Broadcaster PlayerId m) => m aSource

Matches any MonadDungeon context that also implements most of the Chatty classes and some of our utility classes.

type Handler = ChattyDungeonM ()Source

The common type of all event handlers.

newtype HandlerBox Source

A boxed Handler to avoid ImpredicativeTypes

Constructors

Handler 

Fields

runHandler :: Handler
 

type Prerequisite = ChattyDungeonM BoolSource

The common type of all prerequisites.

Utilities

class IsText t whereSource

Typeclass for all types that are convertible to or from Text

Methods

toText :: t -> TextSource

fromText :: Text -> tSource

Instances

data Direction Source

10 directions to go

Rooms

class Monad m => MonadRoom m whereSource

Typeclass for all room monads.

Methods

getRoomState :: m RoomStateSource

Get the room state

putRoomState :: RoomState -> m ()Source

Put the room state

data PathState Source

State type for a path from one room to another

Objects

data StatKey Source

Key for item or player statistics

Instances

data Relation Source

Relation between the player and the object.

Constructors

Near 
Carried 
Worn 

Instances

data Feature Source

Object features.

Constructors

Damagable

May take damage.

Acquirable

May be acquired.

Equipable EquipKey

May be equipped at the given slot.

Redeemable Currency Int

May be redeemed for the given currency.

AutoRedeem Currency Int

Redeem automatically for a given currency.

Weighty Int

Has a known weight.

Played PlayerId

Is connected to a real player.

Mobile

May move around.

Stereo Relation (Atom PlayerStereo)

Implies an additional stereotype for the nearcarryingwearing player

Described (Atom String)

Implies an additional particle for the room description

data ObjectId Source

Phantom ID type for objects.

Constructors

ObjectId Int 
FalseObject 

data KindId Source

Phantom ID type for object kinds.

Constructors

KindId Int 
FalseKind 

Instances

newtype ObjectT m a Source

The object monad. Used to create or modify objects.

Constructors

Object 

Fields

runObjectT :: ObjectState -> m (a, ObjectState)
 

Instances

MonadTrans ObjectT 
ChannelPrinter Bool m0 => ChannelPrinter Bool (ObjectT m0) 
ChannelPrinter Int m0 => ChannelPrinter Int (ObjectT m0) 
ChannelPrinter Handle m0 => ChannelPrinter Handle (ObjectT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (ObjectT m0) 
MonadError SplErr m0 => MonadError SplErr (ObjectT m0) 
Monad m => Monad (ObjectT m) 
Functor m => Functor (ObjectT m) 
HistoryEnv m0 => HistoryEnv (ObjectT m0) 
ExpanderEnv m0 => ExpanderEnv (ObjectT m0) 
MonadExpand m0 => MonadExpand (ObjectT m0) 
ExtendedPrinter m0 => ExtendedPrinter (ObjectT m0) 
MonadSpawn m0 => MonadSpawn (ObjectT m0) 
MonadPrinter m0 => MonadPrinter (ObjectT m0) 
MonadScanner m0 => MonadScanner (ObjectT m0) 
MonadFinalizer m0 => MonadFinalizer (ObjectT m0) 
MonadClock m0 => MonadClock (ObjectT m0) 
MonadRandom m0 => MonadRandom (ObjectT m0) 
MonadIO m0 => MonadIO (ObjectT m0) 
MonadCounter m0 => MonadCounter (ObjectT m0) 
MonadAtoms m0 => MonadAtoms (ObjectT m0) 
MonadVocab m0 => MonadVocab (ObjectT m0) 
Monad m => MonadObject (ObjectT m) 
Monad m => OnDie (ObjectT m) 
Monad m => OnTakeDamage (ObjectT m) 
Monad m => OnRoomLeave (ObjectT m) 
Monad m => OnRoomEnter (ObjectT m) 
Monad m => OnRead (ObjectT m) 
Monad m => OnFirstInspection (ObjectT m) 
Monad m => OnInspection (ObjectT m) 
Monad m => OnFirstAcquire (ObjectT m) 
Monad m => OnAcquire (ObjectT m) 
Monad m => OnFirstSight (ObjectT m) 
Monad m => OnSight (ObjectT m) 
Monad m => OnAnnounce (ObjectT m) 
Monad m => OnLookInto (ObjectT m) 
Monad m => OnLook (ObjectT m) 
Monad m => OnEnter (ObjectT m) 

class Monad m => MonadObject m whereSource

Typeclass for all object monads

Methods

getObjectState :: m ObjectStateSource

Get the object state

putObjectState :: ObjectState -> m ()Source

Put the object state

Factions

data Attitude Source

Constructors

Hostile 
Friendly 
Exalted 

Instances

Currencies

data Currency Source

Currency descriptor (description and expander name)

data CurrencyId Source

Phantom ID type for currencies

Constructors

Health 
CurrencyId Int 

Fight

data DamageTarget Source

Target for attacks. May be a player or an object.

Players

newtype PlayerId Source

Phantom ID type for players

Constructors

PlayerId Int 

Instances

Eq PlayerId 
Ord PlayerId 
Indexable PlayerState PlayerId PlayerState 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (AnsiPrinterT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (HtmlPrinterT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (ExpanderT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (NullExpanderT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (RecorderT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (CounterT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (SplErrT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (AtomStoreT m0) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (VocabT m0) 
ChannelPrinter PlayerId m => Broadcaster PlayerId (DungeonT m) 
(MonadDungeon m0, ChannelPrinter PlayerId m0) => Broadcaster PlayerId (StereoBuilderT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (AnsiPrinterT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (HtmlPrinterT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (ExpanderT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (NullExpanderT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (RecorderT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (CounterT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (SplErrT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (AtomStoreT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (VocabT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (DungeonT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (PlayerT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (ObjectT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (RoomT m0) 
ChannelPrinter PlayerId m0 => ChannelPrinter PlayerId (StereoBuilderT m0) 
HistoryEnv m0 => HistoryEnv (PlayerFilterT m0) 
ExpanderEnv m0 => ExpanderEnv (PlayerFilterT m0) 
MonadExpand m0 => MonadExpand (PlayerFilterT m0) 
MonadSpawn m0 => MonadSpawn (PlayerFilterT m0) 
MonadScanner m0 => MonadScanner (PlayerFilterT m0) 
MonadFinalizer m0 => MonadFinalizer (PlayerFilterT m0) 
MonadClock m0 => MonadClock (PlayerFilterT m0) 
MonadRandom m0 => MonadRandom (PlayerFilterT m0) 
MonadCounter m0 => MonadCounter (PlayerFilterT m0) 
MonadAtoms m0 => MonadAtoms (PlayerFilterT m0) 
MonadVocab m0 => MonadVocab (PlayerFilterT m0) 

class Monad m => MonadPlayer m whereSource

Typeclass for all player monads.

Methods

getPlayerState :: m PlayerStateSource

Get the player state.

putPlayerState :: PlayerState -> m ()Source

Put the player state.

modifyPlayerState :: (PlayerState -> PlayerState) -> m ()Source

Modify the player state.

Stereotypes

data CooldownId Source

Phantom ID type for cooldowns

Dungeons

currentRoomOf :: DungeonState -> Maybe NodeIdSource

For compatibility. Earlier versions of DungeonT had a field for that.

playerOf :: DungeonState -> Maybe PlayerStateSource

For compatibility. Earlier versions of DungeonT had a field for that.

class (MonadRoom m, MonadPlayer m) => MonadDungeon m whereSource

Typeclass for all dungeon monads.

Methods

getDungeonState :: m DungeonStateSource

Get the dungeon state.

putDungeonState :: DungeonState -> m ()Source

Put the dungeon state.

lowerDungeon :: DungeonT m a -> m aSource

Lower a given DungeonT function