implemented overtimeCheck

This commit is contained in:
Jonathan Lamothe
2019-08-29 00:12:30 -04:00
parent 7ee53ee8c1
commit 3c8302174b
4 changed files with 84 additions and 10 deletions

View File

@@ -27,9 +27,10 @@ module Mtlstats.Actions
, startNewGame
, addChar
, removeChar
, overtimeCheck
) where
import Lens.Micro (over, (&), (.~), (?~), (%~))
import Lens.Micro (over, (^.), (&), (.~), (?~), (%~))
import Mtlstats.Types
@@ -58,3 +59,14 @@ removeChar :: ProgState -> ProgState
removeChar = inputBuffer %~ \case
"" -> ""
str -> init str
-- | Determines whether or not to perform a check for overtime
overtimeCheck :: ProgState -> ProgState
overtimeCheck s
| gameTied (s^.progMode.gameStateL) =
s & progMode.gameStateL
%~ (homeScore .~ Nothing)
. (awayScore .~ Nothing)
| gameWon (s^.progMode.gameStateL) =
s & progMode.gameStateL.overtimeFlag ?~ False
| otherwise = s