implemented goalsAllowedPrompt
This commit is contained in:
@@ -41,6 +41,7 @@ module Mtlstats.Actions
|
|||||||
, awardAssist
|
, awardAssist
|
||||||
, resetGoalData
|
, resetGoalData
|
||||||
, assignPMins
|
, assignPMins
|
||||||
|
, recordGoalieStats
|
||||||
, backHome
|
, backHome
|
||||||
, scrollUp
|
, scrollUp
|
||||||
, scrollDown
|
, scrollDown
|
||||||
@@ -269,6 +270,10 @@ assignPMins mins s = fromMaybe s $ do
|
|||||||
)
|
)
|
||||||
. (selectedPlayer .~ Nothing)
|
. (selectedPlayer .~ Nothing)
|
||||||
|
|
||||||
|
-- | Records the goalie's game stats
|
||||||
|
recordGoalieStats :: ProgState -> ProgState
|
||||||
|
recordGoalieStats = undefined
|
||||||
|
|
||||||
-- | Resets the program state back to the main menu
|
-- | Resets the program state back to the main menu
|
||||||
backHome :: ProgState -> ProgState
|
backHome :: ProgState -> ProgState
|
||||||
backHome
|
backHome
|
||||||
|
|||||||
@@ -40,3 +40,7 @@ dbFname = "database.json"
|
|||||||
-- | The maximum number of assists
|
-- | The maximum number of assists
|
||||||
maxAssists :: Int
|
maxAssists :: Int
|
||||||
maxAssists = 2
|
maxAssists = 2
|
||||||
|
|
||||||
|
-- | The length of a typical game (in minutes)
|
||||||
|
gameLength :: Int
|
||||||
|
gameLength = 60
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import Control.Monad.Extra (whenJust)
|
|||||||
import Control.Monad.Trans.State (gets, modify)
|
import Control.Monad.Trans.State (gets, modify)
|
||||||
import Data.Char (isDigit, toUpper)
|
import Data.Char (isDigit, toUpper)
|
||||||
import Data.Foldable (forM_)
|
import Data.Foldable (forM_)
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
import Lens.Micro ((^.), (&), (.~), (?~), (%~))
|
import Lens.Micro ((^.), (&), (.~), (?~), (%~))
|
||||||
import Lens.Micro.Extras (view)
|
import Lens.Micro.Extras (view)
|
||||||
import Text.Read (readMaybe)
|
import Text.Read (readMaybe)
|
||||||
@@ -319,7 +320,12 @@ goalieMinsPlayedPrompt = numPrompt "Minutes played: " $
|
|||||||
|
|
||||||
-- | Prompts for the number of goals the goalie allowed
|
-- | Prompts for the number of goals the goalie allowed
|
||||||
goalsAllowedPrompt :: Prompt
|
goalsAllowedPrompt :: Prompt
|
||||||
goalsAllowedPrompt = undefined
|
goalsAllowedPrompt = numPrompt "Goals allowed: " $ \n -> do
|
||||||
|
modify (progMode.gameStateL.goalsAllowed ?~ n)
|
||||||
|
mins <- fromMaybe 0 <$> gets (^.progMode.gameStateL.goalieMinsPlayed)
|
||||||
|
when (mins >= gameLength) $
|
||||||
|
modify $ progMode.gameStateL.goaliesRecorded .~ True
|
||||||
|
modify recordGoalieStats
|
||||||
|
|
||||||
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
drawSimplePrompt :: String -> ProgState -> C.Update ()
|
||||||
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
drawSimplePrompt pStr s = C.drawString $ pStr ++ s^.inputBuffer
|
||||||
|
|||||||
Reference in New Issue
Block a user