Ejemplo n.º 1
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

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

                    TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 0.2);
                    int      amount   = (int)(Caster.Skills[SkillName.Musicianship].Value * .18);

                    m.SendMessage("Your Physical resistance has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Physical, +amount);

                    m.AddResistanceMod(mod1);

                    m.FixedParticles(0x373A, 10, 15, 5012, 0x450, 3, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                }
            }

            FinishSequence();
        }
Ejemplo n.º 2
0
        private IEnumerable <Mobile> FindAdditionalTargets(Mobile targeted)
        {
            var casterParty = Party.Get(Caster);

            if (casterParty == null)
            {
                yield break;
            }

            IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(targeted), 2);

            foreach (Mobile m in eable)
            {
                if (m == null || m == targeted)
                {
                    continue;
                }

                // Players in the area must be in the casters party in order to receive the beneficial effects of the spell.
                if (Caster.CanBeBeneficial(m, false) && casterParty.Contains(m))
                {
                    yield return(m);
                }
            }

            eable.Free();
        }
Ejemplo n.º 3
0
        private bool AreaCanTarget(Mobile target, bool feluccaRules)
        {
            /* Arch cure area effect won't cure aggressors, victims, murderers, criminals or monsters.
             * In Felucca, it will also not cure summons and pets.
             * For red/criminal players it will only cure themselves and guild members.
             */

            if (!Caster.CanBeBeneficial(target, false))
            {
                return(false);
            }

            if (Caster.EraAOS && target != Caster)
            {
                if (IsAggressor(target) || IsAggressed(target))
                {
                    return(false);
                }

                int notoCaster = Notoriety.Compute(Caster, target);
                int notoTarget = Notoriety.Compute(target, Caster);

                if ((notoCaster != Notoriety.Innocent || notoTarget != Notoriety.Innocent) && notoCaster != Notoriety.Ally)
                {
                    return(false);
                }

                if (feluccaRules && !(target is PlayerMobile))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        private bool AreaCanTarget(Mobile target, bool feluccaRules)
        {
            /* Arch cure area effect won't cure aggressors, victims, murderers, criminals or monsters.
             * In Felucca, it will also not cure summons and pets.
             * For red players it will only cure themselves and guild members.
             */

            if (!Caster.CanBeBeneficial(target, false))
            {
                return(false);
            }

            if (Core.AOS && target != Caster)
            {
                if (IsAggressor(target) || IsAggressed(target))
                {
                    return(false);
                }

                if ((!IsInnocentTo(Caster, target) || !IsInnocentTo(target, Caster)) && !IsAllyTo(Caster, target))
                {
                    return(false);
                }

                if (feluccaRules && !(target is PlayerMobile))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


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

                    int    amount = (int)(Caster.Skills[SkillName.Musicianship].Base * 0.1);
                    string intt   = "int";

                    double duration = (Caster.Skills[SkillName.Musicianship].Base * 0.15);

                    StatMod mod = new StatMod(StatType.Int, intt, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x1F8, 3, EffectLayer.Waist);
                }
            }

            FinishSequence();
        }
        public override void OnCast()
        {
            if (CheckSequence())
            {
                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

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

                    TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 0.2);
                    int      rounds   = (int)(Caster.Skills[SkillName.Musicianship].Value * .16);

                    new ExpireTimer(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();

                    m.FixedParticles(0x376A, 9, 32, 5030, 0x21, 3, EffectLayer.Waist);
                }
            }

            FinishSequence();
        }
Ejemplo n.º 7
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


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

                    Mobile source   = Caster;
                    double allvalue = Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value + Caster.Skills[SkillName.Peacemaking].Value;


                    int amount = (int)(Math.Max((Caster.Skills[SkillName.Musicianship].Value * 0.1), (allvalue - 360 * 0.15)));
                    //int amount = (int)( Caster.Skills[SkillName.Musicianship].Value * 0.1 );
                    string str = "str";

                    double duration = (Caster.Skills[SkillName.Musicianship].Value);

                    StatMod mod = new StatMod(StatType.Str, str, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x224, 3, EffectLayer.Waist);
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Ejemplo n.º 8
0
        public override void OnCast()
        {
            bool sings = false;

            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            //added this to test
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("You need an instrument to play that song!");
            }
            else if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


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

                    TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 2.5);
                    int      amount   = (int)((Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Peacemaking].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value) / 4 * .125);
                    m.SendMessage("Your resistance to fire has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Fire, +amount);

                    m.AddResistanceMod(mod1);

                    m.FixedParticles(0x373A, 10, 15, 5012, 0x21, 3, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Ejemplo n.º 9
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), 3);

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

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

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

                        if (m.BeginAction(typeof(ArchProtectionSpell)))
                        {
                            Caster.DoBeneficial(m);
                            m.VirtualArmorMod += val;

                            AddEntry(m, val);
                            new InternalTimer(m, Caster).Start();

                            m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                            m.PlaySound(0x1F7);
                        }
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 10
0
        protected override void OnTarget(object o)
        {
            if (!HasShield())
            {
                return;
            }

            Mobile protectee = o as Mobile;
            Mobile master    = null;

            if (protectee is BaseCreature && !((BaseCreature)protectee).Summoned && ((BaseCreature)protectee).GetMaster() is PlayerMobile)
            {
                master = ((BaseCreature)protectee).GetMaster();
            }

            if (protectee != null)
            {
                BodyGuardSpell spell = GetSpell(s => s.GetType() == typeof(BodyGuardSpell) && s.Target == protectee) as BodyGuardSpell;

                if (spell != null)
                {
                    Caster.SendLocalizedMessage(1156094); // Your target is already under the effect of this ability.
                }
                if (!protectee.Alive)
                {
                    Caster.SendLocalizedMessage(501857); // This spell won't work on that!
                }
                else if (!Caster.CanBeBeneficial(protectee, true))
                {
                    Caster.SendLocalizedMessage(1001017); // You cannot perform beneficial acts on your target.
                }
                else if (protectee != Caster)
                {
                    Mobile responsible = master != null ? master : protectee;

                    Caster.FixedParticles(0x376A, 9, 32, 5030, 1168, 0, EffectLayer.Waist, 0);

                    if (Caster.Player)
                    {
                        Caster.PlaySound(Caster.Female ? 0x338 : 0x44A);
                    }
                    else if (Caster is BaseCreature)
                    {
                        Caster.PlaySound(((BaseCreature)Caster).GetAngerSound());
                    }

                    if (Caster is PlayerMobile)
                    {
                        protectee.SendGump(new AcceptBodyguardGump(Caster, protectee, this));
                        AddGumpTimer(responsible, Caster);
                    }
                    else
                    {
                        AcceptBodyGuard(responsible);
                    }
                }
            }
        }
Ejemplo n.º 11
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);

                ArrayList targets = new ArrayList();

                IPooledEnumerable eable = Caster.Map.GetMobilesInRange(new Point3D(p), 3);

                foreach (Mobile m in eable)
                {
                    if (Caster.CanBeBeneficial(m, false))
                    {
                        targets.Add(m);
                    }
                }

                eable.Free();

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

                int val = (int)(Caster.Skills[CastSkill].Value / 20.0 + 5);

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

                        if (m.BeginAction(typeof(SpringOfLifeSpell)))
                        {
                            Caster.DoBeneficial(m);
                            m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Head);

                            int toHeal = (int)(Caster.Skills[DamageSkill].Value * 0.6);
                            toHeal += Utility.Random(1, 10);

                            m.Heal(toHeal);

                            new InternalTimer(m, Caster, val).Start();
                            m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                            m.PlaySound(0xAF);
                        }
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 12
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (CheckSequence())
            {
                if (this.Scroll != null)
                {
                    Scroll.Consume();
                }
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

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

                        SpellHelper.AddStatBonus(Caster, targ, StatType.Str); SpellHelper.DisableSkillCheck = true;
                        SpellHelper.AddStatBonus(Caster, targ, StatType.Dex);
                        SpellHelper.AddStatBonus(Caster, targ, StatType.Int); SpellHelper.DisableSkillCheck = false;

                        targ.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
                        targ.PlaySound(0x1EA);
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 13
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


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

                    TimeSpan duration = TimeSpan.FromSeconds((double)(MusicSkill(Caster) * 2));
                    int      amount   = Server.Misc.MyServerSettings.PlayerLevelMod((int)(MusicSkill(Caster) / 16), Caster);

                    m.SendMessage("Your resistance to poison has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Poison, +amount);

                    m.AddResistanceMod(mod1);

                    m.FixedParticles(0x373A, 10, 15, 5012, 0x238, 3, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Ejemplo n.º 14
0
        public bool CheckBSequence(Mobile target, bool allowDead)
        {
            try
            {
                RegionControl regstone = null;
                CustomRegion  reg      = null;
                if (target != null)
                {
                    reg = CustomRegion.FindDRDTRegion(target);
                }
                if (reg != null)
                {
                    regstone = reg.GetRegionControler();
                }

                //if your in a region area spells will fail if disallowed, prevents the run outside of area precast
                //run back into region then release spell ability
                if (m_Caster != null && target != null && m_Caster.Spell != null && m_Caster.Region != target.Region && regstone != null && (regstone.IsRestrictedSpell(m_Caster.Spell, m_Caster) || regstone.IsMagicIsolated) && m_Caster.AccessLevel == AccessLevel.Player && ((m_Caster is BaseCreature && !regstone.RestrictCreatureMagic) || m_Caster is PlayerMobile))
                {
                    m_State = SpellState.None;
                    if (m_Caster.Spell == this)
                    {
                        m_Caster.Spell = null;
                    }
                    Targeting.Target.Cancel(m_Caster);
                    m_Caster.SendMessage("You cannot cast your spell into that area.");
                    return(false);
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            if (!target.Alive && !allowDead)
            {
                m_Caster.SendLocalizedMessage(501857);                 // This spell won't work on that!
                return(false);
            }
            else if (Caster.CanBeBeneficial(target, true, allowDead) && CheckSequence())
            {
                Caster.DoBeneficial(target);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 15
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);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                int      val      = (int)(Caster.Skills[SkillName.Magery].Value / 10.0) + 1;;
                TimeSpan duration = TimeSpan.FromSeconds(6 * (Caster.Skills[SkillName.Magery].Value / 5));

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

                    if (!Registry.ContainsKey(m))
                    {
                        m.VirtualArmorMod += val;
                        Registry.Add(m, val);
                        new Second.ProtectionSpell.InternalTimer(duration, m, val).Start();

                        m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                        m.PlaySound(0x1F7);
                    }
                }
            }

            FinishSequence();
        }
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

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

                    int    amount = Server.Misc.MyServerSettings.PlayerLevelMod((int)(MusicSkill(Caster) / 16), Caster);
                    string intt   = "int";

                    double duration = (double)(MusicSkill(Caster) * 2);

                    StatMod mod = new StatMod(StatType.Int, intt, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x1F8, 3, EffectLayer.Waist);
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Ejemplo n.º 17
0
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = SpellHelper.GetSurfaceTop(response.Target);

            SpellHelper.Turn(Caster, target);

            var targets = new List <Mobile>();
            var map     = Caster.Map;

            IPooledEnumerable eable = map.GetMobilesInRange(target, 2);

            targets.AddRange(eable.Cast <Mobile>().Where(m => Caster.CanBeBeneficial(m, false)));
            eable.Free();

            if (targets.Count <= 0)
            {
                return;
            }

            Effects.PlaySound(target, Caster.Map, 0x299);

            foreach (var mobile in targets)
            {
                var poison = mobile.Poison;
                if (poison is null)
                {
                    continue;
                }

                Caster.DoBeneficial(mobile);

                double difficulty = poison.Level * 15 + 60;
                Caster.FireHook(h => h.OnCure(Caster, mobile, poison, this, ref difficulty));

                if (difficulty < 10)
                {
                    difficulty = 10;
                }

                if (Caster.ShilCheckSkill(SkillName.Magery, (int)difficulty, 0) && mobile.CurePoison(Caster))
                {
                    mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010058, Caster.NetState);
                    mobile.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                    mobile.PlaySound(0x1E0);
                }
            }
        }
Ejemplo n.º 18
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);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), (int)SpellHelper.AdjustValue(Caster, 1 + Caster.Skills[SkillName.Thaumaturgie].Value / 50, true));

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

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

                        if (!Caster.CanSee(m))
                        {
                            continue;
                        }

                        Spells.GuerisonMajeureSpell.ToogleGreaterHeal(this, Caster, m, 1.0);
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 19
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);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

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

                        if (!Caster.CanSee(m))
                        {
                            continue;
                        }

                        Spells.OmbreSpell.CheckIncognito(this, Caster, m);
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 20
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                TimeSpan duration = TimeSpan.FromSeconds(0);

                DateTime endtime = DateTime.Now + duration;

                Map map = Caster.Map;

                ArrayList targets = new ArrayList();

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(Caster.Location), (int)SpellHelper.AdjustValue(Caster, 1 + Caster.Skills[SkillName.ArtMagique].Value / 20));

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false) && (Caster.Party == m.Party))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

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

                        if (m is PlayerMobile)
                        {
                            new CriDOursTimer((PlayerMobile)m, endtime).Start();
                        }

                        if (m is BaseCreature)
                        {
                            new CriDOursTimer((BaseCreature)m, endtime).Start();
                        }
                    }

                    Caster.PlaySound(163);
                }
            }

            FinishSequence();
        }
Ejemplo n.º 21
0
        private List <Mobile> GetArcanists()
        {
            List <Mobile> weavers = new List <Mobile> {
                Caster
            };

            // OSI Verified: Even enemies/combatants count
            // Everyone gets the Arcane Focus, power capped elsewhere
            weavers.AddRange(Caster.GetMobilesInRange(1)
                             .Where(m => m != Caster && m is PlayerMobile && Caster.CanBeBeneficial(m, false) &&
                                    Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20));

            return(weavers);
        }
Ejemplo n.º 22
0
        private bool AreaCanTarget(Mobile target, bool feluccaRules)
        {
            /* Arch cure area effect won't cure aggressors, victims, murderers, criminals or monsters.
             * In Felucca, it will also not cure summons and pets.
             * For red players it will only cure themselves and guild members.
             */

            if (!Caster.CanBeBeneficial(target, false))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 23
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

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

                    SpellHelper.AdjustValue(Caster, tile);

                    if (tile > 12)
                    {
                        tile = 12;
                    }

                    foreach (Mobile m in Caster.GetMobilesInRange((int)tile))
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }
                }

                double toHeal;

                toHeal  = Caster.Skills[CastSkill].Value * 0.15;
                toHeal += Caster.Skills[DamageSkill].Value * 0.07;

                toHeal = SpellHelper.AdjustValue(Caster, toHeal);

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

                    SpellHelper.Heal(m, (int)toHeal + Utility.Random(1, 3), true);

                    Effects.SendTargetParticles(m, 0x376A, 9, 32, 5005, EffectLayer.Waist);
                    m.PlaySound(483);
                }
            }

            FinishSequence();
        }
Ejemplo n.º 24
0
        public bool CheckBSequence(Mobile target, bool allowDead)
        {
            if (!target.Alive && !allowDead)
            {
                Caster.SendLocalizedMessage(501857); // This spell won't work on that!
                return(false);
            }

            if (Caster.CanBeBeneficial(target, true, allowDead) && CheckSequence())
            {
                Caster.DoBeneficial(target);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 25
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), 2);

                    foreach (Mobile m in eable)
                    {
                        if (Caster.CanBeBeneficial(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                Party party = Party.Get(Caster);

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

                    if (m == Caster || (party != null && party.Contains(m)))
                    {
                        Caster.DoBeneficial(m);
                        Spells.Second.ProtectionSpell.Toggle(Caster, m, true);
                    }
                }
            }

            FinishSequence();
        }
Ejemplo n.º 26
0
 public bool CheckBSequence(Mobile target, bool allowDead)
 {
     if (!target.Alive && !allowDead)
     {
         m_Caster.SendAsciiMessage("This spell won't work on that!");
         return(false);
     }
     else if (Caster.CanBeBeneficial(target, true, allowDead) && CheckSequence())
     {
         Caster.DoBeneficial(target);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 27
0
        private List <Mobile> GetArcanists()
        {
            List <Mobile> weavers = new List <Mobile>();

            weavers.Add(Caster);

            //OSI Verified: Even enemies/combatants count
            foreach (Mobile m in Caster.GetMobilesInRange(1))                   //Range verified as 1
            {
                if (m != Caster && m is PlayerMobile && Caster.CanBeBeneficial(m, false) && Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20 && !(m is Clone))
                {
                    weavers.Add(m);
                }
                // Everyone gets the Arcane Focus, power capped elsewhere
            }

            return(weavers);
        }
Ejemplo n.º 28
0
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = SpellHelper.GetSurfaceTop(response.Target);

            SpellHelper.Turn(Caster, target);
            var targets = new List <Mobile>();

            IPooledEnumerable eable = Caster.Map.GetMobilesInRange(target, 3);

            targets.AddRange(eable.Cast <Mobile>().Where(m => Caster.CanBeBeneficial(m, false)));
            eable.Free();

            Effects.PlaySound(target, Caster.Map, 0x299);

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

            foreach (var mobile in targets)
            {
                if (!Caster.HasOneOfBuffs(BuffIcon.Protection, BuffIcon.ArchProtection, BuffIcon.Resilience))
                {
                    Caster.DoBeneficial(mobile);

                    mobile.TryAddBuff(new ArmorBuff
                    {
                        Icon     = BuffIcon.ArchProtection,
                        Title    = "Arch Protection",
                        ArmorMod = (int)(SpellHelper.GetModAmount(Caster, mobile) / 1.5),
                        Duration = SpellHelper.GetDuration(Caster, mobile),
                    });

                    mobile.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                    mobile.PlaySound(0x1F7);
                }
            }
        }
Ejemplo n.º 29
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                bool success = false;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

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

                    TimeSpan duration = TimeSpan.FromSeconds((double)(DamagingSkill(Caster) * 4));
                    int      amount   = (int)(DamagingSkill(Caster) / 8);

                    m.SendMessage("Your resistance to cold has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Cold, +amount);

                    m.AddResistanceMod(mod1);

                    m.PlaySound(0x1E9);
                    m.FixedParticles(0x375A, 9, 20, 5016, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                    success = true;
                }

                if (success)
                {
                    Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);
                }
            }
            FinishSequence();
        }
Ejemplo n.º 30
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                bool success = false;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(10))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

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

                    int    amount = (int)(DamagingSkill(Caster) / 16);
                    string str    = "str";

                    double duration = (double)(DamagingSkill(Caster) * 2);

                    StatMod mod = new StatMod(StatType.Str, str, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x224, 3, EffectLayer.Waist);
                    success = true;
                }

                if (success)
                {
                    Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);
                }
            }
            FinishSequence();
        }