Post-Cancellation, Pre-Nisei Netrunner Rotation
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

51 řádky
1.5KB

  1. module Preview where
  2. import Data.List
  3. import Data.Maybe
  4. import Packs
  5. import State
  6. import Timestamp
  7. import Format
  8. type Preview = ([DataPack], [DataPack], Maybe BigBox, Maybe BigBox)
  9. changes :: Eq a => [a] -> [a] -> [a]
  10. changes x y = filter (\n -> not $ n `elem` y) x
  11. diffRot :: [InRot] -> [InRot] -> ([DataPack], [DataPack])
  12. diffRot c f = (packIn, packOut)
  13. where
  14. packIn = map clean $ changes f c
  15. packOut = map clean $ changes c f
  16. clean = (\(Ir n) -> n)
  17. getPreview :: Timestamp -> Maybe Preview
  18. getPreview n
  19. | isPreviewSeason n = Just $ (fst packsChange, snd packsChange, head b, head (rotate 1 b))
  20. | otherwise = Nothing
  21. where
  22. ((i,o), (Bq b), r) = currentFormat n
  23. packsChange = diffRot i ni
  24. ((ni,_),_,_) = nextFormat ((i,o),(Bq b),r)
  25. printLegal :: State -> [String]
  26. printLegal ((i,o),(Bq b),_) = [
  27. "===Evergreen:\nRevised Core Set x3"
  28. , "===Deluxes :\n" ++ (intercalate "\n" $ sort $ map show $ catMaybes (tail b))
  29. , "===Datapacks:\n" ++ (intercalate "\n" $ sort $ map show $ map (\(Ir n) -> n) i)
  30. ]
  31. printPreview :: Maybe Preview -> [String]
  32. printPreview (Just (i, o, bi, bo)) = [
  33. "===Upcoming Changes:"
  34. , ("===In :\n" ++ (intercalate "\n" $ (map show i) ++ (map show cbi)))
  35. , ("===Out:\n" ++ (intercalate "\n" $ (map show o) ++ (map show cbo)))
  36. ]
  37. where
  38. rmEmp = filter (/="")
  39. cbi = catMaybes [bi]
  40. cbo = catMaybes [bo]
  41. cleanDP = map (\(Or n _) -> n)
  42. printPreview Nothing = []