So how does protection actually work?

This is the forum for helping you out if you're stuck in Grimrock 2 or if you want to discuss about the mysteries of the Isle of Nex. Warning: forum contains spoilers!
Post Reply
Ascender
Posts: 5
Joined: Sat Jan 04, 2020 11:22 pm

So how does protection actually work?

Post by Ascender »

I've read it is 0.5 to 1.5 of protection value but when you play on hard difficulty this is easily debunked. It is realistically more like 10% to 20% of the protection value, but there seem to be extra mechanics at play here. I've tested this by giving myself absurd health using console commands and using Xarant Wormbound as test bench and the difference between 1 and 98 protection is a damage range between 14-42 vs 6-39 respectively. Against catacomb zombies (not surface zombies) the damage is 12-39 vs 1-26. Pyramid Snake 18-53 vs 1-38. Interestingly armor seems to be more effective against mummy attacks from 9-29 to 1-8.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: So how does protection actually work?

Post by Pompidom »

There are enemies that do multiple attacks to your frontline every single attack. There are no zombies, only mummies and undead.
The undead are notorious for multiple attacks every "swing"

The mummies are low level low damage minions, the undead are harder hitting entities and can therefor deal more spike damage.
Regardless of the difficulty, it's still a flat protection value.

Enemies hit harder on Hard difficulty, their attack values are higher, and have their "speeds" increased.
http://grimrock.net/forum/viewtopic.php?t=14145 It's partially explained here.

That's basically all you need to know. The more protection, the better.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: So how does protection actually work?

Post by minmay »

Oh man, I've been waiting for years for this opportunity.

The extra mechanic you're missing is that monster melee attacks don't use the champion's "Protection" value as displayed on the character sheet.
Monster melee attacks target a specific body part at random. They have a 30% chance to target the chest, 22% head, 25% legs, 23% feet.
The protection value used is [full protection value for the item in that slot] + [1/4th of the protection value from rings/cloaks/gloves/amulets/shields/the Natural Armor trait/the Shield spell/etc.] + [1/4th of the armor skill bonus for all items put together].

So let's say your character is wearing the full plate armour set (each piece has 12 protection) and the scaled cloak (5 protection). At 0 armor skill, their displayed protection value is 65, however the actual value that monster melee attacks will use is:
12 (from the plate armor item in the targeted slot)
+ 1.25 (1/4th of the scaled cloak protection value)
+ 3 (1/4th of the plate gauntlets protection value)
for a total of 16.25.

If this character has 5 armor skill, their protection bonus from armor skill will be 3 for each plate armor item and 1.25 for the scaled cloak, but it rounds at the end, so the total bonus is 16 instead of 16.25. Then the protection value used by monster melee attacks is:
12 (from the plate armor item in the targeted slot)
+ 1.25 (1/4th of the scaled cloak protection value)
+ 3 (1/4th of the plate gauntlets protection value)
+ 4 (1/4th of the armor skill bonus)
for a total of 20.25.

Also, damage from monster melee attacks can't be reduced below 1.

Charging ogres also get their damage reduced somewhat similarly, but they always "target" the chest, and damage is reduced by between 50% and 100% of the protection value rather than 50% and 150%. and it can be reduced to 0.

Finally, note that some monster melee attacks, such as the undead, have the "pierce" property that subtracts from the protection value above before using it. The undead monster has 7 pierce, so it would be using a value of 13.25 instead of 20.25 against this character.

Difficulty has no effect on how protection works.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Ascender
Posts: 5
Joined: Sat Jan 04, 2020 11:22 pm

Re: So how does protection actually work?

Post by Ascender »

Nice, this is the perfect explanation, thank you! Though I wish that I could have read your post during the release of Grimrock 2. :lol:
It is so annoying how so much false info about game mechanics gets spread around and the "0.5-1.5" protection BS turns up in multiple Google searches.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: So how does protection actually work?

Post by Pompidom »

Ascender wrote: Sun Jan 12, 2020 12:08 am Nice, this is the perfect explanation, thank you! Though I wish that I could have read your post during the release of Grimrock 2. :lol:
It is so annoying how so much false info about game mechanics gets spread around and the "0.5-1.5" protection BS turns up in multiple Google searches.
You clearly misunderstood then. The whole "0.5-1.5" protection isn't bullshit. That's just the entire point. Minmay just explained it in more detail but it's still basically "0.5x - 1.5x" of your protection value of your "hitbox" and not the total amount of protection.

The "zombie" (assuming it's an undead) you "tested" with attack you multiple times.

Basically an "undead" can hit you up for like (7?) (someone please correct me in the specific numbers of attacks) times in 1 single attack and each individual "sub-attack" can be evaded individually.
This attack is aimed at the frontrow so both front row characters can be hit at the same time by the same "attack" by multiple hits.

If you look closely to your health values you can see it clearly when attacked by an undead. your health pool will drop down with every succesful hit and you will quickly see multiple numbers pop up in a split second.

So you clearly haven't tested this at all. Because you would have noticed that in like 10 seconds.

An undead has a flat attack value of 19 and can hit up to 7 times which will rapidly deplete your health pool.
A flat attack value of 19 means 9 - 28 (rounded) on Normal Difficulty.
On Hard difficulty this damage is increased by 1.4x

So basically every time an undead attacks you he will hit you in the range of 9 - 28 damage (x7) on Normal difficulty.

If you have 0 protection you will see numbers in that specific range of (9 - 28) x 7
So assuming it's indeed 7 ( I don't know the exact value )
Worst case scenario a single attack from an undead can set you back 28 x 7 = 196 health loss.

So let's take Minmay's example case with a plate armor set on level 1 characters. No cloak.
If you're wearing a plate set with (armor pieces of 12 armor) + gauntlets of 12
= 15 armor for each "hitbox"
so basically your "hitboxes" can have an armor value in the range of 7.5 - 22.5 armor.

0.5x - 1.5x protection value now changes the damage range of this undead to your plate armor set wearing character to: 1 - 28 from 9 - 28.

That's right, you can still get hit for full damage with a plate armor set as if you were wearing 0 armor by monsters with pierce. The chances of that happening are severely reduced offcourse. Only IF the undead hits you for 28 damage and that specfic hit is countered with a 0.5x protection multiplier lowering that 15 armor to 7 - 8. And the pierce value of 7 of the undead monster actually reduces that number back down to 0 - 1 protection (worst case scenario) I have no idea what gets applied first though. The pierce or the 0.5 - 1.5x multiplier.
Then you will still lose 28 hp.

If you're unlucky, a 100 hp character with a plate armor set can still get "one shotted" by an undead as if he was wearing no armor at all. (1 - 28) x7?

It's the main reason why I never bother with pumping skillpoints in armor. Health > protection > evasion in that specific order.
And you're better off pumping skillpoints into offensive skills. Unless you go for a very specific playstyle.

I'm too lazy to test this, my numbers can be slightly off in rounding up or down, but this is basically how it works.

Monsters without pierce are simply countered by getting protection up as high as possible at 0.5x - 1.5x multiplier and that's why you find that info everywhere because that's basically the short version and technically correct.

if you wear +18 armor pieces + shield spell + armor skill 5 etc.. Many enemies will simply hit you for 1 damage all the time.

Feel free to correct me if I made a mistake somewhere.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: So how does protection actually work?

Post by minmay »

your entire post is the mistake
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: So how does protection actually work?

Post by Pompidom »

minmay wrote: Sun Jan 12, 2020 2:07 am your entire post is the mistake
Then feel free to correct it with the example of an "undead" with an attack value of 19
a level 1 character with 0 protection
and a level 1 character with a plate armor set

with evidence offcourse.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: So how does protection actually work?

Post by Pompidom »

Minmay, I just tested the proposed scenario:

level 1 minotaur barbarian which I gave 1000 health.
0 protection: 9 - 28 of health loss every "sub-hit"

60 protection:
full plate set + gloves
1 - 28 of health loss every "sub-hit"

Looks like my math was pretty much spot on. Unless I'm missing something.
Your post was very helpful, but it lacked the explanation of monster attack values.
And also multi attack monsters. Not that it really matters.

I'm just curious where you can look up the value of multi-attacks. I can't find it in the monster files so it must be hardcoded or something?

The only question that remains:
What gets applied first, the pierce or the protection multiplier?

In your post you say that pierce gets calculated first.
But in this simple scenario it's clear that the protection multiplier is calculated first before pierce.

If pierce was calculated first: 15 - 7 = 8 * 0.5 = 4 armor left and the maximum damage the minotaur should receive is 24. Yet he still receives 28 damage in the proposed testing method.
Protection multiplier first: 15 * 0.5 = 7.5 - 7 = 0.5 armor left which explains the 28 health loss both naked and armoured.

So I don't see the need being so salty.
MiG_Foxbat
Posts: 3
Joined: Sun Oct 20, 2019 10:16 am

Re: So how does protection actually work?

Post by MiG_Foxbat »

From what I can say based on what I see when playing, sorry, but Pompidom's math is correct, it falls in line with what you can find in the game.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: So how does protection actually work?

Post by minmay »

The only purpose of your post was to twist what Ascender was saying so that you could insult them. I don't care to engage with that. But I suppose an "explanation of monster attack values" would indeed be useful.

Whenever a MonsterAttackComponent hits a champion in melee, this is how the damage dealt is determined:
- Start with the component's attack power, or 0 if its attack power is nil. I'll call it X.
- Double X if the party is resting.
- Set X to a random integer between X/2 rounded down and X*1.5 rounded down, but not below 1.
- Multiply X by the difficulty damage multiplier (0.6 for Easy, 1 for Normal, 1.4 for Hard).
- Pick a random body part, and get the protection value for that body part as described in my first post; I'll call this Y.
- Subtract the component's pierce from Y, or if its pierce is nil, leave Y unchanged. Yes, negative pierce will increase Y.
- If Y is at least 1000, set X to 0; the attack will do no damage.
- Otherwise, if Y is greater than 0, set X to the good old math.max(1,X-math.floor((math.random()+0.5)*Y)) that everyone thought protection worked like because I posted that formula somewhere without any context in like 2016 :oops: (this is the "0.5 to 1.5 of protection value" that the OP is talking about)
- Round X down. This can only have an effect on Easy and Hard, on Normal X will always already be an integer.
- If X is greater than 0 (i.e. the champion didn't have 1000+ protection), call the component's onDealDamage hook, and stop here if it returned false.
- Then apply conditions and wounds and camera shake and stuff, which don't have to do with damage, so luckily I don't have to try to explain them.
- Then finally actually damage the champion for X damage.

You can inspect much of this in-game by replacing functions like math.random() with versions that print their arguments for you:

Code: Select all

local orig = math.random
math.random = function(...) print(...) return orig(...) end
Of course, lots of different things use these functions, so you'll definitely want to do this in a custom dungeon with few objects.

Whether the monster has "multi-attacks" is irrelevant. All that means is that there are multiple "attack" animation events defined for the animation being used by the MonsterAttackComponent. And the undead monster has four of them, not seven. This does not change anything about the attacks themselves, it doesn't affect the damage of the individual attacks and it certainly doesn't affect what protection does.
Pompidom wrote:The only question that remains:
What gets applied first, the pierce or the protection multiplier?
You keep saying this but I answered that question in my first post. Pierce is subtracted from the protection value for the targeted body part, prior to using that protection value (the "protection multiplier" as you call it).

Something is certainly going wrong with your test; one possibility is that your champion has wounds. If you have an item equipped on a wounded body part, 1/4th of that item's protection (including any bonus from armor skill) is subtracted from the protection value for ALL body parts.



edit: Here's an alternative way to calculate your "effective protection" for a body part that might be less confusing, or easier to do in your head:
- Start with the "Protection" value on your character sheet.
- Subtract the base protection values (do not include armor skill bonus) of the items on the other three body parts.
- Divide by 4.
- Add the protection value for the chosen body part.

This takes advantage of the character sheet protection value to "automatically" account for the effects of wounds and armor skill.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply