Working on a hunter CC I've got a very simple piece of code to maintain Improved Steady Shot buff. Code: new Decorator(ret => !Me.HasAura("Improved Steady Shot") || MustRefreshBuff(Me, WoWSpell.FromId(53220)), new Sequence( CreateSpellCheckAndCast("Steady Shot"), CreateSpellCheckAndCast("Steady Shot") ) ) What's happening is it's casting 3 times. I'm assuming it's checking for the buff (which applies after 2 casts, then casting a 3rd due to lag before HB can read the buff. If it was lag, shouldn't I see 4 casts, since it should be casting in pairs?
Yes, one would think it would be done in pairs. I would guess another part of the BT is also casting SteadyShot. You might altering the Sequence so you can see what's going on a little better... Code: new Sequence( CreateSpellCheckAndCast("Steady Shot"), new Action(delegate { Logging.Write("ping for buff refresh 1"); }), CreateSpellCheckAndCast("Steady Shot") new Action(delegate { Logging.Write("ping for buff refresh 2"); }), ) You may also need to delay by the GCD between shots... not sure about this as its been a while since I've played a hunter. cheers, chinajade
Thanks for the reply. Took your suggestion to see what was actually being cast. Code: CreateSpellCheckAndCast("Steady Shot") Contains Code: if (SpellManager.CanCast("Steady Shot")) If the sequence is simply running the second action immediately after the first, instead of creating a "queue" like I assumed, it fails since you're in global cooldown. I was able to sort of fix this by using the following decorator around my priority tree. Code: private Composite CreateCombatBehavior() { return new Decorator(ret => !SpellManager.GlobalCooldown, new PrioritySelector( new Decorator(ret => !Me.HasAura("Improved Steady Shot"), new Action(ret => CreateSpellCheckAndCast("Steady Shot"))) ) ); } I'm not liking the result though. My latency is usually very high and waiting for the global cooldown really slows down the combat. I might be able to record the spell id of my last cast and use that, but I'd like to be able to check if the cast was successful. Is there any way to check if your spells are cast successfully (rather than interrupted etc.)?
sometimes what happens is spells and buffs have "Travel Time" sometimes in that travel time, it can pulse the code 2 or 3 times and the result is it double or triple casting spells. now if you look at Zerfall, the way i got around this was to use a "LastCast" System. where after a spell is casts, it takes the spell id, and puts in in a varible, so when the code runs though again, (!Me.HasAura("Improved Steady Shot") && LastCast != SteadyShot) **SteadyShot would be a variable with the id#** it would cause the code not to cast it again, until your next thing Changes that LastCast Number Variable to something else. using that logic prevents doublecasts.
Singular has a way to check the combat log and tell you what's the name of the last spell you succefully casted, see in sinbular V1 the CombatLog.cs file for how that's done (do not know if is the same way as Zerfall do it (you will need to attach an handlebehaviour to your inizialize function)
Great stuff, thanks guys. I saw your code CodenameG and using LastCast as a global variable works well for tracking the casts so I can match the steady shots in pairs. The next part is check if the steady shot actually landed. The LastCast variable doesn't work if you get interrupted or miss. I'll check Singular for that, Gilderoy, and see what I can glean, thank you.
well now that i think about it, if you use what i said, and have the && there, then it wont matter, it will keep going till it hit, since the mob still wouldnt have the buff.