Exemple #1
0
 protected override void OnTick()
 {
     if ((i_item != null) && (!i_item.Deleted))
     {
         TrapWand wands = (TrapWand)i_item;
         Mobile   from  = wands.owner;
         from.LocalOverheadMessage(Network.MessageType.Emote, 0x3B2, false, "Your trap finding wand has vanished.");
         from.PlaySound(0x1F0);
         i_item.Delete();
     }
 }
Exemple #2
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (m_TrapType != TrapType.None)
            {
                Point3D loc   = this.GetWorldLocation();
                Map     facet = this.Map;

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
                    return(false);
                }

                int nTrapLevel  = TrapLevel * 10;
                int nTrapLevel2 = nTrapLevel + 20;

                if ((int)(from.Skills[SkillName.RemoveTrap].Value) < nTrapLevel)
                {
                    from.CheckTargetSkill(SkillName.RemoveTrap, this, 0, nTrapLevel2);
                }
                else if (from.CheckTargetSkill(SkillName.RemoveTrap, this, 0, nTrapLevel2))
                {
                    from.PlaySound(0x241);
                    TrapPower = 0;
                    TrapLevel = 0;
                    TrapType  = TrapType.None;
                    SendMessageTo(from, "That was trapped, but you were able to disable it.", 0x3B2);
                    return(false);
                }

                if (from.Backpack != null)
                {
                    Item magicwand   = from.Backpack.FindItemByType(typeof(TrapWand));
                    Item tenfootpole = from.Backpack.FindItemByType(typeof(TenFootPole));

                    if (GetPlayerInfo.LuckyPlayer(from.Luck))
                    {
                        from.PlaySound(0x241);
                        TrapPower = 0;
                        TrapLevel = 0;
                        TrapType  = TrapType.None;
                        SendMessageTo(from, "That was trapped, but with luck on your side...it broke.", 0x3B2);
                        return(false);
                    }
                    if (magicwand != null)
                    {
                        TrapWand wands    = (TrapWand)magicwand;
                        int      nPower   = wands.WandPower;
                        int      nAgainst = Utility.RandomMinMax(nTrapLevel, nTrapLevel2);
                        if (nPower >= nAgainst)
                        {
                            from.PlaySound(0x1F0);
                            TrapPower = 0;
                            TrapLevel = 0;
                            TrapType  = TrapType.None;
                            SendMessageTo(from, "That was trapped, but your magic orb disabled it.", 0x3B2);
                            return(false);
                        }
                    }
                    if (tenfootpole != null)
                    {
                        TenFootPole poles = (TenFootPole)tenfootpole;
                        if (50 >= Utility.RandomMinMax(nTrapLevel, nTrapLevel2))
                        {
                            from.PlaySound(0x039);
                            TrapPower     = 0;
                            TrapLevel     = 0;
                            TrapType      = TrapType.None;
                            poles.Charges = poles.Charges - 1;
                            if (poles.Charges < 1)
                            {
                                SendMessageTo(from, "You tap your ten foot pole, disabling a trap and breaking the pole.", 0x3B2);
                                poles.Delete();
                            }
                            else
                            {
                                SendMessageTo(from, "You tap your ten foot pole, disabling a trap.", 0x3B2);
                                poles.InvalidateProperties();
                            }
                            return(false);
                        }
                    }
                }

                int MagicAvoid = (int)((from.Skills[SkillName.RemoveTrap].Value + from.EnergyResistance) / 3);
                if (MagicAvoid > 90)
                {
                    MagicAvoid = 90;
                }

                switch (m_TrapType)
                {
                case TrapType.ExplosionTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - from.FireResistance)) / 100);
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);

                        // Your skin blisters from the heat!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                    Effects.PlaySound(loc, facet, 0x307);

                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(loc, 1))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - MagicAvoid)) / 100);
                        from.Damage(damage);
                    }

                    Effects.PlaySound(loc, Map, 0x307);

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);

                    break;
                }

                case TrapType.DartTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - from.PhysicalResistance)) / 100);
                        AOS.Damage(from, damage, 100, 0, 0, 0, 0);

                        // A dart imbeds itself in your flesh!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502998);
                    }

                    Effects.PlaySound(loc, facet, 0x223);

                    break;
                }

                case TrapType.PoisonTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        Poison poison = Poison.Lesser;

                        int itHurts = from.PoisonResistance;
                        int itSicks = 0;

                        if (itHurts >= 70)
                        {
                            itSicks = 1;
                        }
                        else if (itHurts >= 50)
                        {
                            itSicks = 2;
                        }
                        else if (itHurts >= 30)
                        {
                            itSicks = 3;
                        }
                        else if (itHurts >= 10)
                        {
                            itSicks = 4;
                        }
                        else
                        {
                            itSicks = 5;
                        }

                        switch (Utility.RandomMinMax(1, itSicks))
                        {
                        case 1: poison = Poison.Lesser;         break;

                        case 2: poison = Poison.Regular;        break;

                        case 3: poison = Poison.Greater;        break;

                        case 4: poison = Poison.Deadly;         break;

                        case 5: poison = Poison.Lethal;         break;
                        }

                        from.ApplyPoison(from, poison);

                        // You are enveloped in a noxious green cloud!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                    Effects.PlaySound(loc, facet, 0x231);

                    break;
                }
                }

                m_TrapType  = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return(true);
            }

            return(false);
        }