Safe Haskell | None |
---|
Provides the basic data types and monads for Antisplice.
- type DungeonM a = forall m. MonadDungeon m => m a
- 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 a
- type Handler = ChattyDungeonM ()
- newtype HandlerBox = Handler {}
- type Prerequisite = ChattyDungeonM Bool
- newtype PrerequisiteBox = Prerequisite {}
- class IsText t where
- data Direction
- data RoomState = RoomState {}
- newtype RoomT m a = Room {}
- class Monad m => MonadRoom m where
- getRoomState :: m RoomState
- putRoomState :: RoomState -> m ()
- data PathState = PathState {}
- data StatKey
- = Strength
- | Agility
- | Stamina
- | Intelligence
- | Spirit
- | Armor
- | Haste
- | CooldownDuration
- | AttackPower
- data EquipKey
- data Relation
- data Feature
- data ObjectId
- = ObjectId Int
- | FalseObject
- data KindId
- data ObjectState = ObjectState {
- objectIdOf :: !ObjectId
- objectKindOf :: !KindId
- objectTitleOf :: !Text
- objectDescOf :: !Text
- objectNamesOf :: ![String]
- objectAttributesOf :: ![String]
- objectOnceSeenOf :: !Bool
- objectOnceAcquiredOf :: !Bool
- objectOnceInspectedOf :: !Bool
- objectOnceEquippedOf :: !Bool
- objectMaxHealthOf :: !Int
- objectCurHealthOf :: !Int
- objectRouteOf :: ![NodeId]
- objectFeaturesOf :: AVL Feature
- objectFactionOf :: !(Maybe (Atom Faction))
- objectTriggerOnFirstSightOf :: Handler
- objectTriggerOnEachSightOf :: Handler
- objectTriggerOnFirstAcquireOf :: Handler
- objectTriggerOnEachAcquireOf :: Handler
- objectTriggerOnFirstInspectionOf :: Handler
- objectTriggerOnEachInspectionOf :: Handler
- objectTriggerOnLookAtOf :: Handler
- objectTriggerOnLookIntoOf :: Handler
- objectTriggerOnReadOf :: Handler
- objectTriggerOnEnterOf :: Handler
- objectTriggerOnRoomEnterOf :: Handler
- objectTriggerOnRoomLeaveOf :: Handler
- objectTriggerOnAnnounceOf :: Handler
- objectTriggerOnDropOf :: Handler
- objectTriggerOnFirstEquipOf :: Handler
- objectTriggerOnEachEquipOf :: Handler
- objectTriggerOnUnequipOf :: Handler
- objectTriggerOnDieOf :: Handler
- objectTriggerOnTakeDamageOf :: Handler
- objectTriggerOnUseOf :: Handler
- objectTriggerOnEatOf :: Handler
- objectTriggerOnDrinkOf :: Handler
- newtype ObjectT m a = Object {
- runObjectT :: ObjectState -> m (a, ObjectState)
- class Monad m => MonadObject m where
- getObjectState :: m ObjectState
- putObjectState :: ObjectState -> m ()
- data Faction = Faction {}
- data Attitude
- data Currency = Currency {}
- data CurrencyId
- = Health
- | CurrencyId Int
- data DamageTarget
- newtype PlayerId = PlayerId Int
- data PlayerState = PlayerState {
- playerIdOf :: !PlayerId
- playerRoomOf :: !NodeId
- playerMaxHealthOf :: !Int
- playerInventoryOf :: AVL ObjectState
- playerEquipOf :: AVL (EquipKey, ObjectState)
- playerBaseStatsOf :: AVL (StatKey, Int)
- playerStereosOf :: [Atom PlayerStereo]
- playerReputationOf :: AVL (Atom Faction, Int)
- playerCurrenciesOf :: AVL (CurrencyId, Int)
- playerCooldownsOf :: AVL CooldownId
- playerOpponentOf :: !ObjectId
- playerActiveQuestsOf :: AVL (Atom Quest, QuestRel)
- playerAlcoholOf :: Int
- playerSoberingActiveOf :: Bool
- newtype PlayerT m a = Player {
- runPlayerT :: PlayerState -> m (a, PlayerState)
- class Monad m => MonadPlayer m where
- getPlayerState :: m PlayerState
- putPlayerState :: PlayerState -> m ()
- modifyPlayerState :: (PlayerState -> PlayerState) -> m ()
- data PlayerStereo = PlayerStereo {
- stereoCalcStatBonus :: (StatKey -> Int) -> StatKey -> Int
- stereoSkillBonus :: String -> Maybe (SkillParam -> HandlerBox)
- data CooldownId
- data SkillParam = SkillParam {}
- data GetterResponse
- = Found ObjectState
- | TooMany
- | NoneFound
- data Getters = Getters {}
- data DungeonState = DungeonState {}
- currentRoomOf :: DungeonState -> Maybe NodeId
- playerOf :: DungeonState -> Maybe PlayerState
- newtype DungeonT m a = Dungeon {
- runDungeonT :: DungeonState -> m (a, DungeonState)
- class (MonadRoom m, MonadPlayer m) => MonadDungeon m where
- getDungeonState :: m DungeonState
- putDungeonState :: DungeonState -> m ()
- lowerDungeon :: DungeonT m a -> m a
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
type Prerequisite = ChattyDungeonM BoolSource
The common type of all prerequisites.
newtype PrerequisiteBox Source
A boxed Prerequisite
to avoid ImpredicativeTypes
Utilities
Typeclass for all types that are convertible to or from Text
10 directions to go
Rooms
State type for RoomT
The room monad. Used to create or modify room data.
class Monad m => MonadRoom m whereSource
Typeclass for all room monads.
getRoomState :: m RoomStateSource
Get the room state
putRoomState :: RoomState -> m ()Source
Put the room state
MonadRoom m0 => MonadRoom (AnsiPrinterT m0) | |
MonadRoom m0 => MonadRoom (HtmlPrinterT m0) | |
MonadRoom m0 => MonadRoom (ExpanderT m0) | |
MonadRoom m0 => MonadRoom (NullExpanderT m0) | |
MonadRoom m0 => MonadRoom (RecorderT m0) | |
MonadRoom m0 => MonadRoom (CounterT m0) | |
MonadRoom m0 => MonadRoom (SplErrT m0) | |
MonadRoom m0 => MonadRoom (AtomStoreT m0) | |
MonadRoom m0 => MonadRoom (VocabT m0) | |
Monad m => MonadRoom (DungeonT m) | |
Monad m => MonadRoom (RoomT m) | |
MonadRoom m0 => MonadRoom (StereoBuilderT m0) |
State type for a path from one room to another
Objects
Key for item or player statistics
Key for equipment slot
Relation between the player and the object.
Object features.
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 |
Phantom ID type for objects.
Phantom ID type for object kinds.
data ObjectState Source
State type for ObjectT
The object monad. Used to create or modify objects.
Object | |
|
class Monad m => MonadObject m whereSource
Typeclass for all object monads
getObjectState :: m ObjectStateSource
Get the object state
putObjectState :: ObjectState -> m ()Source
Put the object state
MonadObject m0 => MonadObject (CounterT m0) | |
MonadObject m0 => MonadObject (SplErrT m0) | |
Monad m => MonadObject (ObjectT m) | |
MonadObject m0 => MonadObject (StereoBuilderT m0) |
Factions
A faction
Currencies
Currency descriptor (description and expander name)
data CurrencyId Source
Phantom ID type for currencies
Fight
data DamageTarget Source
Target for attacks. May be a player or an object.
Players
Phantom ID type for players
data PlayerState Source
State type for PlayerT
PlayerState | |
|
The player monad. Used to create or modify players.
Player | |
|
class Monad m => MonadPlayer m whereSource
Typeclass for all player monads.
getPlayerState :: m PlayerStateSource
Get the player state.
putPlayerState :: PlayerState -> m ()Source
Put the player state.
modifyPlayerState :: (PlayerState -> PlayerState) -> m ()Source
Modify the player state.
MonadPlayer m0 => MonadPlayer (AnsiPrinterT m0) | |
MonadPlayer m0 => MonadPlayer (HtmlPrinterT m0) | |
MonadPlayer m0 => MonadPlayer (ExpanderT m0) | |
MonadPlayer m0 => MonadPlayer (NullExpanderT m0) | |
MonadPlayer m0 => MonadPlayer (RecorderT m0) | |
MonadPlayer m0 => MonadPlayer (CounterT m0) | |
MonadPlayer m0 => MonadPlayer (SplErrT m0) | |
MonadPlayer m0 => MonadPlayer (AtomStoreT m0) | |
MonadPlayer m0 => MonadPlayer (VocabT m0) | |
Monad m => MonadPlayer (DungeonT m) | |
Monad m => MonadPlayer (PlayerT m) | |
MonadPlayer m0 => MonadPlayer (StereoBuilderT m0) |
Stereotypes
data PlayerStereo Source
A player stereotype
PlayerStereo | |
|
data CooldownId Source
Phantom ID type for cooldowns
data GetterResponse Source
Response of an object getter
Tuple of object getters
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.
The dungeon monad. Everything runs inside this.
Dungeon | |
|
class (MonadRoom m, MonadPlayer m) => MonadDungeon m whereSource
Typeclass for all dungeon monads.
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
MonadDungeon m0 => MonadDungeon (AnsiPrinterT m0) | |
MonadDungeon m0 => MonadDungeon (HtmlPrinterT m0) | |
MonadDungeon m0 => MonadDungeon (ExpanderT m0) | |
MonadDungeon m0 => MonadDungeon (NullExpanderT m0) | |
MonadDungeon m0 => MonadDungeon (RecorderT m0) | |
MonadDungeon m0 => MonadDungeon (CounterT m0) | |
MonadDungeon m0 => MonadDungeon (SplErrT m0) | |
MonadDungeon m0 => MonadDungeon (AtomStoreT m0) | |
MonadDungeon m0 => MonadDungeon (VocabT m0) | |
Monad m => MonadDungeon (DungeonT m) | |
MonadDungeon m0 => MonadDungeon (StereoBuilderT m0) |