Exemple #1
0
        private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancelable)
        {
            float minDistance = RangeManager.GetMeleeRangeWithTarget() + 3f;

            // Do we need to backup?
            if ((ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                ObjectManager.Target.GetDistance < minDistance &&
                Me.IsAlive &&
                ObjectManager.Target.IsAlive &&
                !cast.IsBackingUp &&
                !Me.IsCast &&
                !RangeManager.CurrentRangeIsMelee() &&
                ObjectManager.Target.HealthPercent > 5 &&
                !_isPolymorphing)
            {
                cast.IsBackingUp = true;
                Timer timer = new Timer(3000);

                // Using CTM
                if (settings.BackupUsingCTM)
                {
                    Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 15f);
                    MovementManager.Go(PathFinder.FindPath(position), false);
                    Thread.Sleep(500);

                    // Backup loop
                    while (MovementManager.InMoveTo &&
                           Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Target.GetDistance < minDistance &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                           !timer.IsReady)
                    {
                        // Wait follow path
                        Thread.Sleep(300);
                        if (settings.BlinkWhenBackup)
                        {
                            cast.OnSelf(Blink);
                        }
                    }
                    MovementManager.StopMove();
                    Thread.Sleep(500);
                }
                // Using Keyboard
                else
                {
                    while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           ObjectManager.Target.GetDistance < minDistance &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                           !timer.IsReady)
                    {
                        Move.Backward(Move.MoveAction.PressKey, 500);
                    }
                }
                cast.IsBackingUp = false;
            }

            // Polymorph
            if (settings.UsePolymorph &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                Polymorph.KnownSpell &&
                !cast.IsBackingUp &&
                !cast.IsApproachingTarget &&
                specialization.RotationType != Enums.RotationType.Party &&
                _polymorphableEnemyInThisFight)
            {
                WoWUnit myNearbyPolymorphed = null;
                // Detect if a polymorph cast has succeeded
                if (_polymorphedEnemy != null)
                {
                    myNearbyPolymorphed = ObjectManager.GetObjectWoWUnit().Find(u => u.HaveBuff("Polymorph") && u.Guid == _polymorphedEnemy.Guid);
                }

                // If we don't have a polymorphed enemy
                if (myNearbyPolymorphed == null)
                {
                    _polymorphedEnemy = null;
                    _isPolymorphing   = true;
                    WoWUnit firstTarget = ObjectManager.Target;
                    WoWUnit potentialPolymorphTarget = null;

                    // Select our attackers one by one for potential polymorphs
                    foreach (WoWUnit enemy in ObjectManager.GetUnitAttackPlayer())
                    {
                        Interact.InteractGameObject(enemy.GetBaseAddress);

                        if ((enemy.CreatureTypeTarget == "Beast" || enemy.CreatureTypeTarget == "Humanoid") &&
                            enemy.Guid != firstTarget.Guid)
                        {
                            potentialPolymorphTarget = enemy;
                            break;
                        }
                    }

                    if (potentialPolymorphTarget == null)
                    {
                        _polymorphableEnemyInThisFight = false;
                    }

                    // Polymorph cast
                    if (potentialPolymorphTarget != null &&
                        _polymorphedEnemy == null &&
                        cast.OnFocusUnit(Polymorph, potentialPolymorphTarget))
                    {
                        Usefuls.WaitIsCasting();
                        _polymorphedEnemy = potentialPolymorphTarget;
                    }

                    _isPolymorphing = false;
                }
            }
        }
        protected override void CombatRotation()
        {
            base.CombatRotation();

            WoWUnit Target               = ObjectManager.Target;
            bool    _isPoisoned          = ToolBox.HasPoisonDebuff();
            bool    _hasDisease          = ToolBox.HasDiseaseDebuff();
            bool    _shouldBeInterrupted = false;

            // Remove Ghost Wolf
            if (Me.HaveBuff("Ghost Wolf") &&
                cast.OnSelf(GhostWolf))
            {
                return;
            }

            // Healing Wave + Lesser Healing Wave
            if (Me.HealthPercent < settings.HealThreshold &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 25))
            {
                if (cast.OnSelf(LesserHealingWave) || cast.OnSelf(HealingWave))
                {
                    return;
                }
            }

            // Cure Poison
            if (settings.CurePoison &&
                _isPoisoned &&
                CurePoison.KnownSpell &&
                Me.ManaPercentage > _lowManaThreshold)
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(CurePoison))
                {
                    return;
                }
            }

            // Cure Disease
            if (settings.CureDisease &&
                _hasDisease &&
                CureDisease.KnownSpell &&
                Me.ManaPercentage > _lowManaThreshold)
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(CureDisease))
                {
                    return;
                }
            }

            // Bloodlust
            if (!Me.HaveBuff("Bloodlust") &&
                Target.HealthPercent > 80 &&
                cast.OnSelf(Bloodlust))
            {
                return;
            }

            // Water Shield
            if (!Me.HaveBuff("Water Shield") &&
                !Me.HaveBuff("Lightning Shield") &&
                (settings.UseWaterShield || !settings.UseLightningShield || Me.ManaPercentage <= _lowManaThreshold) &&
                cast.OnSelf(WaterShield))
            {
                return;
            }

            // Lightning Shield
            if (Me.ManaPercentage > _lowManaThreshold &&
                !Me.HaveBuff("Lightning Shield") &&
                !Me.HaveBuff("Water Shield") &&
                settings.UseLightningShield &&
                (!WaterShield.KnownSpell || !settings.UseWaterShield) &&
                cast.OnTarget(LightningShield))
            {
                return;
            }

            // Check if we need to interrupt
            int channelTimeLeft = Lua.LuaDoString <int>(@"local spell, _, _, _, endTimeMS = UnitChannelInfo('target')
                                    if spell then
                                     local finish = endTimeMS / 1000 - GetTime()
                                     return finish
                                    end");

            if (channelTimeLeft < 0 || Target.CastingTimeLeft > ToolBox.GetLatency())
            {
                _shouldBeInterrupted = true;
            }

            // Earth Shock Interupt
            if (_shouldBeInterrupted)
            {
                if (!_casterEnemies.Contains(Target.Name))
                {
                    _casterEnemies.Add(Target.Name);
                }
                _fightingACaster = true;
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnTarget(EarthShock))
                {
                    return;
                }
            }

            // Frost Shock
            if ((Target.CreatureTypeTarget == "Humanoid" || Target.Name.Contains("Plainstrider")) &&
                settings.ENFrostShockHumanoids &&
                Target.HealthPercent < 40 &&
                !Target.HaveBuff("Frost Shock") &&
                !Me.HaveBuff("Focused Casting") &&
                cast.OnTarget(FrostShock))
            {
                return;
            }

            // Totems
            if (Me.ManaPercentage > _lowManaThreshold &&
                Target.GetDistance < 20 &&
                _totemManager.CastTotems(specialization))
            {
                return;
            }

            // Chain Lightning
            if (settings.ELChainLightningOnMulti &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                Me.ManaPercentage > 20 &&
                cast.OnTarget(ChainLightning))
            {
                return;
            }

            // Earth Shock DPS
            if (Target.GetDistance < 19f &&
                (!FlameShock.KnownSpell || !settings.UseFlameShock) &&
                !_fightingACaster &&
                Target.HealthPercent > 25 &&
                Me.ManaPercentage > settings.ELShockDPSMana &&
                !Me.HaveBuff("Focused Casting") &&
                cast.OnTarget(EarthShock))
            {
                return;
            }

            // Flame Shock DPS
            if (Target.GetDistance < 19f &&
                !Target.HaveBuff("Flame Shock") &&
                Target.HealthPercent > 20 &&
                !_fightingACaster &&
                settings.UseFlameShock &&
                Me.ManaPercentage > settings.ELShockDPSMana &&
                !Me.HaveBuff("Focused Casting") &&
                cast.OnTarget(FlameShock))
            {
                return;
            }

            // Lightning Bolt
            if (ObjectManager.Target.GetDistance <= _pullRange &&
                (Target.HealthPercent > settings.ELLBHealthThreshold || Me.HaveBuff("Clearcasting") || Me.HaveBuff("Focused Casting")) &&
                Me.ManaPercentage > 15 &&
                cast.OnTarget(LightningBolt))
            {
                return;
            }

            // Default melee
            if (!RangeManager.CurrentRangeIsMelee())
            {
                Logger.Log("Going in melee because nothing else to do");
                RangeManager.SetRangeToMelee();
            }
        }
        protected override void CombatRotation()
        {
            // Reactivate auto attack (after dragon's breath)
            if (!ToolBox.UsingWand())
            {
                ToolBox.CheckAutoAttack(Attack);
            }

            base.CombatRotation();
            WoWUnit Target = ObjectManager.Target;

            // Stop wand use on multipull
            if (_iCanUseWand && ObjectManager.GetNumberAttackPlayer() > 1)
            {
                _iCanUseWand = false;
            }

            // Remove Curse
            if (ToolBox.HasCurseDebuff())
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(RemoveCurse))
                {
                    return;
                }
            }

            // Mana Shield
            if (!Me.HaveBuff("Mana Shield") &&
                (Me.HealthPercent < 30 && Me.ManaPercentage > 50 ||
                 Me.HealthPercent < 10) &&
                cast.OnTarget(ManaShield))
            {
                return;
            }

            // Use Mana Stone
            if ((ObjectManager.GetNumberAttackPlayer() > 1 && Me.ManaPercentage < 50 || Me.ManaPercentage < 5) &&
                _foodManager.UseManaStone())
            {
                return;
            }

            // Combustion
            if (!Me.HaveBuff("Combustion") &&
                cast.OnSelf(Combustion))
            {
                return;
            }

            // Blast Wave
            if (settings.BlastWaveOnMulti &&
                ToolBox.GetNbEnemiesClose(10) > 1 &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                cast.OnSelf(BlastWave))
            {
                return;
            }

            // Dragon's Breath
            if (Target.GetDistance <= 10f &&
                settings.UseDragonsBreath &&
                (Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                _polymorphedEnemy == null &&
                cast.OnSelf(DragonsBreath))
            {
                return;
            }

            // Fire Blast
            if (Target.HealthPercent <= settings.FireblastThreshold &&
                (Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                !Target.HaveBuff("Polymorph") &&
                cast.OnTarget(FireBlast))
            {
                return;
            }

            // Cone of Cold
            if (Target.GetDistance < 10 &&
                settings.UseConeOfCold &&
                _polymorphedEnemy == null &&
                cast.OnTarget(ConeOfCold))
            {
                return;
            }

            // FireBall
            if ((Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                !Target.HaveBuff("Polymorph") &&
                cast.OnTarget(Fireball))
            {
                return;
            }

            // Stop wand if banned
            if (ToolBox.UsingWand() &&
                UnitImmunities.Contains(ObjectManager.Target, "Shoot"))
            {
                if (cast.OnTarget(UseWand))
                {
                    return;
                }
            }

            // Spell if wand banned
            if (UnitImmunities.Contains(ObjectManager.Target, "Shoot"))
            {
                if (cast.OnTarget(Fireball) || cast.OnTarget(Frostbolt) || cast.OnTarget(ArcaneMissiles))
                {
                    return;
                }
            }

            // Use Wand
            if (!ToolBox.UsingWand() &&
                _iCanUseWand &&
                !cast.IsBackingUp &&
                !MovementManager.InMovement)
            {
                if (cast.OnTarget(UseWand, false))
                {
                    return;
                }
            }

            // Go in melee because nothing else to do
            if (!ToolBox.UsingWand() &&
                !UseWand.IsSpellUsable &&
                !RangeManager.CurrentRangeIsMelee() &&
                !cast.IsBackingUp &&
                Target.IsAlive)
            {
                Logger.Log("Going in melee");
                RangeManager.SetRangeToMelee();
                return;
            }
        }
        protected override void CombatRotation()
        {
            bool    _hasMagicDebuff     = ToolBox.HasMagicDebuff();
            bool    _hasDisease         = ToolBox.HasDiseaseDebuff();
            bool    _hasWeakenedSoul    = ToolBox.HasDebuff("Weakened Soul");
            double  _myManaPC           = Me.ManaPercentage;
            bool    _inShadowForm       = Me.HaveBuff("ShadowForm");
            int     _mindBlastCD        = Lua.LuaDoString <int>("local start, duration, enabled = GetSpellCooldown(\"Mind Blast\"); return start + duration - GetTime();");
            int     _innerFocusCD       = Lua.LuaDoString <int>("local start, duration, enabled = GetSpellCooldown(\"Inner Focus\"); return start + duration - GetTime();");
            bool    _shoulBeInterrupted = ToolBox.TargetIsCasting();
            WoWUnit Target = ObjectManager.Target;

            // Power Word Shield on multi aggro
            if (!Me.HaveBuff("Power Word: Shield") &&
                !_hasWeakenedSoul &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                settings.UsePowerWordShield &&
                cast.OnSelf(PowerWordShield))
            {
                return;
            }

            // Power Word Shield
            if (Me.HealthPercent < 50 &&
                !Me.HaveBuff("Power Word: Shield") &&
                !_hasWeakenedSoul &&
                settings.UsePowerWordShield &&
                cast.OnSelf(PowerWordShield))
            {
                return;
            }

            // Renew
            if (Me.HealthPercent < 70 &&
                !Me.HaveBuff("Renew") &&
                !_inShadowForm &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 25) &&
                cast.OnSelf(Renew))
            {
                return;
            }

            // Psychic Scream
            if (Me.HealthPercent < 50 &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                cast.OnSelf(PsychicScream))
            {
                return;
            }

            // Flash Heal
            if (Me.HealthPercent < 50 &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 25) &&
                cast.OnSelf(FlashHeal))
            {
                return;
            }

            // Heal
            if (Me.HealthPercent < 50 &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 25) &&
                cast.OnSelf(Heal))
            {
                return;
            }

            // Lesser Heal
            if (Me.HealthPercent < 50 &&
                !FlashHeal.KnownSpell &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 25) &&
                cast.OnSelf(LesserHeal))
            {
                return;
            }

            // Silence
            if (_shoulBeInterrupted)
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnTarget(Silence))
                {
                    return;
                }
            }

            // Cure Disease
            if (_hasDisease && !_inShadowForm)
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(CureDisease))
                {
                    return;
                }
            }

            // Dispel Magic self
            if (_hasMagicDebuff &&
                _myManaPC > 10 &&
                DispelMagic.KnownSpell &&
                DispelMagic.IsSpellUsable &&
                (_dispelTimer.ElapsedMilliseconds > 10000 || _dispelTimer.ElapsedMilliseconds <= 0))
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(DispelMagic))
                {
                    return;
                }
            }

            // Vampiric Touch
            if (!Target.HaveBuff("Vampiric Touch") &&
                _myManaPC > _innerManaSaveThreshold &&
                Target.HealthPercent > _wandThreshold &&
                cast.OnTarget(VampiricTouch))
            {
                return;
            }

            // Vampiric Embrace
            if (!Target.HaveBuff("Vampiric Embrace") &&
                _myManaPC > _innerManaSaveThreshold &&
                cast.OnTarget(VampiricEmbrace))
            {
                return;
            }

            // ShadowFiend
            if (ObjectManager.GetNumberAttackPlayer() > 1 &&
                cast.OnTarget(Shadowfiend))
            {
                return;
            }

            // Shadow Word Pain
            if (_myManaPC > 10 &&
                Target.HealthPercent > 15 &&
                !Target.HaveBuff("Shadow Word: Pain") &&
                cast.OnTarget(ShadowWordPain))
            {
                return;
            }

            // Inner Fire
            if (!Me.HaveBuff("Inner Fire") &&
                settings.UseInnerFire &&
                InnerFire.KnownSpell &&
                _myManaPC > _innerManaSaveThreshold &&
                Target.HealthPercent > _wandThreshold &&
                cast.OnSelf(InnerFire))
            {
                return;
            }

            // Shadowguard
            if (!Me.HaveBuff("Shadowguard") &&
                _myManaPC > _innerManaSaveThreshold &&
                settings.UseShadowGuard &&
                Target.HealthPercent > _wandThreshold &&
                cast.OnSelf(Shadowguard))
            {
                return;
            }

            // Shadow Protection
            if (!Me.HaveBuff("Shadow Protection") &&
                _myManaPC > 70 &&
                settings.UseShadowProtection &&
                cast.OnSelf(ShadowProtection))
            {
                return;
            }

            // Devouring Plague
            if (!Target.HaveBuff("Devouring Plague") &&
                Target.HealthPercent > 80 &&
                cast.OnTarget(DevouringPlague))
            {
                return;
            }

            // Shadow Word Death
            if (_myManaPC > _innerManaSaveThreshold &&
                settings.UseShadowWordDeath &&
                Target.HealthPercent < 15 &&
                cast.OnTarget(ShadowWordDeath))
            {
                return;
            }

            // Mind Blast + Inner Focus
            if (!_inShadowForm &&
                _myManaPC > _innerManaSaveThreshold &&
                Target.HealthPercent > 50 &&
                _mindBlastCD <= 0 &&
                (Target.HealthPercent > _wandThreshold || !_iCanUseWand))
            {
                if (InnerFocus.KnownSpell && _innerFocusCD <= 0)
                {
                    cast.OnSelf(InnerFocus);
                }

                if (cast.OnTarget(MindBlast))
                {
                    return;
                }
            }

            // Shadow Form Mind Blast + Inner Focus
            if (_inShadowForm &&
                _myManaPC > _innerManaSaveThreshold &&
                _mindBlastCD <= 0 &&
                Target.HealthPercent > _wandThreshold)
            {
                if (InnerFocus.KnownSpell && _innerFocusCD <= 0)
                {
                    cast.OnSelf(InnerFocus);
                }

                if (cast.OnTarget(MindBlast))
                {
                    return;
                }
            }

            // Mind FLay
            if ((Me.HaveBuff("Power Word: Shield") || !settings.UsePowerWordShield) &&
                _inShadowForm &&
                _myManaPC > _innerManaSaveThreshold &&
                Target.HealthPercent > _wandThreshold &&
                cast.OnTarget(MindFlay))
            {
                return;
            }

            // Low level Smite
            if (Me.Level < 5 && (Target.HealthPercent > 30 || Me.ManaPercentage > 80) &&
                _myManaPC > _innerManaSaveThreshold &&
                cast.OnTarget(Smite))
            {
                return;
            }

            // Smite
            if (!_inShadowForm &&
                _myManaPC > _innerManaSaveThreshold &&
                Me.Level >= 5 &&
                Target.HealthPercent > 20 &&
                (Target.HealthPercent > settings.WandThreshold || !_iCanUseWand) &&
                cast.OnTarget(Smite))
            {
                return;
            }

            // Stop wand if banned
            if (ToolBox.UsingWand() &&
                UnitImmunities.Contains(ObjectManager.Target, "Shoot") &&
                cast.OnTarget(UseWand))
            {
                return;
            }

            // Spell if wand banned
            if (UnitImmunities.Contains(ObjectManager.Target, "Shoot"))
            {
                if (cast.OnTarget(MindBlast) || cast.OnTarget(Smite))
                {
                    return;
                }
            }

            // Use Wand
            if (!ToolBox.UsingWand() &&
                _iCanUseWand &&
                cast.OnTarget(UseWand, false))
            {
                return;
            }

            // Go in melee because nothing else to do
            if (!ToolBox.UsingWand() &&
                !_iCanUseWand &&
                !RangeManager.CurrentRangeIsMelee() &&
                Target.IsAlive)
            {
                Logger.Log("Going in melee");
                RangeManager.SetRangeToMelee();
                return;
            }
        }
Exemple #5
0
        protected override void CombatRotation()
        {
            base.CombatRotation();
            WoWUnit Target = ObjectManager.Target;

            // Stop wand use on multipull
            if (_iCanUseWand && ObjectManager.GetNumberAttackPlayer() > 1)
            {
                _iCanUseWand = false;
            }

            // Remove Curse
            if (ToolBox.HasCurseDebuff())
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(RemoveCurse))
                {
                    return;
                }
            }

            // Summon Water Elemental
            if (Target.HealthPercent > 95 ||
                ObjectManager.GetNumberAttackPlayer() > 1)
            {
                if (cast.OnSelf(SummonWaterElemental))
                {
                    return;
                }
            }

            // Ice Barrier
            if (IceBarrier.IsSpellUsable &&
                !Me.HaveBuff("Ice Barrier") &&
                cast.OnSelf(IceBarrier))
            {
                return;
            }

            // Mana Shield
            if (!Me.HaveBuff("Mana Shield") &&
                (Me.HealthPercent < 30 && Me.ManaPercentage > 50 ||
                 Me.HealthPercent < 10) &&
                cast.OnSelf(ManaShield))
            {
                return;
            }

            // Cold Snap
            if (ObjectManager.GetNumberAttackPlayer() > 1 &&
                !Me.HaveBuff("Icy Veins") &&
                !IcyVeins.IsSpellUsable &&
                cast.OnSelf(ColdSnap))
            {
                return;
            }

            // Icy Veins
            if (ObjectManager.GetNumberAttackPlayer() > 1 && settings.IcyVeinMultiPull ||
                !settings.IcyVeinMultiPull &&
                cast.OnSelf(IcyVeins))
            {
                return;
            }

            // Use Mana Stone
            if ((ObjectManager.GetNumberAttackPlayer() > 1 && Me.ManaPercentage < 50 || Me.ManaPercentage < 5) &&
                _foodManager.UseManaStone())
            {
                return;
            }

            // Ice Lance
            if ((Target.HaveBuff("Frostbite") || Target.HaveBuff("Frost Nova")) &&
                cast.OnTarget(IceLance))
            {
                return;
            }

            // Frost Nova
            if (Target.GetDistance < 6f &&
                Target.HealthPercent > 10 &&
                !Target.HaveBuff("Frostbite") &&
                _polymorphedEnemy == null &&
                cast.OnSelf(FrostNova))
            {
                return;
            }

            // Fire Blast
            if (Target.HealthPercent <= settings.FireblastThreshold &&
                !Target.HaveBuff("Frostbite") &&
                !Target.HaveBuff("Frost Nova") &&
                cast.OnTarget(FireBlast))
            {
                return;
            }

            // Cone of Cold
            if (Target.GetDistance < 10 &&
                settings.UseConeOfCold &&
                Me.IsFacing(Target.Position, 0.5f) &&
                _polymorphedEnemy == null &&
                cast.OnSelf(ConeOfCold))
            {
                return;
            }

            // Frost Bolt
            if (Me.Level >= 6 &&
                !cast.IsBackingUp &&
                (Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                cast.OnTarget(Frostbolt))
            {
                return;
            }

            // Low level Frost Bolt
            if ((Target.HealthPercent > 15 || Me.HealthPercent < 50) &&
                Me.Level < 6 &&
                cast.OnTarget(Frostbolt))
            {
                return;
            }

            // Low level FireBall
            if (!Frostbolt.KnownSpell &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 50) &&
                cast.OnTarget(Fireball))
            {
                return;
            }

            // Stop wand if banned
            if (ToolBox.UsingWand() &&
                UnitImmunities.Contains(ObjectManager.Target, "Shoot") &&
                cast.OnTarget(UseWand))
            {
                return;
            }

            // Spell if wand banned
            if (UnitImmunities.Contains(ObjectManager.Target, "Shoot"))
            {
                if (cast.OnTarget(Frostbolt) || cast.OnTarget(Fireball) || cast.OnTarget(ArcaneMissiles))
                {
                    return;
                }
            }

            // Use Wand
            if (!ToolBox.UsingWand() &&
                _iCanUseWand &&
                !cast.IsBackingUp &&
                !MovementManager.InMovement)
            {
                if (cast.OnTarget(UseWand, false))
                {
                    return;
                }
            }

            // Go in melee because nothing else to do
            if (!ToolBox.UsingWand() &&
                !UseWand.IsSpellUsable &&
                !RangeManager.CurrentRangeIsMelee() &&
                !cast.IsBackingUp &&
                Target.IsAlive)
            {
                Logger.Log("Going in melee");
                RangeManager.SetRangeToMelee();
                return;
            }
        }
        protected override void CombatRotation()
        {
            base.CombatRotation();

            WoWUnit Me                    = ObjectManager.Me;
            WoWUnit Target                = ObjectManager.Target;
            double  _myManaPC             = Me.ManaPercentage;
            bool    _overLowManaThreshold = _myManaPC > _innerManaSaveThreshold;

            // Drain Soul
            bool _shouldDrainSoul = ToolBox.CountItemStacks("Soul Shard") < settings.NumberOfSoulShards || settings.AlwaysDrainSoul;

            if (_shouldDrainSoul &&
                ObjectManager.Target.HealthPercent < settings.DrainSoulHP &&
                ObjectManager.Target.Level >= Me.Level - 8 &&
                !UnitImmunities.Contains(ObjectManager.Target, "Drain Soul(Rank 1)"))
            {
                if (settings.DrainSoulLevel1 &&
                    cast.OnTarget(DrainSoulRank1))
                {
                    return;
                }
                else if (cast.OnTarget(DrainSoul))
                {
                    return;
                }
            }

            // How of Terror
            if (ToolBox.GetNumberEnemiesAround(10f, Me) > 1 &&
                cast.OnSelf(HowlOfTerror))
            {
                return;
            }

            // Use Health Stone
            if (Me.HealthPercent < 15)
            {
                WarlockPetAndConsumables.UseHealthstone();
            }

            // Shadow Trance
            if (Me.HaveBuff("Shadow Trance") &&
                _overLowManaThreshold &&
                cast.OnTarget(ShadowBolt))
            {
                return;
            }

            // Siphon Life
            if (Me.HealthPercent < 90 &&
                _overLowManaThreshold &&
                Target.HealthPercent > 20 &&
                !Target.HaveBuff("Siphon Life") &&
                settings.UseSiphonLife &&
                cast.OnTarget(SiphonLife))
            {
                return;
            }

            // Death Coil
            if (Me.HealthPercent < 20 &&
                cast.OnTarget(DeathCoil))
            {
                return;
            }

            // Drain Life low
            if (Me.HealthPercent < 30 &&
                Target.HealthPercent > 20 &&
                cast.OnTarget(DrainLife))
            {
                return;
            }

            // Curse of Agony
            if (!Target.HaveBuff("Curse of Agony") &&
                _overLowManaThreshold &&
                Target.HealthPercent > 20 &&
                cast.OnTarget(CurseOfAgony))
            {
                return;
            }

            // Unstable Affliction
            if (!Target.HaveBuff("Unstable Affliction") &&
                _overLowManaThreshold &&
                Target.HealthPercent > 30 &&
                cast.OnTarget(UnstableAffliction))
            {
                return;
            }

            // Corruption
            if (!Target.HaveBuff("Corruption") &&
                _overLowManaThreshold &&
                Target.HealthPercent > 20 &&
                cast.OnTarget(Corruption))
            {
                return;
            }

            // Immolate
            if (!Target.HaveBuff("Immolate") &&
                !ObjectManager.Target.HaveBuff("Fire Ward") &&
                _overLowManaThreshold &&
                Target.HealthPercent > 30 &&
                (settings.UseImmolateHighLevel || !UnstableAffliction.KnownSpell) &&
                cast.OnTarget(Immolate))
            {
                return;
            }

            // Drain Life high
            if (Me.HealthPercent < 70 &&
                Target.HealthPercent > 20 &&
                cast.OnTarget(DrainLife))
            {
                return;
            }

            // Health Funnel
            if (ObjectManager.Pet.IsValid &&
                ObjectManager.Pet.HealthPercent < 30 &&
                Me.HealthPercent > 30)
            {
                if (RangeManager.GetRange() > 19)
                {
                    RangeManager.SetRange(19f);
                }
                if (HealthFunnel.IsDistanceGood && cast.OnTarget(HealthFunnel))
                {
                    return;
                }
            }

            // Dark Pact
            if (Me.ManaPercentage < 70 &&
                ObjectManager.Pet.Mana > 0 &&
                ObjectManager.Pet.ManaPercentage > 60 &&
                settings.UseDarkPact &&
                cast.OnSelf(DarkPact))
            {
                return;
            }

            // Drain Mana
            if (Me.ManaPercentage < 70 &&
                Target.Mana > 0 &&
                Target.ManaPercentage > 30 &&
                cast.OnTarget(DrainMana))
            {
                return;
            }

            // Incinerate
            if (Target.HaveBuff("Immolate") &&
                _overLowManaThreshold &&
                Target.HealthPercent > 30 &&
                settings.UseIncinerate &&
                cast.OnTarget(Incinerate))
            {
                return;
            }

            // Shadow Bolt
            if ((!settings.PrioritizeWandingOverSB || !_iCanUseWand) &&
                (ObjectManager.Target.HealthPercent > 50 || Me.ManaPercentage > 90 && ObjectManager.Target.HealthPercent > 10) &&
                _myManaPC > 40 &&
                cast.OnTarget(ShadowBolt))
            {
                return;
            }

            // Life Tap
            if (Me.HealthPercent > 50 &&
                Me.ManaPercentage < 40 &&
                !ObjectManager.Target.IsTargetingMe &&
                settings.UseLifeTap &&
                cast.OnSelf(LifeTap))
            {
                return;
            }

            // Stop wand if banned
            if (ToolBox.UsingWand() &&
                UnitImmunities.Contains(ObjectManager.Target, "Shoot") &&
                cast.OnTarget(UseWand))
            {
                return;
            }

            // Spell if wand banned
            if (UnitImmunities.Contains(ObjectManager.Target, "Shoot") &&
                cast.OnTarget(ShadowBolt))
            {
                return;
            }

            // Use Wand
            if (!ToolBox.UsingWand() &&
                _iCanUseWand &&
                cast.OnTarget(UseWand, false))
            {
                return;
            }

            // Go in melee because nothing else to do
            if (!ToolBox.UsingWand() &&
                !UseWand.IsSpellUsable &&
                !RangeManager.CurrentRangeIsMelee() &&
                Target.IsAlive)
            {
                Logger.Log("Going in melee");
                RangeManager.SetRangeToMelee();
                return;
            }
        }
        protected override void CombatRotation()
        {
            base.CombatRotation();
            Lua.LuaDoString("PetAttack();", false);
            WoWUnit Target = ObjectManager.Target;

            // Stop wand use on multipull
            if (_iCanUseWand && ObjectManager.GetNumberAttackPlayer() > 1)
            {
                _iCanUseWand = false;
            }

            // Remove Curse
            if (ToolBox.HasCurseDebuff())
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnSelf(RemoveCurse))
                {
                    return;
                }
            }

            // Mana Shield
            if (!Me.HaveBuff("Mana Shield") &&
                (Me.HealthPercent < 30 && Me.ManaPercentage > 50 ||
                 Me.HealthPercent < 10) &&
                cast.OnSelf(ManaShield))
            {
                return;
            }

            // Use Mana Stone
            if ((ObjectManager.GetNumberAttackPlayer() > 1 && Me.ManaPercentage < 50 || Me.ManaPercentage < 5) &&
                _foodManager.UseManaStone())
            {
                return;
            }

            // Cast presence of mind spell
            if (Me.HaveBuff("Presence of Mind"))
            {
                if (cast.OnTarget(ArcaneBlast) || cast.OnTarget(Fireball))
                {
                    Usefuls.WaitIsCasting();
                    return;
                }
            }

            // Presence of Mind
            if (!Me.HaveBuff("Presence of Mind") &&
                (ObjectManager.GetNumberAttackPlayer() > 1 || !settings.PoMOnMulti) &&
                Target.HealthPercent > 50 &&
                cast.OnSelf(PresenceOfMind))
            {
                return;
            }

            // Arcane Power
            if (!Me.HaveBuff("Arcane Power") &&
                (ObjectManager.GetNumberAttackPlayer() > 1 || !settings.ArcanePowerOnMulti) &&
                Target.HealthPercent > 50 &&
                cast.OnSelf(ArcanePower))
            {
                return;
            }

            // Slow
            if ((settings.ACSlow || Target.CreatureTypeTarget == "Humanoid") &&
                !Target.HaveBuff("Slow") &&
                cast.OnTarget(Slow))
            {
                return;
            }

            // Cone of Cold
            if (Target.GetDistance < 10 &&
                settings.UseConeOfCold &&
                _polymorphedEnemy == null &&
                cast.OnTarget(ConeOfCold))
            {
                return;
            }

            // Fire Blast
            if (Target.HealthPercent <= settings.FireblastThreshold &&
                _polymorphedEnemy == null &&
                cast.OnTarget(FireBlast))
            {
                return;
            }

            bool _shouldCastArcaneBlast =
                ArcaneBlast.KnownSpell &&
                (Me.ManaPercentage > 70 ||
                 Me.HaveBuff("Clearcasting") ||
                 (Me.ManaPercentage > 50 && ToolBox.CountDebuff("Arcane Blast") < 3) ||
                 (Me.ManaPercentage > 35 && ToolBox.CountDebuff("Arcane Blast") < 2));

            // Arcane Blast
            if (_shouldCastArcaneBlast &&
                (Target.HealthPercent > settings.WandThreshold || !_iCanUseWand) &&
                cast.OnTarget(ArcaneBlast))
            {
                return;
            }

            // Arcane Missiles
            if (Me.Level >= 6 &&
                (Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                cast.OnTarget(ArcaneMissiles))
            {
                return;
            }

            // Frost Bolt
            if (Me.Level >= 6 &&
                (Target.HealthPercent > settings.WandThreshold || ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 40 || !_iCanUseWand) &&
                _polymorphedEnemy == null &&
                cast.OnTarget(Frostbolt))
            {
                return;
            }

            // Low level Frost Bolt
            if ((Target.HealthPercent > 15 || Me.HealthPercent < 50) &&
                Me.Level < 6 &&
                cast.OnTarget(Frostbolt))
            {
                return;
            }

            // Low level FireBall
            if (!Frostbolt.KnownSpell &&
                (Target.HealthPercent > 15 || Me.HealthPercent < 50) &&
                cast.OnTarget(Fireball))
            {
                return;
            }

            // Stop wand if banned
            if (ToolBox.UsingWand() &&
                UnitImmunities.Contains(ObjectManager.Target, "Shoot") &&
                cast.OnTarget(UseWand))
            {
                return;
            }

            // Spell if wand banned
            if (UnitImmunities.Contains(ObjectManager.Target, "Shoot"))
            {
                if (cast.OnTarget(ArcaneBlast) || cast.OnTarget(ArcaneMissiles) || cast.OnTarget(Frostbolt) || cast.OnTarget(Fireball))
                {
                    return;
                }
            }

            // Use Wand
            if (!ToolBox.UsingWand() &&
                _iCanUseWand &&
                !cast.IsBackingUp &&
                !MovementManager.InMovement &&
                cast.OnTarget(UseWand, false))
            {
                return;
            }

            // Go in melee because nothing else to do
            if (!ToolBox.UsingWand() &&
                !UseWand.IsSpellUsable &&
                !RangeManager.CurrentRangeIsMelee() &&
                !cast.IsBackingUp &&
                Target.IsAlive)
            {
                Logger.Log("Going in melee");
                RangeManager.SetRangeToMelee();
                return;
            }
        }