🐛 修复因命座加成导致的技能等级错误

This commit is contained in:
omg-xtao 2022-09-10 20:22:51 +08:00 committed by 洛水居室
parent 87c7253e3a
commit ce57672274
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
3 changed files with 239 additions and 4 deletions

View File

@ -7,8 +7,11 @@ from modules.playercards.fight_prop import FightProp, FightPropScore
_project_path = os.path.dirname(__file__) _project_path = os.path.dirname(__file__)
_fight_prop_rule_file = os.path.join(_project_path, "metadata", "FightPropRule.json") _fight_prop_rule_file = os.path.join(_project_path, "metadata", "FightPropRule.json")
_fix_skills_level_file = os.path.join(_project_path, "metadata", "avatarName2SkillAdd_mapping.json")
with open(_fight_prop_rule_file, "r", encoding="utf-8") as f: with open(_fight_prop_rule_file, "r", encoding="utf-8") as f:
fight_prop_rule_data: dict = json.load(f) fight_prop_rule_data: dict = json.load(f)
with open(_fix_skills_level_file, "r", encoding="utf-8") as f:
fix_skills_level_data: dict = json.load(f)
class ArtifactStatsTheory: class ArtifactStatsTheory:

View File

@ -0,0 +1,218 @@
{
"旅行者": [
"E",
"Q"
],
"胡桃": [
"E",
"Q"
],
"托马": [
"E",
"Q"
],
"宵宫": [
"E",
"Q"
],
"烟绯": [
"E",
"Q"
],
"可莉": [
"E",
"Q"
],
"迪卢克": [
"E",
"Q"
],
"辛焱": [
"E",
"Q"
],
"安柏": [
"Q",
"E"
],
"香菱": [
"Q",
"E"
],
"班尼特": [
"E",
"Q"
],
"珊瑚宫心海": [
"Q",
"E"
],
"达达利亚": [
"E",
"Q"
],
"行秋": [
"Q",
"E"
],
"莫娜": [
"Q",
"E"
],
"芭芭拉": [
"Q",
"E"
],
"申鹤": [
"E",
"Q"
],
"神里绫华": [
"Q",
"E"
],
"优菈": [
"Q",
"E"
],
"甘雨": [
"Q",
"E"
],
"凯亚": [
"E",
"Q"
],
"重云": [
"Q",
"E"
],
"七七": [
"Q",
"E"
],
"迪奥娜": [
"Q",
"E"
],
"罗莎莉亚": [
"E",
"Q"
],
"埃洛伊": [
null,
null
],
"八重神子": [
"E",
"Q"
],
"雷电将军": [
"Q",
"E"
],
"九条裟罗": [
"Q",
"E"
],
"刻晴": [
"Q",
"E"
],
"雷泽": [
"Q",
"E"
],
"菲谢尔": [
"E",
"Q"
],
"丽莎": [
"Q",
"E"
],
"北斗": [
"E",
"Q"
],
"早柚": [
"Q",
"E"
],
"枫原万叶": [
"E",
"Q"
],
"魈": [
"E",
"Q"
],
"温迪": [
"Q",
"E"
],
"琴": [
"Q",
"E"
],
"砂糖": [
"E",
"Q"
],
"荒泷一斗": [
"E",
"Q"
],
"五郎": [
"E",
"Q"
],
"阿贝多": [
"E",
"Q"
],
"钟离": [
"E",
"Q"
],
"诺艾尔": [
"E",
"Q"
],
"凝光": [
"Q",
"E"
],
"云堇": [
"Q",
"E"
],
"神里绫人": [
"E",
"Q"
],
"夜兰": [
"Q",
"E"
],
"久岐忍": [
"E",
"Q"
],
"鹿野院平藏": [
"E",
"Q"
],
"柯莱": [
"E",
"Q"
],
"提纳里": [
"Q",
"E"
],
"多莉": [
"E",
"Q"
]
}

View File

@ -21,7 +21,7 @@ from core.template import TemplateService
from core.user import UserService from core.user import UserService
from core.user.error import UserNotFoundError from core.user.error import UserNotFoundError
from metadata.shortname import roleToName from metadata.shortname import roleToName
from modules.playercards.helpers import ArtifactStatsTheory from modules.playercards.helpers import ArtifactStatsTheory, fix_skills_level_data
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
@ -231,6 +231,8 @@ class RenderTemplate:
if artifact_total_score / 5 >= r[1]: if artifact_total_score / 5 >= r[1]:
artifact_total_score_label = r[0] artifact_total_score_label = r[0]
self.fix_skills_level()
data = { data = {
"uid": self.uid, "uid": self.uid,
"character": self.character, "character": self.character,
@ -311,9 +313,8 @@ class RenderTemplate:
if max_stat.id != 0: if max_stat.id != 0:
for item in items: for item in items:
if "元素伤害加成" in item[0]: if "元素伤害加成" in item[0] and max_stat.to_percentage_symbol() != item[1]:
if max_stat.to_percentage_symbol() != item[1]: items.remove(item)
items.remove(item)
return items return items
@ -359,3 +360,16 @@ class RenderTemplate:
for e in self.character.equipments for e in self.character.equipments
if e.type == EquipmentsType.ARTIFACT if e.type == EquipmentsType.ARTIFACT
] ]
def fix_skills_level(self) -> None:
"""修复因命座加成导致的技能等级错误"""
data = fix_skills_level_data.get(self.character.name)
if not data:
return
unlocked_constellations = len([i for i in self.character.constellations if i.unlocked])
for i in range(2):
if unlocked_constellations >= 3 + i * 2:
if data[i] == "E" and len(self.character.skills) >= 2:
self.character.skills[1].level += 3
elif data[i] == "Q" and len(self.character.skills) >= 3:
self.character.skills[2].level += 3