コード例 #1
0
        public void RefreshReportedBackToFalse()
        {
            var sut = AggressorInfo.Create(_Attacker, _Defender, true);

            sut.Reported = true;

            sut.Refresh();

            Assert.False(sut.Reported);
        }
コード例 #2
0
        public void CreateTheSameInstanceAfterCallingFree()
        {
            var sut  = AggressorInfo.Create(_Attacker, _Defender, true);
            var sut2 = AggressorInfo.Create(_Attacker, _Defender, true);

            sut.Free();

            var sut3 = AggressorInfo.Create(_Attacker, _Defender, true);

            Assert.NotSame(sut, sut2);
            Assert.Same(sut, sut3);
        }
コード例 #3
0
        public void HaveInitialState()
        {
            const bool criminal = true;

            var sut = AggressorInfo.Create(_Attacker, _Defender, criminal);

            Assert.False(sut.Reported);
            Assert.Equal(criminal, sut.CriminalAggression);
            Assert.False(sut.Expired);
            Assert.Equal(criminal, sut.CanReportMurder);
            Assert.Same(_Attacker, sut.Attacker);
            Assert.Same(_Defender, sut.Defender);
            // ReSharper disable once RedundantTypeArgumentsOfMethod
            Assert.InRange <DateTime>(sut.LastCombatTime, DateTime.UtcNow.AddSeconds(-1.0), DateTime.UtcNow);
        }
コード例 #4
0
ファイル: HouseRegion.cs プロジェクト: nogu3ira/xrunuo
        // Use OnLocationChanged instead of OnEnter because it can be that we enter a house region even though we're not actually inside the house
        public override void OnLocationChanged(Mobile m, Point3D oldLocation)
        {
            if (m_Recursion)
            {
                return;
            }

            base.OnLocationChanged(m, oldLocation);

            m_Recursion = true;

            if (m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions)
            {
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside(oldLocation, 16)))
            {
            }
            else if (m_House.Public && m_House.IsBanned(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;
            }
            else if (!m_House.Public && !m_House.HasAccess(m) && m_House.IsInside(m))
            {
                m.Location = m_House.BanLocation;
            }
            else if (m_House.IsCombatRestricted(m) && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16))
            {
                m.Location = m_House.BanLocation;
                m.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
            else if (m_House is HouseFoundation)
            {
                HouseFoundation foundation = (HouseFoundation)m_House;

                if (foundation.Customizer != null && foundation.Customizer != m && m_House.IsInside(m))
                {
                    m.Location = m_House.BanLocation;
                }
            }

            // Añadido para Antihousing
            if (m_House.IsInside(m) && CheckCombat(m, TimeSpan.FromMinutes(2.0)))
            {
                for (int i = 0; i < m.Aggressors.Count; i++)
                {
                    bool found = false;

                    AggressorInfo info = (AggressorInfo)m.Aggressors[i];

                    Mobile aggressor = info.Attacker;

                    for (int j = 0; j < m.Aggressed.Count; j++)
                    {
                        AggressorInfo info2 = (AggressorInfo)m.Aggressed[j];

                        Mobile aggressed = info2.Attacker;

                        if (aggressed == m)
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        m.Aggressed.Add(AggressorInfo.Create(m, aggressor, !m.Criminal));
                    }
                }
            }

            if (m_House.InternalizedVendors.Count > 0 && m_House.IsInside(m) && !m_House.IsInside(oldLocation, 16) && m_House.IsOwner(m) && m.Alive && !m.HasGump(typeof(NoticeGump)))
            {
                /* This house has been customized recently, and vendors that work out of this
                 * house have been temporarily relocated.  You must now put your vendors back to work.
                 * To do this, walk to a location inside the house where you wish to station
                 * your vendor, then activate the context-sensitive menu on your avatar and
                 * select "Get Vendor".
                 */
                m.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180, null, null));
            }

            m_Recursion = false;
        }
コード例 #5
0
        public bool ExecuteTrap(Mobile from, bool bAutoReset)
        {
            Point3D loc   = this.GetWorldLocation();
            Map     facet = this.Map;

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

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

                    if (from.InRange(loc, 3))
                    {
                        int damage;

                        // RunUO says 10, 30, but stratics says 5, 15
                        // http://replay.waybackmachine.org/20020402172114/http://uo.stratics.com/content/guides/tinkertraps/trapessay.shtml
                        if (m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(5, 15) * m_TrapLevel;
                        }
                        else
                        {
                            damage = m_TrapPower;
                        }

                        if (m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.Aggressors.Add(AggressorInfo.Create(m_Trapper, from, true));
                        }

                        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))
                    {
                        from.Damage(m_TrapPower);
                    }
                    //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                    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;

                        if (m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(5, 15) * m_TrapLevel;
                        }
                        else
                        {
                            damage = m_TrapPower;
                        }

                        if (m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.Aggressors.Add(AggressorInfo.Create(m_Trapper, from, true));
                        }

                        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;

                        if (m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.Aggressors.Add(AggressorInfo.Create(m_Trapper, from, true));
                        }

                        if (m_TrapLevel > 0)
                        {
                            poison = Poison.GetPoison(Math.Max(0, Math.Min(4, m_TrapLevel - 1)));
                        }
                        else
                        {
                            AOS.Damage(from, m_TrapPower, 0, 0, 0, 100, 0);
                            poison = Poison.Greater;
                        }

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

                // new style tinker traps remain trapped (auto reset)
                if (!bAutoReset)
                {
                    m_TrapType = TrapType.None;
                }

                return(true);
            }

            return(false);
        }