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

[Trigger] Trying to detect negative armor

Status
Not open for further replies.
Does anyone know the correct equation to reverse -20 armor so 250 damage is 250? The damage type is 100% and the armor constant is 0.06.

[trigger=]
OnDamage
Events
Game - PDD_damageEventTrigger becomes Equal to 1.00
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PDD_damageType Equal to PDD_PHYSICAL
Then - Actions
-------- Actions for PHYSICAL damage --------
Set PDD_amount = (PDD_amount / (2.00 - (Power(0.94, -20.00))))
-------- End of Actions for PHYISCAL damage --------
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PDD_damageType Equal to PDD_SPELL
Then - Actions
-------- Actions for SPELL damage --------
-------- End of Actions for SPELL damage --------
Else - Actions
-------- Actions for CODE damage --------
-------- End of Actions for CODE damage --------
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
JASS:
function calculateArmorFactor takes real armor returns real
    if armor >= 0 then
        return 1 - (0.06*armor / (1 + 0.06*armor))
    endif
    return 2-Pow(0.94, -armor)
endfunction
(source: http://classic.battle.net/war3/pdf/armorattackdefense.pdf)

Following that equation, you just have to divide your resulting value by the returned value from that.
(I know WC3 armors are integers, but that doesnt mean that you dont see the use of having it as reals.)

I also do not give a damn about the armor limit :D

However, you do have to get the armor value first to apply this function.
 
Status
Not open for further replies.
Top