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) => 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 ObjectState = ObjectState {
- objectIdOf :: !ObjectId
- 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
- 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
- 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 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 ()
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
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.
MonadTrans RoomT | |
Run RoomT | |
MonadError SplErr m0 => MonadError SplErr (RoomT m0) | |
Monad m => Monad (RoomT m) | |
Functor m => Functor (RoomT m) | |
HistoryEnv m0 => HistoryEnv (RoomT m0) | |
ExpanderEnv m0 => ExpanderEnv (RoomT m0) | |
MonadExpand m0 => MonadExpand (RoomT m0) | |
ExtendedPrinter m0 => ExtendedPrinter (RoomT m0) | |
MonadSpawn m0 => MonadSpawn (RoomT m0) | |
MonadPrinter m0 => MonadPrinter (RoomT m0) | |
MonadScanner m0 => MonadScanner (RoomT m0) | |
MonadFinalizer m0 => MonadFinalizer (RoomT m0) | |
MonadClock m0 => MonadClock (RoomT m0) | |
MonadRandom m0 => MonadRandom (RoomT m0) | |
MonadIO m0 => MonadIO (RoomT m0) | |
MonadCounter m0 => MonadCounter (RoomT m0) | |
MonadAtoms m0 => MonadAtoms (RoomT m0) | |
MonadVocab m0 => MonadVocab (RoomT m0) | |
Monad m => MonadRoom (RoomT m) | |
Monad m => OnAnnounce (RoomT m) | |
Monad m => OnLook (RoomT m) | |
Monad m => OnFirstEnter (RoomT m) | |
Monad m => OnEnter (RoomT m) |
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
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. |
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.
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 | |
|
MonadTrans PlayerT | |
MonadError SplErr m0 => MonadError SplErr (PlayerT m0) | |
Monad m => Monad (PlayerT m) | |
Functor m => Functor (PlayerT m) | |
HistoryEnv m0 => HistoryEnv (PlayerT m0) | |
ExpanderEnv m0 => ExpanderEnv (PlayerT m0) | |
MonadExpand m0 => MonadExpand (PlayerT m0) | |
ExtendedPrinter m0 => ExtendedPrinter (PlayerT m0) | |
MonadSpawn m0 => MonadSpawn (PlayerT m0) | |
MonadPrinter m0 => MonadPrinter (PlayerT m0) | |
MonadScanner m0 => MonadScanner (PlayerT m0) | |
MonadFinalizer m0 => MonadFinalizer (PlayerT m0) | |
MonadClock m0 => MonadClock (PlayerT m0) | |
MonadRandom m0 => MonadRandom (PlayerT m0) | |
MonadIO m0 => MonadIO (PlayerT m0) | |
MonadCounter m0 => MonadCounter (PlayerT m0) | |
MonadAtoms m0 => MonadAtoms (PlayerT m0) | |
MonadVocab m0 => MonadVocab (PlayerT m0) | |
Monad m => MonadPlayer (PlayerT m) | |
Monad m => HasStatsM (PlayerT m) |
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 (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
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 | |
|
MonadTrans DungeonT | |
Run DungeonT | |
MonadError SplErr m0 => MonadError SplErr (DungeonT m0) | |
Monad m => Monad (DungeonT m) | |
Functor m => Functor (DungeonT m) | |
HistoryEnv m0 => HistoryEnv (DungeonT m0) | |
ExpanderEnv m0 => ExpanderEnv (DungeonT m0) | |
MonadExpand m => MonadExpand (DungeonT m) | |
ExtendedPrinter m0 => ExtendedPrinter (DungeonT m0) | |
MonadPrinter m0 => MonadPrinter (DungeonT m0) | |
MonadScanner m0 => MonadScanner (DungeonT m0) | |
MonadFinalizer m0 => MonadFinalizer (DungeonT m0) | |
MonadClock m0 => MonadClock (DungeonT m0) | |
MonadRandom m0 => MonadRandom (DungeonT m0) | |
MonadIO m0 => MonadIO (DungeonT m0) | |
MonadCounter m0 => MonadCounter (DungeonT m0) | |
MonadAtoms m0 => MonadAtoms (DungeonT m0) | |
MonadVocab m0 => MonadVocab (DungeonT m0) | |
Monad m => MonadDungeon (DungeonT m) | |
Monad m => MonadPlayer (DungeonT m) | |
Monad m => MonadRoom (DungeonT m) |
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.
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) |