• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Armor Formula

Status
Not open for further replies.
Level 6
Joined
Nov 3, 2005
Messages
103
Trying to figure out how to pull off the armor types from Starcraft, when a target's armor is subtracted from a unit's attack damage to get the total damage, and also creating attack types that ignore armor.

Do I need to use a damage detection system for this or is there an easier way?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Hardened skin reduces physical damage taken by set amount (you can also give it a chance for this reduction effect to proc) to a minimum damage.
E.g. you set the amount to 20 and min damage to 10.
If unit takes 60 damage, this ability will reduce the damage to 40 (60-20 = 40).
If unit takes 15 damage, this ability will reduce damage to 10 (15 - 20 = -5, which is below min damage - below 10, so the damage is set to 10)
 
Level 12
Joined
Nov 3, 2013
Messages
989
In gameplay constants remove the damage reduction gain from armor and then use hardened skin and make it block as much damage as the unit's armor.

When someone researches armor upgrade the level of hardened skin would increase accordingly by either having techtree requirement or make the upgrade itself have the ability level bonus component.
 
Oh I think I get it, so just set each unit's armor to 0, then use harden skin to set the armor manually. Kind of wish the armor was visible though.

You just need a dummy system for that, you can use item abilities or item abilities with a system to easily add stats instead of a thousand level ability or you can make a thousand level research which does it nicely too without the green/red colors.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I think you can have negative block amount on hardened skin?

What I mean is the usual armor formula. If you want to display armor at all, then you'll need to use the normal armor for this and thus, it's likely that disabling it is also necessary.

If you have any damage detection system, then this snippet will undo the damage increase. You'll still need to somehow know how much armor the unit has though.
JASS:
if armor < 0 then//The negative armor formula by blizzard can not be entirely disabled, so we have to undo it. 
    set amount = amount / (2-Pow(0.94,I2R(-armor)))
endif
 
Level 12
Joined
Nov 3, 2013
Messages
989
1 - 0.94 ^ (-armor) is the default negative formula, yeah? Doesn't 0.94 represent (1 - DR constant) If the constant is 0 then the multiplier should be 1 all the time, or am I missing something?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
1 - 0.94 ^ (-armor) is the default negative formula, yeah? Doesn't 0.94 represent (1 - DR constant) If the constant is 0 then the multiplier should be 1 all the time, or am I missing something?

It should be like this, but isn't. At first I also assumed so, but while making my map I set damage resistance to 0 and before I had implemented my own damage resistance I already saw that damage was increasing if armor was negative. This made me investigate. I did some calculations and they showed that the negative armor formula doesn't use this constant.

The calculation that I posted in my previous post is reversed, so it makes the damage increase not apply at all.
 
Status
Not open for further replies.
Top