예제 #1
0
        public void TestInstantDamageSpell()
        {
            var spell = SpellHandler.Get(SpellId.ClassSkillFireBlastRank1);

            Assert.AreEqual(0, spell.ProjectileSpeed);             // not delayed

            chr.EnsureInWorld();

            var enemy = chr.Enemies.Create();

            enemy.Regenerates = false;

            var oldHealth = enemy.Health;

            Asser.GreaterThan(enemy.Health, 0);

            // make sure we are in range and facing the enemy
            enemy.EnsureXDistance(chr, spell.Range.MinDist + 0.5f, true);
            chr.EnsureFacing(enemy);

            // triggered spells are instant and cannot miss
            chr.Map.AddMessageAndWait(() => {
                var failReason = chr.SpellCast.Start(spell, true, enemy);
                Assert.AreEqual(SpellFailedReason.Ok, failReason);

                Assert.IsFalse(chr.SpellCast.IsCasting);

                Asser.GreaterThan(oldHealth, enemy.Health);
            });
        }
예제 #2
0
        public static void Initialize(TestContext testContext)
        {
            // register the test packet handlers
            FakePacketMgr.Instance.Register(typeof(FakeClientTest));
            RealmPacketMgr.Instance.Register(typeof(FakeClientTest));

            Setup.EnsureBasicSetup();

            m_chr = Setup.DefaultCharacter;
            m_chr.EnsureInWorld();
        }
예제 #3
0
        public static void ApplyAura(TestCharacter chr, Spell spell)
        {
            Assert.IsTrue(spell.IsAura || spell.IsAreaAura, "Spell {0} is not an Aura", spell);

            chr.EnsureInWorld();

            chr.ShapeshiftForm = ShapeshiftForm.Normal;
            chr.Auras.Clear();

            Assert.AreEqual(0, chr.Auras.Count);

            // important: Execute this in the Map's thread
            chr.Map.AddMessageAndWait(new Message(() => {
                chr.SpellCast.TriggerSelf(spell);

                var failure =
                    chr.FakeClient.DequeueSMSG(RealmServerOpCode.SMSG_SPELL_FAILURE);

                Assert.IsNull(failure,
                              failure != null
                                                                ? "Spell failed: " + failure["FailReason"].Value
                                                                : "");

                Assert.AreEqual(1, chr.Auras.Count, "Aura was not added.");
                var aura = chr.Auras[spell, !spell.HasHarmfulEffects];

                Assert.IsNotNull(aura);

                Assert.AreEqual(spell.GetDuration(chr.SharedReference, chr), (uint)aura.Duration);
                Assert.AreNotEqual(0, spell.GetDuration(chr.SharedReference, chr));
                Asser.GreaterOrEqual(spell.GetDuration(chr.SharedReference, chr), (uint)aura.TimeLeft);

                aura.Cancel();

                Assert.IsNull(chr.Auras[spell, !spell.HasHarmfulEffects]);
                Assert.AreEqual(0, chr.Auras.Count);
            }));
        }