Want more features on Pastebin? Sign Up, it's FREE!
Guest

Mithy

By: a guest on Aug 20th, 2010  |  syntax: Lua  |  size: 2.10 KB  |  views: 61  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --HDemon_Abilities.lua hook adding innate snare protection on Elusiveness
  2. --that matches the player's level of Demon's Speed.
  3.  
  4. --Adds a callback to each of the six abilities that sets ability levels for easy retrieval
  5. for i=1, 3 do
  6.         Ability['HDemonDemonsSpeed0'..i].OnAbilityAdded = function(self, unit)
  7.                 unit.DemonSpeed = (unit.DemonSpeed or 0) + 1
  8.                 CalcSlowCap(unit)
  9.         end
  10.         Ability['HDemonElusiveness0'..i].OnAbilityAdded = function(self, unit)
  11.                 unit.DemonElusiveness = (unit.DemonElusiveness or 0) + 1
  12.                 CalcSlowCap(unit)
  13.         end
  14. end
  15.  
  16. --Applies the correct slow cap buff for lowest-common-denominator speed/elusiveness level
  17. CalcSlowCap = function(unit)
  18.         if unit.DemonElusiveness and unit.DemonSpeed then
  19.                 if unit.DemonElusiveness == unit.DemonSpeed then
  20.                         Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonElusiveness)
  21.                 elseif unit.DemonElusiveness > unit.DemonSpeed then
  22.                         Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonSpeed)
  23.                 else
  24.                         Buff.ApplyBuff(unit, 'HDemonSlowCap'..unit.DemonElusiveness)
  25.                 end
  26.         end
  27. end
  28.  
  29. --Slow cap buffs for Elusiveness + Speed combinations
  30. BuffBlueprint {
  31.         Name = 'HDemonSlowCap1',
  32.         DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
  33.         Description = "Innate speed unaffected by slows",
  34.         BuffType = 'HDEMONSLOWCAP',
  35.         EntityCategory = 'HERO',
  36.         Debuff = false,
  37.         CanBeDispelled = false,
  38.         Stacks = 'REPLACE',
  39.         Duration = -1,
  40.         Affects = {
  41.                 MoveSlowCap = {Mult = 0.05},
  42.         },
  43. }
  44. BuffBlueprint {
  45.         Name = 'HDemonSlowCap2',
  46.         DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
  47.         Description = "Innate speed unaffected by slows",
  48.         BuffType = 'HDEMONSLOWCAP',
  49.         EntityCategory = 'HERO',
  50.         Debuff = false,
  51.         CanBeDispelled = false,
  52.         Stacks = 'REPLACE',
  53.         Duration = -1,
  54.         Affects = {
  55.                 MoveSlowCap = {Mult = 0.10},
  56.         },
  57. }
  58. BuffBlueprint {
  59.         Name = 'HDemonSlowCap3',
  60.         DisplayName = '<LOC ABILITY_DA_0032>Assassin\'s Speed',
  61.         Description = "Innate speed unaffected by slows",
  62.         BuffType = 'HDEMONSLOWCAP',
  63.         EntityCategory = 'HERO',
  64.         Debuff = false,
  65.         CanBeDispelled = false,
  66.         Stacks = 'REPLACE',
  67.         Duration = -1,
  68.         Affects = {
  69.                 MoveSlowCap = {Mult = 0.15},
  70.         },
  71. }
clone this paste RAW Paste Data