mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-31 04:30:29 +08:00
✨ 改进的毕业度计算
This commit is contained in:
parent
5b2703fa24
commit
2262798ade
1
genshinuid_enka/dmgCalc/dmgMap.json
Normal file
1
genshinuid_enka/dmgCalc/dmgMap.json
Normal file
File diff suppressed because one or more lines are too long
@ -32,13 +32,109 @@ with open(DMG_PATH / 'char_talent_effect.json', "r", encoding='UTF-8') as f:
|
|||||||
with open(DMG_PATH / 'char_skill_effect.json', "r", encoding='UTF-8') as f:
|
with open(DMG_PATH / 'char_skill_effect.json', "r", encoding='UTF-8') as f:
|
||||||
char_skill_effect_map = json.load(f)
|
char_skill_effect_map = json.load(f)
|
||||||
|
|
||||||
|
with open(DMG_PATH / 'dmgMap.json', "r", encoding='UTF-8') as f:
|
||||||
|
dmgMap = json.load(f)
|
||||||
|
|
||||||
dmgBar_1 = Image.open(DMG_TEXT_PATH / 'dmgBar_1.png')
|
dmgBar_1 = Image.open(DMG_TEXT_PATH / 'dmgBar_1.png')
|
||||||
dmgBar_2 = Image.open(DMG_TEXT_PATH / 'dmgBar_2.png')
|
dmgBar_2 = Image.open(DMG_TEXT_PATH / 'dmgBar_2.png')
|
||||||
|
|
||||||
|
|
||||||
async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
async def get_first_main(mainName: str) -> str:
|
||||||
with open(DMG_PATH / 'char_action.json', "r", encoding='UTF-8') as f:
|
if '伤害加成' in mainName:
|
||||||
char_action = json.load(f)
|
equipMain = mainName[0]
|
||||||
|
elif '元素' in mainName:
|
||||||
|
equipMain = mainName[2]
|
||||||
|
elif '百分比' in mainName:
|
||||||
|
if '血量' in mainName:
|
||||||
|
equipMain = '生'
|
||||||
|
else:
|
||||||
|
equipMain = mainName[3]
|
||||||
|
else:
|
||||||
|
equipMain = mainName[0]
|
||||||
|
return equipMain
|
||||||
|
|
||||||
|
|
||||||
|
async def get_char_percent(raw_data: dict, prop: dict, char_name: str) -> str:
|
||||||
|
# print(prop)
|
||||||
|
percent = '0.0%'
|
||||||
|
weaponName = raw_data['weaponInfo']['weaponName']
|
||||||
|
|
||||||
|
equipMain = ''
|
||||||
|
for aritifact in raw_data['equipList']:
|
||||||
|
mainName = aritifact['reliquaryMainstat']['statName']
|
||||||
|
artifactsPos = aritifact['aritifactPieceName']
|
||||||
|
if artifactsPos == '时之沙':
|
||||||
|
equipMain += await get_first_main(mainName)
|
||||||
|
elif artifactsPos == '空之杯':
|
||||||
|
equipMain += await get_first_main(mainName)
|
||||||
|
elif artifactsPos == '理之冠':
|
||||||
|
equipMain += await get_first_main(mainName)
|
||||||
|
|
||||||
|
if 'equipSets' in raw_data:
|
||||||
|
equipSets = raw_data['equipSets']
|
||||||
|
else:
|
||||||
|
artifact_set_list = []
|
||||||
|
for i in raw_data['equipList']:
|
||||||
|
artifact_set_list.append(i['aritifactSetsName'])
|
||||||
|
equipSetList = set(artifact_set_list)
|
||||||
|
equipSets = {'type': '', 'set': ''}
|
||||||
|
for equip in equipSetList:
|
||||||
|
if artifact_set_list.count(equip) >= 4:
|
||||||
|
equipSets['type'] = '4'
|
||||||
|
equipSets['set'] = equip
|
||||||
|
break
|
||||||
|
elif artifact_set_list.count(equip) == 1:
|
||||||
|
pass
|
||||||
|
elif artifact_set_list.count(equip) >= 2:
|
||||||
|
equipSets['type'] += '2'
|
||||||
|
equipSets['set'] += equip
|
||||||
|
|
||||||
|
if equipSets['type'] in ['2', '']:
|
||||||
|
seq = ''
|
||||||
|
else:
|
||||||
|
seq = '{}|{}|{}'.format(
|
||||||
|
weaponName.replace('「', '').replace('」', ''),
|
||||||
|
equipSets['set'],
|
||||||
|
equipMain,
|
||||||
|
)
|
||||||
|
print(seq)
|
||||||
|
std_prop = dmgMap[char_name]
|
||||||
|
for std_seq in std_prop:
|
||||||
|
if std_seq['seq'] == seq:
|
||||||
|
std = std_seq
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
std = dmgMap[char_name][0]
|
||||||
|
print(std)
|
||||||
|
f = []
|
||||||
|
c = 0.83
|
||||||
|
if std['critRate'] != 'any':
|
||||||
|
crate = (prop['critrate'] - std['critRate']) / 2
|
||||||
|
c = c * (crate + 1)
|
||||||
|
if char_name == '珊瑚宫心海':
|
||||||
|
c = 0.83
|
||||||
|
else:
|
||||||
|
if std['critDmg'] != 'any':
|
||||||
|
f.append(float(prop['critdmg'] / std['critDmg']))
|
||||||
|
if std['atk'] != 'any':
|
||||||
|
f.append(float(prop['attack'] / std['atk']))
|
||||||
|
for i in std['other']:
|
||||||
|
if '生命' in i:
|
||||||
|
f.append(float(prop['hp'] / std['other'][i]))
|
||||||
|
elif '充能' in i:
|
||||||
|
f.append(float(prop['ce'] / std['other'][i]))
|
||||||
|
elif '精通' in i:
|
||||||
|
f.append(float(prop['em'] / std['other'][i]))
|
||||||
|
elif '防御' in i:
|
||||||
|
f.append(float(prop['defense'] / std['other'][i]))
|
||||||
|
else:
|
||||||
|
f.append(1)
|
||||||
|
print(f)
|
||||||
|
percent = '{:.2f}'.format(c * (float(sum(f) / len(f)) * 100))
|
||||||
|
return percent
|
||||||
|
|
||||||
|
|
||||||
|
async def calc_prop(raw_data: dict, power_list: dict) -> dict:
|
||||||
# 获取值
|
# 获取值
|
||||||
char_name = raw_data['avatarName']
|
char_name = raw_data['avatarName']
|
||||||
char_level = int(raw_data['avatarLevel'])
|
char_level = int(raw_data['avatarLevel'])
|
||||||
@ -47,15 +143,11 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
weaponAffix = raw_data['weaponInfo']['weaponAffix']
|
weaponAffix = raw_data['weaponInfo']['weaponAffix']
|
||||||
|
|
||||||
skillList = raw_data['avatarSkill']
|
skillList = raw_data['avatarSkill']
|
||||||
# a_skill_name = skillList[0]['skillName'].replace('普通攻击·', '')
|
|
||||||
prop = {}
|
prop = {}
|
||||||
prop['A_skill_level'] = skillList[0]['skillLevel']
|
prop['A_skill_level'] = skillList[0]['skillLevel']
|
||||||
# e_skill_name = skillList[1]['skillName']
|
|
||||||
prop['E_skill_level'] = skillList[1]['skillLevel']
|
prop['E_skill_level'] = skillList[1]['skillLevel']
|
||||||
# q_skill_name = skillList[-1]['skillName']
|
|
||||||
prop['Q_skill_level'] = skillList[-1]['skillLevel']
|
prop['Q_skill_level'] = skillList[-1]['skillLevel']
|
||||||
|
|
||||||
enemy_level = char_level
|
|
||||||
skill_add = avatarName2SkillAdd[char_name]
|
skill_add = avatarName2SkillAdd[char_name]
|
||||||
for skillAdd_index in range(0, 2):
|
for skillAdd_index in range(0, 2):
|
||||||
if len(raw_data['talentList']) >= 3 + skillAdd_index * 2:
|
if len(raw_data['talentList']) >= 3 + skillAdd_index * 2:
|
||||||
@ -83,14 +175,6 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
prop['healBouns'] = fight_prop['healBonus']
|
prop['healBouns'] = fight_prop['healBonus']
|
||||||
prop['shieldBouns'] = 0
|
prop['shieldBouns'] = 0
|
||||||
|
|
||||||
# 无action情况兜底
|
|
||||||
if char_name not in char_action:
|
|
||||||
faild_img = Image.new('RGBA', (950, 1))
|
|
||||||
return faild_img, 0
|
|
||||||
|
|
||||||
# 拿到倍率表
|
|
||||||
power_list = char_action[char_name]
|
|
||||||
|
|
||||||
# 给每个技能 分别添加上属性
|
# 给每个技能 分别添加上属性
|
||||||
for prop_attr in [
|
for prop_attr in [
|
||||||
'attack',
|
'attack',
|
||||||
@ -108,6 +192,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
'ignoreDef',
|
'ignoreDef',
|
||||||
'shieldBouns',
|
'shieldBouns',
|
||||||
'physicalDmgBonus',
|
'physicalDmgBonus',
|
||||||
|
'healBouns',
|
||||||
]:
|
]:
|
||||||
if prop_attr in ['addDmg', 'd', 'r', 'ignoreDef']:
|
if prop_attr in ['addDmg', 'd', 'r', 'ignoreDef']:
|
||||||
prop['{}'.format(prop_attr)] = 0
|
prop['{}'.format(prop_attr)] = 0
|
||||||
@ -121,6 +206,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
'ce',
|
'ce',
|
||||||
'hp',
|
'hp',
|
||||||
'physicalDmgBonus',
|
'physicalDmgBonus',
|
||||||
|
'healBouns',
|
||||||
]:
|
]:
|
||||||
prop[f'{prop_limit}_{prop_attr}'] = prop[prop_attr]
|
prop[f'{prop_limit}_{prop_attr}'] = prop[prop_attr]
|
||||||
else:
|
else:
|
||||||
@ -270,7 +356,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
del power_list['effect']
|
del power_list['effect']
|
||||||
|
|
||||||
# 特殊效果,目前有雷神满愿力
|
# 特殊效果,目前有雷神满愿力
|
||||||
extra_effect = {}
|
prop['extra_effect'] = {}
|
||||||
if 'extra' in power_list:
|
if 'extra' in power_list:
|
||||||
if char_name == '雷电将军':
|
if char_name == '雷电将军':
|
||||||
extra_value = (
|
extra_value = (
|
||||||
@ -293,7 +379,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
f'Q高空下落伤害:attack+{60*extra_value2}'
|
f'Q高空下落伤害:attack+{60*extra_value2}'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
extra_effect = {'Q梦想一刀基础伤害(满愿力)': extra_value}
|
prop['extra_effect'] = {'Q梦想一刀基础伤害(满愿力)': extra_value}
|
||||||
del power_list['extra']
|
del power_list['extra']
|
||||||
|
|
||||||
# 在计算buff前, 引入特殊效果
|
# 在计算buff前, 引入特殊效果
|
||||||
@ -302,7 +388,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
elif char_name == '钟离':
|
elif char_name == '钟离':
|
||||||
all_effect.append('r+-20')
|
all_effect.append('r+-20')
|
||||||
|
|
||||||
sp = []
|
prop['sp'] = []
|
||||||
# 计算全部的buff,添加入属性
|
# 计算全部的buff,添加入属性
|
||||||
print(all_effect)
|
print(all_effect)
|
||||||
if all_effect:
|
if all_effect:
|
||||||
@ -393,7 +479,7 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
if effect_limit:
|
if effect_limit:
|
||||||
# 如果限制条件为中文,则为特殊label才生效
|
# 如果限制条件为中文,则为特殊label才生效
|
||||||
if '\u4e00' <= effect_limit[-1] <= '\u9fff':
|
if '\u4e00' <= effect_limit[-1] <= '\u9fff':
|
||||||
sp.append(
|
prop['sp'].append(
|
||||||
{
|
{
|
||||||
'effect_name': effect_limit,
|
'effect_name': effect_limit,
|
||||||
'effect_attr': effect_attr,
|
'effect_attr': effect_attr,
|
||||||
@ -415,6 +501,19 @@ async def draw_dmgCacl_img(raw_data: dict) -> Tuple[Image.Image, int]:
|
|||||||
for attr in ['A', 'B', 'C', 'E', 'Q']:
|
for attr in ['A', 'B', 'C', 'E', 'Q']:
|
||||||
prop[f'{attr}_{effect_attr}'] += effect_value
|
prop[f'{attr}_{effect_attr}'] += effect_value
|
||||||
prop[f'{effect_attr}'] += effect_value
|
prop[f'{effect_attr}'] += effect_value
|
||||||
|
return prop
|
||||||
|
|
||||||
|
|
||||||
|
async def draw_dmgCacl_img(
|
||||||
|
raw_data: dict, power_list: dict, prop: dict
|
||||||
|
) -> Tuple[Image.Image, int]:
|
||||||
|
# 获取值
|
||||||
|
char_name = raw_data['avatarName']
|
||||||
|
char_level = int(raw_data['avatarLevel'])
|
||||||
|
enemy_level = char_level
|
||||||
|
|
||||||
|
extra_effect = prop['extra_effect']
|
||||||
|
sp = prop['sp']
|
||||||
|
|
||||||
# 计算伤害计算部分图片长宽值
|
# 计算伤害计算部分图片长宽值
|
||||||
w = 950
|
w = 950
|
||||||
|
@ -11,7 +11,13 @@ from PIL import Image, ImageDraw, ImageChops
|
|||||||
from ..utils.db_operation.db_operation import config_check
|
from ..utils.db_operation.db_operation import config_check
|
||||||
from ..utils.draw_image_tools.send_image_tool import convert_img
|
from ..utils.draw_image_tools.send_image_tool import convert_img
|
||||||
from ..utils.genshin_fonts.genshin_fonts import genshin_font_origin
|
from ..utils.genshin_fonts.genshin_fonts import genshin_font_origin
|
||||||
from .dmgCalc.dmg_calc import draw_dmgCacl_img, avatarName2SkillAdd
|
from .dmgCalc.dmg_calc import (
|
||||||
|
DMG_PATH,
|
||||||
|
calc_prop,
|
||||||
|
draw_dmgCacl_img,
|
||||||
|
get_char_percent,
|
||||||
|
avatarName2SkillAdd,
|
||||||
|
)
|
||||||
|
|
||||||
R_PATH = Path(__file__).parent
|
R_PATH = Path(__file__).parent
|
||||||
RESOURCE_PATH = Path(__file__).parents[1] / 'resource'
|
RESOURCE_PATH = Path(__file__).parents[1] / 'resource'
|
||||||
@ -159,345 +165,6 @@ async def get_all_artifacts_value(
|
|||||||
return artifactsValue
|
return artifactsValue
|
||||||
|
|
||||||
|
|
||||||
async def get_first_main(mainName: str) -> str:
|
|
||||||
if '伤害加成' in mainName:
|
|
||||||
equipMain = mainName[0]
|
|
||||||
elif '元素' in mainName:
|
|
||||||
equipMain = mainName[2]
|
|
||||||
elif '百分比' in mainName:
|
|
||||||
if '血量' in mainName:
|
|
||||||
equipMain = '生'
|
|
||||||
else:
|
|
||||||
equipMain = mainName[3]
|
|
||||||
else:
|
|
||||||
equipMain = mainName[0]
|
|
||||||
return equipMain
|
|
||||||
|
|
||||||
|
|
||||||
async def get_char_percent(raw_data: dict) -> str:
|
|
||||||
percent = '0.0'
|
|
||||||
char_name = raw_data['avatarName']
|
|
||||||
weaponName = raw_data['weaponInfo']['weaponName']
|
|
||||||
weaponType = raw_data['weaponInfo']['weaponType']
|
|
||||||
|
|
||||||
fight_prop = raw_data['avatarFightProp']
|
|
||||||
hp = fight_prop['hp']
|
|
||||||
attack = fight_prop['atk']
|
|
||||||
defense = fight_prop['def']
|
|
||||||
em = fight_prop['elementalMastery']
|
|
||||||
critrate = fight_prop['critRate']
|
|
||||||
critdmg = fight_prop['critDmg']
|
|
||||||
ce = fight_prop['energyRecharge']
|
|
||||||
dmgBonus = (
|
|
||||||
fight_prop['dmgBonus']
|
|
||||||
if fight_prop['physicalDmgBonus'] <= fight_prop['dmgBonus']
|
|
||||||
else fight_prop['physicalDmgBonus']
|
|
||||||
)
|
|
||||||
healBouns = fight_prop['healBonus']
|
|
||||||
|
|
||||||
# hp_green = fight_prop['addHp']
|
|
||||||
# attack_green = fight_prop['addAtk']
|
|
||||||
# defense_green = fight_prop['addDef']
|
|
||||||
|
|
||||||
r = 0.9
|
|
||||||
equipMain = ''
|
|
||||||
for aritifact in raw_data['equipList']:
|
|
||||||
mainName = aritifact['reliquaryMainstat']['statName']
|
|
||||||
artifactsPos = aritifact['aritifactPieceName']
|
|
||||||
if artifactsPos == '时之沙':
|
|
||||||
equipMain += await get_first_main(mainName)
|
|
||||||
elif artifactsPos == '空之杯':
|
|
||||||
equipMain += await get_first_main(mainName)
|
|
||||||
elif artifactsPos == '理之冠':
|
|
||||||
equipMain += await get_first_main(mainName)
|
|
||||||
|
|
||||||
if 'equipSets' in raw_data:
|
|
||||||
equipSets = raw_data['equipSets']
|
|
||||||
else:
|
|
||||||
artifact_set_list = []
|
|
||||||
for i in raw_data['equipList']:
|
|
||||||
artifact_set_list.append(i['aritifactSetsName'])
|
|
||||||
equipSetList = set(artifact_set_list)
|
|
||||||
equipSets = {'type': '', 'set': ''}
|
|
||||||
for equip in equipSetList:
|
|
||||||
if artifact_set_list.count(equip) >= 4:
|
|
||||||
equipSets['type'] = '4'
|
|
||||||
equipSets['set'] = equip
|
|
||||||
break
|
|
||||||
elif artifact_set_list.count(equip) == 1:
|
|
||||||
pass
|
|
||||||
elif artifact_set_list.count(equip) >= 2:
|
|
||||||
equipSets['type'] += '2'
|
|
||||||
equipSets['set'] += equip
|
|
||||||
|
|
||||||
if equipSets['type'] in ['2', '']:
|
|
||||||
seq = ''
|
|
||||||
else:
|
|
||||||
seq = '{}|{}|{}'.format(
|
|
||||||
weaponName.replace('「', '').replace('」', ''),
|
|
||||||
equipSets['set'],
|
|
||||||
equipMain,
|
|
||||||
)
|
|
||||||
|
|
||||||
if char_name in dmgMap:
|
|
||||||
for action in dmgMap[char_name]:
|
|
||||||
if action['seq'] == seq:
|
|
||||||
cal = action
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
if '钟离' in char_name:
|
|
||||||
cal = dmgMap[char_name][-1]
|
|
||||||
else:
|
|
||||||
cal = dmgMap[char_name][0]
|
|
||||||
|
|
||||||
print(seq)
|
|
||||||
print(cal)
|
|
||||||
if cal['action'] == 'E刹那之花':
|
|
||||||
effect_prop = defense
|
|
||||||
elif cal['key'] == '攻击力':
|
|
||||||
effect_prop = attack
|
|
||||||
elif cal['key'] == '防御力':
|
|
||||||
effect_prop = defense
|
|
||||||
elif cal['key'] == '血量':
|
|
||||||
effect_prop = hp
|
|
||||||
else:
|
|
||||||
effect_prop = attack
|
|
||||||
|
|
||||||
dmgBonus_value_cal = 0
|
|
||||||
dmgBonus_cal = dmgBonus
|
|
||||||
em_cal = em
|
|
||||||
|
|
||||||
if '夜兰' in char_name:
|
|
||||||
effect_prop = hp
|
|
||||||
elif '胡桃' in char_name:
|
|
||||||
effect_prop += (
|
|
||||||
0.4 * hp
|
|
||||||
if 0.4 * hp <= fight_prop['baseAtk'] * 4
|
|
||||||
else fight_prop['baseAtk'] * 4
|
|
||||||
)
|
|
||||||
elif '一斗' in char_name:
|
|
||||||
effect_prop += 0.9792 * defense
|
|
||||||
dmgBonus_value_cal += 0.35 * defense
|
|
||||||
elif '诺艾尔' in char_name:
|
|
||||||
effect_prop = attack
|
|
||||||
effect_prop += 1.3 * defense
|
|
||||||
elif '烟绯' in char_name:
|
|
||||||
dmgBonus_value_cal += 0.6 + 0.2
|
|
||||||
elif '优菈' in char_name:
|
|
||||||
r = 1.065
|
|
||||||
elif '钟离' in char_name:
|
|
||||||
r = 1.05
|
|
||||||
elif '辛焱' in char_name:
|
|
||||||
r = 1.025
|
|
||||||
|
|
||||||
if '踩班' in cal['action']:
|
|
||||||
effect_prop += 1202
|
|
||||||
effect_prop += fight_prop['baseAtk'] * 0.25
|
|
||||||
|
|
||||||
if '雾切' in weaponName:
|
|
||||||
dmgBonus_cal += 0.28
|
|
||||||
elif '弓藏' in weaponName and (
|
|
||||||
'首' in cal['action']
|
|
||||||
or '击' in cal['action']
|
|
||||||
or '两段' in cal['action']
|
|
||||||
):
|
|
||||||
dmgBonus_cal += 0.8
|
|
||||||
elif '飞雷' in weaponName and (
|
|
||||||
'首' in cal['action']
|
|
||||||
or '击' in cal['action']
|
|
||||||
or '两段' in cal['action']
|
|
||||||
):
|
|
||||||
dmgBonus_cal += 0.4
|
|
||||||
elif '阿莫斯' in weaponName:
|
|
||||||
dmgBonus_cal += 0.52
|
|
||||||
elif '破魔' in weaponName:
|
|
||||||
dmgBonus_cal += 0.18 * 2
|
|
||||||
elif '赤角石溃杵' in weaponName and (
|
|
||||||
'首' in cal['action']
|
|
||||||
or '击' in cal['action']
|
|
||||||
or '两段' in cal['action']
|
|
||||||
):
|
|
||||||
dmgBonus_value_cal += 0.4 * defense
|
|
||||||
elif '螭骨剑' in weaponName:
|
|
||||||
dmgBonus_cal += 0.4
|
|
||||||
elif '松籁响起之时' in weaponName:
|
|
||||||
effect_prop += fight_prop['baseAtk'] * 0.2
|
|
||||||
elif '试作澹月' in weaponName:
|
|
||||||
effect_prop += fight_prop['baseAtk'] * 0.72
|
|
||||||
elif '流浪乐章' in weaponName and '烟绯' in char_name:
|
|
||||||
em_cal += 480
|
|
||||||
elif '冬极' in weaponName:
|
|
||||||
effect_prop += fight_prop['baseAtk'] * 0.48
|
|
||||||
dmgBonus_cal += 0.12
|
|
||||||
|
|
||||||
if '蒸发' in cal['action'] or '融化' in cal['action']:
|
|
||||||
k = 0
|
|
||||||
if '蒸发' in cal['action']:
|
|
||||||
if raw_data['avatarElement'] == 'Pyro':
|
|
||||||
k = 1.5
|
|
||||||
else:
|
|
||||||
k = 2
|
|
||||||
elif '融化' in cal['action']:
|
|
||||||
if raw_data['avatarElement'] == 'Pyro':
|
|
||||||
k = 2
|
|
||||||
else:
|
|
||||||
k = 1.5
|
|
||||||
|
|
||||||
if equipSets['type'] in ['2', '']:
|
|
||||||
a = 0
|
|
||||||
else:
|
|
||||||
if '魔女' in equipSets['set']:
|
|
||||||
a = 0.15
|
|
||||||
else:
|
|
||||||
a = 0
|
|
||||||
add_dmg = k * (1 + (2.78 * em_cal) / (em_cal + 1400) + a)
|
|
||||||
else:
|
|
||||||
add_dmg = 1
|
|
||||||
|
|
||||||
if equipSets['type'] in ['2', '', '22']:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if '追忆' in equipSets['set']:
|
|
||||||
dmgBonus_cal += 0.5
|
|
||||||
elif '绝缘' in equipSets['set']:
|
|
||||||
Bouns = ce * 0.25 if ce * 0.25 <= 0.75 else 0.75
|
|
||||||
dmgBonus_cal += Bouns
|
|
||||||
elif '乐团' in equipSets['set']:
|
|
||||||
if weaponType in ['法器', '弓']:
|
|
||||||
dmgBonus_cal += 0.35
|
|
||||||
elif '华馆' in equipSets['set']:
|
|
||||||
if raw_data['avatarElement'] == 'Geo':
|
|
||||||
effect_prop += 0.24 * defense
|
|
||||||
dmgBonus_cal += 0.24
|
|
||||||
|
|
||||||
critdmg_cal = critdmg
|
|
||||||
healBouns_cal = healBouns
|
|
||||||
|
|
||||||
if '魈' in char_name:
|
|
||||||
dmgBonus_cal += 0.906
|
|
||||||
elif '绫华' in char_name:
|
|
||||||
dmgBonus_cal += 0.18
|
|
||||||
elif '宵宫' in char_name:
|
|
||||||
dmgBonus_cal += 0.5
|
|
||||||
elif '九条' in char_name:
|
|
||||||
effect_prop += 0.9129 * fight_prop['baseAtk']
|
|
||||||
critdmg_cal += 0.6
|
|
||||||
|
|
||||||
if '治疗' in cal['action']:
|
|
||||||
if equipSets['type'] in ['2', '']:
|
|
||||||
healBouns_cal += 0
|
|
||||||
else:
|
|
||||||
if '少女' in equipSets['set']:
|
|
||||||
healBouns_cal += 0.2
|
|
||||||
|
|
||||||
if cal['action'] == '扩散':
|
|
||||||
dmg = 868 * 1.15 * (1 + 0.6 + (16 * em_cal) / (em_cal + 2000))
|
|
||||||
elif '霄宫' in char_name:
|
|
||||||
dmg = (
|
|
||||||
effect_prop
|
|
||||||
* cal['power']
|
|
||||||
* (1 + critdmg_cal)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
* 1.5879
|
|
||||||
)
|
|
||||||
elif '班尼特' in char_name and 'Q治疗' in cal['action']:
|
|
||||||
power = cal['power'].split('+')
|
|
||||||
dmg = (effect_prop * float(power[0]) / 100 + float(power[1])) * (
|
|
||||||
1 + healBouns_cal
|
|
||||||
)
|
|
||||||
elif '心海' in char_name and cal['action'] == '开Q普攻':
|
|
||||||
dmg = (
|
|
||||||
(attack * cal['power'] + hp * (0.0971 + 0.15 * healBouns_cal))
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
)
|
|
||||||
elif '心海' in char_name and cal['action'] == '水母回血':
|
|
||||||
dmg = (862 + 0.0748 * hp) * (1 + healBouns_cal)
|
|
||||||
elif char_name in ['芭芭拉', '早柚', '琴', '七七']:
|
|
||||||
power = cal['power'].split('+')
|
|
||||||
dmg = (effect_prop * float(power[0]) / 100 + float(power[1])) * (
|
|
||||||
1 + healBouns_cal
|
|
||||||
)
|
|
||||||
elif '绫人' in char_name:
|
|
||||||
dmg = (
|
|
||||||
(effect_prop * cal['power'] + 0.0222 * hp)
|
|
||||||
* (1 + critdmg_cal)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
* 1.5879
|
|
||||||
)
|
|
||||||
elif char_name in ['荒泷一斗', '诺艾尔']:
|
|
||||||
dmg = (
|
|
||||||
(effect_prop * cal['power'] + dmgBonus_value_cal)
|
|
||||||
* (1 + critdmg_cal)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
)
|
|
||||||
elif '迪奥娜' in char_name:
|
|
||||||
dmg = (effect_prop * cal['power'] + 1905) * 1.9
|
|
||||||
elif '钟离' in char_name and 'E实际盾值' in cal['action']:
|
|
||||||
dmg = (2506 + hp * cal['power']) * 1.5 * 1.3
|
|
||||||
elif cal['action'] == 'Q开盾天星':
|
|
||||||
effect_prop = attack
|
|
||||||
dmg = (
|
|
||||||
(effect_prop * cal['power'] + 0.33 * hp)
|
|
||||||
* (1 + critdmg_cal)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
)
|
|
||||||
elif '凝光' in char_name:
|
|
||||||
dmg = (
|
|
||||||
effect_prop
|
|
||||||
* cal['power']
|
|
||||||
* (1 + critdmg_cal * critrate)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
)
|
|
||||||
elif isinstance(cal['power'], str):
|
|
||||||
if cal['power'] == '攻击力':
|
|
||||||
dmg = attack
|
|
||||||
elif cal['power'] == '防御力':
|
|
||||||
dmg = defense
|
|
||||||
else:
|
|
||||||
power = cal['power'].split('+')
|
|
||||||
dmg = effect_prop * float(power[0]) / 100 + float(power[1])
|
|
||||||
elif cal['val'] != 'any':
|
|
||||||
dmg = (
|
|
||||||
effect_prop
|
|
||||||
* cal['power']
|
|
||||||
* (1 + critdmg_cal)
|
|
||||||
* (1 + dmgBonus_cal)
|
|
||||||
* 0.5
|
|
||||||
* r
|
|
||||||
* add_dmg
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
dmg = attack
|
|
||||||
print(dmg)
|
|
||||||
|
|
||||||
if cal['val'] != 'any':
|
|
||||||
percent = '{:.2f}'.format(dmg / cal['val'] * 100)
|
|
||||||
elif cal['power'] == '攻击力':
|
|
||||||
percent = '{:.2f}'.format(dmg / cal['atk'] * 100)
|
|
||||||
elif '云堇' in char_name:
|
|
||||||
percent = '{:.2f}'.format(dmg / cal['other2'] * 100)
|
|
||||||
elif cal['power'] == '防御力':
|
|
||||||
percent = '{:.2f}'.format(dmg / cal['other'] * 100)
|
|
||||||
return percent
|
|
||||||
|
|
||||||
|
|
||||||
async def draw_char_img(
|
async def draw_char_img(
|
||||||
raw_data: dict, charUrl: Optional[str] = None
|
raw_data: dict, charUrl: Optional[str] = None
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
@ -560,7 +227,17 @@ async def draw_char_img(
|
|||||||
y2 = new_h / 2 + based_new_h / 2 - offset_y / 2
|
y2 = new_h / 2 + based_new_h / 2 - offset_y / 2
|
||||||
char_img = bg_img2.crop((x1, y1, x2, y2)) # type: ignore
|
char_img = bg_img2.crop((x1, y1, x2, y2)) # type: ignore
|
||||||
|
|
||||||
dmg_img, dmg_len = await draw_dmgCacl_img(raw_data)
|
with open(DMG_PATH / 'char_action.json', "r", encoding='UTF-8') as f:
|
||||||
|
char_action = json.load(f)
|
||||||
|
# 拿到倍率表
|
||||||
|
power_list = char_action[char_name]
|
||||||
|
new_prop = await calc_prop(raw_data, power_list)
|
||||||
|
if char_name not in char_action:
|
||||||
|
dmg_img, dmg_len = Image.new('RGBA', (950, 1)), 0
|
||||||
|
else:
|
||||||
|
dmg_img, dmg_len = await draw_dmgCacl_img(
|
||||||
|
raw_data, power_list, new_prop
|
||||||
|
)
|
||||||
img_w, img_h = 950, 1850 + dmg_len * 40
|
img_w, img_h = 950, 1850 + dmg_len * 40
|
||||||
overlay = Image.open(TEXT_PATH / 'overlay.png')
|
overlay = Image.open(TEXT_PATH / 'overlay.png')
|
||||||
overlay_w, overlay_h = overlay.size
|
overlay_w, overlay_h = overlay.size
|
||||||
@ -1053,7 +730,7 @@ async def draw_char_img(
|
|||||||
genshin_font_origin(50),
|
genshin_font_origin(50),
|
||||||
anchor='mm',
|
anchor='mm',
|
||||||
)
|
)
|
||||||
percent = await get_char_percent(raw_data)
|
percent = await get_char_percent(raw_data, new_prop, char_name)
|
||||||
img_text.text(
|
img_text.text(
|
||||||
(768, 1690),
|
(768, 1690),
|
||||||
f'{str(percent)+"%"}',
|
f'{str(percent)+"%"}',
|
||||||
@ -1088,19 +765,18 @@ async def draw_single_card(
|
|||||||
'RGBA', overlay.size, COLOR_MAP[char['avatarElement']]
|
'RGBA', overlay.size, COLOR_MAP[char['avatarElement']]
|
||||||
)
|
)
|
||||||
img_base = ImageChops.overlay(color_img, overlay)
|
img_base = ImageChops.overlay(color_img, overlay)
|
||||||
'''
|
char_img_raw = Image.open(STAND_PATH / f'{char["id"]}.png')
|
||||||
if char['char_name'] in avatarCardOffsetMap:
|
char_img = char_img_raw.resize(
|
||||||
offset_x, offset_y = (
|
(round(char_img_raw.size[0] * 0.5), round(char_img_raw.size[1] * 0.5))
|
||||||
avatarCardOffsetMap[char['char_name']][0],
|
).convert('RGBA')
|
||||||
avatarCardOffsetMap[char['char_name']][1],
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
offset_x, offset_y = 200, 0
|
|
||||||
'''
|
|
||||||
offset_x, offset_y = 0, 0
|
|
||||||
char_img = Image.open(GACHA_PATH / f'{char["char_name"]}.png')
|
|
||||||
|
|
||||||
img_base.paste(char_img, (-760 + offset_x, 110 + offset_y), char_img)
|
offset_x, offset_y = 0, 0
|
||||||
|
if char['char_name'] == '八重神子':
|
||||||
|
offset_x = -100
|
||||||
|
elif char['char_name'] == '早柚':
|
||||||
|
offset_x = 50
|
||||||
|
|
||||||
|
img_base.paste(char_img, (-380 + offset_x, 200 + offset_y), char_img)
|
||||||
img_card.paste(img_base, (-25, -260), char_card_mask)
|
img_card.paste(img_base, (-25, -260), char_card_mask)
|
||||||
img_card = Image.alpha_composite(img_card, char_card_1)
|
img_card = Image.alpha_composite(img_card, char_card_1)
|
||||||
# img_card.paste(img_card, (0, 0), img_card)
|
# img_card.paste(img_card, (0, 0), img_card)
|
||||||
@ -1189,6 +865,8 @@ async def draw_cahrcard_list(uid: str, limit: int = 24) -> Union[str, bytes]:
|
|||||||
return '你还没有已缓存的角色!\n请先使用【强制刷新】进行刷新!'
|
return '你还没有已缓存的角色!\n请先使用【强制刷新】进行刷新!'
|
||||||
|
|
||||||
char_done_list = []
|
char_done_list = []
|
||||||
|
with open(DMG_PATH / 'char_action.json', "r", encoding='UTF-8') as f:
|
||||||
|
char_action = json.load(f)
|
||||||
for char_name in char_list:
|
for char_name in char_list:
|
||||||
temp = {}
|
temp = {}
|
||||||
with open(uid_fold / f'{char_name}.json', 'r', encoding='UTF-8') as f:
|
with open(uid_fold / f'{char_name}.json', 'r', encoding='UTF-8') as f:
|
||||||
@ -1198,9 +876,13 @@ async def draw_cahrcard_list(uid: str, limit: int = 24) -> Union[str, bytes]:
|
|||||||
skillList = raw_data['avatarSkill']
|
skillList = raw_data['avatarSkill']
|
||||||
|
|
||||||
temp['char_name'] = char_name
|
temp['char_name'] = char_name
|
||||||
|
temp['id'] = raw_data['avatarId']
|
||||||
temp['avatarEnName'] = raw_data['avatarEnName']
|
temp['avatarEnName'] = raw_data['avatarEnName']
|
||||||
temp['avatarElement'] = raw_data['avatarElement']
|
temp['avatarElement'] = raw_data['avatarElement']
|
||||||
temp['percent'] = await get_char_percent(raw_data)
|
# 拿到倍率表
|
||||||
|
power_list = char_action[char_name]
|
||||||
|
new_prop = await calc_prop(raw_data, power_list)
|
||||||
|
temp['percent'] = await get_char_percent(raw_data, new_prop, char_name)
|
||||||
temp['critrate'] = fight_prop['critRate']
|
temp['critrate'] = fight_prop['critRate']
|
||||||
temp['critdmg'] = fight_prop['critDmg']
|
temp['critdmg'] = fight_prop['critDmg']
|
||||||
baseHp = fight_prop['baseHp']
|
baseHp = fight_prop['baseHp']
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
tools/blue_data/参考面板3.0.xlsx
Normal file
BIN
tools/blue_data/参考面板3.0.xlsx
Normal file
Binary file not shown.
@ -2,16 +2,27 @@ import json
|
|||||||
import asyncio
|
import asyncio
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import httpx
|
||||||
import openpyxl
|
import openpyxl
|
||||||
|
|
||||||
from ..utils.minigg_api.get_minigg_data import get_misc_info
|
|
||||||
|
|
||||||
version = '2.7.0'
|
|
||||||
version_old = '2.6.0'
|
|
||||||
|
|
||||||
R_PATH = Path(__file__).parent
|
R_PATH = Path(__file__).parent
|
||||||
DATA_PATH = R_PATH / 'blue_data'
|
DATA_PATH = R_PATH / 'blue_data'
|
||||||
ETC_PATH = Path(__file__).parents[1] / 'genshinuid_enka' / 'etc'
|
ETC_PATH = Path(__file__).parents[1] / 'genshinuid_enka' / 'dmgCalc'
|
||||||
|
|
||||||
|
|
||||||
|
async def get_misc_info(mode: str, name: str):
|
||||||
|
"""
|
||||||
|
:说明:
|
||||||
|
一些杂项信息。
|
||||||
|
:参数:
|
||||||
|
* name (str): 'enemies', 'foods', 'artifacts'。
|
||||||
|
* name (str): 参数。
|
||||||
|
:返回:
|
||||||
|
* data (str): 获取数据信息。
|
||||||
|
"""
|
||||||
|
url = 'https://info.minigg.cn/{}'.format(mode)
|
||||||
|
req = httpx.get(url=url, params={'query': name})
|
||||||
|
return req.json()
|
||||||
|
|
||||||
|
|
||||||
async def getEquipName(name: str) -> str:
|
async def getEquipName(name: str) -> str:
|
||||||
@ -26,13 +37,14 @@ async def panle2Json() -> None:
|
|||||||
访问DATA_PATH并转换数据为dmgMap.json。
|
访问DATA_PATH并转换数据为dmgMap.json。
|
||||||
"""
|
"""
|
||||||
wb = openpyxl.load_workbook(
|
wb = openpyxl.load_workbook(
|
||||||
str(DATA_PATH / '参考面板2.7(上).xlsx'), data_only=True
|
str(DATA_PATH / '参考面板3.0.xlsx'), data_only=True
|
||||||
)
|
)
|
||||||
sheet = wb.active
|
sheet = wb.active
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
char_result = []
|
char_result = []
|
||||||
char_temp = ''
|
char_temp = ''
|
||||||
|
title = 0
|
||||||
for row in range(9, 300):
|
for row in range(9, 300):
|
||||||
temp = {}
|
temp = {}
|
||||||
char_name = sheet.cell(row, 1).value
|
char_name = sheet.cell(row, 1).value
|
||||||
@ -52,78 +64,26 @@ async def panle2Json() -> None:
|
|||||||
|
|
||||||
equip_main = str(sheet.cell(row, 4).value)
|
equip_main = str(sheet.cell(row, 4).value)
|
||||||
g_atk = sheet.cell(row, 8).value
|
g_atk = sheet.cell(row, 8).value
|
||||||
other = sheet.cell(row, 9).value
|
other = {}
|
||||||
other2 = sheet.cell(row, 10).value
|
for i in [9, 10]:
|
||||||
|
if sheet.cell(title, i).value is not None:
|
||||||
|
n = str(sheet.cell(title, i).value)
|
||||||
|
if '加成' in n:
|
||||||
|
continue
|
||||||
|
if sheet.cell(row, i).value is not None:
|
||||||
|
v = float(str(sheet.cell(row, i).value))
|
||||||
|
if v:
|
||||||
|
other[sheet.cell(title, i).value] = v
|
||||||
crit_rate = sheet.cell(row, 13).value
|
crit_rate = sheet.cell(row, 13).value
|
||||||
|
crit_dmg = sheet.cell(row, 14).value
|
||||||
|
|
||||||
if equip_main[1] in ['生']:
|
|
||||||
key = '血量'
|
|
||||||
elif equip_main[1] in ['精']:
|
|
||||||
key = '元素精通'
|
|
||||||
elif equip_main[1] in ['防']:
|
|
||||||
key = '防御力'
|
|
||||||
else:
|
|
||||||
key = '攻击力'
|
|
||||||
|
|
||||||
if char_name == '夜兰':
|
|
||||||
key = '血量'
|
|
||||||
elif char_name == '五郎':
|
|
||||||
key = '防御力'
|
|
||||||
|
|
||||||
dmgBouns = sheet.cell(row, 15).value
|
|
||||||
defArea = sheet.cell(row, 16).value
|
|
||||||
resArea = sheet.cell(row, 17).value
|
|
||||||
power = sheet.cell(row, 18).value
|
|
||||||
|
|
||||||
if char_name == '七七':
|
|
||||||
power = '153+1174'
|
|
||||||
elif power == '/' or power == 0:
|
|
||||||
if char_name == '托马':
|
|
||||||
power = '14.40+4829'
|
|
||||||
elif char_name == '班尼特':
|
|
||||||
power = '12.75+1587.82'
|
|
||||||
elif char_name == '芭芭拉':
|
|
||||||
power = '35.2+4335'
|
|
||||||
elif char_name == '早柚':
|
|
||||||
power = '159.74+1280'
|
|
||||||
elif char_name == '琴':
|
|
||||||
power = '452.16+3389'
|
|
||||||
elif char_name == '申鹤':
|
|
||||||
power = '攻击力'
|
|
||||||
elif char_name == '五郎':
|
|
||||||
power = '防御力'
|
|
||||||
elif char_name == '云堇':
|
|
||||||
power = '防御力'
|
|
||||||
else:
|
|
||||||
power = 'any'
|
|
||||||
|
|
||||||
action = str(sheet.cell(row, 19).value)
|
|
||||||
if sheet.cell(row, 20).value != 'any':
|
|
||||||
val = float(
|
|
||||||
'{:.2f}'.format(
|
|
||||||
float(sheet.cell(row, 20).value) # type: ignore
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
val = 'any'
|
|
||||||
|
|
||||||
if char_name == '辛焱' and '盾' in action:
|
|
||||||
power = '2.88 + 1773'
|
|
||||||
|
|
||||||
# temp['name'] = char_name
|
|
||||||
weapon = weapon.replace('试做', '试作')
|
weapon = weapon.replace('试做', '试作')
|
||||||
temp['seq'] = '{}|{}|{}'.format(weapon, equip_set, equip_main)
|
temp['seq'] = '{}|{}|{}'.format(weapon, equip_set, equip_main)
|
||||||
temp['action'] = action
|
temp['critRate'] = crit_rate
|
||||||
temp['crit_rate'] = crit_rate
|
temp['critDmg'] = crit_dmg
|
||||||
temp['atk'] = g_atk
|
temp['atk'] = g_atk
|
||||||
temp['dmgBouns'] = dmgBouns
|
|
||||||
temp['defArea'] = defArea
|
|
||||||
temp['resArea'] = resArea
|
|
||||||
temp['other'] = other
|
temp['other'] = other
|
||||||
temp['other2'] = other2
|
|
||||||
temp['key'] = key
|
|
||||||
temp['power'] = power
|
|
||||||
temp['val'] = val
|
|
||||||
if char_temp:
|
if char_temp:
|
||||||
if char_name == char_temp:
|
if char_name == char_temp:
|
||||||
pass
|
pass
|
||||||
@ -134,10 +94,21 @@ async def panle2Json() -> None:
|
|||||||
else:
|
else:
|
||||||
char_temp = char_name
|
char_temp = char_name
|
||||||
char_result.append(temp)
|
char_result.append(temp)
|
||||||
if row == 263:
|
if row == 296:
|
||||||
print('ok!')
|
print('ok!')
|
||||||
result[char_temp] = char_result
|
result[char_temp] = char_result
|
||||||
with open(DATA_PATH / 'dmgMap.json', 'w', encoding='UTF-8') as file:
|
else:
|
||||||
|
title = row
|
||||||
|
result['旅行者'] = [
|
||||||
|
{
|
||||||
|
"seq": "护摩之杖|无锋剑|生火暴",
|
||||||
|
"critRate": 0.65,
|
||||||
|
"critDmg": 1.55,
|
||||||
|
"atk": 2300,
|
||||||
|
"other": {"生命": 16000, "元素精通": 45},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
with open(ETC_PATH / 'dmgMap.json', 'w', encoding='UTF-8') as file:
|
||||||
json.dump(result, file, ensure_ascii=False)
|
json.dump(result, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user