Example #1
0
        public void AttackRoundDamage_Success()
        {
            //Arrange
            _mockDice.Setup(dice => dice.RollDice()).Returns(16);
            _mockDice.Setup(dice => dice.RollDice(4, 11)).Returns(8);
            var expectedResult = 8;

            //Act
            var actualResult = combatHandler.GetAttackRoundDamage(_mockChar1.Object, _mockChar2.Object);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Example #2
0
        private static void AttackSequence(ICharacter attacker, ICharacter defender, ICombatHandler combatHandler)
        {
            var damageTaken = combatHandler.GetAttackRoundDamage(attacker, defender);

            defender.TakeDamage(damageTaken);

            Console.WriteLine(string.Format("{0} attacks!", attacker.Name));
            System.Threading.Thread.Sleep(1000);
            Console.WriteLine(combatHandler.LastAttackStatus);
            if (damageTaken > 0)
            {
                Console.WriteLine(string.Format("{0} has lost {1} life points.", defender.Name, damageTaken));
            }
            Console.WriteLine();
        }
Example #3
0
        private static string AttackSequence(ICharacter attacker, ICharacter defender, ICombatHandler combatHandler)
        {
            var damageTaken = combatHandler.GetAttackRoundDamage(attacker, defender);

            defender.TakeDamage(damageTaken);

            var sb = new StringBuilder();

            sb.Append(string.Format("{0} attacks!", attacker.Name));
            sb.Append("\n");
            sb.Append(combatHandler.LastAttackStatus);
            if (damageTaken > 0)
            {
                sb.AppendLine(string.Format("{0} has lost {1} life points.", defender.Name, damageTaken));
            }
            sb.Append("\n");
            return(sb.ToString());
        }