Example #1
0
        public void CalculateToHitChance_BaseChance_Return85()
        {
            var spell        = NewFakeSpell();
            var source       = NewFakePlayer();
            var target       = NewFakePlayer();
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(85, actual);
        }
Example #2
0
        public void CalculateToHitChance_SpellBonusIsSeven_Return88()
        {
            var spell  = NewFakeSpell();
            var source = NewFakePlayer();

            source.modifiedSpellLevel = 7; //spellBonus
            var target       = NewFakePlayer();
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(88, actual);
        }
Example #3
0
        public void CalculateToHitChance_SpellBonusIsTen_Return90()
        {
            var spell  = Create.Spell();
            var source = Create.FakePlayer();

            source.modifiedSpellLevel = 10; //spellBonus
            var target       = Create.FakePlayer();
            var spellLine    = new SpellLine("", "", "", false);
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(90, actual);
        }
Example #4
0
        public void CalculateToHitChance_SpellLevelIs50TargetLevelIsZero_Return110()
        {
            var spell = NewFakeSpell();

            spell.Level = 50;
            var source = NewFakePlayer();
            var target = NewFakePlayer();

            target.Level = 0;
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(110, actual);
        }
Example #5
0
        public void CalculateToHitChance_SameTargetAndSpellLevelWithFiveToHitBonus_Return90()
        {
            var spell = NewFakeSpell();

            spell.Level = 50;
            var source = NewFakePlayer();

            source.modifiedSpellLevel = 0; //spellBonus
            source.modifiedToHitBonus = 5;
            var target = NewFakePlayer();

            target.Level = 50;
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(90, actual);
        }
Example #6
0
        public void CalculateToHitChance_SourceSpellBonusIsTenSpellLevelAndTargetLevelAre50_Return85()
        {
            var spell = NewFakeSpell();

            spell.Level = 50;
            var source = NewFakePlayer();

            source.modifiedSpellLevel = 10; //spellBonus
            source.modifiedToHitBonus = 0;
            var target = NewFakePlayer();

            target.Level = 50;
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(85, actual);
        }
Example #7
0
        public void CalculateToHitChance_TargetIsNPCLevel50SourceIsLevel50PlayerAndSpellLevelIs40_Return80()
        {
            GS.ServerProperties.Properties.PVE_SPELL_CONHITPERCENT = 10;
            var spell = NewFakeSpell();

            spell.Level = 40;
            var source = NewFakePlayer();

            source.modifiedEffectiveLevel = 50;
            var target = NewFakeNPC();

            target.Level = 50;
            target.modifiedEffectiveLevel = 50;
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(80, actual);
        }