Exemple #1
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.
                }
            }
Exemple #2
0
 protected override void OnTick()
 {
     if (m_Target.Deleted || !m_Target.Alive || DateTime.UtcNow >= m_End)
     {
         MindRotSpell.ClearMindRotScalar(m_Target);
         Stop();
     }
 }
Exemple #3
0
 protected override void OnTick()
 {
     if (_target.Deleted || !_target.Alive || Core.Now >= _end)
     {
         MindRotSpell.ClearMindRotScalar(_target);
         Stop();
     }
 }
        }// 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);
        }
Exemple #5
0
        public static void RemoveCurses(Mobile m)
        {
            // play the sound
            m.PlaySound(0xF6);
            m.PlaySound(0x1F7);

            // do the effects
            m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

            IEntity from = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), m.Map);
            IEntity to   = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), m.Map);

            Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

            // remove stat mods
            StatMod mod;

            foreach (string statModName in StatModNames)
            {
                mod = m.GetStatMod(statModName);
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod(statModName);
                }
            }

            m.Paralyzed = false;

            EvilOmenSpell.CheckEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.EndEffect(m);
            SpellPlagueSpell.RemoveEffect(m);
            SleepSpell.RemoveEffect(m);
            MindRotSpell.ClearMindRotScalar(m);

            BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
            BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
            BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
            BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
            BuffInfo.RemoveBuff(m, BuffIcon.Curse);
            BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
            BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
            BuffInfo.RemoveBuff(m, BuffIcon.Sleep);
            BuffInfo.RemoveBuff(m, BuffIcon.MassSleep);
            BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
        }
Exemple #6
0
        public virtual int CalculateMana(Mobile from)
        {
            int mana = BaseMana;

            double skillTotal = GetSkill(from, SkillName.Swords) + GetSkill(from, SkillName.Macing)
                                + GetSkill(from, SkillName.Fencing) +
                                GetSkill(from, SkillName.Archery) +
                                GetSkill(from, SkillName.Parry)
                                + GetSkill(from, SkillName.Lumberjacking) +
                                GetSkill(from, SkillName.Stealth)
                                + GetSkill(from, SkillName.Poisoning) +
                                GetSkill(from, SkillName.Bushido) +
                                GetSkill(from, SkillName.Ninjitsu);

            if (skillTotal >= 300.0)
            {
                mana -= 10;
            }
            else if (skillTotal >= 200.0)
            {
                mana -= 5;
            }

            double scalar = 1.0;

            if (!MindRotSpell.GetMindRotScalar(from, ref scalar))
            {
                scalar = 1.0;
            }

            // Lower Mana Cost = 40%
            int lmc = Math.Min(AosAttributes.GetValue(from, AosAttribute.LowerManaCost), 40);

            scalar -= (double)lmc / 100;
            mana    = (int)(mana * scalar);

            // Using a special move within 3 seconds of the previous special move costs double mana
            if (GetContext(from) != null)
            {
                mana *= 2;
            }

            return(mana);
        }
Exemple #7
0
        }// A tasty bite of the enchanted apple lifts all curses from your soul.
        public override bool Eat(Mobile from)
        {
            if (base.Eat(from))
            {
                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);

                from.RemoveStatMod("[Magic] Str Curse");
                from.RemoveStatMod("[Magic] Dex Curse");
                from.RemoveStatMod("[Magic] Int Curse");

                from.Asleep = false;

                EvilOmenSpell.TryEndEffect(from);
                StrangleSpell.RemoveCurse(from);
                CorpseSkinSpell.RemoveCurse(from);
                CurseSpell.RemoveEffect(from);
                MortalStrike.EndWound(from);
                BloodOathSpell.RemoveCurse(from);
                MindRotSpell.ClearMindRotScalar(from);
                SpellPlagueSpell.RemoveFromList(from);

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

                return(true);
            }

            return(false);
        }
 public static void SuperHealXML(BaseCreature bc, Mobile player)
 {
     if (!bc.Alive)
     {
         bc.Resurrect();
     }
     if (bc.Hits < bc.HitsMax)
     {
         bc.Hits = bc.HitsMax;
     }
     if (bc.Mana < bc.ManaMax)
     {
         bc.Mana = bc.ManaMax;
     }
     if (bc.Stam < bc.StamMax)
     {
         bc.Stam = bc.StamMax;
     }
     if (bc.Poison != null)
     {
         bc.Poison = null;
     }
     if (bc.Paralyzed == true)
     {
         bc.Paralyzed = false;
     }
     EvilOmenSpell.TryEndEffect(bc);
     StrangleSpell.RemoveCurse(bc);
     CorpseSkinSpell.RemoveCurse(bc);
     CurseSpell.RemoveEffect(bc);
     MortalStrike.EndWound(bc);
     BloodOathSpell.RemoveCurse(bc);
     MindRotSpell.ClearMindRotScalar(bc);
     bc.Loyalty = BaseCreature.MaxLoyalty;
     Effects.SendTargetEffect(bc, 0x3709, 32);
     Effects.SendTargetEffect(bc, 0x376A, 32);
     bc.PlaySound(0x208);
     bc.Emote("*you see {0} looks refreshed!*", bc.Name);
 }
Exemple #9
0
        private void RemoveCurses(Mobile m)
        {
            StatMod mod;

            foreach (var statModName in StatModNames)
            {
                mod = m.GetStatMod(statModName);
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod(statModName);
                }
            }

            m.Paralyzed = false;

            EvilOmenSpell.CheckEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.EndEffect(m);
            SpellPlagueSpell.RemoveEffect(m);
            SleepSpell.RemoveEffect(m);
            MindRotSpell.ClearMindRotScalar(m);

            BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
            BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
            BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
            BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
            BuffInfo.RemoveBuff(m, BuffIcon.Curse);
            BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
            BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
            BuffInfo.RemoveBuff(m, BuffIcon.Sleep);
            BuffInfo.RemoveBuff(m, BuffIcon.MassSleep);
            BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
        }
Exemple #10
0
        public override void OnTarget(Object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p == null)
            {
                return;
            }

            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();
                Party         party   = Party.Get(Caster);
                StatMod       mod;

                double prim = Caster.Skills[CastSkill].Value;
                double sec  = Caster.Skills[DamageSkill].Value;

                IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(p), 3);
                foreach (Mobile mob in eable)
                {
                    if (mob == null)
                    {
                        continue;
                    }

                    if (mob == Caster)
                    {
                        targets.Add(mob);
                    }

                    if (Caster.CanBeBeneficial(mob, false) && party != null && party.Contains(mob))
                    {
                        targets.Add(mob);
                    }
                }
                eable.Free();

                Mobile m;
                int    toheal = (int)(((prim + sec) / 2) * 0.3) - 6;
                Caster.PlaySound(0x64C);

                for (int i = 0; i < targets.Count; i++)
                {
                    m = targets[i];
                    int toHealMod = toheal;

                    if (!m.Alive)
                    {
                        continue;
                    }

                    if (m.Poisoned)
                    {
                        int chanceToCure = (10000 + (int)(((prim + sec) / 2) * 75) - ((m.Poison.RealLevel + 1) * 1750)) / 100;

                        if (chanceToCure > Utility.Random(100) && m.CurePoison(Caster))
                        {
                            toHealMod /= 3;
                        }
                        else
                        {
                            toHealMod = 0;
                        }
                    }

                    if (MortalStrike.IsWounded(m))
                    {
                        MortalStrike.EndWound(m);
                        toHealMod = 0;
                    }

                    if (toHealMod > 0)
                    {
                        m.Heal(toHealMod + Utility.RandomMinMax(1, 6));
                    }

                    m.RemoveStatMod("[Magic] Str Curse");
                    m.RemoveStatMod("[Magic] Dex Curse");
                    m.RemoveStatMod("[Magic] Int Curse");

                    SleepSpell.EndSleep(m);
                    EvilOmenSpell.TryEndEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);
                    BloodOathSpell.RemoveCurse(m);
                    MindRotSpell.ClearMindRotScalar(m);

                    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);

                    //TODO: Message/Effects???
                }
            }

            FinishSequence();
        }
Exemple #11
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);
        }
Exemple #12
0
        public static int GetCursePower(Mobile m)
        {
            int power = 0;

            // 1st circle debuffs
            foreach (string statModName in StatModNames)
            {
                if (m.GetStatMod(statModName) != null)
                {
                    power += 1;
                }
            }

            // 3rd circle debuffs
            if (EvilOmenSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (BloodOathSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (CorpseSkinSpell.UnderEffect(m))
            {
                power += 3;
            }

            if (MindRotSpell.HasMindRotScalar(m))
            {
                power += 3;
            }

            if (SleepSpell.IsSlept(m))
            {
                power += 3;
            }

            // 4th circle debuffs
            if (CurseSpell.UnderEffect(m))
            {
                power += 4;
            }

            // 6th circle debuffs
            if (StrangleSpell.UnderEffect(m))
            {
                power += 6;
            }

            // 7th circle debuffs
            if (SpellPlagueSpell.UnderEffect(m))
            {
                power += 7;
            }

            if (MortalStrike.IsWounded(m))
            {
                power += 7;
            }

            return(power);
        }
Exemple #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                var m = targeted as Mobile;

                if (m == null)
                {
                    from.SendMessage("This is not a mobile!");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} completely restoring {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));

                if (!m.Alive)
                {
                    m.Resurrect();
                }

                m.Hits      = m.HitsMax;
                m.Mana      = m.ManaMax;
                m.Stam      = m.StamMax;
                m.Hunger    = 20;
                m.Thirst    = 20;
                m.Poison    = null;
                m.Paralyzed = false;

                StatMod mod;

                mod = m.GetStatMod("[Magic] Str Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Str Offset");
                }

                mod = m.GetStatMod("[Magic] Dex Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Dex Offset");
                }

                mod = m.GetStatMod("[Magic] Int Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Int Offset");
                }

                EvilOmenSpell.TryEndEffect(m);
                StrangleSpell.RemoveCurse(m);
                CorpseSkinSpell.RemoveCurse(m);
                CurseSpell.RemoveEffect(m);
                MortalStrike.EndWound(m);
                BloodOathSpell.RemoveCurse(m);
                MindRotSpell.ClearMindRotScalar(m);

                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);

                from.SendMessage("{0} has been completely restored!", m.Name);
            }
Exemple #14
0
        protected override void OnTarget(object o)
        {
            Mobile m = o as Mobile;

            if (m != null)
            {
                if (m.IsDeadBondedPet)
                {
                    Caster.SendLocalizedMessage(1046439); // That is not a valid target.
                }
                else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
                {
                    Caster.SendLocalizedMessage(1046439); // That is not a valid target.
                }
                else if (m is Golem)
                {
                    Caster.SendLocalizedMessage(1046439); // That is not a valid target.
                }
                else if (m.Hits > m.HitsMax && m.Stam >= m.StamMax && m.Mana >= m.ManaMax)
                {
                    Caster.SendLocalizedMessage(1155788); // Your target is already at full health, mana and stamina!
                }
                else if (CheckBSequence(m))
                {
                    double rejuv = (GetMasteryLevel() * 33.3) / 100;

                    if (rejuv > 1.0)
                    {
                        rejuv = 1.0;
                    }

                    int hitsNeeds = m.HitsMax - m.Hits;
                    int stamNeeds = m.StamMax - m.Stam;
                    int manaNeeds = m.ManaMax - m.Mana;

                    int toRejuv = 0;

                    if (hitsNeeds > 0)
                    {
                        toRejuv = (int)Math.Ceiling(hitsNeeds * rejuv);

                        if (toRejuv > 0)
                        {
                            SpellHelper.Heal(toRejuv, m, Caster, false);
                        }
                    }

                    if (stamNeeds > 0)
                    {
                        toRejuv = (int)Math.Ceiling(stamNeeds * rejuv);

                        if (toRejuv > 0)
                        {
                            m.Stam += toRejuv;
                        }
                    }

                    if (manaNeeds > 0)
                    {
                        toRejuv = (int)Math.Ceiling(manaNeeds * rejuv);

                        if (toRejuv > 0)
                        {
                            m.Mana += toRejuv;
                        }
                    }

                    if (Caster.Karma > Utility.Random(5000))
                    {
                        if (m.Poison != null)
                        {
                            m.CurePoison(Caster);
                        }

                        StatMod mod;

                        mod = m.GetStatMod("[Magic] Str Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            m.RemoveStatMod("[Magic] Str Offset");
                        }

                        mod = m.GetStatMod("[Magic] Dex Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            m.RemoveStatMod("[Magic] Dex Offset");
                        }

                        mod = m.GetStatMod("[Magic] Int Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            m.RemoveStatMod("[Magic] Int Offset");
                        }

                        m.Paralyzed = false;

                        EvilOmenSpell.TryEndEffect(m);
                        StrangleSpell.RemoveCurse(m);
                        CorpseSkinSpell.RemoveCurse(m);
                        CurseSpell.RemoveEffect(m);
                        MortalStrike.EndWound(m);
                        BloodOathSpell.RemoveCurse(m);
                        MindRotSpell.ClearMindRotScalar(m);

                        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);
                    }

                    Caster.PlaySound(0x102);

                    m.SendLocalizedMessage(1155789); // You feel completely rejuvenated!

                    if (Caster != m)
                    {
                        m.PlaySound(0x102);
                        Caster.SendLocalizedMessage(1155790); // Your target has been rejuvenated!
                    }

                    int skill = ((int)Caster.Skills[CastSkill].Value + GetWeaponSkill() + GetMasteryLevel() * 40) / 3;
                    int duration;

                    if (skill >= 120)
                    {
                        duration = 60;
                    }
                    else if (skill >= 110)
                    {
                        duration = 120;
                    }
                    else
                    {
                        duration = 180;
                    }

                    TimeSpan d;

                    if (Caster.AccessLevel == AccessLevel.Player)
                    {
                        d = TimeSpan.FromMinutes(duration);
                    }
                    else
                    {
                        d = TimeSpan.FromSeconds(10);
                    }

                    AddToCooldown(d);
                }
            }
            else
            {
                Caster.SendLocalizedMessage(1046439); // That is not a valid target.
            }
        }
        public void Target(Mobile m)
        {
            if (CheckBSequence(m) && CheckFizzle())
            {
                SpellHelper.Turn(Caster, m);

                int chance = 0;
                int karma  = Caster.Karma * -1;

                if (karma < -5000)
                {
                    chance = 0;
                }
                else if (karma < 0)
                {
                    chance = (int)Math.Sqrt(20000 + karma) - 122;
                }
                else if (karma < 5625)
                {
                    chance = (int)Math.Sqrt(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);

                    StatMod mod;

                    mod = m.GetStatMod("[Magic] Str Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Str Offset");
                    }

                    mod = m.GetStatMod("[Magic] Dex Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Dex Offset");
                    }

                    mod = m.GetStatMod("[Magic] Int Offset");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Int Offset");
                    }

                    m.Paralyzed = false;

                    EvilOmenSpell.TryEndEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);
                    MortalStrike.EndWound(m);
                    if (Core.ML)
                    {
                        BloodOathSpell.RemoveCurse(m);
                    }
                    MindRotSpell.ClearMindRotScalar(m);

                    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);
                }
                else
                {
                    m.PlaySound(0x1DF);
                }
            }

            FinishSequence();
        }
Exemple #16
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);
        }
Exemple #17
0
        public override bool OnBeforeDeath(Mobile m)
        {
            if (!(m is PlayerMobile))
            {
                return(base.OnBeforeDeath(m));
            }

            //Remove the player's items acquired in the dream
            for (int x = m.Items.Count - 1; x >= 0; x--)
            {
                if (!(m.Items[x] is Backpack))
                {
                    m.RemoveItem(m.Items[x]);
                }
            }

            for (int y = m.Backpack.Items.Count - 1; y >= 0; y--)
            {
                if ((m.Backpack.Items[y] is HelmOfCourage) || (m.Backpack.Items[y] is CrystalRoseOfLove) || (m.Backpack.Items[y] is MirrorOfTruth) || (m.Backpack.Items[y] is StaffOrb))
                {
                }
                else
                {
                    m.RemoveItem(m.Backpack.Items[y]);
                }
            }

            //Find the player's item container
            Item[] Items = Map.SerpentIsle.GetItemsInRange(new Point3D(0, 0, 0)).CastToArray <Item>();

            foreach (Item found in Items)
            {
                if (found is MetalBox)
                {
                    MetalBox box = found as MetalBox;

                    if (box.Name == m.Name)
                    {
                        //Give them back their stuff
                        for (int x = box.Items.Count - 1; x >= 0; x--)
                        {
                            if (box.Items[x] is MetalBox)
                            {
                                MetalBox itemBox = box.Items[x] as MetalBox;
                                for (int y = itemBox.Items.Count - 1; y >= 0; y--)
                                {
                                    m.AddToBackpack(itemBox.Items[y]);
                                }
                                if (itemBox.Items.Count == 0)
                                {
                                    itemBox.Delete();
                                }
                            }
                            else
                            {
                                m.EquipItem(box.Items[x]);
                            }
                        }

                        if (box.Items.Count == 0)
                        {
                            box.Delete();
                        }
                    }
                }
            }

            //Move pets back
            foreach (Mobile mobile in ((PlayerMobile)m).AllFollowers)
            {
                mobile.MoveToWorld(new Point3D(650, 881, 0), Map.SerpentIsle);
                mobile.Frozen = false;
            }


            switch (Utility.Random(2))
            {
            case 0:
                m.MoveToWorld(new Point3D(643, 881, 0), Map.SerpentIsle);
                break;

            case 1:
                m.MoveToWorld(new Point3D(662, 882, 0), Map.SerpentIsle);
                break;
            }

            m.SendMessage("Thou hast awoken from thy dream.");

            //Restore player to full
            ((PlayerMobile)m).Hits   = m.HitsMax;
            ((PlayerMobile)m).Mana   = m.ManaMax;
            ((PlayerMobile)m).Stam   = m.StamMax;
            ((PlayerMobile)m).Hunger = 20;
            ((PlayerMobile)m).Thirst = 20;

            ((PlayerMobile)m).Paralyzed = false;
            ((PlayerMobile)m).Poison    = null;

            EvilOmenSpell.TryEndEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.RemoveCurse(m);
            MindRotSpell.ClearMindRotScalar(m);

            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);

            return(false);
        }
Exemple #18
0
        public virtual Spell DoCombo(Mobile c)
        {
            Spell spell = null;

            if (m_Combo == 0)
            {
                spell = new FlameStrikeSpell(m_Mobile, null);
                ++m_Combo;                 // Move to next spell
            }
            else if (m_Combo == 1)
            {
                spell = new WitherSpell(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 MindRotSpell(m_Mobile, null);
                    }
                    else
                    {
                        spell = new WitherSpell(m_Mobile, null);
                    }

                    ++m_Combo;                             // Move to next spell

                    break;
                }

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

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

            return(spell);
        }
Exemple #19
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            if (!SmartAI)
            {
                if (!m_Mobile.Summoned && ScaleByMagery(HealChance) > Utility.RandomDouble())
                {
                    if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
                    {
                        return(new GreaterHealSpell(m_Mobile, null));
                    }
                    else if (m_Mobile.Hits < (m_Mobile.HitsMax - 10))
                    {
                        return(new HealSpell(m_Mobile, null));
                    }
                }

                return(GetRandomDamageSpell());
            }

            Spell spell = null;

            int healChance = (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits));

            if (m_Mobile.Summoned)
            {
                healChance = 0;
            }

            switch (Utility.Random(5 + healChance))
            {
            case 0:                     // Heal  myself
            {
                if (!m_Mobile.Summoned)
                {
                    if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
                    {
                        m_Mobile.UseSkill(SkillName.SpiritSpeak);
                    }
                    else if (m_Mobile.Hits < (m_Mobile.HitsMax - 10))
                    {
                        m_Mobile.UseSkill(SkillName.SpiritSpeak);
                    }
                }

                break;
            }

            case 1:                     // PoisonStrike them
            {
                if (!c.Poisoned)
                {
                    spell = new PoisonStrikeSpell(m_Mobile, null);
                }

                break;
            }

            case 2:                     // Deal some damage
            {
                spell = GetRandomDamageSpell();

                break;
            }

            case 3:                     // Set up a combo of attacks
            {
                if (m_Mobile.Mana < 30 && m_Mobile.Mana > 15)
                {
                    if (c.Paralyzed && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned)
                    {
                        spell = new PoisonSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 30 && m_Mobile.Mana < 80)
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new PainSpikeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new MindRotSpell(m_Mobile, null);
                    }
                }
                break;
            }

            case 4:                     //Combo to soften our enemies with a powerful attack while we have max mana amounts
            {
                if (m_Mobile.Mana > 80)
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new VengefulSpiritSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new PoisonStrikeSpell(m_Mobile, null);
                    }
                }
                break;
            }
            }

            return(spell);
        }
        public override void OnTarget(Object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p == null)
            {
                return;
            }

            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();
                Party         party   = Party.Get(Caster);

                double prim = Caster.Skills[CastSkill].Value;
                double sec  = Caster.Skills[DamageSkill].Value;

                IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(p), 3);
                foreach (Mobile mob in eable)
                {
                    if (mob == null)
                    {
                        continue;
                    }

                    if (mob == Caster)
                    {
                        targets.Add(mob);
                    }

                    if (Caster.CanBeBeneficial(mob, false) && party != null && party.Contains(mob))
                    {
                        targets.Add(mob);
                    }
                }
                eable.Free();

                Mobile m;
                int    toheal = (int)(((prim + sec) / 2) * 0.3) - 6;
                Caster.PlaySound(0x64C);

                for (int i = 0; i < targets.Count; i++)
                {
                    m = targets[i];
                    int toHealMod = toheal;

                    if (!m.Alive)
                    {
                        continue;
                    }

                    if (m.Poisoned)
                    {
                        int level        = m.Poison.RealLevel + 1;
                        int chanceToCure = (10000 + (int)(((prim + sec) / 2) * 75) - (level * 1750)) / 100;

                        if (chanceToCure > Utility.Random(100) && m.CurePoison(Caster))
                        {
                            toHealMod /= level;
                        }
                        else
                        {
                            toHealMod = 0;
                        }
                    }

                    if (MortalStrike.IsWounded(m))
                    {
                        MortalStrike.EndWound(m);
                        toHealMod = 0;
                    }

                    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 (m.GetStatMod("[Magic] Str Curse") != null)
                    {
                        m.RemoveStatMod("[Magic] Str Curse");
                        curselevel += 1;
                    }

                    if (m.GetStatMod("[Magic] Dex Curse") != null)
                    {
                        m.RemoveStatMod("[Magic] Dex Curse");
                        curselevel += 1;
                    }

                    if (m.GetStatMod("[Magic] Int Curse") != null)
                    {
                        m.RemoveStatMod("[Magic] Int Curse");
                        curselevel += 1;
                    }

                    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);

                    if (toHealMod > 0 && curselevel > 0)
                    {
                        int toHealMod1 = toHealMod - (curselevel * 3);
                        int toHealMod2 = toHealMod - (int)((double)toHealMod * ((double)curselevel / 100));

                        toHealMod -= toHealMod1 + toHealMod2;
                    }

                    if (toHealMod > 0)
                    {
                        SpellHelper.Heal(toHealMod + Utility.RandomMinMax(1, 6), m, Caster);
                    }
                }
            }

            FinishSequence();
        }
Exemple #21
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckBSequence(m, false))
            {
                SpellHelper.Turn(Caster, m);

                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);

                StatMod mod;

                mod = m.GetStatMod("[Magic] Str Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Str Offset");
                }

                mod = m.GetStatMod("[Magic] Dex Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Dex Offset");
                }

                mod = m.GetStatMod("[Magic] Int Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Int Offset");
                }

                m.Paralyzed = false;

                EvilOmenSpell.TryEndEffect(m);
                StrangleSpell.RemoveCurse(m);
                CorpseSkinSpell.RemoveCurse(m);
                CurseSpell.RemoveEffect(m);
                MortalStrike.EndWound(m);
                if (Core.ML)
                {
                    BloodOathSpell.RemoveCurse(m);
                }
                MindRotSpell.ClearMindRotScalar(m);

                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);
            }

            FinishSequence();
        }
Exemple #22
0
        public override void OnTarget(Object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p == null)
            {
                return;
            }

            List <Mobile> targets = new List <Mobile>();
            StatMod       mod;

            foreach (Mobile mob in Caster.Map.GetMobilesInRange(new Point3D(p), 3))
            {
                if (mob == null)
                {
                    continue;
                }

                if (Caster is PlayerMobile)
                {
                    if (Caster.CanBeBeneficial(mob, false))
                    {
                        targets.Add(mob);
                    }
                }
            }

            Mobile m;
            int    toheal = (int)(Caster.Skills[SkillName.EvalInt].Value * 0.5);

            Caster.PlaySound(0x64D);

            for (int i = 0; i < targets.Count; i++)
            {
                m = targets[i];

                if (!m.Alive)
                {
                    continue;
                }

                m.Heal(toheal + Utility.RandomMinMax(11, 15));

                mod = m.GetStatMod("[Magic] Str Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Str Offset");
                }

                mod = m.GetStatMod("[Magic] Dex Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Dex Offset");
                }

                mod = m.GetStatMod("[Magic] Int Offset");
                if (mod != null && mod.Offset < 0)
                {
                    m.RemoveStatMod("[Magic] Int Offset");
                }

                m.Paralyzed = false;
                m.Sleep     = false;             // SA Mysticism Edit
                m.CurePoison(Caster);
                EvilOmenSpell.TryEndEffect(m);
                StrangleSpell.RemoveCurse(m);
                CorpseSkinSpell.RemoveCurse(m);
                CurseSpell.RemoveEffect(m);
                MortalStrike.EndWound(m);

                if (Core.ML)
                {
                    BloodOathSpell.RemoveCurse(m);
                }

                MindRotSpell.ClearMindRotScalar(m);

                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);
            }
        }
Exemple #23
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

            int    healChance = (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits));
            int    spellResult;
            double witherChance = .10; //05% chance to wither per enemy in range

            m_Mobile.DebugSay("Choosing a Spell");
            spellResult = Utility.Random(4 + healChance);
            m_Mobile.DebugSay("Chose " + spellResult);
            switch (spellResult)
            {
            case 0:                     // Heal  myself
            {
                m_Mobile.DebugSay("0. Heal");
                if (m_Mobile.Hits < (m_Mobile.HitsMax - 50))
                {
                    spell = new GreaterHealSpell(m_Mobile, null);
                }
                else if (m_Mobile.Hits < (m_Mobile.HitsMax - 20))
                {
                    spell = new HealSpell(m_Mobile, null);
                }

                break;
            }

            case 1:                     // PoisonStrike them
            {
                m_Mobile.DebugSay("1. Poison Strike or Pfield or Ffield");
                if (!c.Poisoned && (!(c is BaseCreature) ||
                                    (((BaseCreature)c).PoisonImmune != null && ((BaseCreature)m_Mobile).HitPoison != null &&
                                     ((BaseCreature)c).PoisonImmune.Level < ((BaseCreature)m_Mobile).HitPoison.Level) ||
                                    ((BaseCreature)c).PoisonImmune == null))
                {
                    if (Utility.RandomDouble() > .5)
                    {
                        spell = new PoisonStrikeSpell(m_Mobile, null);
                    }
                    else
                    {
                        spell = new PoisonFieldSpell(m_Mobile, null);      //need to do targeting on fields
                    }
                }
                else
                if (Utility.RandomDouble() > .5)
                {
                    spell = new FireFieldSpell(m_Mobile, null);
                }
                else
                {
                    spell = new FlameStrikeSpell(m_Mobile, null);
                }

                break;
            }

            case 2:                     // Deal some damage
            {
                List <Mobile> targets = new List <Mobile>();

                BaseCreature cbc       = m_Mobile as BaseCreature;
                bool         isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned);
                //check if enough wither targets.
                foreach (Mobile m in m_Mobile.GetMobilesInRange(Core.ML ? 4 : 5))
                {
                    if (m_Mobile != m && m_Mobile.InLOS(m) && (isMonster || SpellHelper.ValidIndirectTarget(m_Mobile, m)) && m_Mobile.CanBeHarmful(m, false))
                    {
                        /*
                         * if (isMonster)
                         * {
                         * if (m is BaseCreature)
                         * {
                         *  BaseCreature bc = (BaseCreature)m;
                         *
                         *  if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team)
                         *      continue;
                         * }
                         * else if (!m.Player)
                         * {
                         *  continue;
                         * }
                         * }
                         */
                        targets.Add(m);
                    }
                }

                if (targets.Count * witherChance > Utility.RandomDouble())
                {
                    m_Mobile.DebugSay("2. Wither");
                    spell = new WitherSpell(m_Mobile, null);
                }
                else
                {
                    spell = GetRandomDamageSpell();
                    m_Mobile.DebugSay("2. Random Spell");
                }


                break;
            }

            case 3:                     // Set up a combo of attacks
            {
                if (m_Mobile.Mana < 30 && m_Mobile.Mana > 15)
                {
                    if (c.Paralyzed && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned && (!(c is BaseCreature) ||
                                             (((BaseCreature)c).PoisonImmune != null && ((BaseCreature)m_Mobile).HitPoison != null &&
                                              ((BaseCreature)c).PoisonImmune.Level < ((BaseCreature)m_Mobile).HitPoison.Level) ||
                                             ((BaseCreature)c).PoisonImmune == null))
                    {
                        m_Mobile.DebugSay("3. Casting Poison");
                        spell = new PoisonSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 30 && m_Mobile.Mana < 80)
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("3. Pain Spike (Explo)");
                        m_Combo = 0;
                        spell   = new PainSpikeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Mobile.DebugSay("3. Mind Rot or Curse (FS)");
                        m_Combo = 1;
                        if (Utility.RandomBool())
                        {
                            spell = new CurseSpell(m_Mobile, null);
                        }
                        else
                        {
                            spell = new MindRotSpell(m_Mobile, null);
                        }
                    }
                }
                else
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("4. Vengeful Spirit (Explo)");
                        m_Combo = 0;
                        spell   = new VengefulSpiritSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Mobile.DebugSay("4. Poison Strike (FS)");
                        m_Combo = 1;
                        spell   = new PoisonStrikeSpell(m_Mobile, null);
                    }
                }
                break;
            }
            }

            return(spell);
        }
Exemple #24
0
        private void OnBeginDream(PlayerMobile m)
        {
            if ((!m.Alive))
            {
                return;
            }

            m.SendMessage("Thou hast fallen asleep.");

            //Create the player's box and label it
            MetalBox playerBox = new MetalBox();

            playerBox.Name = m.Name;

            //Items list so we can remove them
            List <Item> equipItems = m.Items;

            //Remove clothing/equipment
            for (int x = m.Items.Count - 1; x >= 0; x--)
            {
                if (!(m.Items[x] is Backpack))
                {
                    playerBox.AddItem(m.Items[x]);
                }
            }

            //Create the box for the backpack items
            MetalBox backpackBox = new MetalBox();

            playerBox.AddItem(backpackBox);

            //Remove backpack items
            for (int y = m.Backpack.Items.Count - 1; y >= 0; y--)
            {
                if ((m.Backpack.Items[y] is HelmOfCourage) || (m.Backpack.Items[y] is CrystalRoseOfLove) || (m.Backpack.Items[y] is MirrorOfTruth) || (m.Backpack.Items[y] is StaffOrb))
                {
                }
                else
                {
                    backpackBox.AddItem(m.Backpack.Items[y]);
                }
            }

            //Move the container away
            playerBox.MoveToWorld(new Point3D(0, 0, 0), Map.SerpentIsle);

            //Move pets away
            foreach (Mobile mobile in m.AllFollowers)
            {
                mobile.MoveToWorld(new Point3D(0, 0, 0), Map.SerpentIsle);
                mobile.Frozen = true;
            }

            //Send to random destination in the dream
            switch (Utility.Random(4))
            {
            case 0:
                m.MoveToWorld(new Point3D(1988, 1536, 0), Map.SerpentIsle);
                m.SetDirection(Direction.East);
                break;

            case 1:
                m.MoveToWorld(new Point3D(2050, 1491, 0), Map.SerpentIsle);
                m.SetDirection(Direction.North);
                break;

            case 2:
                m.MoveToWorld(new Point3D(2040, 1389, 0), Map.SerpentIsle);
                m.SetDirection(Direction.East);
                break;

            case 3:
                m.MoveToWorld(new Point3D(1904, 1376, 0), Map.SerpentIsle);
                m.SetDirection(Direction.West);
                break;
            }

            //Restore player to full
            ((PlayerMobile)m).Hits   = m.HitsMax;
            ((PlayerMobile)m).Mana   = m.ManaMax;
            ((PlayerMobile)m).Stam   = m.StamMax;
            ((PlayerMobile)m).Hunger = 20;
            ((PlayerMobile)m).Thirst = 20;

            ((PlayerMobile)m).Paralyzed = false;
            ((PlayerMobile)m).Poison    = null;

            EvilOmenSpell.TryEndEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.RemoveCurse(m);
            MindRotSpell.ClearMindRotScalar(m);

            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);

            //Additionally, remove any polymorphs
            PolymorphSpell.EndPolymorph(m);
            StoneFormSpell.EndEffect(m);

            m.BodyMod = 0;
            m.HueMod  = -1;
        }
        public void Target(Mobile m)
        {
            if (this.CheckBSequence(m))
            {
                SpellHelper.Turn(this.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 (this.Caster.Karma < -5000)
                {
                    chance = 0;
                }
                else if (this.Caster.Karma < 0)
                {
                    chance = (int)Math.Sqrt(20000 + this.Caster.Karma) - 122;
                }
                else if (this.Caster.Karma < 5625)
                {
                    chance = (int)Math.Sqrt(this.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), this.Caster.Map);
                    IEntity to   = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), this.Caster.Map);
                    Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    m.RemoveStatMod("[Magic] Str Curse");
                    m.RemoveStatMod("[Magic] Dex Curse");
                    m.RemoveStatMod("[Magic] Int Curse");

                    m.Paralyzed = false;

                    EvilOmenSpell.TryEndEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);
                    MortalStrike.EndWound(m);
                    if (Core.ML)
                    {
                        BloodOathSpell.RemoveCurse(m);
                    }
                    MindRotSpell.ClearMindRotScalar(m);

                    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);
                    // TODO: Should this remove blood oath? Pain spike?
                }
                else
                {
                    m.PlaySound(0x1DF);
                }
            }

            this.FinishSequence();
        }
Exemple #26
0
        public static void NegateEffects(Mobile target, bool curses, bool buffs, bool damage, bool morph)
        {
            if (target == null)
            {
                return;
            }

            if (damage)
            {
                if (target.Poisoned)
                {
                    var p = target.Poison;

                    target.Poison = null;

                    target.OnCured(target, p);
                }

                target.Frozen    = false;
                target.Paralyzed = false;

                target.SetPropertyValue("Asleep", false);

                BuffInfo.RemoveBuff(target, BuffIcon.Paralyze);
                BuffInfo.RemoveBuff(target, BuffIcon.Sleep);
            }

            if (buffs)
            {
                ReactiveArmorSpell.EndArmor(target);
                MagicReflectSpell.EndReflect(target);
            }

            if (curses)
            {
                #region Pain Spike
                IDictionary table;

                if (typeof(PainSpikeSpell).GetFieldValue("m_Table", out table) && table.Contains(target))
                {
                    var t = table[target] as Timer;

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

                    table.Remove(target);

                    BuffInfo.RemoveBuff(target, BuffIcon.PainSpike);
                }
                #endregion

                CurseSpell.RemoveEffect(target);
                EvilOmenSpell.TryEndEffect(target);
                StrangleSpell.RemoveCurse(target);
                CorpseSkinSpell.RemoveCurse(target);
                BloodOathSpell.RemoveCurse(target);
                MindRotSpell.ClearMindRotScalar(target);
            }

            if (damage)
            {
                MortalStrike.EndWound(target);
                BleedAttack.EndBleed(target, target.Alive);
                MeerMage.StopEffect(target, target.Alive);
            }

            if (morph)
            {
                AnimalForm.RemoveContext(target, true);

                PolymorphSpell.StopTimer(target);
                IncognitoSpell.StopTimer(target);

                target.Send(SpeedControl.Disable);

                target.EndAction(typeof(PolymorphSpell));
                target.EndAction(typeof(IncognitoSpell));

                BuffInfo.RemoveBuff(target, BuffIcon.AnimalForm);
                BuffInfo.RemoveBuff(target, BuffIcon.Polymorph);
                BuffInfo.RemoveBuff(target, BuffIcon.Incognito);
            }

            if (buffs)
            {
                RemoveStatBonus(target, StatType.All);
            }

            if (curses)
            {
                RemoveStatCurse(target, StatType.All);
            }
        }