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