From fec83e38d5a6b7a5c7fb139460cf2942331d1f52 Mon Sep 17 00:00:00 2001 From: a376148946 <376148946@qq.com> Date: Thu, 5 Oct 2023 13:28:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BC=A4=E5=AE=B3=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StarRailUID/starrailuid_charinfo/__init__.py | 40 +- .../starrailuid_charinfo/cal_damage.py | 7 + .../starrailuid_charinfo/damage/Avatar.py | 152 ++ .../damage/AvatarDamage/AvatarDamage.py | 214 ++ .../damage/AvatarDamage/__init__.py | 0 .../damage/Base/AvatarBase.py | 171 ++ .../damage/Base/RelicBase.py | 93 + .../damage/Base/SkillBase.py | 45 + .../damage/Base/WeaponBase.py | 78 + .../starrailuid_charinfo/damage/Base/model.py | 103 + .../damage/Excel/SkillData.json | 695 ++++++ .../damage/Excel/weapon_effect.json | 469 ++++ .../damage/Relic/Relic.py | 744 +++++++ .../damage/Relic/__init__.py | 0 .../starrailuid_charinfo/damage/Role.py | 258 +++ .../damage/Weapon/Weapon.py | 1931 +++++++++++++++++ .../damage/Weapon/__init__.py | 0 .../starrailuid_charinfo/damage/__init__.py | 0 .../starrailuid_charinfo/damage/utils.py | 65 + .../starrailuid_charinfo/effect/Role.py | 2 +- 20 files changed, 5031 insertions(+), 36 deletions(-) create mode 100644 StarRailUID/starrailuid_charinfo/damage/Avatar.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/AvatarDamage/AvatarDamage.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/AvatarDamage/__init__.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Base/AvatarBase.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Base/RelicBase.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Base/SkillBase.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Base/WeaponBase.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Base/model.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Excel/SkillData.json create mode 100644 StarRailUID/starrailuid_charinfo/damage/Excel/weapon_effect.json create mode 100644 StarRailUID/starrailuid_charinfo/damage/Relic/Relic.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Relic/__init__.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Role.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Weapon/Weapon.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/Weapon/__init__.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/__init__.py create mode 100644 StarRailUID/starrailuid_charinfo/damage/utils.py diff --git a/StarRailUID/starrailuid_charinfo/__init__.py b/StarRailUID/starrailuid_charinfo/__init__.py index 1b231d3..93f6634 100644 --- a/StarRailUID/starrailuid_charinfo/__init__.py +++ b/StarRailUID/starrailuid_charinfo/__init__.py @@ -13,44 +13,14 @@ from ..utils.sr_prefix import PREFIX from ..utils.error_reply import UID_HINT from .get_char_img import draw_char_info_img from ..utils.image.convert import convert_img -from .draw_char_img import cal, get_char_data +from .draw_char_img import get_char_data +from .cal_damage import cal_info from ..utils.resource.RESOURCE_PATH import TEMP_PATH sv_char_info_config = SV('sr面板设置', pm=2) sv_get_char_info = SV('sr面板查询', priority=10) sv_get_sr_original_pic = SV('sr查看面板原图', priority=5) sv_char_damage_cal = SV('sr伤害计算') -sv_group_damage_cal = SV('sr伤害计算') - - -@sv_group_damage_cal.on_prefix(f'{PREFIX}队伍伤害') -async def send_group_damage_msg(bot: Bot, ev: Event): - msg = ''.join(re.findall('[\u4e00-\u9fa5 ]', ev.text)) - if not msg: - return None - await bot.logger.info('开始执行[队伍伤害计算]') - # 获取uid - sr_uid = await get_uid(bot, ev) - if sr_uid is None: - return await bot.send(UID_HINT) - await bot.logger.info(f'[队伍伤害计算]uid: {sr_uid}') - char_name = ' '.join(re.findall('[\u4e00-\u9fa5]+', msg)) - char_list = char_name.split() - char_data_list = [] - for char_name in char_list: - char_data = await get_char_data(sr_uid, char_name) - if isinstance(char_data, str): - return await bot.send(char_data) - char_data_list.append(char_data) - im_list = [] - # im = await cal_group(char_data_list) - # for info_im in im: - # con = f'{info_im[0]} 暴击伤害: {info_im[1]}' - # con = f'{con} 期望伤害{info_im[2]} 满配辅助末日兽伤害{info_im[3]}' - # im_list.append(con) - await bot.send(im_list) - return None - @sv_char_damage_cal.on_prefix(f'{PREFIX}伤害计算') async def send_damage_msg(bot: Bot, ev: Event): @@ -69,10 +39,10 @@ async def send_damage_msg(bot: Bot, ev: Event): if isinstance(char_data, str): return await bot.send(char_data) im_list = [] - im = await cal(char_data) + im = await cal_info(char_data) for info_im in im: - con = f'{info_im[0]} 暴击伤害: {info_im[1]}' - con = f'{con} 期望伤害{info_im[2]} 满配辅助末日兽伤害{info_im[3]}' + con = f"{info_im['name']}" + con = f"{con} 暴击伤害{info_im['damagelist'][0]} 期望伤害{info_im['damagelist'][1]} 满配辅助末日兽伤害{info_im['damagelist'][2]}" im_list.append(con) await bot.send(im_list) return None diff --git a/StarRailUID/starrailuid_charinfo/cal_damage.py b/StarRailUID/starrailuid_charinfo/cal_damage.py index 2976008..3516b76 100644 --- a/StarRailUID/starrailuid_charinfo/cal_damage.py +++ b/StarRailUID/starrailuid_charinfo/cal_damage.py @@ -4,6 +4,7 @@ from typing import Dict, List, Union from .effect.Role import RoleInstance from .mono.Character import Character +from .damage.Avatar import AvatarInstance Excel_path = Path(__file__).parent / 'effect' with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f: @@ -31,3 +32,9 @@ async def cal(char_data: Dict): skill_info_list.append(im_tmp) return skill_info_list return '角色伤害计算未完成' + +async def cal_info(char_data: Dict): + char = await cal_char_info(char_data) + avatar = AvatarInstance(char) + skill_info_list = await avatar.gat_damage() + return skill_info_list \ No newline at end of file diff --git a/StarRailUID/starrailuid_charinfo/damage/Avatar.py b/StarRailUID/starrailuid_charinfo/damage/Avatar.py new file mode 100644 index 0000000..a3c35b7 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Avatar.py @@ -0,0 +1,152 @@ +import json +from pathlib import Path +from typing import List, Union + +from gsuid_core.logger import logger + +from .Base.AvatarBase import BaseAvatarinfo +from .AvatarDamage.AvatarDamage import AvatarDamage +from .Weapon.Weapon import Weapon +from .utils import merge_attribute +from ..mono.Character import Character +from .Base.model import DamageInstance +from .Relic.Relic import RelicSet, SingleRelic + +Excel_path = Path(__file__).parent +with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f: + skill_dict = json.load(f) + + +class AvatarInstance: + def __init__(self, raw_data: Character): + self.raw_data = DamageInstance(raw_data) + self.avatardamage = AvatarDamage.create(self.raw_data.avatar, self.raw_data.skill) + self.avatar = BaseAvatarinfo(self.raw_data.avatar) + self.weapon = Weapon.create(self.raw_data.weapon) + self.relic_set = RelicSet().create(self.raw_data.relic) + + self.base_attr = self.cal_role_base_attr() + self.attribute_bonus: dict[str, float] = {} + + self.cal_relic_attr_add() + self.cal_avatar_attr_add() + self.cal_avatar_eidolon_add() + self.cal_weapon_attr_add() + + def cal_role_base_attr(self): + logger.info('cal_role_base_attr') + base_attr: dict[str, float] = {} + avatar_attribute = self.avatar.avatar_attribute + for attr_name, attr_value in avatar_attribute.items(): + if attr_name in base_attr: + base_attr[attr_name] += attr_value + else: + base_attr[attr_name] = attr_value + + weapon_attribute = self.weapon.weapon_base_attribute + for attr_name, attr_value in weapon_attribute.items(): + if attr_name in base_attr: + base_attr[attr_name] += attr_value + else: + base_attr[attr_name] = attr_value + return base_attr + + def cal_relic_attr_add(self): + # 单件属性 + for relic_type in self.relic_set.__dict__: + if type(self.relic_set.__dict__[relic_type]) == SingleRelic: + relic: SingleRelic = self.relic_set.__dict__[relic_type] + for attribute in relic.relic_attribute_bonus: + if attribute in self.attribute_bonus: + self.attribute_bonus[ + attribute + ] += relic.relic_attribute_bonus[attribute] + else: + self.attribute_bonus[ + attribute + ] = relic.relic_attribute_bonus[attribute] + + # 套装面板加成属性 + for set_skill in self.relic_set.SetSkill: + for attribute in set_skill.relicSetAttribute: + if attribute in self.attribute_bonus: + self.attribute_bonus[ + attribute + ] += set_skill.relicSetAttribute[attribute] + else: + self.attribute_bonus[ + attribute + ] = set_skill.relicSetAttribute[attribute] + + def cal_avatar_eidolon_add(self): + for attribute in self.avatardamage.eidolon_attribute: + if attribute in self.attribute_bonus: + self.attribute_bonus[ + attribute + ] += self.avatardamage.eidolon_attribute[attribute] + else: + self.attribute_bonus[ + attribute + ] = self.avatardamage.eidolon_attribute[attribute] + for attribute in self.avatardamage.extra_ability_attribute: + if attribute in self.attribute_bonus: + self.attribute_bonus[ + attribute + ] += self.avatardamage.extra_ability_attribute[attribute] + else: + self.attribute_bonus[ + attribute + ] = self.avatardamage.extra_ability_attribute[attribute] + + def cal_avatar_attr_add(self): + attribute_bonus = self.avatar.avatar_attribute_bonus + if attribute_bonus: + for bonus in attribute_bonus: + status_add = bonus.statusAdd + bonus_property = status_add.property + value = status_add.value + if bonus_property in self.attribute_bonus: + self.attribute_bonus[bonus_property] += value + else: + self.attribute_bonus[bonus_property] = value + + def cal_weapon_attr_add(self): + for attribute in self.weapon.weapon_attribute: + if attribute in self.attribute_bonus: + self.attribute_bonus[ + attribute + ] += self.weapon.weapon_attribute[attribute] + else: + self.attribute_bonus[attribute] = self.weapon.weapon_attribute[ + attribute + ] + + async def gat_damage(self): + logger.info('base_attr') + logger.info(self.base_attr) + logger.info('attribute_bonus') + logger.info(self.attribute_bonus) + + logger.info('检查武器战斗生效的buff') + Ultra_Use = self.avatar.Ultra_Use() + logger.info('Ultra_Use') + logger.info(Ultra_Use) + self.attribute_bonus = await self.weapon.weapon_ability( + Ultra_Use, self.base_attr, self.attribute_bonus + ) + logger.info(self.attribute_bonus) + logger.info('检查遗器套装战斗生效的buff') + for set_skill in self.relic_set.SetSkill: + self.attribute_bonus = await set_skill.set_skill_ability( + self.base_attr, self.attribute_bonus + ) + if self.attribute_bonus is None: + raise Exception('attribute_bonus is None') + logger.info(self.attribute_bonus) + + return await self.avatardamage.getdamage(self.base_attr, self.attribute_bonus) + + + + + \ No newline at end of file diff --git a/StarRailUID/starrailuid_charinfo/damage/AvatarDamage/AvatarDamage.py b/StarRailUID/starrailuid_charinfo/damage/AvatarDamage/AvatarDamage.py new file mode 100644 index 0000000..2067c1e --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/AvatarDamage/AvatarDamage.py @@ -0,0 +1,214 @@ +from typing import Dict, List +import json +from pathlib import Path +import copy +from gsuid_core.logger import logger +from ..Base.model import DamageInstanceSkill, DamageInstanceAvatar +from ..Base.AvatarBase import BaseAvatar, BaseAvatarBuff +from ..Role import demage_num + +class Seele(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 < 2: + self.eidolon_attribute['SpeedAddedRatio'] = 0.25 + if self.avatar_rank >= 1: + self.eidolon_attribute['CriticalChanceBase'] = 0.15 + if self.avatar_rank >= 2: + self.eidolon_attribute['SpeedAddedRatio'] = 0.5 + + def extra_ability(self): + # 额外能力 割裂 抗性穿透提高20 + self.extra_ability_attribute['QuantumResistancePenetration'] = 0.2 + + async def getdamage( + self, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + # logger.info(base_attr) + # logger.info(self.avatar_rank) + + # 希尔天赋再现加伤害 + attribute_bonus['AllDamageAddedRatio'] = self.Skill_num('Talent', 'Talent') + attribute_bonus.get('AllDamageAddedRatio', 0) + + + skill_info_list = [] + # 计算普攻伤害 + skill_multiplier = self.Skill_num('Normal', 'Normal') + damagelist1 = await demage_num(base_attr, attribute_bonus, 'Normal', 'Normal', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'普攻', 'damagelist': damagelist1}) + + # 计算战技伤害 + skill_multiplier = self.Skill_num('BPSkill', 'BPSkill') + damagelist2 = await demage_num(base_attr, attribute_bonus, 'BPSkill', 'BPSkill', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'战技', 'damagelist': damagelist2}) + + # 计算大招伤害 + skill_multiplier = self.Skill_num('Ultra', 'Ultra') + damagelist3 = await demage_num(base_attr, attribute_bonus, 'Ultra', 'Ultra', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'终结技', 'damagelist': damagelist3}) + + # 银狼降防终结技伤害 + skill_multiplier = self.Skill_num('Ultra', 'Ultra') + add_attr_bonus = copy.deepcopy(attribute_bonus) + add_attr_bonus['ignore_defence'] = 0.45 + add_attr_bonus.get('ignore_defence', 0) + damagelist4 = await demage_num(base_attr, add_attr_bonus, 'Ultra', 'Ultra', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'银狼降防终结技', 'damagelist': damagelist4}) + + logger.info(skill_info_list) + return skill_info_list + +class JingYuan(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 >= 2: + self.eidolon_attribute['NormalDmgAdd'] = 0.2 + self.eidolon_attribute['BPSkillDmgAdd'] = 0.2 + self.eidolon_attribute['UltraDmgAdd'] = 0.2 + if self.avatar_rank >= 6: + self.eidolon_attribute['Talent_DmgRatio'] = 0.288 + + def extra_ability(self): + logger.info('额外能力') + logger.info('【神君】下回合的攻击段数大于等于6段, 则其下回合的暴击伤害提高25%。') + self.extra_ability_attribute['CriticalDamageBase'] = 0.25 + logger.info('施放战技后, 暴击率提升10%') + self.extra_ability_attribute['CriticalChanceBase'] = 0.1 + + async def getdamage( + self, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + skill_info_list = [] + # 计算普攻伤害 + skill_multiplier = self.Skill_num('Normal', 'Normal') + damagelist1 = await demage_num(base_attr, attribute_bonus, 'Normal', 'Normal', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'普攻', 'damagelist': damagelist1}) + + # 计算战技伤害 + skill_multiplier = self.Skill_num('BPSkill', 'BPSkill') + damagelist2 = await demage_num(base_attr, attribute_bonus, 'BPSkill', 'BPSkill', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'战技', 'damagelist': damagelist2}) + + # 计算大招伤害 + skill_multiplier = self.Skill_num('Ultra', 'Ultra') + damagelist3 = await demage_num(base_attr, attribute_bonus, 'Ultra', 'Ultra', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'终结技', 'damagelist': damagelist3}) + + # 神君 + skill_multiplier = self.Skill_num('Talent', 'Talent') + damagelist4 = await demage_num(base_attr, attribute_bonus, 'Talent', 'Talent', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'10层神君伤害', 'damagelist': damagelist4}) + + logger.info(skill_info_list) + return skill_info_list + +class Welt(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): + pass + + def extra_ability(self): + logger.info('额外能力') + logger.info('施放终结技时, 有100%基础概率使目标受到的伤害提高12%, 持续2回合。') + self.extra_ability_attribute['DmgRatio'] = 0.12 + logger.info('对被弱点击破的敌方目标造成的伤害提高20') + self.extra_ability_attribute['AllDamageAddedRatio'] = 0.20 + + async def getdamage( + self, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + skill_info_list = [] + # 计算普攻伤害 + skill_multiplier = self.Skill_num('Normal', 'Normal') + damagelist1 = await demage_num(base_attr, attribute_bonus, 'Normal', 'Normal', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'普攻', 'damagelist': damagelist1}) + + # 计算战技伤害 + attnum = 3 + skill_multiplier = self.Skill_num('BPSkill', 'BPSkill') / attnum + damagelist2 = await demage_num(base_attr, attribute_bonus, 'BPSkill', 'BPSkill', self.avatar_element, skill_multiplier, self.avatar_level) + if self.avatar_rank >= 6: + attnum = 4 + damagelist2[0] = damagelist2[0] * attnum + damagelist2[1] = damagelist2[1] * attnum + damagelist2[2] = damagelist2[2] * attnum + skill_info_list.append({'name':'战技', 'damagelist': damagelist2}) + + # 计算大招伤害 + skill_multiplier = self.Skill_num('Ultra', 'Ultra') + damagelist3 = await demage_num(base_attr, attribute_bonus, 'Ultra', 'Ultra', self.avatar_element, skill_multiplier, self.avatar_level) + skill_info_list.append({'name':'终结技', 'damagelist': damagelist3}) + + if self.avatar_rank >= 1: + skill_multiplier = self.Skill_num('Normal', 'Normal') * 0.5 + damagelist4 = await demage_num(base_attr, attribute_bonus, 'Normal', 'Normal', self.avatar_element, skill_multiplier, self.avatar_level) + damagelist4[0] = damagelist1[0] + damagelist4[0] + damagelist4[1] = damagelist1[1] + damagelist4[1] + damagelist4[2] = damagelist1[2] + damagelist4[2] + skill_info_list.append({'name':'强化普攻', 'damagelist': damagelist4}) + + skill_multiplier = (self.Skill_num('BPSkill', 'BPSkill') / 3) * 0.8 + damagelist5 = await demage_num(base_attr, attribute_bonus, 'BPSkill', 'BPSkill', self.avatar_element, skill_multiplier, self.avatar_level) + damagelist5[0] = damagelist2[0] + damagelist5[0] + damagelist5[1] = damagelist2[1] + damagelist5[1] + damagelist5[2] = damagelist2[2] + damagelist5[2] + skill_info_list.append({'name':'强化战技', 'damagelist': damagelist5}) + + logger.info(skill_info_list) + return skill_info_list + +class AvatarDamage: + @classmethod + def create( + cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill] + ): + if char.id_ == 1102: + return Seele(char, skills) + if char.id_ == 1204: + return JingYuan(char, skills) + if char.id_ == 1004: + return Welt(char, skills) + raise Exception('不支持的角色') diff --git a/StarRailUID/starrailuid_charinfo/damage/AvatarDamage/__init__.py b/StarRailUID/starrailuid_charinfo/damage/AvatarDamage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/StarRailUID/starrailuid_charinfo/damage/Base/AvatarBase.py b/StarRailUID/starrailuid_charinfo/damage/Base/AvatarBase.py new file mode 100644 index 0000000..4a15d85 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Base/AvatarBase.py @@ -0,0 +1,171 @@ +import json +from pathlib import Path +from abc import abstractmethod +from typing import List, Union + +import msgspec +from msgspec import Struct + +from .SkillBase import BaseSkills +from ....utils.excel.model import AvatarPromotionConfig +from .model import DamageInstanceSkill, DamageInstanceAvatar + +path = Path(__file__).parent.parent +with Path.open(path / 'Excel' / 'SkillData.json', encoding='utf-8') as f: + skill_dict = json.load(f) + + +class BaseAvatarAttribute(Struct): + attack: float + defence: float + hp: float + speed: float + CriticalChanceBase: float + CriticalDamageBase: float + BaseAggro: float + + def items(self): + return [ + ('attack', self.attack), + ('defence', self.defence), + ('hp', self.hp), + ('speed', self.speed), + ('CriticalChanceBase', self.CriticalChanceBase), + ('CriticalDamageBase', self.CriticalDamageBase), + ('BaseAggro', self.BaseAggro), + ] + + +class BaseAvatarBuff: + @classmethod + def create( + cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill] + ): + cls.extra_ability_id = [] + if char.extra_ability: + for extra_ability in char.extra_ability: + cls.extra_ability_id.append(extra_ability['extraAbilityId']) + return cls + + @abstractmethod + async def Technique(self): + ... + + @abstractmethod + async def eidolons(self): + ... + + @abstractmethod + async def extra_ability(self): + ... + +class BaseAvatarinfo: + def __init__( + self, char: DamageInstanceAvatar + ): + self.avatar_id = char.id_ + self.avatar_level = char.level + self.avatar_rank = char.rank + self.avatar_element = char.element + self.avatar_promotion = char.promotion + self.avatar_attribute_bonus = char.attribute_bonus + self.avatar_extra_ability = char.extra_ability + self.avatar_attribute = self.get_attribute() + + def get_attribute(self): + promotion = AvatarPromotionConfig.Avatar[str(self.avatar_id)][ + str(self.avatar_promotion) + ] + + return BaseAvatarAttribute( + # 攻击力 + attack=( + promotion.AttackBase.Value + + promotion.AttackAdd.Value * (self.avatar_level - 1) + ), + # 防御力 + defence=( + promotion.DefenceBase.Value + + promotion.DefenceAdd.Value * (self.avatar_level - 1) + ), + # 血量 + hp=( + promotion.HPBase.Value + + promotion.HPAdd.Value * (self.avatar_level - 1) + ), + # 速度 + speed=promotion.SpeedBase.Value, + # 暴击率 + CriticalChanceBase=promotion.CriticalChance.Value, + # 暴击伤害 + CriticalDamageBase=promotion.CriticalDamage.Value, + # 嘲讽 + BaseAggro=promotion.BaseAggro.Value, + ) + + def Ultra_Use(self): + skill_info = skill_dict[str(self.avatar_id)]['Ultra_Use'][0] + return msgspec.convert(skill_info, type=float) + +class BaseAvatar: + def __init__( + self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill] + ): + self.Skill = BaseSkills.create(char=char, skills=skills) + self.Buff = BaseAvatarBuff.create(char=char, skills=skills) + self.avatar_id = char.id_ + self.avatar_level = char.level + self.avatar_rank = char.rank + self.avatar_element = char.element + self.avatar_promotion = char.promotion + self.avatar_attribute_bonus = char.attribute_bonus + self.avatar_extra_ability = char.extra_ability + self.avatar_attribute = self.get_attribute() + + def get_attribute(self): + promotion = AvatarPromotionConfig.Avatar[str(self.avatar_id)][ + str(self.avatar_promotion) + ] + + return BaseAvatarAttribute( + # 攻击力 + attack=( + promotion.AttackBase.Value + + promotion.AttackAdd.Value * (self.avatar_level - 1) + ), + # 防御力 + defence=( + promotion.DefenceBase.Value + + promotion.DefenceAdd.Value * (self.avatar_level - 1) + ), + # 血量 + hp=( + promotion.HPBase.Value + + promotion.HPAdd.Value * (self.avatar_level - 1) + ), + # 速度 + speed=promotion.SpeedBase.Value, + # 暴击率 + CriticalChanceBase=promotion.CriticalChance.Value, + # 暴击伤害 + CriticalDamageBase=promotion.CriticalDamage.Value, + # 嘲讽 + BaseAggro=promotion.BaseAggro.Value, + ) + + def Skill_Info(self, skill_type: str): + skill_info = skill_dict[str(self.avatar_id)]['skillList'][skill_type] + return msgspec.convert(skill_info, type=List[Union[str, int]]) + + def Skill_num(self, skill: Union[str, int], skill_type: str): + skill_level = 0 + if skill == 'Normal': + skill_level = self.Skill.Normal_.level - 1 + if skill == 'BPSkill': + skill_level = self.Skill.BPSkill_.level - 1 + if skill == 'Ultra': + skill_level = self.Skill.Ultra_.level - 1 + if skill == 'Talent': + skill_level = self.Skill.Talent_.level - 1 + skill_info = skill_dict[str(self.avatar_id)][skill_type][skill_level] + return msgspec.convert(skill_info, type=float) diff --git a/StarRailUID/starrailuid_charinfo/damage/Base/RelicBase.py b/StarRailUID/starrailuid_charinfo/damage/Base/RelicBase.py new file mode 100644 index 0000000..174013d --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Base/RelicBase.py @@ -0,0 +1,93 @@ +from typing import Dict +from abc import abstractmethod + +from gsuid_core.logger import logger + +from .model import DamageInstanceRelic +from ....utils.map.SR_MAP_PATH import RelicSetSkill + + +class SingleRelic: + def __init__(self, relic: DamageInstanceRelic): + self.raw_relic = relic + self.relic_id = relic.relicId + self.set_id = relic.SetId + self.relic_type = relic.Type + self.relic_level = relic.Level + self.relic_attribute_bonus: Dict[str, float] = {} + + def get_attribute_(self): + # MainAffix + if self.raw_relic.MainAffix.Property in self.relic_attribute_bonus: + self.relic_attribute_bonus[ + self.raw_relic.MainAffix.Property + ] += self.raw_relic.MainAffix.Value + else: + self.relic_attribute_bonus[ + self.raw_relic.MainAffix.Property + ] = self.raw_relic.MainAffix.Value + + # SubAffix + if self.raw_relic.SubAffixList: + for sub_affix in self.raw_relic.SubAffixList: + sub_affix_property = sub_affix.Property + value = sub_affix.Value + if sub_affix_property in self.relic_attribute_bonus: + self.relic_attribute_bonus[sub_affix_property] += value + else: + self.relic_attribute_bonus[sub_affix_property] = value + + +class BaseRelicSetSkill: + setId: int + pieces2: bool = False + pieces4: bool = False + + def __init__(self, set_id: int, count: int): + self.setId = set_id + if count >= 2: + self.pieces2 = True + logger.info(f'Relic {set_id} 2 pieces set activated') + if count == 4: + self.pieces4 = True + logger.info(f'Relic {set_id} 4 pieces set activated') + self.relicSetAttribute = self.set_skill_property_ability() + + @abstractmethod + async def check( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + ... + + @abstractmethod + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + """ + 战斗加成属性, 与 set_skill_property() 互斥 + """ + ... + + def set_skill_property_ability(self): + set_property = '' + set_value = 0 + relic_set_attribute: Dict[str, float] = {} + if self.pieces2: + status_add = RelicSetSkill.RelicSet[str(self.setId)]['2'] + if status_add: + set_property = status_add.Property + set_value = status_add.Value + if set_property != '': + relic_set_attribute[set_property] = ( + relic_set_attribute.get(set_property, 0) + set_value + ) + if self.pieces4: + status_add = RelicSetSkill.RelicSet[str(self.setId)]['4'] + if status_add: + set_property = status_add.Property + set_value = status_add.Value + if set_property != '': + relic_set_attribute[set_property] = ( + relic_set_attribute.get(set_property, 0) + set_value + ) + return relic_set_attribute diff --git a/StarRailUID/starrailuid_charinfo/damage/Base/SkillBase.py b/StarRailUID/starrailuid_charinfo/damage/Base/SkillBase.py new file mode 100644 index 0000000..e3c84df --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Base/SkillBase.py @@ -0,0 +1,45 @@ +import json +from typing import List +from pathlib import Path + +from .model import DamageInstanceSkill, DamageInstanceAvatar + +path = Path(__file__).parent.parent +with Path.open(path / 'Excel' / 'SkillData.json', encoding='utf-8') as f: + skill_dict = json.load(f) + + +class SingleSkill: + def __init__(self, skill: DamageInstanceSkill): + self.id = skill.skillId + self.level = skill.skillLevel + + +class BaseSkills: + Normal_: SingleSkill + BPSkill_: SingleSkill + Ultra_: SingleSkill + Maze_: SingleSkill + Talent_: SingleSkill + + @classmethod + def create( + cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill] + ): + for skill in skills: + skill_attack_type = skill.skillAttackType + if skill_attack_type == 'Normal': + cls.Normal_ = SingleSkill(skill) + elif skill_attack_type == 'BPSkill': + cls.BPSkill_ = SingleSkill(skill) + elif skill_attack_type == 'Ultra': + cls.Ultra_ = SingleSkill(skill) + elif skill_attack_type == 'Maze': + cls.Maze_ = SingleSkill(skill) + elif skill_attack_type == '': + cls.Talent_ = SingleSkill(skill) + else: + raise ValueError( + f'Unknown skillAttackType: {skill_attack_type}' + ) + return cls diff --git a/StarRailUID/starrailuid_charinfo/damage/Base/WeaponBase.py b/StarRailUID/starrailuid_charinfo/damage/Base/WeaponBase.py new file mode 100644 index 0000000..d6bb1ab --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Base/WeaponBase.py @@ -0,0 +1,78 @@ +from typing import Dict +from abc import abstractmethod + +from msgspec import Struct + +from .model import DamageInstanceWeapon +from ....utils.excel.model import EquipmentPromotionConfig +from ....utils.map.SR_MAP_PATH import EquipmentID2AbilityProperty + + +class BaseWeaponAttribute(Struct): + hp: float + attack: float + defence: float + + def items(self): + return [ + ('hp', self.hp), + ('attack', self.attack), + ('defence', self.defence), + ] + + +class BaseWeapon: + def __init__(self, weapon: DamageInstanceWeapon): + self.weapon_id = weapon.id_ + self.weapon_level = weapon.level + self.weapon_rank = weapon.rank + self.weapon_promotion = weapon.promotion + self.weapon_base_attribute = self.get_attribute() + self.weapon_attribute: Dict[str, float] = {} + self.get_attribute() + self.weapon_property_ability() + + @abstractmethod + async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): + """ + 战斗加成属性, 与 weapon_property_ability() 互斥 + """ + ... + + def weapon_property_ability(self): + """ + 面板加成属性, 与 weapon_ability() 互斥 + """ + ability_property = EquipmentID2AbilityProperty[str(self.weapon_id)] + equip_ability_property = ability_property[str(self.weapon_rank)] + for equip_ability in equip_ability_property: + property_type = equip_ability['PropertyType'] + value = equip_ability['Value']['Value'] + if property_type in self.weapon_attribute: + self.weapon_attribute[property_type] += value + else: + self.weapon_attribute[property_type] = value + + @abstractmethod + async def check(self): + ... + + def get_attribute(self): + promotion = EquipmentPromotionConfig.Equipment[str(self.weapon_id)][ + str(self.weapon_promotion) + ] + + return BaseWeaponAttribute( + hp=( + promotion.BaseHP.Value + + promotion.BaseHPAdd.Value * (self.weapon_level - 1) + ), + attack=( + promotion.BaseAttack.Value + + promotion.BaseAttackAdd.Value * (self.weapon_level - 1) + ), + defence=( + promotion.BaseDefence.Value + + promotion.BaseDefenceAdd.Value * (self.weapon_level - 1) + ), + ) diff --git a/StarRailUID/starrailuid_charinfo/damage/Base/model.py b/StarRailUID/starrailuid_charinfo/damage/Base/model.py new file mode 100644 index 0000000..3e033a4 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Base/model.py @@ -0,0 +1,103 @@ +from typing import List, Union + +import msgspec +from msgspec import Struct, field + + +class DamageInstanceSkill(Struct): + skillId: int + skillName: str + skillEffect: str + skillAttackType: str + skillLevel: int + + +class DamageInstanceRelicSubAffix(Struct): + SubAffixID: int + Property: str + Name: str + Cnt: int + Step: int + Value: float + + +class DamageInstanceRelicMainAffix(Struct): + AffixID: int + Property: str + Name: str + Value: float + + +class DamageInstanceRelic(Struct): + relicId: int + relicName: str + SetId: int + SetName: str + Type: int + MainAffix: DamageInstanceRelicMainAffix + SubAffixList: Union[List[DamageInstanceRelicSubAffix], None] + Level: int = 0 + + +class DamageInstanceWeapon(Struct): + id_: str = field(name='id') + level: int + rank: int + promotion: int + + +class AttributeBounsStatusAdd(Struct): + property: str + name: str + value: float + + +class DamageInstanceAvatarAttributeBouns(Struct): + attributeBonusId: int + attributeBonusLevel: int + statusAdd: AttributeBounsStatusAdd + + +class DamageInstanceAvatar(Struct): + id_: str = field(name='id') + level: int + rank: int + element: str + promotion: int + attribute_bonus: Union[List[DamageInstanceAvatarAttributeBouns], None] + extra_ability: Union[List, None] + + +class DamageInstance: + avatar: DamageInstanceAvatar + weapon: DamageInstanceWeapon + relic: List[DamageInstanceRelic] + skill: List[DamageInstanceSkill] + + def __init__(self, char): + self.avatar = DamageInstanceAvatar( + id_=char.char_id, + level=char.char_level, + rank=char.char_rank, + element=char.char_element, + promotion=char.char_promotion, + attribute_bonus=msgspec.convert( + char.attribute_bonus, + Union[List[DamageInstanceAvatarAttributeBouns], None], + ), + extra_ability=msgspec.convert( + char.extra_ability, Union[List, None] + ), + ) + self.weapon = DamageInstanceWeapon( + id_=char.equipment['equipmentID'], + level=char.equipment['equipmentLevel'], + rank=char.equipment['equipmentRank'], + promotion=char.equipment['equipmentPromotion'], + ) + self.relic = [] + for relic in char.char_relic: + self.relic.append(msgspec.convert(relic, DamageInstanceRelic)) + self.skill = [] + for skill in char.char_skill: + self.skill.append(msgspec.convert(skill, DamageInstanceSkill)) diff --git a/StarRailUID/starrailuid_charinfo/damage/Excel/SkillData.json b/StarRailUID/starrailuid_charinfo/damage/Excel/SkillData.json new file mode 100644 index 0000000..ea2086d --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Excel/SkillData.json @@ -0,0 +1,695 @@ +{ + "1102": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 1.1000000000931323, 1.2100000001955777, 1.3200000002980232, + 1.4300000004004687, 1.5400000005029142, 1.6500000006053597, + 1.7875000005587935, 1.9250000005122274, 2.0625000002328306, + 2.2000000001862645, 2.31000000028871, 2.4200000003911555, + 2.530000000493601, 2.6400000005960464, 2.750000000698492 + ], + "Ultra": [ + 2.5500000005122274, 2.7200000006705523, 2.890000000828877, + 3.0600000000558794, 3.230000000214204, 3.400000000372529, + 3.612500000745058, 3.825000000419095, 4.037499999860302, + 4.250000000232831, 4.4200000003911555, 4.59000000054948, + 4.760000000707805, 4.93000000086613, 5.100000000093132 + ], + "Talent": [ + 0.40000000037252903, 0.44000000040978193, 0.48000000044703484, + 0.5200000004842877, 0.5600000005215406, 0.6000000005587935, + 0.6500000006053597, 0.7000000006519258, 0.7500000006984919, + 0.8000000007450581, 0.840000000782311, 0.8800000008195639, + 0.9200000008568168, 0.9600000008940697, 1 + ], + "Maze": [20], + "Ultra_Use": [120], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1204": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 0.5000000004656613, 0.5500000004656613, 0.6000000005587935, + 0.6500000005587935, 0.7000000006519258, 0.7500000006519258, + 0.8000000007450581, 0.8500000007450581, 0.9000000008381903, + 0.9500000008381903, 1.0000000000931323, 1.0500000000931323, + 1.1000000001862645, 1.1500000001862645, 1.2000000002793968, + 1.2500000002793968 + ], + "Ultra": [ + 1.2000000002793968, 1.2800000002793968, 1.3600000002793968, + 1.4400000002793968, 1.5200000002793968, 1.6000000002793968, + 1.6800000002793968, 1.7600000002793968, 1.8400000002793968, + 1.9200000002793968, 2.0000000002793968, 2.0800000002793968, + 2.1600000002793968, 2.2400000002793968, 2.3200000002793968, + 2.4000000002793968 + ], + "Talent": [ + 3.300000000372529, 3.63000000372529, 3.960000000372529, 4.290000000372529, + 4.620000000372529, 4.495000000372529, 5.363000000372529, + 5.775000000372529, 6.188000000372529, 6.600000000372529, + 6.930000000372529, 7.260000000372529, 7.590000000372529, + 7.920000000372529, 8.250000000372529 + ], + "Maze": [20], + "Ultra_Use": [130], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "Talent": ["attack", "10层神君", 1, "Talent", "Talent"] + } + }, + "1107": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 0.6000000004656613, 0.6600000004656613, 0.7200000005587935, + 0.7800000005587935, 0.8400000006519258, 0.9000000006519258, + 0.9600000007450581, 1.0200000007450581, 1.0800000008381903, + 1.1400000008381903, 1.2000000000931323, 1.2600000000931323, + 1.3200000001862645, 1.3800000001862645, 1.4400000002793968, + 1.5000000002793968 + ], + "Talent1": [ + 0.9600000002793968, 1.0240000002793968, 1.0880000002793968, + 1.1520000002793968, 1.2160000002793968, 1.2800000002793968, + 1.3600000002793968, 1.4400000002793968, 1.5200000002793968, + 1.6000000002793968, 1.6640000002793968, 1.7280000002793968, + 1.7920000002793968, 1.1850000002793968, 1.9200000002793968 + ], + "Talent": [ + 0.800000000372529, 0.880000000372529, 0.960000000372529, + 1.040000000372529, 1.120000000372529, 1.200000000372529, + 1.300000000372529, 1.400000000372529, 1.500000000372529, + 1.600000000372529, 1.680000000372529, 1.760000000372529, + 1.840000000372529, 1.920000000372529, 2.000000000372529 + ], + "Maze": [20], + "Ultra_Use": [130], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Talent": ["attack", "反击", 1, "Talent", "Talent"], + "Talent1": ["attack", "强化反击", 1, "Talent", "Ultra"] + } + }, + "1213": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "Normal1": [ + 1.3000000004656613, 1.5600000005587935, 1.8200000006519258, + 2.0800000007450581, 2.3400000008381903, 2.6000000000931323, + 2.8600000001862645, 3.1200000002793968, 3.3800000002793968 + ], + "Normal2": [ + 1.9000000004656613, 2.2800000005587935, 2.6600000006519258, + 3.0400000007450581, 3.4200000008381903, 3.8000000000931323, + 4.1800000001862645, 4.5600000002793968, 4.9400000002793968 + ], + "Normal3": [ + 2.5000000004656613, 3.0000000005587935, 3.5000000006519258, + 4.0000000007450581, 4.5000000008381903, 5.0000000000931323, + 5.5000000001862645, 6.0000000002793968, 6.5000000002793968 + ], + "BPSkill": [ + 0.0600000004656613, 0.0660000004656613, 0.0720000005587935, + 0.0780000005587935, 0.0840000006519258, 0.0900000006519258, + 0.0975000007450581, 0.1050000007450581, 0.1125000008381903, + 0.1200000008381903, 0.1260000000931323, 0.1320000000931323, + 0.1380000001862645, 0.1440000001862645, 0.1500000002793968, + 0.1560000002793968 + ], + "Ultra": [ + 1.8000000002793968, 1.9200000002793968, 2.0400000002793968, + 2.1600000002793968, 2.2800000002793968, 2.4000000002793968, + 2.5500000002793968, 2.7000000002793968, 2.8500000002793968, + 3.0000000002793968, 3.1200000002793968, 3.2400000002793968, + 3.3600000002793968, 3.4800000002793968, 3.6000000002793968 + ], + "Talent": [ + 0.050000000372529, 0.055000000372529, 0.060000000372529, + 0.065000000372529, 0.070000000372529, 0.075000000372529, + 0.081300000372529, 0.087500000372529, 0.093800000372529, + 0.100000000372529, 0.105000000372529, 0.110000000372529, + 0.115000000372529, 0.120000000372529, 0.125000000372529 + ], + "Maze": [20], + "Ultra_Use": [140], + "skillList": { + "Normal": ["attack", "普攻", 2, "Normal", "Normal"], + "Normal1": ["attack", "瞬华", 3, "Normal", "Normal"], + "Normal2": ["attack", "天矢阴", 5, "Normal", "Normal"], + "Normal3": ["attack", "盘拏耀跃", 7, "Normal", "Normal"], + "Ultra": ["attack", "终结技", 3, "Ultra", "Ultra"] + } + }, + "1006": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 0.9800000004656613, 1.0790000004656613, 1.1760000005587935, + 1.2740000005587935, 1.3720000006519258, 1.4700000006519258, + 1.5925000007450581, 1.7150000007450581, 1.8375000008381903, + 1.9600000008381903, 2.0580000000931323, 2.1560000000931323, + 2.2540000001862645, 2.3520000001862645, 2.4500000002793968 + ], + "BPSkill_D": [ + 0.075000000372529, 0.077500000372529, 0.080000000372529, + 0.082500000372529, 0.085000000372529, 0.087500000372529, + 0.090600000372529, 0.093800000372529, 0.096900000372529, + 0.100000000372529, 0.102500000372529, 0.105000000372529, + 0.107500000372529, 0.110000000372529, 0.112500000372529 + ], + "Ultra": [ + 2.280000000372529, 2.432000000372529, 2.584000000372529, + 2.736000000372529, 2.888000000372529, 3.040000000372529, + 3.230000000372529, 3.420000000372529, 3.610000000372529, + 3.800000000372529, 3.952000000372529, 4.104000000372529, + 4.256000000372529, 4.408000000372529, 4.560000000372529 + ], + "Ultra_D": [ + 0.360000000372529, 0.369000000372529, 0.378000000372529, + 0.387000000372529, 0.396000000372529, 0.405000000372529, + 0.416300000372529, 0.427500000372529, 0.438800000372529, + 0.450000000372529, 0.459000000372529, 0.468000000372529, + 0.477000000372529, 0.486000000372529, 0.495000000372529 + ], + "Talent": [ + 0.040000000372529, 0.044000000372529, 0.048000000372529, + 0.052000000372529, 0.056000000372529, 0.040000000372529, + 0.060000000372529, 0.065000000372529, 0.070000000372529, + 0.075000000372529, 0.080000000372529, 0.084000000372529, + 0.088000000372529, 0.096000000372529, 0.100000000372529 + ], + "Maze": [20], + "Ultra_Use": [110], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1005": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 0.8000000004656613, 0.8800000004656613, 0.9600000005587935, + 1.0400000005587935, 1.1200000006519258, 1.2000000006519258, + 1.3000000007450581, 1.4000000007450581, 1.5000000008381903, + 1.6000000008381903, 1.6800000000931323, 1.7600000000931323, + 1.8400000001862645, 1.9200000001862645, 2.0000000002793968 + ], + "Ultra": [ + 0.480000000372529, 0.512000000372529, 0.544000000372529, + 0.576000000372529, 0.608000000372529, 0.640000000372529, + 0.680000000372529, 0.720000000372529, 0.760000000372529, + 0.800000000372529, 0.832000000372529, 0.864000000372529, + 0.896000000372529, 0.928000000372529, 0.960000000372529 + ], + "DOT": [ + 1.1600000004656613, 1.2688000004656613, 1.3775000005587935, + 1.4863000005587935, 1.5950000006519258, 1.7581000006519258, + 1.9756000007450581, 2.2475000007450581, 2.5738000008381903, + 2.9000000008381903, 3.0414000000931323, 3.1828000000931323, + 3.3241000001862645, 3.4655000001862645, 3.6069000002793968 + ], + "Talent": [ + 0.420000000372529, 0.518000000372529, 0.616000000372529, + 0.714000000372529, 0.812000000372529, 0.910000000372529, + 1.032500000372529, 1.155000000372529, 1.277500000372529, + 1.400000000372529, 1.498000000372529, 1.596000000372529, + 1.694000000372529, 1.792000000372529, 1.890000000372529 + ], + "Maze": [20], + "Ultra_Use": [110], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "DOT": ["attack", "单次持续伤害", 1, "DOT", "Ultra"], + "Talent": ["attack", "追加攻击", 1, "Talent", "Talent"] + } + }, + "1205": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "Normal1": [ + 0.2000000004656613, 0.2400000005587935, 0.2800000006519258, + 0.3200000007450581, 0.3600000008381903, 0.4000000000931323, + 0.4400000001862645, 0.4800000002793968, 0.5200000002793968 + ], + "Normal1_HP": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "BPSkill": [ + 0.1200000004656613, 0.1480000004656613, 0.1760000005587935, + 0.204000000372529, 0.232000000372529, 0.260000000372529, + 0.295000000372529, 0.330000000372529, 0.365000000372529, + 0.400000000372529, 0.428000000372529, 0.456000000372529, + 0.484000000372529, 0.512000000372529, 0.540000000372529 + ], + "Ultra": [ + 0.240000000372529, 0.256000000372529, 0.272000000372529, + 0.288000000372529, 0.304000000372529, 0.320000000372529, + 0.340000000372529, 0.360000000372529, 0.380000000372529, + 0.400000000372529, 0.416000000372529, 0.432000000372529, + 0.448000000372529, 0.464000000372529, 0.480000000372529 + ], + "Ultra_HP": [ + 1.500000000372529, 1.540000000372529, 1.580000000372529, + 1.620000000372529, 1.660000000372529, 1.700000000372529, + 1.750000000372529, 1.800000000372529, 1.850000000372529, + 1.900000000372529, 1.940000000372529, 1.980000000372529, + 2.020000000372529, 2.060000000372529, 2.100000000372529 + ], + "Talent": [ + 0.220000000372529, 0.242000000372529, 0.264000000372529, + 0.286000000372529, 0.308000000372529, 0.330000000372529, + 0.357500000372529, 0.385000000372529, 0.412500000372529, + 0.440000000372529, 0.462000000372529, 0.484000000372529, + 0.506000000372529, 0.528000000372529, 0.550000000372529 + ], + "Talent_HP": [ + 0.550000000372529, 0.605000000372529, 0.660000000372529, + 0.715000000372529, 0.770000000372529, 0.825000000372529, + 0.893800000372529, 0.962500000372529, 1.031300000372529, + 1.100000000372529, 1.155000000372529, 1.210000000372529, + 1.265000000372529, 1.320000000372529, 1.375000000372529 + ], + "Maze": [20], + "Ultra_Use": [110], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "Normal1": ["attack", "无间剑树", 1, "Normal", "Normal"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "Talent": ["attack", "追加攻击", 1, "Talent", "Talent"] + } + }, + "1208": { + "Normal": [0, 0, 0, 0, 0, 0, 0, 0, 0], + "Normal_HP": [ + 0.2500000004656613, 0.3000000005587935, 0.3500000006519258, + 0.4000000007450581, 0.4500000008381903, 0.5000000000931323, + 0.5500000001862645, 0.6000000002793968, 0.6500000002793968 + ], + "BPSkill_HP": [ + 0.0300000004656613, 0.0330000004656613, 0.0360000005587935, + 0.039000000372529, 0.042000000372529, 0.045000000372529, + 0.048800000372529, 0.052500000372529, 0.056300000372529, + 0.060000000372529, 0.063000000372529, 0.066000000372529, + 0.069000000372529, 0.072000000372529, 0.075000000372529 + ], + "BPSkill_CC": [ + 0.0600000004656613, 0.0660000004656613, 0.0720000005587935, + 0.078000000372529, 0.084000000372529, 0.090000000372529, + 0.097500000372529, 0.105000000372529, 0.112500000372529, + 0.120000000372529, 0.126000000372529, 0.132000000372529, + 0.138000000372529, 0.144000000372529, 0.150000000372529 + ], + "Ultra": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "Ultra_HP": [ + 0.600000000372529, 0.640000000372529, 0.680000000372529, + 0.720000000372529, 0.760000000372529, 0.800000000372529, + 0.850000000372529, 0.900000000372529, 0.950000000372529, + 1.000000000372529, 1.040000000372529, 1.080000000372529, + 1.120000000372529, 1.160000000372529, 1.200000000372529 + ], + "Talent": [ + 0.220000000372529, 0.242000000372529, 0.264000000372529, + 0.286000000372529, 0.308000000372529, 0.330000000372529, + 0.357500000372529, 0.385000000372529, 0.412500000372529, + 0.440000000372529, 0.462000000372529, 0.484000000372529, + 0.506000000372529, 0.528000000372529, 0.550000000372529 + ], + "Maze": [20], + "Ultra_Use": [135], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1104": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "BPSkill": [ + 1.0000000004656613, 1.1000000004656613, 1.2000000005587935, + 1.300000000372529, 1.400000000372529, 1.500000000372529, + 1.625000000372529, 1.750000000372529, 1.875000000372529, + 2.000000000372529, 2.100000000372529, 2.200000000372529, + 2.300000000372529, 2.400000000372529, 2.500000000372529 + ], + "Ultra": [ + 0.300000000372529, 0.318800000372529, 0.337500000372529, + 0.356300000372529, 0.375000000372529, 0.390000000372529, + 0.405000000372529, 0.420000000372529, 0.435000000372529, + 0.450000000372529, 0.465000000372529, 0.480000000372529, + 0.495000000372529, 0.510000000372529, 0.525000000372529 + ], + "Ultra_G": [ + 150, 240, 308, 375, 420, 465, 499, 533, 566, 600, 634, 668, 701, 735, 769 + ], + "Maze": [20], + "Ultra_Use": [110], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["defence", "终结技(护盾)", 1, "Ultra", "Ultra"] + } + }, + "1209": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 1.1000000000931323, 1.2100000001955777, 1.3200000002980232, + 1.4300000004004687, 1.5400000005029142, 1.6500000006053597, + 1.7875000005587935, 1.9250000005122274, 2.0625000002328306, + 2.2000000001862645, 2.31000000028871, 2.4200000003911555, + 2.530000000493601, 2.6400000005960464, 2.750000000698492 + ], + "Ultra": [ + 2.1000000005122274, 2.2400000006705523, 2.380000000828877, + 2.5200000000558794, 2.660000000214204, 2.800000000372529, + 2.975000000745058, 3.150000000419095, 3.332499999860302, + 3.500000000232831, 3.6400000003911555, 3.78000000054948, + 3.920000000707805, 4.06000000086613, 4.200000000093132 + ], + "Ultra_CD": [ + 0.3000000005122274, 0.3200000006705523, 0.340000000828877, + 0.3600000000558794, 0.380000000214204, 0.400000000372529, + 0.425000000745058, 0.450000000419095, 0.474999999860302, + 0.500000000232831, 0.5200000003911555, 0.54000000054948, + 0.560000000707805, 0.58000000086613, 0.600000000093132 + ], + "Talent": [ + 0.25000000037252903, 0.27500000040978193, 0.30000000044703484, + 0.3250000004842877, 0.3500000005215406, 0.3750000005587935, + 0.4063000006053597, 0.4375000006519258, 0.4688000006984919, + 0.5000000007450581, 0.525000000782311, 0.5500000008195639, + 0.5750000008568168, 0.6000000008940697, 0.6250000008940697 + ], + "Talent_CC": [ + 0.15000000037252903, 0.15500000040978193, 0.16000000044703484, + 0.1650000004842877, 0.1700000005215406, 0.1750000005587935, + 0.1813000006053597, 0.1875000006519258, 0.1938000006984919, + 0.2000000007450581, 0.205000000782311, 0.2100000008195639, + 0.2150000008568168, 0.2200000008940697, 0.2250000008940697 + ], + "Talent_CD": [ + 0.15000000037252903, 0.16500000040978193, 0.18000000044703484, + 0.1950000004842877, 0.2100000005215406, 0.2250000005587935, + 0.2438000006053597, 0.2625000006519258, 0.2813000006984919, + 0.3000000007450581, 0.315000000782311, 0.3300000008195639, + 0.3450000008568168, 0.3600000008940697, 0.3750000008940697 + ], + "Maze": [20], + "Ultra_Use": [120], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "Talent": ["attack", "附加伤害", 1, "Talent", "Talent"] + } + }, + "1004": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 1.0800000000931323, 1.1880000001955777, 1.2960000002980232, + 1.4040000004004687, 1.5120000005029142, 1.6200000006053597, + 1.7550000005587935, 1.8900000005122274, 2.0550000002328306, + 2.1600000001862645, 2.26800000028871, 2.3760000003911555, + 2.484000000493601, 2.5920000005960464, 2.700000000698492 + ], + "Ultra": [ + 0.9000000005122274, 0.9600000006705523, 1.020000000828877, + 1.0800000000558794, 1.140000000214204, 1.200000000372529, + 1.275000000745058, 1.350000000419095, 1.424999999860302, + 1.500000000232831, 1.5600000003911555, 1.62000000054948, + 1.680000000707805, 1.74000000086613, 1.800000000093132 + ], + "Talent": [ + 0.30000000037252903, 0.33000000040978193, 0.36000000044703484, + 0.3900000004842877, 0.4200000005215406, 0.4500000005587935, + 0.4875000006053597, 0.525000006519258, 0.5625000006984919, + 0.6000000007450581, 0.63000000782311, 0.6600000008195639, + 0.6900000008568168, 0.7200000008940697, 0.7500000008940697 + ], + "Maze": [20], + "Ultra_Use": [120], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 3, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1003": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "BPSkill": [ + 1.0000000000931323, 1.1000000001955777, 1.2000000002980232, + 1.3000000004004687, 1.4000000005029142, 1.5000000006053597, + 1.6250000005587935, 1.7500000005122274, 1.8750000002328306, + 2.0000000001862645, 2.10000000028871, 2.2000000003911555, + 2.300000000493601, 2.4000000005960464, 2.500000000698492 + ], + "Ultra": [ + 1.3800000005122274, 1.4720000006705523, 1.564000000828877, + 1.6560000000558794, 1.748000000214204, 1.840000000372529, + 1.955000000745058, 2.070000000419095, 2.185000000860302, + 2.300000000232831, 2.3920000003911555, 2.48400000054948, + 2.596000000707805, 2.66800000086613, 2.76000000093132 + ], + "Talent": [ + 0.70000000037252903, 0.77000000040978193, 0.84000000044703484, + 0.9100000004842877, 0.9800000005215406, 1.0500000005587935, + 1.1375000006053597, 1.225000006519258, 1.312500006984919, + 1.4000000007450581, 1.47000000782311, 1.5400000008195639, + 1.6100000008568168, 1.6800000008940697, 1.7500000008940697 + ], + "Maze": [20], + "Ultra_Use": [120], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "Talent": ["attack", "追加攻击", 1, "Talent", "Talent"] + } + }, + "1201": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968 + ], + "Normal1": [ + 1.2000000000931323, 1.4400000001955777, 1.6800000002980232, + 1.9200000004004687, 2.1600000005029142, 2.4000000006053597, + 2.6450000005587935, 2.8800000005122274, 3.1200000002328306 + ], + "BPSkill": [ + 0.14000000037252903, 0.15400000040978193, 0.16800000044703484, + 0.1820000004842877, 0.1960000005215406, 0.2100000005587935, + 0.2275000006053597, 0.2450000006519258, 0.2625000006984919, + 0.2800000007450581, 0.294000000782311, 0.3080000008195639, + 0.3220000008568168, 0.3360000008940697, 0.3500000008940697 + ], + "Ultra": [ + 1.2000000005122274, 1.2800000006705523, 1.360000000828877, + 1.440000000558794, 1.520000000214204, 1.600000000372529, + 1.700000000745058, 1.800000000419095, 1.900000000860302, + 2.000000000232831, 2.0800000003911555, 2.16000000054948, + 2.240000000707805, 2.32000000086613, 2.40000000093132 + ], + "Talent": [ + 0.36000000037252903, 0.39600000040978193, 0.43200000044703484, + 0.4680000004842877, 0.5040000005215406, 0.5400000005587935, + 0.5850000006053597, 0.6300000006519258, 0.6750000006984919, + 0.7200000007450581, 0.756000000782311, 0.7920000008195639, + 0.8280000008568168, 0.8640000008940697, 0.9000000008940697 + ], + "Maze": [20], + "Ultra_Use": [140], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "Normal1": ["attack", "杠上开花!", 1, "Normal", "Normal"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1212": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "BPSkill": [ + 1.0000000005122274, 1.1000000006705523, 1.200000000828877, + 1.300000000558794, 1.400000000214204, 1.500000000372529, + 1.630000000745058, 1.750000000419095, 1.880000000860302, + 2.000000000232831, 2.1000000003911555, 2.20000000054948, + 2.300000000707805, 2.40000000086613, 2.50000000093132 + ], + "BPSkill1": [ + 1.2500000005122274, 1.3750000006705523, 1.500000000828877, + 1.625000000558794, 1.750000000214204, 1.875000000372529, + 0.031250000745058, 2.187500000419095, 2.343750000860302, + 2.500000000232831, 2.6250000003911555, 2.75000000054948, + 2.875000000707805, 3.00000000086613, 3.12500000093132 + ], + "Ultra": [ + 1.8000000005122274, 1.9200000006705523, 2.040000000828877, + 2.160000000558794, 2.280000000214204, 2.400000000372529, + 2.550000000745058, 2.700000000419095, 2.850000000860302, + 3.000000000232831, 3.1200000003911555, 3.24000000054948, + 3.360000000707805, 3.48000000086613, 3.60000000093132 + ], + "Talent_CC": [ + 0.40000000037252903, 0.41000000040978193, 0.42000000044703484, + 0.4300000004842877, 0.4400000005215406, 0.4500000005587935, + 0.4625000006053597, 0.4750000006519258, 0.4875000006984919, + 0.5000000007450581, 0.510000000782311, 0.5200000008195639, + 0.5300000008568168, 0.5400000008940697, 0.5500000008940697 + ], + "Talent_atk": [ + 0.90000000037252903, 0.99000000040978193, 1.08000000044703484, + 1.1700000004842877, 1.2600000005215406, 1.3500000005587935, + 1.4625000006053597, 1.5750000006519258, 1.6875000006984919, + 1.8000000007450581, 1.890000000782311, 1.9800000008195639, + 2.0700000008568168, 2.1600000008940697, 2.2500000008940697 + ], + "Maze": [20], + "Ultra_Use": [140], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "BPSkill1": ["attack", "寒川映月", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"] + } + }, + "1112": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000001862645, 1.2000000002793968, 1.3000000002793968 + ], + "BPSkill": [ + 0.7500000005122274, 0.8250000006705523, 0.900000000828877, + 0.975000000558794, 1.050000000214204, 1.125000000372529, + 1.218750000745058, 1.312500000419095, 1.406250000860302, + 1.500000000232831, 1.575000000391155, 1.65000000054948, 1.725000000707805, + 1.80000000086613, 1.87500000093132 + ], + "BPSkill_add": [ + 0.2500000005122274, 0.2750000006705523, 0.300000000828877, + 0.325000000558794, 0.350000000214204, 0.375000000372529, + 0.406250000745058, 0.437500000419095, 0.468750000860302, + 0.500000000232831, 0.5250000003911555, 0.55000000054948, + 0.575000000707805, 0.60000000086613, 0.62500000093132 + ], + "Talent1": [ + 0.7500000005122274, 0.8250000006705523, 0.900000000828877, + 0.975000000558794, 1.050000000214204, 1.125000000372529, + 1.218750000745058, 1.312500000419095, 1.406250000860302, + 1.500000000232831, 1.575000000391155, 1.65000000054948, 1.725000000707805, + 1.80000000086613, 1.87500000093132 + ], + "Ultra_CD": [ + 0.1250000005122274, 0.13750000006705523, 0.150000000828877, + 0.162500000558794, 0.175000000214204, 0.187500000372529, + 0.203125000745058, 0.218750000419095, 0.234375000860302, + 0.250000000232831, 0.262500000391155, 0.27500000054948, 0.287500000707805, + 0.30000000086613, 0.31250000093132 + ], + "Maze": [20], + "Ultra_Use": [140], + "skillList": { + "Normal": ["attack", "普攻", 1, "Talent", "Normal"], + "BPSkill": ["attack", "账账", 1, "Talent", "BPSkill"], + "Talent1": ["attack", "强化账账", 1, "Talent", "Talent"] + } + }, + "1210": { + "Normal": [ + 0.5000000004656613, 0.6000000005587935, 0.7000000006519258, + 0.8000000007450581, 0.9000000008381903, 1.0000000000931323, + 1.1000000000931323, 1.2000000001862645, 1.3000000002793968 + ], + "BPSkill": [ + 0.6000000005587935, 0.6600000006146729, 0.7200000006705523, + 0.7800000007264316, 0.840000000782311, 0.9000000008381903, + 0.9750000005587935, 1.0500000000465661, 1.1249999997671694, + 1.2000000001862645, 1.2600000002421439, 1.3200000002980232, + 1.3800000003539026, 1.440000000409782, 1.5000000004656613 + ], + "DOT": [ + 0.8390400004573166, 0.9229800018947572, 1.0069200003053993, + 1.0908600010443479, 1.1748000003863126, 1.3007100007962435, + 1.4685900008771569, 1.6784400006290525, 1.9302600014489144, + 2.182080000638962, 2.2912020003423095, 2.400324000744149, + 2.5094460004474968, 2.6185680008493364, 2.727690001251176 + ], + "Ultra": [ + 0.7200000006705523, 0.7680000001564622, 0.8160000003408641, + 0.8640000005252659, 0.9120000007096678, 0.9600000008940697, + 1.0200000000186265, 1.0800000000745058, 1.1400000001303852, + 1.2000000001862645, 1.2479999996721745, 1.2959999998565763, + 1.3440000000409782, 1.39200000022538, 1.440000000409782 + ], + "Talent": [ + 0.0400000000372529, 0.04299999983049929, 0.04599999962374568, + 0.04899999941699207, 0.05199999990873039, 0.054999999701976776, + 0.058750000316649675, 0.06250000023283064, 0.06625000014901161, + 0.07000000006519258, 0.07299999985843897, 0.07599999965168536, + 0.07899999944493175, 0.08199999993667006, 0.08499999972991645 + ], + "Maze": [20], + "Ultra_Use": [140], + "skillList": { + "Normal": ["attack", "普攻", 1, "Normal", "Normal"], + "BPSkill": ["attack", "战技", 1, "BPSkill", "BPSkill"], + "Ultra": ["attack", "终结技", 1, "Ultra", "Ultra"], + "DOT": ["attack", "每段灼烧", 1, "DOT", "BPSkill"] + } + } +} diff --git a/StarRailUID/starrailuid_charinfo/damage/Excel/weapon_effect.json b/StarRailUID/starrailuid_charinfo/damage/Excel/weapon_effect.json new file mode 100644 index 0000000..17c1461 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Excel/weapon_effect.json @@ -0,0 +1,469 @@ +{ + "23001": { + "Param": { + "CriticalChance": [ + 0.18000000016763806, 0.21000000019557774, 0.24000000022351742, + 0.2700000002514571, 0.3000000002793968 + ], + "a_dmg": [ + 0.060000000055879354, 0.07000000006519258, 0.0800000000745058, + 0.09000000008381903, 0.10000000009313226 + ], + "e_dmg": [ + 0.060000000055879354, 0.07000000006519258, 0.0800000000745058, + 0.09000000008381903, 0.10000000009313226 + ], + "q_crit_dmg": [ + 0.12000000011175871, 0.14000000013038516, 0.1600000001490116, + 0.18000000016763806, 0.20000000018626451 + ] + }, + "AbilityProperty": [ + 0.18000000016763806, 0.21000000019557774, 0.24000000022351742, + 0.2700000002514571, 0.3000000002793968 + ] + }, + "21003": { + "Param": { + "CriticalChance": [ + 0.12000000011175871, 0.1500000001396984, 0.18000000016763806, + 0.21000000019557774, 0.24000000022351742 + ] + } + }, + "24001": { + "Param": { + "CriticalChance": [ + 0.0800000000745058, 0.10000000009313226, 0.12000000011175871, + 0.14000000013038516, 0.1600000001490116 + ], + "AttackAddedRatio": [ + 0.20000000018626451, 0.25000000023283064, 0.3000000002793968, + 0.3500000003259629, 0.40000000037252903 + ] + }, + "AbilityProperty": [ + 0.0800000000745058, 0.10000000009313226, 0.12000000011175871, + 0.14000000013038516, 0.1600000001490116 + ] + }, + "21024": { + "Param": { + "SpeedAddedRatio": [ + 0.0800000000745058, 0.09000000008381903, 0.10000000009313226, + 0.11000000010244548, 0.12000000011175871 + ], + "AllDamageAddedRatio": [ + 0.12000000011175871, 0.1500000001396984, 0.18000000016763806, + 0.21000000019557774, 0.24000000022351742 + ] + } + }, + "21017": { + "Param": { + "a_dmg": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ], + "e_dmg": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ] + } + }, + "23010": { + "Param": { + "CriticalDamageBase": [ + 0.36000000022351742, 0.4200000002793968, 0.4800000003352761, + 0.5400000003911555, 0.60000000044703484 + ], + "e_dmg": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ], + "r_dmg": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ], + "t_dmg": [ + 0.48000000022351742, 0.5600000002793968, 0.6400000003352761, + 0.7200000003911555, 0.80000000044703484 + ] + } + }, + "20002": { + "Param": { + "a_dmg": [ + 0.20000000022351742, 0.2500000002793968, 0.3000000003352761, + 0.3500000003911555, 0.40000000044703484 + ], + "e_dmg": [ + 0.20000000022351742, 0.2500000002793968, 0.3000000003352761, + 0.3500000003911555, 0.40000000044703484 + ] + } + }, + "21006": { + "Param": { + "t_dmg": [ + 0.48000000022351742, 0.6000000002793968, 0.7200000003352761, + 0.8400000003911555, 0.96000000044703484 + ] + } + }, + "21012": { + "Param": { + "AllDamageAddedRatio": [ + 0.40000000022351742, 0.5000000002793968, 0.6000000003352761, + 0.7000000003911555, 0.80000000044703484 + ] + } + }, + "20011": { + "Param": { + "AllDamageAddedRatio": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ] + } + }, + "20004": { + "Param": { + "StatusProbability": [ + 0.20000000022351742, 0.2500000002793968, 0.3000000003352761, + 0.3500000003911555, 0.40000000044703484 + ] + } + }, + "20020": { + "Param": { + "A3_AttackAddedRatio": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ] + } + }, + "21013": { + "Param": { + "r_dmg": [ + 0.32000000022351742, 0.4000000002793968, 0.4800000003352761, + 0.5600000003911555, 0.64000000044703484 + ] + } + }, + "20006": { + "Param": { + "r_dmg": [ + 0.28000000022351742, 0.3500000002793968, 0.4200000003352761, + 0.4900000003911555, 0.56000000044703484 + ] + } + }, + "20014": { + "Param": { + "SpeedAddedRatio": [ + 0.10000000009313226, 0.12000000011175871, 0.14000000013038516, + 0.1600000001490116, 0.18000000016763806 + ] + } + }, + "20007": { + "Param": { + "AttackAddedRatio": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ] + } + }, + "23000": { + "Param": { + "AttackAddedRatio": [ + 0.09000000022351742, 0.1050000002793968, 0.1200000003352761, + 0.1350000003911555, 0.15000000044703484 + ], + "AllDamageAddedRatio": [ + 0.30000000022351742, 0.3500000002793968, 0.4000000003352761, + 0.4500000003911555, 0.50000000044703484 + ] + } + }, + "21001": { + "Param": { + "AllDamageAddedRatio": [ + 0.12000000022351742, 0.1500000002793968, 0.1800000003352761, + 0.2100000003911555, 0.24000000044703484 + ] + } + }, + "23011": { + "Param": { + "AllDamageAddedRatio": [ + 0.09000000022351742, 0.1050000002793968, 0.1200000003352761, + 0.1350000003911555, 0.15000000044703484 + ] + } + }, + "23005": { + "Param": { + "DefenceAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "20003": { + "Param": { + "DefenceAddedRatio": [ + 0.1600000000745058, 0.20000000009313226, 0.24000000011175871, + 0.28000000013038516, 0.3200000001490116 + ] + } + }, + "21022": { + "Param": { + "AllDamageAddedRatio": [ + 0.16000000022351742, 0.2050000002793968, 0.2400000003352761, + 0.2850000003911555, 0.32000000044703484 + ] + } + }, + "21015": { + "Param": { + "ignore_defence": [ + 0.12000000022351742, 0.1300000002793968, 0.1400000003352761, + 0.1500000003911555, 0.16000000044703484 + ] + } + }, + "23004": { + "Param": { + "AllDamageAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ], + "A2_StatusProbability": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ], + "A2_AttackAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "23007": { + "Param": { + "DmgRatio": [ + 0.12000000022351742, 0.1400000002793968, 0.1600000003352761, + 0.1800000003911555, 0.20000000044703484 + ], + "CriticalChance": [ + 0.12000000022351742, 0.1400000002793968, 0.1600000003352761, + 0.1800000003911555, 0.20000000044703484 + ] + } + }, + "23006": { + "Param": { + "SpeedAddedRatio": [ + 0.04800000022351742, 0.0560000002793968, 0.0640000003352761, + 0.0720000003911555, 0.0800000044703484 + ], + "AllDamageAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "21020": { + "Param": { + "AttackAddedRatio": [ + 0.16000000022351742, 0.2050000002793968, 0.2400000003352761, + 0.2850000003911555, 0.32000000044703484 + ], + "CriticalDamageBase": [ + 0.24000000022351742, 0.3000000002793968, 0.3600000003352761, + 0.4200000003911555, 0.48000000044703484 + ] + } + }, + "23015": { + "Param": { + "AttackAddedRatio": [ + 0.18000000022351742, 0.2150000002793968, 0.2400000003352761, + 0.2750000003911555, 0.30000000044703484 + ], + "CriticalChance": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ] + } + }, + "20016": { + "Param": { + "CriticalChance": [ + 0.12000000022351742, 0.1500000002793968, 0.1800000003352761, + 0.2100000003911555, 0.24000000044703484 + ] + } + }, + "21005": { + "Param": { + "AttackAddedRatio": [ + 0.12000000022351742, 0.1500000002793968, 0.1800000003352761, + 0.2100000003911555, 0.24000000044703484 + ] + } + }, + "21019": { + "Param": { + "AttackAddedRatio": [ + 0.16000000022351742, 0.200000002793968, 0.2400000003352761, + 0.2850000003911555, 0.32000000044703484 + ], + "CriticalChance": [ + 0.12000000022351742, 0.1500000002793968, 0.1800000003352761, + 0.2100000003911555, 0.24000000044703484 + ] + } + }, + "23009": { + "Param": { + "CriticalChance": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ], + "HPAddedRatio": [ + 0.18000000022351742, 0.2100000002793968, 0.2400000003352761, + 0.2700000003911555, 0.30000000044703484 + ], + "AllDamageAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "21034": { + "Param": { + "AllDamageAddedRatio": [ + 0.0020000022351742, 0.0025000002793968, 0.0030000003352761, + 0.0035000003911555, 0.0040000044703484 + ] + } + }, + "20009": { + "Param": { + "AllDamageAddedRatio": [ + 0.2000000000745058, 0.25000000009313226, 0.30000000011175871, + 0.35000000013038516, 0.4100000001490116 + ] + } + }, + "21010": { + "Param": { + "AllDamageAddedRatio": [ + 0.0800000000745058, 0.10000000009313226, 0.12000000011175871, + 0.14000000013038516, 0.1600000001490116 + ] + } + }, + "21033": { + "Param": { + "AllDamageAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ], + "AttackAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "23014": { + "Param": { + "AllDamageAddedRatio": [ + 0.1400000000745058, 0.16400000009313226, 0.19000000011175871, + 0.21400000013038516, 0.2400000001490116 + ], + "ResistancePenetration": [ + 0.1200000000745058, 0.14000000009313226, 0.16000000011175871, + 0.18000000013038516, 0.2000000001490116 + ] + } + }, + "23002": { + "Param": { + "AllDamageAddedRatio": [ + 0.2400000000745058, 0.28000000009313226, 0.32000000011175871, + 0.36000000013038516, 0.4000000001490116 + ] + } + }, + "21026": { + "Param": { + "AllDamageAddedRatio": [ + 0.16000000011175871, 0.2000000001396984, 0.24000000016763806, + 0.28000000019557774, 0.32000000022351742 + ], + "AttackAddedRatio": [ + 0.1000000000745058, 0.12500000009313226, 0.15000000011175871, + 0.17500000013038516, 0.2000000001490116 + ] + } + }, + "24000": { + "Param": { + "AllDamageAddedRatio": [ + 0.12000000011175871, 0.1500000001396984, 0.18000000016763806, + 0.21000000019557774, 0.24000000022351742 + ], + "AttackAddedRatio": [ + 0.0800000000745058, 0.10000000009313226, 0.12000000011175871, + 0.14000000013038516, 0.1600000001490116 + ] + } + }, + "21027": { + "Param": { + "AllDamageAddedRatio": [ + 0.12000000011175871, 0.1500000001396984, 0.18000000016763806, + 0.21000000019557774, 0.24000000022351742 + ], + "AttackAddedRatio": [ + 0.04000000011175871, 0.0500000001396984, 0.06000000016763806, + 0.07000000019557774, 0.08000000022351742 + ] + } + }, + "23012": { + "Param": { + "CriticalChance": [ + 0.36000000011175871, 0.4200000001396984, 0.48000000016763806, + 0.54000000019557774, 0.60000000022351742 + ] + } + }, + "23016": { + "Param": { + "CriticalDamageBase": [ + 0.12000000011175871, 0.14000000013038516, 0.1600000001490116, + 0.18000000016763806, 0.20000000018626451 + ], + "TalentDmgAdd": [ + 0.30000000011175871, 0.3500000001396984, 0.40000000016763806, + 0.45000000019557774, 0.50000000022351742 + ] + } + }, + "21031": { + "enable": false + }, + "20000": { + "Param": { + "CriticalChance": [ + 0.12000000011175871, 0.1500000001396984, 0.18000000016763806, + 0.21000000019557774, 0.24000000022351742 + ] + } + } +} diff --git a/StarRailUID/starrailuid_charinfo/damage/Relic/Relic.py b/StarRailUID/starrailuid_charinfo/damage/Relic/Relic.py new file mode 100644 index 0000000..cf40c97 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Relic/Relic.py @@ -0,0 +1,744 @@ +from collections import Counter +from typing import Dict, List, Union + +from gsuid_core.logger import logger + +from ..utils import merge_attribute +from ..Base.model import DamageInstanceRelic +from ..Base.RelicBase import SingleRelic, BaseRelicSetSkill + + +class Relic101(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] + ): + """ + 在战斗开始时 + """ + logger.info('Relic101 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + pass + return attribute_bonus + + +class Relic102(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] + ): + """ + 无 + """ + logger.info('Relic102 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + a_dmg = attribute_bonus.get('NormalDmgAdd', 0) + attribute_bonus['NormalDmgAdd'] = a_dmg + 0.10000000018626451 + return attribute_bonus + + +class Relic103(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] + ): + """ + 战斗中生效:装备者提供的护盾量提高 + """ + logger.info('Relic103 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + shield_added_ratio = attribute_bonus.get('shield_added_ratio', 0) + attribute_bonus['shield_added_ratio'] = ( + shield_added_ratio + 0.20000000018626451 + ) + return attribute_bonus + + +class Relic104(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] + ): + """ + 装备者施放终结技 + """ + logger.info('Relic104 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + critical_damage_base = attribute_bonus.get('CriticalDamageBase', 0) + attribute_bonus['CriticalDamageBase'] = ( + critical_damage_base + 0.25000000023283064 + ) + return attribute_bonus + + +class Relic105(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] + ): + """ + 施放攻击或受到攻击时, 默认叠满 + """ + logger.info('Relic105 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + 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.05000000004656613 * 5 + ) + return attribute_bonus + + +class Relic106(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] + ): + """ + 无 + """ + logger.info('Relic106 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + pass + return attribute_bonus + + +class Relic107(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] + ): + """ + TODO: 检查是否是火属性伤害 + """ + logger.info('Relic107 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4: + e_dmg = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = e_dmg + 0.12000000011175871 + if self.pieces4 and await self.check(base_attr, attribute_bonus): + fire_added_ratio = attribute_bonus.get('FireAddedRatio', 0) + attribute_bonus['FireAddedRatio'] = ( + fire_added_ratio + 0.12000000011175871 + ) + return attribute_bonus + + +class Relic108(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] + ): + """ + 装备者对敌方目标造成伤害 + 目标拥有量子属性弱点 + """ + logger.info('Relic108 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info(attribute_bonus) + ignore_defence = attribute_bonus.get('ignore_defence', 0) + attribute_bonus['ignore_defence'] = ( + ignore_defence + 0.10000000009313226 * 2 + ) + return attribute_bonus + + +class Relic109(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] + ): + """ + TODO: 检查是否释放战技 + """ + logger.info('Relic109 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info(attribute_bonus) + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + 0.20000000018626451 + ) + return attribute_bonus + + +class Relic110(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] + ): + """ + 装备者施放终结技 + """ + logger.info('Relic110 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info('ModifyActionDelay') + pass + return attribute_bonus + + +class Relic111(BaseRelicSetSkill): + def __init__(self, set_id: int, count: int): + super().__init__(set_id, count) + self._count = count + + async def check( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + """ + 装备者击破敌方目标弱点 + """ + logger.info('Relic111 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info('ModifySPNew') + pass + return attribute_bonus + + +class Relic112(BaseRelicSetSkill): + def __init__(self, set_id: int, count: int): + super().__init__(set_id, count) + self._count = count + + async def check( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + """ + 装备者对陷入负面效果的敌方目标造成伤害 + 对陷入禁锢状态的敌方目标造成伤害 + """ + logger.info('Relic111 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info('对陷入负面效果的敌方目标造成伤害') + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + 0.10000000009313226 + ) + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info('对陷入禁锢状态的敌方目标造成伤害') + critical_damage_base = attribute_bonus.get('CriticalDamageBase', 0) + attribute_bonus['CriticalDamageBase'] = ( + critical_damage_base + 0.20000000018626451 + ) + return attribute_bonus + + +class Relic113(BaseRelicSetSkill): + def __init__(self, set_id: int, count: int): + super().__init__(set_id, count) + self._count = count + + async def check( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + """ + 当装备者受到攻击或被我方目标消耗生命值后, 暴击率提高8%, 持续2回合, 该效果最多叠加2层。 + """ + logger.info('Relic113 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + logger.info('当装备者受到攻击或被我方目标消耗生命值后') + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + 0.08000000009313226 * 2 + ) + return attribute_bonus + + +class Relic114(BaseRelicSetSkill): + def __init__(self, set_id: int, count: int): + super().__init__(set_id, count) + self._count = count + + async def check( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + """ + 当装备者对我方目标施放终结技时, 我方全体速度提高12%, 持续1回合, 该效果无法叠加。 + """ + logger.info('Relic114 check success') + return True + + async def set_skill_ability( + self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float] + ): + if self.pieces4 and await self.check(base_attr, attribute_bonus): + speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) + attribute_bonus['SpeedAddedRatio'] = ( + speed_added_ratio + 0.12000000011175871 + ) + return attribute_bonus + + +class Relic301(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] + ): + """ + 装备者的速度大于等于120 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['speed'] >= 120: + logger.info('Relic306 check success') + return True + return False + + 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): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + 0.12000000011175871 + ) + return attribute_bonus + + +class Relic302(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] + ): + """ + 装备者的速度大于等于120 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['speed'] >= 120: + logger.info('Relic306 check success') + return True + return False + + 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): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + 0.0800000000745058 + ) + return attribute_bonus + + +class Relic303(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] + ): + # 提高装备者等同于当前效果命中25%的攻击力,最多提高25% + 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): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + merged_attr = await merge_attribute(base_attr, attribute_bonus) + status_probability = merged_attr.get('StatusProbabilityBase', 0) + # 提高装备者等同于当前效果命中25%的攻击力,最多提高25% + attribute_bonus['AttackAddedRatio'] = attack_added_ratio + min( + 0.25000000023283064, status_probability / 0.25 + ) + return attribute_bonus + + +class Relic304(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] + ): + """ + 备者的效果命中大于等于50% + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['StatusResistanceBase'] >= 0.5000000004656613: + logger.info('Relic306 check success') + return True + return False + + 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): + defence_added_ratio = attribute_bonus.get('DefenceAddedRatio', 0) + attribute_bonus['DefenceAddedRatio'] = ( + defence_added_ratio + 0.1500000001396984 + ) + return attribute_bonus + + +class Relic305(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] + ): + """ + 装备者的暴击伤害大于等于120% + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['CriticalDamageBase'] >= 1.2000000001862645: + logger.info('Relic306 check success') + return True + return False + + 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): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + 0.6000000005587935 + ) + return attribute_bonus + + +class Relic306(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] + ): + """ + 装备者当前暴击率大于等于50% + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['CriticalChanceBase'] >= 0.5: + logger.info('Relic306 check success') + return True + return False + + 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): + q_dmg = attribute_bonus.get('UltraDmgAdd', 0) + attribute_bonus['UltraDmgAdd'] = q_dmg + 0.1500000001396984 + a3_dmg = attribute_bonus.get('TalentDmgAdd', 0) + attribute_bonus['TalentDmgAdd'] = a3_dmg + 0.1500000001396984 + return attribute_bonus + + +class Relic307(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] + ): + """ + 装备者的速度大于等于145 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['speed'] >= 145: + logger.info('Relic306 check success') + return True + return False + + 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): + break_damage_added_ratio_base = attribute_bonus.get( + 'BreakDamageAddedRatioBase', 0 + ) + attribute_bonus['BreakDamageAddedRatioBase'] = ( + break_damage_added_ratio_base + 0.20000000018626451 + ) + return attribute_bonus + + +class Relic308(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] + ): + """ + 装备者的速度大于等于120 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['speed'] >= 120: + logger.info('Relic306 check success') + return True + return False + + 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): + logger.info('ModifyActionDelay') + return attribute_bonus + + +class Relic309(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] + ): + """ + 当装备者的当前暴击率大于等于70%时, 普攻和战技造成的伤害提高20%。 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['CriticalChanceBase'] >= 0.7: + logger.info('Relic309 check success') + return True + return False + + 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): + a_dmg = attribute_bonus.get('NormalDmgAdd', 0) + attribute_bonus['NormalDmgAdd'] = a_dmg + 0.20000000018626451 + a2_dmg = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = a2_dmg + 0.20000000018626451 + return attribute_bonus + + +class Relic310(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] + ): + """ + 当装备者的效果抵抗大于等于30%时, 我方全体暴击伤害提高10%。 + """ + merged_attr = await merge_attribute(base_attr, attribute_bonus) + if merged_attr['StatusResistanceBase'] >= 0.3: + logger.info('Relic310 check success') + return True + return False + + 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): + critical_damage_base = attribute_bonus.get('CriticalDamageBase', 0) + attribute_bonus['CriticalDamageBase'] = ( + critical_damage_base + 0.10000000018626451 + ) + return attribute_bonus + + +class RelicSet: + HEAD: SingleRelic + HAND: SingleRelic + BODY: SingleRelic + FOOT: SingleRelic + NECK: SingleRelic + OBJECT: SingleRelic + Unknow: SingleRelic + + SetSkill: List[ + Union[ + Relic101, + Relic102, + Relic103, + Relic104, + Relic105, + Relic106, + Relic107, + Relic108, + Relic109, + Relic110, + Relic111, + Relic112, + Relic113, + Relic114, + Relic301, + Relic302, + Relic303, + Relic304, + Relic305, + Relic306, + Relic307, + Relic308, + Relic309, + Relic310, + ] + ] + + def create(self, relic_list: List[DamageInstanceRelic]): + set_id_list: List[int] = [] + for relic in relic_list: + set_id_list.append(relic.SetId) + + if relic.Type == 1: + self.HEAD = SingleRelic(relic) + elif relic.Type == 2: + self.HAND = SingleRelic(relic) + elif relic.Type == 3: + self.BODY = SingleRelic(relic) + elif relic.Type == 4: + self.FOOT = SingleRelic(relic) + elif relic.Type == 5: + self.NECK = SingleRelic(relic) + elif relic.Type == 6: + self.OBJECT = SingleRelic(relic) + else: + self.Unknow = SingleRelic(relic) + + self.set_id_counter = Counter(set_id_list).most_common() + self.check_set() + self.get_attribute() + return self + + def get_attribute(self): + for item in self.__dict__: + if type(self.__dict__[item]) == SingleRelic: + itme__: SingleRelic = self.__dict__[item] + itme__.get_attribute_() + + def check_set(self): + self.SetSkill = [] + for item in self.set_id_counter: + set_id = item[0] + count = item[1] + + if set_id == 101: + self.SetSkill.append(Relic101(set_id, count)) + elif set_id == 102: + self.SetSkill.append(Relic102(set_id, count)) + elif set_id == 103: + self.SetSkill.append(Relic103(set_id, count)) + elif set_id == 104: + self.SetSkill.append(Relic104(set_id, count)) + elif set_id == 105: + self.SetSkill.append(Relic105(set_id, count)) + elif set_id == 106: + self.SetSkill.append(Relic106(set_id, count)) + elif set_id == 107: + self.SetSkill.append(Relic107(set_id, count)) + elif set_id == 108: + self.SetSkill.append(Relic108(set_id, count)) + elif set_id == 109: + self.SetSkill.append(Relic109(set_id, count)) + elif set_id == 110: + self.SetSkill.append(Relic110(set_id, count)) + elif set_id == 111: + self.SetSkill.append(Relic111(set_id, count)) + elif set_id == 112: + self.SetSkill.append(Relic112(set_id, count)) + elif set_id == 113: + self.SetSkill.append(Relic113(set_id, count)) + elif set_id == 114: + self.SetSkill.append(Relic114(set_id, count)) + elif set_id == 301: + self.SetSkill.append(Relic301(set_id, count)) + elif set_id == 302: + self.SetSkill.append(Relic302(set_id, count)) + elif set_id == 303: + self.SetSkill.append(Relic303(set_id, count)) + elif set_id == 304: + self.SetSkill.append(Relic304(set_id, count)) + elif set_id == 305: + self.SetSkill.append(Relic305(set_id, count)) + elif set_id == 306: + self.SetSkill.append(Relic306(set_id, count)) + elif set_id == 307: + self.SetSkill.append(Relic307(set_id, count)) + elif set_id == 308: + self.SetSkill.append(Relic308(set_id, count)) + elif set_id == 309: + self.SetSkill.append(Relic309(set_id, count)) + elif set_id == 310: + self.SetSkill.append(Relic310(set_id, count)) + else: + raise Exception(f'Unknow SetId: {set_id}') diff --git a/StarRailUID/starrailuid_charinfo/damage/Relic/__init__.py b/StarRailUID/starrailuid_charinfo/damage/Relic/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/StarRailUID/starrailuid_charinfo/damage/Role.py b/StarRailUID/starrailuid_charinfo/damage/Role.py new file mode 100644 index 0000000..bf2fb53 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Role.py @@ -0,0 +1,258 @@ +import json +from pathlib import Path +from typing import List, Union + +from gsuid_core.logger import logger +from .utils import merge_attribute + +async def demage_num(base_attr, attribute_bonus, skill_type, add_skill_type, element, skill_multiplier, level): + logger.info(f'技能区: {skill_multiplier}') + logger.info(f'skill_type: {skill_type}') + logger.info(f'level: {level}') + # logger.info(f'base_attr: {base_attr}') + # logger.info(f'attribute_bonus: {attribute_bonus}') + # 检查是否有对某一个技能的属性加成 + logger.info('检查是否有对某一个技能的属性加成') + for attr in attribute_bonus: + # 攻击加成 + if attr.__contains__('AttackAddedRatio'): + attr_name = attr.split('AttackAddedRatio')[0] + if attr_name in (skill_type, add_skill_type): + attack_added_ratio = attribute_bonus.get( + 'AttackAddedRatio', 0 + ) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + attribute_bonus[attr] + ) + # 效果命中加成 + if attr.__contains__('StatusProbabilityBase'): + attr_name = attr.split('StatusProbabilityBase')[0] + if attr_name in (skill_type, add_skill_type): + status_probability = attribute_bonus.get( + 'StatusProbabilityBase', 0 + ) + attribute_bonus['StatusProbabilityBase'] = ( + status_probability + attribute_bonus[attr] + ) + + merged_attr = await merge_attribute(base_attr, attribute_bonus) + # logger.info(f'{merged_attr}') + skill_info_list = [] + attack = merged_attr.get('attack', 0) + logger.info(f'攻击力: {attack}') + damage_add = 0 + hp_multiplier = 0 + hp_num = 0 + + # 模拟 同属性弱点 同等级 的怪物 + # 韧性条减伤 + enemy_damage_reduction = 0.1 + damage_reduction = 1 - enemy_damage_reduction + logger.info(f'韧性区: {damage_reduction}') + # 抗性区 + enemy_status_resistance = 0.0 + for attr in merged_attr: + if attr.__contains__('ResistancePenetration'): + # 检查是否有某一属性的抗性穿透 + attr_name = attr.split('ResistancePenetration')[0] + if attr_name in (element, 'AllDamage'): + logger.info(f'{attr_name}属性有{merged_attr[attr]}穿透加成') + enemy_status_resistance += merged_attr[attr] + # 检查是否有某一技能属性的抗性穿透 + if attr_name.__contains__('_'): + skill_name = attr_name.split('_')[0] + skillattr_name = attr_name.split('_')[1] + if skill_name in (skill_type, add_skill_type) and skillattr_name in (element, 'AllDamage'): + enemy_status_resistance += merged_attr[attr] + logger.info( + f'{skill_name}对{skillattr_name}属性有{merged_attr[attr]}穿透加成' + ) + resistance_area = 1.0 - (0 - enemy_status_resistance) + logger.info(f'抗性区: {resistance_area}') + + # 防御区 + # 检查是否有 ignore_defence + logger.info('检查是否有 ignore_defence') + ignore_defence = 1.0 + for attr in merged_attr: + if attr == 'ignore_defence': + ignore_defence = 1 - merged_attr[attr] + break + logger.info(f'ignore_defence {ignore_defence}') + enemy_defence = ( + level * 10 + 200 + ) * ignore_defence + defence_multiplier = (level * 10 + 200) / ( + level * 10 + 200 + enemy_defence + ) + logger.info(f'防御区: {defence_multiplier}') + + # 增伤区 + injury_area = 0 + # 检查是否有对某一个技能的伤害加成 + # logger.info('检查是否有对某一个技能的伤害加成') + for attr in merged_attr: + if attr.__contains__('DmgAdd'): + attr_name = attr.split('DmgAdd')[0] + if attr_name in (skill_type, add_skill_type): + logger.info( + f'{attr} 对 {skill_type} 有 {merged_attr[attr]} 伤害加成' + ) + injury_area += merged_attr[attr] + # 检查有无符合属性的伤害加成 + # logger.info('检查球有无符合属性的伤害加成') + element_area = 0 + for attr in merged_attr: + if attr.__contains__('AddedRatio'): + attr_name = attr.split('AddedRatio')[0] + if attr_name in (element, 'AllDamage'): + logger.info( + f'{attr} 对 {element} ' + f'有 {merged_attr[attr]} 伤害加成' + ) + if attr_name == element: + element_area += merged_attr[attr] + injury_area += merged_attr[attr] + injury_area += 1 + logger.info(f'增伤区: {injury_area}') + + # 易伤区 + # logger.info('检查是否有易伤加成') + damage_ratio = merged_attr.get('DmgRatio', 0) + # 检查是否有对特定技能的易伤加成 + # Talent_DmgRatio + for attr in merged_attr: + if attr.__contains__('_DmgRatio'): + skill_name = attr.split('_')[0] + if skill_name in (skill_type, add_skill_type): + logger.info( + f'{attr} 对 {skill_type} 有 {merged_attr[attr]} 易伤加成' + ) + damage_ratio += merged_attr[attr] + damage_ratio = damage_ratio + 1 + logger.info(f'易伤: {damage_ratio}') + + # 爆伤区 + if skill_type == 'DOT': + critical_damage_base = 0.0 + else: + # logger.info('检查是否有爆伤加成') + # logger.info(f'{merged_attr}') + critical_damage_base = merged_attr.get('CriticalDamageBase', 0) + # 检查是否有对特定技能的爆伤加成 + # Ultra_CriticalChance + for attr in merged_attr: + if attr.__contains__('_CriticalDamageBase'): + skill_name = attr.split('_')[0] + if skill_name in (skill_type, add_skill_type): + logger.info( + f'{attr} 对 {skill_type} 有 ' + f'{merged_attr[attr]} 爆伤加成' + ) + critical_damage_base += merged_attr[attr] + critical_damage = critical_damage_base + 1 + logger.info(f'暴伤: {critical_damage}') + + # 暴击区 + logger.info('检查是否有暴击加成') + critical_chance_base = merged_attr['CriticalChanceBase'] + # 检查是否有对特定技能的爆伤加成 + # Ultra_CriticalChance + for attr in merged_attr: + if attr.__contains__('_CriticalChance'): + skill_name = attr.split('_')[0] + if skill_name in (skill_type, add_skill_type): + logger.info( + f'{attr} 对 {skill_type} 有 ' + f'{merged_attr[attr]} 暴击加成' + ) + critical_chance_base += merged_attr[attr] + critical_chance_base = min(1, critical_chance_base) + logger.info(f'暴击: {critical_chance_base}') + + # 期望伤害 + qiwang_damage = (critical_chance_base * critical_damage_base) + 1 + logger.info(f'暴击期望: {qiwang_damage}') + + attack_tz = 0.0 + injury_add = 0.0 + critical_damage_add = 0 + + damage_cd = ( + attack + * skill_multiplier + * damage_ratio + * (injury_area + injury_add) + * defence_multiplier + * resistance_area + * damage_reduction + * (critical_damage + critical_damage_add) + + damage_add + ) + + damage_qw = ( + attack + * skill_multiplier + * damage_ratio + * (injury_area + injury_add) + * defence_multiplier + * resistance_area + * damage_reduction + * qiwang_damage + + damage_add + ) + + + attr_value_tz: float = base_attr.get('attack', 0) + attribute_atk = attribute_bonus.get('AttackDelta', 0) + attack_tz = ( + attr_value_tz + + attr_value_tz + * ( + 1 + + attribute_bonus.get('AttackAddedRatio', 0) + + 2.144 + ) + + attribute_atk + ) + + injury_add_tz = 0 + + if element == 'Imaginary': + injury_add_tz = 0.12 + + damage_tz = ( + attack_tz + * skill_multiplier + * damage_ratio + * (injury_area + injury_add + injury_add_tz + 2.326) + * defence_multiplier + * resistance_area + * damage_reduction + * (critical_damage + critical_damage_add + 1.594) + * 10 + + damage_add + ) + + + + if element == 'Thunder': + element_area = 0 + damage_tz_fj = ( + attack_tz + * 0.44 + * damage_ratio + * (injury_area + injury_add + 2.326 + element_area) + * defence_multiplier + * resistance_area + * damage_reduction + * (critical_damage + critical_damage_add + 1.594) + * 10 + ) + damage_tz += damage_tz_fj + skill_info_list: List[Union[str, float]] = [] + skill_info_list.append(damage_cd) + skill_info_list.append(damage_qw) + skill_info_list.append(damage_tz) + logger.info(f'暴击: {damage_cd} 期望:{damage_qw} 末日:{damage_tz}') + return skill_info_list diff --git a/StarRailUID/starrailuid_charinfo/damage/Weapon/Weapon.py b/StarRailUID/starrailuid_charinfo/damage/Weapon/Weapon.py new file mode 100644 index 0000000..09be5e6 --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/Weapon/Weapon.py @@ -0,0 +1,1931 @@ +import json +from typing import Dict +from pathlib import Path + +from ..Base.WeaponBase import BaseWeapon +from ..Base.model import DamageInstanceWeapon + +path = Path(__file__).parent.parent +with Path.open(path / 'Excel' / 'weapon_effect.json', encoding='utf-8') as f: + weapon_effect = json.load(f) + + +class Arrows(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者消灭敌方目标 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChance', 0) + attribute_bonus['CriticalChance'] = ( + critical_chance_base + + weapon_effect['20000']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +class ReturntoDarkness(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者消灭敌方目标 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + pass + return attribute_bonus + + +class Swordplay(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者多次击中同一敌方目标时, 每次造成的伤害提高8%, 该效果最多叠加5层 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + ( + weapon_effect['21010']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 5 + ) + return attribute_bonus + + +class DartingArrow(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者消灭敌方目标 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + weapon_effect['20007']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +class Adversarial(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者消灭敌方目标 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) + attribute_bonus['SpeedAddedRatio'] = ( + speed_added_ratio + + weapon_effect['20014']['Param']['SpeedAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + return attribute_bonus + + +class SubscribeforMore(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者的当前能量值等于其能量上限 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0) + attribute_bonus['NormalDmgAdd'] = ( + normal_dmg_add + + ( + weapon_effect['21017']['Param']['a_dmg'][ + self.weapon_rank - 1 + ] + ) + * 2 + ) + bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = ( + bp_skill_dmg_add + + ( + weapon_effect['21017']['Param']['e_dmg'][ + self.weapon_rank - 1 + ] + ) + * 2 + ) + return attribute_bonus + return attribute_bonus + + +class RiverFlowsinSpring(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 进入战斗后,使装备者速度提高8%,造成的伤害提高12%。 + # 当装备者受到伤害后该效果失效,下个回合结束时该效果恢复。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) + attribute_bonus['SpeedAddedRatio'] = ( + speed_added_ratio + + weapon_effect['21024']['Param']['SpeedAddedRatio'][ + self.weapon_rank - 1 + ] + ) + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['21024']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + return attribute_bonus + + +class OnlySilenceRemains(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当场上的敌方目标数量小于等于2时 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['21003']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + return attribute_bonus + + +# 拂晓之前 +class BeforeDawn(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = bp_skill_dmg_add + ( + weapon_effect['23010']['Param']['e_dmg'][self.weapon_rank - 1] + ) + ultra_dmg_add = attribute_bonus.get('UltraDmgAdd', 0) + attribute_bonus['UltraDmgAdd'] = ultra_dmg_add + ( + weapon_effect['23010']['Param']['r_dmg'][self.weapon_rank - 1] + ) + talent_dmg_add = attribute_bonus.get('TalentDmgAdd', 0) + attribute_bonus['TalentDmgAdd'] = talent_dmg_add + ( + weapon_effect['23010']['Param']['t_dmg'][self.weapon_rank - 1] + ) + return attribute_bonus + + +class IntheNight(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + char_speed = ( + base_attr.get('speed', 0) + attribute_bonus.get('SpeedDelta', 0) + ) * (attribute_bonus.get('SpeedAddedRatio', 0) + 1) + count_ = min(6, int((char_speed - 100) / 10)) + normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0) + attribute_bonus['NormalDmgAdd'] = ( + normal_dmg_add + + (weapon_effect['23001']['Param']['a_dmg'][self.weapon_rank - 1]) + * count_ + ) + bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = ( + bp_skill_dmg_add + + (weapon_effect['23001']['Param']['e_dmg'][self.weapon_rank - 1]) + * count_ + ) + ultra_critical_chance_base = attribute_bonus.get( + 'Ultra_CriticalDamageBase', 0 + ) + attribute_bonus['Ultra_CriticalDamageBase'] = ( + ultra_critical_chance_base + + ( + weapon_effect['23001']['Param']['q_crit_dmg'][ + self.weapon_rank - 1 + ] + ) + * count_ + ) + return attribute_bonus + + +class CruisingintheStellarSea(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者对生命值百分比小于等于50%的敌方目标 + # 装备者消灭敌方目标 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['24001']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + weapon_effect['24001']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +class SeriousnessofBreakfast(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者造成伤害提高12% + # 每消灭1个敌方目标, 装备者的攻击力提高4%, 该效果最多叠加3层。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['21027']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + ( + weapon_effect['21027']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + return attribute_bonus + + +# 银河铁道之夜 +class NightontheMilkyWay(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 场上每有1个敌方目标, 使装备者的攻击力提高9% + # 敌方目标的弱点被击破时, 装备者造成的伤害提高30% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + weapon_effect['23000']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['23000']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + return attribute_bonus + + +# 今日亦是和平的一日 +class TodayIsAnotherPeacefulDay(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 根据装备者的能量上限, 提高装备者造成的伤害: 每点能量提高0.2%, 最多计入160点 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + ( + weapon_effect['21034']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * Ultra_Use + ) + return attribute_bonus + + +# 天才们的休憩 +class GeniusesRepose(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者攻击力提高16% + # 当装备者消灭敌方目标后, 暴击伤害提高24% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0) + attribute_bonus['CriticalDamageBase'] = critical_chance_base + ( + weapon_effect['21020']['Param']['CriticalDamageBase'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 别让世界静下来 +class MaketheWorldClamor(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 终结技造成的伤害提高32%。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + ultra_dmg_add = attribute_bonus.get('UltraDmgAdd', 0) + attribute_bonus['UltraDmgAdd'] = ultra_dmg_add + ( + weapon_effect['21013']['Param']['r_dmg'][self.weapon_rank - 1] + ) + return attribute_bonus + + +# 「我」的诞生 +class TheBirthoftheSelf(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 追加攻击造成的伤害提高30% + # 若该敌方目标当前生命值百分比小于等于50%, 则追加攻击造成的伤害额外提高30%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + talent_dmg_add = attribute_bonus.get('TalentDmgAdd', 0) + attribute_bonus['TalentDmgAdd'] = talent_dmg_add + ( + weapon_effect['21006']['Param']['t_dmg'][self.weapon_rank - 1] + ) + return attribute_bonus + return attribute_bonus + + +# 秘密誓心 +class ASecretVow(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 造成的伤害提高20% + # 对当前生命值百分比大于等于装备者自身当前生命值百分比的敌方目标 + # 造成的伤害额外提高20% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['21012']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + return attribute_bonus + + +# 比阳光更明亮的 +class BrighterThantheSun(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者的暴击率提高18% + # 当装备者施放普攻时, 获得1层【龙吟】, 持续2回合。 + # 每层【龙吟】使装备者的攻击力提高18%,【龙吟】最多叠加2层 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + ( + weapon_effect['23015']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 2 + ) + return attribute_bonus + + +# 到不了的彼岸 +class TheUnreachableSide(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者的暴击率提高30%, 生命上限提高30% + # 当装备者受到攻击或装备者消耗自身生命值后, 造成的伤害提高40% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['23009']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 无可取代的东西 +class SomethingIrreplaceable(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者的攻击力提高24% + # 当装备者消灭敌方目标或受到攻击后, 造成的伤害提高24% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['23002']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 记一位星神的陨落 +class OntheFallofanAeon(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者施放攻击时, 使装备者本场战斗中的攻击力提高8%, 该效果最多叠加4层 + # 当装备者击破敌方目标弱点后, 造成的伤害提高12% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + ( + weapon_effect['24000']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 4 + ) + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['24000']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 无处可逃 +class NowheretoRun(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者的攻击力提高24% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 汪! 散步时间! +class WoofWalkTime(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者的攻击力提高10% + # 对处于灼烧或裂伤状态的敌方目标造成的伤害提高16% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + # attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + # attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf( + # weapon_effect['21026']['Param']['AttackAddedRatio'][ + # self.weapon_rank - 1 + # ] + # ) + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['21026']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 在蓝天下 +class UndertheBlueSky(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者攻击力提高16% + # 当装备者消灭敌方目标后, 暴击率提高12% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + # attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + # attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf( + # weapon_effect['21019']['Param']['AttackAddedRatio'][ + # self.weapon_rank - 1 + # ] + # ) + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['21019']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 鼹鼠党欢迎你 +class TheMolesWelcomeYou(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者施放普攻、战技或终结技攻击敌方目标后, + # 分别获取一层【淘气值】。每层使装备者的攻击力提高12%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) + attribute_bonus['AttackAddedRatio'] = ( + attack_added_ratio + + ( + weapon_effect['21005']['Param']['AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + return attribute_bonus + + +# 雨一直下 +class IncessantRain(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者对同时处于大于等于3个负面效果的敌方目标造成伤害时, 暴击率提高12% + # 持有【以太编码】的目标受到的伤害提高12% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + damage_ratio = attribute_bonus.get('DmgRatio', 0) + attribute_bonus['DmgRatio'] = ( + damage_ratio + + weapon_effect['23007']['Param']['DmgRatio'][ + self.weapon_rank - 1 + ] + ) + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['23007']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 只需等待 +class PatienceIsAllYouNeed(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者造成的伤害提高24% + # 装备者每次施放攻击后, 速度提高4.8%, 最多叠加3层。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['23006']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + + speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) + attribute_bonus['SpeedAddedRatio'] = ( + speed_added_ratio + + ( + weapon_effect['23006']['Param']['SpeedAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + return attribute_bonus + + +# 以世界之名 +class IntheNameoftheWorld(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者对陷入负面效果的敌方目标造成的伤害提高24% + # 当装备者施放战技时, 装备者此次攻击的效果命中提高18% + # 当装备者施放战技时, 装备者此次攻击的攻击力提高24%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['23004']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + + a2_status_probability = attribute_bonus.get( + 'BPSkillStatusProbabilityBase', 0 + ) + attribute_bonus['BPSkillStatusProbabilityBase'] = ( + a2_status_probability + + weapon_effect['23004']['Param']['A2_StatusProbability'][ + self.weapon_rank - 1 + ] + ) + + a2_attack_added_ratio = attribute_bonus.get( + 'BPSkillAttackAddedRatio', 0 + ) + attribute_bonus['BPSkillAttackAddedRatio'] = ( + a2_attack_added_ratio + + weapon_effect['23004']['Param']['A2_AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 孤独的疗愈 +class SolitaryHealing(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者的击破特攻提高20% + # 装备者施放终结技时, 使装备者造成的持续伤害提高24% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 新手任务开始前 +class BeforetheTutorialMissionStarts(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者攻击防御力被降低的敌方目标后, 恢复4点能量。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 后会有期 +class WeWillMeetAgain(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者施放普攻或战技后, + # 对随机1个受到攻击的敌方目标造成等同于自身48%攻击力的附加伤害。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 延长记号 +class Fermata(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 对处于触电或风化状态的敌方目标造成的伤害提高16% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['21022']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 决心如汗珠般闪耀 +class ResolutionShinesAsPearlsofSweat(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 对处于触电或风化状态的敌方目标造成的伤害提高16% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + ignore_defence = attribute_bonus.get('ignore_defence', 0) + attribute_bonus['ignore_defence'] = ( + ignore_defence + + weapon_effect['21015']['Param']['ignore_defence'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 猎物的视线 +class EyesofthePrey(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 造成的持续伤害提高24%。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 晚安与睡颜 +class GoodNightandSleepWell(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 敌方目标每承受1个负面效果, 装备者对其造成的伤害提高12%, 最多叠加3层 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + ( + weapon_effect['21001']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + return attribute_bonus + + +# 她已闭上双眼 +class SheAlreadyShutHerEyes(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者的生命值降低时, 使我方全体造成的伤害提高15% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + ( + weapon_effect['23011']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + return attribute_bonus + + +# 制胜的瞬间 +class MomentofVictory(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者受到攻击后, 防御力额外提高24% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + defence_added_ratio = attribute_bonus.get('DefenceAddedRatio', 0) + attribute_bonus['DefenceAddedRatio'] = ( + defence_added_ratio + + weapon_effect['23005']['Param']['DefenceAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 记忆的质料 +class TextureofMemories(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # ... + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 这就是我啦 +class ThisIsMe(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者施放终结技时造成的伤害值提高, 提高数值等同于装备者防御力的60% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 我们是地火 +class WeAreWildfire(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 战斗开始时, 使我方全体受到的伤害降低8% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 宇宙市场趋势 +class TrendoftheUniversalMarket(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者受到攻击后, 有100%的基础概率使敌方目标陷入灼烧状态, + # 每回合造成等同于装备者40%防御力的持续伤害 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 朗道的选择 +class LandausChoice(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者受到攻击的概率提高, 同时受到的伤害降低16%。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 余生的第一天 +class DayOneofMyNewLife(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 进入战斗后, 使我方全体的全属性抗性提高8% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 开疆 +class Pioneering(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 进入战斗后, 使我方全体的全属性抗性提高8% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 戍御 +class Defense(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 进入战斗后, 使我方全体的全属性抗性提高8% + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 琥珀 +class Amber(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者当前生命值百分比小于50%时, 其防御力额外提高16%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + defence_added_ratio = attribute_bonus.get('DefenceAddedRatio', 0) + attribute_bonus['DefenceAddedRatio'] = ( + defence_added_ratio + + weapon_effect['20003']['Param']['DefenceAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 俱殁 +class MutualDemise(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者当前生命值百分比小于80%时, 暴击率提高12% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['20016']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 乐圮 +class ShatteredHome(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者对当前生命值百分比大于50%的敌方目标造成的伤害提高20%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['20009']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 天倾 +class CollapsingSky(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者普攻和战技造成的伤害提高20%。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0) + attribute_bonus['NormalDmgAdd'] = normal_dmg_add + ( + weapon_effect['20002']['Param']['a_dmg'][self.weapon_rank - 1] + ) + bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0) + attribute_bonus['BPSkillDmgAdd'] = bp_skill_dmg_add + ( + weapon_effect['20002']['Param']['e_dmg'][self.weapon_rank - 1] + ) + return attribute_bonus + + +# 匿影 +class HiddenShadow(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 施放战技后, 使装备者的下一次普攻对敌方目标造成等同于自身60%攻击力的附加伤害。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 渊环 +class Loop(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者对减速状态下的敌方目标造成的伤害提高24%。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + all_damage_added_ratio = attribute_bonus.get( + 'AllDamageAddedRatio', 0 + ) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + weapon_effect['20009']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 幽邃 +class Void(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 战斗开始时, 使装备者的效果命中提高20%, 持续3回合。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + status_probability = attribute_bonus.get( + 'StatusProbabilityBase', 0 + ) + attribute_bonus['StatusProbabilityBase'] = ( + status_probability + + weapon_effect['20004']['Param']['StatusProbability'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 睿见 +class Sagacity(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者施放终结技时, 攻击力提高24%, 持续2回合。 + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + a3_attack_added_ratio = attribute_bonus.get( + 'UltraAttackAddedRatio', 0 + ) + attribute_bonus['UltraAttackAddedRatio'] = ( + a3_attack_added_ratio + + weapon_effect['20020']['Param']['A3_AttackAddedRatio'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 灵钥 +class Passkey(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者施放战技后额外恢复8点能量 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + return attribute_bonus + + +# 智库 +class DataBank(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 使装备者终结技造成的伤害提高28%。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + ultra_dmg_add = attribute_bonus.get('UltraDmgAdd', 0) + attribute_bonus['UltraDmgAdd'] = ultra_dmg_add + ( + weapon_effect['20006']['Param']['r_dmg'][self.weapon_rank - 1] + ) + return attribute_bonus + + +# 此身为剑 +class Thisbodyisasword(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当队友受到攻击或消耗生命值后, 装备者获得1层【月蚀】, + # 最多叠加3层。每层【月蚀】使装备者下一次攻击造成的伤害提高14%。 + # 叠满3层时, 额外使该次攻击无视目标12%的防御力。该效果在装备者施放攻击后解除。 + pass + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0) + attribute_bonus['AllDamageAddedRatio'] = ( + all_damage_added_ratio + + ( + weapon_effect['23014']['Param']['AllDamageAddedRatio'][ + self.weapon_rank - 1 + ] + ) + * 3 + ) + + resistance_penetration = attribute_bonus.get( + 'AllResistancePenetration', 0 + ) + attribute_bonus[ + 'AllResistancePenetration' + ] = resistance_penetration + ( + weapon_effect['23014']['Param']['ResistancePenetration'][ + self.weapon_rank - 1 + ] + ) + + return attribute_bonus + + +# 如泥酣眠 +class SleepLiketheDead(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 当装备者的普攻或战技伤害未造成暴击时,使自身暴击率提高36% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) + attribute_bonus['CriticalChanceBase'] = ( + critical_chance_base + + weapon_effect['23012']['Param']['CriticalChance'][ + self.weapon_rank - 1 + ] + ) + return attribute_bonus + + +# 烦恼着,幸福着 +class WorrisomeBlissf(BaseWeapon): + weapon_base_attributes: Dict + + def __init__(self, weapon: DamageInstanceWeapon): + super().__init__(weapon) + + async def check(self): + # 装备者施放追加攻击后,使目标陷入【温驯】状态,该效果最多叠加2层.我方目标击中【温驯】状态下的敌方目标时,每层【温驯】使造成的暴击伤害提高12% + return True + + async def weapon_ability( + self, + Ultra_Use: float, + base_attr: Dict[str, float], + attribute_bonus: Dict[str, float], + ): + critical_chance_base = attribute_bonus.get('TalentDmgAdd', 0) + attribute_bonus['TalentDmgAdd'] = ( + critical_chance_base + + weapon_effect['23016']['Param']['TalentDmgAdd'][ + self.weapon_rank - 1 + ] + ) + if await self.check(): + critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0) + attribute_bonus['CriticalDamageBase'] = ( + critical_chance_base + + ( + weapon_effect['23016']['Param']['CriticalDamageBase'][ + self.weapon_rank - 1 + ] + ) + * 2 + ) + return attribute_bonus + + +class Weapon: + @classmethod + def create(cls, weapon: DamageInstanceWeapon): + if weapon.id_ in [ + 23011, + 23007, + 21005, + 21019, + 21026, + 21033, + 24000, + 23002, + 23009, + 23015, + 21012, + 21006, + 21013, + 21027, + 21020, + 21034, + 23000, + 23010, + 23001, + 21003, + 23012, + 24001, + 21024, + 21017, + 20014, + 20007, + 21010, + 21031, + 20000, + 23006, + 23004, + 24003, + 22000, + 21029, + 21022, + 21015, + 21008, + 21001, + 23005, + 24002, + 21030, + 21023, + 21016, + 21009, + 21002, + 20017, + 20010, + 20003, + 20016, + 20009, + 20002, + 20018, + 20011, + 20004, + 20020, + 20013, + 20006, + 23014, + 23016, + ]: + if weapon.id_ == 23016: + return WorrisomeBlissf(weapon) + if weapon.id_ == 23012: + return SleepLiketheDead(weapon) + if weapon.id_ == 23014: + return Thisbodyisasword(weapon) + if weapon.id_ == 20006: + return DataBank(weapon) + if weapon.id_ == 20013: + return Passkey(weapon) + if weapon.id_ == 20020: + return Sagacity(weapon) + if weapon.id_ == 20004: + return Void(weapon) + if weapon.id_ == 20011: + return Loop(weapon) + if weapon.id_ == 20018: + return HiddenShadow(weapon) + if weapon.id_ == 20002: + return CollapsingSky(weapon) + if weapon.id_ == 20009: + return ShatteredHome(weapon) + if weapon.id_ == 20016: + return MutualDemise(weapon) + if weapon.id_ == 20003: + return Amber(weapon) + if weapon.id_ == 20010: + return Defense(weapon) + if weapon.id_ == 20017: + return Pioneering(weapon) + if weapon.id_ == 21002: + return DayOneofMyNewLife(weapon) + if weapon.id_ == 21009: + return LandausChoice(weapon) + if weapon.id_ == 21016: + return TrendoftheUniversalMarket(weapon) + if weapon.id_ == 21023: + return WeAreWildfire(weapon) + if weapon.id_ == 21030: + return ThisIsMe(weapon) + if weapon.id_ == 24002: + return TextureofMemories(weapon) + if weapon.id_ == 23005: + return MomentofVictory(weapon) + if weapon.id_ == 23011: + return SheAlreadyShutHerEyes(weapon) + if weapon.id_ == 21001: + return GoodNightandSleepWell(weapon) + if weapon.id_ == 21008: + return EyesofthePrey(weapon) + if weapon.id_ == 21015: + return ResolutionShinesAsPearlsofSweat(weapon) + if weapon.id_ == 21022: + return Fermata(weapon) + if weapon.id_ == 21029: + return WeWillMeetAgain(weapon) + if weapon.id_ == 22000: + return BeforetheTutorialMissionStarts(weapon) + if weapon.id_ == 24003: + return SolitaryHealing(weapon) + if weapon.id_ == 23004: + return IntheNameoftheWorld(weapon) + if weapon.id_ == 23006: + return PatienceIsAllYouNeed(weapon) + if weapon.id_ == 23007: + return IncessantRain(weapon) + if weapon.id_ == 21005: + return TheMolesWelcomeYou(weapon) + if weapon.id_ == 21019: + return UndertheBlueSky(weapon) + if weapon.id_ == 21026: + return WoofWalkTime(weapon) + if weapon.id_ == 21033: + return NowheretoRun(weapon) + if weapon.id_ == 24000: + return OntheFallofanAeon(weapon) + if weapon.id_ == 23002: + return SomethingIrreplaceable(weapon) + if weapon.id_ == 23009: + return TheUnreachableSide(weapon) + if weapon.id_ == 23015: + return BrighterThantheSun(weapon) + if weapon.id_ == 21012: + return ASecretVow(weapon) + if weapon.id_ == 21006: + return TheBirthoftheSelf(weapon) + if weapon.id_ == 21013: + return MaketheWorldClamor(weapon) + if weapon.id_ == 21020: + return GeniusesRepose(weapon) + if weapon.id_ == 21027: + return SeriousnessofBreakfast(weapon) + if weapon.id_ == 21034: + return TodayIsAnotherPeacefulDay(weapon) + if weapon.id_ == 23000: + return NightontheMilkyWay(weapon) + if weapon.id_ == 23010: + return BeforeDawn(weapon) + if weapon.id_ == 24001: + return CruisingintheStellarSea(weapon) + if weapon.id_ == 23001: + return IntheNight(weapon) + if weapon.id_ == 21003: + return OnlySilenceRemains(weapon) + if weapon.id_ == 21024: + return RiverFlowsinSpring(weapon) + if weapon.id_ == 20014: + return Adversarial(weapon) + if weapon.id_ == 20007: + return DartingArrow(weapon) + if weapon.id_ == 21010: + return Swordplay(weapon) + if weapon.id_ == 21031: + return ReturntoDarkness(weapon) + if weapon.id_ == 20000: + return Arrows(weapon) + raise ValueError(f'未知武器id: {weapon.id_}') + raise ValueError(f'不支持的武器种类: {weapon.id_}') diff --git a/StarRailUID/starrailuid_charinfo/damage/Weapon/__init__.py b/StarRailUID/starrailuid_charinfo/damage/Weapon/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/StarRailUID/starrailuid_charinfo/damage/__init__.py b/StarRailUID/starrailuid_charinfo/damage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/StarRailUID/starrailuid_charinfo/damage/utils.py b/StarRailUID/starrailuid_charinfo/damage/utils.py new file mode 100644 index 0000000..61ac5df --- /dev/null +++ b/StarRailUID/starrailuid_charinfo/damage/utils.py @@ -0,0 +1,65 @@ +from typing import Dict + + +async def merge_attribute( + base_attr: Dict[str, float], attribute_bonus: Dict[str, float] +): + # hp attack defence need base_value and add_value + merged_attr: Dict[str, float] = {} + attr_list = ['attack', 'defence', 'hp', 'speed'] + for attribute in attribute_bonus: + if ( + attribute.__contains__('Attack') + or attribute.__contains__('Defence') + or attribute.__contains__('HP') + or attribute.__contains__('Speed') + ): + if attribute.__contains__('Delta'): + attr = attribute.split('Delta')[0].lower() + if attr in attr_list: + attr_value = merged_attr.get(attr, 0) + merged_attr[attr] = attr_value + attribute_bonus[attribute] + elif attribute.__contains__('AddedRatio'): + attr = attribute.split('AddedRatio')[0].lower() + if attr in attr_list: + attr_value = merged_attr.get(attr, 0) + merged_attr[attr] = attr_value + base_attr[attr] * ( + 1 + attribute_bonus[attribute] + ) + else: + raise Exception(f'attribute error {attribute}') + elif attribute.__contains__('Base'): + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute.__contains__('AddedRatio'): + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute.__contains__('DmgAdd'): + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute.__contains__('DmgRatio'): + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute == 'ignore_defence': + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute.__contains__('ResistancePenetration'): + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute == 'Atk_buff': + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute == 'Normal_buff': + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + elif attribute == 'shield_added_ratio': + attr_value = base_attr.get(attribute, 0) + merged_attr[attribute] = attr_value + attribute_bonus[attribute] + else: + continue + for attr in base_attr: + merged_value = merged_attr.get(attr, 0) + if merged_value == 0: + merged_attr[attr] = base_attr[attr] + + return merged_attr diff --git a/StarRailUID/starrailuid_charinfo/effect/Role.py b/StarRailUID/starrailuid_charinfo/effect/Role.py index e096a61..ff5d813 100644 --- a/StarRailUID/starrailuid_charinfo/effect/Role.py +++ b/StarRailUID/starrailuid_charinfo/effect/Role.py @@ -19,7 +19,7 @@ with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f: class RoleInstance: def __init__(self, raw_data: Character): self.raw_data = DamageInstance(raw_data) - + self.avatar = Avatar.create(self.raw_data.avatar, self.raw_data.skill) self.weapon = Weapon.create(self.raw_data.weapon) self.relic_set = RelicSet().create(self.raw_data.relic)