Пример #1
0
            private bool IsHerdable(BaseCreature bc)
            {
                if (bc.IsParagon)
                {
                    return(false);
                }

                if (bc.Tamable)
                {
                    return(true);
                }

                Map map = bc.Map;

                if (Region.Find(bc.Home, map) is ChampionSpawnRegion region)
                {
                    ChampionSpawn spawn = region.ChampionSpawn;

                    if (spawn?.IsChampionSpawn(bc) == true)
                    {
                        Type t = bc.GetType();

                        foreach (Type type in m_ChampTamables)
                        {
                            if (type == t)
                            {
                                return(true);
                            }
                        }
                    }
                }

                return(false);
            }
Пример #2
0
        public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> equipItems)
            : base(0x2006)
        {
            // To supress console warnings, stackable must be true
            Stackable = true;
            Amount    = owner.Body;          // protocol defines that for itemid 0x2006, amount=body
            Stackable = false;

            Movable   = false;
            Hue       = owner.Hue;
            Direction = owner.Direction;
            Name      = owner.Name;

            BaseCreature bc = owner as BaseCreature;

            m_Owner = owner;

            m_CorpseName = GetCorpseName(owner);

            m_TimeOfDeath = DateTime.Now;

            m_AccessLevel = owner.AccessLevel;
            m_Guild       = owner.Guild as Guild;
            m_Kills       = bc != null && bc.AlwaysMurderer ? 100 : owner.Kills;
            SetFlag(CorpseFlag.Criminal, owner.Criminal);

            m_Hair       = hair;
            m_FacialHair = facialhair;

            // This corpse does not turn to bones if: the owner is not a player
            SetFlag(CorpseFlag.NoBones, !owner.Player);
            m_BloodHue = owner.BloodHue;

            m_Looters    = new List <Mobile>();
            m_EquipItems = equipItems;

            m_Aggressors = new List <Mobile>(owner.Aggressors.Count + owner.Aggressed.Count);
            bool addToAggressors = bc == null;

            TimeSpan lastTime = TimeSpan.MaxValue;

            for (int i = 0; i < owner.Aggressors.Count; ++i)
            {
                AggressorInfo info = owner.Aggressors[i];

                if ((DateTime.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Attacker;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if (addToAggressors && !info.CriminalAggression)
                {
                    m_Aggressors.Add(info.Attacker);
                }
            }

            for (int i = 0; i < owner.Aggressed.Count; ++i)
            {
                AggressorInfo info = owner.Aggressed[i];

                if ((DateTime.Now - info.LastCombatTime) < lastTime)
                {
                    m_Killer = info.Defender;
                    lastTime = (DateTime.Now - info.LastCombatTime);
                }

                if (addToAggressors)
                {
                    m_Aggressors.Add(info.Defender);
                }
            }

            if (!addToAggressors)
            {
                Mobile master = bc.GetMaster();
                if (master != null)
                {
                    m_Aggressors.Add(master);
                }

                List <DamageStore> rights = BaseCreature.GetLootingRights(bc.DamageEntries, bc.HitsMax);
                for (int i = 0; i < rights.Count; ++i)
                {
                    DamageStore ds = rights[i];

                    if (ds.m_HasRight)
                    {
                        m_Aggressors.Add(ds.m_Mobile);
                    }
                }
            }

            TimeSpan decayTime = m_DefaultDecayTime;

            if (bc != null)
            {
                ChampionSpawnRegion region = Region.Find(Location, Map) as ChampionSpawnRegion;

                if (region != null)
                {
                    ChampionSpawn spawn = region.Spawn;

                    if (spawn != null && spawn.IsChampionSpawn(bc))
                    {
                        decayTime = spawn.DecayTime;
                    }
                }
            }

            BeginDecay(decayTime);

            DevourCorpse();
        }