WEBVTT

00:06.920 --> 00:08.270
Welcome back.

00:08.480 --> 00:15.290
So now that we have this concept of damage types, it logically makes sense that we should have a concept

00:15.290 --> 00:18.080
of resistances to those damage types.

00:18.110 --> 00:24.770
Now, here in exec calc damage, we're looping through this array that we've created in aura gameplay

00:24.770 --> 00:26.930
tags called damage types.

00:27.050 --> 00:32.240
And here we can get set by caller magnitudes if they exist in our gameplay effect.

00:32.270 --> 00:37.130
Mapping a damage type tag to some damage value.

00:37.160 --> 00:44.360
But now that we're going to take resistances into account, we're going to want resistance tags and

00:44.360 --> 00:45.950
resistance attributes.

00:45.950 --> 00:52.820
So while we're in this for loop, it'd be really handy if we knew which resistance gameplay tag was

00:52.820 --> 00:55.830
associated with which damage type.

00:55.850 --> 01:03.530
So for that reason it might be a little bit more handy if aura gameplay tags didn't have a damage types

01:03.530 --> 01:07.290
array of gameplay tags, but rather a damage types.

01:07.290 --> 01:11.370
Map of damage types to damage resistances.

01:11.890 --> 01:17.530
Now, if we're going to have damage types and resistances, we're going to need gameplay tags for those.

01:17.530 --> 01:21.100
So the first thing we should do is add our resistances.

01:21.100 --> 01:24.340
Now we only have one damage type and that's fire.

01:24.430 --> 01:31.090
But I'd like to decide all of the different damage types for my project at this stage, and that way

01:31.090 --> 01:35.580
I don't have to keep going back and adding more damage types and more resistances.

01:35.590 --> 01:40.390
Then we can add our resistances to our attribute set as attributes.

01:40.390 --> 01:47.020
So the first step is to add gameplay tags for all the damage types and all the resistances, and then

01:47.020 --> 01:50.590
we can create this team map instead of using a t array.

01:50.620 --> 01:52.930
So let's go to Aura gameplay tags.

01:52.930 --> 02:01.420
I'm going to go ahead and close all other tabs except for calc damage and open up aura gameplay tags.

02:01.540 --> 02:04.570
Here it is and we have damage.

02:04.570 --> 02:09.340
We're also going to want resistances and we'll have one for each damage type.

02:09.340 --> 02:11.080
So we have damage fire.

02:11.290 --> 02:17.060
I'm going to decide on having three other damage types in addition to fire.

02:17.090 --> 02:19.640
I'd like to have damage lightning.

02:21.710 --> 02:23.360
I'd also like damage.

02:23.360 --> 02:24.350
Arcane.

02:24.910 --> 02:27.640
We'll just call this one of those types.

02:27.970 --> 02:35.050
And I'd also like damage physical and that will be for melee and such.

02:35.140 --> 02:40.210
So we have four damage types fire, lightning, arcane and physical.

02:40.210 --> 02:46.480
And these can be sort of the elements, if you will, in this game will have that as a theme, as one

02:46.480 --> 02:52.390
of the character classes is Elementalist a master of the elements right now, since we know that we

02:52.390 --> 02:56.980
need resistances for each of these, let's go ahead and add those gameplay tags here.

02:57.370 --> 03:03.970
Now these are going to be attributes and really they're just secondary attributes, but in case we'd

03:03.970 --> 03:10.450
like to categorize them a little bit differently so that we can sort things by tag preemptively, I'm

03:10.450 --> 03:15.370
going to place them in a different sub category than secondary.

03:15.400 --> 03:21.310
I'm just going to place them in resistances, so I'm going to make an gameplay tag.

03:21.970 --> 03:29.270
Called attributes underscore resistances or just resistance, underscore fire.

03:29.290 --> 03:34.150
And then we can have attributes, resistance, lightning and the others.

03:34.150 --> 03:37.420
So we'll have attributes, resistance, lightning.

03:37.930 --> 03:45.190
We'll have attributes, resistance arcane, and we'll have attributes, resistance, physical.

03:45.940 --> 03:49.300
But again, these are just secondary attributes.

03:49.330 --> 03:52.210
They'll be treated exactly like secondary attributes.

03:52.210 --> 03:59.260
The difference is, well, they're resistances, but that doesn't really mean anything from a technical

03:59.260 --> 04:00.220
standpoint.

04:00.220 --> 04:06.820
It just means something to humans when we want to organize these, much like some of these secondary

04:06.820 --> 04:12.880
attributes are related to combat and others are more related to the vital aspects such as Max Health

04:12.880 --> 04:15.010
and Max Mana and so on.

04:15.040 --> 04:18.760
Now we have damage types and we have resistances.

04:18.760 --> 04:21.490
I really like a t map instead of a t array.

04:21.490 --> 04:25.940
So we can associate all the resistances with the damage types.

04:26.240 --> 04:32.840
So I'm going to change this from a t array to a t map and it's going to map from gameplay tag to gameplay

04:32.840 --> 04:33.170
tag.

04:33.170 --> 04:34.880
So gameplay tag there.

04:35.180 --> 04:38.930
And we can call this damage types to resistances.

04:39.560 --> 04:47.240
Now we need to define all of these new gameplay tags and then make sure our t map has all the tags to

04:47.240 --> 04:48.140
resistances.

04:48.140 --> 04:53.030
So let's go into the CPP file and let's flesh this out.

04:53.180 --> 05:00.650
Now just to make things easier, I'm going to make a multi-line comment here that says damage types

05:00.650 --> 05:05.090
and after damage types, we'll have the resistances.

05:06.370 --> 05:13.010
So we'll say resistances and let's just make sure we have all of these here.

05:13.030 --> 05:15.370
Now first of all, this gameplay tags.

05:15.580 --> 05:17.670
Damage types no longer exists.

05:17.680 --> 05:18.950
Now we have a map.

05:19.000 --> 05:21.640
I'm just going to go ahead and remove that for now.

05:21.640 --> 05:25.300
And in addition to fire, let's add the other three.

05:25.300 --> 05:32.980
So we're going to have one, two, three more damage types starting with damage underscore lightning.

05:32.980 --> 05:40.900
This is going to be for the name damage dot lightning and we'll just say lightning damage type.

05:40.900 --> 05:42.790
Next we'll have damage.

05:42.790 --> 05:52.060
Arcane the name is damage dot arcane comment says arcane damage type and finally damage underscore physical

05:52.090 --> 05:57.670
the name is damage dot physical and the comment is physical damage type.

05:57.670 --> 06:00.550
So now we have all of these damage types.

06:00.550 --> 06:02.410
Now we need the resistances.

06:02.410 --> 06:05.140
So let's go ahead and define those.

06:05.510 --> 06:15.320
So first we have attributes, underscore resistance, underscore arcane, and our name is going to be

06:15.320 --> 06:23.510
and this is very important not to typo here attributes dot resistance dot arcane.

06:23.750 --> 06:28.430
And this will be resistance to arcane damage.

06:28.610 --> 06:31.790
And we're going to want three others, right?

06:31.790 --> 06:38.870
So let's go ahead and just paste it three times and the next one will be, I don't know why I did arcane

06:38.870 --> 06:46.550
first, but the next one can be fire and it will be attributes dot resistance dot fire Comment says

06:46.550 --> 06:48.500
Resistance to fire damage.

06:48.530 --> 06:51.260
Next we'll do lightning.

06:51.560 --> 06:56.090
The tag is attributes resistance, lightning resistance to lightning damage.

06:56.090 --> 06:58.670
And finally we have physical.

07:00.670 --> 07:06.540
Which will be attributes, resistance, physical and resistance to physical damage like so.

07:06.550 --> 07:11.500
And just to separate these, I'm going to have another multi-line comment that says effects.

07:12.110 --> 07:15.530
Now we need to set up this team map.

07:15.530 --> 07:17.360
And I'm just going to set it up right here.

07:17.360 --> 07:24.020
We'll have another multi-line comment that says map of damage types to resistances.

07:24.050 --> 07:28.130
And we'll just go ahead and do all four damage types to resistances.

07:28.130 --> 07:37.010
So we're going to say gameplay tags, dot damage types to resistances dot Add and we're going to add

07:38.180 --> 07:39.620
damage underscore.

07:39.620 --> 07:41.690
We'll just go in alphabetical order here.

07:41.720 --> 07:43.190
Damage Arcane.

07:43.960 --> 07:50.080
And we'll use attributes, resistances or resistance, rather arcane.

07:50.170 --> 07:52.450
Now, we can't just pass these straight in.

07:52.480 --> 07:55.450
We have to use gameplay tags, right?

07:55.480 --> 08:04.000
Gameplay tags dot as this is a static function, so we need to use our actual gameplay tags.

08:04.000 --> 08:06.250
Static variable here.

08:06.280 --> 08:08.830
Now that's going to take care of arcane.

08:08.830 --> 08:11.290
We need to take care of the other three.

08:11.320 --> 08:12.790
So I'm going to paste three times.

08:12.790 --> 08:17.020
One, two, three, and the next one will be damage underscore.

08:18.580 --> 08:20.050
We'll go with lightning.

08:22.550 --> 08:26.000
Mapping gameplay tags Resistance Lightning.

08:26.330 --> 08:31.280
Next we'll do physical again.

08:31.280 --> 08:33.420
Just going in alphabetical order here.

08:33.440 --> 08:34.610
Physical.

08:34.730 --> 08:38.510
And the last one is fire.

08:39.530 --> 08:47.660
And having them all together here shows us that this map here contains the damage types, the resistances.

08:47.660 --> 08:55.910
This is just for convenience so we don't have to go out of our way to figure out or hardcode these relationships.

08:55.910 --> 09:00.080
This allows our algorithms to be more general in the future.

09:00.080 --> 09:06.800
So now that we have gameplay tags for all the damage types and gameplay tags for all the resistances,

09:06.830 --> 09:09.710
we can start implementing resistances.

09:09.710 --> 09:16.790
Now something I have to go back and change is the exact calc because we were looping through that array.

09:16.820 --> 09:25.170
Now we need to loop through the team map so gameplay tags get it now cannot be just damage types but

09:25.170 --> 09:27.540
damage types to resistances.

09:30.690 --> 09:36.480
And now this is no longer a gameplay tag, but a pair of gameplay tags.

09:36.480 --> 09:42.630
So we're going to say auto reference pair and we can remove this damage type tag here.

09:44.110 --> 09:46.030
This can be a const auto pair.

09:46.030 --> 09:51.500
And really, if we want, we can just use its actual type A t tuple.

09:51.520 --> 09:54.610
So for transparency we can do that.

09:54.640 --> 09:58.420
Now we're getting the set by caller magnitude using the damage type.

09:58.420 --> 10:00.730
That's going to be the pair dot key, right?

10:00.730 --> 10:02.500
So we're going to use pair dot key here.

10:03.130 --> 10:03.820
Okay.

10:03.820 --> 10:05.560
So now we're set up.

10:05.560 --> 10:09.280
We have gameplay tags for our resistances.

10:09.280 --> 10:11.970
They're associated with damage types.

10:11.980 --> 10:20.230
What's left is to make those resistances, these ones actual attributes in the attribute set and we'll

10:20.230 --> 10:21.180
do that next.

10:21.190 --> 10:22.380
So great job.

10:22.390 --> 10:23.530
I'll see you soon.
