Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions LuaRules/Gadgets/unit_paralysis_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,19 @@ function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, rawDamage, paralyzer
local health, maxHealth, paralyzeDamage = spGetUnitHealth(unitID)
if health and maxHealth and health > 0 then -- taking no chances.
if GG.Awards and GG.Awards.AddAwardPoints then
local cost_emped = (rawDamage / maxHealth) * GetUnitCost(unitID)
GG.Awards.AddAwardPoints('emp', attackerTeam, cost_emped)
local maxStunFraction = paraTime[weaponDefID] / DECAY_SECONDS
local maxParaHealth = maxHealth * (1 + maxStunFraction)
local remainingParaHealth = maxParaHealth - paralyzeDamage

-- in theory overstun mult can modify things further,
-- but we don't care for similar reasons why the
-- mult from low health is ignored as well

if remainingParaHealth > 0 then -- smaller than 0 if already stunned by a stronger weapon
local cappedDamage = math.min(rawDamage, remainingParaHealth)
local cost_emped = (cappedDamage / maxHealth) * GetUnitCost(unitID)
GG.Awards.AddAwardPoints('emp', attackerTeam, cost_emped)
end
end
local damage = GetStunDamage(weaponDefID, rawDamage, health, maxHealth, paralyzeDamage)
if overstunTime[weaponDefID] > 0 then
Expand Down