Example #1
0
 public override void OnDoubleClick(Mobile m)
 {
     if (m.Warmode)
     {
         m.Attack(this);
     }
 }
Example #2
0
 public override void OnDoubleClick(Mobile m)
 {
     if (m.Warmode)
         m.Attack(this);
 }
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (m_TrapType != TrapType.None && m_Trapped)
            {
                if (from.AccessLevel != AccessLevel.Player)
                {
                    if (from.AccessLevel >= AccessLevel.GameMaster)
                    {
                        from.SendAsciiMessage("Note: This container is trapped.");
                    }
                    return(false);
                }

                if (m_Trapper != null && !m_Trapper.Deleted)
                {
                    m_Trapper.Attack(from);
                }
                //	from.AggressiveAction( m_Trapper, false );
                // should m_Trapper be flagged for their trap being opened?

                switch (m_TrapType)
                {
                case TrapType.DartTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!
                    from.SendAsciiMessage("A dart embeds itself in your flesh!");

                    if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                    {
                        from.AggressiveAction(m_Trapper);                                  //AggressiveActionNoRegion( m_Trapper, from, Notoriety.Compute( m_Trapper, from ) == Notoriety.Innocent );
                    }
                    AOS.Damage(from, Utility.Random(1, 15) + m_TrapPower, 100, 0, 0, 0, 0);
                    Effects.SendMovingEffect(this, from, 0x1BFE, 18, 1, false, false);
                    break;
                }

                case TrapType.PoisonTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        from.Poison = Poison.GetPoison(m_TrapPower - 1);
                        from.SendAsciiMessage("A cloud of green gas engulfs your body!");

                        if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    Point3D loc = GetWorldLocation();
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z), Map, 0x11a6, 15);
                    break;
                }

                case TrapType.ExplosionTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!

                    int damage = 20 * (m_TrapPower - 1) + Utility.Random(25);
                    if (this.RootParent is Mobile && this.RootParent != from)
                    {
                        Mobile mob = (Mobile)this.RootParent;
                        AOS.Damage(mob, damage / 3, 0, 100, 0, 0, 0);
                        damage -= damage / 3;
                        mob.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!

                        if (mob != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                        from.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!

                        if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    Point3D loc = GetWorldLocation();
                    Effects.PlaySound(loc, Map, 0x307);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15);
                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(GetWorldLocation(), 1))
                    {
                        double damage = Spells.Spell.GetPreUORDamage(Spells.SpellCircle.Second) * 0.75;
                        if (from.CheckSkill(SkillName.MagicResist, damage * 2.5 - 25.0, damage * 2.5 + 25.0))
                        {
                            damage *= 0.5;
                            from.SendLocalizedMessage(501783);                                       // You feel yourself resisting magical energy.
                        }
                        if (damage < 1)
                        {
                            damage = 1;
                        }
                        from.Damage((int)damage);
                        //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                    }

                    Point3D loc = GetWorldLocation();

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

                m_Trapped = false;
                return(true);
            }

            return(false);
        }
                protected override void OnTick()
                {
                    bool orcs   = IsOrc(m_Target);
                    bool savage = IsSavage(m_Target);

                    var badKarmaChance  = 0.5 - ((double)m_From.Karma / 8570);         //Lower your Karma Less chance you get
                    var goodKarmaChance = 0.5 + ((double)m_From.Karma / 8570);         //Higher Karma less chance for Monsters

                    m_From.NextSkillTime = Core.TickCount + 10000;                     //Set next skill use 10 seconds
                    if (!orcs && !savage && m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        if (!orcs && m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (orcs)
                    {
                        if (m_From.Karma > 0 && goodKarmaChance > Utility.RandomDouble())
                        {
                            m_From.SendMessage("You seem to notable to beg");
                        }
                        else
                        {
                            //Console.WriteLine("Orc Begged");
                            if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100)) //Need 80+ Skill to Attempt to Beg Orc
                            {
                                int begchance = Utility.Random(100);                           //Lets see if you have bad accident
                                if (begchance <= 10)                                           //10% chance to blow up mask
                                {
                                    Item item = m_From.FindItemOnLayer(Layer.Helm);

                                    if (item is OrcishKinMask)
                                    {
                                        m_From.SendMessage("{0} alerts the other orcs that you are a fake", m_Target);                                         //Orcs dont beg
                                        AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                        item.Delete();
                                        m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                        m_From.PlaySound(0x307);
                                    }
                                }
                                else if (begchance <= 30)                                 //30% to just attack player
                                {
                                    m_Target.Attack(m_From);
                                    m_From.SendMessage("{0} seems upset", m_Target);                                     //Well they dont like beggers
                                }
                                else
                                {
                                    BegChance(m_From, m_Target, true, false);                                     //What is your chance to beg?
                                }
                            }
                            else
                            {
                                m_From.SendMessage("They don't seem to have noticed you");
                            }
                        }
                    }
                    else if (savage)
                    {
                        //Console.WriteLine("Savage Beg");
                        if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100))                         //Need 80+ Skill to Attempt to beg from Savages
                        {
                            int begchance = Utility.Random(100);
                            if (begchance <= 10)                             //10% chance to blow up paint, Pride Tribesman/Women!
                            {
                                if (m_From.BodyMod == 183 || m_From.BodyMod == 184)
                                {
                                    AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                    m_From.BodyMod = 0;
                                    m_From.HueMod  = -1;
                                    m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                    m_From.PlaySound(0x307);
                                    m_From.SendLocalizedMessage(1040008);                                     // Your skin is scorched as the tribal paint burns away!
                                    ((PlayerMobile)m_From).SavagePaintExpiration = TimeSpan.Zero;
                                }
                            }
                            else if (begchance <= 30)                             //30% to just attack player
                            {
                                m_Target.Attack(m_From);
                                m_From.SendMessage("{0} seems upset", m_Target);
                            }
                            else
                            {
                                BegChance(m_From, m_Target, false, true);                                 //Whats your Beg Chance?
                            }
                        }
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                    {
                        //Console.WriteLine("Human Beg");
                        BegChance(m_From, m_Target, false, false);                         //Not a Savage or Orc? Human than!
                    }
                    else
                    {
                        //Console.WriteLine("Fail Beg");
                        m_Target.SendLocalizedMessage(500404);                         // They seem unwilling to give you any money.
                    }
                }