Esempio n. 1
0
        /// <summary>
        ///     <para>(Non-Blocking) Checks the target to determine if it is a candidate for interrupting the current spell.</para>
        ///     <para>
        ///         If the target is a candidate, it will attempt to interrupt based on the condition of the settings and
        ///         available interrupt abilities.
        ///     </para>
        /// </summary>
        /// <returns>Returns true on a successful interrupt</returns>
        public static async Task <bool> CheckMyTarget()
        {
            if (!Me.CanActuallyInterruptCurrentTargetSpellCast(SettingsManager.Instance.InterruptMinMilliseconds))
            {
                return(false);
            }
            if (MyCurrentTarget == _lastInterruptableTarget)
            {
                if (InterruptTimer.ElapsedMilliseconds < _interruptRandomIntervalInMilliseconds)
                {
                    return(false);
                }
                if (_interruptRollIsSuccessful)
                {
                    if (await Abilities.Cast <SkullBashAbility>(MyCurrentTarget))
                    {
                        return(ReturnSuccessWithMessage(InterruptTimer.ElapsedMilliseconds));
                    }
                    if (await Abilities.Cast <MightyBashAbility>(MyCurrentTarget))
                    {
                        return(ReturnSuccessWithMessage(InterruptTimer.ElapsedMilliseconds));
                    }
                    if (await Abilities.Cast <TyphoonAbility>(MyCurrentTarget))
                    {
                        return(ReturnSuccessWithMessage(InterruptTimer.ElapsedMilliseconds));
                    }
                    if (await Abilities.Cast <MaimAbility>(MyCurrentTarget))
                    {
                        return(ReturnSuccessWithMessage(InterruptTimer.ElapsedMilliseconds));
                    }
                }
                else
                {
                    Log.AppendLine(
                        string.Format("Roll failed to complete the Interrupt on {0} [{1}] after {2} milliseconds.",
                                      MyCurrentTarget.SafeName,
                                      UnitManager.GuidToUnitId(MyCurrentTarget.Guid),
                                      InterruptTimer.ElapsedMilliseconds),
                        Colors.Gold);

                    InterruptTimer.Reset();
                    _interruptRollIsSuccessful = !_interruptRollIsSuccessful;
                    _lastInterruptableTarget   = null;

                    return(false);
                }
            }
            else
            {
                await SetupRandomInterruptTimer();
            }

            return(false);
        }