diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 8c3387f04f..3260f63c92 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -642,10 +642,14 @@ local function FindBestMatchData(time, id, triggernum, triggerInfo, matchedUnits for index, auraData in pairs(unitData) do local remCheck = true if triggerInfo.remainingFunc and auraData.expirationTime then - local modRate = auraData.modRate or 1 - local remaining = (auraData.expirationTime - time) / modRate - remCheck = triggerInfo.remainingFunc(remaining) - nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + if auraData.duration == 0 then + remCheck = false + else + local modRate = auraData.modRate or 1 + local remaining = (auraData.expirationTime - time) / modRate + remCheck = triggerInfo.remainingFunc(remaining) + nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + end end if remCheck then @@ -679,10 +683,14 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit) for index, auraData in pairs(matchDataByTrigger[id][triggernum][unit]) do local remCheck = true if triggerInfo.remainingFunc and auraData.expirationTime then - local modRate = auraData.modRate or 1 - local remaining = (auraData.expirationTime - time) / modRate - remCheck = triggerInfo.remainingFunc(remaining) - nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + if auraData.expirationTime == 0 then + remCheck = false + else + local modRate = auraData.modRate or 1 + local remaining = (auraData.expirationTime - time) / modRate + remCheck = triggerInfo.remainingFunc(remaining) + nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + end end if remCheck then @@ -1578,10 +1586,14 @@ local function UpdateTriggerState(time, id, triggernum) for index, auraData in pairs(unitData) do local remCheck = true if triggerInfo.remainingFunc and auraData.expirationTime then - local modRate = auraData.modRate or 1 - local remaining = (auraData.expirationTime - time) / modRate - remCheck = triggerInfo.remainingFunc(remaining) - nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + if auraData.expirationTime == 0 then + remCheck = false + else + local modRate = auraData.modRate or 1 + local remaining = (auraData.expirationTime - time) / modRate + remCheck = triggerInfo.remainingFunc(remaining) + nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck) + end end if remCheck then diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index 1c531611d4..5b435da74e 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -335,9 +335,9 @@ local function CreateTestForCondition(data, input, allConditionsTemplate, usedSt or "" if (op == "==") then - check = stateCheck .. stateVariableCheck .. "abs((" .. remainingTime .. "-" .. value .. ")" .. divideModRate .. ") < 0.05" + check = stateCheck .. stateVariableCheck .. varString .. "~= 0 and " .. "abs((" .. remainingTime .. "-" .. value .. ")" .. divideModRate .. ") < 0.05" else - check = stateCheck .. stateVariableCheck .. remainingTime .. divideModRate .. op .. value + check = stateCheck .. stateVariableCheck .. varString .. "~= 0 and " .. remainingTime .. divideModRate .. op .. value end elseif (cType == "elapsedTimer" and value and op) then if (op == "==") then