Exemplo n.º 1
0
    def test_game_time(self):
        self.assertEqual(turn.game_datetime(),
                         tt_calendar.DateTime(0, 0, 0, 0, 0, 0))

        turn.increment()

        self.assertEqual(turn.game_datetime(),
                         tt_calendar.DateTime(0, 0, 0, 0, 2, 0))
Exemplo n.º 2
0
    def create(cls, generator):
        obj = cls()

        cells = []

        for y in range(0, generator.h):
            row = []

            for x in range(0, generator.w):
                cell = generator.cell_info(x, y)
                randomized_cell = cell.randomize(
                    seed=(x + y) * turn.game_datetime().day,
                    fraction=map_settings.CELL_RANDOMIZE_FRACTION)
                row.append(UICell(randomized_cell))

            cells.append(tuple(row))

        obj.cells = tuple(cells)

        return obj
Exemplo n.º 3
0
    def get_achievement_type_value(self, achievement_type):

        if achievement_type.is_TIME:
            return turn.game_datetime(self.last_rare_operation_at_turn -
                                      self.created_at_turn).year
        elif achievement_type.is_MONEY:
            return self.statistics.money_earned
        elif achievement_type.is_MOBS:
            return self.statistics.pve_kills
        elif achievement_type.is_ARTIFACTS:
            return self.statistics.artifacts_had
        elif achievement_type.is_QUESTS:
            return self.statistics.quests_done
        elif achievement_type.is_DEATHS:
            return self.statistics.pve_deaths
        elif achievement_type.is_PVP_BATTLES_1X1:
            return self.statistics.pvp_battles_1x1_number
        elif achievement_type.is_PVP_VICTORIES_1X1:
            if self.statistics.pvp_battles_1x1_number >= conf.heroes_settings.MIN_PVP_BATTLES:
                return int(
                    float(self.statistics.pvp_battles_1x1_victories) /
                    self.statistics.pvp_battles_1x1_number * 100)
            return 0
        elif achievement_type.is_KEEPER_HELP_COUNT:
            return self.statistics.help_count
        elif achievement_type.is_HABITS_HONOR:
            return self.habit_honor.raw_value
        elif achievement_type.is_HABITS_PEACEFULNESS:
            return self.habit_peacefulness.raw_value
        elif achievement_type.is_KEEPER_CARDS_USED:
            return self.statistics.cards_used
        elif achievement_type.is_KEEPER_CARDS_COMBINED:
            return self.statistics.cards_combined

        raise exceptions.UnkwnownAchievementTypeError(
            achievement_type=achievement_type)
Exemplo n.º 4
0
def game_datetime(turn_number=None):
    return turn.game_datetime(turn_number)
Exemplo n.º 5
0
def verbose_game_date(turn_number):
    return turn.game_datetime(turn_number).date.verbose_full()
Exemplo n.º 6
0
 def age(self):
     return turn.game_datetime() - turn.game_datetime(self.created_at_turn)
Exemplo n.º 7
0
 def birthday(self):
     return turn.game_datetime(self.created_at_turn)
Exemplo n.º 8
0
 def game_time(self):
     return turn.game_datetime(self.turn_number)