Post-Cancellation, Pre-Nisei Netrunner Rotation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
8.0KB

  1. {-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
  2. module Main where
  3. import Data.Time.Clock
  4. import Data.Time.Calendar
  5. import Data.List
  6. import Data.Maybe
  7. import Packs
  8. import State
  9. import Format
  10. import Timestamp
  11. import Preview
  12. import Yesod
  13. import Config
  14. data Chhf = Chhf
  15. io :: MonadIO io => IO a -> io a
  16. io = liftIO
  17. putStrLnIO :: MonadIO io => String -> io ()
  18. putStrLnIO = io . putStrLn
  19. mkYesod "Chhf" [parseRoutes|
  20. / HomeR GET
  21. |]
  22. instance Yesod Chhf
  23. inBoth :: (Eq a) => [a] -> [a] -> [a]
  24. inBoth x y = filter (\n -> n `elem` y) x
  25. showMonth :: Int -> String
  26. showMonth 1 = "January"
  27. showMonth 2 = "February"
  28. showMonth 3 = "March"
  29. showMonth 4 = "April"
  30. showMonth 5 = "May"
  31. showMonth 6 = "June"
  32. showMonth 7 = "July"
  33. showMonth 8 = "August"
  34. showMonth 9 = "September"
  35. showMonth 10 = "October"
  36. showMonth 11 = "November"
  37. showMonth 12 = "December"
  38. getHomeR :: Handler Html
  39. getHomeR = defaultLayout $ do
  40. (year, month, day) <- io $ getCurrentTime >>= return . toGregorian . utctDay
  41. let nextMonth = (month + 1) `mod` 12
  42. let ts = toTS (year, month, day)
  43. let ((i,o),b,r) = currentFormat ts
  44. let bx = (\(Bq x) -> x)
  45. let (_,ib,_) = initialRotation
  46. let bbout = map show $ catMaybes $ inBoth (bx ib) (tail $ bx b)
  47. let dpout = sort $ map show $ map (\(Ir n) -> n) i
  48. let pr = getPreview ts
  49. setTitle "Protocol Seven"
  50. toWidget [lucius|
  51. html {
  52. color: #FFFFFF;
  53. background-color: #222222;
  54. font-family: 'Inconsolata', monospace;
  55. margin: 0px;
  56. padding: 0px;
  57. }
  58. body {
  59. width: 740px;
  60. margin: auto;
  61. padding: 20px;
  62. text-align: left;
  63. border-left: 4px solid white;
  64. border-right: 4px solid white;
  65. }
  66. section {
  67. border-top: 4px solid white;
  68. padding: 5px;
  69. }
  70. header {
  71. margin: 0px;
  72. padding: 5px;
  73. border-top: 4px solid white;
  74. }
  75. .subheading {
  76. text-align: center;
  77. padding: 5px;
  78. }
  79. h1 {
  80. text-align: center;
  81. margin: 0px;
  82. padding: 5px;
  83. }
  84. p,h2,h3 {
  85. margin: 0px;
  86. padding: 5px;
  87. }
  88. ul {
  89. text-align: initial;
  90. }
  91. .current {
  92. width: 600px;
  93. }
  94. .currentFormat {
  95. margin: auto;
  96. padding: 1px;
  97. }
  98. .currentLeft {
  99. width: 300px;
  100. float: left;
  101. }
  102. .currentRight {
  103. margin-left: 300px;
  104. }
  105. .upcoming {
  106. width: 600px;
  107. }
  108. .changes {
  109. margin: auto;
  110. padding: 1px;
  111. }
  112. .upcomingIn {
  113. color: #00DD00;
  114. background-color: inherit;
  115. width: 300px;
  116. float: left;
  117. }
  118. .upcomingOut {
  119. color: #DD0000;
  120. background-color: inherit;
  121. margin-left: 300px;
  122. }
  123. |]
  124. addScriptRemote "https://fonts.googleapis.com/css?family=Inconsolata"
  125. toWidgetBody [hamlet|
  126. <header>
  127. <h1>Protocol Seven
  128. <p class="subheading">Always Be Running</p>
  129. |]
  130. toWidgetBody [hamlet|
  131. <section class="rotation">
  132. <div class="current">
  133. <h2>Format for #{showMonth month} #{year}:
  134. <div class="currentFormat">
  135. <div class="currentLeft">
  136. <h3>Evergreen:
  137. <ul>
  138. <li>Revised Core Set x3
  139. <h3>Big Boxes:
  140. <ul>
  141. $forall bb <- bbout
  142. <li>#{bb}
  143. <div class="currentRight">
  144. <h3>Data-packs:
  145. <ul>
  146. $forall dp <- dpout
  147. <li>#{dp}
  148. <div class="upcoming">
  149. <h2>Upcoming Changes for #{showMonth nextMonth} #{year}:
  150. $maybe (pin, pout, pbin, pbout) <- pr
  151. <div class="changes">
  152. <div class="upcomingIn">
  153. <h3>In:
  154. <ul>
  155. $maybe pbbin <- pbin
  156. <li>+ #{show pbbin}
  157. $forall indp <- pin
  158. <li>+ #{show indp}
  159. <div class="upcomingOut">
  160. <h3>Out:
  161. <ul>
  162. $maybe pbbout <- pbout
  163. <li>- #{show pbbout}
  164. $forall outdp <- pout
  165. <li>- #{show outdp}
  166. $nothing
  167. <h3>Coming soon!
  168. |]
  169. toWidgetBody [hamlet|
  170. <section class="about">
  171. <h2>What is Protocol Seven?
  172. <blockquote><em>"No matter where you go, everybody's connected."</em> - Lain Iwakura
  173. <p>For many of us, Fantasy Flight Games' Living Card Game <strong>Android: Netrunner</strong> was more than simply a card game. The term <em>Lifestyle Game</em> has been thrown around a lot, but is truer for no other community than that of <strong>ANR</strong>. Without the influx of things to discuss each month, it may seem likely that the community will die, however this is only true if we let it happen.
  174. <p>With the cancellation of many players favourite game, and no real replacement anywhere on the horizon, all that's left is to create our own points of discussion. Many players are working on custom cycles to expand the card pool, however one <strong>Chris Hay</strong> of the small and oft ridiculed meta from <strong>Dunedin, New Zealand</strong> has come up with a solution; an everchanging format using the current completed card pool.
  175. <h2>How does it work?
  176. <blockquote><em>"One theory says that man is a neoteny and is no longer able to evolve. If this is true, then what an absurd creature mankind has evolved into."</em> - Eiri Masami
  177. <p><strong>Protocol Seven</strong> is an attempt at a constantly evolving metagame. Rather than relying on an influx of new cards every month, <strong>Protocol Seven</strong> relies on a monthly rotation schedule. This allows discussion of a new metagame every month for the forseeable future.
  178. <p>A month's format in <strong>Protocol Seven</strong> will at any time consist of the following:
  179. <ul>
  180. <li>3x Revised Core Set
  181. <li>18x Data Packs from the Lunar - Kitara cycles
  182. <li>5-6x Deluxe Boxes (Including Terminal Directive)
  183. <p>This website will automatically update with the latest format, as well as a preview of the next months changes. This allows discussion, an ever-changing metagame, whilst also keeping the card pool similar enough between months that decks can be altered rather than completely remade.
  184. <h2>The Protocol Seven Protocol
  185. <blockquote><em>"But a protocol is nothing more than a simple agreement."</em> - Eiri Masami
  186. <p>A comprehensive description of the <strong>Protocol Seven</strong> format
  187. <ul>
  188. <li>3x Revised Core Sets will be legal at all times
  189. <li>The most recent FFG Most Wanted List will be active at all times
  190. <li>The Genesis and Spin cycles are not legal
  191. <li>Cards from the Original Core Set that are not in the Revised Core Set are not legal
  192. <li>18x of the 36 Data Packs from Lunar cycle onwards will be legal at all times
  193. <li>Each rotation will remove the two Data Packs that have been in play the longest, and replace them with two, randomly chosen packs
  194. <li>Once rotated out, a Data Pack will not rotate in for at least three months
  195. <li>Each rotation, one Deluxe Box (Including Terminal Directive), in release order, will be chosen as illegal
  196. <li>Every 7th rotation, all Deluxes will be legal instead
  197. <li>The rotation will happen on the 1st of every month, New Zealand time
  198. <li>On the 20th of every month, a preview of the next months format will be shown
  199. <li><del>No matter what the currently legal packs are, Door to Door (Escalation #59) will always be legal</del>
  200. |]
  201. main :: IO ()
  202. main = warp 80 Chhf
  203. toTS :: (Integer, Int, Int) -> Timestamp
  204. toTS (y,m,d) = Ts (fromIntegral d) (fromIntegral m) y