Esempio n. 1
0
def test_default_worksheet_loaded_when_no_worksheet_id_provided():
    worksheet = get_worksheet_data()
    assert worksheet.era == "future"
    assert len(worksheet.map_updaters) == 1
    assert type(worksheet.map_updaters[0]) == PickupUpdater
    assert worksheet.map_updaters[0].pickup_types == [YellowOrbArtefact]
    assert worksheet.avatar_state_serializer == worksheet1_avatar_state_serializer
Esempio n. 2
0
    def __init__(self, game_state, communicator, worksheet: WorksheetData = None):
        if worksheet is None:
            worksheet = get_worksheet_data()

        self.game_state = game_state
        self.communicator = communicator
        self.worksheet: WorksheetData = worksheet
        self._lock = threading.RLock()
Esempio n. 3
0
def test_worksheet_loads_from_environment_variables():
    with patch.dict("os.environ", values={"worksheet_id": "2"}):
        worksheet = get_worksheet_data()
        assert worksheet.era == "future"
        assert len(worksheet.map_updaters) == 1
        assert type(worksheet.map_updaters[0]) == PickupUpdater
        assert worksheet.map_updaters[0].pickup_types == [YellowOrbArtefact]
        assert worksheet.avatar_state_serializer == worksheet2_avatar_state_serializer
Esempio n. 4
0
    def __init__(self,
                 world_map,
                 avatar_manager,
                 worksheet: WorksheetData = None):
        if worksheet is None:
            worksheet = get_worksheet_data()

        self.world_map: WorldMap = world_map
        self.avatar_manager: AvatarManager = avatar_manager
        self.turn_count: int = 0
        self.worksheet: WorksheetData = worksheet
Esempio n. 5
0
    def make_obstacle(worksheet: WorksheetData = None) -> "Obstacle":
        """
        Returns an obstacle with a randomly generated texture choice based on number of different
        obstacle textures indicated in the worksheet.

        Args:
            worksheet (WorksheetData, optional): The worksheet to use to generate the obstacle. Defaults to get_worksheet_data().
        """
        if worksheet is None:
            worksheet = get_worksheet_data()
        texture_choice = randint(1, worksheet.number_of_obstacle_textures)
        return Obstacle(texture_choice)
Esempio n. 6
0
    def __init__(self, worksheet: WorksheetData = None):
        if worksheet is None:
            worksheet = get_worksheet_data()

        self.avatars_by_id = {}
        self.worksheet = worksheet
Esempio n. 7
0
def test_worksheet_loads_from_environment_variables():
    with patch.dict("os.environ", values={"worksheet_id": "2"}):
        worksheet = get_worksheet_data()
        assert worksheet.era == "future"
        assert worksheet.map_updaters == [PickupUpdater]
        assert worksheet.avatar_state_serializer == worksheet2_avatar_state_serializer
Esempio n. 8
0
def test_default_worksheet_loaded_when_no_worksheet_id_provided():
    worksheet = get_worksheet_data()
    assert worksheet.era == "future"
    assert worksheet.map_updaters == [PickupUpdater]
    assert worksheet.avatar_state_serializer == worksheet1_avatar_state_serializer