Helper Function: auraDuration( aura, duration, unit ) #4412
+41
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another helper function for changing duration of buffs/debuffs, whether extended (very common) or reduced (like warlock arts or devastation evoker fire breath)
Features
removeBuff()
if extension brings an aura to 0 or less (it checks.remains
)1
: Aura was modified successfully (it was up, and the extension was applied, and the aura is not removed because of it)aura.remains
as it would always be a positive value? Would pass all the same test cases as1
, but maybe add additional functionality?0
: No operations were done, most likely due to aura not being up or the function call supplied a0
in the duration parameter-1
: Aura was negatively extended, and will be removed due to itbuff.buff_name
, we should stick with passing the aura name as a stringapplyBuff()
andaddStack()
buffDuration( aura, duration )
anddebuffDuration( aura, duration, unit )
Unit
parameter is optional, will default to"target"
. It is not considered when checking buffs.Fully Commented Code
Real Use Cases
Marksmanship Hunter
Devastation Evoker
This would also work due to
"target"
defaultShadow Priest
Havoc Demon Hunter
(yes I know the actual code here has changed since I wrote the example, hopefully it still illustrates)