werewolf 0.4.2.0 → 0.4.2.1
raw patch · 5 files changed
+21/−13 lines, 5 files
Files
- CHANGELOG.md +12/−0
- src/Game/Werewolf/Game.hs +3/−7
- test/app/Main.hs +1/−1
- test/src/Game/Werewolf/Test/Engine.hs +4/−4
- werewolf.cabal +1/−1
CHANGELOG.md view
@@ -2,11 +2,23 @@ #### Upcoming +#### v0.4.2.1++*Revisions*++* Fixed a bug causing the Witch being unable to heal themselves. ([#76](https://github.com/hjwylde/werewolf/issues/76))+ #### v0.4.2.0 *Minor* * Added the Villager role. ([#37](https://github.com/hjwylde/werewolf/issues/37))++#### v0.4.1.1++*Revisions*++* Fixed a bug causing the Witch being unable to heal themselves. ([#76](https://github.com/hjwylde/werewolf/issues/76)) #### v0.4.1.0
src/Game/Werewolf/Game.hs view
@@ -139,13 +139,9 @@ stageAvailable _ Sunset = True stageAvailable _ VillagesTurn = True stageAvailable game WerewolvesTurn = any isWerewolf (filterAlive $ game ^. players)-stageAvailable game WitchsTurn = and [- any isWitch (filterAlive $ game ^. players),- not (game ^. healUsed) || not (game ^. poisonUsed),- witch ^. name `notElem` [name | (DevourEvent name) <- game ^. events]- ]- where- witch = head . filterWitches $ game ^. players+stageAvailable game WitchsTurn =+ (any isWitch (filterAlive $ game ^. players))+ && (not (game ^. healUsed) || not (game ^. poisonUsed)) getDevourEvent :: Game -> Maybe Event getDevourEvent game = listToMaybe [event | event@(DevourEvent _) <- game ^. events]
test/app/Main.hs view
@@ -115,7 +115,7 @@ testProperty "check villages' turn does nothing unless all voted" prop_checkVillagesTurnDoesNothingUnlessAllVoted, testProperty "check werewolves' turn advances to witch's turn" prop_checkWerewolvesTurnAdvancesToWitchsTurn,- testProperty "check werewolves' turn skips witch's turn when witch devoured" prop_checkWerewolvesTurnSkipsWitchsTurnWhenWitchDevoured,+ testProperty "check werewolves' turn doesn't skip witch's turn when witch devoured" prop_checkWerewolvesTurnDoesntSkipWitchsTurnWhenWitchDevoured, testProperty "check werewolves' turn skips witch's turn when healed and poisoned" prop_checkWerewolvesTurnSkipsWitchsTurnWhenHealedAndPoisoned, testProperty "check werewolves' turn kills one player when consensus" prop_checkWerewolvesTurnKillsOnePlayerWhenConsensus, testProperty "check werewolves' turn kills no one when conflicted" prop_checkWerewolvesTurnKillsNoOneWhenConflicted,
test/src/Game/Werewolf/Test/Engine.hs view
@@ -22,7 +22,7 @@ prop_checkVillagesTurnDoesNothingUnlessAllVoted, prop_checkWerewolvesTurnAdvancesToWitchsTurn,- prop_checkWerewolvesTurnSkipsWitchsTurnWhenWitchDevoured,+ prop_checkWerewolvesTurnDoesntSkipWitchsTurnWhenWitchDevoured, prop_checkWerewolvesTurnSkipsWitchsTurnWhenHealedAndPoisoned, prop_checkWerewolvesTurnKillsOnePlayerWhenConsensus, prop_checkWerewolvesTurnKillsNoOneWhenConflicted, prop_checkWerewolvesTurnResetsVotes,@@ -179,12 +179,12 @@ game' = game { _stage = WerewolvesTurn } n = length . filterWerewolves $ game' ^. players -prop_checkWerewolvesTurnSkipsWitchsTurnWhenWitchDevoured :: Game -> Property-prop_checkWerewolvesTurnSkipsWitchsTurnWhenWitchDevoured game =+prop_checkWerewolvesTurnDoesntSkipWitchsTurnWhenWitchDevoured :: Game -> Property+prop_checkWerewolvesTurnDoesntSkipWitchsTurnWhenWitchDevoured game = forAll (arbitraryWitch game) $ \witch -> let devourVoteCommands = map (\werewolf -> devourVoteCommand (werewolf ^. name) (witch ^. name)) (filterWerewolves $ game ^. players) game'' = foldl (flip $ run_ . apply) game' devourVoteCommands- in not . isWitchsTurn $ run_ checkStage game''+ in isWitchsTurn $ run_ checkStage game'' where game' = game { _stage = WerewolvesTurn }
werewolf.cabal view
@@ -1,5 +1,5 @@ name: werewolf-version: 0.4.2.0+version: 0.4.2.1 author: Henry J. Wylde maintainer: public@hjwylde.com