Changed equipment behaviour, now equipped items stay in the inventory

This commit is contained in:
Nicolas Margulies
2021-01-10 22:15:32 +01:00
parent 44b967625c
commit 88471f4361
4 changed files with 51 additions and 68 deletions

View File

@ -155,9 +155,9 @@ class TestEntities(unittest.TestCase):
"""
item = Item()
self.map.add_entity(item)
self.assertFalse(item.held)
self.assertIsNone(item.held_by)
item.hold(self.player)
self.assertTrue(item.held)
self.assertEqual(item.held_by, self.player)
item.drop()
self.assertEqual(item.y, 1)
self.assertEqual(item.x, 6)
@ -165,7 +165,6 @@ class TestEntities(unittest.TestCase):
# Pick up item
self.player.move_left()
self.player.move_right()
self.assertTrue(item.held)
self.assertEqual(item.held_by, self.player)
self.assertIn(item, self.player.inventory)
self.assertNotIn(item, self.map.entities)
@ -208,7 +207,7 @@ class TestEntities(unittest.TestCase):
# The player can't hold the explosion
explosion.hold(self.player)
self.assertNotIn(explosion, self.player.inventory)
self.assertFalse(explosion.held)
self.assertIsNone(explosion.held_by)
# The explosion disappears after one tick
explosion.act(self.map)