Esempio n. 1
0
        public void TweakMelee(BoogieBot.Common.Object Monster)
        {
            double Distance = Monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
            double sensitivity = 2.5; // default melee distance is 4.8 - 2.5 = 2.3, no monster will chase us at 2.3
            double min = 4.5 - sensitivity;
            if (min < 1.0) min = 1.0;

            if (Distance > 4.5)
            {
                // Too far
                //Spam("Tweak forwards. "+ Distance + " > " + Context.MeleeDistance);
                mover.Forwards(true);
                Thread.Sleep(100);
                mover.Forwards(false);
            }
            else if (Distance < min)
            {
                // Too close
                //Spam("Tweak backwards. "+ Distance + " < " + min);
                mover.Backwards(true);
                Thread.Sleep(200);
                mover.Backwards(false);
            }
        }
Esempio n. 2
0
        public Coordinate PredictedLocation(BoogieBot.Common.Object mob)
        {
            Coordinate currentLocation = mob.GetCoordinates();
            double x = currentLocation.X;
            double y = currentLocation.Y;
            double z = currentLocation.Z;
            double heading = mob.GetOrientation();
            double dist = 4;

            x += Math.Cos(heading) * dist;
            y += Math.Sin(heading) * dist;

            Coordinate predictedLocation = new Coordinate((float)x, (float)y, (float)z);

            Coordinate closestLocatition = currentLocation;
            if (predictedLocation.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()) < closestLocatition.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()))
                closestLocatition = predictedLocation;
            return closestLocatition;
        }
Esempio n. 3
0
        public Coordinate InFrontOf(BoogieBot.Common.Object unit, double d)
        {
            double x = unit.GetCoordinates().X;
            double y = unit.GetCoordinates().Y;
            double z = unit.GetCoordinates().Z;
            double heading = unit.GetOrientation();
            x += Math.Cos(heading) * d;
            y += Math.Sin(heading) * d;

            return new Coordinate((float)x, (float)y, (float)z);
        }
Esempio n. 4
0
 public bool IsItSafeAt(BoogieBot.Common.Object ignore, BoogieBot.Common.Object u)
 {
     return IsItSafeAt(ignore, u.GetCoordinates());
 }
Esempio n. 5
0
        public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe, int timeout)
        {
            BoogieCore.Log(LogType.System, "[Approach] 1");
            Coordinate loc = monster.GetCoordinates();
            float DistTo = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
            BoogieCore.Log(LogType.System, "[Approach] Distance to object: {0}", DistTo);
            if (DistTo < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return true;
            }

            GSpellTimer approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd = new StuckDetecter(this, 1, 2);
            GSpellTimer t = new GSpellTimer(0);
            bool doJump = random.Next(4) == 0;
            EasyMover em = null;
            GSpellTimer NewTargetUpdate = new GSpellTimer(1000);

            BoogieCore.Log(LogType.System, "[Approach] 2");
            do
            {
                BoogieCore.Log(LogType.System, "[Approach] 3");
                UpdateMyPos();
                BoogieCore.Log(LogType.System, "[Approach] 4");
                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "[Approach] 5");
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return false;
                }
                double distance = monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                BoogieCore.Log(LogType.System, "[Approach] 6 - Dist = {0}", distance);
                bool moved;

                if (distance < 8)
                {
                    loc = monster.GetCoordinates();
                    BoogieCore.Log(LogType.System, "[Approach] 7");
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                    BoogieCore.Log(LogType.System, "[Approach] 8 {0}", moved);
                }
                else
                {
                    BoogieCore.Log(LogType.System, "[Approach] 9");
                    if (em == null)
                    {
                        loc = monster.GetCoordinates();
                        em = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 10");
                    EasyMover.MoveResult mr = em.move();
                    BoogieCore.Log(LogType.System, "[Approach] 11 {0}", mr);
                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 12");
                }
                BoogieCore.Log(LogType.System, "[Approach] 13");

                if (!moved)
                {
                    mover.Stop();
                    return true;
                }

            } while (!approachTimeout.IsReadySlow);
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return false;
        }