packages feed

werewolf 0.4.7.1 → 0.4.8.0

raw patch · 8 files changed

+113/−60 lines, 8 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Game.Werewolf.Command: pingCommand :: Command
+ Game.Werewolf.Command: pingCommand :: Text -> Command

Files

CHANGELOG.md view
@@ -2,6 +2,20 @@  #### Upcoming +#### v0.4.8.0++*Minor*++* Added role allocations to the game over messages. ([#27](https://github.com/hjwylde/werewolf/issues/27))++*Revisions*++* Improved prompt to Wolf-hound on how to choose an allegiance. ([#90](https://github.com/hjwylde/werewolf/issues/90))+* Changed Scapegoat's balance to 0. ([#91](https://github.com/hjwylde/werewolf/issues/91))+* Grouped `help commands` to improve readability. ([#97](https://github.com/hjwylde/werewolf/issues/97))+* Changed the `status` and `ping` commands to tell the caller when the game is over. ([#89](https://github.com/hjwylde/werewolf/issues/89))+* Added roles in game to the `status` command. ([#93](https://github.com/hjwylde/werewolf/issues/93))+ #### v0.4.7.1  *Revisions*
README.md view
@@ -145,7 +145,7 @@  ```bash > werewolf --caller @corge vote @grault-{"ok":false,"messages":[{"to":["@corge"],"message":"You've already voted!"}]}+{"ok":false,"messages":[{"to":"@corge","message":"You've already voted!"}]} ```  Here the command was unsuccessful and an error message is sent to _@corge_.
app/Werewolf/Commands/Help.hs view
@@ -57,21 +57,41 @@     }  commandsMessages :: [Text]-commandsMessages =-    [ "choose (ALLEGIANCE | PLAYER,...) - choose an allegiance or player(s)."-    , "circle [--include-dead] - get the game circle."-    , "end - ends the current game."-    , "heal - heal the devoured player."-    , "pass - pass on healing or poisoning a player."-    , "ping - ping the status of the current game publicly."-    , "poison PLAYER - poison a player."-    , "protect PLAYER - protect a player."-    , "quit - quit the current game."-    , "see PLAYER - see a player's allegiance."-    , "start ([--extra-roles ROLE,...] | [--random-extra-roles]) PLAYER... - starts a new game with the given players and extra roles. A game requires at least 7 players."-    , "status - get the status of the current game."-    , "version - show this engine's version."-    , "vote PLAYER - vote against a player."+commandsMessages = map (T.intercalate "\n")+    [ [ "Global commands:"+      , "start ([--extra-roles ROLE,...] | [--random-extra-roles]) PLAYER..."+      , "end"+      , "quit"+      , "version"+      ]+    , [ "Status commands:"+      , "ping - ping the status of the current game publicly."+      , "status - get the status of the current game."+      , "circle [--include-dead] - get the game circle."+      ]+    , [ "Standard commands:"+      , "vote PLAYER"+      ]+    , [ "Defender commands:"+      , "protect PLAYER"+      ]+    , [ "Scapegoat commands:"+      , "choose PLAYER,..."+      ]+    , [ "Seer commands:"+      , "see PLAYER"+      ]+    , [ "Wild-child commands:"+      , "choose PLAYER"+      ]+    , [ "Witch commands:"+      , "heal"+      , "poison PLAYER"+      , "pass"+      ]+    , [ "Wolf-hound commands:"+      , "choose (villagers | werewolves)"+      ]     ]  descriptionMessages :: [Text]@@ -139,8 +159,10 @@  helpMessages :: [Text] helpMessages =-    [ "help commands - print the in-game commands."-    , "help description - print the game description."-    , "help roles - print the roles and their description."-    , "help rules - print the game rules."+    [ T.intercalate "\n"+        [ "help commands - print the in-game commands."+        , "help description - print the game description."+        , "help roles - print the roles and their description."+        , "help rules - print the game rules."+        ]     ]
app/Werewolf/Commands/Ping.hs view
@@ -34,7 +34,7 @@      game <- readGame -    let command = pingCommand+    let command = pingCommand callerName      case runExcept (execWriterT $ execStateT (apply command) game) of         Left errorMessages  -> exitWith failure { messages = errorMessages }
src/Game/Werewolf/Command.hs view
@@ -109,9 +109,9 @@      passes %= nub . cons callerName -pingCommand :: Command-pingCommand = Command $ use stage >>= \stage' -> case stage' of-    GameOver        -> return ()+pingCommand :: Text -> Command+pingCommand callerName = Command $ use stage >>= \stage' -> case stage' of+    GameOver        -> tell [gameIsOverMessage callerName]     DefendersTurn   -> do         defender <- findPlayerBy_ role defenderRole @@ -214,7 +214,7 @@  statusCommand :: Text -> Command statusCommand callerName = Command $ use stage >>= \stage' -> case stage' of-    GameOver        -> get >>= tell . gameOverMessages+    GameOver        -> tell [gameIsOverMessage callerName]     Sunrise         -> return ()     Sunset          -> return ()     VillagesTurn    -> do@@ -232,7 +232,10 @@     _               -> tell . standardStatusMessages stage' =<< use players     where         standardStatusMessages stage players =-            currentStageMessages callerName stage ++ [playersInGameMessage callerName players]+            currentStageMessages callerName stage +++            [ rolesInGameMessage (Just callerName) (players ^.. roles)+            , playersInGameMessage callerName players+            ]  voteDevourCommand :: Text -> Text -> Command voteDevourCommand callerName targetName = Command $ do
src/Game/Werewolf/Messages.hs view
@@ -32,7 +32,7 @@     pingPlayerMessage, pingRoleMessage,      -- * Status messages-    currentStageMessages, playersInGameMessage, waitingOnMessage,+    currentStageMessages, rolesInGameMessage, playersInGameMessage, waitingOnMessage,      -- * Angel's turn messages     angelJoinedVillagersMessage,@@ -101,7 +101,7 @@ newGameMessages :: Game -> [Message] newGameMessages game = concat     [ [newPlayersInGameMessage $ players' ^.. names]-    , [rolesInGameMessage $ players' ^.. roles]+    , [rolesInGameMessage Nothing $ players' ^.. roles]     , map newPlayerMessage players'     , villagerVillagerMessages     , stageMessages game@@ -254,7 +254,8 @@ wolfHoundsTurnMessages :: Text -> [Message] wolfHoundsTurnMessages to =     [ publicMessage "The Wolf-hound wakes up."-    , privateMessage to "Which allegiance do you `choose` to be aligned with?"+    , privateMessage to+        "Which allegiance do you `choose` to be aligned with? (Either `villagers` or `werewolves`.)"     ]  gameOverMessages :: Game -> [Message]@@ -262,21 +263,34 @@     | hasAngelWon game      = concat         [ [publicMessage "You should have heeded my warning, for now the Angel has been set free!"]         , [publicMessage "The game is over! The Angel has won."]+        , [playerRolesMessage]         , playerWonMessages         , playerLostMessages         ]     | hasVillagersWon game  = concat         [ [publicMessage "The game is over! The Villagers have won."]+        , [playerRolesMessage]         , playerWonMessages         , playerLostMessages         ]     | hasWerewolvesWon game = concat         [ [publicMessage "The game is over! The Werewolves have won."]+        , [playerRolesMessage]         , playerWonMessages         , playerLostMessages         ]     | otherwise             = undefined     where+        playerRolesMessage = publicMessage $ T.concat+            [ "As I know you're all wondering who lied to you, here's the role allocations: "+            , T.intercalate ", "+                (map+                    (\player -> T.concat [player ^. name, " (", player ^. role . Role.name, ")"])+                    (game ^. players)+                    )+            , "."+            ]+         winningAllegiance             | hasAngelWon game      = Angel             | hasVillagersWon game  = Villagers@@ -356,8 +370,8 @@         showTurn WitchsTurn     = "Witch's"         showTurn WolfHoundsTurn = "Wolf-hound's" -rolesInGameMessage :: [Role] -> Message-rolesInGameMessage roles = publicMessage $ T.concat+rolesInGameMessage :: Maybe Text -> [Role] -> Message+rolesInGameMessage mTo roles = Message mTo $ T.concat     [ "The roles in play are "     , T.intercalate ", " $ map (\(role, count) ->         T.concat [role ^. Role.name, " (", T.pack $ show count, ")"])
src/Game/Werewolf/Role.hs view
@@ -258,7 +258,7 @@ scapegoatRole = Role     { _name         = "Scapegoat"     , _allegiance   = Villagers-    , _balance      = 1+    , _balance      = 0     , _description  = T.unwords         [ "It's sad to say, but in Miller's Hollow, when something doesn't go right"         , "it's always him who unjustly suffers the consequences."
werewolf.cabal view
@@ -1,5 +1,5 @@ name:           werewolf-version:        0.4.7.1+version:        0.4.8.0  author:         Henry J. Wylde maintainer:     public@hjwylde.com@@ -28,26 +28,26 @@     hs-source-dirs: app/     ghc-options:    -threaded -with-rtsopts=-N     other-modules:-        Werewolf.Commands.Choose,-        Werewolf.Commands.Circle,-        Werewolf.Commands.End,-        Werewolf.Commands.Heal,-        Werewolf.Commands.Help,-        Werewolf.Commands.Interpret,-        Werewolf.Commands.Pass,-        Werewolf.Commands.Ping,-        Werewolf.Commands.Poison,-        Werewolf.Commands.Protect,-        Werewolf.Commands.Quit,-        Werewolf.Commands.See,-        Werewolf.Commands.Start,-        Werewolf.Commands.Status,-        Werewolf.Commands.Version,-        Werewolf.Commands.Vote,-        Werewolf.Game,-        Werewolf.Messages,-        Werewolf.Options,-        Werewolf.Version,+        Werewolf.Commands.Choose+        Werewolf.Commands.Circle+        Werewolf.Commands.End+        Werewolf.Commands.Heal+        Werewolf.Commands.Help+        Werewolf.Commands.Interpret+        Werewolf.Commands.Pass+        Werewolf.Commands.Ping+        Werewolf.Commands.Poison+        Werewolf.Commands.Protect+        Werewolf.Commands.Quit+        Werewolf.Commands.See+        Werewolf.Commands.Start+        Werewolf.Commands.Status+        Werewolf.Commands.Version+        Werewolf.Commands.Vote+        Werewolf.Game+        Werewolf.Messages+        Werewolf.Options+        Werewolf.Version         Paths_werewolf      default-language: Haskell2010@@ -73,15 +73,15 @@ library     hs-source-dirs: src/     exposed-modules:-        Game.Werewolf,-        Game.Werewolf.Command,-        Game.Werewolf.Engine,-        Game.Werewolf.Game,-        Game.Werewolf.Player,-        Game.Werewolf.Response,+        Game.Werewolf+        Game.Werewolf.Command+        Game.Werewolf.Engine+        Game.Werewolf.Game+        Game.Werewolf.Player+        Game.Werewolf.Response         Game.Werewolf.Role     other-modules:-        Game.Werewolf.Messages,+        Game.Werewolf.Messages         Game.Werewolf.Util      default-language: Haskell2010