bump to v1.0.9

This commit is contained in:
qwerdvd 2023-11-22 16:17:55 +08:00
parent ca39daff41
commit 580f844524
No known key found for this signature in database
GPG Key ID: A3AF89C783404769
6 changed files with 127 additions and 54 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "starrail_damage_cal" name = "starrail_damage_cal"
version = "1.0.8" version = "1.0.9"
description = "For StarRail Role Damage Cal" description = "For StarRail Role Damage Cal"
authors = [ authors = [
{name = "qwerdvd", email = "105906879+qwerdvd@users.noreply.github.com"}, {name = "qwerdvd", email = "105906879+qwerdvd@users.noreply.github.com"},

View File

@ -104,7 +104,7 @@ class DamageCal:
@classmethod @classmethod
async def get_all_damage_data_by_uid(cls, uid: str): async def get_all_damage_data_by_uid(cls, uid: str):
char_id_list, char_data_dict = await api_to_dict(sr_uid=uid) char_id_list, char_data_dict = await api_to_dict(uid=uid)
if isinstance(char_id_list, str): if isinstance(char_id_list, str):
raise MihomoRequestError raise MihomoRequestError

View File

@ -7,11 +7,11 @@ from starrail_damage_cal.damage.Base.model import (
DamageInstanceSkill, DamageInstanceSkill,
) )
from starrail_damage_cal.damage.Role import ( from starrail_damage_cal.damage.Role import (
break_damage,
calculate_damage, calculate_damage,
calculate_heal, calculate_heal,
calculate_shield, calculate_shield,
get_damage, get_damage,
break_damage,
) )
from starrail_damage_cal.logger import logger from starrail_damage_cal.logger import logger
@ -4371,6 +4371,7 @@ class Hanya(BaseAvatar):
return skill_info_list return skill_info_list
class DrRatio(BaseAvatar): class DrRatio(BaseAvatar):
Buff: BaseAvatarBuff Buff: BaseAvatarBuff
@ -4406,11 +4407,18 @@ class DrRatio(BaseAvatar):
if self.avatar_rank >= 1: if self.avatar_rank >= 1:
buff_num = 5 buff_num = 5
attribute_bonus["AttackAddedRatio"] = attribute_bonus.get("AttackAddedRatio",0) + ATK_ADD * buff_num attribute_bonus["AttackAddedRatio"] = (
attribute_bonus["CriticalChanceBase"] = attribute_bonus.get("CriticalChanceBase",0) + CC_ADD * buff_num attribute_bonus.get("AttackAddedRatio", 0) + ATK_ADD * buff_num
attribute_bonus["CriticalDamageBase"] = attribute_bonus.get("CriticalDamageBase",0) + CD_ADD * buff_num )
attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get("SpeedAddedRatio",0) + SPD_ADD * buff_num attribute_bonus["CriticalChanceBase"] = (
attribute_bonus.get("CriticalChanceBase", 0) + CC_ADD * buff_num
)
attribute_bonus["CriticalDamageBase"] = (
attribute_bonus.get("CriticalDamageBase", 0) + CD_ADD * buff_num
)
attribute_bonus["SpeedAddedRatio"] = (
attribute_bonus.get("SpeedAddedRatio", 0) + SPD_ADD * buff_num
)
damage1, damage2, damage3 = await calculate_damage( damage1, damage2, damage3 = await calculate_damage(
base_attr, base_attr,
@ -4494,6 +4502,7 @@ class DrRatio(BaseAvatar):
return skill_info_list return skill_info_list
class RuanMei(BaseAvatar): class RuanMei(BaseAvatar):
Buff: BaseAvatarBuff Buff: BaseAvatarBuff
@ -4524,10 +4533,15 @@ class RuanMei(BaseAvatar):
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
# 计算属性加成 # 计算属性加成
attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get("SpeedAddedRatio",0) + self.Skill_num("BPSkill", "BPSkill") attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get(
attribute_bonus["ResistancePenetration"] = attribute_bonus.get("ResistancePenetration",0) + self.Skill_num("Ultra", "Ultra_P") "SpeedAddedRatio", 0
attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + self.Skill_num("Talent", "Talent_A") ) + self.Skill_num("BPSkill", "BPSkill")
attribute_bonus["ResistancePenetration"] = attribute_bonus.get(
"ResistancePenetration", 0
) + self.Skill_num("Ultra", "Ultra_P")
attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get(
"AllDamageAddedRatio", 0
) + self.Skill_num("Talent", "Talent_A")
damage1, damage2, damage3 = await calculate_damage( damage1, damage2, damage3 = await calculate_damage(
base_attr, base_attr,
@ -4557,7 +4571,9 @@ class RuanMei(BaseAvatar):
# 计算终结技伤害 # 计算终结技伤害
skill_multiplier = self.Skill_num("Ultra", "Ultra") skill_multiplier = self.Skill_num("Ultra", "Ultra")
if self.avatar_rank >= 6: if self.avatar_rank >= 6:
break_damage_added_ratio_base = attribute_bonus.get("BreakDamageAddedRatioBase", 0) break_damage_added_ratio_base = attribute_bonus.get(
"BreakDamageAddedRatioBase", 0
)
if break_damage_added_ratio_base >= 1.8: if break_damage_added_ratio_base >= 1.8:
break_damage_added_ratio = break_damage_added_ratio_base - 1.8 break_damage_added_ratio = break_damage_added_ratio_base - 1.8
skill_multiplier_add = int((break_damage_added_ratio * 100) / 10) * 0.24 skill_multiplier_add = int((break_damage_added_ratio * 100) / 10) * 0.24
@ -4599,6 +4615,7 @@ class RuanMei(BaseAvatar):
return skill_info_list return skill_info_list
class AvatarDamage: class AvatarDamage:
@classmethod @classmethod
def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]): def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):

View File

@ -371,6 +371,7 @@ class Relic114(BaseRelicSetSkill):
attribute_bonus["SpeedAddedRatio"] = speed_added_ratio + 0.12000000011175871 attribute_bonus["SpeedAddedRatio"] = speed_added_ratio + 0.12000000011175871
return attribute_bonus return attribute_bonus
class Relic115(BaseRelicSetSkill): class Relic115(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -382,7 +383,7 @@ class Relic115(BaseRelicSetSkill):
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
"""追加攻击造成的伤害提高20%""" """追加攻击造成的伤害提高20%"""
"""每次造成伤害时使装备者的攻击力提高6%最多叠加8次持续3回合。该效果在装备者下一次施放追加攻击时移除。""" """每次造成伤害时使装备者的攻击力提高6%, 最多叠加8次, 持续3回合。该效果在装备者下一次施放追加攻击时移除。"""
logger.info("Relic114 check success") logger.info("Relic114 check success")
return True return True
@ -392,12 +393,17 @@ class Relic115(BaseRelicSetSkill):
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
if self.pieces2: 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): if self.pieces4 and await self.check(base_attr, attribute_bonus):
attack_added_ratio = attribute_bonus.get("AttackAddedRatio", 0) 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 return attribute_bonus
class Relic116(BaseRelicSetSkill): class Relic116(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -408,7 +414,7 @@ class Relic116(BaseRelicSetSkill):
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
"""敌方目标每承受1个持续伤害效果装备者对其造成伤害时就无视其6%的防御力,最多计入3个持续伤害效果。""" """敌方目标每承受1个持续伤害效果, 装备者对其造成伤害时就无视其6%的防御力, 最多计入3个持续伤害效果。"""
logger.info("Relic114 check success") logger.info("Relic114 check success")
return True return True
@ -422,6 +428,7 @@ class Relic116(BaseRelicSetSkill):
attribute_bonus["ignore_defence"] = ignore_defence + 0.06000000009313226 * 3 attribute_bonus["ignore_defence"] = ignore_defence + 0.06000000009313226 * 3
return attribute_bonus return attribute_bonus
class Relic301(BaseRelicSetSkill): class Relic301(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -711,6 +718,7 @@ class Relic310(BaseRelicSetSkill):
) )
return attribute_bonus return attribute_bonus
class Relic311(BaseRelicSetSkill): class Relic311(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -720,7 +728,7 @@ class Relic311(BaseRelicSetSkill):
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: 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) merged_attr = await merge_attribute(base_attr, attribute_bonus)
if merged_attr["speed"] >= 135: if merged_attr["speed"] >= 135:
logger.info("Relic306 check success") logger.info("Relic306 check success")
@ -734,14 +742,18 @@ class Relic311(BaseRelicSetSkill):
): ):
if self.pieces2 and await self.check(base_attr, attribute_bonus): if self.pieces2 and await self.check(base_attr, attribute_bonus):
merged_attr = await merge_attribute(base_attr, attribute_bonus) merged_attr = await merge_attribute(base_attr, attribute_bonus)
add_damage_base = 0
if merged_attr["speed"] >= 135: if merged_attr["speed"] >= 135:
add_damage_base = 0.12000000018626451 add_damage_base = 0.12000000018626451
if merged_attr["speed"] >= 160: if merged_attr["speed"] >= 160:
add_damage_base = 0.18000000018626451 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 return attribute_bonus
class Relic312(BaseRelicSetSkill): class Relic312(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -760,10 +772,13 @@ class Relic312(BaseRelicSetSkill):
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
if self.pieces2 and await self.check(base_attr, attribute_bonus): 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 return attribute_bonus
class RelicSet: class RelicSet:
HEAD: SingleRelic HEAD: SingleRelic
HAND: SingleRelic HAND: SingleRelic

View File

@ -52,6 +52,7 @@ async def calculate_shield(
return [defence_num] return [defence_num]
async def get_damage( async def get_damage(
damege: int, damege: int,
base_attr: Dict[str, float], base_attr: Dict[str, float],
@ -84,10 +85,17 @@ async def get_damage(
damage_qw = damege * skill_multiplier * injury_area * expected_damage damage_qw = damege * skill_multiplier * injury_area * expected_damage
damage_tz = damege * skill_multiplier * (injury_area + 2.626) * (critical_damage + 1.794) * 10 damage_tz = (
damege
* skill_multiplier
* (injury_area + 2.626)
* (critical_damage + 1.794)
* 10
)
return [damage_cd, damage_qw, damage_tz] return [damage_cd, damage_qw, damage_tz]
async def break_damage( async def break_damage(
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
@ -97,13 +105,13 @@ async def break_damage(
level: int, level: int,
): ):
break_element = { break_element = {
'Ice': 1, "Ice": 1,
'Imaginary': 1, "Imaginary": 1,
'Quantum': 1, "Quantum": 1,
'Thunder': 2, "Thunder": 2,
'Wind': 3, "Wind": 3,
'Physical': 4, "Physical": 4,
'Fire': 5, "Fire": 5,
} }
add_attr_bonus = copy.deepcopy(attribute_bonus) add_attr_bonus = copy.deepcopy(attribute_bonus)
@ -112,7 +120,7 @@ async def break_damage(
merged_attr = await merge_attribute(base_attr, add_attr_bonus) 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) damage_reduction = calculate_damage_reduction(level)
@ -129,10 +137,20 @@ async def break_damage(
break_damage = merged_attr.get("BreakDamageAddedRatioBase", 0) + 1 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] return [damage_cd]
async def calculate_damage( async def calculate_damage(
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],

View File

@ -2261,6 +2261,7 @@ class Mediation(BaseWeapon):
) )
return attribute_bonus return attribute_bonus
# 纯粹思维的洗礼 # 纯粹思维的洗礼
class BaptismofPureThought(BaseWeapon): class BaptismofPureThought(BaseWeapon):
weapon_base_attributes: Dict weapon_base_attributes: Dict
@ -2282,23 +2283,36 @@ class BaptismofPureThought(BaseWeapon):
critical_damage_base = attribute_bonus.get("CriticalDamageBase", 0) critical_damage_base = attribute_bonus.get("CriticalDamageBase", 0)
attribute_bonus["CriticalDamageBase"] = ( attribute_bonus["CriticalDamageBase"] = (
critical_damage_base critical_damage_base
+ (weapon_effect["23020"]["Param"]["CriticalDamageBase"][self.weapon_rank - 1]) + (
weapon_effect["23020"]["Param"]["CriticalDamageBase"][
self.weapon_rank - 1
]
)
* 3 * 3
) )
all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0) all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0)
attribute_bonus["AllDamageAddedRatio"] = ( attribute_bonus["AllDamageAddedRatio"] = (
all_damage_added_ratio 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("ignore_defence", 0) resistance_penetration = attribute_bonus.get("ignore_defence", 0)
attribute_bonus["ignore_defence"] = ( attribute_bonus["ignore_defence"] = (
resistance_penetration 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 return attribute_bonus
# 镜中故我 # 镜中故我
class PastSelfinMirror(BaseWeapon): class PastSelfinMirror(BaseWeapon):
weapon_base_attributes: Dict weapon_base_attributes: Dict
@ -2307,7 +2321,7 @@ class PastSelfinMirror(BaseWeapon):
super().__init__(weapon) super().__init__(weapon)
async def check(self): async def check(self):
# 当装备者施放战技后使我方全体造成的伤害提高15%使处于加速状态的我方目标的全属性穿透提高6%持续3回合。 # 当装备者施放战技后, 使我方全体造成的伤害提高15%, 使处于加速状态的我方目标的全属性穿透提高6%, 持续3回合。
return True return True
async def weapon_ability( async def weapon_ability(
@ -2320,16 +2334,25 @@ class PastSelfinMirror(BaseWeapon):
all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0) all_damage_added_ratio = attribute_bonus.get("AllDamageAddedRatio", 0)
attribute_bonus["AllDamageAddedRatio"] = ( attribute_bonus["AllDamageAddedRatio"] = (
all_damage_added_ratio all_damage_added_ratio
+ (weapon_effect["23019"]["Param"]["AllDamageAddedRatio"][self.weapon_rank - 1]) + (
weapon_effect["23019"]["Param"]["AllDamageAddedRatio"][
self.weapon_rank - 1
]
)
) )
resistance_penetration = attribute_bonus.get("ResistancePenetration", 0) resistance_penetration = attribute_bonus.get("ResistancePenetration", 0)
attribute_bonus["ResistancePenetration"] = ( attribute_bonus["ResistancePenetration"] = (
resistance_penetration resistance_penetration
+ (weapon_effect["23019"]["Param"]["ResistancePenetration"][self.weapon_rank - 1]) + (
weapon_effect["23019"]["Param"]["ResistancePenetration"][
self.weapon_rank - 1
]
)
) )
return attribute_bonus return attribute_bonus
class Weapon: class Weapon:
@classmethod @classmethod
def create(cls, weapon: DamageInstanceWeapon): def create(cls, weapon: DamageInstanceWeapon):