Ejemplo n.º 1
0
        public static void GetNextActNpcTest()
        {
            var npc1 = NpcMock.GetSpeedMock(11);
            var npc2 = NpcMock.GetSpeedMock(15);
            var npc3 = NpcMock.GetSpeedMock(18);
            var list = new List <Npc> {
                npc1, npc2, npc3
            };
            Npc actor = null;

            actor = actor.CalcNextActNpc(list);
            Assert.AreEqual(actor, npc3);
            Assert.AreEqual(npc1.nowInitiative, 0);
            Assert.AreEqual(npc2.nowInitiative, 4);
            Assert.AreEqual(npc3.nowInitiative, 7);

            actor = actor.CalcNextActNpc(list);
            Assert.AreEqual(actor, npc2);
            Assert.AreEqual(npc1.nowInitiative, 4);
            Assert.AreEqual(npc2.nowInitiative, 12);
            Assert.AreEqual(npc3.nowInitiative, 0);

            actor = actor.CalcNextActNpc(list);
            Assert.AreEqual(actor, npc3);
            Assert.AreEqual(npc1.nowInitiative, 3);
            Assert.AreEqual(npc2.nowInitiative, 0);
            Assert.AreEqual(npc3.nowInitiative, 6);

            actor = actor.CalcNextActNpc(list);
            Assert.AreEqual(actor, npc2);
            Assert.AreEqual(npc1.nowInitiative, 8);
            Assert.AreEqual(npc2.nowInitiative, 9);
            Assert.AreEqual(npc3.nowInitiative, 0);

            actor = actor.CalcNextActNpc(list);
            Assert.AreEqual(actor, npc1);
            Assert.AreEqual(npc1.nowInitiative, 10);
            Assert.AreEqual(npc2.nowInitiative, 0);
            Assert.AreEqual(npc3.nowInitiative, 9);
        }