bump to 1.2.0

This commit is contained in:
qwerdvd 2023-12-16 12:30:35 +08:00
parent a49a18d459
commit 47beeedf75
No known key found for this signature in database
GPG Key ID: A3AF89C783404769
5 changed files with 123 additions and 57 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "starrail_damage_cal" name = "starrail_damage_cal"
version = "1.1.0" version = "1.2.0"
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

@ -7,11 +7,10 @@ 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,
break_damage,
) )
from starrail_damage_cal.logger import logger from starrail_damage_cal.logger import logger
@ -4371,6 +4370,7 @@ class Hanya(BaseAvatar):
return skill_info_list return skill_info_list
class DrRatio(BaseAvatar): class DrRatio(BaseAvatar):
Buff: BaseAvatarBuff Buff: BaseAvatarBuff
@ -4401,8 +4401,6 @@ class DrRatio(BaseAvatar):
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
damage1, damage2, damage3 = await calculate_damage( damage1, damage2, damage3 = await calculate_damage(
base_attr, base_attr,
attribute_bonus, attribute_bonus,
@ -4455,7 +4453,7 @@ class DrRatio(BaseAvatar):
) )
damagelist3[2] += damage3 damagelist3[2] += damage3
skill_info_list.append({"name": "终结技", "damagelist": damagelist3}) skill_info_list.append({"name": "终结技", "damagelist": damagelist3})
# 计算天赋追伤伤害 # 计算天赋追伤伤害
skill_multiplier = self.Skill_num("Talent", "Talent") skill_multiplier = self.Skill_num("Talent", "Talent")
damagelist4 = await calculate_damage( damagelist4 = await calculate_damage(
@ -4485,6 +4483,7 @@ class DrRatio(BaseAvatar):
return skill_info_list return skill_info_list
class RuanMei(BaseAvatar): class RuanMei(BaseAvatar):
Buff: BaseAvatarBuff Buff: BaseAvatarBuff
@ -4515,17 +4514,28 @@ class RuanMei(BaseAvatar):
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
# 计算属性加成 # 计算属性加成
attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + self.Skill_num("BPSkill", "BPSkill") attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get(
attribute_bonus["BreakDamageAddedRatioBase"] = attribute_bonus.get("BreakDamageAddedRatioBase",0) + 0.5 "AllDamageAddedRatio", 0
attribute_bonus["ResistancePenetration"] = attribute_bonus.get("ResistancePenetration",0) + self.Skill_num("Ultra", "Ultra_P") ) + self.Skill_num("BPSkill", "BPSkill")
attribute_bonus["SpeedAddedRatio"] = attribute_bonus.get("SpeedAddedRatio",0) + self.Skill_num("Talent", "Talent_S") attribute_bonus["BreakDamageAddedRatioBase"] = (
attribute_bonus.get("BreakDamageAddedRatioBase", 0) + 0.5
#战斗中阮•梅的击破特攻大于120%时每超过10%则战技使我方全体伤害提高的效果额外提高6%最高不超过36%。 )
Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase",0) 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: 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 = ((Break_Damage_Added_Ratio - 1.2) / 0.1) * 0.06
add_all_damage_added_ratio = min(0.36,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 attribute_bonus["AllDamageAddedRatio"] = (
attribute_bonus.get("AllDamageAddedRatio", 0)
+ add_all_damage_added_ratio
)
damage1, damage2, damage3 = await calculate_damage( damage1, damage2, damage3 = await calculate_damage(
base_attr, base_attr,
@ -4564,7 +4574,7 @@ class RuanMei(BaseAvatar):
) )
jipodamage1[0] = jipodamage1[0] * skill_multiplier jipodamage1[0] = jipodamage1[0] * skill_multiplier
skill_info_list.append({"name": "残梅绽附加伤害", "damagelist": jipodamage1}) skill_info_list.append({"name": "残梅绽附加伤害", "damagelist": jipodamage1})
# 计算天赋追伤伤害 # 计算天赋追伤伤害
skill_multiplier = self.Skill_num("Talent", "Talent") skill_multiplier = self.Skill_num("Talent", "Talent")
if self.avatar_rank >= 6: if self.avatar_rank >= 6:
@ -4582,6 +4592,7 @@ class RuanMei(BaseAvatar):
return skill_info_list return skill_info_list
class XueYi(BaseAvatar): class XueYi(BaseAvatar):
Buff: BaseAvatarBuff Buff: BaseAvatarBuff
@ -4602,17 +4613,21 @@ class XueYi(BaseAvatar):
self.eidolon_attribute["BreakDamageAddedRatioBase"] = 0.4 self.eidolon_attribute["BreakDamageAddedRatioBase"] = 0.4
def extra_ability(self): 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( async def getdamage(
self, self,
base_attr: Dict[str, float], base_attr: Dict[str, float],
attribute_bonus: Dict[str, float], attribute_bonus: Dict[str, float],
): ):
#使自身造成的伤害提高提高数值等同于击破特攻的100%最多使造成的伤害提高240%。 # 使自身造成的伤害提高, 提高数值等同于击破特攻的100%, 最多使造成的伤害提高240%。
Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase",0) Break_Damage_Added_Ratio = attribute_bonus.get("BreakDamageAddedRatioBase", 0)
attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get("AllDamageAddedRatio",0) + min(2.4,Break_Damage_Added_Ratio) attribute_bonus["AllDamageAddedRatio"] = attribute_bonus.get(
"AllDamageAddedRatio", 0
) + min(2.4, Break_Damage_Added_Ratio)
damage1, damage2, damage3 = await calculate_damage( damage1, damage2, damage3 = await calculate_damage(
base_attr, base_attr,
attribute_bonus, attribute_bonus,
@ -4665,7 +4680,7 @@ class XueYi(BaseAvatar):
) )
damagelist3[2] += damage3 damagelist3[2] += damage3
skill_info_list.append({"name": "终结技", "damagelist": damagelist3}) skill_info_list.append({"name": "终结技", "damagelist": damagelist3})
# 计算天赋追伤伤害 # 计算天赋追伤伤害
skill_multiplier = self.Skill_num("Talent", "Talent") skill_multiplier = self.Skill_num("Talent", "Talent")
damagelist4 = await calculate_damage( damagelist4 = await calculate_damage(
@ -4684,6 +4699,7 @@ class XueYi(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)
@ -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)
@ -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")
@ -733,15 +741,19 @@ class Relic311(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):
add_damage_base = 0
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:
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],
@ -66,7 +67,7 @@ async def get_damage(
add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type) add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type)
merged_attr = await merge_attribute(base_attr, add_attr_bonus) merged_attr = await merge_attribute(base_attr, add_attr_bonus)
injury_area, element_area = calculate_injury_area( injury_area, element_area = calculate_injury_area(
merged_attr, merged_attr,
skill_type, skill_type,
@ -81,13 +82,14 @@ async def get_damage(
expected_damage = calculate_expected_damage(critical_chance, critical_damage) expected_damage = calculate_expected_damage(critical_chance, critical_damage)
damage_cd = damege * skill_multiplier * injury_area damage_cd = damege * skill_multiplier * injury_area
damage_qw = damege * skill_multiplier * injury_area damage_qw = damege * skill_multiplier * injury_area
damage_tz = damege * skill_multiplier * (injury_area + 2.626) * 10 damage_tz = damege * skill_multiplier * (injury_area + 2.626) * 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,23 +99,23 @@ 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)
add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type) add_attr_bonus = apply_attribute_bonus(add_attr_bonus, skill_type, add_skill_type)
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)
resistance_area = calculate_resistance_area( resistance_area = calculate_resistance_area(
@ -123,16 +125,28 @@ async def break_damage(
element, 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) damage_ratio = calculate_damage_ratio(merged_attr, skill_type, add_skill_type)
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],
@ -165,7 +179,9 @@ async def calculate_damage(
element, 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( injury_area, element_area = calculate_injury_area(
merged_attr, merged_attr,

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
@ -2269,7 +2270,7 @@ class BaptismofPureThought(BaseWeapon):
super().__init__(weapon) super().__init__(weapon)
async def check(self): async def check(self):
# 敌方目标每承受1个负面效果装备者对其造成的暴击伤害额外提高8%最多叠加3层。施放终结技攻击敌方目标时使装备者获得【论辩】效果造成的伤害提高36%追加攻击无视目标24%的防御力,该效果持续2回合。 # 敌方目标每承受1个负面效果, 装备者对其造成的暴击伤害额外提高8%, 最多叠加3层。施放终结技攻击敌方目标时, 使装备者获得【论辩】效果, 造成的伤害提高36%, 追加攻击无视目标24%的防御力, 该效果持续2回合。
return True return True
async def weapon_ability( async def weapon_ability(
@ -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("Talentignore_defence", 0) resistance_penetration = attribute_bonus.get("Talentignore_defence", 0)
attribute_bonus["Talentignore_defence"] = ( attribute_bonus["Talentignore_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):
# 装备者施放终结技后使我方全体造成的伤害提高40%持续3回合 # 装备者施放终结技后, 使我方全体造成的伤害提高40%, 持续3回合
return True return True
async def weapon_ability( async def weapon_ability(
@ -2320,10 +2334,15 @@ 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
]
)
) )
return attribute_bonus return attribute_bonus
class Weapon: class Weapon:
@classmethod @classmethod
def create(cls, weapon: DamageInstanceWeapon): def create(cls, weapon: DamageInstanceWeapon):