Exemplo n.º 1
0
        public static async Task <bool> Resurrection()
        {
            if (!Globals.InParty)
            {
                return(false);
            }

            var deadList = Group.DeadAllies.Where(u => u.CurrentHealth == 0 &&
                                                  !u.HasAura(Auras.Raise) &&
                                                  u.Distance(Core.Me) <= 30)
                           .OrderByDescending(r => r.GetResurrectionWeight());

            var deadTarget = deadList.FirstOrDefault();

            if (deadTarget == null)
            {
                return(false);
            }

            if (!deadTarget.IsVisible)
            {
                return(false);
            }

            if (!deadTarget.IsTargetable)
            {
                return(false);
            }

            if (Globals.PartyInCombat)
            {
                if (!ScholarSettings.Instance.SwiftcastRes)
                {
                    return(false);
                }

                if (Spells.Swiftcast.Cooldown != TimeSpan.Zero)
                {
                    return(false);
                }

                if (await Buff.Swiftcast())
                {
                    while (Core.Me.HasAura(Auras.Swiftcast))
                    {
                        if (await Spells.Resurrection.Cast(deadTarget))
                        {
                            return(true);
                        }
                        await Coroutine.Yield();
                    }
                }
            }

            if (Globals.PartyInCombat)
            {
                return(false);
            }

            if (!ScholarSettings.Instance.ResOutOfCombat)
            {
                return(false);
            }

            return(await Spells.Resurrection.CastAura(deadTarget, Auras.Raise));
        }