Esempio n. 1
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Mobile && o is BaseCreature)
                {
                    Mobile       m  = (Mobile)o;
                    BaseCreature bc = m as BaseCreature;

                    if (!from.CanSee(m))
                    {
                        from.SendLocalizedMessage(500237);                 // Target can not be seen.
                    }
                    else if (bc.ControlSlots == 666)                       // FOR SPECIAL SUMMONED WIZARD CREATURES
                    {
                        SpellHelper.Turn(from, m);

                        if (from.Skills.Magery.Value > Utility.RandomMinMax(1, 100))
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, Server.Items.CharacterDatabase.GetMySpellHue(from, 0), 0, 5042, 0);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20, Server.Items.CharacterDatabase.GetMySpellHue(from, 0), 0);
                            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, Server.Items.CharacterDatabase.GetMySpellHue(from, 0), 0, 5042, 0);
                            Effects.PlaySound(m, m.Map, 0x201);

                            m.Delete();
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20, Server.Items.CharacterDatabase.GetMySpellHue(from, 0), 0);
                            from.SendLocalizedMessage(1010084);                               // The creature resisted the attempt to dispel it!
                        }
                    }
                }
            }
Esempio n. 2
0
            protected override void OnTarget(Mobile from, object o)
            {
                IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))

                {
                    return;
                }
                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 (bc == null || !bc.IsDispellable)
                    {
                        from.SendLocalizedMessage(1005049);                           // That cannot be dispelled.
                    }
                    else if (m_Owner.CheckHSequence(m))
                    {
                        m_Owner.Caster.DoHarmful(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!
                        }
                    }
                }
            }
Esempio n. 3
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 (bc == null || !bc.IsDispellable)
                    {
                        from.SendLocalizedMessage(1005049); // That cannot be dispelled.
                    }
                    else if (bc.SummonMaster == from || m_Owner.CheckHSequence(m))
                    {
                        SpellHelper.Turn(from, m);

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

                        //Skill Masteries
                        dispelChance -= ((double)SkillMasteries.MasteryInfo.EnchantedSummoningBonus(bc) / 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!
                        }
                    }
                }
            }
Esempio n. 4
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.SendAsciiMessage("Target can not be seen.");                           // Target can not be seen.
                    }
                    else if (bc == null || !bc.IsDispellable)
                    {
                        from.SendAsciiMessage("That cannot be dispelled.");                           // 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.SendAsciiMessage("The creature resisted the attempt to dispel it!");                               // The creature resisted the attempt to dispel it!
                        }
                    }
                }
            }
Esempio n. 5
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!
                        }
                    }
                }
            }