Safe Haskell | None |
---|
Provides utility functions for composing skills
- data Condition
- data Consumer
- data Skill = Skill {
- skillConditionOf :: !Condition
- skillActionOf :: !(SkillParam -> Handler)
- skillNameOf :: !String
- class ToConsumer c where
- toConsumer :: c -> Consumer
- (!+) :: ToConsumer c => Skill -> c -> Skill
- (>!+) :: (ToConsumer c, Monad m) => m Skill -> c -> m Skill
- (!+>) :: (ToConsumer c, Monad m) => Skill -> m c -> m Skill
- (>!+>) :: (ToConsumer c, Monad m) => m Skill -> m c -> m Skill
- skill :: String -> Skill
- bareAction :: (SkillParam -> Handler) -> Consumer
- bareCondition :: (SkillParam -> ChattyDungeonM Bool) -> Consumer
- focusDirectC :: Consumer
- optionallyFocusDirectC :: Consumer
- runSkill :: Skill -> SkillParam -> Handler
- wrapSkills :: [Skill] -> String -> Maybe (SkillParam -> HandlerBox)
Utility types
A wrapper type for skill execution preconditions.
A single consumer. Build it using bareAction
, bareCondition
and monoid concatenation.
Skill | |
|
class ToConsumer c whereSource
Typeclass for everything that may act as a consumer.
toConsumer :: c -> ConsumerSource
Compositors
(!+) :: ToConsumer c => Skill -> c -> SkillSource
Add a consumer to the skill.
(>!+) :: (ToConsumer c, Monad m) => m Skill -> c -> m SkillSource
Add a consumer to the monadic skill
(!+>) :: (ToConsumer c, Monad m) => Skill -> m c -> m SkillSource
Add a monadic consumer to the skill
(>!+>) :: (ToConsumer c, Monad m) => m Skill -> m c -> m SkillSource
Add a monadic consumer to the monadic skill
Skill builders
skill :: String -> SkillSource
Build a bogus skill that does nothing but has a name. Use this with !+
to build powerful skills.
bareAction :: (SkillParam -> Handler) -> ConsumerSource
Build a consumer from an action.
bareCondition :: (SkillParam -> ChattyDungeonM Bool) -> ConsumerSource
Build a consumer from a condition.
Sample consumers
focusDirectC :: ConsumerSource
Focus direct object
optionallyFocusDirectC :: ConsumerSource
Optionally ocus direct object (obligatory if none is focused yet)
Final wrappers
runSkill :: Skill -> SkillParam -> HandlerSource
Run the given skill
wrapSkills :: [Skill] -> String -> Maybe (SkillParam -> HandlerBox)Source
Wrap the skills into a form that is accepted by stereotypes.