antisplice-0.11.0.4: 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) => 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

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

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 

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.