Beispiel #1
0
 def test_interactable_cells(self):
     cells = self._generate_cells()
     cells[0]["interactable"] = {"type": "health"}
     cells[8]["interactable"] = {"type": "damage_boost"}
     map = WorldMap(cells)
     self.assertLocationsEqual(map.interactable_cells(),
                               (Location(-1, -1), Location(1, 1)))
Beispiel #2
0
 def test_interactable_cells(self):
     cells = self._generate_cells()
     cells[0]["interactable"] = {"health_restored": 5}
     cells[8]["interactable"] = {"health_restored": 2}
     map = WorldMap(cells)
     self.assertLocationsEqual(
         map.interactable_cells(), (Location(-1, -1), Location(1, 1))
     )
Beispiel #3
0
 def test_interactable_cells(self):
     pickup_cell1 = MockCell(interactable=MockPickup())
     pickup_cell2 = MockCell(interactable=MockPickup())
     no_pickup_cell = MockCell()
     grid = self._grid_from_list([[pickup_cell1, no_pickup_cell],
                                  [no_pickup_cell, pickup_cell2]])
     world_map = WorldMap(grid, self.settings)
     cells = list(world_map.interactable_cells())
     self.assertIn(pickup_cell1, cells)
     self.assertIn(pickup_cell2, cells)
     self.assertEqual(len(cells), 2, "Non-pickup cells present")
Beispiel #4
0
    def test_get_all_interactables(self):
        interactable_cell = MockCell()
        interactable_cell.interactable = ScoreLocation(interactable_cell)
        grid = self._grid_from_list(
            [[interactable_cell, MockCell()], [MockCell(), MockCell()]]
        )
        world_map = WorldMap(grid, self.settings)
        interactable_list = list(world_map.interactable_cells())

        self.assertEqual(len(interactable_list), 1)
        self.assertTrue(isinstance(interactable_list[0].interactable, _Interactable))