private void AttackBehaviour() { timeSinceLastSawPlayer = 0; fighter.Attack(player); AggrevatenearbyEnemies(); }
public void DefenderSurvivesAttack() { Warrior one = new Warrior("Derek", 100, 10, 10); Warrior two = new Warrior("Banas", 100, 10, 10); Fight tested = new Fight(one, two); // Subscribe to notifications. tested.AddSubscriber(this); tested.Attack(one, two); // The attack notification will be sent to subscribers. Assert.AreEqual(one, attacker); Assert.AreEqual(two, defender); Assert.NotZero(attack); Assert.Greater(damage, -1); // The defeat nofication will not be sent to subscribers. Assert.IsNull(defeated); // The survivor notification will be sent to subscribers. Assert.AreEqual(two, survivor); }
public void AttackDefeatsDefender() { Warrior one = new Warrior("Derek", 1, 1, 0); Warrior two = new Warrior("Banas", 1, 0, 0); // Don't block, to garauntee death. Fight tested = new Fight(one, two); // Subscribe to notifications. tested.AddSubscriber(this); tested.Attack(one, two); // The attack notification will be sent to subscribers. Assert.AreEqual(one, attacker); Assert.AreEqual(two, defender); Assert.NotZero(attack); Assert.Greater(damage, -1); // The defeat nofication will be sent to subscribers. Assert.AreEqual(two, defeated); // The survivor notification will not be sent to subscribers. Assert.IsNull(survivor); }