Esempio n. 1
0
        public virtual async Task CombatTask()
        {
            if (InstanceManager.Target == null)
            {
                return;
            }

            //if (GameManager.LocalPlayer.IsMoving)
            //Navigator.Stop();

            Tuple <SpellManager.SpellInformation, CastAction> currentBestAbility = Combat.GetHighestPriorityTuple(InstanceManager.Target);


            if (currentBestAbility != null && currentBestAbility.Item1.CanCast)             // sanity check on CanCast
            {
                // move within range of spell
                if (InstanceManager.Target.Distance > currentBestAbility.Item1.TargetMaxRange && Omnibus.WindowSettings.EnableMovement)
                {
                    if (await CommonBehaviors.MoveWithin(InstanceManager.Target.Position, currentBestAbility.Item1.TargetMaxRange, true) == CommonBehaviors.BehaviorResult.CombatStop) // move unless combat stops
                    {
                        return;                                                                                                                                                        // stop combat
                    }
                }

                Omnibus.Logger.Debug(string.Format("[COMBAT] FaceCast [Name {0}, SpellBarIndex {1}]",
                                                   currentBestAbility.Item1.Name,
                                                   currentBestAbility.Item1.SpellBarIndex));
                // NOTE: this needs to change. Since abilities need different casting methods.
                // ChargeAndRelease requires at least N charges before firing it off
                // ChanneledArea or something needs to be cast -> cast again at the location [2+ frames]

                // TODO: Add a "continuous face" into SpellCastBeahviors.CastSimple
                if (Omnibus.WindowSettings.EnableMovement)
                {
                    InstanceManager.Target.Face();
                }

                //await SpellCastBehaviors.CastSimple(currentBestAbility, () => InstanceManager.Target, true);
                await currentBestAbility.Item2(InstanceManager.Target);
            }
        }
Esempio n. 2
0
        public override async Task Pull(object target)
        {
            var pullTarget = (target as Actor);

            if (pullTarget == null)
            {
                return;
            }

            Targeting.PullTarget = pullTarget;

            if (pullTarget.Distance > Routine.PullRange)
            {
                Logger.Debug(string.Format("[MoveWithin] {0} -> {1} (Distance {2})", GameManager.ControlledUnit.Position, pullTarget.Position, pullTarget.Distance));

                // Stop within pull range, also stop early if we happen to body pull something.
                if (await CommonBehaviors.MoveWithin(pullTarget.Position, Routine.PullRange, true, true) == CommonBehaviors.BehaviorResult.CombatStop)
                {
                    // Return only if we body pulled. Chances are, we pulled something we don't actually want.
                    return;
                }
                // NOTE: Do not "return" after moving within range.
                //return;
            }

            SpellManager.SpellInformation pullAbility = Routine.Pull.ToValidAbilityList(pullTarget).FirstOrDefault();

            if (pullAbility == null)
            {
                throw new Exception("Could not find a usable pull ability. Is pull not implemented for this class?");
            }

            Logger.Debug(string.Format("[PULL] FaceCast [Name {0}, SpellBarIndex {1}]", pullAbility.Name, pullAbility.SpellBarIndex));

            if (WindowSettings.EnableMovement)
            {
                pullTarget.Face();
            }

            await SpellCastBehaviors.CastSimple(pullAbility, () => pullTarget, true);
        }