We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43c8ea0 commit 90f3100Copy full SHA for 90f3100
1 file changed
LuaRules/Gadgets/unit_xp.lua
@@ -63,7 +63,7 @@ function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weap
63
64
local hp, maxHP = spGetUnitHealth(unitID)
65
66
- local percentageDamage = ((hp > 0) and damage or (damage + hp)) / maxHP
+ local percentageDamage = math.max(0, ((hp > 0) and damage or (damage + hp)) / maxHP) -- Units can be damaged further as they die.
67
local targetCost = getCost(unitID, unitDefID) * (GG.att_CostMult[unitID] or 1)
68
local attackerCost = getCost(attackerID, attackerDefID) * (GG.att_CostMult[attackerID] or 1)
69
local oldXp = spGetUnitExperience(attackerID)
0 commit comments