♻️ 支持更多角色

This commit is contained in:
qwerdvd 2023-09-05 19:25:19 +08:00
parent 433af75eee
commit 270a15fe20
12 changed files with 1856 additions and 208 deletions

View File

@ -1,7 +1,5 @@
import re import re
from pathlib import Path from pathlib import Path
# import json
from typing import Tuple, cast from typing import Tuple, cast
from PIL import Image from PIL import Image
@ -15,11 +13,7 @@ from ..utils.error_reply import UID_HINT
from ..utils.image.convert import convert_img from ..utils.image.convert import convert_img
from ..utils.resource.RESOURCE_PATH import TEMP_PATH from ..utils.resource.RESOURCE_PATH import TEMP_PATH
from ..utils.sr_prefix import PREFIX from ..utils.sr_prefix import PREFIX
from .cal_damage import cal from .draw_char_img import cal, draw_char_info_img, get_char_data
from .draw_char_img import (
draw_char_info_img,
get_char_data,
)
from .to_card import api_to_card from .to_card import api_to_card
sv_char_info_config = SV('sr面板设置', pm=2) sv_char_info_config = SV('sr面板设置', pm=2)
@ -27,6 +21,31 @@ sv_get_char_info = SV('sr面板查询', priority=10)
sv_get_sr_original_pic = SV('sr查看面板原图', priority=5) sv_get_sr_original_pic = SV('sr查看面板原图', priority=5)
sv_char_damage_cal = SV('sr伤害计算') sv_char_damage_cal = SV('sr伤害计算')
@sv_char_damage_cal.on_prefix(f'{PREFIX}伤害计算')
async def send_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_data = await get_char_data(sr_uid, char_name)
if isinstance(char_data, str):
return await bot.send(char_data)
im_list = []
im = await cal(char_data)
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_get_char_info.on_prefix(f'{PREFIX}查询') @sv_get_char_info.on_prefix(f'{PREFIX}查询')
async def send_char_info(bot: Bot, ev: Event): async def send_char_info(bot: Bot, ev: Event):
@ -77,25 +96,3 @@ async def send_card_info(bot: Bot, ev: Event):
await bot.logger.info(f'UID{uid}获取角色数据成功!') await bot.logger.info(f'UID{uid}获取角色数据成功!')
await bot.send(im) await bot.send(im)
return None return None
@sv_char_damage_cal.on_prefix(f'{PREFIX}伤害计算')
async def send_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_data = await get_char_data(sr_uid, char_name)
if isinstance(char_data, str):
return await bot.send(char_data)
im = await cal(char_data)
await bot.send(im)
return None

View File

@ -1,20 +0,0 @@
from typing import Dict
from mpmath import mp
from .draw_char_img import cal_char_info
from .effect.Role import RoleInstance
mp.dps = 14
async def cal(char_data: Dict):
char = await cal_char_info(char_data)
im = []
for skill_type in ['Normal', 'BPSkill', 'Ultra']:
role = RoleInstance(char)
im_tmp = await role.cal_damage(skill_type)
im.append(im_tmp)
return im

View File

@ -37,16 +37,21 @@ from ..utils.resource.RESOURCE_PATH import (
SKILL_PATH, SKILL_PATH,
WEAPON_PATH, WEAPON_PATH,
) )
from .effect.Base.Character import Character from .effect.Role import RoleInstance
from .mono.Character import Character
from .to_data import api_to_dict from .to_data import api_to_dict
Excel_path = Path(__file__).parent / 'effect'
with Path.open(Excel_path / 'Excel' / 'seele.json', encoding='utf-8') as f:
skill_dict = json.load(f)
mp.dps = 14 mp.dps = 14
TEXT_PATH = Path(__file__).parent / 'texture2D' TEXT_PATH = Path(__file__).parent / 'texture2D'
bg_img = Image.open(TEXT_PATH / "bg.png") bg_img = Image.open(TEXT_PATH / "bg.png")
white_color = (213, 213, 213) white_color = (213, 213, 213)
yellow_color = (255, 255, 0)
NUM_MAP = {0: '', 1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: ''} NUM_MAP = {0: '', 1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: ''}
RANK_MAP = { RANK_MAP = {
@ -85,9 +90,17 @@ async def draw_char_info_img(raw_mes: str, sr_uid: str):
if isinstance(char_data, str): if isinstance(char_data, str):
return char_data return char_data
char = await cal_char_info(char_data) char = await cal_char_info(char_data)
damage_len = 0
if char.char_id in [1102, 1204, 1107, 1213, 1006]:
skill_list = skill_dict[str(char.char_id)]['skilllist']
damage_len = len(skill_list)
# print(damage_len)
bg_height = 0
if damage_len > 0:
bg_height = 48 * (1 + damage_len) + 48
# 放角色立绘 # 放角色立绘
char_info = bg_img.copy() char_info = bg_img.copy()
char_info = char_info.resize((1050, 2050 + bg_height))
char_img = ( char_img = (
Image.open(CHAR_PORTRAIT_PATH / f'{char.char_id}.png') Image.open(CHAR_PORTRAIT_PATH / f'{char.char_id}.png')
.resize((1050, 1050)) .resize((1050, 1050))
@ -572,9 +585,78 @@ async def draw_char_info_img(raw_mes: str, sr_uid: str):
'mm', 'mm',
) )
if damage_len > 0:
damage_list = await cal(char_data)
# 写伤害
char_img_draw.text(
(55, 2048),
'角色动作',
yellow_color,
sr_font_26,
'lm',
)
char_img_draw.text(
(370, 2048),
'暴击值',
yellow_color,
sr_font_26,
'lm',
)
char_img_draw.text(
(560, 2048),
'期望值',
yellow_color,
sr_font_26,
'lm',
)
char_img_draw.text(
(750, 2048),
'满配辅助末日兽',
yellow_color,
sr_font_26,
'lm',
)
damage_num = 0
for damage_info in damage_list:
damage_num = damage_num + 1
char_img_draw.text(
(55, 2048 + damage_num * 48),
f'{damage_info[0]}',
white_color,
sr_font_26,
'lm',
)
damage1 = math.floor(damage_info[1]) # type: ignore
char_img_draw.text(
(370, 2048 + damage_num * 48),
f'{damage1}',
white_color,
sr_font_26,
'lm',
)
damage2 = math.floor(damage_info[2]) # type: ignore
char_img_draw.text(
(560, 2048 + damage_num * 48),
f'{damage2}',
white_color,
sr_font_26,
'lm',
)
damage3 = math.floor(damage_info[3]) # type: ignore
char_img_draw.text(
(750, 2048 + damage_num * 48),
f'{damage3}',
white_color,
sr_font_26,
'lm',
)
# 写底层文字 # 写底层文字
char_img_draw.text( char_img_draw.text(
(525, 2022), (525, 2022 + bg_height),
'--Created by qwerdvd-Designed By Wuyi-Thank for mihomo.me--', '--Created by qwerdvd-Designed By Wuyi-Thank for mihomo.me--',
(255, 255, 255), (255, 255, 255),
fw_font_28, fw_font_28,
@ -634,6 +716,30 @@ async def get_char_data(
return json.load(fp) return json.load(fp)
async def cal(char_data: Dict):
char = await cal_char_info(char_data)
skill_info_list = []
if char.char_id in [1102, 1204, 1107, 1213, 1006]:
if char.char_id == 1213:
for skill_type in ['Normal', 'Normal1', 'Normal2', 'Normal3', 'Ultra']:
role = RoleInstance(char)
im_tmp = await role.cal_damage(skill_type)
skill_info_list.append(im_tmp)
else:
for skill_type in ['Normal', 'BPSkill', 'Ultra']:
role = RoleInstance(char)
im_tmp = await role.cal_damage(skill_type)
skill_info_list.append(im_tmp)
if char.char_id in [1204, 1107]:
role = RoleInstance(char)
im_tmp = await role.cal_damage('Talent')
skill_info_list.append(im_tmp)
return skill_info_list
else:
return '角色伤害计算未完成'
async def get_relic_score( async def get_relic_score(
subProperty: str, subValue, char_name: str, is_main: bool subProperty: str, subValue, char_name: str, is_main: bool
) -> float: ) -> float:

View File

@ -2,6 +2,8 @@ from typing import List
from mpmath import mp from mpmath import mp
from gsuid_core.logger import logger
from ..Base.AvatarBase import BaseAvatar, BaseAvatarBuff from ..Base.AvatarBase import BaseAvatar, BaseAvatarBuff
from ..Base.model import ( from ..Base.model import (
DamageInstanceAvatar, DamageInstanceAvatar,
@ -25,6 +27,8 @@ class Seele(BaseAvatar):
pass pass
def eidolons(self): def eidolons(self):
if self.avatar_rank < 2:
self.eidolon_attribute['SpeedAddedRatio'] = mp.mpf(0.25)
if self.avatar_rank >= 1: if self.avatar_rank >= 1:
self.eidolon_attribute['CriticalDamageBase'] = mp.mpf(0.15) self.eidolon_attribute['CriticalDamageBase'] = mp.mpf(0.15)
if self.avatar_rank >= 2: if self.avatar_rank >= 2:
@ -32,15 +36,146 @@ class Seele(BaseAvatar):
def extra_ability(self): def extra_ability(self):
# 额外能力 割裂 抗性穿透提高20 # 额外能力 割裂 抗性穿透提高20
if 1102102 in self.Buff.extra_ability_id: self.extra_ability_attribute[
'QuantumResistancePenetration'
] = mp.mpf(0.2)
class JingYuan(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 2:
self.eidolon_attribute['NormalDmgAdd'] = mp.mpf(0.2)
self.eidolon_attribute['BPSkillDmgAdd'] = mp.mpf(0.2)
self.eidolon_attribute['UltraDmgAdd'] = mp.mpf(0.2)
if self.avatar_rank >= 6:
self.eidolon_attribute['Talent_DmgRatio'] = mp.mpf(0.288)
def extra_ability(self):
logger.info('额外能力')
logger.info('【神君】下回合的攻击段数大于等于6段则其下回合的暴击伤害提高25%')
self.extra_ability_attribute[
'CriticalDamageBase'
] = mp.mpf(0.25)
logger.info('施放战技后暴击率提升10%')
self.extra_ability_attribute[
'CriticalChanceBase'
] = mp.mpf(0.1)
class Clara(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 2:
self.eidolon_attribute['AttackAddedRatio'] = mp.mpf(0.2)
def extra_ability(self):
logger.info('额外能力')
logger.info('史瓦罗的反击造成的伤害提高30%')
self.extra_ability_attribute[
'TalentDmgAdd'
] = mp.mpf(0.3)
self.extra_ability_attribute[
'UltraDmgAdd'
] = mp.mpf(0.3)
class Danhengil(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 1:
self.eidolon_attribute['Atk_buff'] = mp.mpf(1)
if self.avatar_rank >= 4:
self.eidolon_attribute['Normal_buff'] = mp.mpf(4)
if self.avatar_rank >= 6:
self.extra_ability_attribute[ self.extra_ability_attribute[
'QuantumResistancePenetration' 'Normal_ImaginaryResistancePenetration'
] = mp.mpf(0.2) ] = mp.mpf(0.6)
def extra_ability(self):
logger.info('额外能力')
logger.info('对拥有虚数属性弱点的敌方目标造成伤害时暴击伤害提高24%')
self.extra_ability_attribute[
'CriticalDamageBase'
] = mp.mpf(0.24)
class Avatar(Seele): class Silverwolf(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
super().__init__(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 6:
self.extra_ability_attribute[
'AllDamageAddedRatio'
] = mp.mpf(1)
def extra_ability(self):
logger.info('额外能力')
logger.info('战技降抗')
logger.info('战技使目标全属性抗性降低的效果额外降低3%')
enemy_status_resistance = self.BPSkill_d() + 0.03
self.extra_ability_attribute[
'QuantumResistancePenetration'
] = mp.mpf(enemy_status_resistance)
logger.info('终结技降防')
ultra_defence = self.Ultra_d()
logger.info('天赋降防')
talent_defence = self.Talent()
ignore_defence = ultra_defence + talent_defence
self.extra_ability_attribute[
'ignore_defence'
] = mp.mpf(ignore_defence)
class Avatar:
@classmethod @classmethod
def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]): def create(cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]):
if char.id_ == 1006:
return Silverwolf(char, skills)
if char.id_ == 1213:
return Danhengil(char, skills)
if char.id_ == 1102: if char.id_ == 1102:
return Seele(char, skills) return Seele(char, skills)
raise Exception('角色不存在') if char.id_ == 1204:
return JingYuan(char, skills)
if char.id_ == 1107:
return Clara(char, skills)
raise Exception('不支持的角色')

View File

@ -86,6 +86,17 @@ class BaseAvatar:
promotion["BaseAggro"]['Value'] promotion["BaseAggro"]['Value']
) )
def Skill_Info(self, skill_type):
skill_info = skill_dict[str(self.avatar_id)]['skilllist'][skill_type]
return skill_info
def Normalnum(self, skill_type):
return mp.mpf(
skill_dict[str(self.avatar_id)][skill_type][
self.Skill.Normal_.level - 1
]
)
def Normal(self): def Normal(self):
return mp.mpf( return mp.mpf(
skill_dict[str(self.avatar_id)]['Normal'][ skill_dict[str(self.avatar_id)]['Normal'][
@ -114,5 +125,30 @@ class BaseAvatar:
def Talent(self): def Talent(self):
return mp.mpf( return mp.mpf(
skill_dict[str(self.avatar_id)][''][self.Skill.Talent_.level - 1] skill_dict[str(self.avatar_id)]['Talent'][self.Skill.Talent_.level - 1]
) )
def BPSkill_d(self):
return mp.mpf(
skill_dict[str(self.avatar_id)]['BPSkill_D'][
self.Skill.BPSkill_.level - 1
]
)
def Ultra_d(self):
return mp.mpf(
skill_dict[str(self.avatar_id)]['Ultra_D'][
self.Skill.Ultra_.level - 1
]
)
def Talent_add(self):
if self.avatar_id in [1102]:
return mp.mpf(
skill_dict[str(self.avatar_id)]['Talent'][self.Skill.Talent_.level - 1]
)
else:
return mp.mpf(0)
def Ultra_Use(self):
return skill_dict[str(self.avatar_id)]['Ultra_Use'][0]

View File

@ -6,9 +6,9 @@
0.7000000006519258, 0.7000000006519258,
0.8000000007450581, 0.8000000007450581,
0.9000000008381903, 0.9000000008381903,
1.1000000000931323, 1.0000000000931323,
1.2000000001862645, 1.1000000001862645,
1.3000000002793968 1.2000000002793968
], ],
"BPSkill": [ "BPSkill": [
1.1000000000931323, 1.1000000000931323,
@ -44,7 +44,7 @@
4.93000000086613, 4.93000000086613,
5.100000000093132 5.100000000093132
], ],
"": [ "Talent": [
0.40000000037252903, 0.40000000037252903,
0.44000000040978193, 0.44000000040978193,
0.48000000044703484, 0.48000000044703484,
@ -63,6 +63,386 @@
], ],
"Maze": [ "Maze": [
20 20
] ],
"Ultra_Use": [
120
],
"skilllist": {
"Normal": ["attack","普攻", 1],
"BPSkill": ["attack","战技", 1],
"Ultra": ["attack","终结技", 1]
}
},
"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.3000000003725290,
3.6300000037252900,
3.9600000003725290,
4.2900000003725290,
4.6200000003725290,
4.4950000003725290,
5.3630000003725290,
5.7750000003725290,
6.1880000003725290,
6.6000000003725290,
6.9300000003725290,
7.2600000003725290,
7.5900000003725290,
7.9200000003725290,
8.2500000003725290
],
"Maze": [
20
],
"Ultra_Use": [
130
],
"skilllist": {
"Normal": ["attack","普攻", 1],
"BPSkill": ["attack","战技", 1],
"Ultra": ["attack","终结技", 1],
"Talent": ["attack","10层神君", 1]
}
},
"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
],
"Ultra": [
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.8000000003725290,
0.8800000003725290,
0.9600000003725290,
1.0400000003725290,
1.1200000003725290,
1.2000000003725290,
1.3000000003725290,
1.4000000003725290,
1.5000000003725290,
1.6000000003725290,
1.6800000003725290,
1.7600000003725290,
1.8400000003725290,
1.9200000003725290,
2.0000000003725290
],
"Maze": [
20
],
"Ultra_Use": [
130
],
"skilllist": {
"Normal": ["attack","普攻", 1],
"BPSkill": ["attack","战技", 1],
"Ultra": ["attack","强化反击", 1],
"Talent": ["attack","反击", 1]
}
},
"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.0500000003725290,
0.0550000003725290,
0.0600000003725290,
0.0650000003725290,
0.0700000003725290,
0.0750000003725290,
0.0813000003725290,
0.0875000003725290,
0.0938000003725290,
0.1000000003725290,
0.1050000003725290,
0.1100000003725290,
0.1150000003725290,
0.1200000003725290,
0.1250000003725290
],
"Maze": [
20
],
"Ultra_Use": [
140
],
"skilllist": {
"Normal": ["attack","普攻", 2],
"Normal1": ["attack","瞬华", 3],
"Normal2": ["attack","天矢阴", 5],
"Normal3": ["attack","盘拏耀跃", 7],
"Ultra": ["attack","终结技", 3]
}
},
"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.0750000003725290,
0.0775000003725290,
0.0800000003725290,
0.0825000003725290,
0.0850000003725290,
0.0875000003725290,
0.0906000003725290,
0.0938000003725290,
0.0969000003725290,
0.1000000003725290,
0.1025000003725290,
0.1050000003725290,
0.1075000003725290,
0.1100000003725290,
0.1125000003725290
],
"Ultra": [
2.2800000003725290,
2.4320000003725290,
2.5840000003725290,
2.7360000003725290,
2.8880000003725290,
3.0400000003725290,
3.2300000003725290,
3.4200000003725290,
3.6100000003725290,
3.8000000003725290,
3.9520000003725290,
4.1040000003725290,
4.2560000003725290,
4.4080000003725290,
4.5600000003725290
],
"Ultra_D": [
0.3600000003725290,
0.3690000003725290,
0.3780000003725290,
0.3870000003725290,
0.3960000003725290,
0.4050000003725290,
0.4163000003725290,
0.4275000003725290,
0.4388000003725290,
0.4500000003725290,
0.4590000003725290,
0.4680000003725290,
0.4770000003725290,
0.4860000003725290,
0.4950000003725290
],
"Talent": [
0.0400000003725290,
0.0440000003725290,
0.0480000003725290,
0.0520000003725290,
0.0560000003725290,
0.0400000003725290,
0.0600000003725290,
0.0650000003725290,
0.0700000003725290,
0.0750000003725290,
0.0800000003725290,
0.0840000003725290,
0.0880000003725290,
0.0960000003725290,
0.1000000003725290
],
"Maze": [
20
],
"Ultra_Use": [
110
],
"skilllist": {
"Normal": ["attack","普攻", 1],
"BPSkill": ["attack","战技", 1],
"Ultra": ["attack","终结技", 1]
}
} }
} }

View File

@ -1,6 +1,13 @@
{ {
"23001": { "23001": {
"Param": { "Param": {
"CriticalChance": [
0.18000000016763806,
0.21000000019557774,
0.24000000022351742,
0.2700000002514571,
0.3000000002793968
],
"a_dmg": [ "a_dmg": [
0.060000000055879354, 0.060000000055879354,
0.07000000006519258, 0.07000000006519258,
@ -106,6 +113,71 @@
0.48000000044703484 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
]
}
},
"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
]
}
},
"21013": {
"Param": {
"r_dmg": [
0.32000000022351742,
0.4000000002793968,
0.4800000003352761,
0.5600000003911555,
0.64000000044703484
]
}
}, },
"20014": { "20014": {
"Param": { "Param": {
@ -128,6 +200,143 @@
0.48000000044703484 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
]
}
},
"23007": {
"Param": {
"DmgRatio": [
0.12000000022351742,
0.1400000002793968,
0.1600000003352761,
0.1800000003911555,
0.20000000044703484
],
"CriticalChance": [
0.12000000022351742,
0.1400000002793968,
0.1600000003352761,
0.1800000003911555,
0.20000000044703484
]
}
},
"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
]
}
},
"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
]
}
}, },
"21010": { "21010": {
"Param": { "Param": {
@ -139,6 +348,89 @@
0.1600000001490116 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
]
}
},
"23002": {
"Param": {
"AttackAddedRatio": [
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
]
}
}, },
"21031": { "21031": {
"enable": false "enable": false

View File

@ -1,9 +1,8 @@
from collections import Counter from collections import Counter
from typing import Dict, List from typing import Dict, List
from mpmath import mp
from gsuid_core.logger import logger from gsuid_core.logger import logger
from mpmath import mp
from ..Base.model import DamageInstanceRelic from ..Base.model import DamageInstanceRelic
from ..Base.RelicBase import BaseRelicSetSkill, SingleRelic from ..Base.RelicBase import BaseRelicSetSkill, SingleRelic
@ -40,7 +39,10 @@ class Relic102(BaseRelicSetSkill):
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict): async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
if self.pieces4 and await self.check(base_attr, attribute_bonus): if self.pieces4 and await self.check(base_attr, attribute_bonus):
pass a_dmg = attribute_bonus.get('NormalDmgAdd', 0)
attribute_bonus['NormalDmgAdd'] = a_dmg + mp.mpf(
0.10000000018626451
)
return attribute_bonus return attribute_bonus
@ -164,13 +166,13 @@ class Relic108(BaseRelicSetSkill):
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict): async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
if self.pieces4 and await self.check(base_attr, attribute_bonus): if self.pieces4 and await self.check(base_attr, attribute_bonus):
logger.info(attribute_bonus)
ignore_defence = attribute_bonus.get('ignore_defence', 0) ignore_defence = attribute_bonus.get('ignore_defence', 0)
attribute_bonus['ignore_defence'] = ( attribute_bonus['ignore_defence'] = (
ignore_defence + mp.mpf(0.10000000009313226) * 2 ignore_defence + mp.mpf(0.10000000009313226) * 2
) )
return attribute_bonus return attribute_bonus
class Relic109(BaseRelicSetSkill): class Relic109(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -184,13 +186,13 @@ class Relic109(BaseRelicSetSkill):
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict): async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
if self.pieces4 and await self.check(base_attr, attribute_bonus): if self.pieces4 and await self.check(base_attr, attribute_bonus):
logger.info(attribute_bonus)
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf( attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
0.20000000018626451 0.20000000018626451
) )
return attribute_bonus return attribute_bonus
class Relic110(BaseRelicSetSkill): class Relic110(BaseRelicSetSkill):
def __init__(self, set_id: int, count: int): def __init__(self, set_id: int, count: int):
super().__init__(set_id, count) super().__init__(set_id, count)
@ -308,14 +310,14 @@ class Relic303(BaseRelicSetSkill):
super().__init__(set_id, count) super().__init__(set_id, count)
async def check(self, base_attr: Dict, attribute_bonus: Dict): async def check(self, base_attr: Dict, attribute_bonus: Dict):
pass # 提高装备者等同于当前效果命中25%的攻击力,最多提高25%
return True return True
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict): async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
if self.pieces2 and await self.check(base_attr, attribute_bonus): if self.pieces2 and await self.check(base_attr, attribute_bonus):
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
merged_attr = await merge_attribute(base_attr, attribute_bonus) merged_attr = await merge_attribute(base_attr, attribute_bonus)
status_probability = merged_attr.get('StatusProbability', 0) status_probability = merged_attr.get('StatusProbabilityBase', 0)
# 提高装备者等同于当前效果命中25%的攻击力,最多提高25% # 提高装备者等同于当前效果命中25%的攻击力,最多提高25%
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + min( attribute_bonus['AttackAddedRatio'] = attack_added_ratio + min(
mp.mpf(0.25000000023283064), status_probability / mp.mpf(0.25) mp.mpf(0.25000000023283064), status_probability / mp.mpf(0.25)
@ -387,8 +389,8 @@ class Relic306(BaseRelicSetSkill):
if self.pieces2 and await self.check(base_attr, attribute_bonus): if self.pieces2 and await self.check(base_attr, attribute_bonus):
q_dmg = attribute_bonus.get('UltraDmgAdd', 0) q_dmg = attribute_bonus.get('UltraDmgAdd', 0)
attribute_bonus['UltraDmgAdd'] = q_dmg + mp.mpf(0.1500000001396984) attribute_bonus['UltraDmgAdd'] = q_dmg + mp.mpf(0.1500000001396984)
a3_dmg = attribute_bonus.get('Follow-UpAttackDmgAdd', 0) a3_dmg = attribute_bonus.get('TalentDmgAdd', 0)
attribute_bonus['Follow-UpDmgAdd'] = a3_dmg + mp.mpf( attribute_bonus['TalentDmgAdd'] = a3_dmg + mp.mpf(
0.1500000001396984 0.1500000001396984
) )
return attribute_bonus return attribute_bonus
@ -438,6 +440,31 @@ class Relic308(BaseRelicSetSkill):
logger.info('ModifyActionDelay') logger.info('ModifyActionDelay')
return attribute_bonus 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, attribute_bonus: Dict):
'''
当装备者的当前暴击率大于等于70%普攻和战技造成的伤害提高20%
'''
merged_attr = await merge_attribute(base_attr, attribute_bonus)
if merged_attr['CriticalChanceBase'] >= mp.mpf(0.7):
logger.info('Relic309 check success')
return True
return None
async def set_skill_ability(self, base_attr: Dict, attribute_bonus: Dict):
if self.pieces2 and await self.check(base_attr, attribute_bonus):
a_dmg = attribute_bonus.get('NormalDmgAdd', 0)
attribute_bonus['NormalDmgAdd'] = a_dmg + mp.mpf(
0.20000000018626451
)
a2_dmg = attribute_bonus.get('BPSkillDmgAdd', 0)
attribute_bonus['BPSkillDmgAdd'] = a2_dmg + mp.mpf(
0.20000000018626451
)
return attribute_bonus
class RelicSet: class RelicSet:
HEAD: SingleRelic HEAD: SingleRelic
@ -532,5 +559,7 @@ class RelicSet:
cls.SetSkill.append(Relic307(set_id, count)) cls.SetSkill.append(Relic307(set_id, count))
elif set_id == 308: elif set_id == 308:
cls.SetSkill.append(Relic308(set_id, count)) cls.SetSkill.append(Relic308(set_id, count))
elif set_id == 309:
cls.SetSkill.append(Relic309(set_id, count))
else: else:
raise Exception(f'Unknow SetId: {set_id}') raise Exception(f'Unknow SetId: {set_id}')

View File

@ -1,7 +1,7 @@
from gsuid_core.logger import logger
from mpmath import mp from mpmath import mp
from gsuid_core.logger import logger from ..mono.Character import Character
from .Avatar.Avatar import Avatar from .Avatar.Avatar import Avatar
from .Base.model import DamageInstance from .Base.model import DamageInstance
from .Relic.Relic import RelicSet, SingleRelic from .Relic.Relic import RelicSet, SingleRelic
@ -12,7 +12,7 @@ mp.dps = 14
class RoleInstance: class RoleInstance:
def __init__(self, raw_data): def __init__(self, raw_data: Character):
self.raw_data = DamageInstance(raw_data) self.raw_data = DamageInstance(raw_data)
self.avatar = Avatar.create(self.raw_data.avatar, self.raw_data.skill) self.avatar = Avatar.create(self.raw_data.avatar, self.raw_data.skill)
@ -30,7 +30,7 @@ class RoleInstance:
def cal_role_base_attr(self): def cal_role_base_attr(self):
logger.info('cal_role_base_attr') logger.info('cal_role_base_attr')
avatar_attribute = self.avatar.avatar_attribute avatar_attribute = self.avatar.__dict__['avatar_attribute']
logger.info(avatar_attribute) logger.info(avatar_attribute)
for attribute in avatar_attribute: for attribute in avatar_attribute:
if attribute in self.base_attr: if attribute in self.base_attr:
@ -38,7 +38,7 @@ class RoleInstance:
else: else:
self.base_attr[attribute] = avatar_attribute[attribute] self.base_attr[attribute] = avatar_attribute[attribute]
weapon_attribute = self.weapon.weapon_base_attributes weapon_attribute = self.weapon.__dict__['weapon_base_attribute']
for attribute in weapon_attribute: for attribute in weapon_attribute:
if attribute in self.base_attr: if attribute in self.base_attr:
self.base_attr[attribute] += weapon_attribute[attribute] self.base_attr[attribute] += weapon_attribute[attribute]
@ -113,69 +113,44 @@ class RoleInstance:
def cal_weapon_attr_add(self): def cal_weapon_attr_add(self):
if self.attribute_bonus is None: if self.attribute_bonus is None:
raise Exception('attribute_bonus is None') raise Exception('attribute_bonus is None')
for attribute in self.weapon.weapon_attribute: for attribute in self.weapon.__dict__['weapon_attribute']:
if attribute in self.attribute_bonus: if attribute in self.attribute_bonus:
self.attribute_bonus[ self.attribute_bonus[
attribute attribute
] += self.weapon.weapon_attribute[attribute] ] += self.weapon.__dict__['weapon_attribute'][attribute]
else: else:
self.attribute_bonus[attribute] = self.weapon.weapon_attribute[ self.attribute_bonus[
attribute attribute
] ] = self.weapon.__dict__['weapon_attribute'][attribute]
async def cal_damage(self, skill_type): async def cal_damage(self, skill_type):
logger.info('base_attr')
logger.info(self.base_attr) logger.info(self.base_attr)
logger.info('attribute_bonus')
logger.info(self.attribute_bonus) logger.info(self.attribute_bonus)
# 检查武器战斗生效的buff # 检查武器战斗生效的buff
logger.info('检查武器战斗生效的buff') logger.info('检查武器战斗生效的buff')
Ultra_Use = self.avatar.Ultra_Use()
logger.info('Ultra_Use')
logger.info(Ultra_Use)
if self.attribute_bonus is None: if self.attribute_bonus is None:
raise Exception('attribute_bonus is None') raise Exception('attribute_bonus is None')
self.attribute_bonus = await self.weapon.weapon_ability( self.attribute_bonus = await self.weapon.weapon_ability(
self.base_attr, self.attribute_bonus Ultra_Use, self.base_attr, self.attribute_bonus
) )
logger.info(self.attribute_bonus)
logger.info('检查遗器套装战斗生效的buff') logger.info('检查遗器套装战斗生效的buff')
for set_skill in self.relic_set.SetSkill: for set_skill in self.relic_set.SetSkill:
self.attribute_bonus = await set_skill.set_skill_ability( self.attribute_bonus = await set_skill.set_skill_ability(
self.base_attr, self.attribute_bonus self.base_attr, self.attribute_bonus
) )
logger.info('merge_attribute')
logger.info(self.base_attr)
if self.attribute_bonus is None: if self.attribute_bonus is None:
raise Exception('attribute_bonus is None') raise Exception('attribute_bonus is None')
merged_attr = await merge_attribute( merged_attr = await merge_attribute(
self.base_attr, self.attribute_bonus self.base_attr, self.attribute_bonus
) )
logger.info(merged_attr)
attack = merged_attr['attack']
logger.info(f'攻击力: {attack}')
# 模拟 同属性弱点 同等级 的怪物
# 韧性条减伤
enemy_damage_reduction = 0.1
damage_reduction = 1 - enemy_damage_reduction
logger.info(f'韧性区: {damage_reduction}')
# 抗性区
enemy_status_resistance = 0
for attr in merged_attr:
if attr.__contains__('ResistancePenetration'):
# 先默认触发
enemy_status_resistance = merged_attr[attr]
resistance_area = 1 - (0 - enemy_status_resistance)
logger.info(f'抗性区: {resistance_area}')
# 防御区 skill_info = self.avatar.Skill_Info(skill_type)
# 检查是否有 ignore_defence
logger.info('检查是否有 ignore_defence')
ignore_defence = 1
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 = (self.avatar.avatar_level * 10 + 200) * ignore_defence
defence_multiplier = (self.avatar.avatar_level * 10 + 200) / (
self.avatar.avatar_level * 10 + 200 + enemy_defence
)
logger.info(f'防御区: {defence_multiplier}')
# 技能区 # 技能区
if skill_type == 'Normal': if skill_type == 'Normal':
@ -183,64 +158,230 @@ class RoleInstance:
elif skill_type == 'BPSkill': elif skill_type == 'BPSkill':
skill_multiplier = self.avatar.BPSkill() skill_multiplier = self.avatar.BPSkill()
elif skill_type == 'Ultra': elif skill_type == 'Ultra':
skill_multiplier = self.avatar.Ultra() if self.raw_data.avatar.id_ == 1107:
skill_multiplier = self.avatar.Talent() + self.avatar.Ultra()
elif self.raw_data.avatar.id_ == 1006 and self.raw_data.avatar.rank >= 4:
skill_multiplier = self.avatar.Ultra() + 1
else:
skill_multiplier = self.avatar.Ultra()
elif skill_type == 'Talent':
skill_multiplier = self.avatar.Talent()
else: else:
raise Exception('skill type error') if self.raw_data.avatar.id_ == 1213:
logger.info(f'技能区: {skill_multiplier}') skill_multiplier = self.avatar.Normalnum(skill_type)
skill_type = 'Normal'
else:
raise Exception('skill type error')
# 增伤区 logger.info(f'技能区总: {skill_multiplier}')
# TODO: 这里计算只考虑了希儿,需要重写 injury_area = self.avatar.Talent()
injury_area = self.avatar.Talent()
# 检查是否有对某一个技能的伤害加成
logger.info('检查是否有对某一个技能的伤害加成')
for attr in merged_attr:
if attr.__contains__('DmgAdd'):
attr_name = attr.split('DmgAdd')[0]
if attr_name == skill_type:
logger.info(
f'{attr}{skill_type}{merged_attr[attr]} 伤害加成'
)
injury_area += merged_attr[attr]
# 检查球有无符合属性的伤害加成
logger.info('检查球有无符合属性的伤害加成')
for attr in merged_attr:
if attr.__contains__('AddedRatio'):
attr_name = attr.split('AddedRatio')[0]
if attr_name == self.avatar.avatar_element:
logger.info(
f'{attr}{self.avatar.avatar_element} '
f'{merged_attr[attr]} 伤害加成'
)
injury_area += merged_attr[attr]
injury_area += 1
logger.info(f'增伤区: {injury_area}')
# 爆伤区 skill_info_list = []
logger.info('检查是否有爆伤加成') #技能类型为攻击
logger.info(f'{merged_attr}') if skill_info[0] == 'attack':
critical_damage_base = merged_attr['CriticalDamageBase'] skill_multiplier = skill_multiplier/skill_info[2]
# 检查是否有对特定技能的爆伤加成 logger.info(f'技能区单段: {skill_multiplier}')
# Ultra_CriticalChance attack = merged_attr['attack']
for attr in merged_attr: logger.info(f'攻击力: {attack}')
if attr.__contains__('_CriticalChance'): # 模拟 同属性弱点 同等级 的怪物
skill_name = attr.split('_')[0] # 韧性条减伤
if skill_name == skill_type: enemy_damage_reduction = 0.1
logger.info( damage_reduction = 1 - enemy_damage_reduction
f'{attr}{skill_type}{merged_attr[attr]} 爆伤加成' logger.info(f'韧性区: {damage_reduction}')
# 抗性区
enemy_status_resistance = 0
for attr in merged_attr:
if attr.__contains__('ResistancePenetration'):
# 先默认触发
enemy_status_resistance = merged_attr[attr]
resistance_area = 1 - (0 - enemy_status_resistance)
if self.raw_data.avatar.id_ == 1213:
if skill_info[2] == 7:
Normal_Penetration = merged_attr.get(
'Normal_ImaginaryResistancePenetration', 0
) )
critical_damage_base += merged_attr[attr] resistance_area = resistance_area - (0 - Normal_Penetration)
critical_damage = critical_damage_base + 1 logger.info(f'抗性区: {resistance_area}')
logger.info(f'暴伤: {critical_damage}')
damage = ( # 防御区
attack # 检查是否有 ignore_defence
* skill_multiplier logger.info('检查是否有 ignore_defence')
* injury_area ignore_defence = 1
* defence_multiplier for attr in merged_attr:
* resistance_area if attr == 'ignore_defence':
* damage_reduction ignore_defence = 1 - merged_attr[attr]
* critical_damage break
) logger.info(f'ignore_defence {ignore_defence}')
im = f'{skill_type} 伤害: {damage}' enemy_defence = (self.avatar.avatar_level * 10 + 200) * ignore_defence
logger.info(f'{skill_type} 伤害: {damage}') defence_multiplier = (self.avatar.avatar_level * 10 + 200) / (
return im self.avatar.avatar_level * 10 + 200 + enemy_defence
)
logger.info(f'防御区: {defence_multiplier}')
# 增伤区
# TODO: 这里计算只考虑了希儿,需要重写 injury_area = self.avatar.Talent_add()
injury_area = self.avatar.Talent_add()
# 检查是否有对某一个技能的伤害加成
logger.info('检查是否有对某一个技能的伤害加成')
for attr in merged_attr:
if attr.__contains__('DmgAdd'):
attr_name = attr.split('DmgAdd')[0]
if attr_name == 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 == self.avatar.avatar_element or attr_name == 'AllDamage':
logger.info(
f'{attr}{self.avatar.avatar_element} '
f'{merged_attr[attr]} 伤害加成'
)
if attr_name == self.avatar.avatar_element:
element_area += merged_attr[attr]
injury_area += merged_attr[attr]
injury_area += 1
logger.info(f'增伤区: {injury_area}')
# 易伤区
logger.info('检查是否有易伤加成')
logger.info(f'{merged_attr}')
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 == 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}')
# 爆伤区
logger.info('检查是否有爆伤加成')
logger.info(f'{merged_attr}')
critical_damage_base = merged_attr['CriticalDamageBase']
# 检查是否有对特定技能的爆伤加成
# Ultra_CriticalChance
for attr in merged_attr:
if attr.__contains__('_CriticalChance'):
skill_name = attr.split('_')[0]
if skill_name == skill_type:
logger.info(
f'{attr}{skill_type}{merged_attr[attr]} 爆伤加成'
)
critical_damage_base += merged_attr[attr]
critical_damage = critical_damage_base + 1
logger.info(f'暴伤: {critical_damage}')
# 暴击区
critical_chance_base = min(1, merged_attr['CriticalChanceBase'])
logger.info(f'暴击: {critical_chance_base}')
#期望伤害
qiwang_damage = (critical_chance_base * critical_damage_base) + 1
logger.info(f'暴击期望: {qiwang_damage}')
damage_cd_z = 0
damage_qw_z = 0
damage_tz_z = 0
attack_tz = 0
injury_add = 0
critical_damage_add = 0
for i in range(1, skill_info[2]+1):
logger.info(f'段数: {i}')
injury_add = 0
critical_damage_add = 0
if self.raw_data.avatar.id_ == 1213:
injury_add = self.avatar.Talent()
critical_damage_add = self.avatar.BPSkill()
normal_buff = merged_attr.get('Normal_buff', 0)
if i >= 4:
normal_buff = min(4, int(normal_buff + (i-3)))
if normal_buff >= 1:
critical_damage_add = normal_buff * critical_damage_add
atk_buff = merged_attr.get('Atk_buff', 0)
atk_buff = min(10, int((i - 1)*(atk_buff + 1)))
injury_add = atk_buff * injury_add
qiwang_damage = (
(critical_chance_base *
(critical_damage_base + critical_damage_add))
+ 1
)
damage_cd = (
attack
* skill_multiplier
* damage_ratio
* (injury_area + injury_add)
* defence_multiplier
* resistance_area
* damage_reduction
* (critical_damage + critical_damage_add)
)
damage_cd_z += damage_cd
damage_qw = (
attack
* skill_multiplier
* damage_ratio
* (injury_area + injury_add)
* defence_multiplier
* resistance_area
* damage_reduction
* qiwang_damage
)
damage_qw_z += damage_qw
attr_value_tz: float= self.base_attr.get('attack', 0)
attack_tz = attr_value_tz + attr_value_tz * (
1 + self.attribute_bonus['AttackAddedRatio'] + 2.144
) + self.attribute_bonus['AttackDelta']
injury_add_tz = 0
if self.avatar.avatar_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_tz_z += damage_tz
logger.info(
f'{skill_info[1]}{i}段 暴击伤害: {damage_cd} 期望伤害{damage_qw}'
)
if self.avatar.avatar_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_z += damage_tz_fj
skill_info_list = []
skill_info_list.append(skill_info[1])
skill_info_list.append(damage_cd_z)
skill_info_list.append(damage_qw_z)
skill_info_list.append(damage_tz_z)
logger.info(
f'{skill_info[1]} 暴击伤害: {damage_cd_z} 期望伤害{damage_qw_z}'
)
return skill_info_list

View File

@ -24,7 +24,7 @@ class Arrows(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
critical_chance_base = attribute_bonus.get('CriticalChance', 0) critical_chance_base = attribute_bonus.get('CriticalChance', 0)
attribute_bonus['CriticalChance'] = critical_chance_base + mp.mpf( attribute_bonus['CriticalChance'] = critical_chance_base + mp.mpf(
@ -44,7 +44,7 @@ class ReturntoDarkness(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
pass pass
return attribute_bonus return attribute_bonus
@ -59,7 +59,7 @@ class Swordplay(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
all_damage_added_ratio = attribute_bonus.get( all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0 'AllDamageAddedRatio', 0
@ -83,7 +83,7 @@ class DartingArrow(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0) attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf( attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
@ -103,7 +103,7 @@ class Adversarial(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0)
attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf( attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf(
@ -124,7 +124,7 @@ class SubscribeforMore(BaseWeapon):
# 装备者的当前能量值等于其能量上限 # 装备者的当前能量值等于其能量上限
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0) normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0)
attribute_bonus['NormalDmgAdd'] = normal_dmg_add + ( attribute_bonus['NormalDmgAdd'] = normal_dmg_add + (
@ -158,7 +158,7 @@ class RiverFlowsinSpring(BaseWeapon):
# 当装备者受到伤害后该效果失效,下个回合结束时该效果恢复。 # 当装备者受到伤害后该效果失效,下个回合结束时该效果恢复。
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0) speed_added_ratio = attribute_bonus.get('SpeedAddedRatio', 0)
attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf( attribute_bonus['SpeedAddedRatio'] = speed_added_ratio + mp.mpf(
@ -190,7 +190,7 @@ class SleepLiketheDead(BaseWeapon):
# 该效果每3回合可以触发1次。 # 该效果每3回合可以触发1次。
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
return attribute_bonus return attribute_bonus
return None return None
@ -205,7 +205,7 @@ class OnlySilenceRemains(BaseWeapon):
# 当场上的敌方目标数量小于等于2时 # 当场上的敌方目标数量小于等于2时
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
attribute_bonus[ attribute_bonus[
@ -218,6 +218,35 @@ class OnlySilenceRemains(BaseWeapon):
return attribute_bonus return attribute_bonus
return None return None
#拂晓之前
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: int, base_attr: Dict, attribute_bonus: Dict):
bp_skill_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0)
attribute_bonus['BPSkillDmgAdd'] = bp_skill_dmg_add + (
mp.mpf(
weapon_effect['23010']['Param']['e_dmg'][self.weapon_rank - 1]
)
)
ultra_dmg_add = attribute_bonus.get('UltraDmgAdd', 0)
attribute_bonus['UltraDmgAdd'] = ultra_dmg_add + (
mp.mpf(
weapon_effect['23010']['Param']['r_dmg'][self.weapon_rank - 1]
)
)
talent_dmg_add = attribute_bonus.get('TalentDmgAdd', 0)
attribute_bonus['TalentDmgAdd'] = talent_dmg_add + (
mp.mpf(
weapon_effect['23010']['Param']['t_dmg'][self.weapon_rank - 1]
)
)
return attribute_bonus
class IntheNight(BaseWeapon): class IntheNight(BaseWeapon):
weapon_base_attributes: Dict weapon_base_attributes: Dict
@ -227,8 +256,13 @@ class IntheNight(BaseWeapon):
async def check(self): async def check(self):
pass pass
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
char_speed = mp.mpf(base_attr.get('speed', 0)) char_speed = (
(mp.mpf(base_attr.get('speed', 0))
+ mp.mpf(attribute_bonus.get('SpeedDelta', 0)))
* (mp.mpf(attribute_bonus.get('SpeedAddedRatio', 0))+1)
)
print(char_speed)
count_ = min(6, int(mp.floor((char_speed - 100) / 10))) count_ = min(6, int(mp.floor((char_speed - 100) / 10)))
normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0) normal_dmg_add = attribute_bonus.get('NormalDmgAdd', 0)
attribute_bonus['NormalDmgAdd'] = normal_dmg_add + ( attribute_bonus['NormalDmgAdd'] = normal_dmg_add + (
@ -270,7 +304,7 @@ class CruisingintheStellarSea(BaseWeapon):
# 装备者消灭敌方目标 # 装备者消灭敌方目标
return True return True
async def weapon_ability(self, base_attr: Dict, attribute_bonus: Dict): async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check(): if await self.check():
critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0) critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
attribute_bonus[ attribute_bonus[
@ -289,16 +323,477 @@ class CruisingintheStellarSea(BaseWeapon):
) )
return attribute_bonus return attribute_bonus
class SeriousnessofBreakfast(BaseWeapon):
weapon_base_attributes: Dict
def __init__(self, weapon: DamageInstanceWeapon):
super().__init__(weapon)
# class HuntWeapon( async def check(self):
# IntheNight, OnlySilenceRemains, SleepLiketheDead, #使装备者造成伤害提高12%
# SubscribeforMore, Swordplay, DartingArrow, Adversarial, #每消灭1个敌方目标装备者的攻击力提高4%该效果最多叠加3层。
# RiverFlowsinSpring, Arrows, ReturntoDarkness return True
# ):
# @classmethod async def weapon_ability(self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict):
# def create(cls, weapon: DamageInstanceWeapon): all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
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 + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
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 + mp.mpf(
weapon_effect['23000']['Param']['AllDamageAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
return None
#今日亦是和平的一日
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: int, base_attr: Dict, attribute_bonus: Dict):
all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
# attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
# attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
# weapon_effect['21020']['Param']['AttackAddedRatio'][
# self.weapon_rank - 1
# ]
# )
if await self.check():
critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0)
attribute_bonus['CriticalDamageBase'] = critical_chance_base + (
mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
ultra_dmg_add = attribute_bonus.get('UltraDmgAdd', 0)
attribute_bonus['UltraDmgAdd'] = ultra_dmg_add + (
mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
talent_dmg_add = attribute_bonus.get('TalentDmgAdd', 0)
attribute_bonus['TalentDmgAdd'] = talent_dmg_add + (
mp.mpf(
weapon_effect['21006']['Param']['t_dmg'][self.weapon_rank - 1]
)
)
return attribute_bonus
return None
#秘密誓心
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
weapon_effect['21012']['Param']['AllDamageAddedRatio'][
self.weapon_rank - 1
]
)
return attribute_bonus
return None
#比阳光更明亮的
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
# critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
# attribute_bonus[
# 'CriticalChanceBase'
# ] = critical_chance_base + mp.mpf(
# weapon_effect['23009']['Param']['CriticalChance'][
# self.weapon_rank - 1
# ]
# )
# hp_added_ratio = attribute_bonus.get('HPAddedRatio', 0)
# attribute_bonus[
# 'HPAddedRatio'
# ] = hp_added_ratio + mp.mpf(
# weapon_effect['23009']['Param']['HPAddedRatio'][
# self.weapon_rank - 1
# ]
# )
if await self.check():
all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0
)
attribute_bonus[
'AllDamageAddedRatio'
] = all_damage_added_ratio + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
# attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
# attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
# weapon_effect['23002']['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 + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
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 + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
# attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
# attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
# weapon_effect['21033']['Param']['AttackAddedRatio'][
# self.weapon_rank - 1
# ]
# )
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: int, base_attr: Dict, attribute_bonus: Dict):
# 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 + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
# 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 + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
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: int, base_attr: Dict, attribute_bonus: Dict):
if await self.check():
damage_ratio = attribute_bonus.get('DmgRatio', 0)
attribute_bonus[
'DmgRatio'
] = damage_ratio + mp.mpf(
weapon_effect['23007']['Param']['DmgRatio'][
self.weapon_rank - 1
]
)
critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
attribute_bonus[
'CriticalChanceBase'
] = critical_chance_base + mp.mpf(
weapon_effect['23007']['Param']['CriticalChance'][
self.weapon_rank - 1
]
)
return attribute_bonus
# class HuntWeapon:
# def __new__(cls, weapon: DamageInstanceWeapon):
# 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: # if weapon.id_ == 24001:
# return SleepLiketheDead(weapon) # return CruisingintheStellarSea(weapon)
# if weapon.id_ == 23001: # if weapon.id_ == 23001:
# return IntheNight(weapon) # return IntheNight(weapon)
# if weapon.id_ == 21003: # if weapon.id_ == 21003:
@ -321,14 +816,27 @@ class CruisingintheStellarSea(BaseWeapon):
# pass # pass
class Weapon( class Weapon:
IntheNight, OnlySilenceRemains, SleepLiketheDead,
SubscribeforMore, Swordplay, DartingArrow, Adversarial,
RiverFlowsinSpring, Arrows, ReturntoDarkness
):
@classmethod @classmethod
def create(cls, weapon: DamageInstanceWeapon): def create(cls, weapon: DamageInstanceWeapon):
if weapon.id_ in [ if weapon.id_ in [
23007,
21005,
21019,
21026,
21033,
24000,
23002,
23009,
23015,
21012,
21006,
21013,
21027,
21020,
21034,
23000,
23010,
23001, 23001,
21003, 21003,
23012, 23012,
@ -341,8 +849,42 @@ class Weapon(
21031, 21031,
20000, 20000,
]: ]:
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: if weapon.id_ == 24001:
return SleepLiketheDead(weapon) return CruisingintheStellarSea(weapon)
if weapon.id_ == 23001: if weapon.id_ == 23001:
return IntheNight(weapon) return IntheNight(weapon)
if weapon.id_ == 21003: if weapon.id_ == 21003:

View File

@ -13,11 +13,11 @@ async def merge_attribute(base_attr: Dict, attribute_bonus: Dict) -> Dict:
): ):
if attribute.__contains__('Delta'): if attribute.__contains__('Delta'):
attr = attribute.split('Delta')[0].lower() attr = attribute.split('Delta')[0].lower()
attr_value = base_attr.get(attr, 0) attr_value = merged_attr.get(attr, 0)
merged_attr[attr] = attr_value + attribute_bonus[attribute] merged_attr[attr] = attr_value + attribute_bonus[attribute]
elif attribute.__contains__('AddedRatio'): elif attribute.__contains__('AddedRatio'):
attr = attribute.split('AddedRatio')[0].lower() attr = attribute.split('AddedRatio')[0].lower()
attr_value = base_attr.get(attr, 0) attr_value = merged_attr.get(attr, 0)
merged_attr[attr] = attr_value + base_attr[attr] * ( merged_attr[attr] = attr_value + base_attr[attr] * (
1 + attribute_bonus[attribute] 1 + attribute_bonus[attribute]
) )
@ -33,12 +33,21 @@ async def merge_attribute(base_attr: Dict, attribute_bonus: Dict) -> Dict:
elif attribute.__contains__('DmgAdd'): elif attribute.__contains__('DmgAdd'):
attr_value = base_attr.get(attribute, 0) attr_value = base_attr.get(attribute, 0)
merged_attr[attribute] = attr_value + attribute_bonus[attribute] 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': elif attribute == 'ignore_defence':
attr_value = base_attr.get(attribute, 0) attr_value = base_attr.get(attribute, 0)
merged_attr[attribute] = attr_value + attribute_bonus[attribute] merged_attr[attribute] = attr_value + attribute_bonus[attribute]
elif attribute.__contains__('ResistancePenetration'): elif attribute.__contains__('ResistancePenetration'):
attr_value = base_attr.get(attribute, 0) attr_value = base_attr.get(attribute, 0)
merged_attr[attribute] = attr_value + attribute_bonus[attribute] 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]
else: else:
raise Exception(f'attribute error {attribute}') raise Exception(f'attribute error {attribute}')
return merged_attr return merged_attr

View File

@ -5,10 +5,11 @@ from typing import Dict
from loguru import logger from loguru import logger
from mpmath import mp from mpmath import mp
from ....utils.map.SR_MAP_PATH import EquipmentID2AbilityProperty, RelicSetSkill from ...utils.map.SR_MAP_PATH import EquipmentID2AbilityProperty, RelicSetSkill
mp.dps = 14 mp.dps = 14
class Character: class Character:
def __init__(self, card_prop: Dict): def __init__(self, card_prop: Dict):
# 面板数据 # 面板数据