antisplice-0.13.1.0: An engine for text-based dungeons.

Safe HaskellNone

Game.Antisplice.Skills

Contents

Description

Provides utility functions for composing skills

Synopsis

Utility types

data Condition Source

A wrapper type for skill execution preconditions.

data Consumer Source

A single consumer. Build it using bareAction, bareCondition and monoid concatenation.

data Skill Source

A skill. Build it using the !+ compositor and the skill function.

Instances

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.