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
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Tuple, cast
|
from typing import Tuple, cast
|
||||||
import asyncio
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from gsuid_core.sv import SV
|
from gsuid_core.sv import SV
|
||||||
from gsuid_core.bot import Bot
|
from gsuid_core.bot import Bot
|
||||||
from gsuid_core.models import Event
|
from gsuid_core.models import Event
|
||||||
|
|
||||||
from .cal_damage import cal_info
|
|
||||||
from .to_card import api_to_card
|
from .to_card import api_to_card
|
||||||
from ..utils.convert import get_uid
|
from ..utils.convert import get_uid
|
||||||
from ..utils.sr_prefix import PREFIX
|
from ..utils.sr_prefix import PREFIX
|
||||||
from ..utils.error_reply import UID_HINT
|
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 .get_char_img import draw_char_info_img
|
||||||
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
|
||||||
@ -21,6 +19,7 @@ sv_char_info_config = SV('sr面板设置', pm=2)
|
|||||||
sv_get_char_info = SV('sr面板查询', priority=10)
|
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_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):
|
||||||
im = await _get_char_info(bot, ev, ev.text)
|
im = await _get_char_info(bot, ev, ev.text)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import json
|
from typing import Dict
|
||||||
from pathlib import Path
|
|
||||||
from typing import Dict, List, Union
|
|
||||||
from .mono.Character import Character
|
from .mono.Character import Character
|
||||||
from .damage.Avatar import AvatarInstance
|
from .damage.Avatar import AvatarInstance
|
||||||
|
|
||||||
|
|
||||||
async def cal_char_info(char_data: Dict):
|
async def cal_char_info(char_data: Dict):
|
||||||
char: Character = Character(char_data)
|
char: Character = Character(char_data)
|
||||||
await char.get_equipment_info()
|
await char.get_equipment_info()
|
||||||
@ -11,6 +11,7 @@ async def cal_char_info(char_data: Dict):
|
|||||||
await char.get_relic_info()
|
await char.get_relic_info()
|
||||||
return char
|
return char
|
||||||
|
|
||||||
|
|
||||||
async def cal_info(char_data: Dict):
|
async def cal_info(char_data: Dict):
|
||||||
char = await cal_char_info(char_data)
|
char = await cal_char_info(char_data)
|
||||||
avatar = AvatarInstance(char)
|
avatar = AvatarInstance(char)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,22 @@
|
|||||||
from typing import Dict
|
|
||||||
import copy
|
import copy
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
|
|
||||||
from .utils import merge_attribute
|
from .utils import merge_attribute
|
||||||
|
|
||||||
|
|
||||||
async def calculate_heal(
|
async def calculate_heal(
|
||||||
base_attr: Dict[str, float],
|
base_attr: Dict[str, float],
|
||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
skill_type: str,
|
skill_type: str,
|
||||||
skill_multiplier: float,
|
skill_multiplier: float,
|
||||||
skill_num: float,
|
skill_num: float,
|
||||||
is_atk = 0,
|
is_atk=0,
|
||||||
):
|
):
|
||||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||||
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
||||||
|
|
||||||
if is_atk == 1:
|
if is_atk == 1:
|
||||||
hp = merged_attr.get('attack', 0)
|
hp = merged_attr.get('attack', 0)
|
||||||
else:
|
else:
|
||||||
@ -29,23 +31,21 @@ async def calculate_heal(
|
|||||||
heal_ratio = heal_ratio_base + 1
|
heal_ratio = heal_ratio_base + 1
|
||||||
logger.info(f'治疗量加成: {heal_ratio}')
|
logger.info(f'治疗量加成: {heal_ratio}')
|
||||||
|
|
||||||
heal_num = (
|
heal_num = (hp * skill_multiplier + skill_num) * heal_ratio
|
||||||
hp * skill_multiplier + skill_num
|
|
||||||
) * heal_ratio
|
return [heal_num]
|
||||||
|
|
||||||
skill_info_list = [heal_num]
|
|
||||||
return skill_info_list
|
|
||||||
|
|
||||||
async def calculate_shield(
|
async def calculate_shield(
|
||||||
base_attr: Dict[str, float],
|
base_attr: Dict[str, float],
|
||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
skill_multiplier: float,
|
skill_multiplier: float,
|
||||||
skill_num: float,
|
skill_num: float,
|
||||||
is_atk = 0,
|
is_atk=0,
|
||||||
):
|
):
|
||||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||||
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
merged_attr = await merge_attribute(base_attr, add_attr_bonus)
|
||||||
|
|
||||||
if is_atk == 1:
|
if is_atk == 1:
|
||||||
defence = merged_attr.get('attack', 0)
|
defence = merged_attr.get('attack', 0)
|
||||||
else:
|
else:
|
||||||
@ -57,13 +57,11 @@ async def calculate_shield(
|
|||||||
shield_added = shield_added_ratio + 1
|
shield_added = shield_added_ratio + 1
|
||||||
logger.info(f'护盾加成: {shield_added}')
|
logger.info(f'护盾加成: {shield_added}')
|
||||||
|
|
||||||
defence_num = (
|
defence_num = (defence * skill_multiplier + skill_num) * shield_added
|
||||||
defence * skill_multiplier + skill_num
|
|
||||||
) * shield_added
|
return [defence_num]
|
||||||
|
|
||||||
|
|
||||||
skill_info_list = [defence_num]
|
|
||||||
return skill_info_list
|
|
||||||
|
|
||||||
async def calculate_damage(
|
async def calculate_damage(
|
||||||
base_attr: Dict[str, float],
|
base_attr: Dict[str, float],
|
||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
@ -72,15 +70,15 @@ async def calculate_damage(
|
|||||||
element: str,
|
element: str,
|
||||||
skill_multiplier: float,
|
skill_multiplier: float,
|
||||||
level: int,
|
level: int,
|
||||||
is_hp = 0,
|
is_hp=0,
|
||||||
):
|
):
|
||||||
logger.info(f'Skill Multiplier: {skill_multiplier}')
|
logger.info(f'Skill Multiplier: {skill_multiplier}')
|
||||||
logger.info(f'Skill Type: {skill_type}')
|
logger.info(f'Skill Type: {skill_type}')
|
||||||
logger.info(f'Level: {level}')
|
logger.info(f'Level: {level}')
|
||||||
# logger.info(f'attribute_bonus: {attribute_bonus}')
|
# logger.info(f'attribute_bonus: {attribute_bonus}')
|
||||||
|
|
||||||
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
add_attr_bonus = copy.deepcopy(attribute_bonus)
|
||||||
|
|
||||||
add_attr_bonus = apply_attribute_bonus(
|
add_attr_bonus = apply_attribute_bonus(
|
||||||
add_attr_bonus, skill_type, add_skill_type
|
add_attr_bonus, skill_type, add_skill_type
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
from pathlib import Path
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from ..Base.model import DamageInstanceWeapon
|
|
||||||
from ..Base.WeaponBase import BaseWeapon
|
from ..Base.WeaponBase import BaseWeapon
|
||||||
|
from ..Base.model import DamageInstanceWeapon
|
||||||
|
|
||||||
path = Path(__file__).parent.parent
|
path = Path(__file__).parent.parent
|
||||||
with Path.open(path / 'Excel' / 'weapon_effect.json', encoding='utf-8') as f:
|
with Path.open(path / 'Excel' / 'weapon_effect.json', encoding='utf-8') as f:
|
||||||
@ -1747,6 +1747,7 @@ class WorrisomeBlissf(BaseWeapon):
|
|||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 片刻,留在眼底
|
# 片刻,留在眼底
|
||||||
class AnInstanceBeforeAGaze(BaseWeapon):
|
class AnInstanceBeforeAGaze(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1777,6 +1778,7 @@ class AnInstanceBeforeAGaze(BaseWeapon):
|
|||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 时节不居
|
# 时节不居
|
||||||
class TimeWaitsforNoOne(BaseWeapon):
|
class TimeWaitsforNoOne(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1796,6 +1798,7 @@ class TimeWaitsforNoOne(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 棺的回响
|
# 棺的回响
|
||||||
class EchoesoftheCoffin(BaseWeapon):
|
class EchoesoftheCoffin(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1815,16 +1818,12 @@ class EchoesoftheCoffin(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
||||||
attribute_bonus['SpeedDelta'] = (
|
attribute_bonus['SpeedDelta'] = speed_delta + (
|
||||||
speed_delta
|
weapon_effect['23008']['Param']['speed'][self.weapon_rank - 1]
|
||||||
+ (
|
|
||||||
weapon_effect['23008']['Param']['speed'][
|
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 惊魂夜
|
# 惊魂夜
|
||||||
class NightofFright(BaseWeapon):
|
class NightofFright(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1855,6 +1854,7 @@ class NightofFright(BaseWeapon):
|
|||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 一场术后对话
|
# 一场术后对话
|
||||||
class PostOpConversation(BaseWeapon):
|
class PostOpConversation(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1874,16 +1874,14 @@ class PostOpConversation(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
||||||
attribute_bonus['Ultra_HealRatioBase'] = (
|
attribute_bonus['Ultra_HealRatioBase'] = Ultra_HealRatioBase + (
|
||||||
Ultra_HealRatioBase
|
weapon_effect['21000']['Param']['Ultra_HealRatioBase'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['21000']['Param']['Ultra_HealRatioBase'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 同一种心情
|
# 同一种心情
|
||||||
class SharedFeeling(BaseWeapon):
|
class SharedFeeling(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1903,6 +1901,7 @@ class SharedFeeling(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 此时恰好
|
# 此时恰好
|
||||||
class PerfectTiming(BaseWeapon):
|
class PerfectTiming(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1922,12 +1921,22 @@ class PerfectTiming(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
StatusResistance = attribute_bonus.get('StatusResistance', 0)
|
StatusResistance = attribute_bonus.get('StatusResistance', 0)
|
||||||
HealRatioBase_maxadd = weapon_effect['21000']['Param']['HealRatioBase'][self.weapon_rank - 1]
|
HealRatioBase_maxadd = weapon_effect['21000']['Param'][
|
||||||
HealRatioBaseadd = StatusResistance * weapon_effect['21000']['Param']['StatusResistance'][self.weapon_rank - 1]
|
'HealRatioBase'
|
||||||
|
][self.weapon_rank - 1]
|
||||||
|
HealRatioBaseadd = (
|
||||||
|
StatusResistance
|
||||||
|
* weapon_effect['21000']['Param']['StatusResistance'][
|
||||||
|
self.weapon_rank - 1
|
||||||
|
]
|
||||||
|
)
|
||||||
HealRatioBase = attribute_bonus.get('HealRatioBase', 0)
|
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
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 等价交换
|
# 等价交换
|
||||||
class QuidProQuo(BaseWeapon):
|
class QuidProQuo(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1947,6 +1956,7 @@ class QuidProQuo(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 暖夜不会漫长
|
# 暖夜不会漫长
|
||||||
class WarmthShortensColdNights(BaseWeapon):
|
class WarmthShortensColdNights(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1966,6 +1976,7 @@ class WarmthShortensColdNights(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 嘿,我在这儿
|
# 嘿,我在这儿
|
||||||
class HeyOverHere(BaseWeapon):
|
class HeyOverHere(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -1985,16 +1996,14 @@ class HeyOverHere(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
HealRatioBase = attribute_bonus.get('HealRatioBase', 0)
|
HealRatioBase = attribute_bonus.get('HealRatioBase', 0)
|
||||||
attribute_bonus['HealRatioBase'] = (
|
attribute_bonus['HealRatioBase'] = HealRatioBase + (
|
||||||
HealRatioBase
|
weapon_effect['22001']['Param']['HealRatioBase'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['22001']['Param']['HealRatioBase'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 物穰
|
# 物穰
|
||||||
class Cornucopia(BaseWeapon):
|
class Cornucopia(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2014,25 +2023,24 @@ class Cornucopia(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
Ultra_HealRatioBase = attribute_bonus.get('Ultra_HealRatioBase', 0)
|
||||||
attribute_bonus['Ultra_HealRatioBase'] = (
|
attribute_bonus['Ultra_HealRatioBase'] = Ultra_HealRatioBase + (
|
||||||
Ultra_HealRatioBase
|
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
BPSkill_HealRatioBase = attribute_bonus.get('BPSkill_HealRatioBase', 0)
|
BPSkill_HealRatioBase = attribute_bonus.get(
|
||||||
attribute_bonus['BPSkill_HealRatioBase'] = (
|
'BPSkill_HealRatioBase', 0
|
||||||
BPSkill_HealRatioBase
|
)
|
||||||
+ (
|
attribute_bonus[
|
||||||
weapon_effect['20001']['Param']['HealRatioBase'][
|
'BPSkill_HealRatioBase'
|
||||||
self.weapon_rank - 1
|
] = BPSkill_HealRatioBase + (
|
||||||
]
|
weapon_effect['20001']['Param']['HealRatioBase'][
|
||||||
)
|
self.weapon_rank - 1
|
||||||
|
]
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 嘉果
|
# 嘉果
|
||||||
class FineFruit(BaseWeapon):
|
class FineFruit(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2052,6 +2060,7 @@ class FineFruit(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 蕃息
|
# 蕃息
|
||||||
class Multiplication(BaseWeapon):
|
class Multiplication(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2071,6 +2080,7 @@ class Multiplication(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 但战斗还未结束
|
# 但战斗还未结束
|
||||||
class ButtheBattleIsnotOver(BaseWeapon):
|
class ButtheBattleIsnotOver(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2090,6 +2100,7 @@ class ButtheBattleIsnotOver(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 记忆中的模样
|
# 记忆中的模样
|
||||||
class MemoriesofthePast(BaseWeapon):
|
class MemoriesofthePast(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2109,6 +2120,7 @@ class MemoriesofthePast(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 与行星相会
|
# 与行星相会
|
||||||
class PlanetaryRendezvous(BaseWeapon):
|
class PlanetaryRendezvous(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2127,16 +2139,14 @@ class PlanetaryRendezvous(BaseWeapon):
|
|||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
):
|
):
|
||||||
all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0)
|
all_damage_added_ratio = attribute_bonus.get('AllDamageAddedRatio', 0)
|
||||||
attribute_bonus['AllDamageAddedRatio'] = (
|
attribute_bonus['AllDamageAddedRatio'] = all_damage_added_ratio + (
|
||||||
all_damage_added_ratio
|
weapon_effect['21011']['Param']['AllDamageAddedRatio'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['21011']['Param']['AllDamageAddedRatio'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 舞!舞!舞!
|
# 舞!舞!舞!
|
||||||
class DanceDanceDance(BaseWeapon):
|
class DanceDanceDance(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2156,6 +2166,7 @@ class DanceDanceDance(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 过往未来
|
# 过往未来
|
||||||
class PastandFuture(BaseWeapon):
|
class PastandFuture(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2175,6 +2186,7 @@ class PastandFuture(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 镂月裁云之意
|
# 镂月裁云之意
|
||||||
class CarvetheMoonWeavetheClouds(BaseWeapon):
|
class CarvetheMoonWeavetheClouds(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2196,16 +2208,14 @@ class CarvetheMoonWeavetheClouds(BaseWeapon):
|
|||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
):
|
):
|
||||||
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
||||||
attribute_bonus['AttackAddedRatio'] = (
|
attribute_bonus['AttackAddedRatio'] = AttackAddedRatio + (
|
||||||
AttackAddedRatio
|
weapon_effect['21032']['Param']['AttackAddedRatio'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['21032']['Param']['AttackAddedRatio'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 齐颂
|
# 齐颂
|
||||||
class Chorus(BaseWeapon):
|
class Chorus(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2224,16 +2234,14 @@ class Chorus(BaseWeapon):
|
|||||||
attribute_bonus: Dict[str, float],
|
attribute_bonus: Dict[str, float],
|
||||||
):
|
):
|
||||||
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
AttackAddedRatio = attribute_bonus.get('AttackAddedRatio', 0)
|
||||||
attribute_bonus['AttackAddedRatio'] = (
|
attribute_bonus['AttackAddedRatio'] = AttackAddedRatio + (
|
||||||
AttackAddedRatio
|
weapon_effect['20005']['Param']['AttackAddedRatio'][
|
||||||
+ (
|
self.weapon_rank - 1
|
||||||
weapon_effect['20005']['Param']['AttackAddedRatio'][
|
]
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 轮契
|
# 轮契
|
||||||
class MeshingCogs(BaseWeapon):
|
class MeshingCogs(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2253,6 +2261,7 @@ class MeshingCogs(BaseWeapon):
|
|||||||
):
|
):
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
# 调和
|
# 调和
|
||||||
class Mediation(BaseWeapon):
|
class Mediation(BaseWeapon):
|
||||||
weapon_base_attributes: Dict
|
weapon_base_attributes: Dict
|
||||||
@ -2272,16 +2281,12 @@ class Mediation(BaseWeapon):
|
|||||||
):
|
):
|
||||||
if await self.check():
|
if await self.check():
|
||||||
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
speed_delta = attribute_bonus.get('SpeedDelta', 0)
|
||||||
attribute_bonus['SpeedDelta'] = (
|
attribute_bonus['SpeedDelta'] = speed_delta + (
|
||||||
speed_delta
|
weapon_effect['20019']['Param']['speed'][self.weapon_rank - 1]
|
||||||
+ (
|
|
||||||
weapon_effect['20019']['Param']['speed'][
|
|
||||||
self.weapon_rank - 1
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return attribute_bonus
|
return attribute_bonus
|
||||||
|
|
||||||
|
|
||||||
class Weapon:
|
class Weapon:
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, weapon: DamageInstanceWeapon):
|
def create(cls, weapon: DamageInstanceWeapon):
|
||||||
|
@ -5,14 +5,29 @@ import textwrap
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
|
from PIL import Image, ImageDraw
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
from gsuid_core.utils.image.convert import convert_img
|
from gsuid_core.utils.image.convert import convert_img
|
||||||
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
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.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.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 (
|
from ..utils.fonts.starrail_fonts import (
|
||||||
sr_font_18,
|
sr_font_18,
|
||||||
sr_font_20,
|
sr_font_20,
|
||||||
@ -23,21 +38,6 @@ from ..utils.fonts.starrail_fonts import (
|
|||||||
sr_font_34,
|
sr_font_34,
|
||||||
sr_font_38,
|
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'
|
Excel_path = Path(__file__).parent / 'damage'
|
||||||
with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f:
|
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_bg = Image.open(TEXT_PATH / 'mz_bg.png')
|
||||||
rank_no_bg = Image.open(TEXT_PATH / 'mz_no_bg.png')
|
rank_no_bg = Image.open(TEXT_PATH / 'mz_no_bg.png')
|
||||||
if rank < char.char_rank:
|
if rank < char.char_rank:
|
||||||
rank_img = Image.open(
|
rank_img = (
|
||||||
SKILL_PATH / f'{char.char_id}{RANK_MAP[rank + 1]}'
|
Image.open(SKILL_PATH / f'{char.char_id}{RANK_MAP[rank + 1]}')
|
||||||
).convert('RGBA').resize((50, 50))
|
.convert('RGBA')
|
||||||
|
.resize((50, 50))
|
||||||
|
)
|
||||||
rank_bg.paste(rank_img, (19, 19), rank_img)
|
rank_bg.paste(rank_img, (19, 19), rank_img)
|
||||||
char_info.paste(rank_bg, (20 + rank * 80, 630), rank_bg)
|
char_info.paste(rank_bg, (20 + rank * 80, 630), rank_bg)
|
||||||
else:
|
else:
|
||||||
@ -325,10 +327,14 @@ async def draw_char_img(char_data: Dict, sr_uid: str, msg: str):
|
|||||||
for skill in char.char_skill:
|
for skill in char.char_skill:
|
||||||
skill_attr_img = Image.open(TEXT_PATH / f'skill_attr{i + 1}.png')
|
skill_attr_img = Image.open(TEXT_PATH / f'skill_attr{i + 1}.png')
|
||||||
skill_panel_img = Image.open(TEXT_PATH / 'skill_panel.png')
|
skill_panel_img = Image.open(TEXT_PATH / 'skill_panel.png')
|
||||||
skill_img = Image.open(
|
skill_img = (
|
||||||
SKILL_PATH / f'{char.char_id}_'
|
Image.open(
|
||||||
f'{skill_type_map[skill["skillAttackType"]][1]}.png'
|
SKILL_PATH / f'{char.char_id}_'
|
||||||
).convert('RGBA').resize((55, 55))
|
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_img, (18, 15), skill_img)
|
||||||
skill_panel_img.paste(skill_attr_img, (80, 10), skill_attr_img)
|
skill_panel_img.paste(skill_attr_img, (80, 10), skill_attr_img)
|
||||||
skill_panel_img_draw = ImageDraw.Draw(skill_panel_img)
|
skill_panel_img_draw = ImageDraw.Draw(skill_panel_img)
|
||||||
@ -781,7 +787,15 @@ async def get_relic_score(
|
|||||||
if weight_dict == {}:
|
if weight_dict == {}:
|
||||||
return 0
|
return 0
|
||||||
if is_main:
|
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 relicType in [3, 4, 5, 6]:
|
||||||
if subProperty.__contains__('AddedRatio') and relicType == 5:
|
if subProperty.__contains__('AddedRatio') and relicType == 5:
|
||||||
if subProperty.split('AddedRatio')[0] in elementlist:
|
if subProperty.split('AddedRatio')[0] in elementlist:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user