function GetUnitArmor takes unit u returns real
local real hp1 = GetUnitState(u, UNIT_STATE_LIFE)
local real hp2
local real damage
call UnitAddAbility(u, 'A000')
call SetUnitAbilityLevel(u, 'A000', 2)
call UnitRemoveAbility(u, 'A000')
set hp2 = GetUnitState(u, UNIT_STATE_LIFE)
call UnitDamageTarget( u, u, 10.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
set damage = hp2 - GetUnitState(u, UNIT_STATE_LIFE)
call UnitAddAbility(u, 'A000')
call SetUnitAbilityLevel(u, 'A000', 3)
call UnitRemoveAbility(u, 'A000')
call SetUnitState(u, UNIT_STATE_LIFE, hp1)
if damage > 10.0 then
set damage = 10.0 - damage
return (damage-10.0)/(damage*0.06)
endif
return (10.0-damage)/(damage*0.06)
endfunction