tick function takes the player as argument
This commit is contained in:
parent
dadafc84eb
commit
e1918ab066
|
@ -57,17 +57,17 @@ class TestEntities(unittest.TestCase):
|
||||||
self.map.add_entity(entity)
|
self.map.add_entity(entity)
|
||||||
entity.move(15, 44)
|
entity.move(15, 44)
|
||||||
# Move randomly
|
# Move randomly
|
||||||
self.map.tick()
|
self.map.tick(self.player)
|
||||||
self.assertFalse(entity.y == 15 and entity.x == 44)
|
self.assertFalse(entity.y == 15 and entity.x == 44)
|
||||||
|
|
||||||
# Move to the player
|
# Move to the player
|
||||||
entity.move(3, 6)
|
entity.move(3, 6)
|
||||||
self.map.tick()
|
self.map.tick(self.player)
|
||||||
self.assertTrue(entity.y == 2 and entity.x == 6)
|
self.assertTrue(entity.y == 2 and entity.x == 6)
|
||||||
|
|
||||||
# Rabbit should fight
|
# Rabbit should fight
|
||||||
old_health = self.player.health
|
old_health = self.player.health
|
||||||
self.map.tick()
|
self.map.tick(self.player)
|
||||||
self.assertTrue(entity.y == 2 and entity.x == 6)
|
self.assertTrue(entity.y == 2 and entity.x == 6)
|
||||||
self.assertEqual(old_health - entity.strength, self.player.health)
|
self.assertEqual(old_health - entity.strength, self.player.health)
|
||||||
self.assertEqual(self.map.logs.messages[-1],
|
self.assertEqual(self.map.logs.messages[-1],
|
||||||
|
|
Loading…
Reference in New Issue