Пример #1
0
        /// <summary>
        /// This is the "main"
        /// </summary>
        /// <param name="args">
        /// The args. ??
        /// </param>
        public static void Main(string[] args)
        {
            logger.LogMessage += LogMessageHandler;

            var dummy1 = new TargetDummy("Kalle");
            var dummy2 = new TargetDummy("Urban");
            var drunkenness = new HitModifier() { Description = "Drunk", Value = -10 };
            for (int i = 0; i < 10; i++)
            {
                dummy1.PerformAttack(dummy1.BasicAttack(dummy2).ModifyHit(drunkenness));
                drunkenness.Value -= 10;
            }

            Console.ReadLine();
        }
Пример #2
0
        public void Hitting_A_Target_Yields_A_Hit_Result()
        {
            // Arrange
            ICombatEntity target = new TargetDummy();
            ICombatEntity attacker = new TargetDummy();
            HitModifier guaranteedHit = new HitModifier() { Description = "GuaranteeHit", Value = 100 };

            // Act
            ICombatResult result = attacker.PerformAttack(attacker.BasicAttack(target).ModifyHit(guaranteedHit));

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(HitResult));
        }
Пример #3
0
        public void Hitting_A_Target_Yields_A_Result_With_Damage()
        {
            // Arrange, make target defenceless to guarantee a hit
            ICombatEntity target = new TargetDummy();
            ICombatEntity attacker = new TargetDummy();
            HitModifier guaranteedHit = new HitModifier() { Description = "GuaranteeHit", Value = 100 };

            // Act
            HitResult result = attacker.PerformAttack(attacker.BasicAttack(target).ModifyHit(guaranteedHit)) as HitResult;

            // Assert
            Assert.IsTrue(result.InflictedDamage > 0);
        }
Пример #4
0
 /// <summary>
 /// Adds a hit modifier
 /// </summary>
 /// <param name="hitModifier">
 /// The hit Modifier.
 /// </param>
 /// <returns>
 /// The modified attack.
 /// </returns>
 public IAttackCommand ModifyHit(HitModifier hitModifier)
 {
     this.hitModifiers.Add(hitModifier);
     return this;
 }