-
Notifications
You must be signed in to change notification settings - Fork 1
/
Piece.elm
75 lines (68 loc) · 3.11 KB
/
Piece.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module Piece where
import GameTypes exposing (Piece (..))
fromString : String -> Piece
fromString str =
case str of
"Vain" -> Vainamoinen
"Ukko" -> Ukko
"Kullervo" -> Kullervo
"Kaarme" -> Kaarme
"Jouk" -> Joukahainen
"Ilmar" -> SeppoIlmarinen
"Louhi" -> Louhi
"Lemmi" -> Lemminkainen
toString : Piece -> String
toString piece =
case piece of
Vainamoinen -> "Vain"
Ukko -> "Ukko"
Kullervo -> "Kullervo"
Kaarme -> "Kaarme"
Joukahainen -> "Jouk"
SeppoIlmarinen -> "Ilmar"
Louhi -> "Louhi"
Lemminkainen -> "Lemmi"
toDisplayString : Piece -> String
toDisplayString piece =
case piece of
Vainamoinen -> "Väinämöinen"
Ukko -> "Ukko"
Kullervo -> "Kullervo"
Kaarme -> "Käärme"
Joukahainen -> "Joukahainen"
SeppoIlmarinen -> "Seppo Ilmarinen"
Louhi -> "Louhi"
Lemminkainen -> "Lemminkäinen"
baseValue : Piece -> Int
baseValue piece =
case piece of
Vainamoinen -> 8
Ukko -> 7
Kullervo -> 6
Kaarme -> 5
Joukahainen -> 4
SeppoIlmarinen -> 3
Louhi -> 2
Lemminkainen -> 1
flavorText : Piece -> String
flavorText piece =
case piece of
Vainamoinen -> "Väinämöinen, the central character of the Kalevala, was a shamanistic hero with a magical power of song and music."
Ukko -> "Ukko, the god of the sky, created lightning with his hammer Ukonvasara and caused thunderstorms by driving his chariot through the skies."
Kullervo -> "Kullervo grew up thinking his family was dead, amongst his people's murderers, and killed himself after unknowingly seducing his sister."
Kaarme -> "Plowing a field of poisonous snakes (käärmeitä) was the first task that Seppo Ilmarinen had to perform to marry Louhi's daughter."
Joukahainen -> "After losing a contest, the arrogant archer Joukahainen pledged his sister Aino to Väinämöinen, but she drowned herself rather than marry him."
SeppoIlmarinen -> "Seppo Ilmarinen, the Eternal Hammerer, was an immortal blacksmith who was capable of creating practically anything, but unlucky in love."
Louhi -> "Louhi was a powerful witch with the ability to change shape, and the main opponent of Väinämöinen in the battle for the magical artifact Sampo."
Lemminkainen -> "After Lemminkäinen drowned in the underworld, his mother sewed his body together and restored him to life with ointment from Ukko's halls."
rulesText : Piece -> String
rulesText piece =
case piece of
Vainamoinen -> "8 - No special rules."
Ukko -> "7 - No special rules."
Kullervo -> "6 - Only other Kullervos may be placed next to this tile."
Kaarme -> "5 - May be placed on top of other tiles (except other Käärmes)."
Joukahainen -> "4 - Value is the sum of all Joukahainen tiles in the same row or column."
SeppoIlmarinen -> "3 - You may exchange it with any tile on the table (except other Seppo Ilmarinens)."
Louhi -> "2 - Automatically scores when there are Louhis on both ends of a line."
Lemminkainen -> "1 - All adjacent tiles (except other Lemminkäinens) have value 0."