Beispiel #1
0
 private static void EventSink_AggressiveAction(Mobile aggressor, Mobile aggressed, bool criminal)
 {
     if (TransformationSpellHelper.UnderTransformation(aggressor, typeof(EtherealVoyageSpell)))
     {
         TransformationSpellHelper.RemoveContext(aggressor, true);
     }
 }
Beispiel #2
0
 public static void RemoveTransformationOnAggressiveAction(AggressiveActionEventArgs e)
 {
     if (TransformationSpellHelper.UnderTransformation(e.Aggressor, typeof(EtherealVoyageSpell)))
     {
         TransformationSpellHelper.RemoveContext(e.Aggressor, true);
     }
 }
Beispiel #3
0
        public static void RemoveEffect(Mobile m)
        {
            if (TransformationSpellHelper.UnderTransformation(m))
            {
                TransformationSpellHelper.RemoveContext(m, true);
            }

            m.BodyMod = 0;

            object[] mods = (object[])m_Table[m];

            if (mods != null)
            {
                m.RemoveStatMod(((StatMod)mods[0]).Name);
                m.RemoveStatMod(((StatMod)mods[1]).Name);
                m.RemoveStatMod(((StatMod)mods[2]).Name);
                m.RemoveSkillMod((SkillMod)mods[3]);
                m.RemoveSkillMod((SkillMod)mods[4]);
                m.RemoveSkillMod((SkillMod)mods[5]);
            }

            m_Table.Remove(m);

            m.EndAction(typeof(ClericAngelicFaithSpell));
        }
Beispiel #4
0
        public override void OnRemoved(object parent)
        {
            base.OnRemoved(parent);

            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;
                TransformationSpellHelper.RemoveContext(from);                   //assume resetGraphics = true
            }
        }
Beispiel #5
0
        public override void RemoveEffect(Mobile m)
        {
            m.SendLocalizedMessage(1074771); // You are no longer under the effects of Ethereal Voyage.

            TransformationSpellHelper.RemoveContext(m, true);

            Timer.DelayCall(TimeSpan.FromMinutes(5), m.EndAction <EtherealVoyageSpell>);

            BuffInfo.RemoveBuff(m, BuffIcon.EtherealVoyage);
        }
Beispiel #6
0
 public static void Initialize()
 {
     EventSink.AggressiveAction += new AggressiveActionEventHandler(delegate(AggressiveActionEventArgs e)
     {
         if (TransformationSpellHelper.UnderTransformation(e.Aggressor, typeof(EtherealVoyageSpell)))
         {
             TransformationSpellHelper.RemoveContext(e.Aggressor, true);
         }
     });
 }
Beispiel #7
0
        public void CheckCancelMorph(Mobile m)
        {
            if (m == null)
            {
                return;
            }

            double minSkill, maxSkill;

            TransformContext context = TransformationSpellHelper.GetContext(m);

            if (context != null)
            {
                Spell spell = context.Spell as Spell;
                spell.GetCastSkills(out minSkill, out maxSkill);

                if (m.Skills[spell.CastSkill].Value < minSkill)
                {
                    TransformationSpellHelper.RemoveContext(m, context, true);
                }
            }

            if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1)
            {
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(PolymorphSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
            }

            if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1)
            {
                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).SetHairMods(-1, -1);
                }
                m.BodyMod = 0;
                m.HueMod  = -1;
                m.NameMod = null;
                m.EndAction(typeof(IncognitoSpell));
                BaseArmor.ValidateMobile(m);
                BaseClothing.ValidateMobile(m);
                BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
            }
            return;
        }
Beispiel #8
0
        public override bool CheckCast()
        {
            if (Caster.BodyMod == 123)
            {
                RemoveEffect(Caster);
                if (TransformationSpellHelper.UnderTransformation(Caster))
                {
                    TransformationSpellHelper.RemoveContext(Caster, true);
                }
                if (Caster.BodyMod != 0)
                {
                    Caster.BodyMod = 0;
                }
                return(false);
            }

            if (!TransformationSpellHelper.CheckCast(Caster, this))
            {
                return(false);
            }

            return(base.CheckCast());
        }
        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();
        }
Beispiel #10
0
        public static void WipeMods(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;

            m.DisruptiveAction();

            foreach (StatType Stat in Enum.GetValues(typeof(StatType)))
            {
                string name = String.Format("[Magic] {0} Offset", Stat);
                if (m.GetStatMod(name) != null)
                {
                    m.RemoveStatMod(name);
                }
            }

            if (TransformationSpellHelper.UnderTransformation(m))
            {
                TransformationSpellHelper.RemoveContext(m, true);
            }

            m.HueMod  = -1;
            m.NameMod = null;


            PolymorphSpell.StopTimer(m);
            IncognitoSpell.StopTimer(m);
            DisguiseGump.StopTimer(m);


            foreach (Type T in DispelActions)
            {
                m.EndAction(T);
            }

            m.BodyMod = 0;
            m.HueMod  = -1;



            if (pm != null)
            {
                if (pm.BuffTable != null)
                {
                    List <BuffInfo> list = new List <BuffInfo>();

                    foreach (BuffInfo buff in pm.BuffTable.Values)
                    {
                        if (!buff.RetainThroughDeath)
                        {
                            list.Add(buff);
                        }
                    }

                    for (int i = 0; i < list.Count; i++)
                    {
                        pm.RemoveBuff(list[i]);
                    }
                }

                pm.SavagePaintExpiration = TimeSpan.Zero;
                pm.SetHairMods(-1, -1);

                pm.ResendBuffs();
            }



            m.VirtualArmorMod = 0;


            BaseArmor.ValidateMobile(m);
            BaseClothing.ValidateMobile(m);
        }
Beispiel #11
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

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

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8);

                    foreach (Mobile m in eable)
                    {
                        if ((m is BaseCreature) && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false) ||
                            TransformationSpellHelper.UnderTransformation(m) || !m.CanBeginAction(typeof(PolymorphSpell)) ||
                            AnimalForm.UnderTransformation(Caster) || (TransformationSpellHelper.GetContext(m) != null))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    BaseCreature bc = m as BaseCreature;
                    if (TransformationSpellHelper.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            Caster.DoHarmful(m);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                            Caster.DoHarmful(m);
                        }
                    }
                    else if (!m.CanBeginAction(typeof(PolymorphSpell)))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            PolymorphSpell.EndPolymorph(m);
                            //TransformationSpellHelper.RemoveContext(m, true);
                            Caster.DoHarmful(m);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (AnimalForm.UnderTransformation(Caster))
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            AnimalForm.RemoveContext(m, true);
                            Caster.DoHarmful(m);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (TransformationSpellHelper.GetContext(m) != null)
                    {
                        double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Caster.DoHarmful(m);
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            Caster.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else
                    {
                        if (bc == null)
                        {
                            continue;
                        }

                        double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;

                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            Caster.DoHarmful(m);

                            m.FixedEffect(0x3779, 10, 20);
                        }
                    }
                }
            }

            FinishSequence();
        }
Beispiel #12
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Mobile)
                {
                    Mobile       m  = (Mobile)o;
                    BaseCreature bc = m as BaseCreature;

                    if (!from.CanSee(m))
                    {
                        from.SendLocalizedMessage(500237);                           // Target can not be seen.
                    }
                    else if (TransformationSpellHelper.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            from.DoHarmful(m);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                            from.DoHarmful(m);
                        }
                    }
                    else if (!m.CanBeginAction(typeof(PolymorphSpell)))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            //TransformationSpellHelper.RemoveContext(m, true);
                            PolymorphSpell.EndPolymorph(m);
                            from.DoHarmful(m);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (AnimalForm.UnderTransformation(m))
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            AnimalForm.RemoveContext(m, true);
                            from.DoHarmful(m);
                        }
                        else
                        {
                            from.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (TransformationSpellHelper.GetContext(m) != null)
                    {
                        double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.Skills.Magery.Value) /
                                                        ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2;
                        if (dispelChance < 0)
                        {
                            dispelChance = 0.01;
                        }
                        if (dispelChance > 1)
                        {
                            dispelChance = 1;
                        }
                        if (dispelChance > Utility.RandomDouble())
                        {
                            from.DoHarmful(m);
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                            TransformationSpellHelper.RemoveContext(m, true);
                        }
                        else
                        {
                            from.DoHarmful(m);
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        }
                    }
                    else if (bc == null || !bc.IsDispellable)
                    {
                        from.SendLocalizedMessage(1005049);                           // That cannot be dispelled.
                    }
                    else if (m_Owner.CheckHSequence(m))
                    {
                        SpellHelper.Turn(from, m);

                        double dispelChance = (50.0 + ((100 * (from.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;

                        if (dispelChance > Utility.RandomDouble())
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                            from.SendLocalizedMessage(1010084);                               // The creature resisted the attempt to dispel it!
                        }
                    }
                }
            }