Esempio n. 1
0
    def test_successful_pickup_action(self):
        game_state = GameState(PickupMap(Artefact), self.avatar_manager)

        action.PickupAction(self.avatar).process(game_state.world_map)

        self.assertEqual(
            self.avatar.events,
            [event.PickedUpEvent({"type": "artefact", "location": ORIGIN.serialize()})],
        )
Esempio n. 2
0
    def test_failed_pickup_action_if_backpack_full(self):
        game_state = GameState(PickupMap(Artefact), self.avatar_manager)
        game_state.world_map.setup_cell(self.avatar.location)
        artefact = game_state.world_map.get_cell(
            self.avatar.location).interactable

        self.avatar.backpack = [
            Artefact for _ in range(self.avatar.BACKPACK_SIZE)
        ]

        action.PickupAction(self.avatar).process(game_state.world_map)

        self.assertEqual(self.avatar.events, [event.FailedPickupEvent()])
        self.assertEquals(artefact.in_backpack, False)
Esempio n. 3
0
    def test_successful_pickup_action(self):
        game_state = GameState(PickupMap(Artefact), self.avatar_manager)
        game_state.world_map.setup_cell(self.avatar.location)
        artefact = game_state.world_map.get_cell(
            self.avatar.location).interactable

        self.assertEquals(artefact.in_backpack, False)

        action.PickupAction(self.avatar).process(game_state.world_map)

        self.assertEqual(
            self.avatar.events,
            [event.PickedUpEvent({"type": "artefact"})],
        )
        self.assertEquals(artefact.in_backpack, True)
Esempio n. 4
0
    def test_successful_pickup_action(self):
        game_state = GameState(PickupMap(YellowOrbArtefact),
                               self.avatar_manager)
        game_state.world_map.setup_cell(self.avatar.location)
        artefact = game_state.world_map.get_cell(
            self.avatar.location).interactable

        assert artefact.in_backpack == False

        action.PickupAction(self.avatar).process(game_state.world_map)

        assert self.avatar.events == [
            event.PickedUpEvent({"type": "yellow_orb"})
        ]
        assert artefact.in_backpack == True
Esempio n. 5
0
    def test_failed_pickup_action(self):
        game_state = GameState(InfiniteMap(), self.avatar_manager)

        action.PickupAction(self.avatar).process(game_state.world_map)

        self.assertEqual(self.avatar.events, [event.FailedPickupEvent()])