Exemplo n.º 1
0
        public void Target(Mobile m)
        {
            bool CanAffect = true;

            if (m is BaseCreature)
            {
                SlayerEntry golem = SlayerGroup.GetEntryByName(SlayerName.GolemDestruction);
                if (golem.Slays(m))
                {
                    CanAffect = false;
                }
            }

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (!CanAffect)
            {
                Caster.SendMessage("This spell cannot affect golems or constructs.");
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                SpellHelper.CheckReflect(CirclePower, Caster, ref m);

                TimeSpan duration = TimeSpan.FromSeconds((DamagingSkill(Caster) / 4));

                m.FixedParticles(0x3789, 10, 25, 5032, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xBB3), 0, EffectLayer.Head);
                m.PlaySound(0x19D);

                if (m is PlayerMobile)
                {
                    m.Paralyze(duration);
                    m.SendMessage("You are frozen in fear.");
                }
                else if (m is BaseCreature)
                {
                    BaseCreature bc = (BaseCreature)m;
                    bc.BeginFlee(duration);
                }

                Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);

                HarmfulSpell(m);
            }

            FinishSequence();
        }
Exemplo n.º 2
0
        public override void OnCast()
        {
            if (this.CheckSequence())
            {
                Caster.PlaySound(0xF5);
                Caster.PlaySound(0x299);
                Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                int    dispelSkill = ComputePowerValue(2);
                double chiv        = Caster.Skills.Chivalry.Value;

                foreach (var m in AcquireIndirectTargets(Caster.Location, 8).OfType <Mobile>())
                {
                    BaseCreature bc = m as BaseCreature;

                    if (bc != null)
                    {
                        bool dispellable = bc.Summoned && !bc.IsAnimatedDead;

                        if (dispellable)
                        {
                            double dispelChance = (50.0 + ((100 * (chiv - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;
                            dispelChance *= dispelSkill / 100.0;

                            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();
                                continue;
                            }
                        }

                        bool evil = !bc.Controlled && bc.Karma < 0;

                        if (evil)
                        {
                            // TODO: Is this right?
                            double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
                            fleeChance /= 1000000;

                            if (fleeChance > Utility.RandomDouble())
                            {
                                // guide says 2 seconds, it's longer
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

                    TransformContext context = TransformationSpellHelper.GetContext(m);
                    if (context != null && context.Spell is NecromancerSpell)   //Trees are not evil!	TODO: OSI confirm?
                    {
                        // transformed ..
                        double drainChance = 0.5 * (this.Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));

                        if (drainChance > Utility.RandomDouble())
                        {
                            int drain = (5 * dispelSkill) / 100;

                            m.Stam -= drain;
                            m.Mana -= drain;
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 3
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in Caster.GetMobilesInRange(8))
                {
                    if (m is BaseCreature)
                    {
                        BaseCreature mn = m as BaseCreature;
                        if (mn.ControlSlots == 666)
                        {
                            targets.Add(m);
                        }
                        else if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }
                    else if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }
                }

                Caster.PlaySound(0xF5);
                Caster.PlaySound(0x299);
                Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                int dispelSkill = ComputePowerValue(2);

                double chiv = Caster.Skills.Chivalry.Value;

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

                    if (bc != null)
                    {
                        bool dispellable = bc.Summoned && !bc.IsAnimatedDead;

                        if (dispellable)
                        {
                            double dispelChance = (50.0 + ((100 * (chiv - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;
                            dispelChance *= dispelSkill / 100.0;

                            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();
                                continue;
                            }
                        }
                        else if (bc.ControlSlots == 666)                           // FOR SPECIAL SUMMONED WIZARD CREATURES
                        {
                            if (chiv > Utility.RandomMinMax(1, 100))
                            {
                                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                                Effects.PlaySound(m, m.Map, 0x201);
                                m.Delete();
                                continue;
                            }
                        }

                        bool evil = !bc.Controlled && bc.Karma < 0;

                        if (evil)
                        {
                            // TODO: Is this right?
                            double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
                            fleeChance /= 1000000;

                            if (fleeChance > Utility.RandomDouble())
                            {
                                // guide says 2 seconds, it's longer
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

                    TransformContext context = TransformationSpellHelper.GetContext(m);
                    if (context != null && context.Spell is NecromancerSpell)                           //Trees are not evil!	TODO: OSI confirm?
                    {
                        // transformed ..

                        double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));

                        if (drainChance > Utility.RandomDouble())
                        {
                            int drain = (5 * dispelSkill) / 100;

                            m.Stam -= drain;
                            m.Mana -= drain;
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 4
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in Caster.GetMobilesInRange(8))
                {
                    if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }
                }

                Caster.PlaySound(0x245);
                Caster.PlaySound(0x3EA);
                Caster.FixedParticles(0x2109, 1, 25, 9922, 14, 3, EffectLayer.Head);
                IEntity from = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z), Caster.Map);
                IEntity to   = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z + 32), Caster.Map);
                Effects.SendMovingParticles(from, to, 0x3192, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);


                int dispelSkill = Caster.Int;

                double mag = Caster.Skills.Magery.Value;

                for (int i = 0; i < targets.Count; ++i)
                {
                    if (targets[i] is BaseCreature)
                    {
                        BaseCreature m = targets[i] as BaseCreature;

                        if (m != null)
                        {
                            bool dispellable = m.Summoned && !m.IsAnimatedDead;

                            if (dispellable)
                            {
                                double dispelChance = (50.0 + ((100 * (mag - m.DispelDifficulty)) / (m.DispelFocus * 2))) / 100;
                                dispelChance *= dispelSkill / 100.0;

                                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();
                                    continue;
                                }
                            }

                            bool evil = !m.Controlled && !m.Blessed;

                            if (evil)
                            {
                                double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * mag * dispelSkill;
                                fleeChance /= 1000000;

                                if (fleeChance > Utility.RandomDouble())
                                {
                                    m.PlaySound(m.Female ? 814 : 1088);
                                    m.BeginFlee(TimeSpan.FromSeconds(15.0));
                                }
                            }
                        }
                    }
                }
            }

            FinishSequence();
        }