public void Modifier_ModifiersApplyMultiplierLast()
        {
            var damage           = 0;
            var damageModifier   = 1;
            var damageMultiplier = 2f;

            (Enemy1 as IModifierAttachee <Unit>).AttachModifier(
                new Resistance(multiplier: damageMultiplier));

            (Enemy1 as IModifierAttachee <Unit>).AttachModifier(
                new Resistance(damageModifier));

            (Enemy1 as IModifierAttachee <Unit>).AttachModifier(
                new Resistance(damageModifier));

            var previousHealth = Enemy1.Life;

            var damageAction = new DamageActionArgs(Friend2, Enemy1, () => damage);

            damageAction.Execute();

            var expectedRemainingHealth =
                previousHealth
                - ((damage
                    + (damageModifier * 2))
                   * damageMultiplier);

            Assert.AreEqual(expectedRemainingHealth, Enemy1.Life);
        }
Esempio n. 2
0
        public void DamageAffectsTarget()
        {
            var damageValue    = 3;
            var expectedHealth = Enemy1.Life - damageValue;

            var damage = new DamageActionArgs(Friend1, Enemy1, () => damageValue);

            damage.Execute();

            Assert.AreEqual(expectedHealth, Enemy1.Life);
        }
        public void Modifier_DefensiveActionModifierModifiesDamageAction()
        {
            var damage         = 0;
            var damageModifier = 1;

            (Enemy1 as IModifierAttachee <Unit>).AttachModifier(
                new Resistance(damageModifier));

            var previousHealth = Enemy1.Life;

            var damageAction = new DamageActionArgs(Friend2, Enemy1, () => damage);

            damageAction.Execute();

            Assert.AreEqual(previousHealth - (damage + damageModifier), Enemy1.Life);
        }