This commit is contained in:
eichhornchen 2021-01-05 10:20:55 +01:00
parent c378eead74
commit 6341f39fb0
2 changed files with 11 additions and 12 deletions

View File

@ -95,12 +95,11 @@ class TestEntities(unittest.TestCase):
entity = Rabbit() entity = Rabbit()
self.map.add_entity(entity) self.map.add_entity(entity)
self.map.add_entity(fam) self.map.add_entity(fam)
self.player.move(1, 6) self.player.move(1, 6)
entity.move(2, 6) entity.move(2, 6)
fam.move(2, 7) fam.move(2, 7)
#test fighting # Test fighting
entity.health = 2 entity.health = 2
entity.paths = [] entity.paths = []
entity.recalculate_paths() entity.recalculate_paths()
@ -108,7 +107,7 @@ class TestEntities(unittest.TestCase):
self.map.tick(self.player) self.map.tick(self.player)
self.assertTrue(entity.dead) self.assertTrue(entity.dead)
#test finding a new target # Test finding a new target
entity2 = Rabbit() entity2 = Rabbit()
self.map.add_entity(entity2) self.map.add_entity(entity2)
entity2.move(2, 6) entity2.move(2, 6)
@ -116,7 +115,7 @@ class TestEntities(unittest.TestCase):
self.assertTrue(fam.target == entity2) self.assertTrue(fam.target == entity2)
self.map.remove_entity(entity2) self.map.remove_entity(entity2)
#test following the player and finding the player as target # Test following the player and finding the player as target
self.player.move(5, 5) self.player.move(5, 5)
fam.move(4, 5) fam.move(4, 5)
fam.target = None fam.target = None
@ -126,7 +125,7 @@ class TestEntities(unittest.TestCase):
self.assertEqual(fam.y, 5) self.assertEqual(fam.y, 5)
self.assertEqual(fam.x, 5) self.assertEqual(fam.x, 5)
#test random move # Test random move
fam.move(13, 20) fam.move(13, 20)
fam.target = self.player fam.target = self.player
self.map.tick(self.player) self.map.tick(self.player)

View File

@ -42,7 +42,7 @@ class TestGame(unittest.TestCase):
sword.hold(self.game.player) sword.hold(self.game.player)
for entity in self.game.map.entities: for entity in self.game.map.entities:
#trumpets change order when they are loaded, so it is unsuitable for simple testing # trumpets change order when they are loaded, this breaks the test.
if entity.name == 'trumpet': if entity.name == 'trumpet':
self.game.map.remove_entity(entity) self.game.map.remove_entity(entity)