Esempio n. 1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            int buttonID = info.ButtonID;

            if (buttonID < 100)
            {
                return;
            }

            int page = (buttonID > 110) ? 1 : 0;

            switch (page)
            {
            case 1:
            {
                PolymorphEntry pe = SecondPageEntries[buttonID - 111] as PolymorphEntry;

                Spell spell = new PolymorphSpell(m_Caster, m_Scroll, pe.BodyID);
                spell.Cast();

                break;
            }

            case 0:
            {
                PolymorphEntry pe = FirstPageEntries[buttonID - 101] as PolymorphEntry;

                Spell spell = new PolymorphSpell(m_Caster, m_Scroll, pe.BodyID);
                spell.Cast();

                break;
            }
            }
        }
Esempio n. 2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && info.Switches.Length > 0)
            {
                int cnum = info.Switches[0];
                int cat  = cnum % 256;
                int ent  = cnum >> 8;

                if (cat >= 0 && cat < Categories.Length)
                {
                    if (ent >= 0 && ent < Categories[cat].Entries.Length)
                    {
                        if (m_Caster.Skills[SkillName.Magery].Base < Categories[cat].Entries[ent].SkillRequired)
                        {
                            m_Caster.SendAsciiMessage("You are not skilled enough to polymorph into this");
                        }
                        else
                        {
                            Spell spell = new PolymorphSpell(m_Caster, m_Scroll, Categories[cat].Entries[ent]);
                            spell.Cast();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int idx = info.ButtonID - 1;

            if (idx < 0 || idx >= m_Entries.Length)
            {
                return;
            }

            Spell spell = new PolymorphSpell(m_Caster, m_Scroll, m_Entries[idx].BodyID);

            spell.Cast();
        }
Esempio n. 4
0
        public static void RemoveDisguise(Mobile from)
        {
            from.HueMod  = -1;
            from.NameMod = null;
            ((PlayerMobile)from).SavagePaintExpiration = TimeSpan.Zero;

            ((PlayerMobile)from).SetHairMods(-1, -1);

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

            from.EndAction(typeof(PolymorphSpell));
            from.EndAction(typeof(IncognitoSpell));
        }
Esempio n. 5
0
        public static void RemoveAllEffects(Mobile target, Mobile caster)
        {
            //Remove magic reflect
            if (target.MagicDamageAbsorb > 0)
            {
                target.MagicDamageAbsorb = 0;
            }

            //dispel protection
            ProtectionSpell.StopTimer(target);

            //dispell polymorph
            PolymorphSpell.StopTimer(target);

            //dispell incognito
            IncognitoSpell.StopTimer(target);
        }
Esempio n. 6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && info.Switches.Length > 0)
            {
                int cnum = info.Switches[0];
                int cat  = cnum % 256;
                int ent  = cnum >> 8;

                if (cat >= 0 && cat < Categories.Length)
                {
                    if (ent >= 0 && ent < Categories[cat].Entries.Length)
                    {
                        Spell spell = new PolymorphSpell(m_Caster, m_Scroll, Categories[cat].Entries[ent].BodyID);
                        spell.Cast();
                    }
                }
            }
        }
Esempio n. 7
0
        public static bool DoDispell(Mobile from, Mobile m)
        {
            // only remove beneficial if target is other.
            var res = SpellHelper.RemoveStatMod(from, m, StatType.All, m != from);

            if (!res)
            {
                res = SpellHelper.RemoveStatMod(from, m, StatType.Str, m != from);
            }
            if (!res)
            {
                res = SpellHelper.RemoveStatMod(from, m, StatType.Int, m != from);
            }
            if (!res)
            {
                res = SpellHelper.RemoveStatMod(from, m, StatType.Dex, m != from);
            }
            if (!res && m != from) // only dispel if not targeting self
            {
                res = Second.ProtectionSpell.EndProtection(m);
            }
            if (!res && m != from) // only dispel if not targeting self
            {
                res = First.ReactiveArmorSpell.EndArmor(m);
            }
            if (!res)
            {
                res = DisguiseTimers.RemoveTimer(m);
                m.EndAction(typeof(IncognitoSpell));
            }

            if (!res)
            {
                if (!m.CanBeginAction(typeof(PolymorphSpell)))
                {
                    PolymorphSpell.StopTimer(m);
                    res = true;
                }
            }
            return(res);
        }
Esempio n. 8
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;
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
            }
        }
Esempio n. 11
0
        public override void OnResponse(NetState state, int index)
        {
            Spell spell = new PolymorphSpell(m_Caster, m_Scroll, Categories[0].Entries[index].BodyID);

            spell.Cast();
        }
Esempio n. 12
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);
        }
Esempio n. 13
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!
                        }
                    }
                }
            }