Пример #1
0
        static public Composite Cast(int spellId, CanRunDecoratorDelegate cond, WoWUnitDelegate target)
        {
            return(new Decorator(ret => target != null && cond(ret) && CanCast(spellId),
                                 new Action(ret =>
            {
                SpellManager.Cast(spellId, target(ret));
                Logging.Write(LogLevel.Diagnostic, Colors.White, "" + WoWSpell.FromId(spellId).Name);
                string temp;
                if (target(ret).IsPlayer)
                {
                    temp = "Casting " + WoWSpell.FromId(spellId).Name + " on Player at " +
                           Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy";
                }
                else
                {
                    temp = "Casting " + WoWSpell.FromId(spellId).Name + " on " + target(ret).Name + " at " +
                           Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy";
                }

                Logging.Write(LogLevel.Normal, temp);
            }
                                            )
                                 ));
        }
Пример #2
0
 static public Composite Cast(string spellName, CanRunDecoratorDelegate cond, WoWUnitDelegate target)
 {
     if (spellName.Equals("Hemorrhage"))
     {
         spellName = "Sinister Strike";
     }
     if (spellName.Equals("Dispatch"))
     {
         spellName = "Sinister Strike";
     }
     if (spellName.Equals("Envenom"))
     {
         spellName = "Eviscerate";
     }
     return(new Decorator(ret => target(ret) != null && cond(ret) && CanCast(spellName),
                          new Action(ret =>
     {
         SpellManager.Cast(spellName, target(ret));
         if (target(ret).IsPlayer)
         {
             Logging.Write(LogLevel.Normal, "Casting " + spellName + " on Player at " +
                           Math.Round(target(ret).HealthPercent, 0) + "% with " + Helpers.Rogue.mComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy");
         }
         else
         {
             Logging.Write(LogLevel.Normal, "Casting " + spellName + " on " + target(ret).Name + " at " +
                           Math.Round(target(ret).HealthPercent, 0) + "% with " + Helpers.Rogue.mComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy");
         }
     })
                          ));
 }
        private Composite UtilityBehavior_InteractWithMob(WoWUnitDelegate unitToInteract)
        {
            return(new PrioritySelector(interactUnitContext => unitToInteract(interactUnitContext),
                                        new Decorator(interactUnitContext => IsViable((WoWUnit)interactUnitContext),
                                                      new PrioritySelector(
                                                          // Show user which unit we're going after...
                                                          new Decorator(interactUnitContext => Me.CurrentTarget != (WoWUnit)interactUnitContext,
                                                                        new Action(interactUnitContext => { ((WoWUnit)interactUnitContext).Target(); })),

                                                          // If not within interact range, move closer...
                                                          new Decorator(interactUnitContext => !((WoWUnit)interactUnitContext).WithinInteractRange,
                                                                        new ActionRunCoroutine(
                                                                            interactUnitContext => UtilityCoroutine.MoveTo(
                                                                                ((WoWUnit)interactUnitContext).Location,
                                                                                "to interact with " + ((WoWUnit)interactUnitContext).SafeName))),

                                                          new Decorator(interactUnitContext => Me.IsMoving,
                                                                        new Action(interactUnitContext => { WoWMovement.MoveStop(); })),
                                                          new Decorator(interactUnitContext => !Me.IsFacing((WoWUnit)interactUnitContext),
                                                                        new Action(interactUnitContext => { Me.SetFacing((WoWUnit)interactUnitContext); })),

                                                          // Blindly interact...
                                                          // Ideally, we would blacklist the unit if the interact failed.  However, the HB API
                                                          // provides no CanInteract() method (or equivalent) to make this determination.
                                                          new Action(interactUnitContext =>
            {
                QBCLog.DeveloperInfo("Interacting with {0}", ((WoWUnit)interactUnitContext).SafeName);
                ((WoWUnit)interactUnitContext).Interact();
                return RunStatus.Failure;
            }),
                                                          new Wait(TimeSpan.FromMilliseconds(1000), context => false, new ActionAlwaysSucceed())
                                                          ))));
        }
 /// <summary>
 /// This behavior quits attacking the mob, once the mob is targeting us.
 /// </summary>
 private Composite UtilityBehavior_GetMobsAttention(WoWUnitDelegate selectedTargetDelegate)
 {
     return(new PrioritySelector(targetContext => selectedTargetDelegate(targetContext),
                                 new Decorator(targetContext => IsViable((WoWUnit)targetContext),
                                               new PrioritySelector(
                                                   new Decorator(targetContext => !((((WoWUnit)targetContext).CurrentTarget == Me) ||
                                                                                    (Me.GotAlivePet && ((WoWUnit)targetContext).CurrentTarget == Me.Pet)),
                                                                 new PrioritySelector(
                                                                     new Action(targetContext =>
     {
         QBCLog.Info("Getting attention of {0}", ((WoWUnit)targetContext).SafeName);
         return RunStatus.Failure;
     }),
                                                                     UtilityBehavior_SpankMob(selectedTargetDelegate)))
                                                   ))));
 }
 /// <summary>
 /// Unequivocally engages mob in combat.
 /// </summary>
 private Composite UtilityBehavior_SpankMob(WoWUnitDelegate selectedTargetDelegate)
 {
     return(new PrioritySelector(targetContext => selectedTargetDelegate(targetContext),
                                 new Decorator(targetContext => IsViable((WoWUnit)targetContext),
                                               new PrioritySelector(
                                                   new Decorator(targetContext => ((WoWUnit)targetContext).Distance > CombatMaxEngagementRangeDistance,
                                                                 new Action(targetContext => { Navigator.MoveTo(((WoWUnit)targetContext).Location); })),
                                                   new Decorator(targetContext => Me.CurrentTarget != (WoWUnit)targetContext,
                                                                 new Action(targetContext =>
     {
         BotPoi.Current = new BotPoi((WoWUnit)targetContext, PoiType.Kill);
         ((WoWUnit)targetContext).Target();
     })),
                                                   new Decorator(targetContext => !((WoWUnit)targetContext).IsTargetingMeOrPet,
                                                                 new PrioritySelector(
                                                                     new Decorator(targetContext => RoutineManager.Current.CombatBehavior != null,
                                                                                   RoutineManager.Current.CombatBehavior),
                                                                     new Action(targetContext => { RoutineManager.Current.Combat(); })
                                                                     ))
                                                   ))));
 }
Пример #6
0
        public static Composite Cast(int spellId, CanRunDecoratorDelegate cond, WoWUnitDelegate target)
        {
            return new Decorator(ret => target != null && cond(ret) && CanCast(spellId),
                new Action(ret =>
                    {
                        SpellManager.Cast(spellId, target(ret));
                        Logging.Write(LogLevel.Diagnostic, Colors.White, "" + WoWSpell.FromId(spellId).Name);
                        string temp;
                        if (target(ret).IsPlayer)
                            temp = "Casting " + WoWSpell.FromId(spellId).Name + " on Player at " +
                                             Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                                             Rogue.mCurrentEnergy + " energy";
                        else
                            temp = "Casting " + WoWSpell.FromId(spellId).Name + " on " + target(ret).Name + " at " +
                                             Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                                             Rogue.mCurrentEnergy + " energy";

                        Logging.Write(LogLevel.Normal, temp );
                    }
                )
            );
        }
Пример #7
0
 public static Composite Cast(string spellName, CanRunDecoratorDelegate cond,  WoWUnitDelegate target)
 {
     if (spellName.Equals("Hemorrhage")) spellName = "Sinister Strike";
         if (spellName.Equals("Dispatch")) spellName = "Sinister Strike";
         if (spellName.Equals("Envenom")) spellName = "Eviscerate";
     return new Decorator(ret => target(ret) != null && cond(ret) && CanCast(spellName),
         new Action(ret =>
              {
                 SpellManager.Cast(spellName, target(ret));
                 if (target(ret).IsPlayer)
                     Logging.Write(LogLevel.Normal, "Casting " + spellName + " on Player at " +
                                          Math.Round(target(ret).HealthPercent, 0) + "% with " + Helpers.Rogue.mComboPoints + "CP and " +
                                          Rogue.mCurrentEnergy + " energy");
                 else
                     Logging.Write(LogLevel.Normal , "Casting " + spellName + " on " + target(ret).Name + " at " +
                                      Math.Round(target(ret).HealthPercent, 0) + "% with " + Helpers.Rogue.mComboPoints + "CP and " +
                                      Rogue.mCurrentEnergy + " energy");
             })
     );
 }