Esempio n. 1
0
        public override void OnTarget(Object o)
        {
            Mobile target = o as Mobile;

            if (target == null)
            {
                return;
            }

            if (m_CurseTable.ContainsKey(Caster))
            {
                Caster.SendLocalizedMessage(1154212); //You may not use the Purge Magic spell while you are under its curse.
            }
            else if (m_ImmuneTable.ContainsKey(target) || m_CurseTable.ContainsKey(target))
            {
                Caster.SendMessage("You may not use the Purge Magic spell while they are under its curse.");
            }
            else if (CheckHSequence(target))
            {
                if (CheckResisted(target))
                {
                    target.SendLocalizedMessage(501783);  // You feel yourself resisting magical energy.
                    Caster.SendLocalizedMessage(1080119); //Your Purge Magic has been resisted!
                }
                else
                {
                    Caster.PlaySound(0x655);
                    Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                    BuffType type = GetRandomBuff(target);

                    if (type != BuffType.None)
                    {
                        string arg = "";

                        switch (type)
                        {
                        case BuffType.MagicReflect:
                            MagicReflectSpell.EndReflect(target);
                            arg = "magic reflect";
                            break;

                        case BuffType.ReactiveArmor:
                            ReactiveArmorSpell.EndArmor(target);
                            arg = "reactive armor";
                            break;

                        case BuffType.Protection:
                            ProtectionSpell.EndProtection(target);
                            arg = "protection";
                            break;

                        case BuffType.Transformation:
                            TransformationSpellHelper.RemoveContext(target, true);
                            arg = "transformation spell";
                            break;

                        case BuffType.StrBonus:
                            arg = "strength bonus";
                            target.RemoveStatMod("[Magic] Str Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Strength);
                            break;

                        case BuffType.DexBonus:
                            arg = "dexterity bonus";
                            target.RemoveStatMod("[Magic] Dex Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Agility);
                            break;

                        case BuffType.IntBonus:
                            arg = "intelligence bonus";
                            target.RemoveStatMod("[Magic] Int Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Cunning);
                            break;
                        }

                        target.SendLocalizedMessage(1080117, arg); //Your ~1_ABILITY_NAME~ has been purged.
                        Caster.SendLocalizedMessage(1080118, arg); //Your target's ~1_ABILITY_NAME~ has been purged.

                        int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 15);

                        if (duration <= 0)
                        {
                            duration = 1;
                        }

                        m_ImmuneTable.Add(target, new ImmuneTimer(target, TimeSpan.FromSeconds(duration)));
                    }
                    else
                    {
                        Caster.SendLocalizedMessage(1080120); //Your target has no magic that can be purged.

                        int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 28);

                        if (duration <= 0)
                        {
                            duration = 1;
                        }

                        m_CurseTable.Add(target, new CurseTimer(target, Caster, TimeSpan.FromSeconds(duration)));
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 2
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (m_Talisman == null || m_Talisman.Deleted)
                {
                    return;
                }

                Mobile target = o as Mobile;

                if (from.Talisman != m_Talisman)
                {
                    from.SendLocalizedMessage(502641);                       // You must equip this item to use it.
                }
                else if (target == null)
                {
                    from.SendLocalizedMessage(1046439);                       // That is not a valid target.
                }
                else if (m_Talisman.ChargeTime > 0)
                {
                    from.SendLocalizedMessage(1074882, m_Talisman.ChargeTime.ToString());                       // You must wait ~1_val~ seconds for this to recharge.
                }
                else if (m_Talisman.Charges == 0 && m_Talisman.MaxCharges > 0)
                {
                    from.SendLocalizedMessage(1042544);                       // This item is out of charges.
                }
                else
                {
                    switch (m_Talisman.Removal)
                    {
                    case TalismanRemoval.Curse:
                        target.PlaySound(0xF6);
                        target.PlaySound(0x1F7);
                        target.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

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

                        StatMod mod;

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

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

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

                        target.Paralyzed = false;

                        EvilOmenSpell.TryEndEffect(target);
                        StrangleSpell.RemoveCurse(target);
                        CorpseSkinSpell.RemoveCurse(target);
                        CurseSpell.RemoveEffect(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Clumsy);
                        BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind);
                        BuffInfo.RemoveBuff(target, BuffIcon.Weaken);
                        BuffInfo.RemoveBuff(target, BuffIcon.MassCurse);

                        target.SendLocalizedMessage(1072408);                                   // Any curses on you have been lifted

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072409);                                       // Your targets curses have been lifted
                        }
                        break;

                    case TalismanRemoval.Damage:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        BleedAttack.EndBleed(target, true);
                        MortalStrike.EndWound(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Bleed);
                        BuffInfo.RemoveBuff(target, BuffIcon.MortalStrike);

                        target.SendLocalizedMessage(1072405);                                   // Your lasting damage effects have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072406);                                       // Your Targets lasting damage effects have been removed!
                        }
                        break;

                    case TalismanRemoval.Ward:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        MagicReflectSpell.EndReflect(target);
                        ReactiveArmorSpell.EndArmor(target);
                        ProtectionSpell.EndProtection(target);

                        target.SendLocalizedMessage(1072402);                                   // Your wards have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072403);                                       // Your target's wards have been removed!
                        }
                        break;

                    case TalismanRemoval.Wildfire:
                        // TODO
                        break;
                    }

                    m_Talisman.OnAfterUse(from);
                }
            }
Esempio n. 3
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);
            }
        }