Exemplo n.º 1
0
        public void DamageCalculations()
        {
            var inventory = new Inventory {
                Equipment = null
            };
            var stats = new Stats()
            {
                Strength = 0
            };
            var target = new SimpleEnemy {
                Armor = null, Buffs = null
            };
            var damage = new Player {
                Inventory = inventory, Stats = stats
            }.CalculateDamage(target);

            Assert.AreEqual(10, damage.Amount);
        }
Exemplo n.º 2
0
        private int GetSoak(Target other, int totalDamage)
        {
            var soak = 0;

            if (other is Player)
            {
                // TODO: Not implemented yet
                //  Add friendly fire
                soak = totalDamage;
            }
            else if (other is SimpleEnemy)
            {
                SimpleEnemy simpleEnemy = (SimpleEnemy)other;
                soak = (int)Math.Round(
                    simpleEnemy.Armor.GetDamageSoak() *
                    (
                        ((float)simpleEnemy.Buffs
                         .Select(buff => buff.SoakModifier())
                         .Sum() + 1f)
                    )
                    );
            }
            return(soak);
        }