-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A game engine for playing werewolf within an arbitrary chat client
--   
--   A game engine for playing werewolf within an arbitrary chat client.
--   Werewolf is a well known social party game, commonly also called
--   Mafia. See the Wikipedia article for a rundown on its gameplay
--   and history.
@package werewolf
@version 1.5.1.1

-- | A response is used as a return result of calling the werewolf
--   binary. Each response has a list of associated messages.
--   
--   werewolf was designed to be ambivalent to the playing chat
--   client. The response-message structure reflects this by staying away
--   from anything that could be construed as client-specific. This
--   includes features such as emoji support.
module Game.Werewolf.Response

-- | When a user sends a command to the werewolf binary, a
--   response is always returned.
--   
--   The chat interface should then relay any messages from the
--   response. Whether or not the command was valid (indicated by the
--   ok flag) is often irrelevant as the returned
--   messages will include errors to the user.
data Response
Response :: Bool -> [Message] -> Response

-- | Boolean flag to indicate success.
[ok] :: Response -> Bool

-- | List of messages.
[messages] :: Response -> [Message]

-- | A successful, empty response.
success :: Response

-- | An unsuccessful, empty response.
failure :: Response

-- | Exits fast with the given response. The response is encoded as JSON,
--   printed to stdout and then the program is exited with
--   0 (success).
--   
--   The program always exits with success even if the response was a
--   failure one. This is to distinguish between bad calls to the binary
--   and bad commands to the werewolf engine.
exitWith :: MonadIO m => Response -> m a

-- | A message may be either public or private, indicated by its
--   to field.
--   
--   Each message contains a single text field. This field is permitted to
--   contain special characters such as new lines and tabs.
data Message
Message :: Maybe Text -> Text -> Message

-- | The message recipient: Nothing for a public message,
--   Just for a private message.
[to] :: Message -> Maybe Text

-- | The message text.
[message] :: Message -> Text

-- | Creates a public message with the given text.
publicMessage :: Text -> Message

-- | 
--   privateMessage to message
--   
--   
--   Creates a private message to to with the given text.
privateMessage :: Text -> Text -> Message

-- | 
--   groupMessages tos message
--   
--   
--   Creates multiple private messages (1 to each recipient) with the given
--   text.
groupMessages :: [Text] -> Text -> [Message]
instance GHC.Show.Show Game.Werewolf.Response.Response
instance GHC.Generics.Generic Game.Werewolf.Response.Response
instance GHC.Classes.Eq Game.Werewolf.Response.Response
instance GHC.Show.Show Game.Werewolf.Response.Message
instance GHC.Generics.Generic Game.Werewolf.Response.Message
instance GHC.Classes.Eq Game.Werewolf.Response.Message
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Message
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Message

-- | Extra utility functions for working with the interpolate Quasi Quoter.
module Data.String.Interpolate.Extra
iFile :: QuasiQuoter

-- | Humanise type class for displaying data structures to a human.
module Data.String.Humanise
class Humanise a
humanise :: Humanise a => a -> Text
instance Data.String.Humanise.Humanise Data.Text.Internal.Text
instance Data.String.Humanise.Humanise a => Data.String.Humanise.Humanise [a]

-- | Roles are split into four categories:
--   
--   
--   
- The Ambiguous.
--   
- The Loners.
--   
- The Villagers.
--   
- The Werewolves.
--   
module Game.Werewolf.Role

-- | Role definitions require only a few pieces of information.
--   
--   The balance attribute on a role indicates the allegiance it
--   favours. For example, a Simple Werewolf has a balance of -4 while the
--   Seer has a balance of 2. A balance of 0 means it favours neither
--   allegiance.
--   
--   N.B., role equality is defined on just the tag as a role's
--   allegiance may change throughout the game.
data Role
tag :: Lens' Role Text
name :: Lens' Role Text
allegiance :: Lens' Role Allegiance
balance :: Lens' Role Int
activity :: Lens' Role Activity
description :: Lens' Role Text
rules :: Lens' Role Text

-- | The NoOne allegiance is used for the Loners. It is not used to
--   determine who has won (i.e., if one Loner wins, the others still
--   lose).
data Allegiance
NoOne :: Allegiance
Necromancer :: Allegiance
Villagers :: Allegiance
Werewolves :: Allegiance
_NoOne :: Prism' Allegiance ()
_Necromancer :: Prism' Allegiance ()
_Villagers :: Prism' Allegiance ()
_Werewolves :: Prism' Allegiance ()

-- | Defines whether a role is diurnal or nocturnal. I.e., if the role's
--   turn occurs during the day or night.
data Activity
Diurnal :: Activity
Nocturnal :: Activity
_Diurnal :: Prism' Activity ()
_Nocturnal :: Prism' Activity ()

-- | A list containing all the roles defined in this file.
allRoles :: [Role]

-- | A list containing roles that are restricted to a single instance per
--   Game.
--   
--   
--   restrictedRoles = allRoles \\ [simpleVillagerRole, simpleWerewolfRole, spitefulVillagerRole, zombieRole]
--   
--   
restrictedRoles :: [Role]

-- | Abandoned by their parents as a child, with no-one wanting to look
--   after another mouth to feed, the Orphan was left to fend for
--   themself. No-one looked twice at the Orphan and even fewer
--   showed kindness towards the lonely child. One day however, one
--   townsperson changed all this. He offered the Orphan food, water
--   and a roof over their head. Grateful for his chairty and
--   affection, the Orphan made him their role model. Pray that no ill
--   should befall their role model, for they are the only one
--   conforming the Orphan as a Villager.
--   
--   On the first night, the Orphan chooses a player to become their role
--   model. So long as the role model is alive, the Orphan is a Villager.
--   If however the role model is eliminated, then the Orphan becomes a
--   Werewolf.
orphanRole :: Role

-- | Hah, maybe not as liked as the Jester, but the Drunk sure does
--   their fair share of stupid things in the night! No-one knows if
--   they even actually make it home; sometimes people see them
--   sleeping outside the Blacksmith's home, others say they see them
--   wandering towards the woods. It's pointless quizzing the
--   Village Drunk in the morning about their doings; they can never
--   remember what they did!
--   
--   The Village Drunk is initially aligned with the Villagers.
--   
--   On the third night the Village Drunk sobers up and is randomly
--   assigned a new alignment, either Villagers or Werewolves.
villageDrunkRole :: Role

-- | Normally the Dullahan carries their head under one arm, however
--   while amongst the Villagers, they ere on the side of caution
--   and rest it in a more traditional place. The Dullahan rides a
--   black horse as dark as night and hunts down travellers in the
--   countryside. Beware if the Dullahan knows your name, for you
--   are then marked for death and you should avoid them at all /costs.
--   
--   The Dullahan is given a list of player names at the start of the game.
--   To win, they must eliminate all of them before the end of the game.
dullahanRole :: Role

-- | Long ago during the War in Heaven, angels fell from the sky as one
--   by one those that followed Lucifer were defeated. For centuries
--   they lived amongst mortal Villagers as punishment for their
--   sins and wrongdoings. The Fallen Angel was one such being and is now
--   one of the few angels left on Earth. Nothing is worse
--   punishment for them, the Fallen Angel yearns for death to once
--   again be free!
--   
--   The Fallen Angel wins if they manage to get lynched by the Villagers
--   before the end of the game.
fallenAngelRole :: Role

-- | The dead are feared among the living; the dead outnumber the
--   living. In most villages the dead remain that way, but not when
--   the Necromancer is present. The Necromancer devoted their life
--   to learning black magic and methods of bringing people back to life.
--   Unfortunately this art is hard to perfect and all they can
--   manage to bring back are soulless Zombies.
--   
--   Once per game the Necromancer can choose to resurrect all dead players
--   as Zombies. The Zombies are aligned with the Necromancer and they
--   cannot be lynched or devoured.
--   
--   If the Necromancer is killed, all Zombies die with them.
--   
--   The Necromancer and Zombies win if they are the last ones alive.
necromancerRole :: Role

-- | A loyal follower of the Necromancer. A Zombie has no mind of its
--   own and blindly obeys every command of their master.
--   
--   A Zombie wins with the Necromancer. They cannot be killed, however
--   they die when the Necromancer dies.
zombieRole :: Role

-- | Awareness comes easy to the Beholder. They listen to their senses
--   and trust their hunches. Over the years the Beholder has grown
--   to know a certain few of the village just by paying attention.
--   Little cues here and there, the way someone talks, the way they move -
--   it all gives clues as to their true nature and role.
--   
--   At the start of the game the Beholder is informed the Seer's identity.
beholderRole :: Role

-- | Never trust a politician. Nor a Crooked Senator for that matter.
--   The Crooked Senator may seem like he has the village's best
--   interests at heart, but let's be honest, when put in a tough
--   situation he looks after no-one but himself. Even when safe, the
--   Crooked Senator may decide to toy with the Villagers' emotions
--   and try pit them against one another.
--   
--   The Crooked Senator looks at the village votes as they come in.
crookedSenatorRole :: Role

-- | How honoured we are to be in the presence of such a noble leader.
--   The return of the Druid marks an exceptional time in Fougères's
--   history! Friend of the woodland creatures, practiced
--   philosopher and now, with the help of Ferina their companion, a
--   bane to the Werewolves themselves! My does she have a nose on
--   her, strong enough to sniff out lycanthropes in close
--   proximity! Listen for her grunt and heed her warning for she will
--   not let you down.
--   
--   Each morning when Ferina wakes from her slumber she will be alert and
--   cautious. If the Druid is next to a Werewolf in the player
--   circle then Ferina will grunt in warning.
druidRole :: Role

-- | A skilled marksman with quick reflexes. In the unfortunate
--   situation that they are jumped and killed unjustly, they let
--   off a shot at their attacker, killing them instantly. The Hunter
--   never misses.
--   
--   If the Hunter is killed they choose one player, believed to be an
--   attacker, to kill immediately.
hunterRole :: Role

-- | Every village needs a Jester; they're so stupid, but provide so
--   much entertainment! The Jester may not have any special
--   abilities, but at least no-one in the village wants to hurt
--   them.
--   
--   If the village votes to lynch the Jester, their identity is revealed.
--   The village realise there's no point in burning them and so they are
--   set free.
--   
--   The Jester continues to play but may no longer vote as no-one can take
--   them seriously.
jesterRole :: Role

-- | Traditionally a Werewolf once transformed loses all memories and
--   personality. Over years of transforming, the Lycan has slowly
--   evolved and learnt how to retain themself. Night after night of
--   devouring with the other Werewolves took its toll. The screams alone
--   were enough to turn the Lycan and make them question their true
--   nature.
--   
--   The Lycan is aligned with the Villagers, but appears to nature-seeing
--   roles (e.g., the Seer) as a Werewolf.
lycanRole :: Role

-- | A beautiful flirt, the Medusa is aligned with the Villagers but
--   harbours a terrifying secret. During the day they are well
--   known in the village of Fougères for their stunning appearance
--   which captures the eye and love of all the townsfolk. However when
--   their secret takes ahold at sundown, their true self is
--   revealed. Any who gaze upon her true form would see live snakes
--   for hair and the few that further look into her eyes are turned to
--   stone.
--   
--   If Medusa attracts the attention of a Werewolf during the night and is
--   devoured, the first Werewolf to their left in the player
--   circle will catch their gaze and turn to stone, instantly
--   killing the lupine predator.
medusaRole :: Role

-- | Originally rejected by the townsfolk, the Oracle's prophetic
--   divinations has earned trust within the village. With constant
--   precognition - and concern for the future - the Oracle knows
--   the village will only live if they work together.
--   
--   Each night the Oracle chooses a player to divine. They are then
--   informed of the player's role the following morning. This wisdom is
--   for the Oracle to use to ensure the future of Fougères.
oracleRole :: Role

-- | The Protector is one of the few pure of heart and altruistic
--   Villagers; they are forever putting others needs above their
--   own. Each night they fight against the Werewolves with naught
--   but a sword and shield, potentially saving an innocents life.
--   
--   Each night the Protector chooses a player deemed worthy of their
--   protection. That player is safe for that night (and only that night)
--   against the Werewolves.
--   
--   The Protector may not protect the same player two nights in a row.
protectorRole :: Role

-- | The Saint, also historically known as a hallow, is recognized as
--   having an exceptional degree of holiness and likeness to God.
--   They are a humble Villager and shine light on these dark times.
--   Extinguishing this light would not be wise
--   
--   If the Saint is lynched by the village, all who voted for them die.
saintRole :: Role

-- | Werewolves don't just spring up out of the ground! That's where
--   dwarves come from. Clearly someone is to blame for this
--   affliction to Fougères. Unluckily for the Scapegoat, since
--   no-one actually knows who brought them here, the blame is always
--   laid upon them!
--   
--   If the village's vote ends in a tie, it's the Scapegoat who is
--   eliminated instead of no-one.
--   
--   In this event, the Scapegoat has one last task to complete: they must
--   choose whom is permitted to vote or not on the next day.
scapegoatRole :: Role

-- | The Seer has the ability to see into fellow townsfolk and determine
--   their true nature. This ability to see is not given out
--   lightly, for certain it is a gift! The visions will always be
--   true, but only for the present as not even the Seer knows what the
--   future holds.
--   
--   Each night the Seer sees the allegiance of one player of their choice.
seerRole :: Role

-- | A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all the
--   Villagers in this unfortunate time.
--   
--   The Simple Villager has no special abilities, they must use their
--   guile to determine whom among them is not who they say they are.
simpleVillagerRole :: Role

-- | A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all the
--   Villagers in this unfortunate time.
--   
--   Yet the Spiteful Villager has no loyalty in the afterlife; whoever
--   causes them harm may find themselves in trouble.
--   
--   When the Spiteful Villager is killed, they are informed of everyone's
--   roles and may haunt the village as they wish.
spitefulVillagerRole :: Role

-- | The True Villager has a heart and soul as clear as day! Their
--   allegiance and devotion to the village are beyond reproach. If
--   there is one person whom you should confide in, listen to and
--   trust, it is the True Villager.
--   
--   At the start of the game the True Villager's identity is revealed.
trueVillagerRole :: Role

-- | Somehow forgotten with the coming of the Werewolves, the Witch has
--   a chance to prove themself valuable to the village and maybe
--   abolish the absurd pastime of burning and drowning their cult.
--   The Witch is blessed (or maybe cursed) with the ability to make two
--   powerful potions; one of which heals a victim of the
--   Werewolves, the other poisons a player.
--   
--   The Witch is called after the Werewolves. They are able to heal and
--   poison one player per game. There is no restriction on using both
--   potions in one night or on healing themself.
witchRole :: Role

-- | The Alpha Wolf leads the Werewolves in the raids against Fougères
--   each night and not even the Seer can see them coming. If the
--   Werewolves caused the Villagers to question and accuse one
--   another beforehand, the Alpha Wolf eliminates any shred of humanity
--   left. No-one can be trusted anymore and no-one knows the
--   truth.
--   
--   The Alpha Wolf appears to nature-seeing roles (e.g., the Seer) as a
--   Villager.
alphaWolfRole :: Role

-- | The Simple Werewolf is a fearsome lupine, cunning like no other
--   creature that roams the forest. Their origin is unknown, but
--   that matters little, for they present a grave threat to
--   Fougères. While each day they hide in plain sight as an ordinary
--   Villager, each night they transform and devour an innocent.
--   There is little hope left for the village.
--   
--   A Werewolf may never devour another Werewolf.
simpleWerewolfRole :: Role
instance GHC.Classes.Eq Game.Werewolf.Role.Role
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Role
instance GHC.Read.Read Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Activity
instance GHC.Read.Read Game.Werewolf.Role.Activity
instance GHC.Classes.Eq Game.Werewolf.Role.Activity
instance GHC.Show.Show Game.Werewolf.Role.Allegiance
instance GHC.Read.Read Game.Werewolf.Role.Allegiance
instance GHC.Classes.Eq Game.Werewolf.Role.Allegiance
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Allegiance
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Activity

-- | Variants alter how a game plays out. Either by changing the messages
--   returned, or by changing the game logic.
module Game.Werewolf.Variant

-- | Variant definitions require only a few pieces of information.
data Variant
tag :: Lens' Variant Text
name :: Lens' Variant Text
description :: Lens' Variant Text

-- | A list containing all the variants defined in this file.
allVariants :: [Variant]
standardVariant :: Variant
noRoleKnowledgeVariant :: Variant
noRoleKnowledgeOrRevealVariant :: Variant
noRoleRevealVariant :: Variant
spitefulVillageVariant :: Variant

-- | The traversal of standard Variants.
--   
--   
--   standard = only standardVariant
--   
standard :: Traversal' Variant ()

-- | The traversal of noRoleKnowledge Variants.
--   
--   
--   noRoleKnowledge = only noRoleKnowledgeVariant
--   
noRoleKnowledge :: Traversal' Variant ()

-- | The traversal of noRoleKnowledgeOrReveal Variants.
--   
--   
--   noRoleKnowledgeOrReveal = only noRoleKnowledgeOrRevealVariant
--   
noRoleKnowledgeOrReveal :: Traversal' Variant ()

-- | The traversal of noRoleReveal Variants.
--   
--   
--   noRoleReveal = only noRoleRevealVariant
--   
noRoleReveal :: Traversal' Variant ()

-- | The traversal of spitefulVillage Variants.
--   
--   
--   spitefulVillage = only spitefulVillageVariant
--   
spitefulVillage :: Traversal' Variant ()
instance Data.String.Humanise.Humanise Game.Werewolf.Variant.Variant
instance GHC.Show.Show Game.Werewolf.Variant.Variant
instance GHC.Read.Read Game.Werewolf.Variant.Variant
instance GHC.Classes.Eq Game.Werewolf.Variant.Variant

-- | Extra utility functions for working with lenses.
module Control.Lens.Extra

-- | The counter-part to isn't, but more general as it takes a
--   Getting instead.
--   
--   
--   is = has
--   
is :: Getting Any s a -> s -> Bool

-- | A re-write of isn't to be more general by taking a
--   Getting instead.
--   
--   
--   isn't = hasn't
--   
isn't :: Getting All s a -> s -> Bool

-- | Check to see if this Fold or Traversal matches 1 or more
--   entries in the current state.
--   
--   
--   hasuse = gets . has
--   
hasuse :: MonadState s m => Getting Any s a -> m Bool

-- | Check to see if this Fold or Traversal has no matches in
--   the current state.
--   
--   
--   hasn'tuse = gets . hasn't
--   
hasn'tuse :: MonadState s m => Getting All s a -> m Bool

-- | A companion to filtered that, rather than using a predicate,
--   filters on the given lens for matches.
filteredBy :: Eq b => Lens' a b -> b -> Traversal' a a

-- | Players are quite simple in themselves. They have a name,
--   role and state.
module Game.Werewolf.Player

-- | A player has a name, role and state. Any stateful
--   information needed for a player's role is held on the
--   Game itself.
--   
--   N.B., player equality is defined on just the name.
data Player
name :: Lens' Player Text
role :: Lens' Player Role
state :: Lens' Player State

-- | Surprise surprise, players may be Dead or Alive.
data State
Alive :: State
Dead :: State
_Alive :: Prism' State ()
_Dead :: Prism' State ()

-- | Creates a new Alive player.
newPlayer :: Text -> Role -> Player

-- | The traversal of Players with an alphaWolfRole.
--   
--   
--   alphaWolf = role . only alphaWolfRole
--   
alphaWolf :: Traversal' Player ()

-- | The traversal of Players with a beholderRole.
--   
--   
--   beholder = role . only beholderRole
--   
beholder :: Traversal' Player ()

-- | The traversal of Players with a crookedSenatorRole.
--   
--   
--   crookedSenator = role . only crookedSenatorRole
--   
crookedSenator :: Traversal' Player ()

-- | The traversal of Players with a druidRole.
--   
--   
--   druid = role . only druidRole
--   
druid :: Traversal' Player ()

-- | The traversal of Players with a dullahanRole.
--   
--   
--   dullahan = role . only dullahanRole
--   
dullahan :: Traversal' Player ()

-- | The traversal of Players with a fallenAngelRole.
--   
--   
--   fallenAngel = role . only fallenAngelRole
--   
fallenAngel :: Traversal' Player ()

-- | The traversal of Players with a hunterRole.
--   
--   
--   hunter = role . only hunterRole
--   
hunter :: Traversal' Player ()

-- | The traversal of Players with a jesterRole.
--   
--   
--   jester = role . only jesterRole
--   
jester :: Traversal' Player ()

-- | The traversal of Players with a lycanRole.
--   
--   
--   lycan = role . only lycanRole
--   
lycan :: Traversal' Player ()

-- | The traversal of Players with a medusaRole.
--   
--   
--   medusa = role . only medusaRole
--   
medusa :: Traversal' Player ()

-- | The traversal of Players with a necromancerRole.
--   
--   
--   necromancer = role . only necromancerRole
--   
necromancer :: Traversal' Player ()

-- | The traversal of Players with a oracleRole.
--   
--   
--   oracle = role . only oracleRole
--   
oracle :: Traversal' Player ()

-- | The traversal of Players with an orphanRole.
--   
--   
--   orphan = role . only orphanRole
--   
orphan :: Traversal' Player ()

-- | The traversal of Players with a protectorRole.
--   
--   
--   protector = role . only protectorRole
--   
protector :: Traversal' Player ()

-- | The traversal of Players with a saintRole.
--   
--   
--   saint = role . only saintRole
--   
saint :: Traversal' Player ()

-- | The traversal of Players with a scapegoatRole.
--   
--   
--   scapegoat = role . only scapegoatRole
--   
scapegoat :: Traversal' Player ()

-- | The traversal of Players with a seerRole.
--   
--   
--   seer = role . only seerRole
--   
seer :: Traversal' Player ()

-- | The traversal of Players with a simpleVillagerRole.
--   
--   
--   simpleVillager = role . only simpleVillagerRole
--   
simpleVillager :: Traversal' Player ()

-- | The traversal of Players with a simpleWerewolfRole.
--   
--   
--   simpleWerewolf = role . only simpleWerewolfRole
--   
simpleWerewolf :: Traversal' Player ()

-- | The traversal of Players with a spitefulVillagerRole.
--   
--   
--   spitefulVillager = role . only spitefulVillagerRole
--   
spitefulVillager :: Traversal' Player ()

-- | The traversal of Players with a trueVillagerRole.
--   
--   
--   trueVillager = role . only trueVillagerRole
--   
trueVillager :: Traversal' Player ()

-- | The traversal of Players with a villageDrunkRole.
--   
--   
--   villageDrunk = role . only villageDrunkRole
--   
villageDrunk :: Traversal' Player ()

-- | The traversal of Players with a witchRole.
--   
--   
--   witch = role . only witchRole
--   
witch :: Traversal' Player ()

-- | The traversal of Players with a zombieRole.
--   
--   
--   zombie = role . only zombieRole
--   
zombie :: Traversal' Player ()

-- | The traversal of Players aligned with NoOne.
--   
--   
--   loner = role . allegiance . _NoOne
--   
loner :: Traversal' Player ()

-- | The traversal of Players aligned with the Villagers.
--   
--   
--   villager = role . allegiance . _Villagers
--   
villager :: Traversal' Player ()

-- | The traversal of Players aligned with the Werewolves.
--   
--   
--   werewolf = role . allegiance . _Werewolves
--   
werewolf :: Traversal' Player ()

-- | The traversal of Player names.
--   
--   
--   names = traverse . name
--   
names :: Traversable t => Traversal' (t Player) Text

-- | The traversal of Player roles.
--   
--   
--   roles = traverse . role
--   
roles :: Traversable t => Traversal' (t Player) Role

-- | The traversal of Player states.
--   
--   
--   states = traverse . state
--   
states :: Traversable t => Traversal' (t Player) State

-- | The traversal of Players with the given name.
--   
--   
--   named name' = filteredBy . name name'
--   
named :: Text -> Traversal' Player Player

-- | The traversal of alphaWolf Players.
--   
--   
--   alphaWolves = traverse . filtered (is alphaWolf)
--   
alphaWolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of beholder Players.
--   
--   
--   beholders = traverse . filtered (is beholder)
--   
beholders :: Traversable t => Traversal' (t Player) Player

-- | The traversal of crookedSenator Players.
--   
--   
--   crookedSenators = traverse . filtered (is crookedSenator)
--   
crookedSenators :: Traversable t => Traversal' (t Player) Player

-- | The traversal of druid Players.
--   
--   
--   druids = traverse . filtered (is druid)
--   
druids :: Traversable t => Traversal' (t Player) Player

-- | The traversal of dullahan Players.
--   
--   
--   dullahans = traverse . filtered (is dullahan)
--   
dullahans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of fallenAngel Players.
--   
--   
--   fallenAngels = traverse . filtered (is fallenAngel)
--   
fallenAngels :: Traversable t => Traversal' (t Player) Player

-- | The traversal of hunter Players.
--   
--   
--   hunters = traverse . filtered (is hunter)
--   
hunters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of jester Players.
--   
--   
--   jesters = traverse . filtered (is jester)
--   
jesters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of lycan Players.
--   
--   
--   lycans = traverse . filtered (is lycan)
--   
lycans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of medusa Players.
--   
--   
--   medusas = traverse . filtered (is medusa)
--   
medusas :: Traversable t => Traversal' (t Player) Player

-- | The traversal of necromancer Players.
--   
--   
--   necromancers = traverse . filtered (is necromancer)
--   
necromancers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of oracle Players.
--   
--   
--   oracles = traverse . filtered (is oracle)
--   
oracles :: Traversable t => Traversal' (t Player) Player

-- | The traversal of orphan Players.
--   
--   
--   orphans = traverse . filtered (is orphan)
--   
orphans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of protector Players.
--   
--   
--   protectors = traverse . filtered (is protector)
--   
protectors :: Traversable t => Traversal' (t Player) Player

-- | The traversal of saint Players.
--   
--   
--   saints = traverse . filtered (is saint)
--   
saints :: Traversable t => Traversal' (t Player) Player

-- | The traversal of scapegoat Players.
--   
--   
--   scapegoats = traverse . filtered (is scapegoat)
--   
scapegoats :: Traversable t => Traversal' (t Player) Player

-- | The traversal of seer Players.
--   
--   
--   seers = traverse . filtered (is seer)
--   
seers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of simpleVillager Players.
--   
--   
--   simpleVillagers = traverse . filtered (is simpleVillager)
--   
simpleVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of simpleWerewolf Players.
--   
--   
--   simpleWerewolves = traverse . filtered (is simpleWerewolf)
--   
simpleWerewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of spitefulVillager Players.
--   
--   
--   spitefulVillagers = traverse . filtered (is spitefulVillager)
--   
spitefulVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of trueVillager Players.
--   
--   
--   trueVillagers = traverse . filtered (is trueVillager)
--   
trueVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of villageDrunk Players.
--   
--   
--   villageDrunks = traverse . filtered (is villageDrunk)
--   
villageDrunks :: Traversable t => Traversal' (t Player) Player

-- | The traversal of witch Players.
--   
--   
--   witches = traverse . filtered (is witch)
--   
witches :: Traversable t => Traversal' (t Player) Player

-- | The traversal of zombie Players.
--   
--   
--   zombies = traverse . filtered (is zombie)
--   
zombies :: Traversable t => Traversal' (t Player) Player

-- | The traversal of loner Players.
--   
--   
--   loners = traverse . filtered . (is loner)
--   
loners :: Traversable t => Traversal' (t Player) Player

-- | The traversal of villager Players.
--   
--   
--   villagers = traverse . filtered (is villager)
--   
villagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of werewolf Players.
--   
--   
--   werewolves = traverse . filtered (is werewolf)
--   
werewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of Alive Players.
--   
--   
--   alive = filtered (has $ state . _Alive)
--   
alive :: Traversal' Player Player

-- | The traversal of Dead Players.
--   
--   
--   dead = filtered (has $ state . _Dead)
--   
dead :: Traversal' Player Player
instance GHC.Classes.Eq Game.Werewolf.Player.Player
instance Data.String.Humanise.Humanise Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.Player
instance GHC.Read.Read Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.State
instance GHC.Read.Read Game.Werewolf.Player.State
instance GHC.Classes.Eq Game.Werewolf.Player.State

-- | A game is not quite as simple as players! Roughly speaking though,
--   this engine is stateful. The game state only changes when a
--   command is issued. Thus, this module defines the Game
--   data structure and any fields required to keep track of the current
--   state.
module Game.Werewolf.Game

-- | There are a few key pieces of information that a game always needs to
--   hold. These are:
--   
--   
--   
- the stage,
--   
- the round number and
--   
- the players.
--   
--   
--   Any further fields on the game are specific to one or more roles (and
--   their respective turns!). Some of the additional fields are reset each
--   round (e.g., the Seer's see) while others are kept around for
--   the whole game (e.g., the Orphan's roleModel).
data Game
variant :: Lens' Game Variant
stage :: Lens' Game Stage
round :: Lens' Game Int
players :: Lens' Game [Player]
boots :: Lens' Game (Map Text [Text])
chosenVoters :: Lens' Game [Text]
deadRaised :: Lens' Game Bool
divine :: Lens' Game (Maybe Text)
fallenAngelLynched :: Lens' Game Bool
healUsed :: Lens' Game Bool
hunterRetaliated :: Lens' Game Bool
jesterRevealed :: Lens' Game Bool
marks :: Lens' Game [Text]
passed :: Lens' Game Bool
poison :: Lens' Game (Maybe Text)
poisonUsed :: Lens' Game Bool
priorProtect :: Lens' Game (Maybe Text)
protect :: Lens' Game (Maybe Text)
roleModel :: Lens' Game (Maybe Text)
scapegoatBlamed :: Lens' Game Bool
see :: Lens' Game (Maybe Text)
votes :: Lens' Game (Map Text Text)

-- | Most of these are fairly self-explainable (the turn stages).
--   Sunrise and Sunset are provided as meaningful breaks
--   between the day and night as, for example, a VillagesTurn may
--   not always be available (curse that retched Scapegoat).
--   
--   Once the game reaches a turn stage, it requires a command to
--   help push it past. Often only certain roles and commands may be
--   performed at any given stage.
data Stage
DruidsTurn :: Stage
GameOver :: Stage
HuntersTurn1 :: Stage
HuntersTurn2 :: Stage
Lynching :: Stage
NecromancersTurn :: Stage
OraclesTurn :: Stage
OrphansTurn :: Stage
ProtectorsTurn :: Stage
ScapegoatsTurn :: Stage
SeersTurn :: Stage
Sunrise :: Stage
Sunset :: Stage
VillageDrunksTurn :: Stage
VillagesTurn :: Stage
WerewolvesTurn :: Stage
WitchsTurn :: Stage
_DruidsTurn :: Prism' Stage ()
_GameOver :: Prism' Stage ()
_HuntersTurn1 :: Prism' Stage ()
_HuntersTurn2 :: Prism' Stage ()
_Lynching :: Prism' Stage ()
_NecromancersTurn :: Prism' Stage ()
_OraclesTurn :: Prism' Stage ()
_OrphansTurn :: Prism' Stage ()
_ProtectorsTurn :: Prism' Stage ()
_ScapegoatsTurn :: Prism' Stage ()
_SeersTurn :: Prism' Stage ()
_Sunrise :: Prism' Stage ()
_Sunset :: Prism' Stage ()
_VillageDrunksTurn :: Prism' Stage ()
_VillagesTurn :: Prism' Stage ()
_WerewolvesTurn :: Prism' Stage ()
_WitchsTurn :: Prism' Stage ()
activity :: (Functor f, Contravariant f) => (Activity -> f Activity) -> Stage -> f Stage

-- | All of the Stages in the order that they should occur.
allStages :: [Stage]

-- | An infinite cycle of all Stages in the order that they should
--   occur.
stageCycle :: [Stage]

-- | Checks whether the stage is available for the given Game. Most
--   often this just involves checking if there is an applicable role
--   alive, but sometimes it is more complex.
--   
--   One of the more complex checks here is for the VillagesTurn. If
--   the Fallen Angel is in play, then the VillagesTurn is available
--   on the first day rather than only after the first night.
stageAvailable :: Game -> Stage -> Bool

-- | Creates a new Game with the given players. No validations are
--   performed here, those are left to the binary.
newGame :: Variant -> [Player] -> Game

-- | The traversal of the votes victim's name. This is the player,
--   if they exist, that received the majority of the votes. This could be
--   an empty list depending on whether the votes were in conflict.
votee :: Fold Game Player

-- | The traversal of the allowed voters during the VillagesTurn or
--   WerewolvesTurn. In a standard game, this is all Alive
--   players. However there are two scenarios for the VillagesTurn
--   that may change this:
--   
--   1) if the scapegoat has chosen some chosenVoters, it is
--   these players. 2) if the jester has been revealed, he may not
--   vote.
allowedVoters :: Fold Game Player

-- | The traversal of all Alive players that have yet to vote. This
--   is synonymous to voters - Map.keys votes
pendingVoters :: Fold Game Player

-- | The traversal of Games on the first round.
firstRound :: Prism' Game Game

-- | The traversal of Games on the second round.
secondRound :: Prism' Game Game

-- | The traversal of Games on the third round.
thirdRound :: Prism' Game Game

-- | Gets all the marks in a game (which is names only) and maps
--   them to their player.
getMarks :: Game -> [Player]

-- | Queries whether anyone has won.
hasAnyoneWon :: Game -> Bool

-- | Queries whether the Dullahan has won. The Dullahan wins if they manage
--   to eliminate all their marks.
hasDullahanWon :: Game -> Bool

-- | Queries whether the Fallen Angel has won. The Fallen Angel wins if
--   they manage to get themselves lynched by the Villagers.
hasFallenAngelWon :: Game -> Bool

-- | Queries whether the Necromancer has won. The Necromancer wins
--   if they and their zombies are the only players surviving.
--   
--   N.B., the Jester is not considered when determining whether the
--   Necromancer has won.
hasNecromancerWon :: Game -> Bool

-- | Queries whether the Villagers have won. The Villagers
--   win if they are the only players surviving.
--   
--   N.B., the Dullahan and Fallen Angel are not considered when
--   determining whether the Villagers have won.
hasVillagersWon :: Game -> Bool

-- | Queries whether the Werewolves have won. The Werewolves
--   win if they are the only players surviving.
hasWerewolvesWon :: Game -> Bool

-- | Queries whether everyone has lost.
hasEveryoneLost :: Game -> Bool
instance GHC.Show.Show Game.Werewolf.Game.Game
instance GHC.Read.Read Game.Werewolf.Game.Game
instance GHC.Classes.Eq Game.Werewolf.Game.Game
instance GHC.Show.Show Game.Werewolf.Game.Stage
instance GHC.Read.Read Game.Werewolf.Game.Stage
instance GHC.Classes.Eq Game.Werewolf.Game.Stage
instance Data.String.Humanise.Humanise Game.Werewolf.Game.Stage

-- | Re-exports all of the public modules under Game.Werewolf. These
--   are:
--   
--   
--   
- Game.Werewolf.Game
--   
- Game.Werewolf.Player
--   
- Game.Werewolf.Response
--   
- Game.Werewolf.Role
--   
- Game.Werewolf.Variant
--   
--   
--   N.B., where clashes are found between Game.Werewolf.Player,
--   Game.Werewolf.Role and Game.Werewolf.Variant, the
--   Game.Werewolf.Player functions are preferred.
module Game.Werewolf
