What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

How to check for a debuff that stacks?

  • Thread starter Thread starter weischbier
  • Start date Start date
W

weischbier

Guest
Hi,

I'm just wondering on how to check for stackable debuffs.

Example:

Mage => Casts Arcane Blast result 1 debuff Arcane Blast
Casts again result 2 debuff of Arcane Blast an so on, until you got 4 stacks of that debuff.

How can I check for that amount?

I tried it with:

Me.Debuffs.Containsvalue("Arcane Blast", 2)

intellisense says that <TKey,Tvalue> will be checked.

I want him to cast Arcane Missles with procc or Arcane Barrage when the debuffs stacks 2 times.

Greetz

Weischbier
 
Hi again, weischbier!

I believe you want...
(Me.Auras.ContainsKey("Arcane Blast") && (Me.Auras["Arcane Blast"].StackCount == 2)​

cheers,
chinajade
 
Last edited:
Hi again, weischbier!

I believe you want...
(Me.Auras.ContainsKey("Arcane Blast") && (Me.Auras["Arcane Blast"].StackCount == 2)​

cheers,
chinajade

Thanks again!

I'm really thankful for your help!!!!!

Greetz

Weischbier
 
(Me.Auras["Arcane Blast"].StackCount == 2) is enough, returns 0 if not found
 
Thacai said:
(Me.Auras["Arcane Blast"].StackCount == 2) is enough, returns 0 if not found

Hi, Thacai,

I'd wish it were that simple. :D And... it may be, if you know something I don't.

Me.Auras["Arcane Blast"] will throw a KeyNotFoundException if the buff is not present in the Me.Auras dictionary. I can find no documentation that indicates the buffs are always present in the Auras dictionary even if they are not 'active'.

For the example we gave...
The attempt to dereference StackCount will not occur if ContainsKey() returns false. Such 'short circuiting' is a necessary property of the && operator, and what makes the example shown 'safe'.

So, the possible alternatives for writing safe code are:
1) Find some documentation that guarantees the key will always be present in the Auras dictionary, or
2) Use a technique involving TryGetValue() instead, or
3) Write additional code to handle a KeyNotFoundException, or
4) Use the technique shown

A naked lookup is a crash waiting to happen.

cheers,
chinajade
 
Last edited:
depends how the property stackcount handles null's, but i tried it while being affl to check for a demo buff, and returned 0
 
Me.Auras["Molten Core"].StackCount > 0 was the code, no check prior if the buff exists
 
if your going for a mage, you need to do Me.ActiveAuras["Fingers of Frost"].StackCount. Me.Auras does not contain procs.
 
Back
Top