WEBVTT

00:06.910 --> 00:08.110
Welcome back.

00:08.320 --> 00:13.960
So now we're determining if we got a block and if we did, we cut the damage in half.

00:14.080 --> 00:21.520
The next calculation I'd like to make is taking armor and armor penetration into account.

00:21.910 --> 00:26.080
Now, the order in which we do these calculations matters, right?

00:26.080 --> 00:33.340
Because if we cut the damage in half first, then that's going to affect how subsequent calculations

00:33.340 --> 00:37.810
are made depending on what those calculations are mathematically.

00:38.320 --> 00:44.860
So the way that I'd like to do it is to determine if there's a block first and foremost, and then from

00:44.860 --> 00:50.470
there, any additional calculations will work based on that result.

00:50.680 --> 00:58.780
If the damage has been cut in half, then the starting amount of damage going into the next calculations

00:58.780 --> 01:00.730
will be half as large.

01:01.150 --> 01:07.400
And the reason for that choice is, well, the choice had to be made and this makes sense to me.

01:07.430 --> 01:11.450
Now we're going to go up to aura damage statics.

01:11.450 --> 01:13.610
We're already capturing armor.

01:13.610 --> 01:20.690
We're going to capture armor penetration Now, as the two of these kind of coincide together, they

01:20.690 --> 01:27.590
work with each other or I should say they work against one another as armor penetration ignores a percentage

01:27.590 --> 01:30.970
of the target's armor of the victim's armor.

01:30.980 --> 01:38.060
So we're going to capture armor penetration, which means we need to use armor penetration with this

01:38.060 --> 01:38.780
macro.

01:38.780 --> 01:45.380
And for the define version of this macro, we're going to also use armor penetration.

01:45.500 --> 01:50.660
But in this case, we're going to capture armor penetration from the source.

01:50.690 --> 01:51.410
Right?

01:51.410 --> 01:56.270
Because armor and block chants, those are for the defending character.

01:56.300 --> 01:59.810
The attacker is what uses the armor penetration.

01:59.810 --> 02:05.510
So we're going to compare the armor penetration of the source with the armor of the target.

02:05.600 --> 02:12.140
Now, we do need to add this to relevant attributes to capture, so we'll do that as well, adding our

02:12.140 --> 02:20.600
armor penetration depth to that array, and then we can scroll down and capture the values of armor

02:20.600 --> 02:22.130
and armor penetration.

02:22.130 --> 02:25.940
And these three lines here are what I'm looking at.

02:25.940 --> 02:29.770
This is how we captured our target block Chance.

02:29.780 --> 02:35.990
We're going to copy those three lines and paste them just beneath here, and we're going to change this

02:35.990 --> 02:37.280
to armor.

02:37.280 --> 02:40.040
And this is going to be armor on the target.

02:40.040 --> 02:41.930
So this can be target armor.

02:42.050 --> 02:49.550
Now, target armor will be initialized to zero, but we're going to pass in to attempt calculate captured

02:49.550 --> 02:53.960
attribute magnitude the armor def.

02:54.200 --> 03:03.800
We're also going to pass in this target armor float and then we're going to use Max on target armor

03:03.920 --> 03:06.350
maxing itself and zero.

03:06.350 --> 03:09.670
So that way we'll never get a negative value.

03:09.680 --> 03:12.080
So that's our target's armor.

03:12.080 --> 03:15.560
We're also going to get the source armor penetration.

03:15.560 --> 03:19.610
So we're going to call this one source armor penetration.

03:19.790 --> 03:24.170
And we're capturing armor penetration, depth.

03:24.170 --> 03:25.730
That's the first input.

03:25.730 --> 03:29.420
And we're passing in source armor penetration.

03:29.420 --> 03:33.890
And then we'll go ahead and do the max trick with source armor penetration as well.

03:33.890 --> 03:38.000
So after damage, we can have a couple of comments here as well.

03:38.000 --> 03:44.150
And right here, this comment if block half the damage, that's really what this line is doing here.

03:44.150 --> 03:47.510
So I'm going to move this comment down to right here.

03:47.510 --> 03:50.150
This is where we're having the damage.

03:50.390 --> 03:51.110
Okay.

03:51.110 --> 03:55.910
So now our comments are a little bit descriptive of our intentions here.

03:55.910 --> 04:03.950
And for this next comment, we're going to say armor penetration ignores a percentage.

04:04.590 --> 04:06.210
Of the targets.

04:07.880 --> 04:08.720
Armor.

04:08.870 --> 04:12.230
So how are we going to implement this mathematically?

04:12.260 --> 04:14.300
Well, here's a way that I'd like to do it.

04:14.330 --> 04:22.040
I'm going to make a const float called Effective Armor, and this will be the amount of armor left over

04:22.040 --> 04:24.620
after we've ignored a percentage of it.

04:24.650 --> 04:29.630
Now, if we're going to ignore a percentage of target armor, then we're going to take target armor

04:29.630 --> 04:31.760
and multiply it by something.

04:31.760 --> 04:41.030
We're going to say times equals here and multiply by some fraction and that fraction can be, Here's

04:41.030 --> 04:41.820
one way to do it.

04:41.840 --> 04:48.560
We can say 100 minus source armor penetration divided by.

04:49.190 --> 04:50.300
100.

04:51.080 --> 04:57.170
Now, if we're doing it this way, we have to be aware of how the mathematics works.

04:57.590 --> 05:02.360
What we're doing is we're taking 100 and subtracting source armor penetration.

05:02.360 --> 05:08.360
So that right there tells you that if source armor penetration is 100, then this right here in the

05:08.360 --> 05:10.100
parentheses will be zero.

05:10.130 --> 05:18.320
It'll be 100 -100 and zero divided by 100 is still zero, which means target armor will be equal to

05:18.350 --> 05:20.180
itself times zero.

05:20.180 --> 05:26.360
So source armor penetration of 100 is basically what we would call max armor penetration.

05:26.360 --> 05:30.350
In other words, it's the ultimate armor penetration, right?

05:30.470 --> 05:36.500
You got 100, you're ignoring 100% of your target's armor for that reason.

05:36.500 --> 05:44.780
Sometimes we scale this value and we scale the value depending on the level of the characters involved,

05:44.780 --> 05:50.220
perhaps, or depending on any other criteria that the game designers choose.

05:50.250 --> 05:51.750
It depends on the game you play.

05:51.750 --> 05:55.920
And if you've played lots of RPGs, you've seen it done in a number of ways.

05:55.920 --> 06:05.530
Some games will say, Let's take source armor penetration and we'll scale it by 0.250. 25F.

06:05.580 --> 06:15.720
For example, if the source character is zero to level 60 and then if the character is level 61 to level

06:15.720 --> 06:23.790
80, then this becomes an even smaller number and then it takes more armor penetration to ignore a percentage

06:23.790 --> 06:24.600
of armor.

06:24.600 --> 06:26.010
And then you can scale it.

06:26.010 --> 06:29.310
You can even scale it using a curve, using a curve table.

06:29.310 --> 06:33.300
It really depends on how you want to implement this.

06:33.300 --> 06:35.790
There's really no end to how you do it.

06:35.790 --> 06:43.890
But if we scale this by 0.25, then that means that we'd have to have 400 armor penetration in order

06:43.890 --> 06:47.130
to ignore 100% of the target's armor.

06:47.160 --> 06:47.730
Right.

06:47.730 --> 06:55.380
And that means well, one armor penetration point is worth 25% of what it was before.

06:55.380 --> 07:02.700
But scaling it here means, well, basically, it takes for armor penetration points to ignore 1% of

07:02.700 --> 07:04.080
the target's armor.

07:04.110 --> 07:05.520
That's how it works.

07:05.550 --> 07:14.640
Now, if for some reason this value here is larger than 100, say we have 500 armor penetration, well

07:14.640 --> 07:21.300
then we're taking 100 -125 because 500 times 0.25 is 125.

07:21.300 --> 07:24.750
And in that case, we have -25 divided by 100.

07:24.780 --> 07:26.310
That's a negative value.

07:26.310 --> 07:34.860
So really, if we wanted to, we could use this math max trick here on this value, or we could just

07:34.860 --> 07:40.830
make sure the source armor penetration is never going to be higher than some kind of threshold.

07:40.830 --> 07:42.780
And that's the way that I like to approach it.

07:42.780 --> 07:50.010
But either way, the point is that source armor penetration is going to reduce the armor, the effective

07:50.010 --> 07:54.960
armor will be some percentage less after this calculation.

07:54.960 --> 08:03.090
Now, after that, we need to reduce the damage that will be caused by the effect of armor in some way.

08:03.120 --> 08:10.350
Now, if each point of the effective armor reduces the damage caused by 1%, then here's what that math

08:10.350 --> 08:11.040
would look like.

08:11.040 --> 08:18.270
We would say damage times equals, and then we could have parentheses and say.

08:19.000 --> 08:25.720
100 minus effective armor, all of that divided by 100.

08:27.010 --> 08:31.180
So if effective armor is 100, we ignore all of the damage.

08:31.180 --> 08:34.840
If effective armor is 50, we ignore 50% of the damage.

08:35.200 --> 08:36.730
Effective armor is ten.

08:36.760 --> 08:41.320
Then we have 100 minus ten, which is 90 divided by 100.

08:41.320 --> 08:43.870
90 divided by 100 is 0.9.

08:43.900 --> 08:47.680
Damage times 0.9 means we do 90% of the damage.

08:47.680 --> 08:51.610
So each point of effective armor ignores 1% of the damage.

08:51.610 --> 08:55.090
And of course, we can scale that if we think that's too OP.

08:55.120 --> 09:02.530
If we think that's too overpowered, we can say effective armor times 0.3 F and then effective armor

09:02.560 --> 09:06.760
is going to ignore a third of the percent roughly.

09:06.760 --> 09:10.420
If this is 0.333, for example, that's a third.

09:10.420 --> 09:16.810
So it would take three points of effective armor to ignore 1% of the damage.

09:16.810 --> 09:17.770
That's how that would work.

09:17.770 --> 09:21.770
And again, you can data drive this any way you like.

09:21.770 --> 09:24.680
I leave that to you as an optional exercise.

09:24.680 --> 09:31.910
For now, we know that at least our armor and our armor penetration are doing something to the damage.

09:32.270 --> 09:32.750
Okay.

09:32.750 --> 09:39.620
So now that we're capturing those attributes and making this calculation, we can play test and see

09:39.650 --> 09:41.900
just how much damage we'll be doing.

09:41.930 --> 09:46.160
Now that armor and armor penetration is taken into account.

09:48.610 --> 09:51.670
Okay, let's go ahead and open up those assets.

09:51.670 --> 09:57.820
We have a secondary attributes test if we'd like to test some values, but I'm going to go ahead and

09:57.820 --> 09:59.410
just launch and look at that.

09:59.410 --> 10:00.550
We got 15 now.

10:00.550 --> 10:05.110
We're truncating these damage values down to integers.

10:05.110 --> 10:08.320
So of course that's going to affect things.

10:08.320 --> 10:12.840
But we can set the secondary attributes to whatever we like.

10:12.850 --> 10:20.530
Now, just to prove that armor is working, we can change armor from attribute based to scalable float

10:20.530 --> 10:28.240
and set it to some higher value like I don't know, 45 and we can see if we're doing less damage because,

10:28.240 --> 10:30.730
well, our enemies have a higher armor.

10:31.950 --> 10:36.090
And we're not because we're not actually using this test attribute, are we?

10:36.120 --> 10:41.730
We have to go into the data asset, go to secondary attributes and change this to secondary attribute

10:41.760 --> 10:42.120
test.

10:42.120 --> 10:44.580
I change that back to the normal one.

10:44.580 --> 10:48.390
Now we're using the test one and now we're doing less damage.

10:48.390 --> 10:49.920
We're doing seven damage.

10:49.920 --> 10:54.720
So this is a nice way to play with the values and see how much damage we do.

10:54.750 --> 10:59.580
Let's change armor to 90, see how much damage we do.

10:59.580 --> 11:05.520
Now we do six because we're ignoring even more of that damage.

11:05.520 --> 11:12.840
And if I set this to to 50, we should see that we're ignoring even more of the damage.

11:12.840 --> 11:15.300
Yeah, we're doing one damage now.

11:15.910 --> 11:21.700
So this gives us a bit of a way to tweak those values and see, you know, this isn't the best way to

11:21.700 --> 11:23.470
test this out, but it's one way.

11:26.540 --> 11:31.820
You know, ideally we could have some kind of automated test that we write that tests a whole bunch

11:31.820 --> 11:34.490
of values and spits out some data for us.

11:34.490 --> 11:41.990
We could always do that, but for now it's enough to know that increasing the armor on the enemy is

11:41.990 --> 11:43.850
resulting in less damage.

11:43.850 --> 11:47.180
That much is clear and I'm happy about that.

11:47.180 --> 11:53.630
So at this point, we're taking block chance armor and armor penetration into account.

11:53.630 --> 12:01.130
And this comment here can go right down here where we're actually ignoring a percentage of the target's

12:01.130 --> 12:01.850
armor.

12:02.240 --> 12:12.650
And we can even add another comment that says armor ignores a percentage of incoming damage.

12:14.180 --> 12:15.140
All right.

12:15.140 --> 12:18.980
So our execution calculation is that much more complete.

12:18.980 --> 12:21.050
But we still have more to go.

12:21.050 --> 12:24.230
And we'll continue in the next video.

12:24.260 --> 12:25.310
I'll see you soon.
