antisplice-0.17.1.1: 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

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

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 PlayerT m a Source

The player monad. Used to create or modify players.

Constructors

Player 

Fields

runPlayerT :: PlayerState -> m (a, PlayerState)
 

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

Response of an object getter

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.

newtype DungeonT m a Source

The dungeon monad. Everything runs inside this.

Constructors

Dungeon 

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