Пример #1
0
        public override bool OnMoveOver(Mobile m)
        {
            int ManaLoss = ScaleMana(ManaCost);

            if (TrapOwner != null && DamageScalar == 0)
            {
                //if (PointDest != Point3D.Zero && TrapOwner.Player && (!SpellHelper.ValidIndirectTarget(TrapOwner, m) || m == (Mobile)TrapOwner))
                if (PointDest != Point3D.Zero && TrapOwner.Player && ((m.Party != null && m.Party == TrapOwner.Party) || m == TrapOwner))
                {
                    if (TrapOwner.Mana >= ManaLoss)
                    {
                        TrapOwner.Mana -= ManaLoss;
                    }
                    else
                    {
                        ManaLoss      -= TrapOwner.Mana;
                        TrapOwner.Mana = 0;
                        TrapOwner.Damage((ManaLoss));
                    }
                    Teleport(m);
                    if (TrapOwner.Alive)
                    {
                        this.UsesRemaining -= 1;
                    }
                    else
                    {
                        UsesRemaining -= 10;
                    }
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
        public override void OnTrigger(Mobile from)
        {
            int       sdiBonus;
            int       damage  = 0;
            ArrayList targets = new ArrayList();
            //uncomment this if you want staff to be immune to traps
            //if (from.AccessLevel > AccessLevel.Player)
            //    return;

            int ManaLoss = ScaleMana(ManaCost);

            if (!(TrapOwner.InRange(Location, 25)) || TrapOwner.Map != Map || TrapOwner.Map == Map.Internal)
            {
                this.UsesRemaining -= 1;
                return;
            }

            if (TrapOwner != null && TrapOwner.Player && TrapOwner.CanBeHarmful(from, false) &&
                from != TrapOwner && SpellHelper.ValidIndirectTarget(TrapOwner, (Mobile)from) &&
                (!(from is BaseCreature) || ((BaseCreature)from).ControlMaster != TrapOwner))
            {
                if (TrapOwner.Mana >= ManaLoss)
                {
                    TrapOwner.Mana -= ManaLoss;
                }
                else
                {
                    ManaLoss      -= TrapOwner.Mana;
                    TrapOwner.Mana = 0;
                    TrapOwner.Damage(ManaLoss);
                }
            }
            else
            {
                return;
            }

            if (this.Visible == false)
            {
                this.Visible = true;
            }

            int MinDamage = 20 * (TrapPower / 100);
            int MaxDamage = 30 * (TrapPower / 100);


            if (MinDamage < 5)
            {
                MinDamage = 5;
            }

            if (MaxDamage < 10)
            {
                MaxDamage = 10;
            }
            if (from.Alive)
            {
                IPooledEnumerable eable = this.Map.GetMobilesInRange(new Point3D(from.Location), DamageRange);

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

                if ((from != TrapOwner && SpellHelper.ValidIndirectTarget(TrapOwner, (Mobile)from) && TrapOwner.CanBeHarmful(from, false)) && from.InLOS(this))  //yes, intentional double hit to triggerer
                {
                    targets.Add(from);
                }

                if (targets.Count > 0)
                {
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = (Mobile)targets[i];
                        if (DamageScalar != 0)
                        {
                            sdiBonus  = AosAttributes.GetValue(TrapOwner, AosAttribute.SpellDamage);
                            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(TrapOwner, (m.Player && TrapOwner.Player));

                            // PvP spell damage increase cap of 15% from an item’s magic property
                            if ((m.Player && TrapOwner.Player) && (sdiBonus > 15 + (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10)))
                            {
                                sdiBonus = 15 + (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10);
                            }
                            sdiBonus += (int)(TrapOwner.Skills[SkillName.Inscribe].Value / 10);

                            TrapOwner.DoHarmful(m);
                            MinDamage = MinDamage * (100 + sdiBonus) / 100;
                            MaxDamage = MaxDamage * (100 + sdiBonus) / 100;
                            switch (m_DamageType)
                            {
                            case "Physical":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 100, 0, 0, 0, 0);
                                break;

                            case "Fire":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 100, 0, 0, 0);
                                break;

                            case "Cold":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 100, 0, 0);
                                break;

                            case "Poison":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 0, 100, 0);
                                break;

                            case "Energy":
                                damage = AOS.Damage(m, TrapOwner, (int)(DamageScalar * Utility.RandomMinMax(MinDamage, MaxDamage)), 0, 0, 0, 0, 100);
                                break;
                            }
                            SpellHelper.DoLeech(damage, TrapOwner, m);
                            if (PointDest != Point3D.Zero && TrapOwner.Player)
                            {
                                Teleport(m);
                            }
                        }
                        if (Poison != null)
                        {
                            m.ApplyPoison(m, m_Poison);
                            TrapOwner.DoHarmful(m);
                        }

                        if (ParalyzeTime > 0)
                        {
                            TrapOwner.DoHarmful(m);
                            if (m.Player)
                            {
                                m.Paralyze(TimeSpan.FromSeconds(ParalyzeTime - (m.Skills.MagicResist.Value / 12) / 4));
                            }
                            else
                            {
                                m.Paralyze(TimeSpan.FromSeconds(ParalyzeTime - (m.Skills.MagicResist.Value / 12)));
                            }
                        }
                    }

                    if (TrapOwner.Alive)
                    {
                        this.UsesRemaining -= 1;
                    }
                    else
                    {
                        UsesRemaining -= 10;
                    }

                    if (this.UsesRemaining <= 0)
                    {
                        this.Delete();
                    }
                }
            }
        }