• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Math formula question

Status
Not open for further replies.
Level 12
Joined
Jan 2, 2016
Messages
973
Hey, I am having trouble with finding one formula... (It is related to warcraft), perhaps someone will be able to help me find it? :p

I have this sequence (f(x) = y):
f(0) = 1
f(1) = 0.943
f(2) = 0.896
f(3) = 0.855
f(4) = 0.820
f(5) = 0.790
f(6) = 0.763
f(7) = 0.740
f(8) = 0.719
f(9) = 0.701
f(10) = 0.684
f(11) = 0.669
f(12) = 0.656
f(13) = 0.644
f(14) = 0.633
f(15) = 0.623
f(16) = 0.614
f(17) = 0.606
f(18) = 0.598
f(19) = 0.591
f(20) = 0.585

A hint: the number '0.06' may be helpful (or at least I think it's used somewhere in the formula).
 
Level 12
Joined
Jan 2, 2016
Messages
973
That gives me:
0,943
0,893
0,847
0,806
0,769
0,735
0,704
0,676
0,649
0,625
0,602
0,581
0,562
0,543
0,526
0,510
0,495
0,481
0,467
0,455

So that's not really it xP

And well, to be more specific - I need the NEGATIVE armor formula. They seem to be different...
20 armor reduces 54.5% damage, while -20 armor increases the damage dealt to the unit by 71%
in the original post x(es) should be -1, -2, -3, etc instead of 1, 2, 3... But if we find the formula for 1, 2, 3 - it's like we've found the formula for -1, -2, -3, so I didn't bother with the "-".

EDIT:
Okay, I experimented for a while and got a "close enough" formula: (1-(0.06*A))/(1 + (0.06*(A^1.15192)))
This formula has 98.7% accuracy, but still isn't the exact formula :p (And let me not mention that I got it via experiments, instead of calculations)
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
Hmm I think it should work for the negative numbers, too. Where are you pulling these numbers in the original post?

EDIT:
WAIT!! Found something. I do remember hearing that negative armour is hardcoded.
http://dev.dota2.com/showthread.php?t=46896
1 - 0.94 ^ (-armor)

Uncertain if it is accurate, but might be it.

EDIT2:
Did some number crunching. Doesn't seem to match your initial numbers. :(
 
Level 12
Joined
Jan 2, 2016
Messages
973
Well, I damage a unit for 50000 damage, and then I get the numbers by dividing 50000 by the damage the unit has actually taken.
so if I deal 50000 as base damage, and the unit takes 53022 damage (it has -1 armor) - I get 0.943 as value :p
If I deal 50000 damage to a unit with -20 armor, it will take 85470,08547 damage, and the result is 0.585.
And furthermore, when you divide 1 by 0.585, you get 0.709, which is really close to 71%, and when you put your mouse over a unit's armor (when it has -20 armor) - it shows -71%
 
Level 12
Joined
Jan 2, 2016
Messages
973
Alright, I found the negative armor formula :)
It's (1 - 0.06)^|Armor| - 1 :p
However, the formula I was looking for is:
y=1/(2 - (1 - 0.06)^x)

EDIT: Say, can I use logarithms in the WE?

EDIT 2: Okay, I found a Logarithm library :p
Updated my Armor Altering System, and now it's working with negative armor values too ^_^
The armor formula for negative values (when you know the proportion between damage dealt and damage taken) is:
armor = - Ln(2-(1/armor_rating))/Ln(1-ARMOR_COEFICIENT)
 
Last edited:
Level 4
Joined
Feb 12, 2016
Messages
71
You should probably divide actual damage taken through damage dealt, I guess.

See, if you deal 100 damage and the unit took 120 damage, you would divide 120/100, which is 0.833 - not really sure what you deduce from this?
Opposed to when you divide 120/100, you get 1.2, which would read as the unit has -20% armor.

But I might miss the logic here, feel free to educate me :p
 
Level 12
Joined
May 22, 2015
Messages
1,051
You should probably divide actual damage taken through damage dealt, I guess.

See, if you deal 100 damage and the unit took 120 damage, you would divide 120/100, which is 0.833 - not really sure what you deduce from this?
Opposed to when you divide 120/100, you get 1.2, which would read as the unit has -20% armor.

But I might miss the logic here, feel free to educate me :p

Just a small mistake I think. In the first one you did 120 / 100 but probably was meant to be 100 / 120.

Doing 100 / 120 to 0.8333 then doing 1 / 0.833e is the same as just doing 120 / 100.

0.8333 in this case is the effective health factor of the unit. If you multiply their max health by this amount, that is their total effective health against physical damage with that specific armour value.
 
Level 12
Joined
Jan 2, 2016
Messages
973
Well, it's pretty much the same thing.
If I do:
armor_rating = Base damage / Damage dealt, and then I get the Armor by doing (armor_rating - 1)/ARMOR_COEFICIENT
or if I do:
armor_rating = Damage dealt / Base damage, and then I get the Armor by doing ((1/armor_rating) - 1)/ARMOR_COEFICIENT

I just find it better to write it the 1-st way :p

And... I'm really happy how my Armor altering library turned out to be ^_^
 
Status
Not open for further replies.
Top