0
1
00:00:00,000 --> 00:00:05,421
All right so let's start. So
maybe we can start with the
1

2
00:00:05,421 --> 00:00:09,181
spell because I think that's
the easiest, okay? We know that
2

3
00:00:09,181 --> 00:00:13,661
it's an abstract class. You
just add a name and an abstract
3

4
00:00:13,661 --> 00:00:18,861
function it seems. So let's
start with that. Let's create a
4

5
00:00:18,861 --> 00:00:27,081
spell class. It is going to be
abstract. And so inside we said
5

6
00:00:27,081 --> 00:00:32,921
that we have a name that is
probably a string and we should
6

7
00:00:32,921 --> 00:00:39,001
expose this name so we'll have
get name and we're going to
7

8
00:00:39,001 --> 00:00:45,581
return this underscore name. So
we're going to need a cast
8

9
00:00:45,581 --> 00:00:51,981
function as well. So I'm going
to create an abstract cast
9

10
00:00:53,721 --> 00:00:59,021
like this and void so remember
here the syntax is a bit
10

11
00:00:59,021 --> 00:01:03,101
different than from in an
interface okay in an interface
11

12
00:01:03,101 --> 00:01:06,301
you would do something like
this but this is not going to
12

13
00:01:06,301 --> 00:01:09,421
work in an abstract class okay
so the syntax is a bit
13

14
00:01:09,421 --> 00:01:15,181
different like this and finally
we need a constructor to fill
14

15
00:01:15,181 --> 00:01:18,781
the name so we're going to
create a constructor name
15

16
00:01:18,781 --> 00:01:25,581
string and we're going to fill
the name with the name that we
16

17
00:01:25,581 --> 00:01:31,101
have here and technically yes
we shouldn't have any error
17

18
00:01:31,101 --> 00:01:35,501
okay we're good with the spell
okay so we're good with that so
18

19
00:01:35,501 --> 00:01:40,781
spell is done maybe we can
continue on easy things like the
19

20
00:01:40,781 --> 00:01:43,901
fire spell and the fire spell
name the frost spell and the
20

21
00:01:43,901 --> 00:01:48,941
frost spell name so first let's
start with the enums okay
21

22
00:01:48,941 --> 00:01:52,221
because we know that we have to
create enums for the names so
22

23
00:01:52,221 --> 00:01:56,581
I'm going to create interface
that is going to be fire spell
23

24
00:01:56,581 --> 00:02:03,061
name not sorry not an interface
anonymous and this enum I will
24

25
00:02:03,061 --> 00:02:11,241
have fire bolt and I'm going to
rename and I'm going to set the
25

26
00:02:11,241 --> 00:02:14,921
content to fire bolt like this
so I can display the name
26

27
00:02:14,921 --> 00:02:21,641
correctly. I will have firewall
and I will have big bang and we
27

28
00:02:21,641 --> 00:02:26,841
can do the same thing but for
the frost spell name
28

29
00:02:28,221 --> 00:02:37,881
So we have the frost bolt. And
we have the blizzard.
29

30
00:02:40,221 --> 00:02:49,721
Okay. So we are good. We are
with the spell name and we are good
30

31
00:02:49,721 --> 00:02:54,121
with the frost spell name now
let's work on the fire spell
31

32
00:02:54,121 --> 00:02:59,081
and the frost spell so let's
start with the fire spell so
32

33
00:02:59,081 --> 00:03:05,721
we'll add a class fire spell
that should extends spell since
33

34
00:03:05,721 --> 00:03:11,561
it extends spell we have to
implement the cast method and
34

35
00:03:11,561 --> 00:03:17,881
that's fine we know what to do
we have to display boom you are
35

36
00:03:17,881 --> 00:03:24,261
burning the enemy so we're
going to Take this console.
36

37
00:03:24,261 --> 00:03:26,501
log
37

38
00:03:28,821 --> 00:03:33,041
but first I think I have to
display the name of the spell
38

39
00:03:33,041 --> 00:03:41,041
so I'm going to display this.
name here then boom you are
39

40
00:03:41,041 --> 00:03:46,721
burning the enemy it took 20
damage but twenty damage is
40

41
00:03:46,721 --> 00:03:50,161
burning damage okay and it's a
value that cannot be modified
41

42
00:03:50,161 --> 00:03:55,801
so it has to be read only so
I'm going to create a read only
42

43
00:03:55,801 --> 00:04:00,721
burning damage equal to 20 and
that's what I'm going to use
43

44
00:04:00,721 --> 00:04:06,321
here okay so I'm going to use
back quotes and then display
44

45
00:04:06,321 --> 00:04:11,601
here the burning damage so
pretty easy and we can do
45

46
00:04:11,601 --> 00:04:19,021
something quite similar for the
frost spell frost spell that
46

47
00:04:19,021 --> 00:04:21,661
extend the spell as well it
doesn't have a burning damage
47

48
00:04:21,661 --> 00:04:28,541
but as a slowing rate that is
zero. five and I think the
48

49
00:04:28,541 --> 00:04:33,901
sentence is a bit different
it's your freezing okay so I'm
49

50
00:04:33,901 --> 00:04:40,421
going to display that and here
it's going to be the this dot
50

51
00:04:40,421 --> 00:04:46,861
slowing rate and we're good for
the frost spell and for the
51

52
00:04:46,861 --> 00:04:52,621
fire spell. Cool, so let's
check all of that. So yes, it
52

53
00:04:52,621 --> 00:04:58,961
inerate, it has a slowing and
it display the correct thing and
53

54
00:04:58,961 --> 00:05:03,441
we forgot that it's supposed to
be initialized with a name
54

55
00:05:03,441 --> 00:05:06,961
only, meaning that we have to
create a constructor. So let's
55

56
00:05:06,961 --> 00:05:09,361
do that.
56

57
00:05:11,221 --> 00:05:16,441
So for each one let's create a
constructor and here we're
57

58
00:05:16,441 --> 00:05:23,721
going to receive a name that
should be a fire spell name.
58

59
00:05:23,721 --> 00:05:29,881
And we're going to set the name
so here in spell as you can see
59

60
00:05:29,881 --> 00:05:32,921
that's when we set the name so
we have to call this
60

61
00:05:32,921 --> 00:05:37,001
constructor to fill the name
here to call the constructor of
61

62
00:05:37,001 --> 00:05:39,881
the parent we have to call
super and then send the value
62

63
00:05:39,881 --> 00:05:43,881
and here it's a name so let's
just do that and let's repeat
63

64
00:05:43,881 --> 00:05:49,641
the same thing but in the frost
spell class and here it's going
64

65
00:05:49,641 --> 00:05:57,061
to be a frost spell name and
now we good. Okay, cool. So now
65

66
00:05:57,061 --> 00:06:00,021
technically, we're good with
the fire spell and we're good
66

67
00:06:00,021 --> 00:06:05,221
with the frost spell. Well, we
did we did a lot. Now the
67

68
00:06:05,221 --> 00:06:09,461
wizard. The wizard. Uh maybe
we're going to do the wizard in
68

69
00:06:09,461 --> 00:06:11,701
the next one, okay? Because
this video is going to be a bit
69

70
00:06:11,701 --> 00:06:16,021
too long. So let's do that in
the next one.
