Example #1
0
        public static void Init()
        {
            foreach (var h in EntityManager.Heroes.AllHeroes)
            {
                TrackedUnits.Add(new UnitTrack(h));
            }

            Obj_AI_Base.OnBasicAttack      += Obj_AI_Base_OnBasicAttack;
            Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnBasicAttack;
            Game.OnTick           += Game_OnTick;
            Obj_AI_Base.OnNewPath += Obj_AI_Base_OnNewPath;
        }
Example #2
0
        private static void Obj_AI_Base_OnBasicAttack(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender == null || args.Target == null)
            {
                return;
            }

            var unit = TrackedUnits.FirstOrDefault(s => s.Unit.IdEquals(sender));

            if (unit == null)
            {
                TrackedUnits.Add(new UnitTrack(sender));
                return;
            }

            unit.Target          = args.Target;
            unit.LastCommandTick = Core.GameTickCount;
            unit.AttackStartTick = Core.GameTickCount;
        }
Example #3
0
        private static void Obj_AI_Base_OnNewPath(Obj_AI_Base sender, GameObjectNewPathEventArgs args)
        {
            if (sender == null)
            {
                return;
            }

            var unit = TrackedUnits.FirstOrDefault(s => s.Unit.IdEquals(sender));

            if (unit == null)
            {
                TrackedUnits.Add(new UnitTrack(sender));
                return;
            }

            var validPath = args.Path.LastOrDefault().Distance(sender) > 75 + sender.BoundingRadius;

            if (validPath)
            {
                unit.LastCommandTick = Core.GameTickCount;
            }
        }
Example #4
0
 //returns newly tracked tiles
 public void TrackEnemyRange(Unit enemy)
 {
     TrackedUnits.Add(enemy);
 }