-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTipos.hs
62 lines (57 loc) · 1.3 KB
/
Tipos.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Declaraciones de Tipos de Datos
module Tipos where
-- Declaracion de Tipos de Pokemon
data Tipo
= Bug
| Dark
| Dragon
| Electric
| Fighting
| Fire
| Flying
| Ghost
| Grass
| Ground
| Ice
| Normal
| Poison
| Psychic
| Rock
| Steel
| Water
deriving (Bounded, Eq, Enum, Read, Show)
-- Declaracion de Especies
data Especie = Especie
{ numero :: Int
, nombreEsp :: String
, tipoElem :: (Tipo, Tipo)
, hp :: Int
, ataque :: Int
, defensa :: Int
, ataqueEsp :: Int
, defensaEsp :: Int
, velocidad :: Int
, prevolucion :: Monstruo -- Entero que identifican al pokemon padre
, evolucion :: Monstruo -- Entero que identifica al pokemon hijo
} deriving (Show)
-- Declaracion de Ataques
data Ataque = Ataque
{ nombreAtaq :: String
, tipo :: Tipo
, fisico :: Bool
, pps :: Int
, pow :: Int
} deriving (Show)
-- Declaracion de Monstruo
data Monstruo = Monstruo
{ especie :: Especie
, sobreNombre :: String
, nivel :: Int
, hpAct :: Int
, ataques :: [Ataque]
, individual :: Int
, esfuerzo :: Int
} deriving(Show)
-- Funciones para acceder a ciertos atributos de un tipo
getHp :: Monstruo -> Int
getHp (Monstruo _ _ _ hp _ _ _) = hp