예제 #1
0
 def test_vampire_life_drain(self):
     vampire = monsters.Vampire()
     vampire.take_damage(1)
     self.assertNotEqual(vampire.hp, vampire.maxhp)
     vampire.life_drain(self.dummy)
     self.assertEqual(self.dummy.hp, self.dummy.maxhp - 24)
     self.assertEqual(vampire.hp, vampire.maxhp)
예제 #2
0
 def test_undead_hurt_by_healind(self):
     vampire = monsters.Vampire()
     skeleton = monsters.Skeleton()
     self.assertEqual(vampire.hp, vampire.maxhp)
     self.assertEqual(skeleton.hp, skeleton.maxhp)
     vampire.heal_damage(5)
     skeleton.heal_damage(5)
     self.assertEqual(vampire.hp, vampire.maxhp - 5)
     self.assertEqual(skeleton.hp, skeleton.maxhp - 5)
예제 #3
0
 def test_vampire_bite(self):
     bite_damage = 4
     vampire = monsters.Vampire()
     vampire.take_damage(1)
     self.assertNotEqual(vampire.hp, vampire.maxhp)
     dummy_maxhp_prebite = self.dummy.maxhp
     vampire.bite(self.dummy)
     self.assertEqual(self.dummy.maxhp, dummy_maxhp_prebite - bite_damage)
     self.assertEqual(self.dummy.hp, dummy_maxhp_prebite - bite_damage)
     self.assertEqual(vampire.hp, vampire.maxhp)
예제 #4
0
 def test_create_vampire(self):
     vampire = monsters.Vampire()
     expected_stats = {'str': 8, 'con': 2, 'int': 16, 'spd': 8, 'maxhp': 30}
     actual_stats = {
         'str': vampire.strength,
         'con': vampire.constitution,
         'int': vampire.intelligence,
         'spd': vampire.speed,
         'maxhp': vampire.maxhp
     }
     self.assertEqual(vampire.level, 1)
     self.assertEqual(actual_stats, expected_stats)
     self.assertEqual(vampire.hp, vampire.maxhp)