Fix sunflowers and merchants since the position of the player is no longer fixed

This commit is contained in:
Yohann D'ANELLO 2020-12-11 19:21:02 +01:00
parent 895abe88ad
commit 209bde5b5c
1 changed files with 5 additions and 5 deletions

View File

@ -473,7 +473,7 @@ class TestGame(unittest.TestCase):
self.game.state = GameMode.PLAY self.game.state = GameMode.PLAY
sunflower = Sunflower() sunflower = Sunflower()
sunflower.move(2, 6) sunflower.move(self.game.player.y + 1, self.game.player.x)
self.game.map.add_entity(sunflower) self.game.map.add_entity(sunflower)
# Does nothing # Does nothing
@ -504,15 +504,15 @@ class TestGame(unittest.TestCase):
Sunflower.dialogue_option) Sunflower.dialogue_option)
# Test all directions to detect the friendly entity # Test all directions to detect the friendly entity
self.game.player.move(3, 6) self.game.player.move(sunflower.y + 1, sunflower.x)
self.game.handle_key_pressed(KeyValues.CHAT) self.game.handle_key_pressed(KeyValues.CHAT)
self.game.handle_key_pressed(KeyValues.UP) self.game.handle_key_pressed(KeyValues.UP)
self.assertEqual(len(self.game.logs.messages), 3) self.assertEqual(len(self.game.logs.messages), 3)
self.game.player.move(2, 7) self.game.player.move(sunflower.y, sunflower.x + 1)
self.game.handle_key_pressed(KeyValues.CHAT) self.game.handle_key_pressed(KeyValues.CHAT)
self.game.handle_key_pressed(KeyValues.LEFT) self.game.handle_key_pressed(KeyValues.LEFT)
self.assertEqual(len(self.game.logs.messages), 4) self.assertEqual(len(self.game.logs.messages), 4)
self.game.player.move(2, 5) self.game.player.move(sunflower.y, sunflower.x - 1)
self.game.handle_key_pressed(KeyValues.CHAT) self.game.handle_key_pressed(KeyValues.CHAT)
self.game.handle_key_pressed(KeyValues.RIGHT) self.game.handle_key_pressed(KeyValues.RIGHT)
self.assertEqual(len(self.game.logs.messages), 5) self.assertEqual(len(self.game.logs.messages), 5)
@ -524,7 +524,7 @@ class TestGame(unittest.TestCase):
self.game.state = GameMode.PLAY self.game.state = GameMode.PLAY
merchant = Merchant() merchant = Merchant()
merchant.move(2, 6) merchant.move(self.game.player.y + 1, self.game.player.x)
self.game.map.add_entity(merchant) self.game.map.add_entity(merchant)
# Does nothing # Does nothing