def set_enhancement_sets(self): set_id = int(self.type_id[0:-4]) _set = DataMappingCollection.get_rune_set(set_id) _ancient = "Ancient-" if self.is_ancient else "" self.rune_set = "{}{}".format(_ancient, _set)
def _count_owned_bad_substats(self): """ Count how many bad substats that already owned by a rune """ available_sub = self._get_owned_substats_type() bad_substat = DataMappingCollection.get_bad_substats() owned_bad = len([x for x in available_sub if x in bad_substat]) return owned_bad
def _count_available_bad_substats(self): """ Count how many bad substats that can be acuired as new stat """ owned_substats = self._get_owned_substats_include_innate( ) # Take innate stat into consideration when predicting NEW stats bad_substat = DataMappingCollection.get_bad_substats() available_bad = len( [x for x in bad_substat if x not in owned_substats]) available_bad += self._additional_bad_point_reduction() return available_bad
def enchant_applicable(enchantgem, rune, eff_threshold=0.72): """ Check whether a enchantgem can be used :param enchantgem: which enchantgem to be used :type enchantgem: Enhancement :param rune: which rune to be checked :type rune: Rune :return: is enchantgem usable :rtype: bool """ # Bad rune should not be enchanted if rune.exp_efficiency_15_without_grind <= eff_threshold: return False # If runes is enchanted already (assumption that enchant into good stat) if rune.enchant_type is not None: # If enchanted stat with / without grind already above certain treshold if rune.enchant_value >= 0.70 * DataMappingCollection.get_rune_sub_stat_max_roll(rune.enchant_type): return False # Check for slot 1 and 3 compability if not ApplyGrind.slot_compatible(enchantgem, rune): return False owned_stats = rune.get_owned_all_stats_type() # If the stone stat already exist if enchantgem.stat in owned_stats: return False # If there exist a flat stat without any roll into it (best scenario) if rune.grade == 'L': for substat in rune.substats: substat_type = substat[0] substat_value = substat[1] if substat_type in ["ATK flat", "DEF flat", "HP flat"]: max_roll_value = DataMappingCollection.get_rune_sub_stat_max_roll( substat_type) if substat_value <= max_roll_value: return True elif substat_type in ["ACC", "RES", "CDmg", "CRate", "SPD"]: min_roll_value = DataMappingCollection.get_rune_sub_stat_min_roll( substat_type) if substat_value <= min_roll_value: return True # Since it's not legend (hero or below), it's not going to be reap, # So might as well enchant the flat stat if it's feasible (no more than 1 roll into flat) else: for substat in rune.substats: substat_type = substat[0] substat_value = substat[1] if substat_type in ["ATK flat", "DEF flat", "HP flat"]: max_roll_value = DataMappingCollection.get_rune_sub_stat_max_roll( substat_type) if substat_value <= max_roll_value * 2: # no more than 1 roll into flat return True elif substat_type in ["ACC", "RES", "CDmg", "CRate", "SPD"]: min_roll_value = DataMappingCollection.get_rune_sub_stat_min_roll( substat_type) if substat_value <= min_roll_value: return True
def max_roll_substats(substat): return DataMappingCollection.get_rune_sub_stat_max_value(substat)
def max_roll(primary_stat): return DataMappingCollection.get_rune_primary_stat_max_value( primary_stat)
def get_rune_stat_type(stat): type_id = stat[0] return DataMappingCollection.get_rune_stat_type(type_id)
def get_rune_grade_shorten(class_id): return DataMappingCollection.get_rune_grade_shorten(class_id)
def get_rune_set(set_id): return DataMappingCollection.get_rune_set(set_id)
def _set_grind_value(self, stat): sub_type = RuneParser.get_rune_stat_type(stat) if DataMappingCollection.is_substat_grindable(sub_type): self.grind_values[sub_type] = RuneParser.get_rune_grind_value(stat)
def set_values(self): self.min_value = DataMappingCollection.get_grindstone_value_min(self.stat, self.grade) self.max_value = DataMappingCollection.get_grindstone_value_max(self.stat, self.grade)
def set_values(self): self.min_value = DataMappingCollection.get_enchantgem_value_min(self.stat, self.grade) self.max_value = DataMappingCollection.get_enchantgem_value_max(self.stat, self.grade)
def set_enhancement_grade(self): self.grade_int = int(self.type_id[-1]) self.grade = DataMappingCollection.get_rune_class(self.grade_int)
def set_enhancement_stat(self): type_id = int(self.type_id[-4:-2]) self.stat = DataMappingCollection.get_rune_stat_type(type_id)
def set_enhancement_sets(self): set_id = int(self.type_id[0:-4]) self.rune_set = DataMappingCollection.get_rune_set(set_id)
def _get_monster_name(monster): monster_id = monster['unit_master_id'] return DataMappingCollection.get_monster_name(monster_id)