Exemple #1
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() && CheckFizzle())
            {
                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        Mobile pet = m;

                        if (Caster.Region == m.Region && Caster != m)
                        {
                            if (m is BaseCreature)
                            {
                                pet = ((BaseCreature)m).GetMaster();
                            }

                            if (Caster != pet)
                            {
                                targets.Add(m);
                            }
                        }
                    }

                    eable.Free();
                }

                int min = 20;
                int max = (int)(GetSythDamage(Caster) / 5);

                int damage = Utility.RandomMinMax(min, max);

                int foes = (int)(GetSythDamage(Caster) / 50);
                if (foes < 1)
                {
                    foes = 1;
                }

                if (targets.Count > 0)
                {
                    if (targets.Count == 1)
                    {
                        damage = (int)(damage * 1.0);
                    }
                    else if (targets.Count == 2)
                    {
                        damage = (int)(damage * 0.90);
                    }
                    else if (targets.Count == 3)
                    {
                        damage = (int)(damage * 0.80);
                    }
                    else if (targets.Count == 4)
                    {
                        damage = (int)(damage * 0.70);
                    }
                    else if (targets.Count == 5)
                    {
                        damage = (int)(damage * 0.60);
                    }
                    else if (targets.Count == 6)
                    {
                        damage = (int)(damage * 0.50);
                    }
                    else
                    {
                        damage = (int)(damage * 0.40);
                    }

                    for (int i = 0; i < targets.Count; ++i)
                    {
                        if (foes > 0)
                        {
                            foes--;

                            Mobile m = (Mobile)targets[i];

                            Region house = m.Region;

                            if (!(house is Regions.HouseRegion))
                            {
                                Caster.DoHarmful(m);
                                AOS.Damage(m, Caster, damage, 0, 0, 0, 0, 100);

                                Point3D blast = new Point3D((m.X), (m.Y), m.Z + 10);
                                Effects.SendLocationEffect(blast, m.Map, 0x2A4E, 30, 10, 0xB00, 0);
                                m.PlaySound(0x029);
                            }
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemple #2
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && SpellHelper.CheckWater(new Point3D(p), Caster.Map) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);
                int itemID = eastToWest ? 0x3967 : 0x3979;

                Point3D  pnt      = new Point3D(p);
                TimeSpan duration = TimeSpan.FromSeconds(3.0 + (Caster.Skills[SkillName.Magery].Value / 3.0));

                if (SpellHelper.CheckField(pnt, Caster.Map))
                {
                    new InternalItem(itemID, pnt, Caster, Caster.Map, duration);
                }

                for (int i = 1; i <= 2; ++i)
                {
                    Timer.DelayCall <int>(TimeSpan.FromMilliseconds(i * 300), index =>
                    {
                        Point3D point = new Point3D(eastToWest ? pnt.X + index : pnt.X, eastToWest ? pnt.Y : pnt.Y + index, pnt.Z);
                        SpellHelper.AdjustField(ref point, Caster.Map, 16, false);

                        if (SpellHelper.CheckField(point, Caster.Map))
                        {
                            new InternalItem(itemID, point, Caster, Caster.Map, duration);
                        }

                        point = new Point3D(eastToWest ? pnt.X + -index : pnt.X, eastToWest ? pnt.Y : pnt.Y + -index, pnt.Z);
                        SpellHelper.AdjustField(ref point, Caster.Map, 16, false);

                        if (SpellHelper.CheckField(point, Caster.Map))
                        {
                            new InternalItem(itemID, point, Caster, Caster.Map, duration);
                        }
                    }, i);
                }
            }

            FinishSequence();
        }
Exemple #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)
                {
                    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 (Caster != m && 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();
                }

                double damage;

                if (Core.AOS)
                {
                    damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
                }
                else
                {
                    damage = 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))
                        {
                            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();
        }
Exemple #4
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (Server.Misc.Worlds.NoApocalypse(Caster.Location, Caster.Map))
            {
                Caster.SendMessage("You don't think it is wise to cast this here.");
                return;
            }
            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), 10);

                    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 < 45)
                {
                    damage = 45.0;
                }

                damage = damage + Caster.Hits;

                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);
                        SpellHelper.Damage(this, m, toDeal, 20, 20, 20, 20, 20);

                        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, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                        Effects.SendLocationEffect(blast2, m.Map, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                        Effects.SendLocationEffect(blast3, m.Map, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                        Effects.SendLocationEffect(blast4, m.Map, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                        Effects.SendLocationEffect(blast5, m.Map, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                        Effects.PlaySound(m.Location, m.Map, 0x108);
                    }
                    Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, true);
                    Effects.SendLocationEffect(Caster.Location, Caster.Map, 0x5475, 60, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0xB02), 0);
                    KarmaMod(Caster, ((int)RequiredSkill + RequiredMana));
                    Caster.Hits = 1;
                }
            }

            FinishSequence();
        }
Exemple #5
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendAsciiMessage("Target can not be seen.");
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

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

                int itemID = eastToWest ? 0x398C : 0x3996;

                TimeSpan duration;

                if (Core.AOS)
                {
                    duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 4);
                }
                else
                {
                    duration = TimeSpan.FromSeconds(4.0 + (Caster.Skills[SkillName.Magery].Value * 0.5));
                }

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);

                    new InternalItem(itemID, loc, Caster, Caster.Map, duration, i);
                }
            }

            FinishSequence();
        }
Exemple #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();
                }

                double damage = Utility.Random(27, 22);

                ArrayList targets = new ArrayList();

                IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(p), 1 + (int)(Caster.Skills[DamageSkill].Value / 10.0));

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

                eable.Free();

                if (targets.Count > 0)
                {
                    //damage /= targets.Count; // ~ divides damage between targets, kinda sux

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

                        double toDeal = damage;

                        if (CheckResisted(m))
                        {
                            toDeal *= 0.7;

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

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

                        m.FixedParticles(0x3709, 20, 10, 5044, EffectLayer.RightFoot);
                        m.PlaySound(0x21F);
                        m.FixedParticles(0x36BD, 10, 30, 5052, EffectLayer.Head);
                        m.PlaySound(0x208);
                    }
                }
            }

            FinishSequence();
        }
Exemple #7
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), 5);

                    foreach (Mobile m in eable)
                    {
                        Mobile pet = m;

                        if (Caster != m)
                        {
                            if (m is BaseCreature)
                            {
                                pet = ((BaseCreature)m).GetMaster();
                            }

                            if (Caster != pet)
                            {
                                targets.Add(m);

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

                    eable.Free();
                }

                double damage;

                int nBenefit = 0;
                if (Caster is PlayerMobile)                   // WIZARD
                {
                    nBenefit = (int)(GetKarmaPower(Caster) / 5);
                }

                damage = GetNewAosDamage(32, 1, 4, Caster.Player && playerVsPlayer) + nBenefit;

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

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

                        double toDeal = damage;

                        if (!(house is Regions.HouseRegion))
                        {
                            Caster.DoHarmful(m);
                            SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);

                            m.BoltEffect(0);
                        }
                    }
                }
            }

            FinishSequence();
        }
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(this.Caster, this.Caster) && this.CheckSequence())
            {
                List <IDamageable> targets = new List <IDamageable>();

                Map map = this.Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = this.Caster.GetObjectsInRange(1 + (int)(this.Caster.Skills[SkillName.Magery].Value / 15.0));

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

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

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

                            targets.Add(id);
                        }
                    }

                    eable.Free();
                }

                this.Caster.PlaySound(0x220);

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

                    int damage;

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

                        if (m == null || !m.Player)
                        {
                            damage = Math.Max(Math.Min(damage, 100), 15);
                        }
                        damage += Utility.RandomMinMax(0, 15);
                    }
                    else
                    {
                        damage = (id.Hits * 6) / 10;

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

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

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

            this.FinishSequence();
        }
        public void OnTarget(IPoint3D p)
        {
            if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);
                SpellHelper.GetSurfaceTop(ref p);

                Map map = Caster.Map;

                if (map == null)
                {
                    return;
                }

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

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

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

                    if (id == null || (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;
                        }

                        toEffect.Add(id);
                    }
                }

                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;
                        }

                        IPoint3D pnt = new Point3D(x, y, p.Z);
                        SpellHelper.GetSurfaceTop(ref pnt);

                        Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), point =>
                        {
                            Effects.SendLocationEffect(point, map, 0x3779, 12, 11, 0x63, 0);
                        },
                                                  new Point3D(pnt));
                    }
                }

                foreach (var id in toEffect)
                {
                    if (id.Deleted)
                    {
                        continue;
                    }

                    int damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);

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

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, id, damage, 0, 0, 100, 0, 0);

                    Server.Effects.SendTargetParticles(id, 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255, 0);
                }

                ColUtility.Free(toEffect);
            }

            FinishSequence();
        }
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                //Player Enhancement Customization: Tremor
                bool tremor = false; //PlayerEnhancementPersistance.IsCustomizationEntryActive(Caster, CustomizationType.Tremors);

                bool    enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, null, EnhancedSpellbookType.Wizard, false, true);
                Boolean chargedSpellcast  = SpellHelper.IsChargedSpell(Caster, null, false, Scroll != null);

                int range = 1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0);

                bool useHeightCheck = true;
                int  maxDifferenceZ = 20;

                if (map != null)
                {
                    foreach (Mobile m in Caster.GetMobilesInRange(range))
                    {
                        int differenceZ = Math.Abs(Caster.Location.Z - m.Location.Z);

                        if (useHeightCheck && (differenceZ >= maxDifferenceZ))
                        {
                            continue;
                        }

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

                Caster.PlaySound(0x2f3);

                int baseDamage = Utility.RandomMinMax(20, 25);

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

                    double damage      = (double)Utility.RandomMinMax(5, 10);
                    double damageBonus = 0;

                    CheckMagicResist(mobile);

                    if (mobile is PlayerMobile)
                    {
                        damage = (double)mobile.Hits * .6;
                    }

                    else
                    {
                        Boolean isTamedTarget = SpellHelper.IsTamedTarget(Caster, mobile);

                        if (enhancedSpellcast)
                        {
                            if (isTamedTarget)
                            {
                                damageBonus += SpellHelper.EnhancedSpellTamedCreatureBonus;
                            }

                            else
                            {
                                damageBonus += SpellHelper.EnhancedSpellBonus;
                            }
                        }

                        if (chargedSpellcast)
                        {
                            if (isTamedTarget)
                            {
                                damageBonus += SpellHelper.ChargedSpellTamedCreatureBonus;
                            }

                            else
                            {
                                damageBonus += SpellHelper.ChargedSpellBonus;
                            }
                        }

                        mobile.FixedEffect(0x3779, 10, 20);

                        BaseCreature bc_Target = mobile as BaseCreature;
                        PlayerMobile pm_Target = mobile as PlayerMobile;

                        if (bc_Target != null)
                        {
                            if (bc_Target.ShipOccupied != null)
                            {
                                damage *= BaseShip.shipBasedAoESpellDamageToCreatureScalar;
                            }
                        }

                        if (pm_Target != null)
                        {
                            if (pm_Target.ShipOccupied != null)
                            {
                                damage *= BaseShip.shipBasedAoESpellDamageToPlayerScalar;
                            }
                        }

                        damage *= GetDamageScalar(mobile, damageBonus);
                    }

                    Caster.DoHarmful(mobile);

                    SpellHelper.Damage(this, Caster, mobile, damage);
                }

                if (tremor)
                {
                    CustomizationAbilities.Tremor(Caster, range);
                }
            }

            ArenaFight.SpellCompletion(Caster, typeof(EarthquakeSpell));

            FinishSequence();
        }
Exemple #11
0
        public void Target(IPoint3D p)
        {
            Point3D point = new Point3D(p.X, p.Y, p.Z);

            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (BaseShip.FindShipAt(p, Caster.Map) != null)
            {
                Caster.SendMessage("That location is blocked.");
            }

            else if (SpellHelper.CheckTown(point, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

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

                for (int i = -1; i <= 1; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 22, true);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new WallOfStoneItem(loc, Caster.Map, Caster);
                    Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025);
                }
            }

            FinishSequence();

            Caster.BeginAction(typeof(WallOfStoneSpell));
            Timer.DelayCall(TimeSpan.FromSeconds(16), delegate { Caster.EndAction(typeof(WallOfStoneSpell)); });
        }
Exemple #12
0
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                XmlData x = (XmlData)XmlAttach.FindAttachmentOnMobile(Caster, typeof(XmlData), "Cryomancer");
                if (x != null)
                {
                    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);
                            }
                        }
                    }
                    DoIceNova(GetNewAosDamage(30, 1, 12, false), Caster, targets);
                }
                else
                {
                    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 / 4;

                            if (damage < 10)
                            {
                                damage = 10;
                            }
                            else if (damage > 100)
                            {
                                damage = 100;
                            }

                            damage = GetNewAosDamage(damage, 1, 5, m.Player);
                        }
                        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();
        }
Exemple #13
0
        public void OnTarget(IPoint3D p)
        {
            if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);
                SpellHelper.GetSurfaceTop(ref p);

                Map map = Caster.Map;

                if (map == null)
                {
                    return;
                }

                Rectangle2D effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6);
                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;
                        }

                        IPoint3D pnt = new Point3D(x, y, p.Z);
                        SpellHelper.GetSurfaceTop(ref pnt);

                        Timer.DelayCall(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), point =>
                        {
                            Effects.SendLocationEffect(point, map, 0x3779, 12, 11, 0x63, 0);
                        },
                                        new Point3D(pnt));
                    }
                }

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

                foreach (var target in AcquireIndirectTargets(p, 2))
                {
                    list.Add(target);
                }

                int count = list.Count;

                for (var index = 0; index < list.Count; index++)
                {
                    IDamageable id = list[index];

                    if (id.Deleted)
                    {
                        continue;
                    }

                    int damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);

                    if (count > 2)
                    {
                        damage = (damage * 2) / count;
                    }

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, id, damage, 0, 0, 100, 0, 0);

                    Effects.SendTargetParticles(id, 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255, 0);
                }

                ColUtility.Free(list);
            }

            FinishSequence();
        }
Exemple #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();
                }

                List <Mobile> targets;

                var map = Caster.Map;

                var playerVsPlayer = false;

                if (map != null)
                {
                    var 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 (var i = 0; i < targets.Count; ++i)
                    {
                        var m = targets[i];

                        var 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();
        }
        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, 100);

                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;
                        SpellHelper.CheckReflect((int)Circle, ref source, ref id, SpellDamageType);

                        if (m != null)
                        {
                            damage *= GetDamageScalar(m);
                        }

                        Effects.SendBoltEffect(id, true, 0, false);

                        Caster.DoHarmful(id);
                        SpellHelper.Damage(this, id, damage, 0, 0, 0, 0, 100);
                    }
                }
                else
                {
                    Caster.PlaySound(0x29);
                }

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

            FinishSequence();
        }
        public override void OnCast()
        {
            if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
            {
                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                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();
        }
        public void Target(IPoint3D p)
        {
            if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                /* Summons a storm of hailstones that strikes all Targets
                 * within a radius around the Target's Location, dealing
                 * cold damage.
                 */

                SpellHelper.Turn(Caster, p);

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

                var targets = new List <Mobile>();

                var map = Caster.Map;

                var pvp = false;

                if (map != null)
                {
                    PlayEffect(p, Caster.Map);

                    foreach (var m in map.GetMobilesInRange(new Point3D(p), 2))
                    {
                        if (m == Caster)
                        {
                            continue;
                        }

                        if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.CanSee(m))
                        {
                            if (!Caster.InLOS(m))
                            {
                                continue;
                            }

                            targets.Add(m);

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

                double damage = GetNewAosDamage(51, 1, 5, pvp);

                foreach (var m in targets)
                {
                    Caster.DoHarmful(m);
                    SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
                }
            }

            FinishSequence();
        }
Exemple #18
0
        public void Target(IPoint3D p, Item item)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && (item != null || CheckSequence()))
            {
                if (item != null)
                {
                    if (item is MaskOfKhalAnkur)
                    {
                        ((MaskOfKhalAnkur)item).Charges--;
                    }

                    if (item is PendantOfKhalAnkur)
                    {
                        ((PendantOfKhalAnkur)item).Charges--;
                    }
                }

                SpellHelper.Turn(Caster, p);

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

                IEnumerable <IDamageable> targets = AcquireIndirectTargets(p, 2);
                int count = targets.Count();

                if (count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);
                }

                foreach (var id in targets)
                {
                    Mobile m = id as Mobile;
                    double damage;

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

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

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

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

                    IDamageable source = Caster;
                    IDamageable target = id;

                    if (SpellHelper.CheckReflect((int)Circle, ref source, ref target, SpellDamageType))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
                        {
                            source.MovingParticles(target, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                        });
                    }

                    if (m != null)
                    {
                        damage *= GetDamageScalar(m);
                    }

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);

                    Caster.MovingParticles(id, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                }
            }

            FinishSequence();
        }
Exemple #19
0
        public void Target(IPoint3D p, Item item)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && (item != null || CheckSequence()))
            {
                if (item != null)
                {
                    if (item is MaskOfKhalAnkur)
                    {
                        ((MaskOfKhalAnkur)item).Charges--;
                    }

                    if (item is PendantOfKhalAnkur)
                    {
                        ((PendantOfKhalAnkur)item).Charges--;
                    }
                }

                SpellHelper.Turn(Caster, p);

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

                System.Collections.Generic.List <IDamageable> targets = AcquireIndirectTargets(p, 2).ToList();
                int count = Math.Max(1, targets.Count);

                if (count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);
                }

                foreach (IDamageable id in targets)
                {
                    Mobile m      = id as Mobile;
                    double damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);

                    if (count > 2)
                    {
                        damage = (damage * 2) / count;
                    }

                    IDamageable source = Caster;
                    IDamageable target = id;

                    if (SpellHelper.CheckReflect((int)Circle, ref source, ref target, SpellDamageType))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
                        {
                            source.MovingParticles(target, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                        });
                    }

                    if (m != null)
                    {
                        damage *= GetDamageScalar(m);
                    }

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);

                    Caster.MovingParticles(id, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                }

                ColUtility.Free(targets);
            }

            FinishSequence();
        }
Exemple #20
0
        public void Target(IPoint3D p, Item item)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && (item != null || CheckSequence()))
            {
                if (item != null)
                {
                    if (item is MaskOfKhalAnkur)
                    {
                        ((MaskOfKhalAnkur)item).Charges--;
                    }

                    if (item is PendantOfKhalAnkur)
                    {
                        ((PendantOfKhalAnkur)item).Charges--;
                    }
                }

                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)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);

                    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.
                        }

                        IDamageable source = Caster;
                        IDamageable target = id;

                        if (SpellHelper.CheckReflect((int)Circle, ref source, ref target, SpellDamageType))
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
                            {
                                source.MovingParticles(target, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                            });
                        }

                        if (m != null)
                        {
                            damage *= GetDamageScalar(m);
                        }

                        Caster.DoHarmful(id);
                        SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);

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

                ColUtility.Free(targets);
            }

            FinishSequence();
        }
Exemple #21
0
        public void DoMeteorSwarm(Mobile attacker, Mobile defender)
        {
            if (!attacker.CanBeHarmful(defender, false))
            {
                return;
            }

            IPoint3D p = defender.Location;

            if (!attacker.CanSee(p))
            {
                attacker.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, attacker))
            {
                SpellHelper.Turn(attacker, p);

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

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

                Map map = attacker.Map;

                bool playerVsPlayer = false;

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

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

                            targets.Add(m);

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

                    eable.Free();
                }

                double damage;

                damage = Utility.Random(37, 33);

                if (targets.Count > 0)
                {
                    Effects.PlaySound(p, attacker.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;

                        attacker.DoHarmful(m);
                        SpellHelper.Damage(TimeSpan.FromSeconds(1.0), m, attacker, toDeal, 0, 100, 0, 0, 0);

                        attacker.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                    }
                }
                SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, 1, 0, 100, 0, 0, 0);
            }
        }
Exemple #22
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();
                }

                var 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 (Caster != m /*&& SpellHelper.ValidIndirectTarget( Caster, m )*/ && Caster.CanBeHarmful(m, false))
                        //harms everyone
                        {
                            if (Caster.EraAOS && !Caster.InLOS(m))
                            {
                                continue;
                            }

                            targets.Add(m);

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

                    eable.Free();
                }

                double damage = Utility.Random(30, 18);                 // 30 - 47

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

                    if (Caster is BaseCreature)
                    {
                        var bc = (BaseCreature)Caster;

                        // pseudoseer must be EQPlayerAllowed to do full damage to all
                        if (bc.NetState != null && !bc.Pseu_EQPlayerAllowed)
                        {
                            // NEED TO TEST THIS
                            damage /= targets.Count;
                        }
                    }
                    else
                    {
                        damage /= targets.Count;
                    }

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

                        double toDeal = damage;

                        if (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);

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

            FinishSequence();
        }
Exemple #23
0
        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(0x220);

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

                    int damage;

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

                    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 = damage + nBenefit;

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

            FinishSequence();
        }
Exemple #24
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, 100);

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

                IEnumerable <IDamageable> targets = AcquireIndirectTargets(p, 2);
                int count = targets.Count();

                foreach (var dam in AcquireIndirectTargets(p, 2))
                {
                    var    id = dam;
                    var    m  = id as Mobile;
                    double damage;

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

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

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

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

                    Mobile source = Caster;
                    SpellHelper.CheckReflect((int)Circle, ref source, ref id, SpellDamageType);

                    if (m != null)
                    {
                        damage *= GetDamageScalar(m);
                    }

                    Effects.SendBoltEffect(id, true, 0, false);

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, id, damage, 0, 0, 0, 0, 100);
                }
            }

            FinishSequence();
        }
Exemple #25
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);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

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

                int itemID = eastToWest ? 0x3967 : 0x3979;

                TimeSpan duration = TimeSpan.FromSeconds(3.0 + (Caster.Skills[SkillName.Magery].Value / 3.0));

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(Caster, itemID, loc, Caster.Map, duration);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5048);
                }
            }

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

                SpellHelper.GetSurfaceTop(ref p);

                int dx = this.Caster.Location.X - p.X;
                int dy = this.Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, this.Caster.Map, 0x20B);

                TimeSpan duration;

                if (Core.AOS)
                {
                    duration = TimeSpan.FromSeconds((15 + (this.Caster.Skills.Magery.Fixed / 5)) / 7);
                }
                else
                {
                    duration = TimeSpan.FromSeconds(this.Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0); // (28% of magery) + 2.0 seconds
                }
                int itemID = eastToWest ? 0x3946 : 0x3956;

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, this.Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(loc, this.Caster.Map, duration, itemID, this.Caster);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, this.Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051);
                }
            }

            this.FinishSequence();
        }
Exemple #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);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

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

                int itemID = eastToWest ? 0x398C : 0x3996;

                TimeSpan duration;

                if (Caster.EraAOS)
                {
                    duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 4);
                }
                else if (Caster.EraUOR)
                {
                    duration = TimeSpan.FromSeconds(4.0 + (Caster.Skills[SkillName.Magery].Value * 0.5));
                }
                else
                {
                    // HACK: Convert to T2A mechanics.
                    duration = TimeSpan.FromSeconds(4.0 + (Caster.Skills[SkillName.Magery].Value * 0.5));
                }

                for (int i = -2; i <= 2; ++i)
                {
                    new FireFieldItem(
                        itemID, new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z), Caster, Caster.Map, duration, i);
                }
            }

            FinishSequence();
        }
Exemple #28
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), 2);

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

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

                double damage;

                // Algorithm: (55-75) + (25% of alchemy) + (25% of eval int) + (25% of imbuing) + (25% of inscribe)

                if (Core.AOS)
                {
                    int amount1 = (int)(Caster.Skills[SkillName.Alchemy].Value * 0.25);
                    int amount2 = (int)(Caster.Skills[SkillName.EvalInt].Value * 0.25);
                    int amount3 = (int)(Caster.Skills[SkillName.Imbuing].Value * 0.25);
                    int amount4 = (int)(Caster.Skills[SkillName.Inscribe].Value * 0.25);

                    // damage = (55-75) + amount1 + amount2 + amount3 + amount4
                    damage = Utility.Random(55, 75) + amount1 + amount2 + amount3 + amount4;
                }
                else
                {
                    damage = Utility.Random(54, 44);
                }

                if (targets.Count > 0)
                {
                    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)
                    {
                        toDeal = damage;
                        Mobile 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(0x480);
                    }
                }
                else
                {
                    Caster.PlaySound(0x29);
                }
            }

            FinishSequence();
        }
Exemple #29
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())
            {
                if (this.Scroll != null)
                {
                    Scroll.Consume();
                }
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

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

                Point3D      loc = new Point3D(p.X, p.Y, p.Z);
                int          grovex;
                int          grovey;
                int          grovez;
                InternalItem groveStone = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex            = loc.X;
                grovey            = loc.Y;
                grovez            = loc.Z;
                groveStone.ItemID = 0x08E3;
                groveStone.Name   = "sacred stone";
                Point3D stonexyz = new Point3D(grovex, grovey, grovez);
                groveStone.MoveToWorld(stonexyz, Caster.Map);

                InternalItem grovea = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X - 2;
                grovey        = loc.Y - 2;
                grovez        = loc.Z;
                grovea.ItemID = 3290;
                Point3D grovexyz = new Point3D(grovex, grovey, grovez);
                grovea.MoveToWorld(grovexyz, Caster.Map);

                InternalItem grovec = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X;
                grovey        = loc.Y - 3;
                grovez        = loc.Z;
                grovec.ItemID = 3293;
                Point3D grovexyzb = new Point3D(grovex, grovey, grovez);
                grovec.MoveToWorld(grovexyzb, Caster.Map);

                InternalItem groved = new InternalItem(Caster.Location, Caster.Map, Caster);
                groved.ItemID = 3290;
                grovex        = loc.X + 2;
                grovey        = loc.Y - 2;
                grovez        = loc.Z;
                Point3D grovexyzc = new Point3D(grovex, grovey, grovez);
                groved.MoveToWorld(grovexyzc, Caster.Map);
                InternalItem grovee = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X + 3;
                grovee.ItemID = 3290;
                grovey        = loc.Y;
                grovez        = loc.Z;
                Point3D grovexyzd = new Point3D(grovex, grovey, grovez);
                grovee.MoveToWorld(grovexyzd, Caster.Map);
                InternalItem grovef = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovef.ItemID = 3293;
                grovex        = loc.X + 2;
                grovey        = loc.Y + 2;
                grovez        = loc.Z;
                Point3D grovexyze = new Point3D(grovex, grovey, grovez);
                grovef.MoveToWorld(grovexyze, Caster.Map);
                InternalItem groveg = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X;
                groveg.ItemID = 3290;
                grovey        = loc.Y + 3;
                grovez        = loc.Z;
                Point3D grovexyzf = new Point3D(grovex, grovey, grovez);
                groveg.MoveToWorld(grovexyzf, Caster.Map);
                InternalItem groveh = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X - 2;
                groveh.ItemID = 3293;
                grovey        = loc.Y + 2;
                grovez        = loc.Z;
                Point3D grovexyzg = new Point3D(grovex, grovey, grovez);
                groveh.MoveToWorld(grovexyzg, Caster.Map);
                InternalItem grovei = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex        = loc.X - 3;
                grovei.ItemID = 3293;
                grovey        = loc.Y;
                grovez        = loc.Z;
                Point3D grovexyzh = new Point3D(grovex, grovey, grovez);
                grovei.MoveToWorld(grovexyzh, Caster.Map);
                InternalItem leavesa = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X - 2;
                grovey         = loc.Y - 2;
                grovez         = loc.Z;
                leavesa.ItemID = 3291;
                Point3D leafxyz = new Point3D(grovex, grovey, grovez);
                leavesa.MoveToWorld(leafxyz, Caster.Map);

                InternalItem leavesc = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X;
                grovey         = loc.Y - 3;
                grovez         = loc.Z;
                leavesc.ItemID = 3294;
                Point3D leafxyzb = new Point3D(grovex, grovey, grovez);
                leavesc.MoveToWorld(leafxyzb, Caster.Map);

                InternalItem leavesd = new InternalItem(Caster.Location, Caster.Map, Caster);
                leavesd.ItemID = 3291;
                grovex         = loc.X + 2;
                grovey         = loc.Y - 2;
                grovez         = loc.Z;
                Point3D leafxyzc = new Point3D(grovex, grovey, grovez);
                leavesd.MoveToWorld(leafxyzc, Caster.Map);
                InternalItem leavese = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X + 3;
                leavese.ItemID = 3291;
                grovey         = loc.Y;
                grovez         = loc.Z;
                Point3D leafxyzd = new Point3D(grovex, grovey, grovez);
                leavese.MoveToWorld(leafxyzd, Caster.Map);
                InternalItem leavesf = new InternalItem(Caster.Location, Caster.Map, Caster);
                leavesf.ItemID = 3294;
                grovex         = loc.X + 2;
                grovey         = loc.Y + 2;
                grovez         = loc.Z;
                Point3D leafxyze = new Point3D(grovex, grovey, grovez);
                leavesf.MoveToWorld(leafxyze, Caster.Map);
                InternalItem leavesg = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X;
                leavesg.ItemID = 3291;
                grovey         = loc.Y + 3;
                grovez         = loc.Z;
                Point3D leafxyzf = new Point3D(grovex, grovey, grovez);
                leavesg.MoveToWorld(leafxyzf, Caster.Map);
                InternalItem leavesh = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X - 2;
                leavesh.ItemID = 3294;
                grovey         = loc.Y + 2;
                grovez         = loc.Z;
                Point3D leafxyzg = new Point3D(grovex, grovey, grovez);
                leavesh.MoveToWorld(leafxyzg, Caster.Map);
                InternalItem leavesi = new InternalItem(Caster.Location, Caster.Map, Caster);
                grovex         = loc.X - 3;
                leavesi.ItemID = 3294;
                grovey         = loc.Y;
                grovez         = loc.Z;
                Point3D leafxyzh = new Point3D(grovex, grovey, grovez);
                leavesi.MoveToWorld(leafxyzh, Caster.Map);
            }

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

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

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

                Map map = this.Caster.Map;

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

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

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

                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                double damage;

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

                        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 && this.CheckResisted(m))
                        {
                            damage *= 0.5;

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

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

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

            this.FinishSequence();
        }