magic/Magic.hs
2012-03-02 21:15:06 -05:00

35 lines
1 KiB
Haskell

module Magic where
import Mana
-------------------------------------------------------------------------------
-- Cards
-------------------------------------------------------------------------------
data Rarity = Land
| Common
| Uncommon
| Rare
| Mythic
| Special
deriving (Show, Eq)
data Card = Card Rarity String Cost [String]
deriving (Show, Eq)
instance Mana Card where
colors (Card _ _ cost _) = colors cost
converted (Card _ _ cost _) = converted cost
data Deck = Deck [Card]
curve :: Deck -> [(Int, Int)]
curve (Deck cards) = do
let largest = maximum (map converted cards)
map (\x -> (x, length (filter (\(Card rarity _ cost _) -> rarity /= Land && converted cost == x) cards))) [0..largest]
cards = concat $ [ replicate 13 (Card Land "Swamp" (Cost [] [] []) [])
, replicate 13 (Card Land "Plains" (Cost [] [] []) [])
, replicate 4 (Card Mythic "Jace Beleren" (Cost [Standard 1 Colorless, Standard 2 Blue] [] []) [])
]
deck = Deck cards