-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapTree.hs
More file actions
124 lines (108 loc) · 4.23 KB
/
MapTree.hs
File metadata and controls
124 lines (108 loc) · 4.23 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{-
Module : MapTree
Description : Tree that contains stages for archer
-}
module MapTree (
MapTree(..),
MapNode(..),
storyMap,
createMapNode,
getHistoryString,
getValue,
getVillageName
) where
import Unit
import Enemies
import Story
-- Represent Villages
type Village = String
-- Tree Structure
type StoryString = String
type Enemy = Unit
data MapNode = MapNode(Village, Enemy, StoryString) deriving(Read, Show) -- MapTree node
-- Tree for game
data MapTree a = Null
| Node MapNode (MapTree a) (MapTree a) deriving(Read, Show)
-- Places
tresting = "Tresting"
meridell = "Meridell"
phorofor = "Phorofor"
paris = "Paris"
-- Enemies nodes for Tree
initialNode = MapNode("Initial Game", NullUnity, "")
ramsorNode = MapNode(tresting, ramsor, ramsorDialogue)
mynxeNode = MapNode(meridell, mynxe, mynxeDialogue)
anmiNode = MapNode(phorofor, anmi, anmiDialogue)
ghaaaauyaNode = MapNode(paris, ghaaaauya, ghaaaauyaDialogue)
lohnNode = MapNode(tresting, lohn, lohnDialogue)
mountainWolfNode = MapNode(meridell, mountainWolf, mountainWolfDialogue)
malfoyNode = MapNode(phorofor, malfoy, malfoyDialogue)
robinhoODoFilmeNode = MapNode(paris, robinhoODoFilme, robinhoODoFilmeDialogue)
singleEyedGladiatorNode = MapNode(tresting, singleEyedGladiator, singleEyedGladiatorDialogue)
itzelNode = MapNode(paris, itzel, itzelDialogue)
hydellNode = MapNode(meridell, hydell, hydellDialogue)
durgessNode = MapNode(phorofor, durgess, durgessDialogue)
terakNode = MapNode(tresting, terak, terakDialogue)
ilyNode = MapNode(meridell, ily, ilyDialogue)
noxNode = MapNode(phorofor, nox, noxDialogue)
kingForgusGhostNode = MapNode(paris, kingForgusGhost, kingForgusGhostDialogue)
bombNode = MapNode(tresting, NullUnity, bombDialogue)
battleFairyNode = MapNode(paris, NullUnity, battleFairyDialogue)
-- MapTree
leftSide = (Node (MapNode(northVillage, NullUnity , northVillageDialogue))
(Node ramsorNode
(Node bombNode
(Node ghaaaauyaNode
(Node lohnNode Null Null) (Node mountainWolfNode Null Null))
(Node malfoyNode
(Node robinhoODoFilmeNode Null Null) (Node singleEyedGladiatorNode Null Null)))
(Node battleFairyNode
(Node itzelNode
(Node hydellNode Null Null) (Node durgessNode Null Null))
(Node terakNode
(Node ilyNode Null Null) (Node noxNode Null Null))))
(Node kingForgusGhostNode
(Node malfoyNode
(Node singleEyedGladiatorNode
(Node itzelNode Null Null) (Node hydellNode Null Null))
(Node noxNode
(Node robinhoODoFilmeNode Null Null) (Node ghaaaauyaNode Null Null)))
(Node anmiNode
(Node noxNode
(Node ramsorNode Null Null) (Node durgessNode Null Null))
(Node battleFairyNode
(Node terakNode Null Null) (Node mountainWolfNode Null Null)))))
rightSide = (Node (MapNode(southVillage, NullUnity , southVillageDialogue))
(Node mynxeNode
(Node mountainWolfNode
(Node anmiNode
(Node lohnNode Null Null) (Node robinhoODoFilmeNode Null Null))
(Node noxNode
(Node itzelNode Null Null) (Node ramsorNode Null Null)))
(Node malfoyNode
(Node itzelNode
(Node terakNode Null Null) (Node ramsorNode Null Null))
(Node bombNode
(Node ilyNode Null Null) (Node mountainWolfNode Null Null))))
(Node kingForgusGhostNode
(Node anmiNode
(Node battleFairyNode
(Node durgessNode Null Null) (Node itzelNode Null Null))
(Node hydellNode
(Node mountainWolfNode Null Null) (Node ghaaaauyaNode Null Null)))
(Node ghaaaauyaNode
(Node ramsorNode
(Node mynxeNode Null Null) (Node durgessNode Null Null))
(Node hydellNode
(Node durgessNode Null Null) (Node lohnNode Null Null)))))
storyMap = Node initialNode leftSide rightSide -- MapTree
-- Create MapTree node
createMapNode :: Village -> Unit -> StoryString -> MapNode
createMapNode village unit history = MapNode(village, unit, history)
-- Getters
getHistoryString :: MapNode -> String
getHistoryString (MapNode((_, _, h))) = h
getValue :: MapNode -> Enemy
getValue (MapNode(_, e, _)) = e
getVillageName :: MapTree a -> String
getVillageName (Node (MapNode(n, _, _)) _ _) = n