Exemplo n.º 1
0
        private static bool IsKitingNeeded()
        {
            if (SingularSettings.Instance.DisableAllMovement || !SingularSettings.Instance.AllowKiting)
                return false;

            // note:  PullDistance MUST be longer than our out of melee distance (DISTANCE_WE_NEED_TO_START_BACK_PEDDLING)
            // otherwise it will run back and forth
            if (IsKitingActive() || !Me.IsAlive || Me.IsCasting)
                return false;

            if (Me.Stunned || Me.IsStunned())
                return false;

            if (Me.Rooted || Me.IsRooted())
                return false;

            if (Me.IsFalling)
                return false;

            WoWUnit mob = SafeArea.NearestEnemyMobAttackingMe;
            //mob = Me.CurrentTarget;  // FOR TESTING ONLY
            if (mob == null)
                return false;

            // check if 5yds beyond melee
            if (mob.Distance > 10f)
                return false;

            SafeArea sa = new SafeArea();
            if (Battlegrounds.IsInsideBattleground)
            {
                sa.MinSafeDistance = 12;
                sa.MinScanDistance = 15;
                sa.IncrementScanDistance = 10;
                sa.MaxScanDistance = sa.MinScanDistance + 2 * sa.IncrementScanDistance;
                sa.RaysToCheck = 18;
                sa.MobToRunFrom = mob;
                sa.LineOfSightMob = Me.CurrentTarget;
                sa.CheckLineOfSightToSafeLocation = false;
                sa.CheckSpellLineOfSightToMob = false;
            }
            else
            {
                sa.MinSafeDistance = 20;
                sa.MinScanDistance = 10;
                sa.IncrementScanDistance = 5;
                sa.MaxScanDistance = sa.MinScanDistance + (2 * sa.IncrementScanDistance);
                sa.RaysToCheck = 36;
                sa.MobToRunFrom = mob;
                sa.LineOfSightMob = Me.CurrentTarget;
                sa.CheckLineOfSightToSafeLocation = false;
                sa.CheckSpellLineOfSightToMob = false;
            }

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
                return false;

            return BeginKiting(String.Format("BP: back peddle initiated due to {0} @ {1:F1} yds", mob.Name, mob.Distance));
        }
Exemplo n.º 2
0
        public static bool IsDisengageNeeded()
        {
            if (SingularRoutine.CurrentWoWContext == WoWContext.Instances)
                return false;

            if (!Me.IsAlive || Me.IsFalling || Me.IsCasting)
                return false;

            if (Me.Stunned || Me.Rooted || Me.IsStunned() || Me.IsRooted())
                return false;

            if (NextDisengageAllowed > DateTime.Now)
                return false;

            useRocketJump = false;
            if (!Spell.CanCastHack("Disengage", Me))
            {
                if (!SingularSettings.Instance.UseRacials || Me.Race != WoWRace.Goblin || !Spell.CanCastHack("Rocket Jump", Me))
                    return false;

                useRocketJump = true;
            }

            mobToGetAwayFrom = SafeArea.NearestEnemyMobAttackingMe;
            if (mobToGetAwayFrom == null)
                return false;

            if (SingularRoutine.CurrentWoWContext == WoWContext.Normal )
            {
                List<WoWUnit> attackers = SafeArea.AllEnemyMobsAttackingMe.ToList();
                if ((attackers.Sum( a => a.MaxHealth ) / 4) < Me.MaxHealth &&  Me.HealthPercent > 40)
                    return false;
            }
            else if (SingularRoutine.CurrentWoWContext == WoWContext.Battlegrounds)
            {
                switch (mobToGetAwayFrom.Class)
                {
                    default:
                        return false;

                    case WoWClass.DeathKnight:
                    case WoWClass.Druid:
                    case WoWClass.Monk:
                    case WoWClass.Paladin:
                    case WoWClass.Rogue:
                    case WoWClass.Shaman:
                        break;
                }
            }

            if (mobToGetAwayFrom.Distance > mobToGetAwayFrom.MeleeDistance() + 3f)
                return false;

            SafeArea sa = new SafeArea();
            sa.MinScanDistance = TalentManager.HasGlyph("Disengage") ? 21 : 16;    // average disengage distance on flat ground
            sa.MaxScanDistance = sa.MinScanDistance;
            sa.RaysToCheck = 36;
            sa.LineOfSightMob = Target;
            sa.MobToRunFrom = mobToGetAwayFrom;
            sa.CheckLineOfSightToSafeLocation = true;
            sa.CheckSpellLineOfSightToMob = false;

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
            {
                Logger.WriteDebug(Color.Cyan, "DIS: no safe landing spots found for {0}", useRocketJump ? "Rocket Jump" : "Disengage");
                return false;
            }

            Logger.WriteDebug(Color.Cyan, "DIS: Attempt safe {0} due to {1} @ {2:F1} yds",
                useRocketJump ? "Rocket Jump" : "Disengage",
                mobToGetAwayFrom.SafeName(),
                mobToGetAwayFrom.Distance);

            return true;
        }
Exemplo n.º 3
0
        /*
        private static RunStatus BeginKiting()
        {
            bpwjDest = WoWMathHelper.CalculatePointFrom(Me.Location, Me.CurrentTarget.Location, Spell.MeleeRange + DISTANCE_WE_NEED_TO_START_BACK_PEDAL);
            if (Navigator.CanNavigateFully(StyxWoW.Me.Location, bpwjDest))
            {
                state = JumpTurnState.RunAway;
                Logger.WriteDebug( Color.Cyan,  "Back peddling");
                movementCheck = DateTime.Now.Add(new TimeSpan(0, 0, 0, 0, 500));
                Navigator.MoveTo(bpwjDest);
            }

            return RunStatus.Success;
        }
        */
        private static RunStatus BeginKitingToSafeArea()
        {
            SafeArea sa = new SafeArea();
            sa.MinScanDistance = Spell.MeleeRange + 15;
            sa.IncrementScanDistance = 5;
            sa.MaxScanDistance = sa.MinScanDistance + sa.IncrementScanDistance;
            sa.RaysToCheck = 18;
            sa.MinSafeDistance = 15;

            bpwjDest = sa.FindLocation();
            if (bpwjDest != WoWPoint.Empty)
            {
                state = JumpTurnState.RunAway;
                Logger.WriteDebug( Color.Cyan,  "Back peddling");
                Navigator.MoveTo(bpwjDest);
                movementCheck = DateTime.Now.Add(new TimeSpan(0, 0, 0, 0, 1000));
                stopKiting = DateTime.Now.Add(new TimeSpan(0, 0, 0, 0, 8000));
                return RunStatus.Success;
            }

            return RunStatus.Failure;
        }
Exemplo n.º 4
0
        public static bool IsDisengageNeeded()
        {
            if (!Me.IsAlive || Me.IsFalling || Me.IsCasting)
                return false;

            if (Me.Stunned || Me.Rooted || Me.IsStunned() || Me.IsRooted())
                return false;

            if (NextDisengageAllowed > DateTime.Now)
                return false;

            useRocketJump = false;
            if (!SpellManager.CanCast("Disengage", Me, false, false))
            {
                if (!SingularSettings.Instance.UseRacials || Me.Race != WoWRace.Goblin || !SpellManager.CanCast("Rocket Jump", Me, false, false))
                    return false;

                useRocketJump = true;
            }

            mobToGetAwayFrom = SafeArea.NearestEnemyMobAttackingMe;
            if (mobToGetAwayFrom == null)
                return false;

            if (mobToGetAwayFrom.Distance > mobToGetAwayFrom.MeleeDistance() + 3f)
                return false;

            if (Me.Level > (mobToGetAwayFrom.Level + (mobToGetAwayFrom.Elite ? 10 : 5)) && Me.HealthPercent > 20)
                return false;

            SafeArea sa = new SafeArea();
            sa.MinScanDistance = 16;    // average disengage distance on flat ground
            sa.MaxScanDistance = sa.MinScanDistance;
            sa.RaysToCheck = 36;
            sa.LineOfSightMob = Me.CurrentTarget;
            sa.MobToRunFrom = mobToGetAwayFrom;
            sa.CheckLineOfSightToSafeLocation = true;
            sa.CheckSpellLineOfSightToMob = false;

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
            {
                Logger.Write(Color.Cyan, "DIS: no safe landing spots found for {0}", useRocketJump ? "Rocket Jump" : "Disengage");
                return false;
            }

            Logger.Write(Color.Cyan, "DIS: Attempt safe {0} due to {1} @ {2:F1} yds",
                useRocketJump ? "Rocket Jump" : "Disengage",
                mobToGetAwayFrom.Name,
                mobToGetAwayFrom.Distance);

            return true;
        }
Exemplo n.º 5
0
        public static bool IsKitingPossible(int minScan = -1)
        {
            if (MovementManager.IsMovementDisabled)
                return false;
            if (!SingularRoutine.IsAllowed(CapabilityFlags.Kiting))
                return false;

            // note:  PullDistance MUST be longer than our out of melee distance (DISTANCE_WE_NEED_TO_START_BACK_PEDDLING)
            // otherwise it will run back and forth
            if (IsKitingActive() || !Me.IsAlive || Spell.IsCasting())
                return false;

            if (Me.Stunned || Me.IsStunned())
            {
                Logger.WriteDebug("IsKitingPossible: suppressed while Stunned");
                return false;
            }

            if (Me.Rooted || Me.IsRooted())
            {
                Logger.WriteDebug("IsKitingPossible: suppressed while Rooted");
                return false;
            }

            if (Me.IsFalling)
            {
                Logger.WriteDebug("IsKitingPossible: suppressed while Falling");
                return false;
            }

            WoWUnit mob = SafeArea.NearestEnemyMobAttackingMe;
            //mob = Me.CurrentTarget;  // FOR TESTING ONLY
            if (mob == null)
            {
                Logger.WriteDebug("IsKitingPossible: error - cannot find a Mob Near us to Kite away from");
                return false;
            }

            // check if 5yds beyond melee
            if (mob.SpellDistance() > 10f)
            {
                Logger.WriteDebug("IsKitingPossible: {0} @ {1:F1} yds is already > 10 yds away", mob.SafeName(), mob.SpellDistance());
                return false;
            }

            SafeArea sa = new SafeArea();
            if (Battlegrounds.IsInsideBattleground)
            {
                sa.MinSafeDistance = 12;
                sa.MinScanDistance = minScan == -1 ? 15 : minScan;
                sa.IncrementScanDistance = 10;
                sa.MaxScanDistance = sa.MinScanDistance + 2 * sa.IncrementScanDistance;
                sa.RaysToCheck = 18;
                sa.MobToRunFrom = mob;
                sa.LineOfSightMob = Me.CurrentTarget;
                sa.CheckLineOfSightToSafeLocation = false;
                sa.CheckSpellLineOfSightToMob = false;
                sa.DirectPathOnly = true;   // faster to check direct path than navigable route
            }
            else
            {
                sa.MinSafeDistance = 20;
                sa.MinScanDistance = minScan == -1 ? 10 : minScan;
                sa.IncrementScanDistance = 5;
                sa.MaxScanDistance = sa.MinScanDistance + (2 * sa.IncrementScanDistance);
                sa.RaysToCheck = 36;
                sa.MobToRunFrom = mob;
                sa.LineOfSightMob = Me.CurrentTarget;
                sa.CheckLineOfSightToSafeLocation = false;
                sa.CheckSpellLineOfSightToMob = false;
                sa.DirectPathOnly = true;   // faster to check direct path than navigable route
            }

            locSafeSpot = sa.FindLocation();
            if (locSafeSpot == WoWPoint.Empty)
            {
                return false;
            }

            return BeginKiting(String.Format("^Kiting(begin): moving {0:F1} yds away from {1}", locSafeSpot.Distance(StyxWoW.Me.Location), mob.SafeName()));
        }
Exemplo n.º 6
0
        public static bool CanWeDisengage(string spell, Direction dir, int distance)
        {
            if (!SpellManager.HasSpell(spell))
                return false;

            if (DateTime.UtcNow < NextDisengageAllowed)
                return false;

            if (!Me.IsAlive || Me.IsFalling || Me.IsCasting || Me.IsSwimming)
                return false;

            if (Me.Stunned || Me.Rooted || Me.IsStunned() || Me.IsRooted())
                return false;

            if (!Spell.CanCastHack(spell, Me))
                return false;

            mobToGetAwayFrom = SafeArea.NearestEnemyMobAttackingMe;
            if (mobToGetAwayFrom == null)
                return false;

            if (mobToGetAwayFrom.SpellDistance() > mobToGetAwayFrom.MeleeDistance() + 3f)
                return false;

            SafeArea sa = new SafeArea();
            sa.MinScanDistance = distance;    // average distance on flat ground
            sa.MaxScanDistance = sa.MinScanDistance;
            sa.RaysToCheck = 36;
            sa.LineOfSightMob = Target;
            sa.MobToRunFrom = mobToGetAwayFrom;
            sa.CheckLineOfSightToSafeLocation = true;
            sa.CheckSpellLineOfSightToMob = false;
            sa.DirectPathOnly = true;

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
            {
                Logger.WriteDebug(Color.Cyan, "DIS: no safe landing spots found for {0}", spell);
                return false;
            }

            Logger.WriteDebug(Color.Cyan, "DIS: Attempt safe {0} due to {1} @ {2:F1} yds",
                spell,
                mobToGetAwayFrom.SafeName(),
                mobToGetAwayFrom.Distance);

            return true;
        }
Exemplo n.º 7
0
        public static bool CanWeDisengage(string spell, Direction dir, int distance)
        {
            if (!SpellManager.HasSpell(spell))
                return false;

            if (DateTime.Now < NextDisengageAllowed)
                return false;

            if (!Me.IsAlive || Me.IsFalling || Me.IsCasting || Me.IsSwimming)
                return false;

            if (Me.Stunned || Me.Rooted || Me.IsStunned() || Me.IsRooted())
                return false;

            if (!Spell.CanCastHack(spell, Me))
                return false;

            mobToGetAwayFrom = SafeArea.NearestEnemyMobAttackingMe;
            if (mobToGetAwayFrom == null)
                return false;

            if (SingularRoutine.CurrentWoWContext == WoWContext.Normal)
            {
                List<WoWUnit> attackers = SafeArea.AllEnemyMobsAttackingMe.ToList();
                if ((attackers.Sum(a => a.MaxHealth) / 3) < Me.MaxHealth && Me.HealthPercent > 40)
                {
                    return false;
                }
            }
            else if (SingularRoutine.CurrentWoWContext == WoWContext.Battlegrounds)
            {
                switch (mobToGetAwayFrom.Class)
                {
                    default:
                        return false;

                    case WoWClass.DeathKnight:
                    case WoWClass.Druid:
                    case WoWClass.Monk:
                    case WoWClass.Paladin:
                    case WoWClass.Rogue:
                    case WoWClass.Shaman:
                        break;
                }
            }

            if (mobToGetAwayFrom.Distance > mobToGetAwayFrom.MeleeDistance() + 3f)
                return false;

            SafeArea sa = new SafeArea();
            sa.MinScanDistance = distance;    // average distance on flat ground
            sa.MaxScanDistance = sa.MinScanDistance;
            sa.RaysToCheck = 36;
            sa.LineOfSightMob = Target;
            sa.MobToRunFrom = mobToGetAwayFrom;
            sa.CheckLineOfSightToSafeLocation = true;
            sa.CheckSpellLineOfSightToMob = false;

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
            {
                Logger.WriteDebug(Color.Cyan, "DIS: no safe landing spots found for {0}", spell);
                return false;
            }

            Logger.WriteDebug(Color.Cyan, "DIS: Attempt safe {0} due to {1} @ {2:F1} yds",
                spell,
                mobToGetAwayFrom.SafeName(),
                mobToGetAwayFrom.Distance);

            return true;
        }