Doors #156
|
@ -2,17 +2,17 @@
|
||||||
####### #############
|
####### #############
|
||||||
#.H...# #...........#
|
#.H...# #...........#
|
||||||
#.....# #####...........#
|
#.....# #####...........#
|
||||||
#.....# #............H..#
|
#.....# #...&........H..#
|
||||||
#.##### #.###...........#
|
#.##### #.###...........#
|
||||||
#.# #.# #...........#
|
#.# #.# #...........#
|
||||||
#.# #.# #############
|
#.# #.# #############
|
||||||
#.# #.#
|
#.# #.#
|
||||||
#.#### #.#
|
#.#### #.#
|
||||||
#....# #.#
|
#....# #.#
|
||||||
####.###################.#
|
####&###################&#
|
||||||
#.....................# #################
|
#.....................# #################
|
||||||
#.....................# #...............#
|
#.....................# #...............#
|
||||||
#.....................#######...............#
|
#.....................#######...............#
|
||||||
#...........................................#
|
#.....................&.....&...............#
|
||||||
#.....................#######...............#
|
#.....................#######...............#
|
||||||
####################### #################
|
####################### #################
|
||||||
|
|
|
@ -134,13 +134,13 @@ class TestEntities(unittest.TestCase):
|
||||||
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(6, 5)
|
||||||
fam.move(4, 5)
|
fam.move(5, 5)
|
||||||
fam.target = None
|
fam.target = None
|
||||||
self.player.move_down()
|
self.player.move_down()
|
||||||
self.map.tick(self.player)
|
self.map.tick(self.player)
|
||||||
self.assertTrue(fam.target == self.player)
|
self.assertTrue(fam.target == self.player)
|
||||||
self.assertEqual(fam.y, 5)
|
self.assertEqual(fam.y, 6)
|
||||||
self.assertEqual(fam.x, 5)
|
self.assertEqual(fam.x, 5)
|
||||||
|
|
||||||
# Test random move
|
# Test random move
|
||||||
|
|
|
@ -728,6 +728,7 @@ class TestGame(unittest.TestCase):
|
||||||
self.game.player.inventory.clear()
|
self.game.player.inventory.clear()
|
||||||
ring = RingCritical()
|
ring = RingCritical()
|
||||||
ring.hold(self.game.player)
|
ring.hold(self.game.player)
|
||||||
|
self.game.display_actions(DisplayActions.REFRESH)
|
||||||
old_critical = self.game.player.critical
|
old_critical = self.game.player.critical
|
||||||
self.game.handle_key_pressed(KeyValues.EQUIP)
|
self.game.handle_key_pressed(KeyValues.EQUIP)
|
||||||
self.assertEqual(self.game.player.critical,
|
self.assertEqual(self.game.player.critical,
|
||||||
|
@ -951,3 +952,18 @@ class TestGame(unittest.TestCase):
|
||||||
# Exit the menu
|
# Exit the menu
|
||||||
self.game.handle_key_pressed(KeyValues.SPACE)
|
self.game.handle_key_pressed(KeyValues.SPACE)
|
||||||
self.assertEqual(self.game.state, GameMode.PLAY)
|
self.assertEqual(self.game.state, GameMode.PLAY)
|
||||||
|
|
||||||
|
def test_doors(self) -> None:
|
||||||
|
"""
|
||||||
|
Check that the user can open doors.
|
||||||
|
"""
|
||||||
|
self.game.state = GameMode.PLAY
|
||||||
|
|
||||||
|
self.game.player.move(9, 8)
|
||||||
|
self.assertEqual(self.game.map.tiles[10][8], Tile.DOOR)
|
||||||
|
# Open door
|
||||||
|
self.game.handle_key_pressed(KeyValues.DOWN)
|
||||||
|
self.assertEqual(self.game.map.tiles[10][8], Tile.FLOOR)
|
||||||
|
self.assertEqual(self.game.player.y, 10)
|
||||||
|
self.assertEqual(self.game.player.x, 8)
|
||||||
|
self.game.display_actions(DisplayActions.REFRESH)
|
||||||
|
|
Loading…
Reference in New Issue