0
1
00:00:00,000 --> 00:00:02,701
Alright so in this video we're
going to talk about the new
1

2
00:00:02,701 --> 00:00:06,221
exercise that we're going to
do. So this is a more advanced
2

3
00:00:06,221 --> 00:00:10,981
exercise because we'll have to
use abstract classes, regular
3

4
00:00:10,981 --> 00:00:17,501
classes, enumerations, getters,
access modifiers, well a lot
4

5
00:00:17,501 --> 00:00:19,981
things, okay? So don't worry if
it's a little bit more
5

6
00:00:19,981 --> 00:00:25,501
complicated. Okay? So here is
the exercise. So summary let me
6

7
00:00:25,501 --> 00:00:31,961
zoom a little bit. Okay. So
here a wizard has a spell book
7

8
00:00:31,961 --> 00:00:36,841
containing multiple spells of
the same type. For example, for
8

9
00:00:36,841 --> 00:00:40,681
example, a wizard can have two
fire spells in his book or
9

10
00:00:40,681 --> 00:00:44,921
three frost spells in his book
but never a mix of fire and
10

11
00:00:44,921 --> 00:00:49,081
frost spells, okay? So there is
probably something generic
11

12
00:00:49,081 --> 00:00:53,721
around here. So first let's
talk about the wizard class. So
12

13
00:00:53,721 --> 00:00:58,681
a wizard is a class associated
to a spell. Either fire spell
13

14
00:00:58,681 --> 00:01:04,041
or frost spell. Okay? A wizard
can cast a spell by its name
14

15
00:01:04,041 --> 00:01:09,961
only if it's present in its
spell book. A wizard can cast
15

16
00:01:09,961 --> 00:01:13,561
all the spell of its spell book
at once. So there is a function
16

17
00:01:13,561 --> 00:01:18,001
to cast all the spell at once.
One after each other obviously.
17

18
00:01:18,001 --> 00:01:23,641
And a wizard is initialised
with an array of fire spell or
18

19
00:01:23,641 --> 00:01:30,841
frost spell. Then a spell. So a
spell is an abstract class. And
19

20
00:01:30,841 --> 00:01:34,201
a spell as a name that is
exposed. So I should be able to
20

21
00:01:34,201 --> 00:01:40,221
get the spell name from
outside. And any class that is
21

22
00:01:40,221 --> 00:01:45,101
going to extend a spell will
have to implement a cast
22

23
00:01:45,101 --> 00:01:49,421
function that is going to be
different for each spell so
23

24
00:01:49,421 --> 00:01:53,981
let's talk about the fire spell
a fire spell inherite from the
24

25
00:01:53,981 --> 00:01:58,461
abstract class spell a fire
spell has something very
25

26
00:01:58,461 --> 00:02:03,341
specific to it it has a burning
damage and it's equal to 20 all
26

27
00:02:03,341 --> 00:02:09,241
the time and that value cannot
be modified okay When a fire
27

28
00:02:09,241 --> 00:02:13,081
spell is cast, it displays the
name of the spell and then
28

29
00:02:13,081 --> 00:02:17,961
display boom, you are burning
the enemy, it took 20 damages,
29

30
00:02:17,961 --> 00:02:21,401
okay? And 20 here is obviously
the burning damage that you
30

31
00:02:21,401 --> 00:02:28,101
have in the fire spell class.
Also a fire spell has a name
31

32
00:02:28,101 --> 00:02:34,661
and it can only be Firebolt,
Firewall or Big Bang. Okay? And
32

33
00:02:34,661 --> 00:02:37,301
when you're going to create a
fire spell you're going to send
33

34
00:02:37,301 --> 00:02:42,981
it a name. Okay I'm going to
add that right here
34

35
00:02:45,721 --> 00:02:55,901
So a fire spell is initialized
with a name only.
35

36
00:02:58,221 --> 00:03:02,801
And a fire spell name can only
be firbolt, firewall or big
36

37
00:03:02,801 --> 00:03:07,361
bang. So we may have to work
with enums around here. Okay?
37

38
00:03:07,361 --> 00:03:11,121
And finally we're going to talk
about the frost spell. So a
38

39
00:03:11,121 --> 00:03:16,081
frost spell inherite from a
spell like a fire spell. And it
39

40
00:03:16,081 --> 00:03:19,041
has something very specific to
it. It has a slowing rate
40

41
00:03:19,041 --> 00:03:24,281
equal to zero. five. And that
value cannot be modified. Okay?
41

42
00:03:24,281 --> 00:03:28,081
And when a frost spell is cast
it displays the name of the
42

43
00:03:28,081 --> 00:03:32,161
spell and then display you're
freezing the eanymy it's slowed
43

44
00:03:32,161 --> 00:03:37,601
by zero. five. Okay? Where the
five is the slowing rate. Okay?
44

45
00:03:37,601 --> 00:03:45,781
And exactly I like a fire
spell. I'm going to add that. A
45

46
00:03:45,781 --> 00:03:51,961
frost spell is initialised with
the name only. Okay? And
46

47
00:03:51,961 --> 00:03:57,561
finally Frostpell as a name and
its name can only be Frostbolt
47

48
00:03:57,561 --> 00:04:01,881
or Blizzard okay so again this
has probably something to do
48

49
00:04:01,881 --> 00:04:06,281
with enemies okay so once all
of this will be done obviously
49

50
00:04:06,281 --> 00:04:10,121
I'm going to share that
document with you so once all
50

51
00:04:10,121 --> 00:04:17,241
of this will be done we will be
able to work on the story So we
51

52
00:04:17,241 --> 00:04:19,961
have several things to do.
We're going to create a fire
52

53
00:04:19,961 --> 00:04:24,281
spell array containing a fire
bolt and a firewall. And we're
53

54
00:04:24,281 --> 00:04:27,081
going to create a frost spell
array containing a frostbolt
54

55
00:04:27,081 --> 00:04:32,041
and a blizzard. We're going to
create a fire wizard and
55

56
00:04:32,041 --> 00:04:36,441
initialize it with fire spell
array. We're going to create a
56

57
00:04:36,441 --> 00:04:39,321
frost wizard and initialize it
with the frost spell array that
57

58
00:04:39,321 --> 00:04:43,001
we have created here. We're
going to cast all the fire
58

59
00:04:43,001 --> 00:04:47,641
wizard spell at once. We're
going to cast a big bank from
59

60
00:04:47,641 --> 00:04:52,281
the fire wizard spell book. And
if it throws an error, catch
60

61
00:04:52,281 --> 00:04:57,261
it. Then we're going to cast
all the frost wizard spell at
61

62
00:04:57,261 --> 00:05:02,061
once. And finally we cast a
blizzard spell from the frost
62

63
00:05:02,061 --> 00:05:06,381
wizard spell book. Okay? So
technically this should be easy
63

64
00:05:06,381 --> 00:05:13,181
to do if all of that has been
done correctly. Okay? So I'm
64

65
00:05:13,181 --> 00:05:16,541
going to share all of that with
you and don't worry if you
65

66
00:05:16,541 --> 00:05:20,781
cannot do it to the end, okay?
It's alright. Uh it's a more
66

67
00:05:20,781 --> 00:05:24,761
advanced exercise. Okay? But
try your best and try to go as
67

68
00:05:24,761 --> 00:05:28,681
far as you can. Good luck and
see you on the next one for the
68

69
00:05:28,681 --> 00:05:31,172
correction.
