diff --git a/pyproject.toml b/pyproject.toml index fd700ed..a323cfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "starrail_damage_cal" -version = "1.1.0" +version = "1.2.0" description = "For StarRail Role Damage Cal" authors = [ {name = "qwerdvd", email = "105906879+qwerdvd@users.noreply.github.com"}, diff --git a/starrail_damage_cal/damage/AvatarDamage/AvatarDamage.py b/starrail_damage_cal/damage/AvatarDamage/AvatarDamage.py index 28ec4fe..d37d43f 100644 --- a/starrail_damage_cal/damage/AvatarDamage/AvatarDamage.py +++ b/starrail_damage_cal/damage/AvatarDamage/AvatarDamage.py @@ -7,11 +7,10 @@ from starrail_damage_cal.damage.Base.model import ( DamageInstanceSkill, ) from starrail_damage_cal.damage.Role import ( + break_damage, calculate_damage, calculate_heal, calculate_shield, - get_damage, - break_damage, ) from starrail_damage_cal.logger import logger @@ -4371,6 +4370,7 @@ class Hanya(BaseAvatar): return skill_info_list + class DrRatio(BaseAvatar): Buff: BaseAvatarBuff @@ -4401,8 +4401,6 @@ class DrRatio(BaseAvatar): base_attr: Dict[str, float], attribute_bonus: Dict[str, float], ): - - damage1, damage2, damage3 = await calculate_damage( base_attr, attribute_bonus, @@ -4455,7 +4453,7 @@ class DrRatio(BaseAvatar): ) damagelist3[2] += damage3 skill_info_list.append({"name": "终结技", "damagelist": damagelist3}) - + # 计算天赋追伤伤害 skill_multiplier = self.Skill_num("Talent", "Talent") damagelist4 = await calculate_damage( @@ -4485,6 +4483,7 @@ class DrRatio(BaseAvatar): return skill_info_list + class RuanMei(BaseAvatar): Buff: BaseAvatarBuff @@ -4515,17 +4514,28 @@ class RuanMei(BaseAvatar): attribute_bonus: Dict[str, float], ): # 计算属性加成 - attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + self.Skill_num("BPSkill", "BPSkill") - attribute_bonus["BreakDamageAddedRatioBase"] = attribute_bonus.get("BreakDamageAddedRatioBase",0) + 0.5 - attribute_bonus["ResistancePenetration"] = attribute_bonus.get("ResistancePenetration",0) + self.Skill_num("Ultra", "Ultra_P") - attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get("SpeedAddedRatio",0) + self.Skill_num("Talent", "Talent_S") - - #战斗中阮•梅的击破特攻大于120%时,每超过10%,则战技使我方全体伤害提高的效果额外提高6%,最高不超过36%。 - Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase",0) + attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get( + "AllDamageAddedRatio", 0 + ) + self.Skill_num("BPSkill", "BPSkill") + attribute_bonus["BreakDamageAddedRatioBase"] = ( + attribute_bonus.get("BreakDamageAddedRatioBase", 0) + 0.5 + ) + attribute_bonus["ResistancePenetration"] = attribute_bonus.get( + "ResistancePenetration", 0 + ) + self.Skill_num("Ultra", "Ultra_P") + attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get( + "SpeedAddedRatio", 0 + ) + self.Skill_num("Talent", "Talent_S") + + # 战斗中阮•梅的击破特攻大于120%时, 每超过10%, 则战技使我方全体伤害提高的效果额外提高6%, 最高不超过36%。 + Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase", 0) if Break_Damage_Added_Ratio > 1.2: add_all_damage_added_ratio = ((Break_Damage_Added_Ratio - 1.2) / 0.1) * 0.06 - add_all_damage_added_ratio = min(0.36,add_all_damage_added_ratio) - attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + add_all_damage_added_ratio + add_all_damage_added_ratio = min(0.36, add_all_damage_added_ratio) + attribute_bonus["AllDamageAddedRatio"] = ( + attribute_bonus.get("AllDamageAddedRatio", 0) + + add_all_damage_added_ratio + ) damage1, damage2, damage3 = await calculate_damage( base_attr, @@ -4564,7 +4574,7 @@ class RuanMei(BaseAvatar): ) jipodamage1[0] = jipodamage1[0] * skill_multiplier skill_info_list.append({"name": "残梅绽附加伤害", "damagelist": jipodamage1}) - + # 计算天赋追伤伤害 skill_multiplier = self.Skill_num("Talent", "Talent") if self.avatar_rank >= 6: @@ -4582,6 +4592,7 @@ class RuanMei(BaseAvatar): return skill_info_list + class XueYi(BaseAvatar): Buff: BaseAvatarBuff @@ -4602,17 +4613,21 @@ class XueYi(BaseAvatar): self.eidolon_attribute["BreakDamageAddedRatioBase"] = 0.4 def extra_ability(self): - self.extra_ability_attribute["UltraDmgAdd"] = 0.1 + self.Skill_num("Ultra", "Ultra_A") + self.extra_ability_attribute["UltraDmgAdd"] = 0.1 + self.Skill_num( + "Ultra", "Ultra_A" + ) async def getdamage( self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float], ): - #使自身造成的伤害提高,提高数值等同于击破特攻的100%,最多使造成的伤害提高240%。 - Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase",0) - attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + min(2.4,Break_Damage_Added_Ratio) - + # 使自身造成的伤害提高, 提高数值等同于击破特攻的100%, 最多使造成的伤害提高240%。 + Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase", 0) + attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get( + "AllDamageAddedRatio", 0 + ) + min(2.4, Break_Damage_Added_Ratio) + damage1, damage2, damage3 = await calculate_damage( base_attr, attribute_bonus, @@ -4665,7 +4680,7 @@ class XueYi(BaseAvatar): ) damagelist3[2] += damage3 skill_info_list.append({"name": "终结技", "damagelist": damagelist3}) - + # 计算天赋追伤伤害 skill_multiplier = self.Skill_num("Talent", "Talent") damagelist4 = await calculate_damage( @@ -4684,6 +4699,7 @@ class XueYi(BaseAvatar): return skill_info_list + class AvatarDamage: @classmethod def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]): diff --git a/starrail_damage_cal/damage/Relic/Relic.py b/starrail_damage_cal/damage/Relic/Relic.py index 778aced..194bf24 100644 --- a/starrail_damage_cal/damage/Relic/Relic.py +++ b/starrail_damage_cal/damage/Relic/Relic.py @@ -371,6 +371,7 @@ class Relic114(BaseRelicSetSkill): attribute_bonus["SpeedAddedRatio"] = speed_added_ratio + 0.12000000011175871 return attribute_bonus + class Relic115(BaseRelicSetSkill): def __init__(self, set_id: int, count: int): super().__init__(set_id, count) @@ -392,12 +393,17 @@ class Relic115(BaseRelicSetSkill): attribute_bonus: Dict[str, float], ): if self.pieces2: - attribute_bonus["TalentDmgAdd"] = attribute_bonus.get("TalentDmgAdd", 0) + 0.20000000011175871 + attribute_bonus["TalentDmgAdd"] = ( + attribute_bonus.get("TalentDmgAdd", 0) + 0.20000000011175871 + ) if self.pieces4 and await self.check(base_attr, attribute_bonus): attack_added_ratio = attribute_bonus.get("AttackAddedRatio", 0) - attribute_bonus["AttackAddedRatio"] = attack_added_ratio + 0.06000000009313226 * 8 + attribute_bonus["AttackAddedRatio"] = ( + attack_added_ratio + 0.06000000009313226 * 8 + ) return attribute_bonus + class Relic116(BaseRelicSetSkill): def __init__(self, set_id: int, count: int): super().__init__(set_id, count) @@ -422,6 +428,7 @@ class Relic116(BaseRelicSetSkill): attribute_bonus["ignore_defence"] = ignore_defence + 0.06000000009313226 * 3 return attribute_bonus + class Relic301(BaseRelicSetSkill): def __init__(self, set_id: int, count: int): super().__init__(set_id, count) @@ -711,6 +718,7 @@ class Relic310(BaseRelicSetSkill): ) return attribute_bonus + class Relic311(BaseRelicSetSkill): def __init__(self, set_id: int, count: int): super().__init__(set_id, count) @@ -720,7 +728,7 @@ class Relic311(BaseRelicSetSkill): base_attr: Dict[str, float], attribute_bonus: Dict[str, float], ): - """当装备者的速度大于等于135/160时,使装备者造成的伤害提高12%/18%。""" + """当装备者的速度大于等于135/160时, 使装备者造成的伤害提高12%/18%。""" merged_attr = await merge_attribute(base_attr, attribute_bonus) if merged_attr["speed"] >= 135: logger.info("Relic306 check success") @@ -733,15 +741,19 @@ class Relic311(BaseRelicSetSkill): attribute_bonus: Dict[str, float], ): if self.pieces2 and await self.check(base_attr, attribute_bonus): + add_damage_base = 0 merged_attr = await merge_attribute(base_attr, attribute_bonus) if merged_attr["speed"] >= 135: add_damage_base = 0.12000000018626451 if merged_attr["speed"] >= 160: add_damage_base = 0.18000000018626451 - attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio", 0) + add_damage_base - + attribute_bonus["AllDamageAddedRatio"] = ( + attribute_bonus.get("AllDamageAddedRatio", 0) + add_damage_base + ) + return attribute_bonus + class Relic312(BaseRelicSetSkill): def __init__(self, set_id: int, count: int): super().__init__(set_id, count) @@ -760,10 +772,13 @@ class Relic312(BaseRelicSetSkill): attribute_bonus: Dict[str, float], ): if self.pieces2 and await self.check(base_attr, attribute_bonus): - attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio", 0) + 0.10000000018626451 - + attribute_bonus["AllDamageAddedRatio"] = ( + attribute_bonus.get("AllDamageAddedRatio", 0) + 0.10000000018626451 + ) + return attribute_bonus + class RelicSet: HEAD: SingleRelic HAND: SingleRelic diff --git a/starrail_damage_cal/damage/Role.py b/starrail_damage_cal/damage/Role.py index fb1598a..47501ea 100644 --- a/starrail_damage_cal/damage/Role.py +++ b/starrail_damage_cal/damage/Role.py @@ -52,6 +52,7 @@ async def calculate_shield( return [defence_num] + async def get_damage( damege: int, base_attr: Dict[str, float], @@ -66,7 +67,7 @@ async def get_damage( add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type) merged_attr = await merge_attribute(base_attr, add_attr_bonus) - + injury_area, element_area = calculate_injury_area( merged_attr, skill_type, @@ -81,13 +82,14 @@ async def get_damage( expected_damage = calculate_expected_damage(critical_chance, critical_damage) damage_cd = damege * skill_multiplier * injury_area - + damage_qw = damege * skill_multiplier * injury_area - + damage_tz = damege * skill_multiplier * (injury_area + 2.626) * 10 return [damage_cd, damage_qw, damage_tz] + async def break_damage( base_attr: Dict[str, float], attribute_bonus: Dict[str, float], @@ -97,23 +99,23 @@ async def break_damage( level: int, ): break_element = { - 'Ice': 1, - 'Imaginary': 1, - 'Quantum': 1, - 'Thunder': 2, - 'Wind': 3, - 'Physical': 4, - 'Fire': 5, + "Ice": 1, + "Imaginary": 1, + "Quantum": 1, + "Thunder": 2, + "Wind": 3, + "Physical": 4, + "Fire": 5, } - + add_attr_bonus = copy.deepcopy(attribute_bonus) add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type) merged_attr = await merge_attribute(base_attr, add_attr_bonus) - - break_atk = 3767.55 #80级敌人击破伤害基数,我也不知道为什么是这个,反正都说是这个 - + + break_atk = 3767.55 # 80级敌人击破伤害基数, 我也不知道为什么是这个, 反正都说是这个 + damage_reduction = calculate_damage_reduction(level) resistance_area = calculate_resistance_area( @@ -123,16 +125,28 @@ async def break_damage( element, ) - defence_multiplier = calculate_defence_multiplier(level, merged_attr) - + defence_multiplier = calculate_defence_multiplier( + level, merged_attr, skill_type, add_skill_type + ) + damage_ratio = calculate_damage_ratio(merged_attr, skill_type, add_skill_type) - + break_damage = merged_attr.get("BreakDamageAddedRatioBase", 0) + 1 - - damage_cd = break_atk * break_element[element] * 2 * break_damage * damage_ratio * damage_reduction * resistance_area * defence_multiplier + + damage_cd = ( + break_atk + * break_element[element] + * 2 + * break_damage + * damage_ratio + * damage_reduction + * resistance_area + * defence_multiplier + ) return [damage_cd] + async def calculate_damage( base_attr: Dict[str, float], attribute_bonus: Dict[str, float], @@ -165,7 +179,9 @@ async def calculate_damage( element, ) - defence_multiplier = calculate_defence_multiplier(level, merged_attr, skill_type, add_skill_type) + defence_multiplier = calculate_defence_multiplier( + level, merged_attr, skill_type, add_skill_type + ) injury_area, element_area = calculate_injury_area( merged_attr, diff --git a/starrail_damage_cal/damage/Weapon/Weapon.py b/starrail_damage_cal/damage/Weapon/Weapon.py index bbe615a..3e620ee 100644 --- a/starrail_damage_cal/damage/Weapon/Weapon.py +++ b/starrail_damage_cal/damage/Weapon/Weapon.py @@ -2261,6 +2261,7 @@ class Mediation(BaseWeapon): ) return attribute_bonus + # 纯粹思维的洗礼 class BaptismofPureThought(BaseWeapon): weapon_base_attributes: Dict @@ -2269,7 +2270,7 @@ class BaptismofPureThought(BaseWeapon): super().__init__(weapon) async def check(self): - # 敌方目标每承受1个负面效果,装备者对其造成的暴击伤害额外提高8%,最多叠加3层。施放终结技攻击敌方目标时,使装备者获得【论辩】效果,造成的伤害提高36%,追加攻击无视目标24%的防御力,该效果持续2回合。 + # 敌方目标每承受1个负面效果, 装备者对其造成的暴击伤害额外提高8%, 最多叠加3层。施放终结技攻击敌方目标时, 使装备者获得【论辩】效果, 造成的伤害提高36%, 追加攻击无视目标24%的防御力, 该效果持续2回合。 return True async def weapon_ability( @@ -2282,23 +2283,36 @@ class BaptismofPureThought(BaseWeapon): critical_damage_base = attribute_bonus.get("CriticalDamageBase", 0) attribute_bonus["CriticalDamageBase"] = ( critical_damage_base - + (weapon_effect["23020"]["Param"]["CriticalDamageBase"][self.weapon_rank - 1]) + + ( + weapon_effect["23020"]["Param"]["CriticalDamageBase"][ + self.weapon_rank - 1 + ] + ) * 3 ) - + all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0) attribute_bonus["AllDamageAddedRatio"] = ( all_damage_added_ratio - + (weapon_effect["23020"]["Param"]["AllDamageAddedRatio"][self.weapon_rank - 1]) + + ( + weapon_effect["23020"]["Param"]["AllDamageAddedRatio"][ + self.weapon_rank - 1 + ] + ) ) - + resistance_penetration = attribute_bonus.get("Talentignore_defence", 0) attribute_bonus["Talentignore_defence"] = ( resistance_penetration - + (weapon_effect["23020"]["Param"]["ignore_defence"][self.weapon_rank - 1]) + + ( + weapon_effect["23020"]["Param"]["ignore_defence"][ + self.weapon_rank - 1 + ] + ) ) return attribute_bonus + # 镜中故我 class PastSelfinMirror(BaseWeapon): weapon_base_attributes: Dict @@ -2307,7 +2321,7 @@ class PastSelfinMirror(BaseWeapon): super().__init__(weapon) async def check(self): - # 装备者施放终结技后,使我方全体造成的伤害提高40%,持续3回合 + # 装备者施放终结技后, 使我方全体造成的伤害提高40%, 持续3回合 return True async def weapon_ability( @@ -2320,10 +2334,15 @@ class PastSelfinMirror(BaseWeapon): all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0) attribute_bonus["AllDamageAddedRatio"] = ( all_damage_added_ratio - + (weapon_effect["23019"]["Param"]["AllDamageAddedRatio"][self.weapon_rank - 1]) + + ( + weapon_effect["23019"]["Param"]["AllDamageAddedRatio"][ + self.weapon_rank - 1 + ] + ) ) return attribute_bonus + class Weapon: @classmethod def create(cls, weapon: DamageInstanceWeapon):