示例#1
0
        public void TestFireballChannelingActivation()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder Fireball = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            for (int i = 0; i < 9; i++)
            {
                NewSkill.AddSkillEffectsToTarget(string.Empty);

                Assert.AreEqual(i + 1, Fireball.ChanneledMana);
            }

            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(1, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ActiveUser.ChanneledMana);
            Assert.AreEqual(100, ActiveUser.CurrentMana);
        }
示例#2
0
        public void TestExplodingFireballPositionWithOffset()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));
            FireballCore2.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, -15, 0));

            InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));
            FireballCore3.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, 55, 0));

            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder Fireball1 = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            Fireball1.ChanneledMana = 2000;
            NewSkill.AddSkillEffectsToTarget(string.Empty);
            Constants.TotalGameTime = 10;
            NewSkill.AddSkillEffectsToTarget(string.Empty);
            DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center = new Vector2(10, 10);

            //Channel enough Mana for 2 fireballs
            for (int i = 0; i < 50; i++)
            {
                DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 0, 16)));
            }

            Constants.TotalGameTime = 20;

            DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 50, 0)));

            Assert.AreEqual(0, DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center.X);
            Assert.AreEqual(70, DummyMap.ListLayer[0].ListAttackCollisionBox[1].ListCollisionPolygon[0].Center.X);
        }
示例#3
0
        public void TestExplodingFireballActivation()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder FireballEffect = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            FireballEffect.ChanneledMana = 2000;

            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(0, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[2]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[3]).NumberOfExecutions);
            Constants.TotalGameTime = 10;
            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(1, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[2]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[3]).NumberOfExecutions);

            Assert.AreEqual(1, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
            Assert.AreEqual(2, DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListActiveSkill.Count);
            InvisibleFireball Fireball1      = (InvisibleFireball)DummyMap.ListLayer[0].ListAttackCollisionBox[0];
            IMagicUser        FireballParent = Fireball1.Parent;

            //Channel enough Mana for 2 fireballs
            for (int i = 0; i < 50; i++)
            {
                DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 0, 16)));
                Assert.AreEqual(2000 - i * 2, FireballParent.CurrentMana);
            }

            Constants.TotalGameTime = 20;

            Assert.AreEqual(true, DummyMap.ListLayer[0].ListAttackCollisionBox.Contains(Fireball1));

            DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 50, 0)));

            Assert.AreEqual(false, DummyMap.ListLayer[0].ListAttackCollisionBox.Contains(Fireball1));
            Assert.AreEqual(2, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
        }