ValidIndirectTarget() публичный статический Метод

public static ValidIndirectTarget ( Mobile from, Mobile to ) : bool
from Mobile
to Mobile
Результат bool
Пример #1
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);

                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), (int)SpellHelper.AdjustValue(Caster, 2 + Caster.Skills[CastSkill].Value / 50, true));

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

                    eable.Free();
                }

                //double damage = GetNewAosDamage(15, 1, 5, true);

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

                        Disturb(m);

                        if (CheckResisted(m))
                        {
                            //damage *= 0.75;

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

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

                        Effects.SendBoltEffect(m, true, 0);
                    }
                }
            }

            FinishSequence();
        }
Пример #2
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (m_Item == null)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            bool todelete = false;

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                caster.DoHarmful(m);

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

                                damage = (int)SpellHelper.AdjustValue(caster, damage);

                                AOS.Damage(m, caster, (int)damage, 0, 100, 0, 0, 0);
                                m.PlaySound(0x208);

                                todelete = true;
                            }

                            if (todelete)
                            {
                                m_Item.Delete();
                                Stop();
                            }
                        }
                    }
                }
Пример #3
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                TimeSpan duration = TimeSpan.FromSeconds(0);
                double   amount   = 1;

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

                DateTime endtime = DateTime.Now + duration;

                ArrayList m_target = new ArrayList();

                Map map = Caster.Map;

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

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

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

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

                    StopTimer(targ);

                    m_PoemeTable[targ] = amount;

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

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

            FinishSequence();
        }
Пример #4
0
        public void Target(Mobile m)
        {
            Party party   = Engines.PartySystem.Party.Get(Caster);
            bool  inParty = false;

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

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

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

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

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

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

                int level;

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

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

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

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

                Map map = m.Map;

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

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

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

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

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

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

            FinishSequence();
        }
Пример #5
0
        public void Target(Mobile m)
        {
            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                Disturb(m);

                SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

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

                //double damage = GetNewAosDamage(7, 1, 3, false);

                int level;

                double total = (Caster.Skills[SkillName.ArtMagique].Value + Caster.Skills[SkillName.Empoisonnement].Value);

                if (total >= 200.0 && 3 > Utility.Random(10))
                {
                    level = 2;
                }
                else if (total > 140.0)
                {
                    level = 1;
                }
                else
                {
                    level = 0;
                }

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

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

                Map map = m.Map;

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

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

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

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

                        Effects.SendTargetParticles(m, 0x374A, 10, 15, 5021, EffectLayer.Waist);
                        m.PlaySound(0x474);
                    }
                }
            }

            FinishSequence();
        }
Пример #6
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (m_Item == null)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                bool valid = true;
                                if (m == m_Item.Caster)
                                {
                                    valid = false;
                                }
                                if (m is BaseCreature)
                                {
                                    if (((BaseCreature)m).ControlMaster == m_Item.Caster)
                                    {
                                        valid = false;
                                    }
                                }

                                if (valid)
                                {
                                    caster.DoHarmful(m);

                                    // double damage = Utility.RandomMinMax(5, 8);
                                    double damage = Utility.RandomMinMax(3, 4);


                                    damage = SpellHelper.AdjustValue(caster, damage);

                                    if (m_Item.m_Spell.CheckResisted(m))
                                    {
                                        damage *= 0.75;

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

                                    AOS.Damage(m, caster, (int)damage, 0, 100, 0, 0, 0);
                                    m.PlaySound(0x208);
                                }
                            }
                        }
                    }
                }
Пример #7
0
        public override void OnCast()
        {
            Party party   = Engines.PartySystem.Party.Get(Caster);
            bool  inParty = false;

            if (CheckSequence())
            {
                /* Creates a withering frost around the Caster,
                 * which deals Cold Damage to all valid targets in a radius of 5 tiles.
                 */

                Map map = Caster.Map;

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

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

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

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

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

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

                        if (CheckResisted(m))
                        {
                            damage *= 0.75;

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

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

            FinishSequence();
        }
Пример #8
0
        public void Target(IPoint3D p)
        {
            Party party   = Engines.PartySystem.Party.Get(Caster);
            bool  inParty = false;

            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), 4);

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

                    eable.Free();
                }

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

                    Caster.DoHarmful(m);

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

                    if (m.Spell != null)
                    {
                        m.Spell.OnCasterHurt();
                    }

                    m.Paralyzed = false;

                    Effects.SendTargetParticles(m, 0x374A, 10, 15, 5028, EffectLayer.Waist);
                    m.PlaySound(0x1FB);
                }
            }

            FinishSequence();
        }
Пример #9
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040);
                        }
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            bool eastToWest         = (m_Item.ItemID == 0x3915);
                            IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1)));

                            foreach (Mobile m in eable)
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            eable.Free();

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                caster.DoHarmful(m);

                                m_Item.ApplyPoisonTo(m);
                                m.PlaySound(0x474);
                            }
                        }
                    }
                }