Example #1
0
        public static void RemoveEffect(Mobile m)
        {
            if (!WeakenSpell.IsUnderEffects(m))
            {
                m.RemoveStatMod("[Magic] Str Curse");
            }

            if (!ClumsySpell.IsUnderEffects(m))
            {
                m.RemoveStatMod("[Magic] Dex Curse");
            }

            if (!FeeblemindSpell.IsUnderEffects(m))
            {
                m.RemoveStatMod("[Magic] Int Curse");
            }

            BuffInfo.RemoveBuff(m, BuffIcon.Curse);

            if (m_UnderEffect.ContainsKey(m))
            {
                Timer t = m_UnderEffect[m];

                if (t != null)
                {
                    t.Stop();
                }

                m_UnderEffect.Remove(m);
            }

            m.UpdateResistances();
        }
Example #2
0
            private void EndHeal()
            {
                if (Context.ContainsKey(Healer))
                    Context.Remove(Healer);

                if (Patient != Healer && Patient.InRange(Healer.Location, 2))
                {
                    Healer.PlaySound(0x57);

                    if (EnchantedApple.GetTotalCurses(Patient) == 0)
                        Healer.SendLocalizedMessage(500968); // You apply the bandages, but they barely help.
                    else
                        Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

                    EvilOmenSpell.TryEndEffect(Patient);
                    StrangleSpell.RemoveCurse(Patient);
                    CorpseSkinSpell.RemoveCurse(Patient);
                    WeakenSpell.RemoveEffects(Patient);
                    FeeblemindSpell.RemoveEffects(Patient);
                    ClumsySpell.RemoveEffects(Patient);
                    CurseSpell.RemoveEffect(Patient);
                    MortalStrike.EndWound(Patient);
                    BloodOathSpell.RemoveCurse(Patient);
                    MindRotSpell.ClearMindRotScalar(Patient);
                    SpellPlagueSpell.RemoveFromList(Patient);
                    SleepSpell.EndSleep(Patient);

                    BuffInfo.RemoveBuff(Patient, BuffIcon.MassCurse);
                }
                else
                {
                    Healer.SendLocalizedMessage(500295); // You are too far away to do that.
                }
            }
Example #3
0
        public static void AddEffect(Mobile m, TimeSpan duration, int strOffset, int dexOffset, int intOffset)
        {
            if (m == null)
            {
                return;
            }

            if (m_UnderEffect.ContainsKey(m))
            {
                m_UnderEffect[m].Stop();
                m_UnderEffect[m] = null;
            }

            // my spell is stronger, so lets remove the lesser spell
            if (WeakenSpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Str) <= strOffset)
            {
                WeakenSpell.RemoveEffects(m, false);
            }

            if (ClumsySpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Dex) <= dexOffset)
            {
                ClumsySpell.RemoveEffects(m, false);
            }

            if (FeeblemindSpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Int) <= intOffset)
            {
                FeeblemindSpell.RemoveEffects(m, false);
            }

            m_UnderEffect[m] = Timer.DelayCall <Mobile>(duration, RemoveEffect, m); //= new CurseTimer(m, duration, strOffset, dexOffset, intOffset);
            m.UpdateResistances();
        }
        }// A tasty bite of the enchanted apple lifts all curses from your soul.

        public override bool Eat(Mobile from)
        {
            if (!IsUnderInfluence(from, FoodID))
            {
                if (CoolingDown(from, FoodID))
                {
                    from.SendLocalizedMessage(1151180); // You must wait a while before eating another enchanted apple.
                }
                else
                {
                    from.PlaySound(0xF6);
                    from.PlaySound(0x1F7);
                    from.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity mfrom = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z - 10), from.Map);
                    IEntity mto   = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                    Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    if (Core.SA)
                    {
                        int totalCurses = GetTotalCurses(from);

                        if (totalCurses > 2 && totalCurses > Utility.Random(10))
                        {
                            from.SendLocalizedMessage(1150174); // The apple was not strong enough to purify you.

                            Consume();

                            return(false);
                        }
                    }

                    EvilOmenSpell.TryEndEffect(from);
                    StrangleSpell.RemoveCurse(from);
                    CorpseSkinSpell.RemoveCurse(from);
                    WeakenSpell.RemoveEffects(from);
                    FeeblemindSpell.RemoveEffects(from);
                    ClumsySpell.RemoveEffects(from);
                    CurseSpell.RemoveEffect(from);
                    MortalStrike.EndWound(from);
                    BloodOathSpell.RemoveCurse(from);
                    MindRotSpell.ClearMindRotScalar(from);
                    SpellPlagueSpell.RemoveFromList(from);
                    SleepSpell.EndSleep(from);

                    BuffInfo.RemoveBuff(from, BuffIcon.MassCurse);

                    from.SendLocalizedMessage(EatMessage);

                    StartInfluence(from, FoodID, Duration, Cooldown);
                    Consume();

                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        public Spell CheckCurse()
        {
            Mobile foe = this.m_Mobile.Combatant as Mobile;

            if (foe == null)
            {
                return(null);
            }

            StatMod mod = foe.GetStatMod("[Magic] Int Curse");

            if (mod != null)
            {
                return(null);
            }

            if (this.m_Mobile.Skills[SkillName.Magery].Value >= 40.0)
            {
                return(new CurseSpell(this.m_Mobile, null));
            }

            int   whichone = 1;
            Spell spell    = null;

            if ((mod = foe.GetStatMod("[Magic] Str Curse")) != null)
            {
                whichone++;
            }

            if ((mod = this.m_Mobile.GetStatMod("[Magic] Dex Curse")) != null)
            {
                whichone++;
            }

            switch (whichone)
            {
            case 1:
                spell = new FeeblemindSpell(this.m_Mobile, null);
                break;

            case 2:
                spell = new WeakenSpell(this.m_Mobile, null);
                break;

            case 3:
                spell = new ClumsySpell(this.m_Mobile, null);
                break;
            }

            return(spell);
        }
Example #6
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_Combo == 0)
            {
                spell = new ExplosionSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 1)
            {
                spell = new WeakenSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 2)
            {
                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                ++m_Combo;                 // Move to next spell
            }

            if (m_Combo == 3 && spell == null)
            {
                switch (Utility.Random(3))
                {
                default:
                case 0:
                {
                    if (c.Int < c.Dex)
                    {
                        spell = new FeeblemindSpell(m_Mobile, null);
                    }
                    else
                    {
                        spell = new ClumsySpell(m_Mobile, null);
                    }

                    ++m_Combo;                                     // Move to next spell

                    break;
                }

                case 1:
                {
                    spell   = new EnergyBoltSpell(m_Mobile, null);
                    m_Combo = -1;                                     // Reset combo state
                    break;
                }

                case 2:
                {
                    spell   = new FlameStrikeSpell(m_Mobile, null);
                    m_Combo = -1;                                     // Reset combo state
                    break;
                }
                }
            }
            else if (m_Combo == 4 && spell == null)
            {
                spell   = new MindBlastSpell(m_Mobile, null);
                m_Combo = -1;
            }

            return(spell);
        }
Example #7
0
        public static int RemoveCurses(Mobile m)
        {
            int curseLevel = 0;

            if (SleepSpell.IsUnderSleepEffects(m))
            {
                SleepSpell.EndSleep(m);
                curseLevel += 2;
            }

            if (EvilOmenSpell.TryEndEffect(m))
            {
                curseLevel += 1;
            }

            if (StrangleSpell.RemoveCurse(m))
            {
                curseLevel += 2;
            }

            if (CorpseSkinSpell.RemoveCurse(m))
            {
                curseLevel += 3;
            }

            if (CurseSpell.UnderEffect(m))
            {
                CurseSpell.RemoveEffect(m);
                curseLevel += 4;
            }

            if (BloodOathSpell.RemoveCurse(m))
            {
                curseLevel += 3;
            }

            if (MindRotSpell.HasMindRotScalar(m))
            {
                MindRotSpell.ClearMindRotScalar(m);
                curseLevel += 2;
            }

            if (SpellPlagueSpell.HasSpellPlague(m))
            {
                SpellPlagueSpell.RemoveFromList(m);
                curseLevel += 4;
            }

            if (FeeblemindSpell.IsUnderEffects(m))
            {
                FeeblemindSpell.RemoveEffects(m);
                curseLevel += 1;
            }

            if (ClumsySpell.IsUnderEffects(m))
            {
                ClumsySpell.RemoveEffects(m);
                curseLevel += 1;
            }

            if (WeakenSpell.IsUnderEffects(m))
            {
                WeakenSpell.RemoveEffects(m);
                curseLevel += 1;
            }

            if (MortalStrike.IsWounded(m))
            {
                MortalStrike.EndWound(m);
                curseLevel += 2;
            }

            BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
            BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
            BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
            BuffInfo.RemoveBuff(m, BuffIcon.Curse);
            BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
            BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
            BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
            BuffInfo.RemoveBuff(m, BuffIcon.CorpseSkin);
            BuffInfo.RemoveBuff(m, BuffIcon.Strangle);
            BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);

            return(curseLevel);
        }
Example #8
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_Combo == 0)
            {
                //m_Mobile.Say( "combo phase 0" );
                spell = new ExplosionSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 1)
            {
                //m_Mobile.Say( "combo phase 1" );
                spell = new ExplosionSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 2)
            {
                //m_Mobile.Say( "combo phase 2" );
                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                ++m_Combo;                 // Move to next spell
            }

            else if (m_Combo == 3)
            {
                //m_Mobile.Say( "combo phase 3" );
                if (c.Poisoned)
                {
                    spell = new WeakenSpell(m_Mobile, null);
                }

                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                ++m_Combo;                 // Move to next spell
            }

            else if (m_Combo == 4)
            {
                //	m_Mobile.Say( "combo phase 4 ebolt" );
                spell = new EnergyBoltSpell(m_Mobile, null);

                ++m_Combo;                 // Move to next spell
            }

            else if (m_Combo == 5)
            {
                //m_Mobile.Say( "combo phase 5" );
                if (c.Poisoned && c.Alive)
                {
                    spell = new HarmSpell(m_Mobile, null);

                    m_Combo = 5;                     // Move to next spell
                }

                if (!c.Poisoned)
                {
                    if (m_Mobile.Mana > 20)
                    {
                        spell = new EnergyBoltSpell(m_Mobile, null);
                    }

                    if (m_Mobile.Mana < 19)
                    {
                        spell = new LightningSpell(m_Mobile, null);
                    }
                    m_Combo = -1;                     // Reset combo state
                }
            }

            return(spell);
        }
Example #9
0
        public void Target(Mobile m)
        {
            if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Attempts to remove all Curse effects from Target.
                 * Curses include Mage spells such as Clumsy, Weaken, Feeblemind and Paralyze
                 * as well as all Necromancer curses.
                 * Chance of removing curse is affected by Caster's Karma.
                 */

                int chance = 0;

                if (Caster.Karma < -5000)
                {
                    chance = 0;
                }
                else if (Caster.Karma < 0)
                {
                    chance = (int)Math.Sqrt(20000 + Caster.Karma) - 122;
                }
                else if (Caster.Karma < 5625)
                {
                    chance = (int)Math.Sqrt(Caster.Karma) + 25;
                }
                else
                {
                    chance = 100;
                }

                if (chance > Utility.Random(100))
                {
                    m.PlaySound(0xF6);
                    m.PlaySound(0x1F7);
                    m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), Caster.Map);
                    IEntity to   = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), Caster.Map);
                    Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    m.Paralyzed = false;

                    EvilOmenSpell.TryEndEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);
                    MortalStrike.EndWound(m);
                    WeakenSpell.RemoveEffects(m);
                    FeeblemindSpell.RemoveEffects(m);
                    ClumsySpell.RemoveEffects(m);

                    BloodOathSpell.RemoveCurse(m);

                    MindRotSpell.ClearMindRotScalar(m);
                    SpellPlagueSpell.RemoveFromList(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
                }
                else
                {
                    m.PlaySound(0x1DF);
                }
            }

            FinishSequence();
        }
Example #10
0
        public virtual ISpell CreateSpell(LivingEntity caller)
        {
            ISpell spell = null;

            switch (this.Kind)
            {
            case SpellKind.FireBall:
                spell = new FireBallSpell(caller);
                break;

            case SpellKind.PoisonBall:
                spell = new PoisonBallSpell(caller);
                break;

            case SpellKind.IceBall:
                spell = new IceBallSpell(caller);
                break;

            case SpellKind.Skeleton:
                spell = new SkeletonSpell(caller, Roguelike.Generators.GenerationInfo.Difficulty);
                break;

            case SpellKind.Transform:
                spell = new TransformSpell(caller);
                break;

            case SpellKind.ManaShield:
                spell = new ManaShieldSpell(caller);
                break;

            case SpellKind.Rage:
                spell = new RageSpell(caller);
                break;

            case SpellKind.Weaken:
                spell = new WeakenSpell(caller);
                break;

            case SpellKind.Inaccuracy:
                spell = new InaccuracySpell(caller);
                break;

            case SpellKind.IronSkin:
                spell = new IronSkinSpell(caller);
                break;

            case SpellKind.Teleport:
                spell = new TeleportSpell(caller);
                break;

            case SpellKind.Portal:
                spell = new Portal(caller);
                break;

            case SpellKind.ResistAll:
                spell = new ResistAllSpell(caller);
                break;

            default:
                break;
                throw new Exception("CreateSpell ???" + Kind);
            }
            if (spell is IProjectileSpell proj)
            {
                proj.Range += spell.CurrentLevel - 1;
            }
            return(spell);
        }
Example #11
0
        public static int GetTotalCurses(Mobile m)
        {
            int curses = 0;

            if (EvilOmenSpell.UnderEffects(m))
            {
                curses++;
            }

            if (StrangleSpell.UnderEffects(m))
            {
                curses++;
            }

            if (CorpseSkinSpell.IsUnderEffects(m))
            {
                curses++;
            }

            if (BloodOathSpell.GetBloodOath(m) != null)
            {
                curses++;
            }

            if (MindRotSpell.HasMindRotScalar(m))
            {
                curses++;
            }

            if (SpellPlagueSpell.HasSpellPlague(m))
            {
                curses++;
            }

            if (SleepSpell.IsUnderSleepEffects(m))
            {
                curses++;
            }

            if (CurseSpell.UnderEffect(m))
            {
                curses++;
            }

            if (FeeblemindSpell.IsUnderEffects(m))
            {
                curses++;
            }

            if (ClumsySpell.IsUnderEffects(m))
            {
                curses++;
            }

            if (WeakenSpell.IsUnderEffects(m))
            {
                curses++;
            }

            return(curses);
        }
Example #12
0
        public bool ApplyStatEffect(PlayerMobile Wearer, bool bStr, bool bDex, bool bInt, int change)
        {
            Spell spell = null;

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

            // Try to apply bless to all stats
            int  BlessOffset = change;
            bool AppliedStr  = false;
            bool AppliedInt  = false;
            bool AppliedDex  = false;

            if (bStr)
            {
                if (BlessOffset > 0)
                {
                    spell = new StrengthSpell(Wearer, null);
                }
                else
                {
                    spell = new WeakenSpell(Wearer, null);
                }

                if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false)
                {
                    Wearer.SendMessage("The magic normally within this object seems absent.");
                    return(false);
                }

                AppliedStr = AddStatBonus(Wearer, BlessOffset, StatType.Str, TimeSpan.Zero);
            }
            if (bInt)
            {
                if (BlessOffset > 0)
                {
                    spell = new CunningSpell(Wearer, null);
                }
                else
                {
                    spell = new FeeblemindSpell(Wearer, null);
                }

                if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false)
                {
                    Wearer.SendMessage("The magic normally within this object seems absent.");
                    return(false);
                }
                AppliedInt = AddStatBonus(Wearer, BlessOffset, StatType.Int, TimeSpan.Zero);
            }

            if (bDex)
            {
                if (BlessOffset > 0)
                {
                    spell = new AgilitySpell(Wearer, null);
                }
                else
                {
                    spell = new ClumsySpell(Wearer, null);
                }

                if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false)
                {
                    Wearer.SendMessage("The magic normally within this object seems absent.");
                    return(false);
                }
                AppliedDex = AddStatBonus(Wearer, BlessOffset, StatType.Dex, TimeSpan.Zero);
            }
            Wearer.CheckStatTimers();
            // If any stats were adjusted, start timer to remove the stats after effect expires
            // return that spell was successful
            if (AppliedStr || AppliedInt || AppliedDex)             /* 7/25/04 smerX */
            {
                if (m_StatEffectTimer != null)
                {
                    m_StatEffectTimer.Stop();
                    m_StatEffectTimer = null;
                }

                m_StatEffectTimer = new MagicEffectTimer(Wearer, this, TimeSpan.FromSeconds(120));

                m_StatEffectTimer.Start();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #13
0
        public override bool DoActionCombat()
        {
            m_Mobile.DebugSay("doing DoActionCombat");
            Mobile c = m_Mobile.Combatant;

            m_Mobile.Warmode = true;

            // check to see if our attack priority has changed
            Mobile newTarget = null;

            if (PriorityTarget(c, out newTarget) == true)
            {
                m_Mobile.DebugSay("Higher priority target found switching targets");
                m_Mobile.Combatant = c = newTarget;
                m_Mobile.FocusMob  = null;
            }

            if (m_Mobile.CanReveal)
            {
                if (c == null)
                {
                    //	If we can Recall() a player via FindHiddenTarget, make them our new Combatant.
                    //	Keep in mind, CombatTimer.OnTick() will set the Combatant to null if it sees that the mobile is hidden,
                    //	for this reason, we make this check in DoActionGuard and again in DoActionCombat if the Combatant is null.
                    Mobile mx = FindHiddenTarget();
                    if (mx != null)
                    {
                        m_Mobile.DebugSay("C: Ah, I remembered {0}!", mx.Name);
                        c = m_Mobile.Combatant = mx;
                    }
                }

                // if we can reveal and our target just hid and we Recall them, lets try to reveal
                if (c != null && c.Hidden && ShortTermMemory.Recall(c) && c.Alive && !c.IsDeadBondedPet && m_Mobile.CanBeHarmful(c, false) && !m_Mobile.Controlled)
                {                       // we will keep retrying the reveal
                    if (DoProcessReveal(c))
                    {
                        return(true);
                    }
                    else
                    {
                        m_Mobile.DebugSay("Failed reveal attempt");
                    }
                }
            }

            if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) || !m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant
                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    if (m_Mobile.Debug)
                    {
                        m_Mobile.DebugSay("Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name);
                    }

                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
                else
                {
                    m_Mobile.DebugSay("Something happened to my combatant, and nothing is around. I am on guard.");
                    Action = ActionType.Guard;
                    return(true);
                }

                if (!m_Mobile.InRange(c, m_Mobile.RangePerception))
                {
                    // They are somewhat far away, can we find something else?

                    if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                    {
                        m_Mobile.Combatant = m_Mobile.FocusMob;
                        m_Mobile.FocusMob  = null;
                    }
                    else if (!m_Mobile.InRange(c, m_Mobile.RangePerception * 3))
                    {
                        m_Mobile.Combatant = null;
                    }

                    c = m_Mobile.Combatant;

                    if (c == null)
                    {
                        m_Mobile.DebugSay("My combatant has fled, so I am on guard");
                        Action = ActionType.Guard;
                        return(true);
                    }
                }
            }

            if (!m_Mobile.InLOS(c))
            {
                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.Combatant = c = m_Mobile.FocusMob;
                    m_Mobile.FocusMob  = null;
                }
            }

            if (c != null)
            {
                int    strMod   = GetStatMod(c, StatType.Str);
                Mobile toDispel = null;

                //dont worry about creatures/pets useing these spells, only players.
                if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
                {
                    EnemyCountersPara = true;
                }

                if (UsesPotions && RefreshPotCount >= 1 && m_Mobile.Stam < 20)
                {
                    DrinkRefresh(m_Mobile);
                }

                if (m_Mobile.Paralyzed)
                {
                    UseTrapPouch(m_Mobile);
                }

                TrapPouch(m_Mobile);

                if ((c.Paralyzed || c.Frozen) && PreferMagic() == true)
                {
                    if (m_Mobile.InRange(c, 3))
                    {
                        RunAround(c);
                    }
                }

                if (PreferMagic() == true)
                {
                    if (SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0)
                    {
                        EventSink.InvokeStunRequest(new StunRequestEventArgs(m_Mobile));
                    }
                }

                if (UsesBandages && (IsDamaged || IsPoisoned) && m_Mobile.Skills.Healing.Base > 20.0)
                {
                    TimeSpan ts = TimeUntilBandage;

                    if (ts == TimeSpan.MaxValue)
                    {
                        StartBandage(m_Mobile, m_Mobile);
                    }
                }

                if (IsPoisoned && UsesPotions && CurePotCount >= 1)
                {
                    if (m_Mobile.Poison.Level >= 3 || Combo != -1 || m_Mobile.Mana < 30)
                    {
                        DrinkCure(m_Mobile);
                    }
                }

                if (IsDamaged && UsesPotions && HealPotCount >= 1)
                {
                    if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
                    {
                        if (m_Mobile.Hits < (m_Mobile.HitsMax * .25) || m_Mobile.Mana < (m_Mobile.ManaMax * .25))
                        {
                            DrinkHeal(m_Mobile);
                        }
                    }
                }

                if (m_Mobile.Skills[SkillName.Magery].Value >= 50.0 && m_Mobile.Spell == null && DateTime.Now >= m_Mobile.NextSpellTime)
                {
                    m_Mobile.DebugSay("Doing spell selection");
                    // We are ready to cast a spell
                    Spell spell = null;
                    toDispel = FindDispelTarget(true);

                    //woot weaken block up to lightening!
                    ISpell i = c.Spell;
                    if (i != null && i.IsCasting)
                    {
                        Spell s = (Spell)i;
                        if (m_Mobile.Hits <= 40 && (s.MaxDamage >= 12 || (s is PoisonSpell && !IsPoisoned && CurePotCount == 0)))
                        {
                            m_Mobile.DebugSay("Damage is {0}", s.MaxDamage);
                            spell = new WeakenSpell(m_Mobile, null);
                        }
                    }
                    // Top cast priority is cure - may override the previous assignment
                    else if (IsPoisoned)
                    {
                        spell = new CureSpell(m_Mobile, null);
                        int level = (m_Mobile.Poison.Level + 1);
                        if (level > 0 && (((m_Mobile.Skills[SkillName.Magery].Value / level) - 20) * 7.5) > 50)
                        {
                            spell = new CureSpell(m_Mobile, null);
                        }
                        else
                        {
                            spell = new ArchCureSpell(m_Mobile, null);
                        }
                    }
                    //were hurt they have atleast half life and were to low on mana to finish them start healing
                    else if (m_Mobile.Hits < 70 && c.Hits > 50 && m_Mobile.Mana < 30)
                    {
                        spell = new HealSpell(m_Mobile, null);
                    }
                    // Something dispellable is attacking us
                    else if (toDispel != null)
                    {
                        if (Utility.Random(0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits))) >= 3)
                        {
                            if (UsesPotions && HealPotCount >= 1 && m_Mobile.Hits < (m_Mobile.HitsMax - 20))
                            {
                                DrinkHeal(m_Mobile);
                            }
                            else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20))
                            {
                                spell = new HealSpell(m_Mobile, null);
                            }
                        }

                        spell = DoDispel(toDispel);
                    }
                    // a friend needs healed
                    else if (CrossHeals && FindHealTarget(true) != null)
                    {
                        spell = new GreaterHealSpell(m_Mobile, null);
                    }
                    //target has reflect up hit is with ManaDrain till down
                    else if (c.MagicDamageAbsorb > 5)
                    {
                        spell = new ManaDrainSpell(m_Mobile, null);
                    }
                    // We are doing a spell combo
                    else if (Combo != -1)
                    {
                        spell = DoCombo(c);
                    }
                    //keep them weakened.
                    else if (m_Mobile.Mana >= 40 && strMod >= 0 && !c.Paralyzed)
                    {
                        spell = new WeakenSpell(m_Mobile, null);
                    }
                    else
                    {
                        spell = ChooseSpell(c);
                    }

                    if (spell != null && m_Mobile.InRange(c, 12))
                    {
                        spell.Cast();
                    }
                }


                if (SmartAI && toDispel != null)
                {
                    if (m_Mobile.InRange(toDispel, 8) && !toDispel.Paralyzed)
                    {
                        RunFrom(toDispel);
                    }
                }
                else if (HoldingWeapon() == true && PreferMagic() == false)
                {
                    m_Mobile.DebugSay("I will prefer my weapon over magic");
                    RunTo(c, CanRun);
                }
                else
                {
                    if (c is BaseCreature && ((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned && !c.Paralyzed && m_Mobile.InRange(c, 6))
                    {
                        RunFrom(c);
                    }

                    if (c is BaseCreature && (((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned) && !m_Mobile.InRange(c, 10))
                    {
                        RunTo(c, CanRun);
                    }

                    if (RegainingMana == false)
                    {
                        if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned))
                        {
                            RunTo(c, CanRun);
                        }
                    }
                    else
                    {
                        if (c is PlayerMobile || (c is BaseCreature && !((BaseCreature)c).Controlled && !((BaseCreature)c).Summoned))
                        {
                            if (m_Mobile.InRange(c, 4))
                            {
                                RunAround(c);
                            }

                            if (!m_Mobile.InRange(c, 6))
                            {
                                RunTo(c, CanRun);
                            }
                        }

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                }

                return(true);
            }
            return(true);
        }
        public override Spell DoCombo(Mobile c)
        {
            //m_Mobile.Say("doing human AI combo");
            if (c is PlayerMobile && SmartAI && (c.Spell is MagicTrapSpell || c.Spell is MagicArrowSpell))
            {
                m_EnemyCountersPara = true;
            }

            Spell spell = null;

            if (Combo == 0)
            {
                //m_Mobile.Say( "combo phase 1" );
                spell = new ExplosionSpell(m_Mobile, null);
                ++Combo;                 // Move to next spell
            }

            if (Combo == 1)
            {
                //m_Mobile.Say( "combo phase 1" );
                spell = new ExplosionSpell(m_Mobile, null);
                ++Combo;                 // Move to next spell
            }
            else if (Combo == 2)
            {
                //m_Mobile.Say( "combo phase 2" );
                if (!c.Poisoned && (CheckCanPoison(c)))
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                ++Combo;                 // Move to next spell
            }

            else if (Combo == 3)
            {
                //m_Mobile.Say( "combo phase 3" );
                if (c.Poisoned || !CheckCanPoison(c))
                {
                    spell = new WeakenSpell(m_Mobile, null);
                }

                if (!c.Poisoned && (CheckCanPoison(c)))
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                ++Combo;                 // Move to next spell
            }

            else if (Combo == 4)
            {
                //	m_Mobile.Say( "combo phase 4 ebolt" );

                if (!c.Poisoned && (CheckCanPoison(c)))
                {
                    spell = new PoisonSpell(m_Mobile, null);
                    Combo = 4;
                }

                else
                {
                    spell = new EnergyBoltSpell(m_Mobile, null);
                }

                ++Combo;                 // Move to next spell
            }
            else if (Combo == 5)
            {
                //m_Mobile.Say( "combo phase 5" );
                if (c.Poisoned)
                {
                    if (c.Hits < 20 && m_Mobile.Mana >= 20)
                    {
                        spell = new EnergyBoltSpell(m_Mobile, null);
                    }

                    else
                    {
                        spell = new HarmSpell(m_Mobile, null);
                    }

                    Combo = 5;                     // Move to next spell
                }

                if (!c.Poisoned)
                {
                    if (m_Mobile.Mana > 20)
                    {
                        spell = new EnergyBoltSpell(m_Mobile, null);
                    }

                    if (m_Mobile.Mana < 19)
                    {
                        spell = new LightningSpell(m_Mobile, null);
                    }
                    Combo = -1;                     // Reset combo state
                }
            }

            return(spell);
        }