slimabob

inspire_lua.lua

Sep 5th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. inspire_lua = class({})
  2.  
  3. function ApplyInspire(keys)
  4. print("Applying Inspire.");
  5.  
  6. local caster = keys.caster
  7. local ability = keys.ability
  8. local target = keys.target
  9. local stack_modifier = keys.stack_modifier
  10. local stack_count = target:GetModifierStackCount(stack_modifier, ability)
  11.  
  12. ability:ApplyDataDrivenModifier(caster, target, stack_modifier, {})
  13. target:SetModifierStackCount(stack_modifier, ability, stack_count + 1)
  14. print(stack_count + 1)
  15.  
  16. end
  17.  
  18. function RemoveInspire(keys)
  19. local caster = keys.caster
  20. local target = keys.target
  21. local ability = keys.ability
  22. local stack_modifier = keys.stack_modifier
  23. local stack_count = target:GetModifierStackCount(stack_modifier, ability)
  24.  
  25. if stack_count <= 1 then
  26. target:RemoveModifierByName(stack_modifier)
  27. else
  28. target:SetModifierStackCount(stack_modifier, ability, stack_count - 1)
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment