Search the database
Search forum topics
Search members
Search for trades
diablo2.io is supported by ads
diablo2.io is supported by ads
4 replies   6809 views
2

Description

Hello everyone.

How is defense calculated in the game?

For example, the
Archon Plate
, with a max 524 base defense, has 905 defense when ethereal and superior with 15% enhanced defense (in the best case). The way I would calculate defense for this particular armor:

(524 * 1.5) * 1.15 = 786 * 1.5 = 903.9

How does this become 905?
5

Can be used to make Runewords:

7
Hello everyone.

How is defense calculated in the game?

For example, the
Archon Plate
, with a max 524 base defense, has 905 defense when ethereal and superior with 15% enhanced defense (in the best case). The way I would calculate defense for this particular armor:

(524 * 1.5) * 1.15 = 786 * 1.5 = 903.9

How does this become 905?
Answeredby 33windowlicker2 years agoGo to post
Assuming the truncate function is:

TRUNCATE(number; [num_digits])

The TRUNCATE function syntax has the following arguments:

◾ Number Required. The number you want to truncate.

◾ Num_digits A number specifying the precision of the truncation. The default value for num_digits is 0 (zero).


Let us say the correct equation is:

= TRUNCATE(TRUNCATE((MAX_BASE_DEFENSE+1)*1,15;0)*1,5;0)

How can I mark this thread as solved?
7
I assume the calculations are done separately with a rounding after step one (and also reverse order).

524*1.15=602.6 --> round to 603

603*1.5=904.5 --> round to 905

Only an assuption though, no idea if that's what's going on.

For trades: PrincipalO#2775
For DClone/Ubers: ForrestGrump#2731
7
User avatar

Schnorki 3024Moderator

PC
Simply but, D2 doesn't round. It truncates. And that is done not only at the end but at every step of the (integer) calculation. Additionally, enhanced defense (including superior) results in a base defense of item max + 1. So not 524 in this case but 525.

As such, what you get here is:
525 * 150 / 100 = 787
787 * 115 / 100 = 905

You can confirm each of those pieces by cross-checking specific items that happen to make it obvious. Take an 8% superior
Eth
.
Sacred Armor
for example. You actually don't have to worry about any rounding vs. truncating vs. ... here as everything happens to line up:
600 base defense * 1.5 ethereal = 900 * 1.08 superior = 972

And yet, the actual defense for this one is 973. Why? Because once you add the +1 for ED, you instead get:
601 * 1.5 * 1.08 = 973.62
So that shows you that not only do you get the +1 because you'd otherwise never go past 972 but you also truncate/floor along the way (as opposed to round/ceil the final number) as you'd otherwise end up at 974 and not 973. (Yes, there are alternative calculation rules that would lead to 973 with the +1 but there's other items to prove/disprove those exactly - this is mainly an example for the +1 concept)
(Thanks to the random trade listing that happened to have an 8ed superior
Eth
sacred screenshot)


PS: Do note that the +1 to base defense only applies if the item is initially rolled with ED. Sadly, when you upgrade such an item (e.g. various uniques) in the cube, that rule no longer applies and the upgraded item is rolled with any random normally possible defense value of the new version, despite still having ED as a modifier.
7
OP
Schnorki wrote: 2 years ago
Simply but, D2 doesn't round. It truncates. And that is done not only at the end but at every step of the (integer) calculation. Additionally, enhanced defense (including superior) results in a base defense of item max + 1. So not 524 in this case but 525.

As such, what you get here is:
525 * 150 / 100 = 787
787 * 115 / 100 = 905

You can confirm each of those pieces by cross-checking specific items that happen to make it obvious. Take an 8% superior
Eth
.
Sacred Armor
for example. You actually don't have to worry about any rounding vs. truncating vs. ... here as everything happens to line up:
600 base defense * 1.5 ethereal = 900 * 1.08 superior = 972

And yet, the actual defense for this one is 973. Why? Because once you add the +1 for ED, you instead get:
601 * 1.5 * 1.08 = 973.62
So that shows you that not only do you get the +1 because you'd otherwise never go past 972 but you also truncate/floor along the way (as opposed to round/ceil the final number) as you'd otherwise end up at 974 and not 973. (Yes, there are alternative calculation rules that would lead to 973 with the +1 but there's other items to prove/disprove those exactly - this is mainly an example for the +1 concept)

image.png

(Thanks to the random trade listing that happened to have an 8ed superior
Eth
sacred screenshot)
Take for example a
Great Hauberk
: 501 Defense in a perfect roll, which should have 865 max defense when ethereal and superior.

501*1.15 = 576.15;
truncate(576.15) + 1 = 576 + 1= 577;
577*1.5 = 865.5;
truncate(865.5) =865;

This seems to be ok
7
OP
Assuming the truncate function is:

TRUNCATE(number; [num_digits])

The TRUNCATE function syntax has the following arguments:

◾ Number Required. The number you want to truncate.

◾ Num_digits A number specifying the precision of the truncation. The default value for num_digits is 0 (zero).


Let us say the correct equation is:

= TRUNCATE(TRUNCATE((MAX_BASE_DEFENSE+1)*1,15;0)*1,5;0)

How can I mark this thread as solved?
This post was marked as the best answer.
9

Advertisment

Hide ads
999

Greetings stranger!

You don't appear to be logged in...

No matches
diablo2.io is supported by ads
 

 

 

 

Value:
Hide ads forever by supporting the site with a donation.

Greetings adblocker...

Warriv asks that you consider disabling your adblocker when using diablo2.io

Ad revenue helps keep the servers going and supports me, the site's creator :)

A one-time donation hides all ads, forever:
Make a donation