完成2.1角色伤害计算

This commit is contained in:
a376148946 2024-03-23 16:41:44 +08:00
parent 70a5d0f56f
commit dadeedd3e2
3 changed files with 353 additions and 0 deletions

View File

@ -5044,6 +5044,235 @@ class Acheron(BaseAvatar):
skill_info_list.append({"name": "终结技总伤", "damagelist": damagelist_u})
return skill_info_list
class Aventurine(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute: Dict[str, float] = {}
self.extra_ability_attribute: Dict[str, float] = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 1:
self.eidolon_attribute["CriticalDamageBase"] = 0.2
if self.avatar_rank >= 2:
self.eidolon_attribute["AllDamageResistancePenetration"] = 0.12
if self.avatar_rank >= 4:
self.eidolon_attribute["DefenceAddedRatio"] = 0.4
if self.avatar_rank >= 6:
self.eidolon_attribute["AllDamageAddedRatio"] = 1.5
def extra_ability(self):
pass
async def getdamage(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
# 天赋增加暴击
defence = base_attr["defence"] * (1 + attribute_bonus["DefenceAddedRatio"]) + attribute_bonus["DefenceDelta"]
if defence > 1600:
adddefrnce = defence - 1600
Critical_Chance_Base = (defence/100) * 0.02
Critical_Chance_Base = min(Critical_Chance_Base, 0.48)
attribute_bonus["CriticalChanceBase"] = attribute_bonus.get("CriticalChanceBase", 0) + Critical_Chance_Base
#终结技增加暴击伤害
attribute_bonus["CriticalDamageBase"] = attribute_bonus.get("CriticalDamageBase", 0) + self.Skill_num("Ultra", "Ultra_CD")
damage1, damage2, damage3 = await calculate_damage(
base_attr,
attribute_bonus,
"fujia",
"fujia",
"Thunder",
0.44,
self.avatar_level,
)
skill_info_list = []
# 计算普攻伤害
skill_multiplier = self.Skill_num("Normal", "Normal")
damagelist1 = await calculate_damage(
base_attr,
attribute_bonus,
"Normal",
"Normal",
self.avatar_element,
skill_multiplier,
self.avatar_level,
2,
)
damagelist1[2] += damage3
skill_info_list.append({"name": "普攻", "damagelist": damagelist1})
# 计算战技护盾
skill_multiplier = self.Skill_num("BPSkill", "BPSkill")
skill_num = self.Skill_num("BPSkill", "BPSkill_G")
damagelist2 = await calculate_shield(
base_attr,
attribute_bonus,
skill_multiplier,
skill_num,
)
skill_info_list.append({"name": "战技(护盾)", "damagelist": damagelist2})
# 计算终结技伤害
skill_multiplier = self.Skill_num("Ultra", "Ultra")
damagelist3 = await calculate_damage(
base_attr,
attribute_bonus,
"Ultra",
"Ultra",
self.avatar_element,
skill_multiplier,
self.avatar_level,
2,
)
damagelist3[2] += damage3
skill_info_list.append({"name": "终结技", "damagelist": damagelist3})
duanshu = 10
if self.avatar_rank >= 4:
duanshu = 13
damagelist5 = {}
# 计算天赋追加攻击伤害
skill_multiplier = self.Skill_num("Talent", "Talent")
damagelist4 = await calculate_damage(
base_attr,
attribute_bonus,
"Talent",
"Talent",
self.avatar_element,
skill_multiplier,
self.avatar_level,
2,
)
damagelist5[0] = damagelist4[0] * duanshu
damagelist5[1] = damagelist4[1] * duanshu
damagelist5[2] = damagelist4[2] * duanshu + damage3
damagelist4[2] += damage3
skill_info_list.append({"name": "单层【盲注】追击", "damagelist": damagelist4})
skill_info_list.append({"name": "满层【盲注】追击", "damagelist": damagelist5})
return skill_info_list
class Gallagher(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute: Dict[str, float] = {}
self.extra_ability_attribute: Dict[str, float] = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 6:
self.eidolon_attribute["BreakDamageAddedRatioBase"] = 0.2
def extra_ability(self):
pass
async def getdamage(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
# 使自身提供的治疗量提高提高数值等同于击破特攻的50%最多使提供的治疗量提高75%
Break_Damage_Added_Ratio_Base = attribute_bonus.get("BreakDamageAddedRatioBase", 0)
Heal_Ratio_Base = Break_Damage_Added_Ratio_Base * 0.5
Heal_Ratio_Base = min(0.75, Heal_Ratio_Base)
attribute_bonus["HealRatioBase"] = attribute_bonus.get("HealRatioBase", 0) + Heal_Ratio_Base
damage1, damage2, damage3 = await calculate_damage(
base_attr,
attribute_bonus,
"fujia",
"fujia",
"Thunder",
0.44,
self.avatar_level,
)
skill_info_list = []
# 计算普攻伤害
skill_multiplier = self.Skill_num("Normal", "Normal")
damagelist1 = await calculate_damage(
base_attr,
attribute_bonus,
"Normal",
"Normal",
self.avatar_element,
skill_multiplier,
self.avatar_level,
)
damagelist1[2] += damage3
skill_info_list.append({"name": "普攻", "damagelist": damagelist1})
# 计算强化普攻伤害
skill_multiplier = self.Skill_num("Normal", "Normal1")
damagelist2 = await calculate_damage(
base_attr,
attribute_bonus,
"Normal",
"Normal1",
self.avatar_element,
skill_multiplier,
self.avatar_level,
)
damagelist2[2] += damage3
skill_info_list.append({"name": "强化普攻", "damagelist": damagelist2})
# 计算战技治疗量
skill_num = self.Skill_num("BPSkill", "BPSkill")
damagelist3 = await calculate_heal(
base_attr,
attribute_bonus,
"BPSkill",
0,
skill_num,
)
skill_info_list.append({"name": "战技治疗量", "damagelist": damagelist3})
# 计算终结技伤害
skill_multiplier = self.Skill_num("Ultra", "Ultra")
damagelist4 = await calculate_damage(
base_attr,
attribute_bonus,
"Ultra",
"Ultra",
self.avatar_element,
skill_multiplier,
self.avatar_level,
)
damagelist4[2] += damage3
skill_info_list.append({"name": "结技", "damagelist": damagelist4})
# 计算天赋治疗量
skill_num = self.Skill_num("Talent", "Talent")
damagelist5 = await calculate_heal(
base_attr,
attribute_bonus,
"Talent",
0,
skill_num,
)
skill_info_list.append({"name": "天赋治疗量", "damagelist": damagelist5})
return skill_info_list
class AvatarDamage:
@classmethod
def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
@ -5055,6 +5284,10 @@ class AvatarDamage:
return Acheron(char, skills)
if char.id_ == 1303:
return RuanMei(char, skills)
if char.id_ == 1304:
return Aventurine(char, skills)
if char.id_ == 1301:
return Gallagher(char, skills)
if char.id_ == 1307:
return BlackSwan(char, skills)
if char.id_ == 1305:

View File

@ -1344,5 +1344,72 @@
],
"Maze": [20],
"Ultra_Use": [120]
},
"1304": {
"Normal": [
0.5000000004656613, 0.6000000005587935, 0.7000000006519258,
0.8000000007450581, 0.9000000008381903, 1.0000000000931323,
1.1000000000931323, 1.2000000001862645, 1.3000000002793968
],
"BPSkill": [
0.1600000001490116, 0.17000000015832484, 0.18000000016763806,
0.1900000001769513, 0.20000000018626451, 0.20799999963492155,
0.21599999978207052, 0.22399999992921948, 0.23200000007636845,
0.24000000022351742, 0.24799999967217445, 0.2559999998193234,
0.2639999999664724, 0.27200000011362135, 0.2800000002607703
],
"BPSkill_G": [
80, 128, 164, 200, 224, 248, 266, 284, 302, 320, 338, 356, 374, 392, 410
],
"Ultra": [
1.62000000057742, 1.7280000001192093, 1.8360000003594905,
1.9440000005997717, 2.0519999999087304, 2.1600000001490116,
2.294999999925494, 2.4300000004004687, 2.5650000001769513,
2.700000000651926, 2.808000000193715, 2.9160000004339963,
3.023999999742955, 3.131999999983236, 3.2400000002235174
],
"Ultra_CD": [
0.09000000008381903, 0.09599999967031181, 0.10199999995529652,
0.1079999995417893, 0.113999999826774, 0.12000000011175871,
0.12749999994412065, 0.13499999977648258, 0.14250000030733645,
0.1500000001396984, 0.15599999972619116, 0.16200000001117587,
0.16799999959766865, 0.17399999988265336, 0.18000000016763806
],
"Talent": [
0.12499999976716936, 0.13749999995343387, 0.1500000001396984,
0.1625000003259629, 0.17499999981373549, 0.1875,
0.20312500023283064, 0.2187500004656613, 0.23437500069849193,
0.25000000023283064, 0.26250000041909516, 0.27499999990686774,
0.28750000009313226, 0.3000000002793968, 0.3125000004656613
],
"Maze": [20],
"Ultra_Use": [120]
},
"1301": {
"Normal": [
0.5000000004656613, 0.6000000005587935, 0.7000000006519258,
0.8000000007450581, 0.9000000008381903, 1.0000000000931323,
1.1000000000931323, 1.2000000001862645, 1.3000000002793968
],
"Normal1": [
1.2500000002328306, 1.5000000004656613, 1.750000000698492,
2, 2.2500000002328306, 2.5000000004656613,
2.750000000698492, 3, 3.2500000002328306
],
"BPSkill": [
200, 340, 480, 676, 830, 984, 1138, 1292, 1446, 1600, 1684, 1768, 1852, 1936, 2020
],
"Ultra": [
0.7500000006984919, 0.8250000004190952, 0.9000000008381903,
0.9750000005587935, 1.0500000000465661, 1.1249999997671694,
1.2187500004656613, 1.3125000004656613, 1.4062500004656613,
1.5000000004656613, 1.5750000001862645, 1.6500000006053597,
1.725000000325963, 1.800000000745058, 1.8750000004656613
],
"Talent": [
80, 136, 192, 270, 332, 393, 455, 516, 578, 640, 673, 707, 740, 774, 808
],
"Maze": [20],
"Ultra_Use": [120]
}
}

View File

@ -829,6 +829,53 @@ class Relic312(BaseRelicSetSkill):
return attribute_bonus
class Relic313(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
"""当敌方目标被消灭时装备者暴击伤害提高4%最多叠加10层。"""
return True
async def set_skill_ability(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
if self.pieces2 and await self.check(base_attr, attribute_bonus):
attribute_bonus["CriticalDamageBase"] = (
attribute_bonus.get("CriticalDamageBase", 0) + (0.0400000000372529 * 10)
)
return attribute_bonus
class Relic314(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
"""若至少存在一名与装备者命途相同的队友装备者的暴击率提高12%"""
return True
async def set_skill_ability(
self,
base_attr: Dict[str, float],
attribute_bonus: Dict[str, float],
):
if self.pieces2 and await self.check(base_attr, attribute_bonus):
attribute_bonus["CriticalChanceBase"] = (
attribute_bonus.get("CriticalChanceBase", 0) + 0.12000000011175871
)
return attribute_bonus
class RelicSet:
HEAD: SingleRelic
@ -871,6 +918,8 @@ class RelicSet:
Relic310,
Relic311,
Relic312,
Relic313,
Relic314,
]
]
@ -971,6 +1020,10 @@ class RelicSet:
self.SetSkill.append(Relic311(set_id, count))
elif set_id == 312:
self.SetSkill.append(Relic312(set_id, count))
elif set_id == 313:
self.SetSkill.append(Relic313(set_id, count))
elif set_id == 314:
self.SetSkill.append(Relic314(set_id, count))
else:
msg = f"Unknow SetId: {set_id}"
raise ValueError(msg)