werewolf 0.4.2.1 → 0.4.2.2
raw patch · 3 files changed
+58/−1 lines, 3 files
Files
- CHANGELOG.md +13/−0
- app/Werewolf/Commands/Heal.hs +43/−0
- werewolf.cabal +2/−1
CHANGELOG.md view
@@ -2,6 +2,12 @@ #### Upcoming +#### v0.4.2.2++*Revisions*++* Fixed a bug causing the Witch being unable to heal themselves. ([#76](https://github.com/hjwylde/werewolf/issues/76))+ #### v0.4.2.1 *Revisions*@@ -13,6 +19,13 @@ *Minor* * Added the Villager role. ([#37](https://github.com/hjwylde/werewolf/issues/37))++#### v0.4.1.2++*Revisions*++* Added missing module to Cabal file.+>>>>>>> release/0.4.1 #### v0.4.1.1
+ app/Werewolf/Commands/Heal.hs view
@@ -0,0 +1,43 @@+{-|+Module : Werewolf.Commands.Heal+Description : Handler for the heal subcommand.++Copyright : (c) Henry J. Wylde, 2015+License : BSD3+Maintainer : public@hjwylde.com++Handler for the heal subcommand.+-}++{-# LANGUAGE OverloadedStrings #-}++module Werewolf.Commands.Heal (+ -- * Handle+ handle,+) where++import Control.Monad.Except+import Control.Monad.Extra+import Control.Monad.State+import Control.Monad.Writer++import Data.Text (Text)++import Game.Werewolf.Command+import Game.Werewolf.Engine+import Game.Werewolf.Response++-- | Handle.+handle :: MonadIO m => Text -> m ()+handle callerName = do+ unlessM doesGameExist $ exitWith failure {+ messages = [noGameRunningMessage callerName]+ }++ game <- readGame++ let command = healCommand callerName++ case runExcept (runWriterT $ execStateT (apply command >> checkStage >> checkGameOver) game) of+ Left errorMessages -> exitWith failure { messages = errorMessages }+ Right (game', messages) -> writeGame game' >> exitWith success { messages = messages }
werewolf.cabal view
@@ -1,5 +1,5 @@ name: werewolf-version: 0.4.2.1+version: 0.4.2.2 author: Henry J. Wylde maintainer: public@hjwylde.com@@ -29,6 +29,7 @@ ghc-options: -threaded -with-rtsopts=-N other-modules: Werewolf.Commands.End,+ Werewolf.Commands.Heal, Werewolf.Commands.Help, Werewolf.Commands.Interpret, Werewolf.Commands.Pass,