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

Safe HaskellNone
LanguageHaskell2010

Game.Antisplice.Monad.Dungeon

Contents

Description

Provides the basic data types and monads for Antisplice.

Synopsis

Context quantifiers

type DungeonM a = forall m. SomeDungeon m => m a Source

Matches any SomeDungeon context

type ChattyDungeonM a = forall m. SomeChattyDungeon m => m a Source

Matches any SomeChattyDungeon context

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 Bool Source

The common type of all prerequisites.

type Predicate = ChattyDungeonM (Maybe ReError) Source

The common type for all predicates.

Utilities

class IsText t where Source

Typeclass for all types that are convertible to or from Text

Methods

toText :: t -> Text Source

fromText :: Text -> t Source

Instances

Rooms

newtype RoomT m a Source

The room monad. Used to create or modify room data.

Constructors

Room 

Fields

runRoomT :: RoomState -> m (a, RoomState)
 

class Monad m => MonadRoom m where Source

Typeclass for all room monads.

Methods

getRoomState :: m RoomState Source

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

data Relation Source

Relation between the player and the object.

Constructors

Near 
Carried 
Worn 

data Feature Source

Object features.

Constructors

Damagable

May take damage.

Acquirable

May be acquired.

Usable

May be used.

Drinkable

May be drunk.

Eatable

May be eaten.

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 KindId Source

Phantom ID type for object kinds.

Constructors

KindId Int 
FalseKind 

data ObjectState Source

State type for ObjectT

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 
ChChannelPrinter Bool m0 => ChChannelPrinter Bool (ObjectT m) 
ChChannelPrinter Int m0 => ChChannelPrinter Int (ObjectT m) 
ChChannelPrinter Handle m0 => ChChannelPrinter Handle (ObjectT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (ObjectT m) 
MonadError SplErr m0 => MonadError SplErr (ObjectT m) 
Monad m => Monad (ObjectT m) 
Functor m => Functor (ObjectT m) 
(Functor m, Monad m) => Applicative (ObjectT m) 
ChHistoryEnv m0 => ChHistoryEnv (ObjectT m) 
ChExpanderEnv m0 => ChExpanderEnv (ObjectT m) 
ChExpand m0 => ChExpand (ObjectT m) 
ChExtendedPrinter m0 => ChExtendedPrinter (ObjectT m) 
(ChAtoms (ObjectT m0), ChFilesystem m0) => ChFilesystem (ObjectT m) 
ChSpawn m0 => ChSpawn (ObjectT m) 
ChPrinter m0 => ChPrinter (ObjectT m) 
ChBufferedScanner m0 => ChBufferedScanner (ObjectT m) 
ChScanner m0 => ChScanner (ObjectT m) 
ChFinalizer m0 => ChFinalizer (ObjectT m) 
ChClock m0 => ChClock (ObjectT m) 
ChRandom m0 => ChRandom (ObjectT m) 
ChAtoms m0 => ChAtoms (ObjectT m) 
ChCounter m0 => ChCounter (ObjectT m) 
MonadIO m0 => MonadIO (ObjectT m) 
MonadVocab m0 => MonadVocab (ObjectT m) 
Monad m => MonadObject (ObjectT m) 
Monad m => OnUse (ObjectT m) 
Monad m => OnEat (ObjectT m) 
Monad m => OnDrink (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) 
CanLoad m0 n0 => CanLoad (ObjectT m) n 
CanSave m0 n0 => CanSave (ObjectT m) n 
CanMount m0 n0 => CanMount (ObjectT m) n 

class Monad m => MonadObject m where Source

Typeclass for all object monads

Methods

getObjectState :: m ObjectState Source

Get the object state

putObjectState :: ObjectState -> m () Source

Put the object state

Factions

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 
Tuplify PlayerId PlayerId 
Indexable PlayerState PlayerId PlayerState 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (AnsiPrinterT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (HtmlPrinterT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (ExpanderT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (NullExpanderT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (RecorderT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (AtomStoreT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (CounterT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (SplErrT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (VocabT m) 
ChChannelPrinter PlayerId m => ChBroadcaster PlayerId (DungeonT m) 
(MonadDungeon m0, ChChannelPrinter PlayerId m0) => ChBroadcaster PlayerId (StereoBuilderT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (AnsiPrinterT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (HtmlPrinterT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (ExpanderT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (NullExpanderT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (RecorderT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (AtomStoreT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (CounterT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (SplErrT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (VocabT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (DungeonT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (PlayerT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (ObjectT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (RoomT m) 
ChChannelPrinter PlayerId m0 => ChChannelPrinter PlayerId (StereoBuilderT m) 
ChHistoryEnv m0 => ChHistoryEnv (PlayerFilterT m) 
ChExpanderEnv m0 => ChExpanderEnv (PlayerFilterT m) 
ChExpand m0 => ChExpand (PlayerFilterT m) 
(ChAtoms (PlayerFilterT m0), ChFilesystem m0) => ChFilesystem (PlayerFilterT m) 
ChSpawn m0 => ChSpawn (PlayerFilterT m) 
ChScanner m0 => ChScanner (PlayerFilterT m) 
ChFinalizer m0 => ChFinalizer (PlayerFilterT m) 
ChClock m0 => ChClock (PlayerFilterT m) 
ChRandom m0 => ChRandom (PlayerFilterT m) 
ChAtoms m0 => ChAtoms (PlayerFilterT m) 
ChCounter m0 => ChCounter (PlayerFilterT m) 
MonadVocab m0 => MonadVocab (PlayerFilterT m) 
CanLoad m0 n0 => CanLoad (PlayerFilterT m) n 
CanSave m0 n0 => CanSave (PlayerFilterT m) n 
CanMount m0 n0 => CanMount (PlayerFilterT m) n 

class Monad m => MonadPlayer m where Source

Typeclass for all player monads.

Minimal complete definition

getPlayerState, putPlayerState

Methods

getPlayerState :: m PlayerState Source

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

data GetterResponse Source

Response of an object getter

Instances

type Invokable = [String] -> HandlerBox Source

Some handler that may be invoked by the user

type InvokableP = [String] -> PredicateBox Source

Some prerequisite that may be invoked by the user

data RecipeMethod Source

Method of using recipes

Constructors

RecipeMethod Int 

Dungeons

currentRoomOf :: DungeonState -> Maybe NodeId Source

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

playerOf :: DungeonState -> Maybe PlayerState Source

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

class (MonadRoom m, MonadPlayer m) => MonadDungeon m where Source

Typeclass for all dungeon monads.

Minimal complete definition

getDungeonState, putDungeonState

Methods

getDungeonState :: m DungeonState Source

Get the dungeon state.

putDungeonState :: DungeonState -> m () Source

Put the dungeon state.

lowerDungeon :: DungeonT m a -> m a Source

Lower a given DungeonT function