lazy push

This commit is contained in:
Thorn Avery 2019-05-22 20:50:21 +12:00
parent 14d9d4db4c
commit 953ca6d38c
4 changed files with 36 additions and 2 deletions

10
src/Cogs/Puts.hs Normal file
View File

@ -0,0 +1,10 @@
module Cogs.Puts where
-- == Cogs - Puts ==
-- Get info about put cards
-- ====
import ComBoard.Types
import Cogs.Cards

View File

@ -38,3 +38,14 @@ initBS = BoardState
, bsCardLib = gCardLib
, bsGameLog = []
}
mcCardSym :: MainCharacter -> CardSym
mcCardSym Shinji = S01_Shinji
mcCardSym Asuka = S02_Asuka
mcCardSym Rei = S03_Rei
mcCardSym Misato = S04_Misato
mcCardSym Ritsuko = S05_Ritsuko
mcCardSym Gendo = S06_Gendo
-- meCardSym :: MainEva -> CardSym
-- meCardSym UnitOne =

View File

@ -24,6 +24,7 @@ type Traits = [Trait]
data Mark = Circle | Triangle deriving (Show)
type LineMark = (Mark, Faction)
type LineMarks = [LineMark]
type Speaker = Either
data CardInfo = CardInfo
{ ciName :: String
, ciFaction :: Faction
@ -63,7 +64,8 @@ type Group = [MainCharacter]
type Groups = [Group]
type Angels = [Angel]
type Downed = [MainCharacter]
type PutCards = [(Either MainCharacter MainEva, CardSym)]
type PutEva = [(MainEva, [CardSym])]
type PutMainCharacter = [(MainCharacter, [CardSym])
-- Game types
type ActivePlayers = [PlayerId]

View File

@ -8,4 +8,15 @@ module Leads.Lines where
import ComBoard.Types
import Toolbox.Utils
-- PlayerId announces a line and target
announceLine :: PlayerId -> CardSym -> Maybe CardSym -> MainCharacter -> BoardState -> BoardState
announceLine p l c t bs
| not $ isInHand p c bs = addGameError (playerName p bs ++ " doesnt have " ++ getCardLine c bs) bs
| isJust c && inPutCards c bs =
| isDowned mc bs = addGameError (show mc ++ " is downed, cannot speak") bs
|
where
mc = defCharsFaction (ciFaction . getCardInfo c)
f Nothing = mcCardSym mc
f Just cs = cs
speaker = f c