Channel.lua 775 B

123456789101112131415161718192021222324
  1. --[[
  2. Script Name : Spells/Mage/Enchanter/Coercer/Channel.lua
  3. Script Author : neatz09
  4. Script Date : 2019.10.16 10:10:48
  5. Script Purpose :
  6. :
  7. --]]
  8. -- Distributes the group members' total combined power evenly among all the members
  9. --need to loop the group memeber and add up all the power then divide by # of group members and loop over them again and set them
  10. function cast(Caster, Target)
  11. local group = GetGroup(Caster)
  12. local totalpwr = 0
  13. local members = table.getn(group)
  14. if group ~= nil then
  15. for k, v in ipairs(group) do
  16. totalpwr = totalpwr + GetPower(v)
  17. end
  18. for k, v in ipairs(group) do
  19. SetPower(v, totalpwr / members)
  20. end
  21. end
  22. end