Esempio n. 1
0
 private async Task <bool> Thundercloud()
 {
     if (Core.Player.HasAura("Thundercloud"))
     {
         if (!UmbralAura)
         {
             if (Ultima.LastSpell.Name == MySpells.Fire.Name ||
                 Ultima.LastSpell.Name == MySpells.FireII.Name ||
                 !Core.Player.HasAura("Thundercloud", false, 5000))
             {
                 if (!Actionmanager.HasSpell(MySpells.ThunderIII.Name))
                 {
                     return(await MySpells.ThunderII.Cast());
                 }
                 return(await MySpells.ThunderIII.Cast());
             }
         }
         if (UmbralAura)
         {
             Spell.RecentSpell.RemoveAll(t => DateTime.UtcNow > t);
             if (!RecentThunder)
             {
                 if (!Actionmanager.HasSpell(MySpells.ThunderIII.Name))
                 {
                     return(await MySpells.ThunderII.Cast());
                 }
                 return(await MySpells.ThunderIII.Cast());
             }
         }
     }
     return(false);
 }
Esempio n. 2
0
 private async Task <bool> Flare()
 {
     if (Actionmanager.HasSpell(MySpells.Flare.Name) &&
         AstralAura &&
         Actionmanager.CanCast(MySpells.Convert.Name, Core.Player))
     {
         if (Core.Player.CurrentMana <= 904 ||
             Ultima.LastSpell.Name == MySpells.FireII.Name &&
             Core.Player.CurrentMana <= 1116)
         {
             if (Actionmanager.CanCast(MySpells.Swiftcast.Name, Core.Player) ||
                 Core.Player.HasAura(MySpells.Swiftcast.Name))
             {
                 if (await MySpells.Swiftcast.Cast())
                 {
                     await Coroutine.Wait(3000, () => Actionmanager.CanCast(MySpells.Flare.Name, Core.Player.CurrentTarget));
                 }
                 if (await MySpells.Flare.Cast())
                 {
                     await Coroutine.Wait(3000, () => Actionmanager.CanCast(MySpells.Convert.Name, Core.Player));
                 }
                 if (await MySpells.Convert.Cast())
                 {
                     await Coroutine.Wait(3000, () => !Actionmanager.CanCast(MySpells.Convert.Name, Core.Player));
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 3
0
 private async Task <bool> Thunder()
 {
     if (UmbralAura &&
         Core.Player.CurrentManaPercent < 100)
     {
         if (!Actionmanager.HasSpell(MySpells.BlizzardIII.Name) &&
             !Core.Player.CurrentTarget.HasAura("Thunder", true, 3000))
         {
             return(await MySpells.Thunder.Cast());
         }
         Spell.RecentSpell.RemoveAll(t => DateTime.UtcNow > t);
         if (!RecentThunder)
         {
             return(await MySpells.Thunder.Cast());
         }
     }
     if (!AstralAura &&
         !UmbralAura)
     {
         if (!Actionmanager.HasSpell(MySpells.ThunderII.Name) &&
             !Core.Player.CurrentTarget.HasAura("Thunder", true))
         {
             return(await MySpells.Thunder.Cast());
         }
     }
     return(false);
 }
Esempio n. 4
0
 private async Task <bool> ShadowFlare()
 {
     if (Actionmanager.HasSpell(MySpells.ShadowFlare.Name) &&
         !Core.Player.HasAura(MySpells.ShadowFlare.Name, true, 4000))
     {
         if (Actionmanager.CanCast(MySpells.RuinII.Name, Core.Player.CurrentTarget) &&
             Actionmanager.CanCast(MySpells.CrossClass.Swiftcast.Name, Core.Player))
         {
             if (await MySpells.RuinII.Cast())
             {
                 await Coroutine.Wait(5000, () => Actionmanager.CanCast(MySpells.CrossClass.Swiftcast.Name, Core.Player));
             }
         }
         if (Actionmanager.CanCast(MySpells.CrossClass.Swiftcast.Name, Core.Player))
         {
             if (await MySpells.CrossClass.Swiftcast.Cast())
             {
                 await Coroutine.Wait(5000, () => Actionmanager.CanCast(MySpells.ShadowFlare.Name, Core.Player.CurrentTarget) &&
                                      Core.Player.HasAura(MySpells.CrossClass.Swiftcast.Name));
             }
         }
         if (await MySpells.ShadowFlare.Cast())
         {
             await Coroutine.Wait(3000, () => Core.Player.HasAura(MySpells.ShadowFlare.Name));
         }
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 private async Task <bool> Transpose()
 {
     if (AstralAura)
     {
         if (!Core.Player.InCombat &&
             LowMP)
         {
             return(await MySpells.Transpose.Cast());
         }
     }
     if (UmbralAura &&
         Core.Player.HasAura("Firestarter"))
     {
         if (Ultima.LastSpell.Name == MySpells.Scathe.Name &&
             Core.Player.CurrentManaPercent != 100)
         {
             await Coroutine.Wait(5000, () => Core.Player.CurrentManaPercent == 100 ||
                                  MovementManager.IsMoving);
         }
         if (Core.Player.CurrentManaPercent == 100)
         {
             return(await MySpells.Transpose.Cast());
         }
     }
     if (!Actionmanager.HasSpell(MySpells.BlizzardIII.Name) &&
         LowMP)
     {
         return(await MySpells.Transpose.Cast());
     }
     return(false);
 }
Esempio n. 6
0
 private async Task <bool> Barrage()
 {
     if (!Actionmanager.HasSpell(MySpells.EmpyrealArrow.Name) &&
         DataManager.GetSpellData(97).Cooldown.TotalMilliseconds <= 1000)
     {
         return(await MySpells.Barrage.Cast());
     }
     return(false);
 }
Esempio n. 7
0
 private async Task <bool> ImpulseDrive()
 {
     if (Actionmanager.HasSpell(MySpells.Disembowel.Name) &&
         !Core.Player.CurrentTarget.HasAura(MySpells.Disembowel.Name, false, 5000) ||
         Actionmanager.HasSpell(MySpells.ChaosThrust.Name) &&
         !Core.Player.CurrentTarget.HasAura(MySpells.ChaosThrust.Name, true, 5000))
     {
         return(await MySpells.ImpulseDrive.Cast());
     }
     return(false);
 }
Esempio n. 8
0
 private async Task <bool> KissOfTheWasp()
 {
     if (Ultima.UltSettings.RogueKissOfTheWasp ||
         !Actionmanager.HasSpell(MySpells.KissOfTheViper.Name))
     {
         if (!Core.Player.HasAura(MySpells.KissOfTheWasp.Name))
         {
             return(await MySpells.KissOfTheWasp.Cast());
         }
     }
     return(false);
 }
Esempio n. 9
0
 private async Task <bool> Mutilate()
 {
     if (!Actionmanager.HasSpell(MySpells.ShadowFang.Name) ||
         Core.Player.CurrentTarget.HasAura(MySpells.ShadowFang.Name, true, 4000))
     {
         if (!Core.Player.CurrentTarget.HasAura("Mutilation", true, 4000))
         {
             return(await MySpells.Mutilate.Cast());
         }
     }
     return(false);
 }
Esempio n. 10
0
 private async Task <bool> SwordOath()
 {
     if (Ultima.UltSettings.PaladinSwordOath ||
         !Actionmanager.HasSpell(MySpells.ShieldOath.Name))
     {
         if (!Core.Player.HasAura(MySpells.SwordOath.Name))
         {
             return(await MySpells.SwordOath.Cast());
         }
     }
     return(false);
 }
Esempio n. 11
0
 private async Task <bool> HawksEye()
 {
     if (Core.Player.HasAura(MySpells.CrossClass.BloodForBlood.Name))
     {
         return(await MySpells.HawksEye.Cast());
     }
     if (!Actionmanager.HasSpell(MySpells.CrossClass.BloodForBlood.Name))
     {
         return(await MySpells.HawksEye.Cast());
     }
     return(false);
 }
Esempio n. 12
0
 private async Task <bool> Summon()
 {
     if (Core.Player.Pet == null &&
         Ultima.UltSettings.ScholarSummonPet)
     {
         if (Ultima.UltSettings.ScholarEos ||
             !Actionmanager.HasSpell(MySpells.SummonII.Name))
         {
             return(await MySpells.Summon.Cast());
         }
     }
     return(false);
 }
Esempio n. 13
0
 private async Task <bool> Summon()
 {
     if (Core.Player.Pet == null &&
         Ultima.UltSettings.ArcanistSummonPet)
     {
         if (Ultima.UltSettings.ArcanistEmeraldCarbuncle ||
             !Actionmanager.HasSpell(MySpells.SummonII.Name))
         {
             return(await MySpells.Summon.Cast());
         }
     }
     return(false);
 }
Esempio n. 14
0
 private async Task <bool> Reassemble()
 {
     if (Core.Player.HasAura(862))
     {
         if (Core.Player.HasAura(857) ||
             !Actionmanager.HasSpell(MySpells.CleanShot.Name) &&
             Core.Player.HasAura(856))
         {
             return(await MySpells.Reassemble.Cast());
         }
     }
     return(false);
 }
Esempio n. 15
0
        private async Task <bool> Huton()
        {
            if (Actionmanager.CanCast(MySpells.Jin.ID, Core.Player))
            {
                if (!Core.Player.HasAura(MySpells.Huton.Name) &&
                    DataManager.GetSpellData(2240).Cooldown.TotalMilliseconds <= DataManager.GetSpellData(2240).AdjustedCooldown.TotalMilliseconds - 1000 ||
                    !Actionmanager.HasSpell(MySpells.ArmorCrush.Name) &&
                    !Core.Player.HasAura(MySpells.Huton.Name, true, 20000) &&
                    DataManager.GetSpellData(2240).Cooldown.TotalMilliseconds <= DataManager.GetSpellData(2240).AdjustedCooldown.TotalMilliseconds - 1000 ||
                    Core.Player.HasAura("Mudra"))
                {
                    if (!Actionmanager.CanCast(MySpells.Ninjutsu.ID, Core.Player) &&
                        Ultima.LastSpell.ID != MySpells.Ten.ID &&
                        Ultima.LastSpell.ID != MySpells.Jin.ID &&
                        Ultima.LastSpell.ID != MySpells.Ninjutsu.ID)
                    {
                        if (await MySpells.Chi.Cast())
                        {
                            await Coroutine.Wait(2000, () => Actionmanager.CanCast(MySpells.Ninjutsu.ID, Core.Player));
                        }
                    }
                    if (Actionmanager.CanCast(MySpells.Ninjutsu.ID, Core.Player) &&
                        Ultima.LastSpell.ID == MySpells.Chi.ID)
                    {
                        if (await MySpells.Jin.Cast())
                        {
                            await Coroutine.Wait(2000, () => Actionmanager.CanCast(MySpells.Jin.ID, Core.Player));
                        }
                    }
                    if (Ultima.LastSpell.ID == MySpells.Jin.ID)
                    {
                        if (await MySpells.Ten.Cast())
                        {
                            await Coroutine.Wait(2000, () => Actionmanager.CanCast(MySpells.Ten.ID, Core.Player));
                        }
                    }
                    if (Ultima.LastSpell.ID == MySpells.Ten.ID ||
                        Ultima.LastSpell.ID == MySpells.Huton.ID)
                    {
                        if (await MySpells.Huton.Cast())
                        {
                            await Coroutine.Wait(2000, () => !Core.Player.HasAura("Mudra"));

                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 16
0
 private async Task <bool> Berserk()
 {
     if (Core.Player.HasAura(MySpells.Maim.Name, true, 4000))
     {
         if (!Actionmanager.HasSpell(MySpells.StormsEye.Name) ||
             Actionmanager.HasSpell(MySpells.StormsEye.Name) &&
             (Core.Player.CurrentTarget.HasAura(MySpells.StormsEye.Name, false, 8000) ||
              Core.Player.CurrentTarget.HasAura("Dancing Edge")))
         {
             return(await MySpells.Berserk.Cast());
         }
     }
     return(false);
 }
Esempio n. 17
0
 private async Task <bool> Blizzard()
 {
     if (UmbralAura &&
         Core.Player.CurrentManaPercent < 90)
     {
         return(await MySpells.Blizzard.Cast());
     }
     if (!UmbralAura &&
         LowMP &&
         !Actionmanager.HasSpell(MySpells.BlizzardIII.Name))
     {
         return(await MySpells.Blizzard.Cast());
     }
     return(false);
 }
Esempio n. 18
0
 private async Task <bool> Summon()
 {
     if (Core.Player.Pet == null &&
         Ultima.UltSettings.SummonerSummonPet)
     {
         if (Ultima.UltSettings.SummonerGaruda ||
             !Actionmanager.HasSpell(MySpells.SummonII.Name) &&
             Ultima.UltSettings.SummonerTitan ||
             !Actionmanager.HasSpell(MySpells.SummonIII.Name) &&
             Ultima.UltSettings.SummonerIfrit)
         {
             return(await MySpells.Summon.Cast());
         }
     }
     return(false);
 }
Esempio n. 19
0
 private async Task <bool> EnergyDrain()
 {
     if (Core.Player.HasAura(MySpells.Aetherflow.Name))
     {
         if (Core.Player.CurrentManaPercent <= 90 &&
             !Actionmanager.HasSpell(MySpells.Fester.Name))
         {
             return(await MySpells.EnergyDrain.Cast());
         }
         if (Core.Player.CurrentManaPercent <= 40)
         {
             return(await MySpells.EnergyDrain.Cast());
         }
     }
     return(false);
 }
Esempio n. 20
0
 private async Task <bool> Maim()
 {
     if (Actionmanager.LastSpell.Name == MySpells.HeavySwing.Name)
     {
         if (!Core.Player.HasAura(MySpells.Maim.Name, true, 4000) ||
             Actionmanager.HasSpell(MySpells.StormsEye.Name) &&
             !Core.Player.CurrentTarget.HasAura(MySpells.StormsEye.Name, false, 8000) &&
             !Core.Player.CurrentTarget.HasAura("Dancing Edge") ||
             Actionmanager.HasSpell(MySpells.StormsPath.Name) &&
             !Core.Player.CurrentTarget.HasAura(MySpells.StormsPath.Name, false, 8000))
         {
             return(await MySpells.Maim.Cast());
         }
     }
     return(false);
 }
Esempio n. 21
0
 private async Task <bool> Fire()
 {
     if (!Actionmanager.HasSpell(MySpells.FireIII.Name))
     {
         if (UmbralAura &&
             Core.Player.CurrentManaPercent >= 90)
         {
             return(await MySpells.Fire.Cast());
         }
     }
     if (!UmbralAura)
     {
         return(await MySpells.Fire.Cast());
     }
     return(false);
 }
Esempio n. 22
0
 private async Task <bool> BloodForBlood()
 {
     if (Ultima.UltSettings.ArcherBloodForBlood)
     {
         if (Actionmanager.HasSpell(MySpells.Barrage.Name) &&
             Actionmanager.CanCast(MySpells.HawksEye.Name, Core.Player) &&
             Actionmanager.CanCast(MySpells.Barrage.Name, Core.Player))
         {
             return(await MySpells.CrossClass.BloodForBlood.Cast());
         }
         if (!Actionmanager.HasSpell(MySpells.Barrage.Name))
         {
             return(await MySpells.CrossClass.BloodForBlood.Cast());
         }
     }
     return(false);
 }
Esempio n. 23
0
 private async Task <bool> RookAutoturret()
 {
     if (Ultima.UltSettings.MachinistSummonTurret &&
         Core.Player.HasTarget &&
         Core.Player.CurrentTarget.CanAttack)
     {
         if (Ultima.UltSettings.MachinistRook ||
             !Actionmanager.HasSpell(MySpells.BishopAutoturret.Name))
         {
             if (Core.Player.Pet == null ||
                 Core.Player.Pet.Distance2D(Core.Player.CurrentTarget) - Core.Player.CurrentTarget.CombatReach - Core.Player.Pet.CombatReach > 20)
             {
                 return(await MySpells.RookAutoturret.Cast());
             }
         }
     }
     return(false);
 }
Esempio n. 24
0
 private async Task <bool> Mutilate()
 {
     if (Core.Player.HasAura(MySpells.Huton.Name) &&
         (!Actionmanager.HasSpell(MySpells.ShadowFang.Name) ||
          Core.Player.CurrentTarget.HasAura(MySpells.ShadowFang.Name, true, 5000)))
     {
         if (!Ultima.UltSettings.NinjaDancingEdge ||
             !Actionmanager.HasSpell(MySpells.DancingEdge.Name) ||
             (Core.Player.CurrentTarget.HasAura(MySpells.DancingEdge.Name, false, 6000) ||
              Core.Player.CurrentTarget.HasAura("Storm's Eye")))
         {
             if (!Core.Player.CurrentTarget.HasAura("Mutilation", true, 5000))
             {
                 return(await MySpells.Mutilate.Cast());
             }
         }
     }
     return(false);
 }
Esempio n. 25
0
 private async Task <bool> Souleater()
 {
     if (Actionmanager.LastSpell.Name == MySpells.SyphonStrike.Name)
     {
         if (Ultima.UltSettings.DarkKnightDarkArts &&
             !Core.Player.HasAura(MySpells.DarkArts.Name) &&
             Core.Player.TargetDistance(3, false) &&
             Core.Player.CurrentManaPercent >= 50 &&
             (!Actionmanager.HasSpell(MySpells.Delirium.Name) ||
              Core.Player.CurrentTarget.HasAura(MySpells.Delirium.Name, false, 4000) ||
              Core.Player.CurrentTarget.HasAura("Dragon Kick")))
         {
             if (await MySpells.DarkArts.Cast())
             {
                 await Coroutine.Wait(3000, () => Actionmanager.CanCast(MySpells.Souleater.Name, Core.Player.CurrentTarget));
             }
         }
         return(await MySpells.Souleater.Cast());
     }
     return(false);
 }
Esempio n. 26
0
 private async Task <bool> Scathe()
 {
     if (MovementManager.IsMoving &&
         !LowMP &&
         !Core.Player.HasAura(MySpells.Swiftcast.Name))
     {
         return(await MySpells.Scathe.Cast());
     }
     if (Actionmanager.HasSpell(MySpells.BlizzardIII.Name) &&
         UmbralAura &&
         Core.Player.CurrentManaPercent < 100)
     {
         if (Ultima.LastSpell.Name == MySpells.Blizzard.Name ||
             Ultima.LastSpell.Name == MySpells.Thunder.Name ||
             Ultima.LastSpell.Name == MySpells.ThunderII.Name ||
             Ultima.LastSpell.Name == MySpells.ThunderIII.Name)
         {
             return(await MySpells.Scathe.Cast());
         }
     }
     return(false);
 }
Esempio n. 27
0
        private async Task <bool> BlizzardIII()
        {
            if (LowMP)
            {
                if (AstralAura)
                {
                    if (!Actionmanager.HasSpell(MySpells.Flare.Name))
                    {
                        if (await MySpells.BlizzardIII.Cast())
                        {
                            await Coroutine.Wait(5000, () => UmbralAura);

                            return(true);
                        }
                    }
                    if (!Actionmanager.CanCast(MySpells.Swiftcast.Name, Core.Player) ||
                        !Actionmanager.CanCast(MySpells.Convert.Name, Core.Player))
                    {
                        if (await MySpells.BlizzardIII.Cast())
                        {
                            await Coroutine.Wait(5000, () => UmbralAura);

                            return(true);
                        }
                    }
                }
                if (!AstralAura &&
                    !UmbralAura)
                {
                    if (await MySpells.BlizzardIII.Cast())
                    {
                        await Coroutine.Wait(5000, () => UmbralAura);

                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 28
0
        private async Task <bool> Fracture()
        {
            if (!Core.Player.CurrentTarget.HasAura(MySpells.Fracture.Name, true, 4000))
            {
                if (!Actionmanager.HasSpell(MySpells.StormsEye.Name) &&
                    !Actionmanager.HasSpell(MySpells.StormsPath.Name) ||

                    !Actionmanager.HasSpell(MySpells.StormsEye.Name) &&
                    Core.Player.CurrentTarget.HasAura(MySpells.StormsPath.Name, false, 8000) ||

                    !Actionmanager.HasSpell(MySpells.StormsPath.Name) &&
                    (Core.Player.CurrentTarget.HasAura(MySpells.StormsEye.Name, false, 8000) ||
                     Core.Player.CurrentTarget.HasAura("Dancing Edge")) ||

                    (Core.Player.CurrentTarget.HasAura(MySpells.StormsEye.Name, false, 8000) ||
                     Core.Player.CurrentTarget.HasAura("Dancing Edge")) &&
                    Core.Player.CurrentTarget.HasAura(MySpells.StormsPath.Name, false, 8000))
                {
                    return(await MySpells.Fracture.Cast());
                }
            }
            return(false);
        }
Esempio n. 29
0
        public async Task <bool> Cast(GameObject target = null)
        {
            #region Target
            if (target == null)
            {
                switch (CastType)
                {
                case CastType.TargetLocation:
                    if (!Core.Player.HasTarget)
                    {
                        return(false);
                    }
                    target = Core.Player.CurrentTarget;
                    break;

                case CastType.Target:
                    if (!Core.Player.HasTarget)
                    {
                        return(false);
                    }
                    target = Core.Player.CurrentTarget;
                    break;

                default:
                    target = Core.Player;
                    break;
                }
            }
            #endregion

            #region Recent Spell Check
            RecentSpell.RemoveAll(t => DateTime.UtcNow > t);

            if (RecentSpell.ContainsKey(target.ObjectId.ToString("X") + "-" + Name))
            {
                return(false);
            }
            #endregion

            #region Bard Song Check

            if (Core.Player.CurrentJob == ClassJobType.Bard &&
                SpellType == SpellType.Buff)
            {
                if (Core.Player.HasAura(135, true) ||
                    Core.Player.HasAura(137, true))
                {
                    return(false);
                }
            }

            #endregion

            #region AoE Check

            if (SpellType == SpellType.AoE &&
                Ultima.UltSettings.SmartTarget)
            {
                var EnemyCount = Helpers.EnemyUnit.Count(eu => eu.Distance2D(target) - eu.CombatReach - target.CombatReach <= DataManager.GetSpellData(ID).Radius);

                switch (Core.Player.CurrentJob)
                {
                case ClassJobType.Arcanist:
                case ClassJobType.Scholar:
                case ClassJobType.Summoner:
                    if (EnemyCount < 2)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Archer:
                case ClassJobType.Bard:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Astrologian:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Conjurer:
                case ClassJobType.WhiteMage:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.DarkKnight:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Gladiator:
                case ClassJobType.Paladin:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Lancer:
                case ClassJobType.Dragoon:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Machinist:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Marauder:
                case ClassJobType.Warrior:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Pugilist:
                case ClassJobType.Monk:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Rogue:
                case ClassJobType.Ninja:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Thaumaturge:
                case ClassJobType.BlackMage:
                    if (EnemyCount < 3)
                    {
                        return(false);
                    }
                    break;
                }
            }

            #region Cone Check

            if (ID == 106 || ID == 41 || ID == 70)
            {
                if (!Helpers.InView(Core.Player.Location, Core.Player.Heading, target.Location))
                {
                    return(false);
                }
            }

            #endregion

            #region Rectangle Check

            if (ID == 86)
            {
                if (!Core.Player.IsFacing(target))
                {
                    return(false);
                }
            }

            #endregion

            #endregion

            #region Pet Exception
            if (SpellType == SpellType.Pet)
            {
                if (Core.Player.Pet == null)
                {
                    return(false);
                }

                if (Pet.PetMode != PetMode.Obey)
                {
                    if (!await Coroutine.Wait(1000, () => Pet.DoAction("Obey", Core.Player)))
                    {
                        return(false);
                    }
                    Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: Pet Obey");
                }

                #region IsMounted Check

                if (Core.Player.IsMounted)
                {
                    return(false);
                }

                #endregion

                #region CanCast

                if (!Pet.CanCast(Name, target))
                {
                    return(false);
                }

                #endregion

                #region DoAction

                if (!await Coroutine.Wait(5000, () => Pet.DoAction(Name, target)))
                {
                    return(false);
                }

                #endregion

                Ultima.LastSpell = this;

                #region Recent Spell Add
                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + DataManager.GetSpellData(Name).AdjustedCastTime + TimeSpan.FromSeconds(5);
                RecentSpell.Add(key, val);
                #endregion

                Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: " + Name);

                return(true);
            }
            #endregion

            #region Card Exception

            if (SpellType == SpellType.Card)
            {
                if (!await Coroutine.Wait(1000, () => Actionmanager.DoAction(ID, target)))
                {
                    return(false);
                }
                Ultima.LastSpell = this;
                #region Recent Spell Add
                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + DataManager.GetSpellData(3590).AdjustedCastTime + TimeSpan.FromSeconds(5);
                RecentSpell.Add(key, val);
                #endregion
                Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: " + Name);
                return(true);
            }

            #endregion

            #region CanAttack Check

            if (!target.CanAttack &&
                CastType != CastType.Self)
            {
                switch (SpellType)
                {
                case SpellType.Damage:
                case SpellType.DoT:
                case SpellType.Movement:
                case SpellType.Cooldown:
                case SpellType.Interrupt:
                case SpellType.Execute:
                case SpellType.Knockback:
                case SpellType.Debuff:
                case SpellType.Flank:
                case SpellType.Behind:
                    return(false);
                }
            }

            #endregion

            #region Ninjutsu Exception

            if (SpellType == SpellType.Ninjutsu ||
                SpellType == SpellType.Mudra)
            {
                #region Player Movement

                if (BotManager.Current.IsAutonomous)
                {
                    switch (Actionmanager.InSpellInRangeLOS(2247, target))
                    {
                    case SpellRangeCheck.ErrorNotInLineOfSight:
                        Navigator.MoveTo(target.Location);
                        return(false);

                    case SpellRangeCheck.ErrorNotInRange:
                        Navigator.MoveTo(target.Location);
                        return(false);

                    case SpellRangeCheck.ErrorNotInFront:
                        if (!target.InLineOfSight())
                        {
                            Navigator.MoveTo(target.Location);
                            return(false);
                        }
                        target.Face();
                        return(false);

                    case SpellRangeCheck.Success:
                        if (MovementManager.IsMoving)
                        {
                            Navigator.PlayerMover.MoveStop();
                        }
                        break;
                    }
                }

                #endregion

                #region IsMounted Check

                if (Core.Player.IsMounted)
                {
                    return(false);
                }

                #endregion

                #region CanCast

                if (Ultima.UltSettings.QueueSpells)
                {
                    if (!Actionmanager.CanCastOrQueue(DataManager.GetSpellData(ID), target))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!Actionmanager.CanCast(ID, target))
                    {
                        return(false);
                    }
                }

                #endregion

                #region Wait For Animation

                if (Ultima.LastSpell.ID != null &&
                    Ultima.LastSpell.SpellType != SpellType.Ninjutsu &&
                    Ultima.LastSpell.SpellType != SpellType.Mudra)
                {
                    await Coroutine.Wait(1000, () => DataManager.GetSpellData(Ultima.LastSpell.ID).Cooldown.TotalMilliseconds <= DataManager.GetSpellData(Ultima.LastSpell.ID).AdjustedCooldown.TotalMilliseconds - 1000);
                }

                #endregion

                #region DoAction

                if (!await Coroutine.Wait(1000, () => Actionmanager.DoAction(ID, target)))
                {
                    return(false);
                }

                #endregion

                #region Wait For Cast Completion

                await Coroutine.Wait(2000, () => !Actionmanager.CanCast(ID, target));

                #endregion

                Ultima.LastSpell = this;

                #region Recent Spell Add

                if (SpellType == SpellType.Mudra)
                {
                    var key = target.ObjectId.ToString("X") + "-" + Name;
                    var val = DateTime.UtcNow + DataManager.GetSpellData(ID).AdjustedCastTime + TimeSpan.FromSeconds(1);
                    RecentSpell.Add(key, val);
                }

                #endregion

                Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: " + Name);

                return(true);
            }

            #endregion

            #region HasSpell Check

            if (!Actionmanager.HasSpell(ID))
            {
                return(false);
            }

            #endregion

            #region Player Movement

            if (BotManager.Current.IsAutonomous)
            {
                switch (Actionmanager.InSpellInRangeLOS(ID, target))
                {
                case SpellRangeCheck.ErrorNotInLineOfSight:
                    Navigator.MoveTo(target.Location);
                    return(false);

                case SpellRangeCheck.ErrorNotInRange:
                    Navigator.MoveTo(target.Location);
                    return(false);

                case SpellRangeCheck.ErrorNotInFront:
                    if (!target.InLineOfSight())
                    {
                        Navigator.MoveTo(target.Location);
                        return(false);
                    }
                    target.Face();
                    return(false);

                case SpellRangeCheck.Success:
                    if (CastType == CastType.TargetLocation &&
                        Core.Player.Distance2D(target) + Core.Player.CombatReach + target.CombatReach > 25)
                    {
                        Navigator.MoveTo(target.Location);
                        await Coroutine.Wait(1000, () => Core.Player.Distance2D(target) + Core.Player.CombatReach + target.CombatReach <= 25);

                        return(false);
                    }
                    Navigator.PlayerMover.MoveStop();
                    break;
                }

                if (Core.Player.HasTarget &&
                    !MovementManager.IsMoving &&
                    Core.Player.IsMounted)
                {
                    Logging.Write(Colors.Yellow, @"[Ultima] Dismounting...");
                    Actionmanager.Dismount();
                    await Coroutine.Sleep(1000);
                }
            }

            #endregion

            #region IsMounted Check

            if (Core.Player.IsMounted)
            {
                return(false);
            }

            #endregion

            #region CanCast Check

            switch (CastType)
            {
            case CastType.TargetLocation:
            case CastType.SelfLocation:
                if (!Actionmanager.CanCastLocation(ID, target.Location))
                {
                    return(false);
                }
                break;

            default:
                if (Ultima.UltSettings.QueueSpells)
                {
                    if (!Actionmanager.CanCastOrQueue(DataManager.GetSpellData(ID), target))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!Actionmanager.CanCast(ID, target))
                    {
                        return(false);
                    }
                }
                break;
            }

            if (MovementManager.IsMoving &&
                DataManager.GetSpellData(ID).AdjustedCastTime.TotalMilliseconds > 0)
            {
                if (!BotManager.Current.IsAutonomous)
                {
                    return(false);
                }
                Navigator.PlayerMover.MoveStop();
            }

            #endregion

            #region InView Check

            if (GameSettingsManager.FaceTargetOnAction == false &&
                CastType == CastType.Target &&
                SpellType != SpellType.Heal &&
                SpellType != SpellType.Defensive &&
                !Helpers.InView(Core.Player.Location, Core.Player.Heading, target.Location))
            {
                return(false);
            }

            #endregion

            #region Off-GCD Check
            if (GCDType == GCDType.Off)
            {
                switch (Core.Player.CurrentJob)
                {
                case ClassJobType.Arcanist:
                case ClassJobType.Scholar:
                case ClassJobType.Summoner:
                    if (Core.Player.ClassLevel >= 38 &&
                        Core.Player.CurrentManaPercent > 40 &&
                        DataManager.GetSpellData(163).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Archer:
                case ClassJobType.Bard:
                    if (DataManager.GetSpellData(97).Cooldown.TotalMilliseconds <= 700)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Astrologian:
                    if (DataManager.GetSpellData(3596).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Conjurer:
                case ClassJobType.WhiteMage:
                    if (DataManager.GetSpellData(119).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.DarkKnight:
                    if (DataManager.GetSpellData(3617).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Gladiator:
                case ClassJobType.Paladin:
                    if (DataManager.GetSpellData(9).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Lancer:
                case ClassJobType.Dragoon:
                    if (DataManager.GetSpellData(75).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Machinist:
                    if (DataManager.GetSpellData(2866).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Marauder:
                case ClassJobType.Warrior:
                    if (DataManager.GetSpellData(31).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Pugilist:
                case ClassJobType.Monk:
                    if (DataManager.GetSpellData(53).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Rogue:
                case ClassJobType.Ninja:
                    if (DataManager.GetSpellData(2240).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;

                case ClassJobType.Thaumaturge:
                case ClassJobType.BlackMage:
                    if (DataManager.GetSpellData(142).Cooldown.TotalMilliseconds <= 1000)
                    {
                        return(false);
                    }
                    break;
                }
            }
            #endregion

            #region Cleric Stance Check

            if (Actionmanager.HasSpell(122))
            {
                switch (Core.Player.HasAura("Cleric Stance"))
                {
                case true:
                    if (SpellType == SpellType.Heal)
                    {
                        await Coroutine.Wait(1000, () => Actionmanager.DoAction(122, Core.Player));

                        Logging.Write(Colors.OrangeRed, @"[Ultima] Removing Cleric Stance");
                        await Coroutine.Wait(3000, () => !Core.Player.HasAura(145));
                    }
                    break;

                case false:
                    if (SpellType == SpellType.Damage ||
                        SpellType == SpellType.DoT)
                    {
                        await Coroutine.Wait(1000, () => Actionmanager.DoAction(122, Core.Player));

                        Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: Cleric Stance");
                        await Coroutine.Wait(3000, () => Core.Player.HasAura(145));
                    }
                    break;
                }
            }

            #endregion

            #region DoAction
            switch (CastType)
            {
            case CastType.TargetLocation:
                if (Ultima.UltSettings.RandomCastLocation)
                {
                    var rndx   = (target.CombatReach * _rnd.NextDouble() * GetMultiplier());
                    var rndz   = (target.CombatReach * _rnd.NextDouble() * GetMultiplier());
                    var rndxz  = new Vector3((float)rndx, 0f, (float)rndz);
                    var tarloc = target.Location;
                    var rndloc = tarloc + rndxz;

                    if (!await Coroutine.Wait(1000, () => Actionmanager.DoActionLocation(ID, rndloc)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!await Coroutine.Wait(1000, () => Actionmanager.DoActionLocation(ID, target.Location)))
                    {
                        return(false);
                    }
                }
                break;

            case CastType.SelfLocation:
                if (Ultima.UltSettings.RandomCastLocation)
                {
                    var rndx   = ((1f * _rnd.NextDouble() + 1f) * GetMultiplier());
                    var rndz   = ((1f * _rnd.NextDouble() + 1f) * GetMultiplier());
                    var rndxz  = new Vector3((float)rndx, 0f, (float)rndz);
                    var tarloc = target.Location;
                    var rndloc = tarloc + rndxz;

                    if (!await Coroutine.Wait(1000, () => Actionmanager.DoActionLocation(ID, rndloc)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!await Coroutine.Wait(1000, () => Actionmanager.DoActionLocation(ID, target.Location)))
                    {
                        return(false);
                    }
                }
                break;

            default:
                if (!await Coroutine.Wait(1000, () => Actionmanager.DoAction(ID, target)))
                {
                    return(false);
                }
                break;
            }
            #endregion

            #region Wait For Cast Completion

            switch (CastType)
            {
            case CastType.SelfLocation:
            case CastType.TargetLocation:
                await Coroutine.Wait(3000, () => !Actionmanager.CanCastLocation(ID, target.Location));

                break;

            default:
                await Coroutine.Wait(3000, () => !Actionmanager.CanCast(ID, target));

                break;
            }

            #endregion

            Ultima.LastSpell = this;

            #region Recent Spell Add
            if (SpellType != SpellType.Damage &&
                SpellType != SpellType.Heal &&
                SpellType != SpellType.AoE &&
                SpellType != SpellType.Behind &&
                SpellType != SpellType.Flank)
            {
                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + DataManager.GetSpellData(ID).AdjustedCastTime + TimeSpan.FromSeconds(5);
                RecentSpell.Add(key, val);
            }
            if (SpellType == SpellType.Heal)
            {
                var key = target.ObjectId.ToString("X") + "-" + Name;
                var val = DateTime.UtcNow + DataManager.GetSpellData(ID).AdjustedCastTime + TimeSpan.FromSeconds(3);
                RecentSpell.Add(key, val);
            }
            #endregion

            Logging.Write(Colors.OrangeRed, @"[Ultima] Ability: " + Name);

            return(true);
        }