def __init__(self, padding: float = 1):
     assert (padding < 5)
     super().__init__()
     self.padding = padding
     self.elderCount = GameCount()
     self.elementCount = dict()
     for dragon_type in GameData.DRAGON_TYPES:
         self.elementCount[dragon_type] = GameCount()
Esempio n. 2
0
    def __init__(self):
        super().__init__()

        self.riftheraldCountList = [GameCount() for _ in range(3)]
        self.baronCountList = [GameCount() for _ in range(11)]
        self.elderDragonCountList = [GameCount() for _ in range(11)]
        self.elementDragonCountDict = dict()
        for dragon_type in GameData.DRAGON_TYPES:
            self.elementDragonCountDict[dragon_type] = GameCount()
Esempio n. 3
0
class ElderAfterElement(BaseParser):
	def __init__(self):
		super().__init__()
		self.elderNoElementCount = GameCount()
		self.elderAndElementCount = GameCount()

	def parse(self, game_data: GameData):
		dragons_count = [0, 0]
		element = None
		elder = None

		for log in game_data.monster_logs:
			if log.monster_type in GameData.DRAGON_TYPES:
				is_winner = game_data.is_id_winner(log.killer_id)
				dragons_count[is_winner] += 1
				if dragons_count[is_winner] == 4:
					element = log
			elif log.monster_type == GameData.ELDER_DRAGON and elder is None:
				elder = log

		if element is not None and elder is not None:
			if not game_data.is_same_side(element.killer_id, elder.killer_id):
				self.elderNoElementCount.insert(game_data.is_id_winner(elder.killer_id), elder.timestamp / 60000)
			else:
				self.elderAndElementCount.insert(game_data.is_id_winner(elder.killer_id), elder.timestamp / 60000)

	def __str__(self):
		s = ""
		s += "ELDER_DRAGON_AFTER_DRAGON_ELEMENT_TAKEN_AWAY: %s\n" % self.elderNoElementCount
		s += "ELDER_DRAGON_AND_DRAGON_ELEMENT: %s\n" % self.elderAndElementCount
		return s

	def plot(self):
		self.elderNoElementCount.plot("ELDER_DRAGON_AFTER_DRAGON_ELEMENT_TAKEN_AWAY")
		self.elderAndElementCount.plot("ELDER_DRAGON_AND_DRAGON_ELEMENT")
 def __init__(self, padding: float = 1):
     assert (padding <= 5)
     super().__init__()
     self.padding = padding
     self.dragonCountDict = dict()
     for dragon_type in GameData.DRAGON_TYPES:
         self.dragonCountDict[dragon_type] = GameCount()
 def __init__(self):
     super().__init__()
     self.firstDragonCount = GameCount()
     self.firstHeraldCount = GameCount()
     self.firstBothCount = GameCount()
     self.firstDragonTypeCountDict = dict()
     for dragon_type in GameData.DRAGON_TYPES:
         self.firstDragonTypeCountDict[dragon_type] = GameCount()
Esempio n. 6
0
	def __init__(self):
		super().__init__()
		self.elderNoElementCount = GameCount()
		self.elderAndElementCount = GameCount()
class BaronXElderOrElement(BaseParser):
    def __init__(self, padding: float = 1):
        assert (padding < 5)
        super().__init__()
        self.padding = padding
        self.elderCount = GameCount()
        self.elementCount = dict()
        for dragon_type in GameData.DRAGON_TYPES:
            self.elementCount[dragon_type] = GameCount()

    def parse(self, game_data: GameData):
        elders = []
        nashors = []
        dragons_count = [0, 0]
        element = None

        for log in game_data.monster_logs:
            if log.monster_type in GameData.DRAGON_TYPES:
                is_winner = game_data.is_id_winner(log.killer_id)
                dragons_count[is_winner] += 1
                if dragons_count[is_winner] == 4:
                    element = log
            elif log.monster_type == GameData.ELDER_DRAGON:
                elders.append(log)
            elif log.monster_type == GameData.BARON_NASHOR:
                nashors.append(log)

        if len(nashors) != 0:
            for nashor in nashors:
                nashor_time = nashor.timestamp / 60000

                if element is not None:
                    element_time = element.timestamp / 60000
                    if (abs(nashor_time - element_time) < self.padding) and \
                     not game_data.is_same_side(nashor.killer_id, element.killer_id):
                        self.elementCount[element.monster_type].insert(
                            game_data.is_id_winner(nashor.killer_id),
                            nashor_time)

                for elder in elders:
                    elder_time = elder.timestamp / 60000
                    if (abs(nashor_time - elder_time) < self.padding) and \
                     not game_data.is_same_side(nashor.killer_id, elder.killer_id):
                        self.elderCount.insert(
                            game_data.is_id_winner(nashor.killer_id),
                            nashor_time)

    def plot(self):
        for dragon_type in GameData.DRAGON_TYPES:
            self.elementCount[dragon_type].plot(
                "%s_EXCHANGE_WITH_%s_ELEMENT" %
                (GameData.BARON_NASHOR, dragon_type))
        self.elderCount.plot("%s_EXCHANGE_WITH_%s" %
                             (GameData.BARON_NASHOR, GameData.ELDER_DRAGON))

    def __str__(self):
        s = ""
        for dragon_type in GameData.DRAGON_TYPES:
            s += "%s_EXCHANGE_WITH_%s_ELEMENT: %s\n" % (
                GameData.BARON_NASHOR, dragon_type,
                self.elementCount[dragon_type])
        s += "%s_EXCHANGE_WITH_%s: %s\n" % (
            GameData.BARON_NASHOR, GameData.ELDER_DRAGON, self.elderCount)
        return s
class FirstDragonHerald(BaseParser):
    def __init__(self):
        super().__init__()
        self.firstDragonCount = GameCount()
        self.firstHeraldCount = GameCount()
        self.firstBothCount = GameCount()
        self.firstDragonTypeCountDict = dict()
        for dragon_type in GameData.DRAGON_TYPES:
            self.firstDragonTypeCountDict[dragon_type] = GameCount()

    def parse(self, game_data: GameData):
        first_dragon = None
        first_herald = None

        for log in game_data.monster_logs:
            monster_type = log.monster_type
            is_winner = game_data.is_id_winner(log.killer_id)
            time = log.timestamp // 60000
            if first_dragon is None and monster_type in GameData.DRAGON_TYPES:
                self.firstDragonCount.insert(is_winner, time)
                self.firstDragonTypeCountDict[monster_type].insert(
                    is_winner, time)
                first_dragon = is_winner
            elif first_herald is None and monster_type == GameData.RIFT_HERALD:
                self.firstHeraldCount.insert(is_winner, time)
                first_herald = is_winner
            if first_dragon is not None and first_herald is not None:
                break

        if first_herald == first_dragon:
            self.firstBothCount.insert(first_dragon)

    def __str__(self):
        s = ""
        s += "FIRST_DRAGON: %s\n" % self.firstDragonCount
        s += "FIRST_RIFT_HERALD: %s\n" % self.firstHeraldCount
        s += "FIRST_DRAGON_AND_RIFT_HERALD: % s\n" % self.firstBothCount
        for dragon_type in GameData.DRAGON_TYPES:
            s += "FIRST_%s: %s\n" % (
                dragon_type, self.firstDragonTypeCountDict[dragon_type])
        return s

    def plot(self):
        self.firstDragonCount.plot('FIRST_DRAGON')
        self.firstHeraldCount.plot('FIRST_RIFT_HERALD')
        self.firstBothCount.plot('FIRST_DRAGON_AND_RIFT_HERALD')
        for dragon_type in GameData.DRAGON_TYPES:
            self.firstDragonTypeCountDict[dragon_type].plot("FIRST_%s" %
                                                            dragon_type)