在伤害计算中提供typing支持

This commit is contained in:
qwerdvd 2023-09-11 14:44:17 +08:00
parent f0e8492a9b
commit 16942a83a0
6 changed files with 390 additions and 198 deletions

View File

@ -1,13 +1,14 @@
import json
from typing import List
from pathlib import Path
from abc import abstractmethod
from pathlib import Path
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
from .model import DamageInstanceAvatar, DamageInstanceSkill
from .SkillBase import BaseSkills
path = Path(__file__).parent.parent
with Path.open(path / 'Excel' / 'SkillData.json', encoding='utf-8') as f:
@ -107,7 +108,8 @@ class BaseAvatar:
def Skill_Info(self, skill_type: str):
skill_info = skill_dict[str(self.avatar_id)]['skillList'][skill_type]
return skill_info
skill_info_ = msgspec.convert(skill_info, type=List[Union[str, int]])
return skill_info_
def Normalnum(self, skill_type: str) -> float:
return skill_dict[str(self.avatar_id)][skill_type][
@ -139,17 +141,17 @@ class BaseAvatar:
self.Skill.Talent_.level - 1
]
def BPSkill_num(self, skill_type) -> float:
def BPSkill_num(self, skill_type: str) -> float:
return skill_dict[str(self.avatar_id)][skill_type][
self.Skill.BPSkill_.level - 1
]
def Ultra_num(self, skill_type) -> float:
def Ultra_num(self, skill_type: str) -> float:
return skill_dict[str(self.avatar_id)][skill_type][
self.Skill.Ultra_.level - 1
]
def Talent_num(self, skill_type) -> float:
def Talent_num(self, skill_type: str) -> float:
return skill_dict[str(self.avatar_id)][skill_type][
self.Skill.Talent_.level - 1
]

View File

@ -1,10 +1,10 @@
from typing import Dict
from abc import abstractmethod
from typing import Dict
from gsuid_core.logger import logger
from .model import DamageInstanceRelic
from ....utils.map.SR_MAP_PATH import RelicSetSkill
from .model import DamageInstanceRelic
class SingleRelic:
@ -51,15 +51,19 @@ class BaseRelicSetSkill:
if count == 4:
self.pieces4 = True
logger.info(f'Relic {set_id} 4 pieces set activated')
self.relicSetAttribute = {}
self.relicSetAttribute: Dict[str, float] = {}
self.set_skill_property_ability()
@abstractmethod
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
...
@abstractmethod
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
async def set_skill_ability(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
战斗加成属性, set_skill_property() 互斥
'''
@ -81,3 +85,4 @@ class BaseRelicSetSkill:
)
else:
self.relicSetAttribute[set_property] = set_value
return self.relicSetAttribute

View File

@ -1,25 +1,29 @@
from typing import Dict, List
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
from ..Base.RelicBase import BaseRelicSetSkill, SingleRelic
from ..utils import merge_attribute
class Relic101(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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
@ -29,14 +33,18 @@ class Relic102(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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
@ -47,14 +55,18 @@ class Relic103(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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'] = (
@ -67,14 +79,18 @@ class Relic104(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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'] = (
@ -87,14 +103,18 @@ class Relic105(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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'] = (
@ -107,14 +127,18 @@ class Relic106(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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
@ -124,14 +148,18 @@ class Relic107(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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)
q_dmg = attribute_bonus.get('UltraSkillDmgAdd', 0)
@ -149,7 +177,9 @@ class Relic108(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者对敌方目标造成伤害
目标拥有量子属性弱点
@ -157,7 +187,9 @@ class Relic108(BaseRelicSetSkill):
logger.info('Relic108 check success')
return True
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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)
@ -171,14 +203,18 @@ class Relic109(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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)
@ -192,14 +228,18 @@ class Relic110(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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
@ -211,14 +251,18 @@ class Relic111(BaseRelicSetSkill):
super().__init__(set_id, count)
self._count = count
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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
@ -230,7 +274,9 @@ class Relic112(BaseRelicSetSkill):
super().__init__(set_id, count)
self._count = count
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者对陷入负面效果的敌方目标造成伤害
对陷入禁锢状态的敌方目标造成伤害
@ -238,7 +284,9 @@ class Relic112(BaseRelicSetSkill):
logger.info('Relic111 check success')
return True
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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)
@ -259,14 +307,18 @@ class Relic113(BaseRelicSetSkill):
super().__init__(set_id, count)
self._count = count
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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)
@ -281,14 +333,18 @@ class Relic114(BaseRelicSetSkill):
super().__init__(set_id, count)
self._count = count
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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'] = (
@ -301,7 +357,9 @@ class Relic301(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者的速度大于等于120
'''
@ -309,9 +367,11 @@ class Relic301(BaseRelicSetSkill):
if merged_attr['speed'] >= 120:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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'] = (
@ -324,7 +384,9 @@ class Relic302(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者的速度大于等于120
'''
@ -332,9 +394,11 @@ class Relic302(BaseRelicSetSkill):
if merged_attr['speed'] >= 120:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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'] = (
@ -347,11 +411,15 @@ class Relic303(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
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, attribute_bonus: Dict):
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)
@ -367,7 +435,9 @@ class Relic304(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
备者的效果命中大于等于50%
'''
@ -375,9 +445,11 @@ class Relic304(BaseRelicSetSkill):
if merged_attr['StatusResistanceBase'] >= 0.5000000004656613:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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'] = (
@ -390,7 +462,9 @@ class Relic305(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者的暴击伤害大于等于120%
'''
@ -398,9 +472,11 @@ class Relic305(BaseRelicSetSkill):
if merged_attr['CriticalDamageBase'] >= 1.2000000001862645:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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'] = (
@ -413,7 +489,9 @@ class Relic306(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者当前暴击率大于等于50%
'''
@ -421,9 +499,11 @@ class Relic306(BaseRelicSetSkill):
if merged_attr['CriticalChanceBase'] >= 0.5:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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
@ -436,7 +516,9 @@ class Relic307(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者的速度大于等于145
'''
@ -444,9 +526,11 @@ class Relic307(BaseRelicSetSkill):
if merged_attr['speed'] >= 145:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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
@ -461,7 +545,9 @@ class Relic308(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
装备者的速度大于等于120
'''
@ -469,9 +555,11 @@ class Relic308(BaseRelicSetSkill):
if merged_attr['speed'] >= 120:
logger.info('Relic306 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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
@ -481,7 +569,9 @@ class Relic309(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
当装备者的当前暴击率大于等于70%普攻和战技造成的伤害提高20%
'''
@ -489,9 +579,11 @@ class Relic309(BaseRelicSetSkill):
if merged_attr['CriticalChanceBase'] >= 0.7:
logger.info('Relic309 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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
@ -504,7 +596,9 @@ class Relic310(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int):
super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict):
async def check(
self, base_attr: Dict[str, float], attribute_bonus: Dict[str, float]
):
'''
当装备者的效果抵抗大于等于30%我方全体暴击伤害提高10%
'''
@ -512,9 +606,11 @@ class Relic310(BaseRelicSetSkill):
if merged_attr['StatusResistanceBase'] >= 0.3:
logger.info('Relic310 check success')
return True
return None
return False
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
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'] = (
@ -532,97 +628,117 @@ class RelicSet:
OBJECT: SingleRelic
Unknow: SingleRelic
set_id_counter: List = []
SetSkill: List
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,
]]
@classmethod
def create(cls, relic_list: List[DamageInstanceRelic]):
cls.SetSkill = []
set_id_list = []
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:
cls.HEAD = SingleRelic(relic)
self.HEAD = SingleRelic(relic)
elif relic.Type == 2:
cls.HAND = SingleRelic(relic)
self.HAND = SingleRelic(relic)
elif relic.Type == 3:
cls.BODY = SingleRelic(relic)
self.BODY = SingleRelic(relic)
elif relic.Type == 4:
cls.FOOT = SingleRelic(relic)
self.FOOT = SingleRelic(relic)
elif relic.Type == 5:
cls.NECK = SingleRelic(relic)
self.NECK = SingleRelic(relic)
elif relic.Type == 6:
cls.OBJECT = SingleRelic(relic)
self.OBJECT = SingleRelic(relic)
else:
cls.Unknow = SingleRelic(relic)
self.Unknow = SingleRelic(relic)
cls.set_id_counter: List = Counter(set_id_list).most_common()
cls.check_set()
cls.get_attribute()
return cls
self.set_id_counter = Counter(set_id_list).most_common()
self.check_set()
self.get_attribute()
return self
@classmethod
def get_attribute(cls):
for item in cls.__dict__:
if type(cls.__dict__[item]) == SingleRelic:
itme__: SingleRelic = cls.__dict__[item]
def get_attribute(self):
for item in self.__dict__:
if type(self.__dict__[item]) == SingleRelic:
itme__: SingleRelic = self.__dict__[item]
itme__.get_attribute_()
@classmethod
def check_set(cls):
for item in cls.set_id_counter:
def check_set(self):
self.SetSkill = []
for item in self.set_id_counter:
set_id = item[0]
count = item[1]
# if count == 1:
# break
if set_id == 101:
cls.SetSkill.append(Relic101(set_id, count))
self.SetSkill.append(Relic101(set_id, count))
elif set_id == 102:
cls.SetSkill.append(Relic102(set_id, count))
self.SetSkill.append(Relic102(set_id, count))
elif set_id == 103:
cls.SetSkill.append(Relic103(set_id, count))
self.SetSkill.append(Relic103(set_id, count))
elif set_id == 104:
cls.SetSkill.append(Relic104(set_id, count))
self.SetSkill.append(Relic104(set_id, count))
elif set_id == 105:
cls.SetSkill.append(Relic105(set_id, count))
self.SetSkill.append(Relic105(set_id, count))
elif set_id == 106:
cls.SetSkill.append(Relic106(set_id, count))
self.SetSkill.append(Relic106(set_id, count))
elif set_id == 107:
cls.SetSkill.append(Relic107(set_id, count))
self.SetSkill.append(Relic107(set_id, count))
elif set_id == 108:
cls.SetSkill.append(Relic108(set_id, count))
self.SetSkill.append(Relic108(set_id, count))
elif set_id == 109:
cls.SetSkill.append(Relic109(set_id, count))
self.SetSkill.append(Relic109(set_id, count))
elif set_id == 110:
cls.SetSkill.append(Relic110(set_id, count))
self.SetSkill.append(Relic110(set_id, count))
elif set_id == 111:
cls.SetSkill.append(Relic111(set_id, count))
self.SetSkill.append(Relic111(set_id, count))
elif set_id == 112:
cls.SetSkill.append(Relic112(set_id, count))
self.SetSkill.append(Relic112(set_id, count))
elif set_id == 113:
cls.SetSkill.append(Relic113(set_id, count))
self.SetSkill.append(Relic113(set_id, count))
elif set_id == 114:
cls.SetSkill.append(Relic114(set_id, count))
self.SetSkill.append(Relic114(set_id, count))
elif set_id == 301:
cls.SetSkill.append(Relic301(set_id, count))
self.SetSkill.append(Relic301(set_id, count))
elif set_id == 302:
cls.SetSkill.append(Relic302(set_id, count))
self.SetSkill.append(Relic302(set_id, count))
elif set_id == 303:
cls.SetSkill.append(Relic303(set_id, count))
self.SetSkill.append(Relic303(set_id, count))
elif set_id == 304:
cls.SetSkill.append(Relic304(set_id, count))
self.SetSkill.append(Relic304(set_id, count))
elif set_id == 305:
cls.SetSkill.append(Relic305(set_id, count))
self.SetSkill.append(Relic305(set_id, count))
elif set_id == 306:
cls.SetSkill.append(Relic306(set_id, count))
self.SetSkill.append(Relic306(set_id, count))
elif set_id == 307:
cls.SetSkill.append(Relic307(set_id, count))
self.SetSkill.append(Relic307(set_id, count))
elif set_id == 308:
cls.SetSkill.append(Relic308(set_id, count))
self.SetSkill.append(Relic308(set_id, count))
elif set_id == 309:
cls.SetSkill.append(Relic309(set_id, count))
self.SetSkill.append(Relic309(set_id, count))
elif set_id == 310:
cls.SetSkill.append(Relic310(set_id, count))
self.SetSkill.append(Relic310(set_id, count))
else:
raise Exception(f'Unknow SetId: {set_id}')

View File

@ -14,10 +14,10 @@ class RoleInstance:
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)
self.relic_set = RelicSet().create(self.raw_data.relic)
self.base_attr = self.cal_role_base_attr()
self.attribute_bonus = {}
self.attribute_bonus: dict[str, float] = {}
self.cal_relic_attr_add()
self.cal_avatar_attr_add()
@ -26,7 +26,7 @@ class RoleInstance:
def cal_role_base_attr(self):
logger.info('cal_role_base_attr')
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:
@ -198,7 +198,7 @@ class RoleInstance:
for attr in self.attribute_bonus:
# 攻击加成
if attr.__contains__('AttackAddedRatio'):
attr_name: str = attr.split('AttackAddedRatio')[0]
attr_name = attr.split('AttackAddedRatio')[0]
if attr_name == skill_type or attr_name == skill_info[3]:
attack_added_ratio = self.attribute_bonus.get(
'AttackAddedRatio', 0
@ -231,6 +231,8 @@ class RoleInstance:
skill_info_list = []
# 技能类型为攻击
if skill_info[0] == 'attack':
if isinstance(skill_info[2], str):
raise Exception('skill_info[2] is str')
skill_multiplier = skill_multiplier / skill_info[2]
logger.info(f'技能区单段: {skill_multiplier}')
if self.raw_data.avatar.id_ == 1004:
@ -295,7 +297,7 @@ class RoleInstance:
damage_reduction = 1 - enemy_damage_reduction
logger.info(f'韧性区: {damage_reduction}')
# 抗性区
enemy_status_resistance = 0
enemy_status_resistance = 0.0
for attr in merged_attr:
if attr.__contains__('ResistancePenetration'):
attr_name = attr.split('ResistancePenetration')[0]
@ -305,7 +307,7 @@ class RoleInstance:
):
# 先默认触发
enemy_status_resistance = merged_attr[attr]
resistance_area = 1 - (0 - enemy_status_resistance)
resistance_area = 1.0 - (0 - enemy_status_resistance)
if self.raw_data.avatar.id_ == 1213:
if skill_info[2] == 7:
Normal_Penetration = merged_attr.get(
@ -319,7 +321,7 @@ class RoleInstance:
# 防御区
# 检查是否有 ignore_defence
logger.info('检查是否有 ignore_defence')
ignore_defence = 1
ignore_defence = 1.0
for attr in merged_attr:
if attr == 'ignore_defence':
ignore_defence = 1 - merged_attr[attr]
@ -384,7 +386,7 @@ class RoleInstance:
# 爆伤区
if skill_type == 'DOT':
critical_damage_base = 0
critical_damage_base = 0.0
else:
logger.info('检查是否有爆伤加成')
logger.info(f'{merged_attr}')

View File

@ -21,7 +21,8 @@ class Arrows(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -45,7 +46,8 @@ class ReturntoDarkness(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
if await self.check():
pass
@ -63,7 +65,8 @@ class Swordplay(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -89,7 +92,8 @@ class DartingArrow(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -113,7 +117,8 @@ class Adversarial(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -138,7 +143,8 @@ class SubscribeforMore(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -177,7 +183,8 @@ class RiverFlowsinSpring(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -212,7 +219,8 @@ class SleepLiketheDead(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
if await self.check():
return attribute_bonus
@ -230,7 +238,8 @@ class OnlySilenceRemains(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -255,7 +264,8 @@ class BeforeDawn(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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 + (
@ -282,7 +292,8 @@ class IntheNight(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -327,7 +338,8 @@ class CruisingintheStellarSea(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -360,7 +372,8 @@ class SeriousnessofBreakfast(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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'] = (
@ -393,7 +406,8 @@ class NightontheMilkyWay(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -428,7 +442,8 @@ class TodayIsAnotherPeacefulDay(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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'] = (
@ -453,7 +468,8 @@ class GeniusesRepose(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -477,7 +493,8 @@ class MaketheWorldClamor(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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 + (
@ -499,7 +516,8 @@ class TheBirthoftheSelf(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -519,11 +537,13 @@ class ASecretVow(BaseWeapon):
async def check(self):
# 造成的伤害提高20%
# 对当前生命值百分比大于等于装备者自身当前生命值百分比的敌方目标造成的伤害额外提高20%
# 对当前生命值百分比大于等于装备者自身当前生命值百分比的敌方目标
# 造成的伤害额外提高20%
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -548,11 +568,13 @@ class BrighterThantheSun(BaseWeapon):
async def check(self):
# 使装备者的暴击率提高18%
# 当装备者施放普攻时获得1层【龙吟】持续2回合。每层【龙吟】使装备者的攻击力提高18%,【龙吟】最多叠加2层
# 当装备者施放普攻时获得1层【龙吟】持续2回合。
# 每层【龙吟】使装备者的攻击力提高18%,【龙吟】最多叠加2层
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -578,7 +600,8 @@ class TheUnreachableSide(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -606,7 +629,8 @@ class SomethingIrreplaceable(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -634,7 +658,8 @@ class OntheFallofanAeon(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -668,7 +693,8 @@ class NowheretoRun(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -692,7 +718,8 @@ class WoofWalkTime(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -726,7 +753,8 @@ class UndertheBlueSky(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -753,11 +781,13 @@ class TheMolesWelcomeYou(BaseWeapon):
super().__init__(weapon)
async def check(self):
# 装备者施放普攻、战技或终结技攻击敌方目标后分别获取一层【淘气值】。每层使装备者的攻击力提高12%。
# 装备者施放普攻、战技或终结技攻击敌方目标后,
# 分别获取一层【淘气值】。每层使装备者的攻击力提高12%。
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -783,7 +813,8 @@ class IncessantRain(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -816,7 +847,8 @@ class PatienceIsAllYouNeed(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -853,7 +885,8 @@ class IntheNameoftheWorld(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -901,7 +934,8 @@ class SolitaryHealing(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -918,7 +952,8 @@ class BeforetheTutorialMissionStarts(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -931,11 +966,13 @@ class WeWillMeetAgain(BaseWeapon):
super().__init__(weapon)
async def check(self):
# 装备者施放普攻或战技后对随机1个受到攻击的敌方目标造成等同于自身48%攻击力的附加伤害。
# 装备者施放普攻或战技后,
# 对随机1个受到攻击的敌方目标造成等同于自身48%攻击力的附加伤害。
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -952,7 +989,8 @@ class Fermata(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -979,7 +1017,8 @@ class ResolutionShinesAsPearlsofSweat(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -1004,7 +1043,8 @@ class EyesofthePrey(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1021,7 +1061,8 @@ class GoodNightandSleepWell(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -1048,7 +1089,8 @@ class SheAlreadyShutHerEyes(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -1075,7 +1117,8 @@ class MomentofVictory(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -1100,7 +1143,8 @@ class TextureofMemories(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1117,7 +1161,8 @@ class ThisIsMe(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1134,7 +1179,8 @@ class WeAreWildfire(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1147,11 +1193,13 @@ class TrendoftheUniversalMarket(BaseWeapon):
super().__init__(weapon)
async def check(self):
# 当装备者受到攻击后有100%的基础概率使敌方目标陷入灼烧状态每回合造成等同于装备者40%防御力的持续伤害
# 当装备者受到攻击后有100%的基础概率使敌方目标陷入灼烧状态,
# 每回合造成等同于装备者40%防御力的持续伤害
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1168,7 +1216,8 @@ class LandausChoice(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1185,7 +1234,8 @@ class DayOneofMyNewLife(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1202,7 +1252,8 @@ class Pioneering(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1219,7 +1270,8 @@ class Defense(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1236,7 +1288,8 @@ class Amber(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -1261,7 +1314,8 @@ class MutualDemise(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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)
@ -1286,7 +1340,8 @@ class ShatteredHome(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -1313,7 +1368,8 @@ class CollapsingSky(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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 + (
@ -1338,7 +1394,8 @@ class HiddenShadow(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1355,7 +1412,8 @@ class Loop(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -1382,7 +1440,8 @@ class Void(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
if await self.check():
status_probability = attribute_bonus.get(
@ -1409,7 +1468,8 @@ class Sagacity(BaseWeapon):
return True
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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(
@ -1436,7 +1496,8 @@ class Passkey(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
self, Ultra_Use: float, base_attr: Dict[str, float],
attribute_bonus: Dict[str, float]
):
return attribute_bonus
@ -1453,7 +1514,8 @@ class DataBank(BaseWeapon):
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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 + (
@ -1470,11 +1532,14 @@ class Thisbodyisasword(BaseWeapon):
super().__init__(weapon)
async def check(self):
# 当队友受到攻击或消耗生命值后装备者获得1层【月蚀】最多叠加3层。每层【月蚀】使装备者下一次攻击造成的伤害提高14%。叠满3层时额外使该次攻击无视目标12%的防御力。该效果在装备者施放攻击后解除。
# 当队友受到攻击或消耗生命值后装备者获得1层【月蚀】
# 最多叠加3层。每层【月蚀】使装备者下一次攻击造成的伤害提高14%。
# 叠满3层时额外使该次攻击无视目标12%的防御力。该效果在装备者施放攻击后解除。
pass
async def weapon_ability(
self, Ultra_Use: float, base_attr: Dict, attribute_bonus: Dict
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'] = (

View File

@ -1,9 +1,11 @@
from typing import Dict
async def merge_attribute(base_attr: Dict, attribute_bonus: Dict) -> 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 = {}
merged_attr: Dict[str, float] = {}
attr_list = ['attack', 'defence', 'hp', 'speed']
for attribute in attribute_bonus:
if (