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

PrioritySelector issues

wownerds

New Member
Joined
Feb 15, 2011
Messages
1,385
Reaction score
30
Hey there,

while coding my CC, I came across a somehow strange bug.

The PrioritySelector has a total of about 120 children and looks like this:

Code:
 return new PrioritySelector(
            new Decorator(ret => !StyxWoW.Me.Combat || StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget.Dead || !StyxWoW.Me.CurrentTarget.Attackable || StyxWoW.Me.CurrentTarget.Distance > DunatanksSettings.Instance.AttackDistance || StyxWoW.Me.Mounted,
                new ActionIdle()),

                new Decorator(ret => Me.HealthPercent <= DunatanksSettings.Instance.furyHealthstonePercent && HaveHealthStone() && HealthStoneNotCooldown(),
                new Action(ret => UseHealthStone())),
                CreateSpellCheckAndCast("Colossus Smash", ret => DunatanksSettings.Instance.useSpecc == 0 && !Me.CurrentTarget.HasAura("Colossus Smash") && detectAdds().Count == 1),
[...]
                CreateSpellCheckAndCast("Heroic Strike", ret => DunatanksSettings.Instance.useSpecc == 1 && DunatanksSettings.Instance.FurySpecc == 0 && Me.CurrentRage > 80 && detectAdds().Count == 1),
[...]
                CreateSpellCheckAndCast("Revenge", ret => DunatanksSettings.Instance.useSpecc == 2 && detectAdds().Count > 1 && detectAdds().Count < 6)
);

The problem I encountered is the following:

If DunatanksSettings.Instance.useSpecc is 0, the CC performs the actions as intended, but if it switches to 1 or 2, it just does nothing.

Any suggestions?

thanks in advance
 
Hey there,

while coding my CC, I came across a somehow strange bug.

The PrioritySelector has a total of about 120 children and looks like this:

Code:
 return new PrioritySelector(
            new Decorator(ret => !StyxWoW.Me.Combat || StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget.Dead || !StyxWoW.Me.CurrentTarget.Attackable || StyxWoW.Me.CurrentTarget.Distance > DunatanksSettings.Instance.AttackDistance || StyxWoW.Me.Mounted,
                new ActionIdle()),

                new Decorator(ret => Me.HealthPercent <= DunatanksSettings.Instance.furyHealthstonePercent && HaveHealthStone() && HealthStoneNotCooldown(),
                new Action(ret => UseHealthStone())),
                CreateSpellCheckAndCast("Colossus Smash", ret => DunatanksSettings.Instance.useSpecc == 0 && !Me.CurrentTarget.HasAura("Colossus Smash") && detectAdds().Count == 1),
[...]
                CreateSpellCheckAndCast("Heroic Strike", ret => DunatanksSettings.Instance.useSpecc == 1 && DunatanksSettings.Instance.FurySpecc == 0 && Me.CurrentRage > 80 && detectAdds().Count == 1),
[...]
                CreateSpellCheckAndCast("Revenge", ret => DunatanksSettings.Instance.useSpecc == 2 && detectAdds().Count > 1 && detectAdds().Count < 6)
);

The problem I encountered is the following:

If DunatanksSettings.Instance.useSpecc is 0, the CC performs the actions as intended, but if it switches to 1 or 2, it just does nothing.

Any suggestions?

thanks in advance
try changing it so your least likely is on the top, and your fail safe is on the bottom, 2,1,0
also how are you setting the value? and did you make sure you restarted HB when changing spec? if you didnt its as simple as the value not changing, and it failing to cast a spell you might not have.
 
First of all, thanks for all the help with the CC issues I had.

I'm still looking for a fix for the multiple specc issue.

I tried the Switch<T> you recommended - unfortunately, I ended up with a CC that did nothing at all.

I then switched to an integer determining the chosen specc (0,1,2 for Arms, Fury and Prot) and added that to every Composite in a PrioritySelector as a CanRunDecoratorDelegate. I ended up with a CC that would just perform the Arms (0) actions (as described in this thread). After also following your tip to put the most unlikely events at the top, I again ended up with a CC that did nothing at all.

I thought there might be something wrong with the integer, although it was always saved correctly. I now tried using three booleans, one for every specc and a "void Combat" that switches to the appropriate behaviour.

Code:
        public override void Combat()
        {
            if (Me.Dead || !StyxWoW.Me.Combat || StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget.Dead || !StyxWoW.Me.CurrentTarget.Attackable || StyxWoW.Me.CurrentTarget.Distance > DunatanksSettings.Instance.AttackDistance || StyxWoW.Me.Mounted)
            {
                return;
            }

            if (DunatanksSettings.Instance.UseArms)
            {
                ArmsBehaviour();
                Logging.Write(Color.Orange, "Arms");
            }
            else if (DunatanksSettings.Instance.UseFury)
            {
                TGBehaviour();
                Logging.Write(Color.Orange, "Fury");
            }
            else if (DunatanksSettings.Instance.UseProt)
            {
                ProtBehaviour();
                Logging.Write(Color.Orange, "Prot");
            }
        }

This seemed to work in a CC that does not use BehaviourTrees, but now that I adapted that system, it still refuses to work, although most of the Composites in the PrioritySelector must return true.

EDIT: I found out that the CC does not even load the Behaviours - still don't get why it does not work for me.

Take this as an example:

Code:
                CreateSpellCheckAndCast("Heroic Strike", ret => Me.CurrentRage > 60 && detectAdds().Count == 1),
                CreateSpellCheckAndCast("Bloodthirst", ret => detectAdds().Count == 1),
                CreateSpellCheckAndCast("Raging Blow", ret => detectAdds().Count == 1),

The detectAdds() function works as intended, nonetheless none of the actions is performed.

I also checked the booleans, they are stored correctly.

Do you have another suggestion for me?
 
Last edited:
Back
Top