Пример #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.
                }
            }
Пример #2
0
        public override void Detonate(Mobile m)
        {
            int dam = Utility.RandomMinMax(MinDamage, MaxDamage);

            if (DeploymentType == DeploymentType.Tripwire)
            {
                dam *= 2;
            }

            Effects.SendBoltEffect(m, true, 0);
            AOS.Damage(m, Owner, dam, 0, 0, 100, 0, 0);

            MortalStrike.BeginWound(m, TimeSpan.FromSeconds(3));

            base.Detonate(m);
        }
Пример #3
0
        public override void OnThink()
        {
            if (Combatant != null && MagicDamageAbsorb < 1)
            {
                MagicDamageAbsorb = Utility.RandomMinMax(5, 7);
                FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
                PlaySound(0x1E9);
            }

            if (DateTime.UtcNow >= m_NextAbilityTime)
            {
                m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 15));

                var list = new ArrayList();

                foreach (var m in GetMobilesInRange(8))
                {
                    if (m is MeerWarrior && IsFriend(m) && CanBeBeneficial(m) && m.Hits < m.HitsMax && !m.Poisoned &&
                        !MortalStrike.IsWounded(m))
                    {
                        list.Add(m);
                    }
                }

                for (var i = 0; i < list.Count; ++i)
                {
                    var m = (Mobile)list[i];

                    DoBeneficial(m);

                    var toHeal = Utility.RandomMinMax(20, 30);

                    SpellHelper.Turn(this, m);

                    m.Heal(toHeal, this);

                    m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
                    m.PlaySound(0x202);
                }
            }

            base.OnThink();
        }
Пример #4
0
        public static void DoRemoveCurses(Mobile m)
        {
            StatMod mod;

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

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

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

            m.Paralyzed = false;

            EvilOmenSpell.CheckEffect(m);
            StrangleSpell.RemoveCurse(m);
            CorpseSkinSpell.RemoveCurse(m);
            CurseSpell.RemoveEffect(m);
            MortalStrike.EndWound(m);
            BloodOathSpell.EndEffect(m);
            SpellPlagueSpell.RemoveEffect(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);

            // TODO: Should this remove blood oath? Pain spike?
        }
Пример #5
0
        public override void OnThink()
        {
            if (Combatant != null && MagicDamageAbsorb < 1)
            {
                MagicDamageAbsorb = Utility.RandomMinMax(5, 7);
                FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
                PlaySound(0x1E9);
            }

            if (DateTime.UtcNow >= m_NextAbilityTime)
            {
                m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(10, 15));

                IPooledEnumerable <Mobile> eable = GetMobilesInRange(8);

                foreach (Mobile m in eable)
                {
                    if (!(m is MeerWarrior) || !IsFriend(m) || !CanBeBeneficial(m) || m.Hits >= m.HitsMax || m.Poisoned ||
                        MortalStrike.IsWounded(m))
                    {
                        continue;
                    }

                    DoBeneficial(m);

                    int toHeal = Utility.RandomMinMax(20, 30);

                    SpellHelper.Turn(this, m);

                    m.Heal(toHeal, this);

                    m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
                    m.PlaySound(0x202);
                }

                eable.Free();
            }

            base.OnThink();
        }
 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);
 }
Пример #7
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);
        }
Пример #8
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.
            }
        }
Пример #9
0
        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();
        }
Пример #10
0
        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();
        }
Пример #11
0
        public virtual void Negate(Mobile m)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (m.Frozen)
            {
                m.Frozen = false;
            }

            if (m.Paralyzed)
            {
                m.Paralyzed = false;
            }

            if (m.Poisoned)
            {
                m.CurePoison(m);
            }

            if (BleedAttack.IsBleeding(m))
            {
                BleedAttack.EndBleed(m, true);
            }

            if (MortalStrike.IsWounded(m))
            {
                MortalStrike.EndWound(m);
            }

            PolymorphSpell.StopTimer(m);
            IncognitoSpell.StopTimer(m);
            DisguiseTimers.RemoveTimer(m);

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

            MeerMage.StopEffect(m, false);

            if (DebugMode || m.AccessLevel <= AccessLevel.Counselor)
            {
                m.RevealingAction();
                m.DisruptiveAction();
            }

            if (m.Target != null)
            {
                m.Target.Cancel(m, TargetCancelType.Overriden);
            }

            m.Spell = null;

            if (m.Combatant != null)
            {
#if ServUO
                var c = m.Combatant as Mobile;
#else
                var c = m.Combatant;
#endif

                if (c != null && c.Combatant == m)
                {
                    c.Combatant = null;
                    c.Warmode   = false;
                }

                m.Combatant = null;
            }

            if (m.Aggressed != null)
            {
                m.Aggressed.Clear();
            }

            if (m.Aggressors != null)
            {
                m.Aggressors.Clear();
            }

            m.Warmode  = false;
            m.Criminal = false;

            m.Delta(MobileDelta.Noto);
        }
Пример #12
0
        public void EndSavageDance()
        {
            if (Deleted)
            {
                return;
            }

            ArrayList list = new ArrayList();

            foreach (Mobile m in this.GetMobilesInRange(8))
            {
                list.Add(m);
            }

            if (list.Count > 0)
            {
                switch (Utility.Random(3))
                {
                case 0:                         /* greater heal */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (!isFriendly)
                        {
                            continue;
                        }

                        if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
                        {
                            continue;
                        }

                        DoBeneficial(m);

                        // Algorithm: (40% of magery) + (1-10)

                        int toHeal = (int)(Skills[SkillName.Magery].Value * 0.4);
                        toHeal += Utility.Random(1, 10);

                        m.Heal(toHeal, this);

                        m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
                        m.PlaySound(0x202);
                    }

                    break;
                }

                case 1:                         /* lightning */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (isFriendly)
                        {
                            continue;
                        }

                        if (!CanBeHarmful(m))
                        {
                            continue;
                        }

                        DoHarmful(m);

                        double damage;

                        if (Core.AOS)
                        {
                            int baseDamage = 6 + (int)(Skills[SkillName.EvalInt].Value / 5.0);

                            damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
                        }
                        else
                        {
                            damage = Utility.Random(12, 9);
                        }

                        m.BoltEffect(0);

                        SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
                    }

                    break;
                }

                case 2:                         /* poison */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (isFriendly)
                        {
                            continue;
                        }

                        if (!CanBeHarmful(m))
                        {
                            continue;
                        }

                        DoHarmful(m);

                        if (m.Spell != null)
                        {
                            m.Spell.OnCasterHurt();
                        }

                        m.Paralyzed = false;

                        double total = Skills[SkillName.Magery].Value + Skills[SkillName.Poisoning].Value;

                        double dist = GetDistanceToSqrt(m);

                        if (dist >= 3.0)
                        {
                            total -= (dist - 3.0) * 10.0;
                        }

                        int level;

                        if (total >= 200.0 && Utility.Random(1, 100) <= 10)
                        {
                            level = 3;
                        }
                        else if (total > 170.0)
                        {
                            level = 2;
                        }
                        else if (total > 130.0)
                        {
                            level = 1;
                        }
                        else
                        {
                            level = 0;
                        }

                        m.ApplyPoison(this, Poison.GetPoison(level));

                        m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                        m.PlaySound(0x474);
                    }

                    break;
                }
                }
            }
        }
Пример #13
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;
        }
Пример #14
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();
        }
Пример #15
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);
            }
        }
Пример #16
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
            {
                Caster.SendLocalizedMessage(1061654);                   // You cannot heal that which is not alive.
            }
            else if (m.IsDeadBondedPet)
            {
                Caster.SendLocalizedMessage(1060177);                   // You cannot heal a creature that is already dead!
            }
            else if (m is Golem)
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951);                   // You cannot heal that.
            }
            else if (MortalStrike.IsWounded(m))
            {
                if (GetJediDamage(Caster) > Utility.RandomMinMax(185, 750))
                {
                    MortalStrike.EndWound(m);
                    BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);
                }
                else
                {
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x22, (Caster == m) ? 1005000 : 1010398);
                }
            }
            else if (m.Poisoned)
            {
                double healing = Caster.Skills[SkillName.EvalInt].Value;
                double anatomy = (double)(GetJediDamage(Caster) / 2);
                double chance  = ((healing - 30.0) / 50.0) - (m.Poison.Level * 0.1);

                if (healing >= 60.0 && anatomy >= 60.0 && chance > Utility.RandomDouble())
                {
                    if (m.CurePoison(Caster))
                    {
                        Caster.SendLocalizedMessage(1010058);
                        if (Caster != m)
                        {
                            m.SendLocalizedMessage(1010059);
                        }
                    }
                }
                else
                {
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 1010060);
                }
            }
            else if (BleedAttack.IsBleeding(m))
            {
                if (GetJediDamage(Caster) > Utility.RandomMinMax(185, 750))
                {
                    BleedAttack.EndBleed(m, false);
                }
                else
                {
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 1060159);
                }
            }
            else if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                int toHeal = (int)(Caster.Skills[SkillName.EvalInt].Value * 0.2) + (int)(GetJediDamage(Caster) * 0.1);
                toHeal += Utility.Random(1, 10);
                toHeal  = Server.Misc.MyServerSettings.PlayerLevelMod(toHeal, Caster);

                SpellHelper.Heal(toHeal, m, Caster);

                m.FixedParticles(0x376A, 9, 32, 5030, 0xB41, 0, EffectLayer.Waist);
                m.PlaySound(0x202);
            }

            FinishSequence();
        }
Пример #17
0
            public override void OnCast()
            {
                int    max, min, mana, number;
                Corpse toChannel = null;

                foreach (Item item in Caster.GetItemsInRange(3))
                {
                    if (item is Corpse && !((Corpse)item).Channeled)
                    {
                        toChannel = (Corpse)item;
                        break;
                    }
                }

                if (toChannel != null)
                {
                    min    = 1 + (int)(Caster.Skills[SkillName.SpiritSpeak].Value * 0.25);
                    max    = min + 4;
                    mana   = 0;
                    number = 1061287;                     // You channel energy from a nearby corpse to heal your wounds.
                }
                else
                {
                    min    = 1 + (int)(Caster.Skills[SkillName.SpiritSpeak].Value * 0.25);
                    max    = min + 4;
                    mana   = 10;
                    number = 1061286;                     // You channel your own spiritual energy to heal your wounds.
                }

                if (Caster.Mana < mana)
                {
                    Caster.SendLocalizedMessage(1061285);                       // You lack the mana required to use this skill.
                }
                else
                {
                    Caster.CheckSkill(SkillName.SpiritSpeak, 0.0, 120.0);

                    if (Utility.RandomDouble() > (Caster.Skills[SkillName.SpiritSpeak].Value / 100.0))
                    {
                        Caster.SendLocalizedMessage(502443); // You fail your attempt at contacting the netherworld.
                    }
                    else if (MortalStrike.IsWounded(Caster))
                    {
                        Caster.SendMessage("You cannot heal yourself.");
                    }
                    else
                    {
                        if (toChannel != null)
                        {
                            toChannel.Channeled = true;
                            toChannel.Hue       = 0x835;
                        }

                        Caster.Mana -= mana;
                        Caster.SendLocalizedMessage(number);

                        if (min > max)
                        {
                            min = max;
                        }

                        Caster.Hits += Utility.RandomMinMax(min, max);

                        Caster.FixedParticles(0x375A, 1, 15, 9501, 2100, 4, EffectLayer.Waist);
                    }
                }

                FinishSequence();
            }
Пример #18
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);
            }
        }
Пример #19
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();
        }
Пример #20
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);
        }
Пример #21
0
            public override void OnDoubleClick(Mobile from)
            {
                if (!IsChildOf(from.Backpack))
                {
                    return;
                }

                if (!from.Alive)
                {
                    return;
                }

                HealingStoneContext context = null;

                if (m_MalusTable.ContainsKey(from))
                {
                    context = m_MalusTable[from];
                }

                if (context != null && context.UnderCooldown)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1095172);                       // You must wait a few seconds before using another Healing Stone.
                }
                else if (from.Hits == from.HitsMax)
                {
                    from.SendLocalizedMessage(1049547, "", 0x59);                       // You are already at full health.
                }
                else if (!BasePotion.HasFreeHand(from) && !BasePotion.HasBalancedWeapon(from))
                {
                    from.SendLocalizedMessage(1080116);                       // You must have a free hand to use a Healing Stone.
                }
                else if (MortalStrike.IsWounded(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000);                       // You cannot heal yourself in your current state.
                }
                else if (from.Poisoned)
                {
                    // TODO (SA): Healing Stone should now heal poison
                }
                else
                {
                    int amountToHeal = Utility.RandomMinMax(1, 6) + (int)((GetBaseSkill(from) + GetBoostSkill(from)) / 8.0);

                    if (context != null)
                    {
                        amountToHeal = (int)(amountToHeal * context.Scale);
                    }

                    amountToHeal = Math.Min(amountToHeal, HealingPoints);

                    // TODO (SA): Arcane Empowerment debe otorgar un bonus.

                    from.Heal(amountToHeal);
                    from.PlaySound(0x202);

                    HealingPoints -= amountToHeal;

                    if (context != null)
                    {
                        context.Reset();
                    }
                    else
                    {
                        Timer t = Timer.DelayCall(TimeSpan.FromSeconds(Malus), new TimerCallback(
                                                      delegate
                        {
                            m_MalusTable.Remove(from);
                        }));
                        m_MalusTable.Add(from, new HealingStoneContext(from, t));
                    }
                }
            }
Пример #22
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);
        }
Пример #23
0
        public void OnTarget(object o)
        {
            var targeted = o as Mobile;

            if (targeted == null)
            {
                return;
            }

            if (CheckBSequence(targeted))
            {
                /* Soothing winds attempt to neutralize poisons, lift curses, and heal a valid
                 * Target. The Caster's Mysticism and either Focus or Imbuing (whichever is
                 * greater) skills determine the effectiveness of the Cleansing Winds.
                 */

                Caster.PlaySound(0x64C);

                var targets = new List <Mobile> {
                    targeted
                };
                targets.AddRange(FindAdditionalTargets(targeted).Take(3)); // This effect can hit up to 3 additional players beyond the primary target.

                double primarySkill   = Caster.Skills[CastSkill].Value;
                double secondarySkill = Caster.Skills[DamageSkill].Value;

                var toHeal = (int)((primarySkill + secondarySkill) / 4.0) + Utility.RandomMinMax(-3, 3);
                toHeal /= targets.Count; // The effectiveness of the spell is reduced by the number of targets affected.

                foreach (var target in targets)
                {
                    // WARNING: This spell will flag the caster as a criminal if a criminal or murderer party member is close enough
                    // to the target to receive the benefits from the area of effect.
                    Caster.DoBeneficial(target);

                    PlayEffect(target);

                    int toHealMod = toHeal;

                    if (target.Poisoned)
                    {
                        int poisonLevel  = target.Poison.RealLevel + 1;
                        int chanceToCure = (10000 + (int)((primarySkill + secondarySkill) / 2 * 75) - (poisonLevel * 1750)) / 100;

                        if (chanceToCure > Utility.Random(100) && target.CurePoison(Caster))
                        {
                            // Poison reduces healing factor by 15% per level of poison.
                            toHealMod -= (int)(toHeal * poisonLevel * 0.15);
                        }
                        else
                        {
                            // If the cure fails, the target will not be healed.
                            toHealMod = 0;
                        }
                    }

                    // Cleansing Winds will not heal the target after removing mortal wound.
                    if (MortalStrike.IsWounded(target))
                    {
                        toHealMod = 0;
                    }

                    var curseLevel = RemoveCurses(target);

                    if (toHealMod > 0 && curseLevel > 0)
                    {
                        // Each Curse reduces healing by 3 points + 1% per curse level.
                        toHealMod = toHealMod - (curseLevel * 3);
                        toHealMod = toHealMod - (int)(toHealMod * (curseLevel / 100.0));
                    }

                    if (toHealMod > 0)
                    {
                        SpellHelper.Heal(toHealMod, target, Caster);
                    }
                }
            }

            FinishSequence();
        }
Пример #24
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);

                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();
        }
Пример #25
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);
            }
Пример #26
0
        public void Target(Mobile targeted)
        {
            if (!Caster.CanSee(targeted))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckBSequence(targeted))
            {
                SpellHelper.Turn(Caster, targeted);

                /* Soothing winds attempt to neutralize poisons, lift curses, and heal a valid
                 * Target. The Caster's Mysticism and either Focus or Imbuing (whichever is
                 * greater) skills determine the effectiveness of the Cleansing Winds.
                 */

                targeted.PlaySound(0x64C);

                var targets = new List <Mobile> {
                    targeted
                };

                var map = targeted.Map;

                if (map != null)
                {
                    foreach (var m in map.GetMobilesInRange(targeted.Location, 2))
                    {
                        if (targets.Count >= 3)
                        {
                            break;
                        }

                        if (targeted != m && IsValidTarget(m))
                        {
                            targets.Add(m);
                        }
                    }
                }

                var baseToHeal = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 4.0) + Utility.RandomMinMax(-3, 3);
                baseToHeal /= targets.Count;

                foreach (var m in targets)
                {
                    Caster.DoBeneficial(m);

                    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), Caster.Map);
                    IEntity to   = new DummyEntity(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);

                    Poison poison  = m.Poison;
                    var    toHeal  = baseToHeal;
                    var    canHeal = true;

                    if (MortalStrike.IsWounded(m))
                    {
                        // Cleansing Winds will not heal the target after removing mortal wound.
                        canHeal = false;
                    }

                    // Each Curse reduces healing by 3 points + 1% per curse level.
                    var cursePower = EnchantedApple.GetCursePower(m);
                    toHeal -= cursePower * 3;
                    toHeal -= (int)(toHeal * cursePower * 0.01);

                    // Curse removal no longer based on chance.
                    RemoveCurses(m);

                    if (poison != null)
                    {
                        int chanceBonus = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) * 37.5);
                        int cureChance  = 10000 + chanceBonus - ((poison.Level + 1) * 3500);

                        if (cureChance > Utility.Random(10000))
                        {
                            m.CurePoison(Caster);

                            // Poison reduces healing factor by 15% per level of poison.
                            toHeal -= (int)(toHeal * (poison.Level + 1) * 0.15);
                        }
                        else
                        {
                            // If the cure fails, the target will not be healed.
                            canHeal = false;
                        }
                    }

                    if (canHeal)
                    {
                        m.Heal(toHeal, Caster);
                    }
                }
            }

            FinishSequence();
        }
Пример #27
0
        private static TimeSpan Mobile_HitsRegenRate(Mobile from)
        {
            bool wounded;

            wounded = MortalStrike.IsWounded(from);
            int    points = AosAttributes.GetValue(from, AosAttribute.RegenHits);
            double rate;
            double hungermod;

            if (from.Hunger > 12)
            {
                hungermod = 1.0;
            }
            else
            {
                hungermod = (from.Hunger * .08);
            }

            if (from is BaseCreature)
            {
                if (((BaseCreature)from).IsAnimatedDead)
                {
                    points -= 50;
                }
                else
                {
                    points += (int)(5 * Math.Log(from.HitsMax));
                }

                if (((BaseCreature)from).IsParagon)
                {
                    points += 10;
                }
            }
            if (CheckTransform(from, typeof(HorrificBeastSpell)))
            {
                points += 20;
            }

            if (from is TeiravonMobile)
            {
                TeiravonMobile m_Player = (TeiravonMobile)from;

                if (m_Player.HasFeat(TeiravonMobile.Feats.AdvancedHealing))
                {
                    points += (points + (int)(m_Player.PlayerLevel) + 2);
                }
                if (m_Player.HasFeat(TeiravonMobile.Feats.WholenessOfSelf))
                {
                    points += (points + (int)(m_Player.PlayerLevel) + 6);
                }
                if (m_Player.IsUndead())
                {
                    points += 10;
                    if (m_Player.IsFighter() && m_Player.Shapeshifted)
                    {
                        points += (m_Player.PlayerLevel / 5) * 2;
                    }
                }
            }
            CampfireEntry entry = Campfire.GetEntry(from);

            if (entry != null && entry.Safe)
            {
                points += 40;
            }

            if (points < 0 || wounded)
            {
                points = 0;
            }

            if (from is TeiravonMobile)
            {
                if (hungermod > 0)
                {
                    rate = (1.0 / (0.1 * (1 + points))) / hungermod;
                }
                else
                {
                    rate = 90;
                }
            }
            else
            {
                rate = (1.0 / (0.1 * (1 + points)));
            }
            if (rate < .05)
            {
                rate = .05;
            }
            return(TimeSpan.FromSeconds(rate));
        }
Пример #28
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                if (Caster is TeiravonMobile && (((TeiravonMobile)Caster).IsCleric() || ((TeiravonMobile)Caster).IsDarkCleric() || ((TeiravonMobile)Caster).IsPaladin()) && ((TeiravonMobile)Caster).Faith != TeiravonMobile.Deity.None)
                {
                    TeiravonMobile Cleric = Caster as TeiravonMobile;

                    SpellHelper.Turn(Caster, m);

                    SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

                    if (m is TeiravonMobile && ((TeiravonMobile)m).m_CloakOfDarkness)
                    {
                        return;
                    }

                    double damage;
                    switch (Cleric.Faith)
                    {
                    case TeiravonMobile.Deity.Adalia:
                    {
                        damage = GetNewAosDamage(10, 1, 5, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);
                        m.Stam -= (int)damage;
                        m.FixedParticles(0x37B9, 10, 30, 5013, 1153, 4, EffectLayer.Waist);
                        m.PlaySound(0x470);
                    }
                    break;

                    case TeiravonMobile.Deity.Cultist:
                    {
                        damage = GetNewAosDamage(5, 1, 5, true);
                        SpellHelper.Damage(this, Caster, damage);
                        damage = GetNewAosDamage(25, 5, 10, true);
                        SpellHelper.Damage(this, m, damage, 20, 20, 20, 20, 20);

                        m.FixedParticles(0x37C3, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        Caster.FixedParticles(0x37C3, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        m.PlaySound(0x44E);
                    }
                    break;

                    case TeiravonMobile.Deity.Gruumsh:
                    {
                        int hpMissing = (int)((Caster.HitsMax - Caster.Hits) * .2);
                        damage = GetNewAosDamage(10 + hpMissing, 1, 5, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);

                        Caster.FixedParticles(0x36FE, 10, 30, 5013, 137, 4, EffectLayer.Waist);
                        m.PlaySound(0x056);
                    }
                    break;

                    case TeiravonMobile.Deity.Jareth:
                    {
                        damage = GetNewAosDamage(1, 2, 2, Caster.Player && m.Player);
                        SpellHelper.Damage(this, m, damage);

                        Caster.MovingEffect(m, 0x1CEE, 10, 30, false, false, 1886, 0);
                        m.PlaySound(0x3AC);
                    }
                    break;

                    case TeiravonMobile.Deity.Kamalini:
                    {
                        damage = GetNewAosDamage(22, 1, 5, Caster.Player && m.Player);
                        if (!m.InRange(Caster, 4))
                        {
                            damage *= 0.25;         // 1/4 damage at > 4 tile range
                        }
                        else if (!m.InRange(Caster, 2))
                        {
                            damage *= 0.50;         // 1/2 damage at 2 tile range
                        }
                        SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                        Caster.Heal((int)damage * (1 - m.ColdResistance / 100));
                        Caster.PrivateOverheadMessage(MessageType.Spell, 495, false, damage.ToString(), Caster.NetState);

                        Caster.FixedParticles(0x373A, 10, 30, 5013, 157, 4, EffectLayer.Waist);
                        m.FixedParticles(0x374A, 10, 30, 5013, 157, 4, EffectLayer.Waist);
                        m.PlaySound(0x4B2);
                    }
                    break;

                    case TeiravonMobile.Deity.Kinarugi:
                    {
                        damage = GetNewAosDamage(1, 2, 3, Caster.Player && m.Player);
                        int duration = GetNewAosDamage(8, 1, 3, Caster.Player && m.Player);
                        if (!MortalStrike.IsWounded(m))
                        {
                            MortalStrike.BeginWound(m, TimeSpan.FromSeconds(duration));
                        }

                        Timer m_Timer = new KinTimer(this, Caster, m, duration, (int)damage);
                        m_Timer.Start();

                        m.LocalOverheadMessage(MessageType.Spell, 250, false, duration.ToString());
                        m.FixedParticles(0x3789, 10, 30, 5013, 1888, 2, EffectLayer.Waist);
                        m.PlaySound(0x4B2);
                    }
                    break;

                    case TeiravonMobile.Deity.Lloth:
                    {
                        damage = GetNewAosDamage(10, 1, 5, Caster.Player && m.Player);

                        TavWebbing webbing = XmlAttach.FindAttachmentOnMobile(m, typeof(TavWebbing), "web") as TavWebbing;

                        if (webbing != null)
                        {
                            webbing.Expiration = TimeSpan.FromSeconds(3);
                            webbing.DoWebbing();
                        }
                        else
                        {
                            TavWebbing newweb = new TavWebbing(5);
                            newweb.Name = "web";
                            XmlAttach.AttachTo(m, newweb);
                        }
                        int web = Utility.RandomMinMax(3811, 3814);
                        Caster.MovingParticles(m, web, 12, 5, false, false, 0x377a, 0x377a, -1);
                        SpellHelper.Damage(this, m, damage, 50, 0, 0, 50, 0);
                        Spiderling spiderling = new Spiderling(Caster, m, TimeSpan.FromSeconds(5));
                        spiderling.Combatant = m;
                        Spells.Necromancy.AnimateDeadSpell.Register(Caster, spiderling);
                        spiderling.MoveToWorld(m.Location, m.Map);
                        spiderling.YellowHealthbar = true;
                        Caster.PlaySound(0x21B);
                    }
                    break;

                    case TeiravonMobile.Deity.Narindun:
                    {
                        SlayerEntry atkSlayer = SlayerGroup.GetEntryByName(SlayerName.DaemonDismissal);
                        int         val       = atkSlayer.Slays(m) ? 45 : 15;
                        damage = GetNewAosDamage(val, 1, 5, Caster.Player & m.Player);

                        SpellHelper.Damage(this, m, damage, 0, 0, 50, 0, 50);
                        m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
                        m.PlaySound(0x0FC);
                    }
                    break;

                    case TeiravonMobile.Deity.Occido:
                    {
                        int         val     = 0;
                        ArrayList   targets = new ArrayList();
                        SlayerEntry undead  = SlayerGroup.GetEntryByName(SlayerName.Silver);
                        foreach (Mobile u in m.GetMobilesInRange(5))
                        {
                            if (undead.Slays(u) || (u is TeiravonMobile && ((TeiravonMobile)u).IsUndead()))
                            {
                                val++;
                                targets.Add(u);
                            }
                        }
                        if (val > 0)
                        {
                            for (int i = 0; i < targets.Count; ++i)
                            {
                                Mobile x = (Mobile)targets[i];
                                Effects.SendMovingEffect(x, m, Utility.Random(0x1AE0, 4), 30, 10, false, false, 2004, 3);
                            }
                        }
                        val   *= 3;
                        damage = GetNewAosDamage(5 + val, 1, 5, Caster.Player & m.Player);

                        SpellHelper.Damage(this, m, damage, 0, 0, 50, 0, 50);
                        m.FixedParticles(0x1F1F, 10, 30, 5013, 2562, 3, EffectLayer.Waist);
                        m.PlaySound(0x44E);
                    }
                    break;

                    case TeiravonMobile.Deity.Saerin:
                    {
                        int rock = Utility.RandomMetalHue();
                        m.FixedParticles(0x2565, 15, 15, 5013, rock, 1, EffectLayer.Waist);
                        damage = GetNewAosDamage(15, 1, 5, Caster.Player & m.Player);
                        SpellHelper.Damage(this, m, damage, 100, 0, 0, 0, 0);
                        int           sound = Utility.RandomMinMax(0x3B8, 0x3BE);
                        ResistanceMod mod   = new ResistanceMod(ResistanceType.Physical, -15);
                        m.AddResistanceMod(mod);
                        m.PlaySound(sound);
                        SaerTimer timer = new SaerTimer(m, mod);
                        timer.Start();
                        if (m.PhysicalResistance <= 0)
                        {
                            m.Animate(21, 5, 1, false, false, 0);
                            m.Freeze(TimeSpan.FromSeconds(.5));
                        }
                    }
                    break;

                    case TeiravonMobile.Deity.Talathas:
                    {
                        BaseWeapon weap = Caster.Weapon as BaseWeapon;
                        weap.OnHit(Caster, m);
                        Caster.NextCombatTime = DateTime.Now;
                        int effect = weap is Fists ? 0x36FE : weap.ItemID;
                        m.FixedParticles(effect, 10, 30, 5013, 2360, 2, EffectLayer.Waist);
                    }
                    break;

                    case TeiravonMobile.Deity.Valar:
                    {
                        string  name    = Utility.Random(100).ToString();
                        StatMod themmod = new StatMod(StatType.Dex, "ValarDrain", (int)(m.Dex * -.33), TimeSpan.FromSeconds(15));
                        StatMod castmod = new StatMod(StatType.Dex, "ValarDrain", (int)(m.Dex * .33), TimeSpan.FromSeconds(15));
                        m.AddStatMod(themmod);
                        Caster.AddStatMod(castmod);
                        damage = GetNewAosDamage(15, 1, 5, Caster.Player & m.Player);
                        SpellHelper.Damage(this, m, damage, 0, 0, 0, 50, 50);

                        m.FixedParticles(0x374A, 10, 30, 5013, 2364, 3, EffectLayer.Waist);
                        m.MovingParticles(Caster, 0x36E4, 10, 10, false, false, 2367, 3, 0x035, 0x36FE, 0x035, 0);
                        m.PlaySound(0x456);
                    }
                    break;
                    }
                }
                else
                {
                    SpellHelper.Turn(Caster, m);

                    SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

                    double damage;

                    if (Core.AOS)
                    {
                        damage = GetNewAosDamage(17, 1, 5, Caster.Player && m.Player);
                    }
                    else
                    {
                        damage = Utility.Random(1, 15);

                        if (CheckResisted(m))
                        {
                            damage *= 0.75;

                            m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                        }

                        damage *= GetDamageScalar(m);
                    }

                    /*
                     *              if ( !m.InRange( Caster, 2 ) )
                     *                  damage *= 0.25; // 1/4 damage at > 2 tile range
                     *              else if ( !m.InRange( Caster, 1 ) )
                     *                  damage *= 0.50; // 1/2 damage at 2 tile range
                     */
                    if (Core.AOS)
                    {
                        m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
                        m.PlaySound(0x0FC);
                    }
                    else
                    {
                        m.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist);
                        m.PlaySound(0x1F1);
                    }

                    SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                }
            }

            FinishSequence();
        }
Пример #29
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber, patientNumber;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(Patient);
            SkillName secondarySkill = GetSecondarySkill(Patient);

            BaseCreature petPatient = Patient as BaseCreature;

            if (!Healer.Alive)
            {
                healerNumber  = 500962; // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!Healer.InRange(Patient, Bandage.Range))
            {
                healerNumber  = 500963; // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!Patient.Alive || petPatient?.IsDeadPet == true)
            {
                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;
                double chance  = (healing - 68.0) / 50.0 - Slips * 0.02;

                if ((checkSkills = healing >= 80.0 && anatomy >= 80.0) && chance > Utility.RandomDouble() ||
                    Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer
                    ) //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (Patient.Map?.CanFit(Patient.Location, 16, false, false) != true)
                    {
                        healerNumber  = 501042; // Target can not be resurrected at that location.
                        patientNumber = 502391; // Thou can not be resurrected there!
                    }
                    else if (Patient.Region?.IsPartOf("Khaldun") == true)
                    {
                        healerNumber =
                            1010395; // The veil of death in this area is too strong and resists thy efforts to restore life.
                        patientNumber = -1;
                    }
                    else
                    {
                        healerNumber  = 500965; // You are able to resurrect your patient.
                        patientNumber = -1;

                        Patient.PlaySound(0x214);
                        Patient.FixedEffect(0x376A, 10, 16);

                        if (petPatient?.IsDeadPet == true)
                        {
                            Mobile master = petPatient.ControlMaster;

                            if (master != null && Healer == master)
                            {
                                petPatient.ResurrectPet();

                                for (int i = 0; i < petPatient.Skills.Length; ++i)
                                {
                                    petPatient.Skills[i].Base -= 0.1;
                                }
                            }
                            else if (master?.InRange(petPatient, 3) == true)
                            {
                                healerNumber = 503255; // You are able to resurrect the creature.

                                master.CloseGump <PetResurrectGump>();
                                master.SendGump(new PetResurrectGump(Healer, petPatient));
                            }
                            else
                            {
                                bool found = false;

                                List <Mobile> friends = petPatient.Friends;

                                for (int i = 0; friends != null && i < friends.Count; ++i)
                                {
                                    Mobile friend = friends[i];

                                    if (friend.InRange(petPatient, 3))
                                    {
                                        healerNumber = 503255; // You are able to resurrect the creature.

                                        friend.CloseGump <PetResurrectGump>();
                                        friend.SendGump(new PetResurrectGump(Healer, petPatient));

                                        found = true;
                                        break;
                                    }
                                }

                                if (!found)
                                {
                                    healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection.
                                }
                            }
                        }
                        else
                        {
                            Patient.CloseGump <ResurrectGump>();
                            Patient.SendGump(new ResurrectGump(Patient, Healer));
                        }
                    }
                }
                else
                {
                    if (petPatient?.IsDeadPet == true)
                    {
                        healerNumber = 503256; // You fail to resurrect the creature.
                    }
                    else
                    {
                        healerNumber = 500966; // You are unable to resurrect your patient.
                    }
                    patientNumber = -1;
                }
            }
            else if (Patient.Poisoned)
            {
                Healer.SendLocalizedMessage(500969); // You finish applying the bandages.

                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;
                double chance  = (healing - 30.0) / 50.0 - Patient.Poison.Level * 0.1 - Slips * 0.02;

                if ((checkSkills = healing >= 60.0 && anatomy >= 60.0) && chance > Utility.RandomDouble())
                {
                    if (Patient.CurePoison(Healer))
                    {
                        healerNumber  = Healer == Patient ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                          // You have been cured of all poisons.
                    }
                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }
                else
                {
                    healerNumber  = 1010060; // You have failed to cure your target!
                    patientNumber = -1;
                }
            }
            else if (BleedAttack.IsBleeding(Patient))
            {
                healerNumber  = 1060088; // You bind the wound and stop the bleeding
                patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding!

                BleedAttack.EndBleed(Patient, false);
            }
            else if (MortalStrike.IsWounded(Patient))
            {
                healerNumber  = Healer == Patient ? 1005000 : 1010398;
                patientNumber = -1;
                playSound     = false;
            }
            else if (Patient.Hits == Patient.HitsMax)
            {
                healerNumber  = 500967; // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = Healer.Skills[primarySkill].Value;
                double anatomy = Healer.Skills[secondarySkill].Value;
                double chance  = (healing + 10.0) / 100.0 - Slips * 0.02;

                if (chance > Utility.RandomDouble())
                {
                    healerNumber = 500969; // You finish applying the bandages.

                    double min, max;

                    if (Core.AOS)
                    {
                        min = anatomy / 8.0 + healing / 5.0 + 4.0;
                        max = anatomy / 6.0 + healing / 2.5 + 4.0;
                    }
                    else
                    {
                        min = anatomy / 5.0 + healing / 5.0 + 3.0;
                        max = anatomy / 5.0 + healing / 2.0 + 10.0;
                    }

                    double toHeal = min + Utility.RandomDouble() * (max - min);

                    if (Patient.Body.IsMonster || Patient.Body.IsAnimal)
                    {
                        toHeal += Patient.HitsMax / 100.0;
                    }

                    if (Core.AOS)
                    {
                        toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm
                    }
                    else
                    {
                        toHeal -= Slips * 4;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968; // You apply the bandages, but they barely help.
                    }

                    Patient.Heal((int)toHeal, Healer, false);
                }
                else
                {
                    healerNumber = 500968; // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                Patient.SendLocalizedMessage(patientNumber);
            }

            if (playSound)
            {
                Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                Healer.CheckSkill(secondarySkill, 0.0, 120.0);
                Healer.CheckSkill(primarySkill, 0.0, 120.0);
            }
        }
Пример #30
0
 public override void AlterMeleeDamageTo(Mobile to, ref int damage)
 {
     MortalStrike.BeginWound(to, TimeSpan.FromSeconds(5));
 }