Inheritance: Monster
示例#1
0
 public void GoblinHpBelowZeroResultsInUnActive()
 {
     var testBasicFighter = new BasicFighter("TestFighter");
     var testGoblin = new Goblin();
     Assert.That(testGoblin.IsActive, Is.True);
     while (testGoblin.CurrentHp > 0)
     {
         testBasicFighter.Attack(testGoblin);
     }
     Assert.That(testGoblin.IsActive, Is.False);
 }
示例#2
0
 public void BasicFighterCanAttack()
 {
     //Brittle test, can fail if unlucky with dices
     var testFighter = new BasicFighter("TestFighter");
     var testGoblin = new Goblin();
     var hpBefore = testGoblin.CurrentHp;
     Console.WriteLine($"Initial Hp: {hpBefore}");
     for (var i = 0; i < 8; i++)
     {
         testFighter.Attack(testGoblin);
         Console.WriteLine($"Post Attack {i} Hp: {testGoblin.CurrentHp}");
     }
     Assert.That(testGoblin.CurrentHp, Is.LessThan(hpBefore));
 }
示例#3
0
 private void InitGoblins()
 {
     var rnd = new Random();
     var num = 5;
     for (var i = 0; i < num; i++)
     {
         var gob = new Goblin
         {
             Name = "Gerblin " + i,
             Position = new Vector2((float) rnd.NextDouble()*6f + .6f, (float) rnd.NextDouble()*4f + 1f),
             ScreenObject = new ScreenObject("Goblin.png", 0, UIElement_OnMouseDown)
         };
         gob.ScreenObject.Image.MouseEnter += Image_MouseEnter;
         _gm.Register(gob);
     }
 }
示例#4
0
 public void GoblinProperlyInitialized()
 {
     var testGoblin = new Goblin();
     Assert.That(testGoblin.IsActive, Is.True);
 }
示例#5
0
 public void CanCreateGoblin()
 {
     Assert.DoesNotThrow(() => { var testGoblin = new Goblin(); });
 }