function Spawn:UpgradeUnitStats(unit, multiplier, armor)
if not unit:IsAlive() then
return
end
Timers:CreateTimer(0.02, function()
local armor = armor or 200
local new_armor = unit:GetPhysicalArmorBaseValue() * multiplier
local max_hp = unit:GetMaxHealth() * multiplier
local min_dmg = unit:GetBaseDamageMin() * multiplier
local max_dmg = unit:GetBaseDamageMax() * multiplier
if max_hp <= 1 then
max_hp = 1
elseif max_hp >= 2000000000 then
max_hp = 2000000000
end
unit:SetBaseMaxHealth(max_hp)
unit:SetMaxHealth(max_hp)
unit:SetHealth(max_hp)
if new_armor > armor then
new_armor = armor
end
unit:SetPhysicalArmorBaseValue(new_armor)
if min_dmg >= 2000000000 then
min_dmg = 2000000000
end
unit:SetBaseDamageMin(min_dmg)
if max_dmg >= 2000000000 then
max_dmg = 2000000000
end
unit:SetBaseDamageMax(max_dmg)
end)
end