Example #1
0
        public static void MoveToTarget(Elf e)
        {
            var  target         = MissionExtensions.MoveTargets[e];
            bool elfTarget      = target is Elf && !e.IsSpedUp() && e.IsInChaseWith((Elf)target);
            bool fountainTarget = e.ShouldTargetFountain(out ManaFountain fountain) && fountain?.Equals(target) == true;

            if (GameState.AttackingPortals == 0 && (elfTarget || fountainTarget))
            {
                if (GameState.HasManaFor(CreatableObject.SpeedUp) && e.CanCastSpeedUp())
                {
                    e.CastSpeedUp();
                    return;
                }

                GameState.SaveManaFor(CreatableObject.SpeedUp);
            }

            target = target ?? e.GetMoveTarget();
            if (target == null)
            {
                return;
            }

            e.MoveSafely(target);
        }
Example #2
0
        public override void DoGameAction()
        {
            Elf elf = (Elf)gameObject;

            elf.CastSpeedUp();
        }