mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-05 19:23:45 +08:00
🚨 pre-commit-ci
修复格式错误
This commit is contained in:
parent
163644a15d
commit
b7734598d4
@ -1,18 +1,16 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Tuple, cast
|
||||
import asyncio
|
||||
|
||||
from PIL import Image
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
|
||||
from .cal_damage import cal_info
|
||||
from .to_card import api_to_card
|
||||
from ..utils.convert import get_uid
|
||||
from ..utils.sr_prefix import PREFIX
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_char_img import get_char_data
|
||||
from .get_char_img import draw_char_info_img
|
||||
from ..utils.image.convert import convert_img
|
||||
from ..utils.resource.RESOURCE_PATH import TEMP_PATH
|
||||
@ -21,6 +19,7 @@ sv_char_info_config = SV('sr面板设置', pm=2)
|
||||
sv_get_char_info = SV('sr面板查询', priority=10)
|
||||
sv_get_sr_original_pic = SV('sr查看面板原图', priority=5)
|
||||
|
||||
|
||||
@sv_get_char_info.on_prefix(f'{PREFIX}查询')
|
||||
async def send_char_info(bot: Bot, ev: Event):
|
||||
im = await _get_char_info(bot, ev, ev.text)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Union
|
||||
from typing import Dict
|
||||
|
||||
from .mono.Character import Character
|
||||
from .damage.Avatar import AvatarInstance
|
||||
|
||||
|
||||
async def cal_char_info(char_data: Dict):
|
||||
char: Character = Character(char_data)
|
||||
await char.get_equipment_info()
|
||||
@ -11,6 +11,7 @@ async def cal_char_info(char_data: Dict):
|
||||
await char.get_relic_info()
|
||||
return char
|
||||
|
||||
|
||||
async def cal_info(char_data: Dict):
|
||||
char = await cal_char_info(char_data)
|
||||
avatar = AvatarInstance(char)
|
||||
|
@ -3,9 +3,9 @@ from typing import Dict, List
|
||||
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..Role import calculate_damage, calculate_shield, calculate_heal
|
||||
from ..Base.AvatarBase import BaseAvatar, BaseAvatarBuff
|
||||
from ..Base.model import DamageInstanceSkill, DamageInstanceAvatar
|
||||
from ..Role import calculate_heal, calculate_damage, calculate_shield
|
||||
|
||||
|
||||
class Seele(BaseAvatar):
|
||||
@ -633,6 +633,7 @@ class Danhengil(BaseAvatar):
|
||||
logger.info(skill_info_list)
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Argenti(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -665,10 +666,18 @@ class Argenti(BaseAvatar):
|
||||
attribute_bonus: Dict[str, float],
|
||||
):
|
||||
talent_cc_add = self.Skill_num('Talent', 'Talent')
|
||||
attribute_bonus['CriticalChanceBase'] = talent_cc_add * 10 + attribute_bonus.get('CriticalChanceBase', 0)
|
||||
attribute_bonus[
|
||||
'CriticalChanceBase'
|
||||
] = talent_cc_add * 10 + attribute_bonus.get('CriticalChanceBase', 0)
|
||||
if self.avatar_rank >= 4:
|
||||
attribute_bonus['CriticalDamageBase'] = 0.08 + attribute_bonus.get('CriticalDamageBase', 0)
|
||||
attribute_bonus['CriticalChanceBase'] = talent_cc_add * 2 + attribute_bonus.get('CriticalChanceBase', 0)
|
||||
attribute_bonus['CriticalDamageBase'] = 0.08 + attribute_bonus.get(
|
||||
'CriticalDamageBase', 0
|
||||
)
|
||||
attribute_bonus[
|
||||
'CriticalChanceBase'
|
||||
] = talent_cc_add * 2 + attribute_bonus.get(
|
||||
'CriticalChanceBase', 0
|
||||
)
|
||||
|
||||
damage1, damage2, damage3 = await calculate_damage(
|
||||
base_attr,
|
||||
@ -721,7 +730,9 @@ class Argenti(BaseAvatar):
|
||||
self.avatar_level,
|
||||
)
|
||||
damagelist3[2] += damage3
|
||||
skill_info_list.append({'name': '终结技(90耗能)', 'damagelist': damagelist3})
|
||||
skill_info_list.append(
|
||||
{'name': '终结技(90耗能)', 'damagelist': damagelist3}
|
||||
)
|
||||
|
||||
# 计算大招2伤害
|
||||
skill_multiplier = self.Skill_num('Ultra', 'Ultra1')
|
||||
@ -749,9 +760,12 @@ class Argenti(BaseAvatar):
|
||||
damagelist5[0] = damagelist5[0] * 6 + damagelist4[0]
|
||||
damagelist5[1] = damagelist5[1] * 6 + damagelist4[1]
|
||||
damagelist5[2] = damagelist5[2] * 6 + damagelist4[2]
|
||||
skill_info_list.append({'name': '强化终结技(180耗能)', 'damagelist': damagelist5})
|
||||
skill_info_list.append(
|
||||
{'name': '强化终结技(180耗能)', 'damagelist': damagelist5}
|
||||
)
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Clara(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -835,7 +849,9 @@ class Clara(BaseAvatar):
|
||||
skill_info_list.append({'name': '反击', 'damagelist': damagelist3})
|
||||
|
||||
# 计算强化反击伤害
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num('Ultra', 'Talent1')
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num(
|
||||
'Ultra', 'Talent1'
|
||||
)
|
||||
damagelist4 = await calculate_damage(
|
||||
base_attr,
|
||||
attribute_bonus,
|
||||
@ -851,8 +867,12 @@ class Clara(BaseAvatar):
|
||||
# 计算1+1托帕反击伤害
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent')
|
||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||
add_attr_bonus['Talent_DmgRatio'] = add_attr_bonus.get('Talent_DmgRatio', 0) + 0.5
|
||||
add_attr_bonus['Talent_CriticalDamageBase'] = add_attr_bonus.get('Talent_CriticalDamageBase', 0) + 0.74
|
||||
add_attr_bonus['Talent_DmgRatio'] = (
|
||||
add_attr_bonus.get('Talent_DmgRatio', 0) + 0.5
|
||||
)
|
||||
add_attr_bonus['Talent_CriticalDamageBase'] = (
|
||||
add_attr_bonus.get('Talent_CriticalDamageBase', 0) + 0.74
|
||||
)
|
||||
damagelist5 = await calculate_damage(
|
||||
base_attr,
|
||||
add_attr_bonus,
|
||||
@ -863,13 +883,21 @@ class Clara(BaseAvatar):
|
||||
self.avatar_level,
|
||||
)
|
||||
damagelist5[2] += damage3
|
||||
skill_info_list.append({'name': '(1+1托帕)反击', 'damagelist': damagelist5})
|
||||
skill_info_list.append(
|
||||
{'name': '(1+1托帕)反击', 'damagelist': damagelist5}
|
||||
)
|
||||
|
||||
# 计算反击伤害
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num('Ultra', 'Talent1')
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num(
|
||||
'Ultra', 'Talent1'
|
||||
)
|
||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||
add_attr_bonus['Talent_DmgRatio'] = add_attr_bonus.get('Talent_DmgRatio', 0) + 0.5
|
||||
add_attr_bonus['Talent_CriticalDamageBase'] = add_attr_bonus.get('Talent_CriticalDamageBase', 0) + 0.74
|
||||
add_attr_bonus['Talent_DmgRatio'] = (
|
||||
add_attr_bonus.get('Talent_DmgRatio', 0) + 0.5
|
||||
)
|
||||
add_attr_bonus['Talent_CriticalDamageBase'] = (
|
||||
add_attr_bonus.get('Talent_CriticalDamageBase', 0) + 0.74
|
||||
)
|
||||
damagelist6 = await calculate_damage(
|
||||
base_attr,
|
||||
add_attr_bonus,
|
||||
@ -880,10 +908,13 @@ class Clara(BaseAvatar):
|
||||
self.avatar_level,
|
||||
)
|
||||
damagelist6[2] += damage3
|
||||
skill_info_list.append({'name': '(1+1托帕)强化反击', 'damagelist': damagelist6})
|
||||
skill_info_list.append(
|
||||
{'name': '(1+1托帕)强化反击', 'damagelist': damagelist6}
|
||||
)
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Silverwolf(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -980,6 +1011,7 @@ class Silverwolf(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Kafka(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1094,6 +1126,7 @@ class Kafka(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Blade(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1110,7 +1143,6 @@ class Blade(BaseAvatar):
|
||||
pass
|
||||
|
||||
def eidolons(self):
|
||||
|
||||
if self.avatar_rank >= 2:
|
||||
self.eidolon_attribute['CriticalChanceBase'] = 0.15
|
||||
if self.avatar_rank >= 4:
|
||||
@ -1121,7 +1153,9 @@ class Blade(BaseAvatar):
|
||||
logger.info('天赋施放的追加攻击伤害提高20%')
|
||||
self.extra_ability_attribute['TalentDmgAdd'] = 0.2
|
||||
logger.info('战技加伤')
|
||||
self.extra_ability_attribute['AllDamageAddedRatio'] = self.Skill_num('BPSkill', 'BPSkill')
|
||||
self.extra_ability_attribute['AllDamageAddedRatio'] = self.Skill_num(
|
||||
'BPSkill', 'BPSkill'
|
||||
)
|
||||
|
||||
async def getdamage(
|
||||
self,
|
||||
@ -1241,7 +1275,10 @@ class Blade(BaseAvatar):
|
||||
damagelist7[1] += damagelist6[1]
|
||||
damagelist7[2] += damagelist6[2]
|
||||
if self.avatar_rank >= 6:
|
||||
hp = base_attr['hp'] * (1 + attribute_bonus['HPAddedRatio']) + attribute_bonus['HPDelta']
|
||||
hp = (
|
||||
base_attr['hp'] * (1 + attribute_bonus['HPAddedRatio'])
|
||||
+ attribute_bonus['HPDelta']
|
||||
)
|
||||
damage_add = hp * 0.5
|
||||
damagelist7[0] += damage_add
|
||||
damagelist7[1] += damage_add
|
||||
@ -1250,6 +1287,7 @@ class Blade(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Fuxuan(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1271,8 +1309,12 @@ class Fuxuan(BaseAvatar):
|
||||
|
||||
def extra_ability(self):
|
||||
logger.info('符玄战技【穷观阵】属性加成')
|
||||
self.extra_ability_attribute['CriticalChanceBase'] = self.Skill_num('BPSkill', 'BPSkill_CC')
|
||||
self.extra_ability_attribute['HPAddedRatio'] = self.Skill_num('BPSkill', 'BPSkill_HP')
|
||||
self.extra_ability_attribute['CriticalChanceBase'] = self.Skill_num(
|
||||
'BPSkill', 'BPSkill_CC'
|
||||
)
|
||||
self.extra_ability_attribute['HPAddedRatio'] = self.Skill_num(
|
||||
'BPSkill', 'BPSkill_HP'
|
||||
)
|
||||
|
||||
async def getdamage(
|
||||
self,
|
||||
@ -1334,6 +1376,7 @@ class Fuxuan(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Yanqing(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1446,6 +1489,7 @@ class Yanqing(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Himeko(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1548,6 +1592,7 @@ class Himeko(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Qingque(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1577,7 +1622,9 @@ class Qingque(BaseAvatar):
|
||||
all_damage_added_ratio * 4
|
||||
)
|
||||
logger.info('默认暗杠加攻')
|
||||
self.extra_ability_attribute['AttackAddedRatio'] = self.Skill_num('Talent', 'Talent')
|
||||
self.extra_ability_attribute['AttackAddedRatio'] = self.Skill_num(
|
||||
'Talent', 'Talent'
|
||||
)
|
||||
|
||||
async def getdamage(
|
||||
self,
|
||||
@ -1639,6 +1686,7 @@ class Qingque(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Jingliu(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1765,6 +1813,7 @@ class Jingliu(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Topaz(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1844,7 +1893,9 @@ class Topaz(BaseAvatar):
|
||||
skill_info_list.append({'name': '账账', 'damagelist': damagelist2})
|
||||
|
||||
# 计算强化账账伤害
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num('Ultra', 'Talent1')
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent') + self.Skill_num(
|
||||
'Ultra', 'Talent1'
|
||||
)
|
||||
damagelist3 = await calculate_damage(
|
||||
base_attr,
|
||||
attribute_bonus,
|
||||
@ -1859,6 +1910,7 @@ class Topaz(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Guinaifen(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -1964,6 +2016,7 @@ class Guinaifen(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Gepard(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2042,6 +2095,7 @@ class Gepard(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Luocha(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2124,7 +2178,9 @@ class Luocha(BaseAvatar):
|
||||
skill_info_list.append({'name': '战技治疗量', 'damagelist': damagelist3})
|
||||
if self.avatar_rank >= 2:
|
||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||
add_attr_bonus['HealRatioBase'] = add_attr_bonus.get('HealRatioBase', 0) + 0.3
|
||||
add_attr_bonus['HealRatioBase'] = (
|
||||
add_attr_bonus.get('HealRatioBase', 0) + 0.3
|
||||
)
|
||||
damagelist4 = await calculate_heal(
|
||||
base_attr,
|
||||
add_attr_bonus,
|
||||
@ -2133,7 +2189,9 @@ class Luocha(BaseAvatar):
|
||||
skill_num,
|
||||
1,
|
||||
)
|
||||
skill_info_list.append({'name': '战技治疗量(生命<50%)(2魂)', 'damagelist': damagelist4})
|
||||
skill_info_list.append(
|
||||
{'name': '战技治疗量(生命<50%)(2魂)', 'damagelist': damagelist4}
|
||||
)
|
||||
|
||||
damagelist5 = await calculate_shield(
|
||||
base_attr,
|
||||
@ -2142,7 +2200,9 @@ class Luocha(BaseAvatar):
|
||||
240,
|
||||
1,
|
||||
)
|
||||
skill_info_list.append({'name': '战技护盾量(生命>50%)(2魂)', 'damagelist': damagelist5})
|
||||
skill_info_list.append(
|
||||
{'name': '战技护盾量(生命>50%)(2魂)', 'damagelist': damagelist5}
|
||||
)
|
||||
|
||||
# 计算天赋治疗量
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent')
|
||||
@ -2170,6 +2230,7 @@ class Luocha(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Bailu(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2262,7 +2323,9 @@ class Bailu(BaseAvatar):
|
||||
skill_multiplier,
|
||||
skill_num,
|
||||
)
|
||||
skill_info_list.append({'name': '天赋[生息]治疗量', 'damagelist': damagelist4})
|
||||
skill_info_list.append(
|
||||
{'name': '天赋[生息]治疗量', 'damagelist': damagelist4}
|
||||
)
|
||||
|
||||
# 计算天赋复活治疗量
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent1')
|
||||
@ -2274,10 +2337,13 @@ class Bailu(BaseAvatar):
|
||||
skill_multiplier,
|
||||
skill_num,
|
||||
)
|
||||
skill_info_list.append({'name': '天赋[复活]治疗量', 'damagelist': damagelist5})
|
||||
skill_info_list.append(
|
||||
{'name': '天赋[复活]治疗量', 'damagelist': damagelist5}
|
||||
)
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Lynx(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2320,7 +2386,10 @@ class Lynx(BaseAvatar):
|
||||
skill_num = self.Skill_num('BPSkill', 'BPSkill_HP_G')
|
||||
if self.avatar_rank >= 6:
|
||||
skill_multiplier += 0.06
|
||||
hp = base_attr['hp'] * (1 + attribute_bonus['HPAddedRatio']) + attribute_bonus['HPDelta']
|
||||
hp = (
|
||||
base_attr['hp'] * (1 + attribute_bonus['HPAddedRatio'])
|
||||
+ attribute_bonus['HPDelta']
|
||||
)
|
||||
hp_add = hp * skill_multiplier + skill_num
|
||||
attribute_bonus['HPDelta'] = attribute_bonus.get('HPDelta', 0) + hp_add
|
||||
|
||||
@ -2353,7 +2422,9 @@ class Lynx(BaseAvatar):
|
||||
skill_info_list.append({'name': '战技治疗量', 'damagelist': damagelist2})
|
||||
damagelist3 = []
|
||||
damagelist3.append(hp_add)
|
||||
skill_info_list.append({'name': '[求生反应]生命上限', 'damagelist': damagelist3})
|
||||
skill_info_list.append(
|
||||
{'name': '[求生反应]生命上限', 'damagelist': damagelist3}
|
||||
)
|
||||
|
||||
# 计算终结技治疗量
|
||||
skill_multiplier = self.Skill_num('Ultra', 'Ultra')
|
||||
@ -2380,8 +2451,12 @@ class Lynx(BaseAvatar):
|
||||
skill_info_list.append({'name': '天赋缓回治疗量', 'damagelist': damagelist5})
|
||||
|
||||
# 计算天赋求生反应治疗量
|
||||
skill_multiplier = self.Skill_num('Talent', 'Talent1') + self.Skill_num('Talent', 'Talent')
|
||||
skill_num = self.Skill_num('Talent', 'Talent1_G') + self.Skill_num('Talent', 'Talent_G')
|
||||
skill_multiplier = self.Skill_num(
|
||||
'Talent', 'Talent1'
|
||||
) + self.Skill_num('Talent', 'Talent')
|
||||
skill_num = self.Skill_num('Talent', 'Talent1_G') + self.Skill_num(
|
||||
'Talent', 'Talent_G'
|
||||
)
|
||||
damagelist6 = await calculate_heal(
|
||||
base_attr,
|
||||
attribute_bonus,
|
||||
@ -2389,10 +2464,13 @@ class Lynx(BaseAvatar):
|
||||
skill_multiplier,
|
||||
skill_num,
|
||||
)
|
||||
skill_info_list.append({'name': '天赋[求生反应]缓回治疗量', 'damagelist': damagelist6})
|
||||
skill_info_list.append(
|
||||
{'name': '天赋[求生反应]缓回治疗量', 'damagelist': damagelist6}
|
||||
)
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Natasha(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2412,7 +2490,9 @@ class Natasha(BaseAvatar):
|
||||
pass
|
||||
|
||||
def extra_ability(self):
|
||||
self.extra_ability_attribute['HealRatioBase'] = 0.1 + self.Skill_num('Talent', 'Talent')
|
||||
self.extra_ability_attribute['HealRatioBase'] = 0.1 + self.Skill_num(
|
||||
'Talent', 'Talent'
|
||||
)
|
||||
|
||||
async def getdamage(
|
||||
self,
|
||||
@ -2496,6 +2576,7 @@ class Natasha(BaseAvatar):
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class Mar7th(BaseAvatar):
|
||||
Buff: BaseAvatarBuff
|
||||
|
||||
@ -2585,7 +2666,11 @@ class Mar7th(BaseAvatar):
|
||||
)
|
||||
damagelist4[2] += damage3
|
||||
if self.avatar_rank >= 4:
|
||||
defence = base_attr['defence'] * (1 + attribute_bonus['DefenceAddedRatio']) + attribute_bonus['DefenceDelta']
|
||||
defence = (
|
||||
base_attr['defence']
|
||||
* (1 + attribute_bonus['DefenceAddedRatio'])
|
||||
+ attribute_bonus['DefenceDelta']
|
||||
)
|
||||
damage_add = defence * 0.3
|
||||
damagelist4[0] += damage_add
|
||||
damagelist4[1] += damage_add
|
||||
@ -2600,10 +2685,13 @@ class Mar7th(BaseAvatar):
|
||||
0.24,
|
||||
320,
|
||||
)
|
||||
skill_info_list.append({'name': '开场护盾(2命)', 'damagelist': damagelist5})
|
||||
skill_info_list.append(
|
||||
{'name': '开场护盾(2命)', 'damagelist': damagelist5}
|
||||
)
|
||||
|
||||
return skill_info_list
|
||||
|
||||
|
||||
class AvatarDamage:
|
||||
@classmethod
|
||||
def create(
|
||||
|
@ -1,16 +1,18 @@
|
||||
from typing import Dict
|
||||
import copy
|
||||
from typing import Dict
|
||||
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from .utils import merge_attribute
|
||||
|
||||
|
||||
async def calculate_heal(
|
||||
base_attr: Dict[str, float],
|
||||
attribute_bonus: Dict[str, float],
|
||||
skill_type: str,
|
||||
skill_multiplier: float,
|
||||
skill_num: float,
|
||||
is_atk = 0,
|
||||
is_atk=0,
|
||||
):
|
||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
||||
@ -29,19 +31,17 @@ async def calculate_heal(
|
||||
heal_ratio = heal_ratio_base + 1
|
||||
logger.info(f'治疗量加成: {heal_ratio}')
|
||||
|
||||
heal_num = (
|
||||
hp * skill_multiplier + skill_num
|
||||
) * heal_ratio
|
||||
heal_num = (hp * skill_multiplier + skill_num) * heal_ratio
|
||||
|
||||
return [heal_num]
|
||||
|
||||
skill_info_list = [heal_num]
|
||||
return skill_info_list
|
||||
|
||||
async def calculate_shield(
|
||||
base_attr: Dict[str, float],
|
||||
attribute_bonus: Dict[str, float],
|
||||
skill_multiplier: float,
|
||||
skill_num: float,
|
||||
is_atk = 0,
|
||||
is_atk=0,
|
||||
):
|
||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
||||
@ -57,12 +57,10 @@ async def calculate_shield(
|
||||
shield_added = shield_added_ratio + 1
|
||||
logger.info(f'护盾加成: {shield_added}')
|
||||
|
||||
defence_num = (
|
||||
defence * skill_multiplier + skill_num
|
||||
) * shield_added
|
||||
defence_num = (defence * skill_multiplier + skill_num) * shield_added
|
||||
|
||||
return [defence_num]
|
||||
|
||||
skill_info_list = [defence_num]
|
||||
return skill_info_list
|
||||
|
||||
async def calculate_damage(
|
||||
base_attr: Dict[str, float],
|
||||
@ -72,7 +70,7 @@ async def calculate_damage(
|
||||
element: str,
|
||||
skill_multiplier: float,
|
||||
level: int,
|
||||
is_hp = 0,
|
||||
is_hp=0,
|
||||
):
|
||||
logger.info(f'Skill Multiplier: {skill_multiplier}')
|
||||
logger.info(f'Skill Type: {skill_type}')
|
||||
|
@ -1,9 +1,9 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from pathlib import Path
|
||||
|
||||
from ..Base.model import DamageInstanceWeapon
|
||||
from ..Base.WeaponBase import BaseWeapon
|
||||
from ..Base.model import DamageInstanceWeapon
|
||||
|
||||
path = Path(__file__).parent.parent
|
||||
with Path.open(path / 'Excel' / 'weapon_effect.json', encoding='utf-8') as f:
|
||||
@ -1747,6 +1747,7 @@ class WorrisomeBlissf(BaseWeapon):
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 片刻,留在眼底
|
||||
class AnInstanceBeforeAGaze(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1777,6 +1778,7 @@ class AnInstanceBeforeAGaze(BaseWeapon):
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 时节不居
|
||||
class TimeWaitsforNoOne(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1796,6 +1798,7 @@ class TimeWaitsforNoOne(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 棺的回响
|
||||
class EchoesoftheCoffin(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1815,16 +1818,12 @@ class EchoesoftheCoffin(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
||||
attribute_bonus['SpeedDelta'] = (
|
||||
speed_delta
|
||||
+ (
|
||||
weapon_effect['23008']['Param']['speed'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['SpeedDelta'] = speed_delta + (
|
||||
weapon_effect['23008']['Param']['speed'][self.weapon_rank - 1]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 惊魂夜
|
||||
class NightofFright(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1855,6 +1854,7 @@ class NightofFright(BaseWeapon):
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 一场术后对话
|
||||
class PostOpConversation(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1874,16 +1874,14 @@ class PostOpConversation(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
||||
attribute_bonus['Ultra_HealRatioBase'] = (
|
||||
Ultra_HealRatioBase
|
||||
+ (
|
||||
weapon_effect['21000']['Param']['Ultra_HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['Ultra_HealRatioBase'] = Ultra_HealRatioBase + (
|
||||
weapon_effect['21000']['Param']['Ultra_HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 同一种心情
|
||||
class SharedFeeling(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1903,6 +1901,7 @@ class SharedFeeling(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 此时恰好
|
||||
class PerfectTiming(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1922,12 +1921,22 @@ class PerfectTiming(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
StatusResistance = attribute_bonus.get('StatusResistance', 0)
|
||||
HealRatioBase_maxadd = weapon_effect['21000']['Param']['HealRatioBase'][self.weapon_rank - 1]
|
||||
HealRatioBaseadd = StatusResistance * weapon_effect['21000']['Param']['StatusResistance'][self.weapon_rank - 1]
|
||||
HealRatioBase_maxadd = weapon_effect['21000']['Param'][
|
||||
'HealRatioBase'
|
||||
][self.weapon_rank - 1]
|
||||
HealRatioBaseadd = (
|
||||
StatusResistance
|
||||
* weapon_effect['21000']['Param']['StatusResistance'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
HealRatioBase = attribute_bonus.get('HealRatioBase', 0)
|
||||
attribute_bonus['HealRatioBase'] = HealRatioBase + min(HealRatioBaseadd, HealRatioBase_maxadd)
|
||||
attribute_bonus['HealRatioBase'] = HealRatioBase + min(
|
||||
HealRatioBaseadd, HealRatioBase_maxadd
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 等价交换
|
||||
class QuidProQuo(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1947,6 +1956,7 @@ class QuidProQuo(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 暖夜不会漫长
|
||||
class WarmthShortensColdNights(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1966,6 +1976,7 @@ class WarmthShortensColdNights(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 嘿,我在这儿
|
||||
class HeyOverHere(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -1985,16 +1996,14 @@ class HeyOverHere(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
HealRatioBase = attribute_bonus.get('HealRatioBase', 0)
|
||||
attribute_bonus['HealRatioBase'] = (
|
||||
HealRatioBase
|
||||
+ (
|
||||
weapon_effect['22001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['HealRatioBase'] = HealRatioBase + (
|
||||
weapon_effect['22001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 物穰
|
||||
class Cornucopia(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2014,25 +2023,24 @@ class Cornucopia(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
||||
attribute_bonus['Ultra_HealRatioBase'] = (
|
||||
Ultra_HealRatioBase
|
||||
+ (
|
||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['Ultra_HealRatioBase'] = Ultra_HealRatioBase + (
|
||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
BPSkill_HealRatioBase = attribute_bonus.get('BPSkill_HealRatioBase', 0)
|
||||
attribute_bonus['BPSkill_HealRatioBase'] = (
|
||||
BPSkill_HealRatioBase
|
||||
+ (
|
||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
BPSkill_HealRatioBase = attribute_bonus.get(
|
||||
'BPSkill_HealRatioBase', 0
|
||||
)
|
||||
attribute_bonus[
|
||||
'BPSkill_HealRatioBase'
|
||||
] = BPSkill_HealRatioBase + (
|
||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 嘉果
|
||||
class FineFruit(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2052,6 +2060,7 @@ class FineFruit(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 蕃息
|
||||
class Multiplication(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2071,6 +2080,7 @@ class Multiplication(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 但战斗还未结束
|
||||
class ButtheBattleIsnotOver(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2090,6 +2100,7 @@ class ButtheBattleIsnotOver(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 记忆中的模样
|
||||
class MemoriesofthePast(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2109,6 +2120,7 @@ class MemoriesofthePast(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 与行星相会
|
||||
class PlanetaryRendezvous(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2127,16 +2139,14 @@ class PlanetaryRendezvous(BaseWeapon):
|
||||
attribute_bonus: Dict[str, float],
|
||||
):
|
||||
all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0)
|
||||
attribute_bonus['AllDamageAddedRatio'] = (
|
||||
all_damage_added_ratio
|
||||
+ (
|
||||
weapon_effect['21011']['Param']['AllDamageAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['AllDamageAddedRatio'] = all_damage_added_ratio + (
|
||||
weapon_effect['21011']['Param']['AllDamageAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 舞!舞!舞!
|
||||
class DanceDanceDance(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2156,6 +2166,7 @@ class DanceDanceDance(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 过往未来
|
||||
class PastandFuture(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2175,6 +2186,7 @@ class PastandFuture(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 镂月裁云之意
|
||||
class CarvetheMoonWeavetheClouds(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2196,16 +2208,14 @@ class CarvetheMoonWeavetheClouds(BaseWeapon):
|
||||
attribute_bonus: Dict[str, float],
|
||||
):
|
||||
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
||||
attribute_bonus['AttackAddedRatio'] = (
|
||||
AttackAddedRatio
|
||||
+ (
|
||||
weapon_effect['21032']['Param']['AttackAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['AttackAddedRatio'] = AttackAddedRatio + (
|
||||
weapon_effect['21032']['Param']['AttackAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 齐颂
|
||||
class Chorus(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2224,16 +2234,14 @@ class Chorus(BaseWeapon):
|
||||
attribute_bonus: Dict[str, float],
|
||||
):
|
||||
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
||||
attribute_bonus['AttackAddedRatio'] = (
|
||||
AttackAddedRatio
|
||||
+ (
|
||||
weapon_effect['20005']['Param']['AttackAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['AttackAddedRatio'] = AttackAddedRatio + (
|
||||
weapon_effect['20005']['Param']['AttackAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 轮契
|
||||
class MeshingCogs(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2253,6 +2261,7 @@ class MeshingCogs(BaseWeapon):
|
||||
):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 调和
|
||||
class Mediation(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
@ -2272,16 +2281,12 @@ class Mediation(BaseWeapon):
|
||||
):
|
||||
if await self.check():
|
||||
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
||||
attribute_bonus['SpeedDelta'] = (
|
||||
speed_delta
|
||||
+ (
|
||||
weapon_effect['20019']['Param']['speed'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
attribute_bonus['SpeedDelta'] = speed_delta + (
|
||||
weapon_effect['20019']['Param']['speed'][self.weapon_rank - 1]
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
class Weapon:
|
||||
@classmethod
|
||||
def create(cls, weapon: DamageInstanceWeapon):
|
||||
|
@ -5,14 +5,29 @@ import textwrap
|
||||
from pathlib import Path
|
||||
from typing import Dict, Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from .to_data import api_to_dict
|
||||
from ..utils.error_reply import CHAR_HINT
|
||||
from ..utils.excel.read_excel import light_cone_ranks
|
||||
from .cal_damage import cal_info, cal_char_info
|
||||
from ..utils.fonts.first_world import fw_font_28
|
||||
from ..utils.excel.read_excel import light_cone_ranks
|
||||
from ..utils.map.name_covert import name_to_avatar_id, alias_to_char_name
|
||||
from ..utils.map.SR_MAP_PATH import (
|
||||
RelicId2Rarity,
|
||||
AvatarRelicScore,
|
||||
avatarId2Name,
|
||||
)
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
RELIC_PATH,
|
||||
SKILL_PATH,
|
||||
PLAYER_PATH,
|
||||
WEAPON_PATH,
|
||||
CHAR_PORTRAIT_PATH,
|
||||
)
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_18,
|
||||
sr_font_20,
|
||||
@ -23,21 +38,6 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_34,
|
||||
sr_font_38,
|
||||
)
|
||||
from ..utils.map.name_covert import alias_to_char_name, name_to_avatar_id
|
||||
from ..utils.map.SR_MAP_PATH import (
|
||||
AvatarRelicScore,
|
||||
RelicId2Rarity,
|
||||
avatarId2Name,
|
||||
)
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
CHAR_PORTRAIT_PATH,
|
||||
PLAYER_PATH,
|
||||
RELIC_PATH,
|
||||
SKILL_PATH,
|
||||
WEAPON_PATH,
|
||||
)
|
||||
from .cal_damage import cal_char_info, cal_info
|
||||
from .to_data import api_to_dict
|
||||
|
||||
Excel_path = Path(__file__).parent / 'damage'
|
||||
with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f:
|
||||
@ -300,9 +300,11 @@ async def draw_char_img(char_data: Dict, sr_uid: str, msg: str):
|
||||
rank_bg = Image.open(TEXT_PATH / 'mz_bg.png')
|
||||
rank_no_bg = Image.open(TEXT_PATH / 'mz_no_bg.png')
|
||||
if rank < char.char_rank:
|
||||
rank_img = Image.open(
|
||||
SKILL_PATH / f'{char.char_id}{RANK_MAP[rank + 1]}'
|
||||
).convert('RGBA').resize((50, 50))
|
||||
rank_img = (
|
||||
Image.open(SKILL_PATH / f'{char.char_id}{RANK_MAP[rank + 1]}')
|
||||
.convert('RGBA')
|
||||
.resize((50, 50))
|
||||
)
|
||||
rank_bg.paste(rank_img, (19, 19), rank_img)
|
||||
char_info.paste(rank_bg, (20 + rank * 80, 630), rank_bg)
|
||||
else:
|
||||
@ -325,10 +327,14 @@ async def draw_char_img(char_data: Dict, sr_uid: str, msg: str):
|
||||
for skill in char.char_skill:
|
||||
skill_attr_img = Image.open(TEXT_PATH / f'skill_attr{i + 1}.png')
|
||||
skill_panel_img = Image.open(TEXT_PATH / 'skill_panel.png')
|
||||
skill_img = Image.open(
|
||||
SKILL_PATH / f'{char.char_id}_'
|
||||
f'{skill_type_map[skill["skillAttackType"]][1]}.png'
|
||||
).convert('RGBA').resize((55, 55))
|
||||
skill_img = (
|
||||
Image.open(
|
||||
SKILL_PATH / f'{char.char_id}_'
|
||||
f'{skill_type_map[skill["skillAttackType"]][1]}.png'
|
||||
)
|
||||
.convert('RGBA')
|
||||
.resize((55, 55))
|
||||
)
|
||||
skill_panel_img.paste(skill_img, (18, 15), skill_img)
|
||||
skill_panel_img.paste(skill_attr_img, (80, 10), skill_attr_img)
|
||||
skill_panel_img_draw = ImageDraw.Draw(skill_panel_img)
|
||||
@ -781,7 +787,15 @@ async def get_relic_score(
|
||||
if weight_dict == {}:
|
||||
return 0
|
||||
if is_main:
|
||||
elementlist = ['Quantum', 'Thunder', 'Wind', 'Physical', 'Imaginary', 'Ice', 'Fire']
|
||||
elementlist = [
|
||||
'Quantum',
|
||||
'Thunder',
|
||||
'Wind',
|
||||
'Physical',
|
||||
'Imaginary',
|
||||
'Ice',
|
||||
'Fire',
|
||||
]
|
||||
if relicType in [3, 4, 5, 6]:
|
||||
if subProperty.__contains__('AddedRatio') and relicType == 5:
|
||||
if subProperty.split('AddedRatio')[0] in elementlist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user