Advertisement
lutzmor

Insanity gain

Dec 15th, 2020 (edited)
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. function()
  2. local insanityGain = 0;
  3. local currentInsanity = UnitPower("player", SPELL_POWER_INSANITY, forceUpdate);
  4. local deathAndMadness = nil;
  5. local maxInsanity = UnitPowerMax("player", SPELL_POWER_INSANITY);
  6. local currentSpell = UnitCastingInfo('player');
  7. local specGroup = GetActiveSpecGroup();
  8. local isFotMSelected = select(4, GetTalentInfo(1, 1, specGroup));
  9. local S2MName = select(2, GetTalentInfo(7, 3, specGroup));
  10. local DaMName = select(2, GetTalentInfo(1, 2, specGroup));
  11. local isS2MActive = select(11, WA_GetUnitBuff("player", S2MName));
  12. local isDaMActive = select(11, WA_GetUnitBuff("player", DaMName));
  13.  
  14. if currentSpell == nil then
  15. currentSpell = UnitChannelInfo('player');
  16. end
  17.  
  18. if currentSpell == nil then
  19. for i=1,40 do
  20. local name, icon, _, _, _, etime = UnitBuff("player",i)
  21. if name == "Death and Madness" then
  22. currentSpell = "Death and Madness";
  23. end
  24. end
  25. end
  26.  
  27. if currentSpell == nil then
  28. insanityGain = 0;
  29. return 0,0,0,0;
  30. end
  31.  
  32. local MB = GetSpellInfo(8092); -- Mind Blast
  33. local VT = GetSpellInfo(34914); -- Vampiric Touch
  34. local VOT = GetSpellInfo(263165); -- Void Torrent
  35. local MF = GetSpellInfo(15407); -- Mind Flay
  36.  
  37. if currentSpell == MB then --Mind Blast
  38. if isFotMSelected then
  39. insanityGain = (8) * 1.2;
  40. else
  41. insanityGain = 8;
  42. end
  43. elseif currentSpell == VOT then --Void Torrent
  44. insanityGain = 15;
  45. elseif currentSpell == MF then --Mind Flay
  46. if isFotMSelected then
  47. insanityGain = (3) * 1.2;
  48. else
  49. insanityGain = 3;
  50. end
  51. elseif currentSpell == VT then --Vampric Touch
  52. insanityGain = 5;
  53. elseif currentSpell == "Death and Madness" then
  54. if isDaMActive then
  55. insanityGain = 10;
  56. else
  57. insanityGain = 0;
  58. end
  59. else
  60. insanityGain = 0;
  61. return 0,0,0,0;
  62. end
  63.  
  64. if isS2MActive then
  65. insanityGain = insanityGain * 2.0;
  66. end
  67.  
  68. local x = (currentInsanity+insanityGain);
  69. local y = math.modf(x);
  70. return y,maxInsanity,0,0;
  71.  
  72. end
  73.  
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement