public bool ExecuteTactic(WowRole role, bool isMelee, out bool preventMovement, out bool allowAttacking)
        {
            preventMovement = false;
            allowAttacking  = true;

            WowUnit wowUnit = WowInterface.ObjectManager.GetClosestWowUnitByDisplayId(IckDisplayId, false);

            if (wowUnit != null)
            {
                if (wowUnit.CurrentlyCastingSpellId == 68987 || wowUnit.CurrentlyChannelingSpellId == 68987) // chasing
                {
                    ChasingActivated = DateTime.UtcNow;
                    return(true);
                }
                else if (ChasingActive && wowUnit.TargetGuid == WowInterface.PlayerGuid && wowUnit.Position.GetDistance(WowInterface.Player.Position) < 7.0f)
                {
                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Flee, wowUnit.Position);

                    preventMovement = true;
                    allowAttacking  = false;
                    return(true);
                }

                WowUnit unitOrb = WowInterface.ObjectManager.WowObjects.OfType <WowUnit>()
                                  .OrderBy(e => e.Position.GetDistance(WowInterface.Player.Position))
                                  .FirstOrDefault(e => e.DisplayId == 11686 && e.HasBuffById(69017) && e.Position.GetDistance(WowInterface.Player.Position) < 3.0f);

                if (unitOrb != null) // orbs
                {
                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Flee, unitOrb.Position);

                    preventMovement = true;
                    allowAttacking  = false;
                    return(true);
                }

                if (role == WowRole.Tank)
                {
                    if (wowUnit.TargetGuid == WowInterface.PlayerGuid)
                    {
                        Vector3 modifiedCenterPosition = BotUtils.MoveAhead(MidPosition, BotMath.GetFacingAngle(WowInterface.ObjectManager.MeanGroupPosition, MidPosition), 8.0f);
                        float   distanceToMid          = WowInterface.Player.Position.GetDistance(modifiedCenterPosition);

                        if (distanceToMid > 5.0f && WowInterface.Player.Position.GetDistance(wowUnit.Position) < 3.5)
                        {
                            // move the boss to mid
                            WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, modifiedCenterPosition);

                            preventMovement = true;
                            allowAttacking  = false;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Beispiel #2
0
 public bool ExecuteTactic(WowRole role, bool isMelee, out bool preventMovement, out bool allowAttacking)
 {
     return(role switch
     {
         WowRole.Tank => DoTank(out preventMovement, out allowAttacking),
         WowRole.Heal => DoDpsHeal(false, out preventMovement, out allowAttacking),
         WowRole.Dps => DoDpsHeal(isMelee, out preventMovement, out allowAttacking),
         _ => throw new NotImplementedException(), // should never happen
     });
Beispiel #3
0
        public TargetManager(AmeisenBotInterfaces bot, WowRole role, TimeSpan minTargetSwitchTime)
        {
            TargetSelectionLogic = role switch
            {
                WowRole.Dps => new SimpleDpsTargetSelectionLogic(bot),
                WowRole.Tank => new SimpleTankTargetSelectionLogic(bot),
                WowRole.Heal => new SimpleHealTargetSelectionLogic(bot),
                _ => throw new NotImplementedException(),
            };

            TargetSwitchEvent = new(minTargetSwitchTime);
        }
Beispiel #4
0
        public bool ExecuteTactic(WowRole role, bool isMelee, out bool preventMovement, out bool allowAttacking)
        {
            preventMovement = false;
            allowAttacking  = true;

            WowUnit wowUnit = WowInterface.ObjectManager.GetClosestWowUnitByDisplayId(DevourerOfSoulsDisplayId, false);

            if (wowUnit != null)
            {
                if (wowUnit.DisplayId == 30150)
                {
                    // make sure we avoid the lazer
                    // we only care about being on the reight side of him because the lazer spins clockwise
                    float angleDiff = BotMath.GetAngleDiff(wowUnit.Position, wowUnit.Rotation, WowInterface.Player.Position);

                    if (angleDiff < 0.5f)
                    {
                        WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, BotMath.CalculatePositionAround(wowUnit.Position, wowUnit.Rotation, MathF.PI, isMelee ? 5.0f : 22.0f));

                        preventMovement = true;
                        allowAttacking  = false;
                        return(true);
                    }
                }

                if (role == WowRole.Tank)
                {
                    Vector3 modifiedCenterPosition = BotUtils.MoveAhead(MidPosition, BotMath.GetFacingAngle(WowInterface.ObjectManager.MeanGroupPosition, MidPosition), 8.0f);
                    float   distanceToMid          = WowInterface.Player.Position.GetDistance(modifiedCenterPosition);

                    if (wowUnit.TargetGuid == WowInterface.PlayerGuid)
                    {
                        if (distanceToMid > 5.0f && WowInterface.Player.Position.GetDistance(wowUnit.Position) < 3.5)
                        {
                            // move the boss to mid
                            WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, modifiedCenterPosition);

                            preventMovement = true;
                            allowAttacking  = false;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Beispiel #5
0
        public bool Execute(WowRole role, bool isMelee, out bool preventMovement, out bool allowAttacking)
        {
            if (Tactics.Count > 0)
            {
                foreach (ITactic tactic in Tactics.Values)
                {
                    if (tactic.ExecuteTactic(role, isMelee, out preventMovement, out allowAttacking))
                    {
                        return(true);
                    }
                }
            }

            preventMovement = false;
            allowAttacking  = true;
            return(false);
        }
Beispiel #6
0
        public bool ExecuteTactic(WowRole role, bool isMelee, out bool preventMovement, out bool allowAttacking)
        {
            preventMovement = false;
            allowAttacking  = true;

            WowUnit wowUnit = WowInterface.ObjectManager.GetClosestWowUnitByDisplayId(BronjahmDisplayId, false);

            if (wowUnit != null)
            {
                if (wowUnit.CurrentlyCastingSpellId == 68872 || wowUnit.CurrentlyChannelingSpellId == 68872 || wowUnit.HasBuffById(68872)) // soulstorm
                {
                    if (WowInterface.Player.Position.GetDistance(MidPosition) > 8.0)
                    {
                        WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, BotUtils.MoveAhead(MidPosition, BotMath.GetFacingAngle(WowInterface.Player.Position, MidPosition), -5.0f));

                        preventMovement = true;
                        allowAttacking  = true;
                        return(true);
                    }

                    // stay at the mid
                    return(false);
                }

                if (role == WowRole.Tank)
                {
                    if (wowUnit.TargetGuid == WowInterface.PlayerGuid)
                    {
                        Vector3 modifiedCenterPosition = BotUtils.MoveAhead(MidPosition, BotMath.GetFacingAngle(WowInterface.ObjectManager.MeanGroupPosition, MidPosition), 8.0f);
                        float   distanceToMid          = WowInterface.Player.Position.GetDistance(modifiedCenterPosition);

                        // flee from the corrupted souls target
                        bool needToFlee = wowUnit.CurrentlyChannelingSpellId == 68839 ||
                                          WowInterface.ObjectManager.WowObjects.OfType <WowUnit>().Any(e => e.DisplayId == 30233 && e.IsInCombat);

                        if (needToFlee)
                        {
                            if (distanceToMid < 16.0f)
                            {
                                WowInterface.MovementEngine.SetMovementAction(MovementAction.Flee, modifiedCenterPosition);

                                preventMovement = true;
                                allowAttacking  = false;
                                return(true);
                            }

                            // we cant run away further
                            preventMovement = true;
                            return(false);
                        }

                        if (distanceToMid > 5.0f && WowInterface.Player.Position.GetDistance(wowUnit.Position) < 3.5)
                        {
                            // move the boss to mid
                            WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, modifiedCenterPosition);

                            preventMovement = true;
                            allowAttacking  = false;
                            return(true);
                        }
                    }
                }
                else if (role == WowRole.Dps || role == WowRole.Heal)
                {
                    float distanceToMid = WowInterface.Player.Position.GetDistance(MidPosition);

                    if (!isMelee && distanceToMid < 20.0f)
                    {
                        // move to the outer ring of the arena
                        WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, BotUtils.MoveAhead(MidPosition, BotMath.GetFacingAngle(WowInterface.Player.Position, MidPosition), -22.0f));

                        preventMovement = true;
                        allowAttacking  = false;
                        return(true);
                    }
                }
            }

            return(false);
        }