werewolf 0.4.7.0 → 0.4.7.1
raw patch · 8 files changed
+66/−53 lines, 8 files
Files
- CHANGELOG.md +16/−0
- src/Game/Werewolf/Command.hs +3/−4
- src/Game/Werewolf/Engine.hs +4/−3
- src/Game/Werewolf/Game.hs +3/−1
- src/Game/Werewolf/Messages.hs +2/−5
- test/src/Game/Werewolf/Test/Command.hs +0/−10
- test/src/Game/Werewolf/Test/Engine.hs +10/−2
- werewolf.cabal +28/−28
CHANGELOG.md view
@@ -2,6 +2,15 @@ #### Upcoming +#### v0.4.7.1++*Revisions*++* Fixed bug where the Wolf-hound's turn messages would be displayed on every round. ([#87](https://github.com/hjwylde/werewolf/issues/87))+* Fixed a bug causing the Angel's joining Villagers message to be shown every round. ([#95](https://github.com/hjwylde/werewolf/issues/95))+* Fixed Village Idiot text to have spaces around the name. ([#87](https://github.com/hjwylde/werewolf/issues/87))+* Fixed a bug where the Werewolves couldn't win if it was down to 1 Werewolf and the Village Idiot. ([#88](https://github.com/hjwylde/werewolf/issues/88))+ #### v0.4.7.0 *Revisions*@@ -14,6 +23,13 @@ * Fixed the grammar on the first Werewolves' turn messages. * Moved Wolf-hound's turn to before the Seer's so that the Seer may see his allegiance properly. * Restricted specifying `Simple Villager` or `Simple Werewolf` as extra roles.++#### v0.4.6.1++*Revisions*++* Fixed Village Idiot text to have spaces around the name. ([#87](https://github.com/hjwylde/werewolf/issues/87))+* Fixed a bug where the Werewolves couldn't win if it was down to 1 Werewolf and the Village Idiot. ([#88](https://github.com/hjwylde/werewolf/issues/88)) #### v0.4.6.0
src/Game/Werewolf/Command.hs view
@@ -252,11 +252,10 @@ voteLynchCommand :: Text -> Text -> Command voteLynchCommand callerName targetName = Command $ do validatePlayer callerName callerName- whenM (uses allowedVoters (callerName `notElem`)) $ throwError [playerCannotDoThatMessage callerName]- unlessM isVillagesTurn $ throwError [playerCannotDoThatRightNowMessage callerName]- whenM (isJust <$> getPlayerVote callerName) $ throwError [playerHasAlreadyVotedMessage callerName]+ whenM (uses allowedVoters (callerName `notElem`)) $ throwError [playerCannotDoThatMessage callerName]+ unlessM isVillagesTurn $ throwError [playerCannotDoThatRightNowMessage callerName]+ whenM (isJust <$> getPlayerVote callerName) $ throwError [playerHasAlreadyVotedMessage callerName] validatePlayer callerName targetName- whenM (use villageIdiotRevealed &&^ isPlayerVillageIdiot targetName) $ throwError [playerCannotLynchVillageIdiotMessage callerName] votes %= Map.insert callerName targetName
src/Game/Werewolf/Engine.hs view
@@ -82,10 +82,11 @@ Sunrise -> do round += 1 - whenJustM (preuse $ players . angels . alive) $ \angel -> do- tell [angelJoinedVillagersMessage]+ whenJustM (preuse $ players . angels . alive) $ \angel ->+ unless (is villager angel) $ do+ tell [angelJoinedVillagersMessage] - setPlayerAllegiance (angel ^. name) Villagers+ setPlayerAllegiance (angel ^. name) Villagers advanceStage
src/Game/Werewolf/Game.hs view
@@ -173,7 +173,9 @@ stageAvailable game WitchsTurn = has (players . witches . alive) game && (not (game ^. healUsed) || not (game ^. poisonUsed))-stageAvailable game WolfHoundsTurn = has (players . wolfHounds . alive) game+stageAvailable game WolfHoundsTurn =+ has (players . wolfHounds . alive) game+ && (isNothing $ game ^. allegianceChosen) -- | Creates a new 'Game' with the given players. No validations are performed here, those are left -- to 'Game.Werewolf.Engine.startGame'.
src/Game/Werewolf/Messages.hs view
@@ -59,7 +59,7 @@ scapegoatLynchedMessage, villageIdiotLynchedMessage, -- ** Error messages- playerHasAlreadyVotedMessage, playerCannotLynchVillageIdiotMessage,+ playerHasAlreadyVotedMessage, -- * Werewolves' turn messages playerMadeDevourVoteMessage, playerDevouredMessage, noPlayerDevouredMessage,@@ -465,16 +465,13 @@ villageIdiotLynchedMessage :: Text -> Message villageIdiotLynchedMessage name = publicMessage $ T.concat- [ "Just as the townsfolk tie", name, "up to the pyre, a voice in the crowd yells out."+ [ "Just as the townsfolk tie ", name, " up to the pyre, a voice in the crowd yells out." , " \"We can't burn ", name, "! He's that oaf, you know, John's boy!\"" , " The Village Idiot is quickly untied and apologised to." ] playerHasAlreadyVotedMessage :: Text -> Message playerHasAlreadyVotedMessage to = privateMessage to "You've already voted!"--playerCannotLynchVillageIdiotMessage :: Text -> Message-playerCannotLynchVillageIdiotMessage to = privateMessage to "You cannot lynch the Village Idiot!" playerMadeDevourVoteMessage :: Text -> Text -> Text -> Message playerMadeDevourVoteMessage to voterName targetName = privateMessage to $ T.concat
test/src/Game/Werewolf/Test/Command.hs view
@@ -146,7 +146,6 @@ , testProperty "vote lynch command errors when caller has voted" prop_voteLynchCommandErrorsWhenCallerHasVoted , testProperty "vote lynch command errors when caller is not in allowed voters" prop_voteLynchCommandErrorsWhenCallerIsNotInAllowedVoters , testProperty "vote lynch command errors when caller is known village idiot" prop_voteLynchCommandErrorsWhenCallerIsKnownVillageIdiot- , testProperty "vote lynch command errors when target is known village idiot" prop_voteLynchCommandErrorsWhenTargetIsKnownVillageIdiot , testProperty "vote lynch command updates votes" prop_voteLynchCommandUpdatesVotes ] @@ -870,15 +869,6 @@ verbose_runCommandErrors game command where caller = game ^?! players . villageIdiots--prop_voteLynchCommandErrorsWhenTargetIsKnownVillageIdiot :: GameWithVillageIdiotRevealedAtVillagesTurn -> Property-prop_voteLynchCommandErrorsWhenTargetIsKnownVillageIdiot (GameWithVillageIdiotRevealedAtVillagesTurn game) =- forAll (arbitraryPlayer game) $ \caller -> do- let command = voteLynchCommand (caller ^. name) (target ^. name)-- verbose_runCommandErrors game command- where- target = game ^?! players . villageIdiots prop_voteLynchCommandUpdatesVotes :: GameAtVillagesTurn -> Property prop_voteLynchCommandUpdatesVotes (GameAtVillagesTurn game) =
test/src/Game/Werewolf/Test/Engine.hs view
@@ -50,8 +50,9 @@ , testProperty "check defender's turn advances when no defender" prop_checkDefendersTurnAdvancesWhenNoDefender , testProperty "check defender's turn does nothing unless protected" prop_checkDefendersTurnDoesNothingUnlessProtected - , testProperty "check scapegoat's turn advances to wolf-hound's turn" prop_checkScapegoatsTurnAdvancesToWolfHoundsTurn- , testProperty "check scapegoat's turn does nothing while scapegoat blamed" prop_checkScapegoatsTurnDoesNothingWhileScapegoatBlamed+ , testProperty "check scapegoat's turn advances to wolf-hound's turn" prop_checkScapegoatsTurnAdvancesToWolfHoundsTurn+ , testProperty "check scapegoat's turn skips wolf-hound's turn when allegiance chosen" prop_checkScapegoatsTurnSkipsWolfHoundsTurnWhenAllegianceChosen+ , testProperty "check scapegoat's turn does nothing while scapegoat blamed" prop_checkScapegoatsTurnDoesNothingWhileScapegoatBlamed , testProperty "check seer's turn advances to wild-child's turn" prop_checkSeersTurnAdvancesToWildChildsTurn , testProperty "check seer's turn advances when no seer" prop_checkSeersTurnAdvancesWhenNoSeer@@ -185,6 +186,13 @@ prop_checkScapegoatsTurnAdvancesToWolfHoundsTurn :: GameWithAllowedVoters -> Bool prop_checkScapegoatsTurnAdvancesToWolfHoundsTurn (GameWithAllowedVoters game) = has (stage . _WolfHoundsTurn) (run_ checkStage game)++prop_checkScapegoatsTurnSkipsWolfHoundsTurnWhenAllegianceChosen :: GameWithAllowedVoters -> Property+prop_checkScapegoatsTurnSkipsWolfHoundsTurnWhenAllegianceChosen (GameWithAllowedVoters game) =+ forAll (elements [Villagers, Werewolves]) $ \allegiance -> do+ let game' = game & allegianceChosen .~ Just allegiance++ hasn't (stage . _WolfHoundsTurn) (run_ checkStage game') prop_checkScapegoatsTurnDoesNothingWhileScapegoatBlamed :: GameAtScapegoatsTurn -> Bool prop_checkScapegoatsTurnDoesNothingWhileScapegoatBlamed (GameAtScapegoatsTurn game) =
werewolf.cabal view
@@ -1,5 +1,5 @@ name: werewolf-version: 0.4.7.0+version: 0.4.7.1 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