Created
July 31, 2016 18:49
-
-
Save bryancusatis/5926d9902ec6c512f0dcba213ee4e267 to your computer and use it in GitHub Desktop.
CalculateLast5Hits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() | |
-- Main function to calc FR healing | |
local now = time() | |
local heal_value = 0 | |
-- Versa | |
local VersatilityBonus = GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE) + GetVersatilityBonus(CR_VERSATILITY_DAMAGE_DONE) | |
-- Lazy: | |
VersatilityBonus = 1 + (VersatilityBonus/100) | |
-- Mastery | |
local MyMastery = GetMastery() | |
-- Lazy | |
MyMastery = 1+(MyMastery/100) | |
-- Heal modifiers | |
function healModifier() | |
-- Iterate through buff/debuff table | |
for aura, modifier in pairs(WA_HEAL_BUFF_DEBUFF_TABLE) do | |
if UnitAura("player",aura)then | |
return modifier | |
end | |
end | |
end | |
local currentHealModifier = healModifier() | |
currentHealModifier = currentHealModifier or 1 | |
-- Min healing, 5% of maxhealth: | |
local MinHeal = (UnitHealthMax("player")/100)*5 | |
MinHeal = ((MinHeal * VersatilityBonus * WA_WILDFLESH_MULTIPLIER) * MyMastery)* currentHealModifier | |
-- Iterate through | |
for key, value in pairs(WA_TABLE) do | |
-- If the damage occured within the last 5 seconds, | |
-- assign it to the potential heal value. | |
-- Yep, two of the same type of iteration. | |
-- Suck it up, this is a test :) | |
if key > now-5 then | |
heal_value = heal_value + value or 0 | |
else | |
-- Otherwise, remove from table. | |
-- Else we end up with a preeeetty big table, | |
-- very fast :D | |
WA_TABLE[key] = nil | |
end | |
end | |
-- Heal is only half of damage taken, plus Versatility: | |
heal_value = (((heal_value/2) * VersatilityBonus * WA_WILDFLESH_MULTIPLIER) * MyMastery) * currentHealModifier | |
-- Only output heal value if it's greater than MinHeal: | |
if heal_value < MinHeal then | |
heal_value = MinHeal | |
end | |
-- Optional for Timewalking/Personal preference: Set max FR | |
-- to (UnitHealthMax("player")) * 1.25 | |
local fr_max = UnitHealthMax("player") * 1.25 | |
return math.floor(heal_value) or 0,fr_max,true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment