diff --git a/backend/core/basic/character/base.py b/backend/core/basic/character/base.py index d6b77be5..e814442f 100644 --- a/backend/core/basic/character/base.py +++ b/backend/core/basic/character/base.py @@ -5,7 +5,7 @@ from core.abstract.character import CharacterProperty from core.basic.skill import Skill from core.basic.equipment import EquEffect, OathSuit, OathSuitSkill, Suit from ..formula import 获取基础属性, 获取唤醒属性 -from ..roleinfo import CharacterEquipInfo, get_key_by_value, CharacterOathInfo +from ..roleinfo import CharacterEmblemInfo, CharacterEquipInfo, get_key_by_value, CharacterOathInfo from .jade import Jade @@ -20,6 +20,8 @@ class CharacterBase(CharacterProperty): """装备版本""" charEquipInfo: dict[str, 'CharacterEquipInfo'] """装备打造信息""" + charEmblemInfo: list['CharacterEmblemInfo'] + """徽章打造信息""" charOathInfo: list['CharacterOathInfo'] """誓约打造信息""" charOathSkillId: int diff --git a/backend/core/basic/character/calc_equip.py b/backend/core/basic/character/calc_equip.py index a202d37d..50f9c70d 100644 --- a/backend/core/basic/character/calc_equip.py +++ b/backend/core/basic/character/calc_equip.py @@ -3,7 +3,7 @@ from uuid import uuid1 from core.basic.equipment import OathSuit, Suit, get_equipment from ..formula import 增幅计算, 强化技攻, 武器强化计算, 精通计算, 耳环计算, 左右计算, 锻造计算 -from ..roleinfo import CharacterEquipInfo, CharacterOathInfo, get_key_by_value +from ..roleinfo import CharacterEmblemInfo, CharacterEquipInfo, CharacterOathInfo, get_key_by_value from .base import CharacterBase @@ -16,12 +16,21 @@ class CalcEquipMixin(CharacterBase): """打造信息导入""" self.charEquipInfo = {} self.charOathInfo = [] + self.charEmblemInfo = [] self.bindAwake = info.get('bindAwake', 50) for key in info['equips']: self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key) for key in info['oaths']: # 导入誓约打造信息、誓约信息 self.charOathInfo.append(CharacterOathInfo(info['oaths'][key], self.equVersion, key)) + # 异常处理 彩色等级自动取最小值 + minEmblemLv = min([info['emblems'][key]['lv'] for key in ['红色', '蓝色', '绿色', '黄色']], default=1) + info['emblems']['彩色']['lv'] = minEmblemLv + for key in info['emblems']: + # 导入徽章打造信息、徽章信息 + info['emblems'][key]['part'] = key + self.charEmblemInfo.append(CharacterEmblemInfo(info['emblems'][key])) + pass self.charOathSkillId = info.get('oathSkill', 1) def calc_init(self, setInfo: dict[str, dict]): @@ -208,7 +217,22 @@ class CalcEquipMixin(CharacterBase): # if fun is not None: # fun(self) + def calc_emblems(self): + """计算徽章效果""" + effects = get_equipment(self.equVersion).funs + emblemCombine = effects.execture('emblem_combine') + for emblem in self.charEmblemInfo: + for item in emblem.items: + fun = effects.execture(f'emblem_{item}') + if fun is not None: + fun(self) + emblemCombine(self, emblem.part, emblem.lv, emblem.items) + pass + pass + def calc_oaths(self): + """计算装备基础效果""" + effects = get_equipment(self.equVersion).funs pass def calc_avatar(self, avatar: dict): @@ -320,6 +344,7 @@ class CalcEquipMixin(CharacterBase): self.calc_avatar(setInfo.get('avatar', {})) self.calc_basic() self.calc_sundry(setInfo.get('sundry', {})) + self.calc_emblems() suit = self.calc_suits() self.calc_equs() self.calc_oaths() diff --git a/backend/core/basic/roleinfo.py b/backend/core/basic/roleinfo.py index 413af6d5..c9252ad8 100644 --- a/backend/core/basic/roleinfo.py +++ b/backend/core/basic/roleinfo.py @@ -71,6 +71,18 @@ class CharacterOathInfo: self.oathInfo = None +class CharacterEmblemInfo: + part: str + """星徽部位""" + items: list[str] + """徽章id列表""" + lv: int + """星徽等级""" + + def __init__(self, info={}) -> None: + self.__dict__.update(info) + + class CharacterWeaponInfo(CharacterEquipInfo): refine: int """锻造等级""" diff --git a/backend/core/equipment/version_0/emblem.py b/backend/core/equipment/version_0/emblem.py index 624028ee..bd2fcadb 100644 --- a/backend/core/equipment/version_0/emblem.py +++ b/backend/core/equipment/version_0/emblem.py @@ -516,7 +516,7 @@ def emblem_4701(char: CharacterProperty): @register -def emblem_combine(char: CharacterProperty, position: str, lv: int, emblem_list: list[int | str]): +def emblem_combine(char: CharacterProperty, position: str, lv: int = 1, emblem_list: list[int | str] = []): bufferP = [0.001, 0.002, 0.004, 0.006, 0.008, 0.01, 0.013, 0.016, 0.019, 0.022, 0.025, 0.026, 0.027, 0.028, 0.029, 0.03] buffer = [10, 30, 60, 90, 120, 150, 180, 210, 240270, 300, 320, 340, 360, 380, 400] skillAttack = [0.002, 0.004, 0.008, 0.012, 0.016, 0.02, 0.023, 0.026, 0.029, 0.032, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04] @@ -548,7 +548,9 @@ def emblem_combine(char: CharacterProperty, position: str, lv: int, emblem_list: skillAttack = [0.002, 0.003, 0.005, 0.006] buffer = [20, 30, 50, 60] pass + SkillAttack = 0 + Buffer = 0 for i in emblem_raritys: - char.SetStatus(SkillAttack=skillAttack[i - 1], Buffer=buffer[i - 1]) - pass - pass + SkillAttack += skillAttack[i - 1] + Buffer += buffer[i - 1] + char.SetStatus(SkillAttack=SkillAttack, Buffer=Buffer) diff --git a/backend/core/equipment/version_0/oath.py b/backend/core/equipment/version_0/oath.py new file mode 100644 index 00000000..bee80f95 --- /dev/null +++ b/backend/core/equipment/version_0/oath.py @@ -0,0 +1,543 @@ +from core.basic.equipment import EquEffect +from core.abstract.character import CharacterProperty +from .register import register + + +@register +def oath_2010100(char: CharacterProperty): + pass + + +@register +def oath_2010200(char: CharacterProperty): + pass + + +@register +def oath_2010201(char: CharacterProperty): + pass + + +@register +def oath_2010300(char: CharacterProperty): + pass + + +@register +def oath_2010301(char: CharacterProperty): + pass + + +@register +def oath_2010400(char: CharacterProperty): + pass + + +@register +def oath_2010401(char: CharacterProperty): + pass + + +@register +def oath_2010500(char: CharacterProperty): + pass + + +@register +def oath_2010501(char: CharacterProperty): + pass + + +@register +def oath_2020100(char: CharacterProperty): + pass + + +@register +def oath_2020200(char: CharacterProperty): + pass + + +@register +def oath_2020201(char: CharacterProperty): + pass + + +@register +def oath_2020300(char: CharacterProperty): + pass + + +@register +def oath_2020301(char: CharacterProperty): + pass + + +@register +def oath_2020400(char: CharacterProperty): + pass + + +@register +def oath_2020401(char: CharacterProperty): + pass + + +@register +def oath_2020500(char: CharacterProperty): + pass + + +@register +def oath_2020501(char: CharacterProperty): + pass + + +@register +def oath_2030100(char: CharacterProperty): + pass + + +@register +def oath_2030200(char: CharacterProperty): + pass + + +@register +def oath_2030201(char: CharacterProperty): + pass + + +@register +def oath_2030300(char: CharacterProperty): + pass + + +@register +def oath_2030301(char: CharacterProperty): + pass + + +@register +def oath_2030400(char: CharacterProperty): + pass + + +@register +def oath_2030401(char: CharacterProperty): + pass + + +@register +def oath_2030500(char: CharacterProperty): + pass + + +@register +def oath_2030501(char: CharacterProperty): + pass + + +@register +def oath_2040100(char: CharacterProperty): + pass + + +@register +def oath_2040200(char: CharacterProperty): + pass + + +@register +def oath_2040201(char: CharacterProperty): + pass + + +@register +def oath_2040300(char: CharacterProperty): + pass + + +@register +def oath_2040301(char: CharacterProperty): + pass + + +@register +def oath_2040400(char: CharacterProperty): + pass + + +@register +def oath_2040401(char: CharacterProperty): + pass + + +@register +def oath_2040500(char: CharacterProperty): + pass + + +@register +def oath_2040501(char: CharacterProperty): + pass + + +@register +def oath_2050100(char: CharacterProperty): + pass + + +@register +def oath_2050200(char: CharacterProperty): + pass + + +@register +def oath_2050201(char: CharacterProperty): + pass + + +@register +def oath_2050300(char: CharacterProperty): + pass + + +@register +def oath_2050301(char: CharacterProperty): + pass + + +@register +def oath_2050400(char: CharacterProperty): + pass + + +@register +def oath_2050401(char: CharacterProperty): + pass + + +@register +def oath_2050500(char: CharacterProperty): + pass + + +@register +def oath_2050501(char: CharacterProperty): + pass + + +@register +def oath_2060100(char: CharacterProperty): + pass + + +@register +def oath_2060200(char: CharacterProperty): + pass + + +@register +def oath_2060201(char: CharacterProperty): + pass + + +@register +def oath_2060300(char: CharacterProperty): + pass + + +@register +def oath_2060301(char: CharacterProperty): + pass + + +@register +def oath_2060400(char: CharacterProperty): + pass + + +@register +def oath_2060401(char: CharacterProperty): + pass + + +@register +def oath_2060500(char: CharacterProperty): + pass + + +@register +def oath_2060501(char: CharacterProperty): + pass + + +@register +def oath_2070100(char: CharacterProperty): + pass + + +@register +def oath_2070200(char: CharacterProperty): + pass + + +@register +def oath_2070201(char: CharacterProperty): + pass + + +@register +def oath_2070300(char: CharacterProperty): + pass + + +@register +def oath_2070301(char: CharacterProperty): + pass + + +@register +def oath_2070400(char: CharacterProperty): + pass + + +@register +def oath_2070401(char: CharacterProperty): + pass + + +@register +def oath_2070500(char: CharacterProperty): + pass + + +@register +def oath_2070501(char: CharacterProperty): + pass + + +@register +def oath_2080100(char: CharacterProperty): + pass + + +@register +def oath_2080200(char: CharacterProperty): + pass + + +@register +def oath_2080201(char: CharacterProperty): + pass + + +@register +def oath_2080300(char: CharacterProperty): + pass + + +@register +def oath_2080301(char: CharacterProperty): + pass + + +@register +def oath_2080400(char: CharacterProperty): + pass + + +@register +def oath_2080401(char: CharacterProperty): + pass + + +@register +def oath_2080500(char: CharacterProperty): + pass + + +@register +def oath_2080501(char: CharacterProperty): + pass + + +@register +def oath_2090100(char: CharacterProperty): + pass + + +@register +def oath_2090200(char: CharacterProperty): + pass + + +@register +def oath_2090201(char: CharacterProperty): + pass + + +@register +def oath_2090300(char: CharacterProperty): + pass + + +@register +def oath_2090301(char: CharacterProperty): + pass + + +@register +def oath_2090400(char: CharacterProperty): + pass + + +@register +def oath_2090401(char: CharacterProperty): + pass + + +@register +def oath_2090500(char: CharacterProperty): + pass + + +@register +def oath_2090501(char: CharacterProperty): + pass + + +@register +def oath_2100100(char: CharacterProperty): + pass + + +@register +def oath_2100200(char: CharacterProperty): + pass + + +@register +def oath_2100201(char: CharacterProperty): + pass + + +@register +def oath_2100300(char: CharacterProperty): + pass + + +@register +def oath_2100301(char: CharacterProperty): + pass + + +@register +def oath_2100400(char: CharacterProperty): + pass + + +@register +def oath_2100401(char: CharacterProperty): + pass + + +@register +def oath_2100500(char: CharacterProperty): + pass + + +@register +def oath_2100501(char: CharacterProperty): + pass + + +@register +def oath_2110100(char: CharacterProperty): + pass + + +@register +def oath_2110200(char: CharacterProperty): + pass + + +@register +def oath_2110201(char: CharacterProperty): + pass + + +@register +def oath_2110300(char: CharacterProperty): + pass + + +@register +def oath_2110301(char: CharacterProperty): + pass + + +@register +def oath_2110400(char: CharacterProperty): + pass + + +@register +def oath_2110401(char: CharacterProperty): + pass + + +@register +def oath_2110500(char: CharacterProperty): + pass + + +@register +def oath_2110501(char: CharacterProperty): + pass + + +@register +def oath_2120100(char: CharacterProperty): + pass + + +@register +def oath_2120200(char: CharacterProperty): + pass + + +@register +def oath_2120201(char: CharacterProperty): + pass + + +@register +def oath_2120300(char: CharacterProperty): + pass + + +@register +def oath_2120301(char: CharacterProperty): + pass + + +@register +def oath_2120400(char: CharacterProperty): + pass + + +@register +def oath_2120401(char: CharacterProperty): + pass + + +@register +def oath_2120500(char: CharacterProperty): + pass + + +@register +def oath_2120501(char: CharacterProperty): + pass diff --git a/backend/test.py b/backend/test.py index 61db32bd..c8337630 100644 --- a/backend/test.py +++ b/backend/test.py @@ -2,31 +2,30 @@ from core.basic.character import createCharacter char = createCharacter('GF.gunner_female.spitfire_female') -char.calc_init( - { - 'oaths': {'0': {'id': '2030201', 'adaptation': 3}, '1': {'id': '2030201', 'adaptation': 3}, '2': {'id': '2030201', 'adaptation': 3}, '3': {'id': '2030201', 'adaptation': 3}, '4': {'id': '2030201', 'adaptation': 3}, '11': {'id': '2030200', 'adaptation': 0}}, - 'oathSkill': 1, - 'equips': { - '武器': {'id': '88', 'reinforce': 14, 'reinforceType': 1, 'enchant': 512, 'fusion': 0, 'refine': 8, 'adaptation': 3, 'precision': 100}, - '称号': {'id': '3017', 'reinforce': 0, 'reinforceType': 0, 'enchant': 1201, 'fusion': 0, 'refine': 0, 'adaptation': 3, 'precision': 100}, - '上衣': {'id': '999', 'reinforce': 13, 'reinforceType': 1, 'enchant': 105, 'fusion': '26', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '头肩': {'id': '1001', 'reinforce': 14, 'reinforceType': 1, 'enchant': 5, 'fusion': '28', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '下装': {'id': '1000', 'reinforce': 14, 'reinforceType': 1, 'enchant': 202, 'fusion': '27', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '鞋': {'id': '1003', 'reinforce': 14, 'reinforceType': 1, 'enchant': 309, 'fusion': '30', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '腰带': {'id': '1002', 'reinforce': 14, 'reinforceType': 1, 'enchant': 309, 'fusion': '29', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '项链': {'id': '477', 'reinforce': 13, 'reinforceType': 1, 'enchant': 609, 'fusion': '180', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '手镯': {'id': '483', 'reinforce': 14, 'reinforceType': 1, 'enchant': 609, 'fusion': '302', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '戒指': {'id': '489', 'reinforce': 14, 'reinforceType': 1, 'enchant': 609, 'fusion': '304', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '辅助装备': {'id': '492', 'reinforce': 14, 'reinforceType': 1, 'enchant': 905, 'fusion': '182', 'refine': 3, 'adaptation': 3, 'precision': 100}, - '魔法石': {'id': '495', 'reinforce': 14, 'reinforceType': 1, 'enchant': 1003, 'fusion': '184', 'refine': 3, 'adaptation': 3, 'precision': 100}, - '耳环': {'id': '498', 'reinforce': 14, 'reinforceType': 1, 'enchant': 1104, 'fusion': '186', 'refine': 0, 'adaptation': 3, 'precision': 100}, - '宠物': {'id': '4022', 'reinforce': 0, 'reinforceType': 0, 'enchant': 1304, 'fusion': 0, 'refine': 0, 'adaptation': 3, 'precision': 100}, - }, - 'emblems': {'彩色': {'lv': 1, 'items': ['4401', '4401', '4401', '4401', '4401', '4401']}, '红色': {'lv': 2, 'items': ['4101', '4101', '4101', '4101']}, '蓝色': {'lv': 2, 'items': []}, '绿色': {'lv': 3, 'items': []}, '黄色': {'lv': 4, 'items': []}}, - } -) +setInfo = { + 'oaths': {'0': {'id': '2030201', 'adaptation': 3}, '1': {'id': '2030201', 'adaptation': 3}, '2': {'id': '2030201', 'adaptation': 3}, '3': {'id': '2030201', 'adaptation': 3}, '4': {'id': '2030201', 'adaptation': 3}, '11': {'id': '2030200', 'adaptation': 0}}, + 'oathSkill': 1, + 'equips': { + '武器': {'id': '88', 'reinforce': 14, 'reinforceType': 1, 'enchant': 512, 'fusion': 0, 'refine': 8, 'adaptation': 3, 'precision': 100}, + '称号': {'id': '3017', 'reinforce': 0, 'reinforceType': 0, 'enchant': 1201, 'fusion': 0, 'refine': 0, 'adaptation': 3, 'precision': 100}, + '上衣': {'id': '999', 'reinforce': 13, 'reinforceType': 1, 'enchant': 105, 'fusion': '26', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '头肩': {'id': '1001', 'reinforce': 14, 'reinforceType': 1, 'enchant': 5, 'fusion': '28', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '下装': {'id': '1000', 'reinforce': 14, 'reinforceType': 1, 'enchant': 202, 'fusion': '27', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '鞋': {'id': '1003', 'reinforce': 14, 'reinforceType': 1, 'enchant': 309, 'fusion': '30', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '腰带': {'id': '1002', 'reinforce': 14, 'reinforceType': 1, 'enchant': 309, 'fusion': '29', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '项链': {'id': '477', 'reinforce': 13, 'reinforceType': 1, 'enchant': 609, 'fusion': '180', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '手镯': {'id': '483', 'reinforce': 14, 'reinforceType': 1, 'enchant': 609, 'fusion': '302', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '戒指': {'id': '489', 'reinforce': 14, 'reinforceType': 1, 'enchant': 609, 'fusion': '304', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '辅助装备': {'id': '492', 'reinforce': 14, 'reinforceType': 1, 'enchant': 905, 'fusion': '182', 'refine': 3, 'adaptation': 3, 'precision': 100}, + '魔法石': {'id': '495', 'reinforce': 14, 'reinforceType': 1, 'enchant': 1003, 'fusion': '184', 'refine': 3, 'adaptation': 3, 'precision': 100}, + '耳环': {'id': '498', 'reinforce': 14, 'reinforceType': 1, 'enchant': 1104, 'fusion': '186', 'refine': 0, 'adaptation': 3, 'precision': 100}, + '宠物': {'id': '4022', 'reinforce': 0, 'reinforceType': 0, 'enchant': 1304, 'fusion': 0, 'refine': 0, 'adaptation': 3, 'precision': 100}, + }, + 'emblems': {'彩色': {'lv': 1, 'items': ['4401', '4401', '4401', '4401', '4401', '4401']}, '红色': {'lv': 2, 'items': ['4101', '4101', '4101', '4101']}, '蓝色': {'lv': 2, 'items': []}, '绿色': {'lv': 3, 'items': []}, '黄色': {'lv': 4, 'items': []}}, +} -char.calc_suits() + +char.calc(setInfo) # for oath in char.charOathInfo: # print(oath.id, oath.adaptation, oath.oathInfo.position, oath.oathInfo.max_adaptation, oath.oathInfo.Point)