Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides the basic data types and monads for Antisplice.
- type DungeonM a = forall m. SomeDungeon m => m a
- type ChattyDungeonM a = forall m. SomeChattyDungeon m => m a
- type Handler = ChattyDungeonM ()
- newtype HandlerBox = Handler {}
- type Prerequisite = ChattyDungeonM Bool
- newtype PrerequisiteBox = Prerequisite {}
- type Predicate = ChattyDungeonM (Maybe ReError)
- newtype PredicateBox = Predicate {}
- 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
- data EquipKey
- data Relation
- data Feature
- data ObjectId
- 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 Invokable
- stereoRecipeBonus :: String -> Maybe (RecipeMethod -> Invokable)
- data CooldownId
- data GetterResponse
- type Invokable = [String] -> HandlerBox
- type InvokableP = [String] -> PredicateBox
- data RecipeMethod = RecipeMethod Int
- 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 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
type Prerequisite = ChattyDungeonM Bool Source
The common type of all prerequisites.
newtype PrerequisiteBox Source
A boxed Prerequisite
to avoid ImpredicativeTypes
type Predicate = ChattyDungeonM (Maybe ReError) Source
The common type for all predicates.
newtype PredicateBox Source
A boxed Predicate
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 where Source
Typeclass for all room monads.
getRoomState :: m RoomState Source
Get the room state
putRoomState :: RoomState -> m () Source
Put the room state
MonadRoom m0 => MonadRoom (AnsiPrinterT m) | |
MonadRoom m0 => MonadRoom (HtmlPrinterT m) | |
MonadRoom m0 => MonadRoom (ExpanderT m) | |
MonadRoom m0 => MonadRoom (NullExpanderT m) | |
MonadRoom m0 => MonadRoom (RecorderT m) | |
MonadRoom m0 => MonadRoom (AtomStoreT m) | |
MonadRoom m0 => MonadRoom (CounterT m) | |
MonadRoom m0 => MonadRoom (SplErrT m) | |
MonadRoom m0 => MonadRoom (VocabT m) | |
Monad m => MonadRoom (DungeonT m) | |
Monad m => MonadRoom (RoomT m) | |
MonadRoom m0 => MonadRoom (StereoBuilderT m) |
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 where Source
Typeclass for all object monads
getObjectState :: m ObjectState Source
Get the object state
putObjectState :: ObjectState -> m () Source
Put the object state
MonadObject m0 => MonadObject (CounterT m) | |
MonadObject m0 => MonadObject (SplErrT m) | |
Monad m => MonadObject (ObjectT m) | |
MonadObject m0 => MonadObject (StereoBuilderT m) |
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 where Source
Typeclass for all player monads.
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.
MonadPlayer m0 => MonadPlayer (AnsiPrinterT m) | |
MonadPlayer m0 => MonadPlayer (HtmlPrinterT m) | |
MonadPlayer m0 => MonadPlayer (ExpanderT m) | |
MonadPlayer m0 => MonadPlayer (NullExpanderT m) | |
MonadPlayer m0 => MonadPlayer (RecorderT m) | |
MonadPlayer m0 => MonadPlayer (AtomStoreT m) | |
MonadPlayer m0 => MonadPlayer (CounterT m) | |
MonadPlayer m0 => MonadPlayer (SplErrT m) | |
MonadPlayer m0 => MonadPlayer (VocabT m) | |
Monad m => MonadPlayer (DungeonT m) | |
Monad m => MonadPlayer (PlayerT m) | |
MonadPlayer m0 => MonadPlayer (StereoBuilderT m) |
Stereotypes
data PlayerStereo Source
A player stereotype
PlayerStereo | |
|
data CooldownId Source
Phantom ID type for cooldowns
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
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.
The dungeon monad. Everything runs inside this.
Dungeon | |
|
class (MonadRoom m, MonadPlayer m) => MonadDungeon m where Source
Typeclass for all dungeon monads.
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
MonadDungeon m0 => MonadDungeon (AnsiPrinterT m) | |
MonadDungeon m0 => MonadDungeon (HtmlPrinterT m) | |
MonadDungeon m0 => MonadDungeon (ExpanderT m) | |
MonadDungeon m0 => MonadDungeon (NullExpanderT m) | |
MonadDungeon m0 => MonadDungeon (RecorderT m) | |
MonadDungeon m0 => MonadDungeon (AtomStoreT m) | |
MonadDungeon m0 => MonadDungeon (CounterT m) | |
MonadDungeon m0 => MonadDungeon (SplErrT m) | |
MonadDungeon m0 => MonadDungeon (VocabT m) | |
Monad m => MonadDungeon (DungeonT m) | |
MonadDungeon m0 => MonadDungeon (StereoBuilderT m) |