better hurt/attract semantics
This commit is contained in:
parent
64a03fbe3e
commit
7a5304e9b6
10
Groups.hs
10
Groups.hs
@ -44,6 +44,11 @@ getAdj x nt = curFrens x nt ++ (foldr (++) [] (adjGroups x nt))
|
||||
hurt :: MainCharacter -> MainCharacter -> BoardState -> BoardState
|
||||
hurt x y (nt,d)
|
||||
| not $ y `elem` (getAdj x nt) = (nt,d)
|
||||
| otherwise = hurt' x y (nt,d)
|
||||
|
||||
-- X hurts Y (no restrictions)
|
||||
hurt' :: MainCharacter -> MainCharacter -> BoardState -> BoardState
|
||||
hurt' x y (nt,d)
|
||||
| y `elem` d = if (curFrens y nt == [])
|
||||
then (nt, d)
|
||||
else ([y] : (groupMinusChar y) : (otherGroups y nt), d)
|
||||
@ -55,5 +60,10 @@ hurt x y (nt,d)
|
||||
attract :: MainCharacter -> MainCharacter -> BoardState -> BoardState
|
||||
attract x y (nt,d)
|
||||
| not $ y `elem` (getAdj x nt) = (nt,d)
|
||||
| otherwise = attract' x y (nt'd)
|
||||
|
||||
-- Attract X and Y (no restrictions)
|
||||
attract' :: MainCharacter -> MainCharacter -> BoardState -> BoardState
|
||||
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