• 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.

How to change Armor Damage Reduction Multiplier for positive and negative armor?

Level 5
Joined
May 10, 2024
Messages
57
Hi. I want to change the Armor Reduction formula. I know about the constant 0.06 which can be changed in Gameplay Constants. But it works only for positive armor. If I change that constant to 0 then damage will not be reduced and it is splendid. However damage will be increased by negative armor value (Orb Of Corruption for instance). Which is bad. How to prevent engine from doing that?

I event tried to modify value through damage event, but damage decrease formula changes after -40 armor and cannot be restored with formula 2-0.94^(-armor). At -100 armor it 20% inaccurate.
 

Attachments

  • 1.JPG
    1.JPG
    30.4 KB · Views: 12
Level 45
Joined
Feb 27, 2007
Messages
5,578
There must be something I'm missing about what you're describing here? Sounds to me like you're saying you want to have armor but you also want that armor not to contribute to damage reduction (by modifying the formula). So why have armor at all then if it does nothing? Alternatively you could use a periodic trigger to lock all relevant units' armor at 0 or 1 or 10 or whatever number makes the math easiest for you.
 
Level 5
Joined
May 10, 2024
Messages
57
1. How to change Armor Damage Reduction Multiplier for positive and negative armor? Armor damage reduction multiplier in gameplay constants only works with positive armor values.
2. If it is not possible to change multiplier for positive and negative armor formula then it should be possible to change the formula with some code, right? If I can restore original damage(not reduced/increased) from an attack then I can do whatever I want with the formula, right? I used EVENT_PLAYER_UNIT_DAMAGED event and figured out that I cannot change the formula for negative armor because I can't restore incoming damage from an attack.
JASS:
local unit damageSource = GetEventDamageSource()
local unit damageTarget = GetTriggerUnit()
local real targetArmor = BlzGetUnitArmor(damageTarget)
local real incomingDamage = GetEventDamage() // it is already reduced/increased by armor value and type
local real finalDamage = 0

if (targetArmor > 0) then
    // restore original damage reduced by positive armor
    set incomingDamage = incomingDamage / (1 - (0.06 * targetArmor / (1 + 0.06 * targetArmor)) )
else
    // restore original damage increased by negative 
    set incomingDamage = incomingDamage / (2 - Pow(0.94, RAbsBJ(targetArmor)))
    // when armor +5 damage will be reduced by 23%
    // when armor -5 damage will be increased by 27%
    // It is clear that for negative armor constant is not 0.06
    // I tried to calculate constant which is used by the engine. If I use calculated constant which is work for -5 armor it will not work for -100 armor (~20% inaccurate)
    // I suppose these formulas should use the same constant and works the same way for positive and negative values
endif
// at this point I can do whatever I want with the formula because I know the incoming damage and target armor
set finalDamage = incomingDamage; 
call BlzSetEventDamage(finalDamage)

Both solutions works perfectly fine with positive armor and I have no idea what to do with negative armor.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
If you are on newer patches, you can change damage dealt to be true damage. In that case it will ignore armor (negative and positive) completely:
  • About To Take Damage
    • Events
      • Unit - A unit About to take damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Event Response - Set Damage Type of Unit Damaged Event to Universal
      • Event Response - Set Attack Type of Unit Damaged Event to Spells
 
Top