コード例 #1
0
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
                    {
                        if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)))
                        {
                            targets.Add(m);
                        }
                    }
                }

                Caster.PlaySound(0x2F3);

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

                    int damage;

                    if (Core.AOS)
                    {
                        damage = m.Hits / 2;

                        if (m.Player)
                        {
                            damage += Utility.RandomMinMax(0, 15);
                        }

                        if (damage < 15)
                        {
                            damage = 15;
                        }
                        else if (damage > 100)
                        {
                            damage = 100;
                        }
                    }
                    else
                    {
                        damage = (m.Hits * 6) / 10;

                        if (!m.Player && damage < 10)
                        {
                            damage = 10;
                        }
                        else if (damage > 75)
                        {
                            damage = 75;
                        }
                    }

                    Caster.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, Caster, damage, 100, 0, 0, 0, 0);
                }
            }

            FinishSequence();
        }
コード例 #2
0
ファイル: Reveal.cs プロジェクト: Orion321/unknown-shard
        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), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0));

                    foreach (Mobile m in eable)
                    {
                        if (m is Mobiles.ShadowKnight && (m.X != p.X || m.Y != p.Y))
                        {
                            continue;
                        }

                        if (m.Hidden && (m.AccessLevel == AccessLevel.Player || Caster.AccessLevel > m.AccessLevel) && Caster.CanBeHarmful(m, false, true) && CheckDifficulty(Caster, m))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    m.RevealingAction();

                    m.FixedParticles(0x375A, 9, 20, 5049, EffectLayer.Head);
                    m.PlaySound(0x1FD);
                }
            }

            FinishSequence();
        }
コード例 #3
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item item)
                {
                    p = item.GetWorldLocation();
                }

                List <Mobile> targets;

                Map map = Caster.Map;

                bool playerVsPlayer = false;

                if (map != null)
                {
                    IPooledEnumerable <Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);

                    targets = eable.Where(m =>
                    {
                        if (Caster == m || !SpellHelper.ValidIndirectTarget(Caster, m) || !Caster.CanBeHarmful(m, false) ||
                            Core.AOS && !Caster.InLOS(m))
                        {
                            return(false);
                        }

                        if (m.Player)
                        {
                            playerVsPlayer = true;
                        }

                        return(true);
                    }).ToList();

                    eable.Free();
                }
                else
                {
                    targets = new List <Mobile>();
                }

                double damage;

                damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
          : Utility.Random(27, 22);

                if (targets.Count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);

                    if (Core.AOS && targets.Count > 2)
                    {
                        damage = damage * 2 / targets.Count;
                    }
                    else if (!Core.AOS)
                    {
                        damage /= targets.Count;
                    }

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

                        double toDeal = damage;

                        if (!Core.AOS && CheckResisted(m))
                        {
                            damage *= 0.5;

                            m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                        }

                        toDeal *= GetDamageScalar(m);
                        Caster.DoHarmful(m);
                        SpellHelper.Damage(this, m, toDeal, 0, 100, 0, 0, 0);

                        Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                    }
                }
            }

            FinishSequence();
        }
コード例 #4
0
ファイル: Earthquake.cs プロジェクト: nogu3ira/xrunuo
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
                    {
                        if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.InLOS(m))
                        {
                            targets.Add(m);
                        }
                    }
                }

                Caster.PlaySound(0x2F3);

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

                    int damage = m.Hits / 2;

                    if (!m.IsPlayer)
                    {
                        damage = Math.Max(Math.Min(damage, 100), 15);
                    }

                    damage += Utility.RandomMinMax(0, 15);

                    Caster.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, Caster, damage, 100, 0, 0, 0, 0);
                }
            }

            FinishSequence();
        }
コード例 #5
0
        public void Target(Mobile m)
        {
            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Creates a blast of poisonous energy centered on the target.
                 * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect.
                 * One tile from main target receives 50% damage, two tiles from target receives 33% damage.
                 */

                //CheckResisted( m ); // Check magic resist for skill, but do not use return value	//reports from OSI:  Necro spells don't give Resist gain

                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                Effects.PlaySound(m.Location, m.Map, 0x229);

                double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000);

                double sdiBonus  = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100;
                double pvmDamage = damage * (1 + sdiBonus);

                if (Core.ML && sdiBonus > 0.15)
                {
                    sdiBonus = 0.15;
                }
                double pvpDamage = damage * (1 + sdiBonus);

                Map map = m.Map;

                if (map != null)
                {
                    List <Mobile> targets = new List <Mobile>();

                    if (Caster.CanBeHarmful(m, false))
                    {
                        targets.Add(m);
                    }

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

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

                        if (targ.InRange(m.Location, 0))
                        {
                            num = 1;
                        }
                        else if (targ.InRange(m.Location, 1))
                        {
                            num = 2;
                        }
                        else
                        {
                            num = 3;
                        }

                        Caster.DoHarmful(targ);
                        SpellHelper.Damage(this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0);
                    }
                }
            }

            FinishSequence();
        }
コード例 #6
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = Caster.Map;

                bool playerVsPlayer = false;

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

                    foreach (Mobile m in eable)
                    {
                        Mobile pet = m;
                        if (m is BaseCreature)
                        {
                            pet = ((BaseCreature)m).GetMaster();
                        }

                        if (Caster.Region == m.Region && Caster != m && Caster != pet && Caster.InLOS(m) && m.Blessed == false && Caster.CanBeHarmful(m, true))
                        {
                            targets.Add(m);

                            if (m.Player)
                            {
                                playerVsPlayer = true;
                            }
                        }
                    }

                    eable.Free();
                }

                double damage;

                int nBenefit = 0;
                if (Caster is PlayerMobile)
                {
                    nBenefit = (int)(Caster.Skills[SkillName.Magery].Value / 5);
                }

                if (Core.AOS)
                {
                    damage = GetNewAosDamage(51, 1, 5, playerVsPlayer) + nBenefit;
                }
                else
                {
                    damage = Utility.Random(27, 22) + nBenefit;
                }

                if (targets.Count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);

                    if (Core.AOS && targets.Count > 2)
                    {
                        damage = (damage * 2) / targets.Count;
                    }
                    else if (!Core.AOS)
                    {
                        damage /= targets.Count;
                    }

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

                        toDeal = damage;

                        if (!Core.AOS && CheckResisted(m))
                        {
                            damage *= 0.5;

                            m.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }
                        toDeal *= GetDamageScalar(m);
                        Caster.DoHarmful(m);
                        SpellHelper.Damage(this, m, toDeal, 0, 100, 0, 0, 0);

                        Point3D blast1 = new Point3D((m.X), (m.Y), m.Z);
                        Point3D blast2 = new Point3D((m.X - 1), (m.Y), m.Z);
                        Point3D blast3 = new Point3D((m.X + 1), (m.Y), m.Z);
                        Point3D blast4 = new Point3D((m.X), (m.Y - 1), m.Z);
                        Point3D blast5 = new Point3D((m.X), (m.Y + 1), m.Z);

                        Effects.SendLocationEffect(blast1, m.Map, Utility.RandomList(0x33E5, 0x33F5), 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0);
                        Effects.SendLocationEffect(blast2, m.Map, Utility.RandomList(0x33E5, 0x33F5), 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0);
                        Effects.SendLocationEffect(blast3, m.Map, Utility.RandomList(0x33E5, 0x33F5), 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0);
                        Effects.SendLocationEffect(blast4, m.Map, Utility.RandomList(0x33E5, 0x33F5), 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0);
                        Effects.SendLocationEffect(blast5, m.Map, Utility.RandomList(0x33E5, 0x33F5), 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0);
                        Effects.PlaySound(m.Location, m.Map, 0x15F);
                    }
                }
            }

            FinishSequence();
        }
コード例 #7
0
ファイル: MeteorSwarm.cs プロジェクト: phpjunkie420/RunUO
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendAsciiMessage("Target can not be seen."); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            if (Core.AOS && !Caster.InLOS(m))
                            {
                                continue;
                            }

                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                double damage;
                damage = (((7 * Utility.Random(1, 8)) + 10) * (50 + Caster.Skills[SkillName.Magery].Value)) / 100;

                if (targets.Count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);

                    if (targets.Count > 1)
                    {
                        damage = (damage * 2) / targets.Count;
                    }

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

                        double toDeal = damage;

                        if (!Core.AOS && CheckResisted(m))
                        {
                            toDeal = (toDeal + 1) / 2;

                            m.SendAsciiMessage("You feel yourself resisting magical energy.");                               // You feel yourself resisting magical energy.
                        }

                        int range = (int)Caster.GetDistanceToSqrt(m);
                        Caster.DoHarmful(m);
                        SpellHelper.Damage(TimeSpan.FromSeconds(range > 6 ? 2 : 1), m, Caster, toDeal);
                        Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                    }
                }
            }

            FinishSequence();
        }
コード例 #8
0
        public void Target(Mobile m)
        {
            int nBenefit = 0;

            if (Caster is PlayerMobile)               // WIZARD
            {
                nBenefit = (int)(Caster.Skills[SkillName.Magery].Value / 5);
            }

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (Core.AOS)
            {
                if (Caster.CanBeHarmful(m) && CheckSequence())
                {
                    Mobile from = Caster, target = m;

                    SpellHelper.Turn(from, target);

                    SpellHelper.CheckReflect((int)this.Circle, ref from, ref target);

                    int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);

                    if (damage > 60)
                    {
                        damage = 60;
                    }

                    damage = damage + nBenefit;

                    Timer.DelayCall(TimeSpan.FromSeconds(1.0),
                                    new TimerStateCallback(AosDelay_Callback),
                                    new object[] { Caster, target, m, damage });
                }
            }
            else if (CheckHSequence(m))
            {
                Mobile from = Caster, target = m;

                SpellHelper.Turn(from, target);

                SpellHelper.CheckReflect((int)this.Circle, ref from, ref target);

                // Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]

                int highestStat = target.Str, lowestStat = target.Str;

                if (target.Dex > highestStat)
                {
                    highestStat = target.Dex;
                }

                if (target.Dex < lowestStat)
                {
                    lowestStat = target.Dex;
                }

                if (target.Int > highestStat)
                {
                    highestStat = target.Int;
                }

                if (target.Int < lowestStat)
                {
                    lowestStat = target.Int;
                }

                if (highestStat > 150)
                {
                    highestStat = 150;
                }

                if (lowestStat > 150)
                {
                    lowestStat = 150;
                }

                double damage = GetDamageScalar(m) * (highestStat - lowestStat) / 4;              //less damage

                if (damage > 45)
                {
                    damage = 45;
                }

                damage = damage + nBenefit;

                if (CheckResisted(target))
                {
                    damage /= 2;
                    target.SendLocalizedMessage(501783);                       // You feel yourself resisting magical energy.
                }

                from.FixedParticles(0x374A, 10, 15, 2038, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 1181), 2, EffectLayer.Head);

                target.FixedParticles(0x374A, 10, 15, 5038, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 1181), 2, EffectLayer.Head);
                target.PlaySound(0x213);

                SpellHelper.Damage(this, target, damage, 0, 0, 100, 0, 0);
            }

            FinishSequence();
        }
コード例 #9
0
ファイル: Wither.cs プロジェクト: Delphi79/RunUO-2.0-RC1
        public override void OnCast()
        {
            if (CheckSequence())
            {
                /* Creates a withering frost around the Caster,
                 * which deals Cold Damage to all valid targets in a radius of 5 tiles.
                 */

                Map map = Caster.Map;

                if (map != null)
                {
                    ArrayList targets = new ArrayList();

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

                    Effects.PlaySound(Caster.Location, map, 0x1FB);
                    Effects.PlaySound(Caster.Location, map, 0x10B);
                    Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);

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

                        Caster.DoHarmful(m);
                        m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                        double damage = Utility.RandomMinMax(30, 35);

                        damage *= (300 + (m.Karma / 100) + (GetDamageSkill(Caster) * 10));
                        damage /= 1000;

                        // TODO: cap?
                        //if ( damage > 40 )
                        //	damage = 40;

                        SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                    }
                }
            }

            FinishSequence();
        }
コード例 #10
0
        public override void OnTarget(object o)
        {
            IPoint3D p = o as IPoint3D;

            if (p != null && CheckSequence())
            {
                Map map = Caster.Map;

                if (map != null)
                {
                    List <Mobile> targets = new List <Mobile>();

                    Rectangle2D       effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6);
                    IPooledEnumerable eable      = map.GetMobilesInBounds(effectArea);

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

                    Effects.PlaySound(p, map, 0x64F);

                    for (int x = effectArea.X; x <= effectArea.X + effectArea.Width; x++)
                    {
                        for (int y = effectArea.Y; y <= effectArea.Y + effectArea.Height; y++)
                        {
                            if (x == effectArea.X && y == effectArea.Y ||
                                x >= effectArea.X + effectArea.Width - 1 && y >= effectArea.Y + effectArea.Height - 1 ||
                                y >= effectArea.Y + effectArea.Height - 1 && x == effectArea.X ||
                                y == effectArea.Y && x >= effectArea.X + effectArea.Width - 1)
                            {
                                continue;
                            }

                            Point3D pn = new Point3D(x, y, map.GetAverageZ(x, y));
                            Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), pnt =>
                            {
                                Effects.SendLocationEffect(pnt, map, 0x375A, 8, 11, 0x49A, 0);
                            },
                                                      pn);
                        }
                    }

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

                        m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                        double damage = (((Caster.Skills[CastSkill].Value + (Caster.Skills[DamageSkill].Value / 2)) * .66) + Utility.RandomMinMax(1, 6));

                        SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100, 0);

                        double stamSap = (damage / 3);
                        double manaSap = (damage / 3);
                        double mod     = m.Skills[SkillName.MagicResist].Value - ((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2);

                        if (mod > 0)
                        {
                            mod /= 100;

                            stamSap *= mod;
                            manaSap *= mod;
                        }

                        m.Stam -= (int)stamSap;
                        m.Mana -= (int)manaSap;

                        Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
                        {
                            if (m.Alive)
                            {
                                m.Stam += (int)stamSap;
                                m.Mana += (int)manaSap;
                            }
                        });

                        Effects.SendLocationParticles(EffectItem.Create(m.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);
                    }
                }
            }

            FinishSequence();
        }
コード例 #11
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && 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), 2);

                    foreach (Mobile m in eable)
                    {
                        if (Core.AOS && m == Caster)
                        {
                            continue;
                        }

                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanSee(m) && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    Caster.DoHarmful(m);

                    SpellHelper.AddStatCurse(Caster, m, StatType.Str); SpellHelper.DisableSkillCheck = true;
                    SpellHelper.AddStatCurse(Caster, m, StatType.Dex);
                    SpellHelper.AddStatCurse(Caster, m, StatType.Int); SpellHelper.DisableSkillCheck = false;

                    m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
                    m.PlaySound(0x1FB);

                    HarmfulSpell(m);
                }
            }

            FinishSequence();
        }
コード例 #12
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(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;
                            }
                        }

                        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(10.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();
        }
コード例 #13
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0x5C6);

                int range  = 5 + FocusLevel;
                int damage = 25 + FocusLevel;

                double skill = Caster.Skills[SkillName.Spellweaving].Value;

                TimeSpan duration = TimeSpan.FromSeconds((int)(skill / 24) + FocusLevel);

                int fcMalus  = FocusLevel + 1;
                int ssiMalus = 2 * (FocusLevel + 1);

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

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

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

                    Caster.DoHarmful(m);

                    SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);

                    if (!CheckResisted(m))  //No message on resist
                    {
                        m_Table[m] = new EssenceOfWindInfo(m, fcMalus, ssiMalus, duration);

                        BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EssenceOfWind, 1075802, duration, m, String.Format("{0}\t{1}", fcMalus.ToString(), ssiMalus.ToString())));
                    }
                }
            }

            FinishSequence();
        }
コード例 #14
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item item)
                {
                    p = item.GetWorldLocation();
                }

                var targets = new List <Mobile>();

                var map = Caster.Map;

                var playerVsPlayer = false;

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

                    targets.AddRange(
                        eable.Where(
                            m =>
                    {
                        if (Core.AOS && (m == Caster || !Caster.InLOS(m)) ||
                            !SpellHelper.ValidIndirectTarget(Caster, m) ||
                            !Caster.CanBeHarmful(m, false))
                        {
                            return(false);
                        }

                        if (m.Player)
                        {
                            playerVsPlayer = true;
                        }

                        return(true);
                    }
                            )
                        .ToList()
                        );

                    eable.Free();
                }

                double damage;

                damage = Core.AOS
                    ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
                    : Utility.Random(27, 22);

                if (targets.Count > 0)
                {
                    if (Core.AOS && targets.Count > 2)
                    {
                        damage = damage * 2 / targets.Count;
                    }
                    else if (!Core.AOS)
                    {
                        damage /= targets.Count;
                    }

                    for (var i = 0; i < targets.Count; ++i)
                    {
                        var toDeal = damage;
                        var m      = targets[i];

                        if (!Core.AOS && CheckResisted(m))
                        {
                            toDeal *= 0.5;

                            m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                        }

                        toDeal *= GetDamageScalar(m);
                        Caster.DoHarmful(m);
                        SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);

                        m.BoltEffect(0);
                    }
                }
                else
                {
                    Caster.PlaySound(0x29);
                }
            }

            FinishSequence();
        }
コード例 #15
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (!CheckLineOfSight(m))
            {
                this.DoFizzle();
                Caster.SendAsciiMessage("Target is not in line of sight");
            }
            else if (Core.AOS)
            {
                if (Caster.CanBeHarmful(m) && CheckSequence())
                {
                    Mobile from = Caster, target = m;

                    SpellHelper.Turn(from, target);

                    SpellHelper.CheckReflect((int)this.Circle, ref from, ref target);

                    int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);

                    if (damage > 60)
                    {
                        damage = 60;
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(1.0),
                                    new TimerStateCallback(AosDelay_Callback),
                                    new object[] { Caster, target, m, damage });
                }
            }
            else if (CheckHSequence(m))
            {
                Mobile from = Caster, target = m;

                SpellHelper.Turn(from, target);

                SpellHelper.CheckReflect((int)this.Circle, ref from, ref target);

                // Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]

                int highestStat = target.Str, lowestStat = target.Str;

                if (target.Dex > highestStat)
                {
                    highestStat = target.Dex;
                }

                if (target.Dex < lowestStat)
                {
                    lowestStat = target.Dex;
                }

                if (target.Int > highestStat)
                {
                    highestStat = target.Int;
                }

                if (target.Int < lowestStat)
                {
                    lowestStat = target.Int;
                }

                if (highestStat > 150)
                {
                    highestStat = 150;
                }

                if (lowestStat > 150)
                {
                    lowestStat = 150;
                }

                int damage = (highestStat - lowestStat) / 4;                //less damage

                if (damage > 45)
                {
                    damage = 45;
                }

                if (CheckResisted(target))
                {
                    damage /= 2;
                    target.SendMessage("Voce sente seu corpo resistindo a magia");                     // You feel yourself resisting magical energy.
                }

                from.FixedParticles(0x374A, 10, 15, 2038, EffectLayer.Head);

                target.FixedParticles(0x374A, 10, 15, 5038, EffectLayer.Head);
                target.PlaySound(0x213);

                SpellHelper.Damage(this, target, damage, 0, 0, 100, 0, 0);
            }

            FinishSequence();
        }
コード例 #16
0
ファイル: Wither.cs プロジェクト: Drake1187/runuocustom
        public override void OnCast()
        {
            if (CheckSequence())
            {
                /* Creates a withering frost around the Caster,
                 * which deals Cold Damage to all valid targets in a radius of 5 tiles.
                 */

                Map map = Caster.Map;

                if (map != null)
                {
                    List <Mobile> targets = new List <Mobile>();

                    foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5))
                    {
                        if (Caster != m && Caster.InLOS(m) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    Effects.PlaySound(Caster.Location, map, 0x1FB);
                    Effects.PlaySound(Caster.Location, map, 0x10B);
                    Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);

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

                        Caster.DoHarmful(m);
                        m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                        double damage = Utility.RandomMinMax(30, 35);

                        damage *= (300 + (m.Karma / 100) + (GetDamageSkill(Caster) * 10));
                        damage /= 1000;

                        int sdiBonus = AosAttributes.GetValue(Caster, AosAttribute.SpellDamage);

                        // PvP spell damage increase cap of 15% from an item’s magic property in Publish 33(SE)
                        if (Core.SE && m.Player && Caster.Player && sdiBonus > 15)
                        {
                            sdiBonus = 15;
                        }

                        damage *= (100 + sdiBonus);
                        damage /= 100;

                        // TODO: cap?
                        //if ( damage > 40 )
                        //	damage = 40;

                        SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                    }
                }
            }

            FinishSequence();
        }
コード例 #17
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        Mobile pet = m;
                        if (m is BaseCreature)
                        {
                            pet = ((BaseCreature)m).GetMaster();
                        }

                        if (Caster.Region == m.Region && Caster != m && Caster != pet && Caster.InLOS(m) && m.Blessed == false && Caster.CanBeHarmful(m, true))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                double damage = DamagingSkill(Caster) / 2;
                if (damage > 125)
                {
                    damage = 125.0;
                }
                if (damage < 12)
                {
                    damage = 12.0;
                }

                if (targets.Count > 0)
                {
                    if (targets.Count > 2)
                    {
                        damage = (damage * 2) / targets.Count;
                    }

                    double toDeal;
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = targets[i];
                        toDeal = damage;
                        Caster.DoHarmful(m);

                        SlayerEntry water   = SlayerGroup.GetEntryByName(SlayerName.WaterDissipation);
                        SlayerEntry neptune = SlayerGroup.GetEntryByName(SlayerName.NeptunesBane);
                        if (m is BaseCreature)
                        {
                            if (water.Slays(m))
                            {
                                toDeal = toDeal * 2;
                            }
                            if (neptune.Slays(m))
                            {
                                toDeal = toDeal * 2;
                            }
                        }

                        SpellHelper.Damage(this, m, toDeal, 50, 50, 0, 0, 0);

                        Point3D blast1 = new Point3D((m.X), (m.Y), m.Z);
                        Point3D blast2 = new Point3D((m.X - 1), (m.Y), m.Z);
                        Point3D blast3 = new Point3D((m.X + 1), (m.Y), m.Z);
                        Point3D blast4 = new Point3D((m.X), (m.Y - 1), m.Z);
                        Point3D blast5 = new Point3D((m.X), (m.Y + 1), m.Z);

                        Effects.SendLocationEffect(blast1, m.Map, 0x3728, 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB70), 0);
                        if (Utility.RandomBool())
                        {
                            Effects.SendLocationEffect(blast2, m.Map, 0x3728, 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB70), 0);
                        }
                        if (Utility.RandomBool())
                        {
                            Effects.SendLocationEffect(blast3, m.Map, 0x3728, 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB70), 0);
                        }
                        if (Utility.RandomBool())
                        {
                            Effects.SendLocationEffect(blast4, m.Map, 0x3728, 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB70), 0);
                        }
                        if (Utility.RandomBool())
                        {
                            Effects.SendLocationEffect(blast5, m.Map, 0x3728, 85, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB70), 0);
                        }
                        Effects.PlaySound(m.Location, m.Map, 0x208);
                    }
                    Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);
                }
            }

            FinishSequence();
        }
コード例 #18
0
ファイル: ChainLightning.cs プロジェクト: SynPDX/RCUO_Alpha2
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = Caster.Map;

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

                    foreach (object o in eable)
                    {
                        IDamageable id = o as IDamageable;

                        if (id == null || (Core.AOS && id is Mobile && (Mobile)id == Caster))
                        {
                            continue;
                        }

                        if ((!(id is Mobile) || SpellHelper.ValidIndirectTarget(Caster, id as Mobile)) && Caster.CanBeHarmful(id, false))
                        {
                            if (Core.AOS && !Caster.InLOS(id))
                            {
                                continue;
                            }

                            targets.Add(id);
                        }
                    }

                    eable.Free();
                }

                double damage;

                if (targets.Count > 0)
                {
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        IDamageable id = targets[i];
                        Mobile      m  = id as Mobile;

                        if (Core.AOS)
                        {
                            damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);
                        }
                        else
                        {
                            damage = Utility.Random(27, 22);
                        }

                        if (Core.AOS && targets.Count > 2)
                        {
                            damage = (damage * 2) / targets.Count;
                        }
                        else if (!Core.AOS)
                        {
                            damage /= targets.Count;
                        }

                        if (!Core.AOS && m != null && CheckResisted(m))
                        {
                            damage *= 0.5;

                            m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                        }

                        Mobile source = Caster;

                        if (m != null)
                        {
                            SpellHelper.CheckReflect((int)Circle, ref source, ref m);
                            damage *= GetDamageScalar(m);
                        }

                        Caster.DoHarmful(m != null ? m : id);
                        SpellHelper.Damage(this, m != null ? m : id, damage, 0, 0, 0, 0, 100);

                        Effects.SendBoltEffect(m, true, 0, true);
                    }
                }
                else
                {
                    Caster.PlaySound(0x29);
                }

                targets.Clear();
                targets.TrimExcess();
            }

            FinishSequence();
        }
コード例 #19
0
ファイル: MeteorSwarm.cs プロジェクト: nydehi/divinity
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p) && !Caster.InLOS(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

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

                Map map = Caster.Map;

                bool playerVsPlayer = false;

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

                    foreach (Mobile m in eable)
                    {
                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            if (Core.AOS && !Caster.InLOS(m))
                            {
                                continue;
                            }

                            targets.Add(m);

                            if (m.Player)
                            {
                                playerVsPlayer = true;
                            }
                        }
                    }

                    eable.Free();
                }

                if (targets.Count > 0)
                {
                    double damage;

                    if (Core.AOS)
                    {
                        damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
                    }
                    else
                    {
                        damage = GetPreUORDamage();
                    }

                    Effects.PlaySound(p, Caster.Map, 0x160);

                    if (targets.Count > 2)
                    {
                        damage = (damage * 2) / targets.Count;
                    }

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

                        double toDeal = damage;

                        if (!Core.AOS && CheckResisted(m))
                        {
                            toDeal *= 0.5;

                            m.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }

                        Caster.DoHarmful(m);
                        SpellHelper.Damage(this, m, toDeal, 0, 100, 0, 0, 0);

                        Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                    }
                }
            }

            FinishSequence();
        }
コード例 #20
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                double damage;

                if (Core.AOS)
                {
                    damage = GetNewAosDamage(48, 1, 5);
                }
                else
                {
                    damage = Utility.Random(27, 22);
                }

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        if (Core.AOS && m == Caster)
                        {
                            continue;
                        }

                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                if (targets.Count > 0)
                {
                    if (Core.AOS && targets.Count > 1)
                    {
                        damage = (damage * 2) / targets.Count;
                    }
                    else if (!Core.AOS)
                    {
                        damage /= targets.Count;
                    }

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

                        double toDeal = damage;

                        if (!Core.AOS && CheckResisted(m))
                        {
                            toDeal *= 0.5;

                            m.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }

                        if (toDeal < 7)
                        {
                            toDeal = 7;
                        }

                        Caster.DoHarmful(m);
                        SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);

                        m.BoltEffect(0);
                    }
                }
            }

            FinishSequence();
        }
コード例 #21
0
ファイル: PoisonStrike.cs プロジェクト: Zilmerx/Temrael2
        public void Target(Mobile m)
        {
            Party party   = Engines.PartySystem.Party.Get(Caster);
            bool  inParty = false;

            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Creates a blast of poisonous energy centered on the target.
                 * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect.
                 * One tile from main target receives 50% damage, two tiles from target receives 33% damage.
                 */

                CheckResisted(m);                   // Check magic resist for skill, but do not use return value

                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                Effects.PlaySound(m.Location, m.Map, 0x229);

                //double damage = Utility.RandomMinMax(10, 20) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000);

                //damage = SpellHelper.AdjustValue(Caster, damage);

                int level;

                double total = Caster.Skills[SkillName.Animisme].Value; // + Caster.Skills[SkillName.Empoisonner].Value;

                if (total >= 90.0)
                {
                    level = 3;
                }
                else if (total > 70.0)
                {
                    level = 2;
                }
                else if (total > 45.0)
                {
                    level = 1;
                }
                else
                {
                    level = 0;
                }

                m.ApplyPoison(Caster, Poison.GetPoison(level));

                //SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);

                Map map = m.Map;

                if (map != null)
                {
                    ArrayList targets = new ArrayList();

                    foreach (Mobile targ in m.GetMobilesInRange(4))
                    {
                        if ((Caster != targ && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ)) && Caster.CanBeHarmful(targ, false))
                        {
                            if (party != null && party.Count > 0)
                            {
                                for (int k = 0; k < party.Members.Count; ++k)
                                {
                                    PartyMemberInfo pmi    = (PartyMemberInfo)party.Members[k];
                                    Mobile          member = pmi.Mobile;
                                    if (member.Serial == targ.Serial)
                                    {
                                        inParty = true;
                                    }
                                }
                                if (!inParty)
                                {
                                    targets.Add(targ);
                                }
                            }
                            else
                            {
                                targets.Add(targ);
                            }
                        }
                        inParty = false;
                    }

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

                        targ.ApplyPoison(Caster, Poison.GetPoison(level));

                        //SpellHelper.Damage(this, targ, damage, 0, 0, 0, 0, 100);

                        /*if (!m_Table.Contains(targ))
                         * {
                         *  Timer t = new InternalTimer(targ, Caster);
                         *  t.Start();
                         *
                         *  m_Table[targ] = t;
                         * }*/
                    }
                }
            }

            FinishSequence();
        }
コード例 #22
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                TimeSpan duration = TimeSpan.FromSeconds(0);
                double   amount   = 1;

                //Calcul du bonus donné par le sort (niveau * bonus_donne)
                if (Caster is PlayerMobile)
                {
                    //amount += (double)(((PlayerMobile)Caster).GetAptitudeValue(Aptitude.Composition) * bonus_donne);
                }

                DateTime endtime = DateTime.Now + duration;

                ArrayList m_target = new ArrayList();

                Map map = Caster.Map;

                Party party = Engines.PartySystem.Party.Get(Caster);

                //Définition des cibles du sort
                m_target.Add(Caster);

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(portee))
                    {
                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            if (party != null && party.Count > 0)
                            {
                                for (int k = 0; k < party.Members.Count; ++k)
                                {
                                    PartyMemberInfo pmi    = (PartyMemberInfo)party.Members[k];
                                    Mobile          member = pmi.Mobile;
                                    if (member.Serial == m.Serial)
                                    {
                                        m_target.Add(m);
                                    }
                                }
                            }
                        }
                    }
                }

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

                    StopTimer(targ);

                    m_PoemeTable[targ] = amount;

                    Timer t = new PoemeTimer(targ, amount, DateTime.Now + duration);
                    m_Timers[targ] = t;
                    t.Start();

                    Effects.SendTargetParticles(targ, 14170, 10, 20, 5013, 1945, 0, EffectLayer.Head); //ID, speed, dura, effect, hue, render, layer
                    targ.PlaySound(483);
                }
            }

            FinishSequence();
        }
コード例 #23
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Caster.PlaySound(0xF5);
                Caster.PlaySound(0x299);
                Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);

                var dispelSkill = ComputePowerValue(2);

                var chiv = Caster.Skills.Chivalry.Value;

                var targets = Caster.GetMobilesInRange(8)
                              .Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false));

                foreach (var m in targets)
                {
                    if (m is BaseCreature bc)
                    {
                        if (bc.Summoned && !bc.IsAnimatedDead)
                        {
                            var 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;
                            }
                        }

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

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

                            if (fleeChance > Utility.RandomDouble())
                            {
                                bc.BeginFlee(TimeSpan.FromSeconds(30.0));
                            }
                        }
                    }

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

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

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

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

            FinishSequence();
        }
コード例 #24
0
ファイル: Reveal.cs プロジェクト: Zilmerx/Temrael2
        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);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    double tile = 4;

                    tile = SpellHelper.AdjustValue(Caster, tile);

                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), (int)tile);

                    foreach (Mobile m in eable)
                    {
                        if (m.Hidden && (m.AccessLevel == AccessLevel.Player || Caster.AccessLevel > m.AccessLevel) && Caster.CanBeHarmful(m, false, true) && CheckDifficulty(Caster, m))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    m.RevealingAction();

                    Effects.SendTargetParticles(m, 0x375A, 9, 20, 5049, EffectLayer.Head);
                    m.PlaySound(0x1FD);
                }
            }

            FinishSequence();
        }
コード例 #25
0
ファイル: NetherBlast.cs プロジェクト: ifeelrobbed/ServUO
        private bool DoDamage(Mobile m, InternalItem item)
        {
            if (item.Visible && Caster != null && (!Core.AOS || m != Caster) && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
            {
                if (SpellHelper.CanRevealCaster(m))
                {
                    Caster.RevealingAction();
                }

                SkillName damageSkill = Caster.Skills[SkillName.Focus].Value > Caster.Skills[SkillName.Imbuing].Value ? SkillName.Focus : SkillName.Imbuing;

                double skill = ((Caster.Skills[SkillName.Mysticism].Value) + Caster.Skills[damageSkill].Value * 2) / 3;
                skill /= m.Player ? 3.5 : 2;

                int damage = (int)skill + Utility.RandomMinMax(-3, 3);
                damage *= (int)GetDamageScalar(m);

                int sdiBonus = SpellHelper.GetSpellDamageBonus(Caster, m, CastSkill, Caster.Player && m.Player);

                damage *= (100 + sdiBonus);
                damage /= 100;

                AOS.Damage(m, Caster, damage, 0, 0, 0, 0, 0, 100, 0, DamageType.SpellAOE);

                m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                int manaRip = Math.Min(m.Mana, damage / 4);

                if (manaRip > 0)
                {
                    m.Mana      -= manaRip;
                    Caster.Mana += manaRip;
                }
            }

            return(true);
        }
コード例 #26
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();
        }
コード例 #27
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                bool playerVsPlayer = false;

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

                    foreach (Mobile m in eable)
                    {
                        if (Core.AOS && m == Caster)
                        {
                            continue;
                        }

                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);

                            if (m.Player)
                            {
                                playerVsPlayer = true;
                            }
                        }
                    }

                    eable.Free();
                }
                if (targets.Count == 0)
                {
                    FinishSequence();
                    return;
                }

                double damage = 0;

                if (Caster is TeiravonMobile)
                {
                    TeiravonMobile tav = Caster as TeiravonMobile;

                    if (tav.IsForester() && tav.HasFeat(TeiravonMobile.Feats.TempestsWrath))
                    {
                        damage = GetNewAosDamage(48, 1, 5, Caster.Player && playerVsPlayer);
                        Mobile    targ    = targets[0] as Mobile;
                        Hashtable litup   = new Hashtable();
                        Timer     m_Chain = new ChainBounce(Caster, litup, targ, damage, this);
                        Caster.DoHarmful(targ);
                        m_Chain.Start();
                        FinishSequence();
                        return;
                    }
                    else
                    {
                        if (Core.AOS)
                        {
                            damage = GetNewAosDamage(48, 1, 5, Caster.Player && playerVsPlayer);
                        }
                        else
                        {
                            damage = Utility.Random(27, 22);
                        }

                        if (targets.Count > 0)
                        {
                            if (Core.AOS && targets.Count > 1)
                            {
                                damage = (damage * 2) / targets.Count;
                            }
                            else if (!Core.AOS)
                            {
                                damage /= targets.Count;
                            }

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

                                double toDeal = damage;

                                if (!Core.AOS && CheckResisted(m))
                                {
                                    toDeal *= 0.5;

                                    m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                                }

                                Caster.DoHarmful(m);
                                SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);

                                m.BoltEffect(0);
                            }
                        }
                    }
                }
                else
                {
                    if (Core.AOS)
                    {
                        damage = GetNewAosDamage(48, 1, 5, Caster.Player && playerVsPlayer);
                    }
                    else
                    {
                        damage = Utility.Random(27, 22);
                    }

                    if (targets.Count > 0)
                    {
                        if (Core.AOS && targets.Count > 1)
                        {
                            damage = (damage * 2) / targets.Count;
                        }
                        else if (!Core.AOS)
                        {
                            damage /= targets.Count;
                        }

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

                            double toDeal = damage;

                            if (!Core.AOS && CheckResisted(m))
                            {
                                toDeal *= 0.5;

                                m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                            }

                            Caster.DoHarmful(m);
                            SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);

                            m.BoltEffect(0);
                        }
                    }
                }
            }
            FinishSequence();
        }
コード例 #28
0
ファイル: MassDispel.cs プロジェクト: zerodowned/UO-Forever
        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))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                    BaseCreature bc = m as BaseCreature;

                    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();
        }
コード例 #29
0
ファイル: PlayingTheOdds.cs プロジェクト: UODOC/MyShard
        public override void OnCast()
        {
            BaseWeapon wep = GetWeapon();

            if (wep != null && CheckSequence())
            {
                wep.PlaySwingAnimation(Caster);

                TimeSpan duration = TimeSpan.FromMinutes(1);

                double skill = (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2;

                _HCIBonus = (int)Math.Max(45, skill / 2.667);
                _SSIBonus = (int)Math.Max(30, skill / 4);

                string args = String.Format("{0}\t{1}\t{2}", Caster.Name, _HCIBonus.ToString(), _SSIBonus.ToString());
                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.PlayingTheOddsDebuff, 1155913, 1156091, duration, Caster));
                //Your bow range has been reduced as you play the odds.

                List <Mobile> list = GetParty();

                foreach (Mobile m in list.Where(mob => mob is PlayerMobile))
                {
                    m.PlaySound(0x101);
                    m.FixedEffect(0x13B2, 10, 20, 2728, 5);
                    m.FixedEffect(0x37C4, 10, 20, 2728, 5);

                    if (m != Caster)
                    {
                        BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PlayingTheOdds, 1155913, 1155998, duration, m, args));
                    }
                    //~1_NAME~ grants you the following:<br>+~2_VAl~% Hit Chance Increase.<br>+~3_VAL~% Swing Speed Increase.
                }

                ColUtility.Free(list);

                Caster.SendLocalizedMessage(1156091); // Your bow range has been reduced as you play the odds.

                Expires = DateTime.UtcNow + duration;
                BeginTimer();

                AddToCooldown(TimeSpan.FromSeconds(90));

                IPooledEnumerable eable   = Caster.Map.GetMobilesInRange(Caster.Location, 5);
                List <Mobile>     targets = new List <Mobile>();

                foreach (Mobile m in eable)
                {
                    if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        if (!Caster.InLOS(m))
                        {
                            continue;
                        }

                        targets.Add(m);
                    }
                }
                eable.Free();

                foreach (Mobile mob in targets)
                {
                    if (HitLower.ApplyDefense(mob))
                    {
                        if (wep is BaseRanged && !(wep is BaseThrown))
                        {
                            Caster.MovingEffect(mob, ((BaseRanged)wep).EffectID, 18, 1, false, false);
                        }

                        mob.PlaySound(0x28E);
                        Effects.SendTargetEffect(mob, 0x37BE, 1, 4, 0x23, 3);

                        Caster.DoHarmful(mob);
                    }
                }

                wep.InvalidateProperties();
            }

            FinishSequence();
        }
コード例 #30
0
ファイル: Earthquake.cs プロジェクト: walshie1986/runuot2a
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
                    {
                        if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)))
                        {
                            targets.Add(m);
                        }
                    }
                }

                Caster.PlaySound(0x2F3);

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

                    int damage;

                    if (Core.AOS)
                    {
                        damage = m.Hits / 2;

                        if (!m.Player)
                        {
                            damage = Math.Max(Math.Min(damage, 100), 15);
                        }
                        damage += Utility.RandomMinMax(0, 15);
                    }
                    else
                    {
                        /*damage = (m.Hits * 6) / 10;
                         *
                         * if ( !m.Player && damage < 10 )
                         *      damage = 10;
                         * else if ( damage > 75 )
                         *      damage = 75;*/
                        damage = Utility.Random(14, 38);
                        if (CheckResisted(m))
                        {
                            damage = (int)(damage * 0.5);

                            m.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }
                    }

                    Caster.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, Caster, damage, 100, 0, 0, 0, 0);
                }
            }

            FinishSequence();
        }