added downed suppert
This commit is contained in:
parent
7a6c7db914
commit
151b75d1d2
20
Groups.hs
20
Groups.hs
@ -2,6 +2,8 @@ module Groups where
|
|||||||
|
|
||||||
type Group = [MainCharacter]
|
type Group = [MainCharacter]
|
||||||
type NeoTokyo = [Group]
|
type NeoTokyo = [Group]
|
||||||
|
type Downed = [MainCharacter]
|
||||||
|
type BoardState = (NeoTokyo, Downed)
|
||||||
data MainCharacter = Asuka | Shinji | Rei | Misato | Ritsuko | Gendo
|
data MainCharacter = Asuka | Shinji | Rei | Misato | Ritsuko | Gendo
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
@ -44,11 +46,17 @@ getAdj :: MainCharacter -> NeoTokyo -> [MainCharacter]
|
|||||||
getAdj x nt = curFrens x nt ++ (foldr (++) [] (adjGroups x nt))
|
getAdj x nt = curFrens x nt ++ (foldr (++) [] (adjGroups x nt))
|
||||||
|
|
||||||
-- Hurt character x
|
-- Hurt character x
|
||||||
hurt :: MainCharacter -> NeoTokyo -> NeoTokyo
|
hurt :: MainCharacter -> BoardState -> BoardState
|
||||||
hurt x nt
|
hurt x (nt,d)
|
||||||
| curFrens x nt == [] = nt
|
| x `elem` d = if (curFrens x nt == [])
|
||||||
| otherwise = [x] : (filter (/= x) $ charsGroup x nt) : (otherGroups x nt)
|
then (nt, d)
|
||||||
|
else ([x] : (groupMinusChar x) : (otherGroups x nt), d)
|
||||||
|
| otherwise = (nt, x:d)
|
||||||
|
where
|
||||||
|
groupMinusChar x = (filter (/= x) $ charsGroup x nt)
|
||||||
|
|
||||||
-- Attract X and Y
|
-- Attract X and Y
|
||||||
attract :: MainCharacter -> MainCharacter -> NeoTokyo -> NeoTokyo
|
attract :: MainCharacter -> MainCharacter -> BoardState -> BoardState
|
||||||
attract x y nt = (uniq (charsGroup x nt ++ charsGroup y nt)) : (otherGroups y (otherGroups x nt))
|
attract x y (nt,d)
|
||||||
|
| x `elem` d = (nt, (filter (/= x) d))
|
||||||
|
| otherwise = ((uniq (charsGroup x nt ++ charsGroup y nt)) : (otherGroups y (otherGroups x nt)), d)
|
||||||
|
Loading…
Reference in New Issue
Block a user