mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-05 19:23:45 +08:00
完成符玄伤害计算 (#70)
* 完成符玄伤害计算
* 完成符玄伤害计算
* 🚨 `pre-commit-ci`修复格式错误
* 完成符玄伤害计算
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
6de261cfc3
commit
7e12552b96
@ -1,19 +1,35 @@
|
||||
import re
|
||||
import json
|
||||
import math
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Dict, Union
|
||||
|
||||
from mpmath import mp, nstr
|
||||
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 .to_data import api_to_dict
|
||||
from .effect.Role import RoleInstance
|
||||
from .mono.Character import Character
|
||||
from ..utils.error_reply import CHAR_HINT
|
||||
from ..utils.excel.read_excel import light_cone_ranks
|
||||
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,
|
||||
avatarId2DamageType,
|
||||
)
|
||||
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_20,
|
||||
sr_font_23,
|
||||
@ -23,23 +39,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,
|
||||
avatarId2DamageType,
|
||||
avatarId2Name,
|
||||
)
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
CHAR_PORTRAIT_PATH,
|
||||
PLAYER_PATH,
|
||||
RELIC_PATH,
|
||||
SKILL_PATH,
|
||||
WEAPON_PATH,
|
||||
)
|
||||
from .effect.Role import RoleInstance
|
||||
from .mono.Character import Character
|
||||
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:
|
||||
@ -90,7 +89,7 @@ async def draw_char_info_img(raw_mes: str, sr_uid: str):
|
||||
return char_data
|
||||
char = await cal_char_info(char_data)
|
||||
damage_len = 0
|
||||
if char.char_id in [1102, 1204, 1107, 1213, 1006, 1005, 1205]:
|
||||
if char.char_id in [1102, 1204, 1107, 1213, 1006, 1005, 1205, 1208]:
|
||||
skill_list = skill_dict[str(char.char_id)]['skilllist']
|
||||
damage_len = len(skill_list)
|
||||
# print(damage_len)
|
||||
@ -728,7 +727,7 @@ 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, 1005, 1205]:
|
||||
if char.char_id in [1102, 1204, 1107, 1213, 1006, 1005, 1205, 1208]:
|
||||
if char.char_id == 1213:
|
||||
for skill_type in [
|
||||
'Normal',
|
||||
@ -745,6 +744,11 @@ async def cal(char_data: Dict):
|
||||
role = RoleInstance(char)
|
||||
im_tmp = await role.cal_damage(skill_type)
|
||||
skill_info_list.append(im_tmp)
|
||||
elif char.char_id == 1208:
|
||||
for skill_type in ['Normal', 'Ultra']:
|
||||
role = RoleInstance(char)
|
||||
im_tmp = await role.cal_damage(skill_type)
|
||||
skill_info_list.append(im_tmp)
|
||||
elif char.char_id == 1205:
|
||||
for skill_type in ['Normal', 'Normal1', 'Ultra']:
|
||||
role = RoleInstance(char)
|
||||
|
@ -215,11 +215,36 @@ class Blade(BaseAvatar):
|
||||
self.extra_ability_attribute['TalentDmgAdd'] = mp.mpf(0.2)
|
||||
|
||||
|
||||
class Fuxuan(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['CriticalDamageBase'] = mp.mpf(0.3)
|
||||
|
||||
def extra_ability(self):
|
||||
pass
|
||||
|
||||
|
||||
class Avatar:
|
||||
@classmethod
|
||||
def create(
|
||||
cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]
|
||||
):
|
||||
if char.id_ == 1208:
|
||||
return Fuxuan(char, skills)
|
||||
if char.id_ == 1205:
|
||||
return Blade(char, skills)
|
||||
if char.id_ == 1005:
|
||||
|
@ -97,11 +97,7 @@ class DamageInstance:
|
||||
)
|
||||
self.relic = []
|
||||
for relic in char.char_relic:
|
||||
self.relic.append(
|
||||
msgspec.convert(relic, DamageInstanceRelic)
|
||||
)
|
||||
self.relic.append(msgspec.convert(relic, DamageInstanceRelic))
|
||||
self.skill = []
|
||||
for skill in char.char_skill:
|
||||
self.skill.append(
|
||||
msgspec.convert(skill, DamageInstanceSkill)
|
||||
)
|
||||
self.skill.append(msgspec.convert(skill, DamageInstanceSkill))
|
||||
|
@ -669,5 +669,124 @@
|
||||
"Ultra": ["attack","终结技", 1],
|
||||
"Talent": ["attack","追加攻击", 1]
|
||||
}
|
||||
},
|
||||
"1208": {
|
||||
"Normal": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"Normal_HP": [
|
||||
0.2500000004656613,
|
||||
0.3000000005587935,
|
||||
0.3500000006519258,
|
||||
0.4000000007450581,
|
||||
0.4500000008381903,
|
||||
0.5000000000931323,
|
||||
0.5500000001862645,
|
||||
0.6000000002793968,
|
||||
0.6500000002793968
|
||||
],
|
||||
"BPSkill_HP": [
|
||||
0.0300000004656613,
|
||||
0.0330000004656613,
|
||||
0.0360000005587935,
|
||||
0.0390000003725290,
|
||||
0.0420000003725290,
|
||||
0.0450000003725290,
|
||||
0.0488000003725290,
|
||||
0.0525000003725290,
|
||||
0.0563000003725290,
|
||||
0.0600000003725290,
|
||||
0.0630000003725290,
|
||||
0.0660000003725290,
|
||||
0.0690000003725290,
|
||||
0.0720000003725290,
|
||||
0.0750000003725290
|
||||
],
|
||||
"BPSkill_CC": [
|
||||
0.0600000004656613,
|
||||
0.0660000004656613,
|
||||
0.0720000005587935,
|
||||
0.0780000003725290,
|
||||
0.0840000003725290,
|
||||
0.0900000003725290,
|
||||
0.0975000003725290,
|
||||
0.1050000003725290,
|
||||
0.1125000003725290,
|
||||
0.1200000003725290,
|
||||
0.1260000003725290,
|
||||
0.1320000003725290,
|
||||
0.1380000003725290,
|
||||
0.1440000003725290,
|
||||
0.1500000003725290
|
||||
],
|
||||
"Ultra": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"Ultra_HP": [
|
||||
0.6000000003725290,
|
||||
0.6400000003725290,
|
||||
0.6800000003725290,
|
||||
0.7200000003725290,
|
||||
0.7600000003725290,
|
||||
0.8000000003725290,
|
||||
0.8500000003725290,
|
||||
0.9000000003725290,
|
||||
0.9500000003725290,
|
||||
1.0000000003725290,
|
||||
1.0400000003725290,
|
||||
1.0800000003725290,
|
||||
1.1200000003725290,
|
||||
1.1600000003725290,
|
||||
1.2000000003725290
|
||||
],
|
||||
"Talent": [
|
||||
0.2200000003725290,
|
||||
0.2420000003725290,
|
||||
0.2640000003725290,
|
||||
0.2860000003725290,
|
||||
0.3080000003725290,
|
||||
0.3300000003725290,
|
||||
0.3575000003725290,
|
||||
0.3850000003725290,
|
||||
0.4125000003725290,
|
||||
0.4400000003725290,
|
||||
0.4620000003725290,
|
||||
0.4840000003725290,
|
||||
0.5060000003725290,
|
||||
0.5280000003725290,
|
||||
0.5500000003725290
|
||||
],
|
||||
"Maze": [
|
||||
20
|
||||
],
|
||||
"Ultra_Use": [
|
||||
135
|
||||
],
|
||||
"skilllist": {
|
||||
"Normal": ["attack","普攻", 1],
|
||||
"Ultra": ["attack","终结技", 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,10 +225,21 @@
|
||||
0.12000000022351742,
|
||||
0.1500000002793968,
|
||||
0.1800000003352761,
|
||||
0.210000003911555,
|
||||
0.2100000003911555,
|
||||
0.24000000044703484
|
||||
]
|
||||
}
|
||||
},
|
||||
"23011": {
|
||||
"Param": {
|
||||
"AllDamageAddedRatio": [
|
||||
0.09000000022351742,
|
||||
0.1050000002793968,
|
||||
0.1200000003352761,
|
||||
0.1350000003911555,
|
||||
0.15000000044703484
|
||||
]
|
||||
}
|
||||
},
|
||||
"21022": {
|
||||
"Param": {
|
||||
|
@ -1,13 +1,12 @@
|
||||
from mpmath import mp
|
||||
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..mono.Character import Character
|
||||
from .Avatar.Avatar import Avatar
|
||||
from .Weapon.Weapon import Weapon
|
||||
from .utils import merge_attribute
|
||||
from ..mono.Character import Character
|
||||
from .Base.model import DamageInstance
|
||||
from .Relic.Relic import RelicSet, SingleRelic
|
||||
from .utils import merge_attribute
|
||||
from .Weapon.Weapon import Weapon
|
||||
|
||||
mp.dps = 14
|
||||
|
||||
@ -163,6 +162,22 @@ class RoleInstance:
|
||||
|
||||
logger.info(f'技能区总: {skill_multiplier}')
|
||||
|
||||
if self.raw_data.avatar.id_ == 1208:
|
||||
logger.info(f'符玄战技【穷观阵】属性加成')
|
||||
fx_cc_up = self.avatar.BPSkill_num('BPSkill_CC')
|
||||
fx_hp_up = self.avatar.BPSkill_num('BPSkill_HP')
|
||||
critical_chance_base = self.attribute_bonus.get(
|
||||
'CriticalChanceBase', 0
|
||||
)
|
||||
self.attribute_bonus[
|
||||
'CriticalChanceBase'
|
||||
] = critical_chance_base + mp.mpf(fx_cc_up)
|
||||
|
||||
hp_added_ratio = self.attribute_bonus.get('HPAddedRatio', 0)
|
||||
self.attribute_bonus['HPAddedRatio'] = hp_added_ratio + mp.mpf(
|
||||
fx_hp_up
|
||||
)
|
||||
|
||||
# 检查武器战斗生效的buff
|
||||
logger.info('检查武器战斗生效的buff')
|
||||
Ultra_Use = self.avatar.Ultra_Use()
|
||||
@ -222,18 +237,32 @@ class RoleInstance:
|
||||
damage_add = 0
|
||||
hp_multiplier = 0
|
||||
hp_num = 0
|
||||
if self.raw_data.avatar.id_ == 1205:
|
||||
if self.raw_data.avatar.id_ in [1205, 1208]:
|
||||
hp_num = merged_attr['hp']
|
||||
if skill_type == 'Normal1':
|
||||
if skill_type == 'Normal':
|
||||
if self.raw_data.avatar.id_ == 1208:
|
||||
hp_multiplier = self.avatar.Normalnum('Normal_HP')
|
||||
elif skill_type == 'Normal1':
|
||||
hp_multiplier = self.avatar.Normalnum('Normal1_HP')
|
||||
skill_type = 'Normal'
|
||||
elif skill_type == 'Ultra':
|
||||
hp_multiplier = self.avatar.Ultra_num('Ultra_HP')
|
||||
if self.raw_data.avatar.rank >= 1:
|
||||
if (
|
||||
self.raw_data.avatar.rank >= 1
|
||||
and self.raw_data.avatar.id_ == 1205
|
||||
):
|
||||
hp_multiplier += 0.9
|
||||
if (
|
||||
self.raw_data.avatar.rank >= 6
|
||||
and self.raw_data.avatar.id_ == 1208
|
||||
):
|
||||
hp_multiplier += 1.2
|
||||
elif skill_type == 'Talent':
|
||||
hp_multiplier = self.avatar.Talent_num('Talent_HP')
|
||||
if self.raw_data.avatar.rank >= 6:
|
||||
if (
|
||||
self.raw_data.avatar.rank >= 6
|
||||
and self.raw_data.avatar.id_ == 1205
|
||||
):
|
||||
damage_add = hp_num * 0.5
|
||||
else:
|
||||
hp_multiplier = 0
|
||||
@ -412,10 +441,14 @@ class RoleInstance:
|
||||
attack_tz = (
|
||||
attr_value_tz
|
||||
+ attr_value_tz
|
||||
* (1 + self.attribute_bonus.get('AttackAddedRatio', 0) + 2.144)
|
||||
* (
|
||||
1
|
||||
+ self.attribute_bonus.get('AttackAddedRatio', 0)
|
||||
+ 2.144
|
||||
)
|
||||
+ self.attribute_bonus['AttackDelta']
|
||||
)
|
||||
if self.raw_data.avatar.id_ == 1205:
|
||||
if self.raw_data.avatar.id_ in [1205, 1208]:
|
||||
attack_tz = (skill_multiplier * attack_tz) + (
|
||||
hp_multiplier * hp_num
|
||||
)
|
||||
|
@ -1117,10 +1117,41 @@ class GoodNightandSleepWell(BaseWeapon):
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
# 她已闭上双眼
|
||||
class SheAlreadyShutHerEyes(BaseWeapon):
|
||||
weapon_base_attributes: Dict
|
||||
|
||||
def __init__(self, weapon: DamageInstanceWeapon):
|
||||
super().__init__(weapon)
|
||||
|
||||
async def check(self):
|
||||
# 当装备者的生命值降低时,使我方全体造成的伤害提高15%
|
||||
return True
|
||||
|
||||
async def weapon_ability(
|
||||
self, Ultra_Use: 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['23011']['Param']['AllDamageAddedRatio'][
|
||||
self.weapon_rank - 1
|
||||
]
|
||||
)
|
||||
* 3
|
||||
)
|
||||
return attribute_bonus
|
||||
|
||||
|
||||
class Weapon:
|
||||
@classmethod
|
||||
def create(cls, weapon: DamageInstanceWeapon):
|
||||
if weapon.id_ in [
|
||||
23011,
|
||||
23007,
|
||||
21005,
|
||||
21019,
|
||||
@ -1159,6 +1190,8 @@ class Weapon:
|
||||
21008,
|
||||
21001,
|
||||
]:
|
||||
if weapon.id_ == 23011:
|
||||
return SheAlreadyShutHerEyes(weapon)
|
||||
if weapon.id_ == 21001:
|
||||
return GoodNightandSleepWell(weapon)
|
||||
if weapon.id_ == 21008:
|
||||
|
@ -1,37 +1,37 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Union
|
||||
from typing import List, Union, Optional
|
||||
|
||||
from httpx import ReadTimeout
|
||||
from mpmath import mp
|
||||
from httpx import ReadTimeout
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..sruid_utils.api.mihomo import MihomoData
|
||||
from ..sruid_utils.api.mihomo.models import Avatar
|
||||
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
||||
from ..sruid_utils.api.mihomo.requests import get_char_card_info
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
# from gsuid_core.utils.api.minigg.request import get_weapon_info
|
||||
from .cal_value import cal_relic_sub_affix, cal_relic_main_affix
|
||||
from ..utils.excel.read_excel import AvatarPromotion, EquipmentPromotion
|
||||
from ..utils.map.SR_MAP_PATH import (
|
||||
AvatarRankSkillUp,
|
||||
EquipmentID2Name,
|
||||
EquipmentID2Rarity,
|
||||
SetId2Name,
|
||||
ItemId2Name,
|
||||
Property2Name,
|
||||
RelicId2SetId,
|
||||
SetId2Name,
|
||||
avatarId2DamageType,
|
||||
avatarId2EnName,
|
||||
EquipmentID2Name,
|
||||
AvatarRankSkillUp,
|
||||
EquipmentID2Rarity,
|
||||
rankId2Name,
|
||||
skillId2Name,
|
||||
avatarId2Name,
|
||||
skillId2Effect,
|
||||
avatarId2EnName,
|
||||
avatarId2Rarity,
|
||||
characterSkillTree,
|
||||
rankId2Name,
|
||||
skillId2AttackType,
|
||||
skillId2Effect,
|
||||
skillId2Name,
|
||||
avatarId2DamageType,
|
||||
)
|
||||
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
||||
|
||||
# from gsuid_core.utils.api.minigg.request import get_weapon_info
|
||||
from .cal_value import cal_relic_main_affix, cal_relic_sub_affix
|
||||
|
||||
mp.dps = 14
|
||||
|
||||
@ -242,14 +242,15 @@ async def get_data(char: Avatar, sr_data: MihomoData, sr_uid: str):
|
||||
skill_id = item['id']
|
||||
skill_up_num = item['num']
|
||||
# 查找skill_id在不在avatarSkill中
|
||||
for index, skill_item in enumerate(char_data['avatarSkill']):
|
||||
if skill_id == str(skill_item['skillId']):
|
||||
char_data['avatarSkill'][index]['skillLevel'] += skill_up_num
|
||||
for index, skill_item in enumerate(
|
||||
char_data['avatarSkill']
|
||||
):
|
||||
if str(skill_id) == str(skill_item['skillId']):
|
||||
char_data['avatarSkill'][index][
|
||||
'skillLevel'
|
||||
] += skill_up_num
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
||||
# 处理基础属性
|
||||
base_attributes = {}
|
||||
avatar_promotion_base = AvatarPromotion[str(char['avatarId'])][
|
||||
|
@ -1,12 +1,12 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
|
||||
from ..utils.convert import get_uid
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..utils.sr_prefix import PREFIX
|
||||
from .draw_gachalogs import draw_gachalogs_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .get_gachalogs import save_gachalogs
|
||||
from .draw_gachalogs import draw_gachalogs_img
|
||||
|
||||
sv_gacha_log = SV('sr抽卡记录')
|
||||
sv_get_gachalog_by_link = SV('sr导入抽卡链接', area='DIRECT')
|
||||
|
@ -1,5 +1,5 @@
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, TypedDict, Union
|
||||
from typing import Dict, List, Union, TypedDict
|
||||
|
||||
from msgspec import json as msgjson
|
||||
|
||||
@ -41,6 +41,7 @@ class TS(TypedDict):
|
||||
Name: Dict[str, str]
|
||||
Icon: Dict[str, str]
|
||||
|
||||
|
||||
class LU(TypedDict):
|
||||
id: str
|
||||
num: int
|
||||
@ -117,4 +118,6 @@ with Path.open(MAP / AvatarRelicScore_fileName, encoding='UTF-8') as f:
|
||||
AvatarRelicScore = msgjson.decode(f.read(), type=List[Dict])
|
||||
|
||||
with Path.open(MAP / avatarRankSkillUp_fileName, encoding='UTF-8') as f:
|
||||
AvatarRankSkillUp = msgjson.decode(f.read(), type=Dict[str, Union[List[LU], None]])
|
||||
AvatarRankSkillUp = msgjson.decode(
|
||||
f.read(), type=Dict[str, Union[List[LU], None]]
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user