-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchar.hs
42 lines (34 loc) · 839 Bytes
/
char.hs
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
data Class = Fighter | Rogue | Mage
data Element = Physical | Fire | Ice | Earth | Water
deriving Eq
data Res = Res {
fireRes :: Int,
coldRes :: Int,
earthRes :: Int,
waterRes :: Int
}
deriving Show
data Damage = Damage {
amount :: Int,
element :: Element
}
data Stat = Stat {
level :: Int,
maxhp :: Int,
hp :: Int,
maxmp :: Int,
mp :: Int,
res :: Res
}
deriving Show
makeStat :: Int -> Class -> Stat
makeStat level Rogue = genStat level 1.5 2.8 0.6 0.2
genStat :: Int -> Float -> Float -> Float -> Float -> Stat
genStat level str dex vit ene = Stat level maxhp maxhp maxmp maxmp res
where maxhp = ((floor (vit*10))*level)
maxmp = ((floor (ene*10))*level)
res = Res 0 0 0 0
applyResistance :: Damage -> Res -> Int
applyResistance dmg res = 0
main = do
putStrLn $ show $ makeStat 10 Rogue