Exemplo n.º 1
0
        protected internal NPC()
        {
            m_threatCollection = new ThreatCollection();

            // auras
            m_auras = new NPCAuraCollection(this);

            m_spells = NPCSpellCollection.Obtain(this);
        }
Exemplo n.º 2
0
        public void TestThreatCollection()
        {
            var collection = new ThreatCollection();

            var npc1 = CreateDummy(1);
            var npc2 = CreateDummy(2);
            var npc3 = CreateDummy(3);

            collection.AddNewIfNotExisted(npc1);

            Assert.AreEqual(npc1, collection.CurrentAggressor);

            collection.AddNewIfNotExisted(npc2);

            Assert.AreEqual(npc1, collection.CurrentAggressor);

            collection[npc2] = 10000;

            Assert.AreEqual(npc2, collection.CurrentAggressor);

            collection[npc3] = 1000000;

            Assert.AreEqual(npc3, collection.CurrentAggressor);

            collection[npc3] = 1;

            Assert.AreEqual(npc2, collection.CurrentAggressor);
            Assert.AreEqual(3, collection.Size);

            collection.Remove(npc2);
            Assert.AreEqual(npc3, collection.CurrentAggressor);

            collection.Remove(npc3);
            Assert.AreEqual(npc1, collection.CurrentAggressor);

            collection.Remove(npc1);
            Assert.AreEqual(null, collection.CurrentAggressor);
        }