
Mithy
By: a guest on
Aug 20th, 2010 | syntax:
Lua | size: 2.10 KB | hits: 58 | expires: Never
--HDemon_Abilities.lua hook adding innate snare protection on Elusiveness
--that matches the player's level of Demon's Speed.
--Adds a callback to each of the six abilities that sets ability levels for easy retrieval
for i=1, 3 do
Ability['HDemonDemonsSpeed0'..i].OnAbilityAdded = function(self, unit)
unit.DemonSpeed = (unit.DemonSpeed or 0) + 1
CalcSlowCap(unit)
end
Ability['HDemonElusiveness0'..i].OnAbilityAdded = function(self, unit)
unit.DemonElusiveness = (unit.DemonElusiveness or 0) + 1
CalcSlowCap(unit)
end
end
--Applies the correct slow cap buff for lowest-common-denominator speed/elusiveness level
CalcSlowCap = function(unit)
if unit.DemonElusiveness and unit.DemonSpeed then
if unit.DemonElusiveness == unit.DemonSpeed then
Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonElusiveness)
elseif unit.DemonElusiveness > unit.DemonSpeed then
Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonSpeed)
else
Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonElusiveness)
end
end
end
--Slow cap buffs for Elusiveness + Speed combinations
BuffBlueprint {
Name = 'HDemonSlowCap1',
DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
Description = "Innate speed unaffected by slows",
BuffType = 'HDEMONSLOWCAP',
EntityCategory = 'HERO',
Debuff = false,
CanBeDispelled = false,
Stacks = 'REPLACE',
Duration = -1,
Affects = {
MoveSlowCap = {Mult = 0.05},
},
}
BuffBlueprint {
Name = 'HDemonSlowCap2',
DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
Description = "Innate speed unaffected by slows",
BuffType = 'HDEMONSLOWCAP',
EntityCategory = 'HERO',
Debuff = false,
CanBeDispelled = false,
Stacks = 'REPLACE',
Duration = -1,
Affects = {
MoveSlowCap = {Mult = 0.10},
},
}
BuffBlueprint {
Name = 'HDemonSlowCap3',
DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
Description = "Innate speed unaffected by slows",
BuffType = 'HDEMONSLOWCAP',
EntityCategory = 'HERO',
Debuff = false,
CanBeDispelled = false,
Stacks = 'REPLACE',
Duration = -1,
Affects = {
MoveSlowCap = {Mult = 0.15},
},
}