This commit is contained in:
2026-04-01 13:12:43 +08:00
parent 7299ea20e3
commit 00e1147e8e
4 changed files with 128 additions and 114 deletions
+74 -88
View File
@@ -13,7 +13,7 @@ from core.basic.equipment import get_equipment, EquEffect, Equ
# from core.basic.equipment import equipments # from core.basic.equipment import equipments
# from core.basic.skill import Skill, ActiveSkill, PassiveSkill # from core.basic.skill import Skill, ActiveSkill, PassiveSkill
from .formula import 增幅计算, 强化技攻, 武器强化计算, 精通计算, 获取唤醒属性, 获取基础属性, 耳环计算, 左右计算, 锻造计算 from .formula import 增幅计算, 强化技攻, 武器强化计算, 精通计算, 获取唤醒属性, 获取基础属性, 耳环计算, 左右计算, 锻造计算
from .roleinfo import CharacterEquipInfo, get_key_by_value from .roleinfo import CharacterEquipInfo, get_key_by_value, CharacterOathInfo
# from .property import 精通计算, 角色基础, CharacterInfo # from .property import 精通计算, 角色基础, CharacterInfo
@@ -117,7 +117,7 @@ class Character(CharacterProperty):
# endregion # endregion
BindAwake : int BindAwake: int
"""绑定觉醒等级""" """绑定觉醒等级"""
skills: list['Skill'] = [] skills: list['Skill'] = []
# """技能列表""" # """技能列表"""
@@ -127,6 +127,8 @@ class Character(CharacterProperty):
"""装备版本""" """装备版本"""
charEquipInfo: dict[str, 'CharacterEquipInfo'] charEquipInfo: dict[str, 'CharacterEquipInfo']
"""装备打造信息""" """装备打造信息"""
charOathInfo: list['CharacterOathInfo']
"""誓约打造信息"""
equ_effect: list['EquEffect'] = [] equ_effect: list['EquEffect'] = []
"""装备效果列表""" """装备效果列表"""
equ_options: dict[str, int] = {} equ_options: dict[str, int] = {}
@@ -231,7 +233,7 @@ class Character(CharacterProperty):
temp = 获取基础属性(self.角色, self.职业) temp = 获取基础属性(self.角色, self.职业)
唤醒 = 获取唤醒属性() 唤醒 = 获取唤醒属性()
for index, i in enumerate([get_key_by_value(i) for i in ['力量', '体力', '智力', '精神']]): for index, i in enumerate([get_key_by_value(i) for i in ['力量', '体力', '智力', '精神']]):
setattr(self, i, getattr(self,i) + temp[index] + 唤醒) setattr(self, i, getattr(self, i) + temp[index] + 唤醒)
# 角色属性抗性 # 角色属性抗性
pass pass
# 角色异常抗性 # 角色异常抗性
@@ -420,21 +422,26 @@ class Character(CharacterProperty):
def GetWeaponType(self) -> tuple[str, str]: def GetWeaponType(self) -> tuple[str, str]:
"""获取武器类型""" """获取武器类型"""
weapon = self.charEquipInfo["武器"].equInfo weapon = self.charEquipInfo['武器'].equInfo
if weapon is None: if weapon is None:
return None,None return None, None
else: else:
return weapon.itemDetailType,weapon.categorize return weapon.itemDetailType, weapon.categorize
# endregion # endregion
# region 计算相关 # region 计算相关
def SetDetail(self, info: dict[str, dict]) -> None: def SetDetail(self, info: dict[str, dict]) -> None:
self.charEquipInfo = {} self.charEquipInfo = {}
self.charOathInfo = []
self.bindAwake = info.get('bindAwake', 50) self.bindAwake = info.get('bindAwake', 50)
"""打造信息导入""" """打造信息导入"""
for key in info['equips']: for key in info['equips']:
# 导入部位打造信息、装备信息、贴膜信息 # 导入部位打造信息、装备信息、贴膜信息
self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key) 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))
def getInfo(self): def getInfo(self):
"""返回到前端信息""" """返回到前端信息"""
@@ -480,7 +487,7 @@ class Character(CharacterProperty):
'hasUP': skill.hasUP, 'hasUP': skill.hasUP,
'upType': skill.upType, 'upType': skill.upType,
'uuid': skill.uuid, 'uuid': skill.uuid,
'vps': [{"name":i["name"],"desc":i["desc"]} for i in skill.vps], 'vps': [{'name': i['name'], 'desc': i['desc']} for i in skill.vps],
} }
) )
info['skills'] = skillInfo info['skills'] = skillInfo
@@ -500,7 +507,7 @@ class Character(CharacterProperty):
info['suits'] = suits info['suits'] = suits
info['stones'] = stones info['stones'] = stones
key = '辅助' if self.buffer else '输出' key = '辅助' if self.buffer else '输出'
info['enchants'] = list(filter(lambda x: key in x["categorize"], equInfos.enchants)) info['enchants'] = list(filter(lambda x: key in x['categorize'], equInfos.enchants))
info['emblems'] = [i for i in equInfos.emblems] info['emblems'] = [i for i in equInfos.emblems]
info['avatar'] = equInfos.funs.get_dress_list(skill_clothes) info['avatar'] = equInfos.funs.get_dress_list(skill_clothes)
info['jades'] = equInfos.jades info['jades'] = equInfos.jades
@@ -581,7 +588,7 @@ class Character(CharacterProperty):
module = sys.modules[self.moduleName] module = sys.modules[self.moduleName]
for name in dir(module): for name in dir(module):
memberClass = getattr(module, name) memberClass = getattr(module, name)
if isinstance(memberClass, type) and memberClass.__name__.startswith("Skill"): if isinstance(memberClass, type) and memberClass.__name__.startswith('Skill'):
skill = memberClass(char=self) skill = memberClass(char=self)
self.skills_dict[skill.name] = skill self.skills_dict[skill.name] = skill
self.skills.append(skill) self.skills.append(skill)
@@ -660,8 +667,8 @@ class Character(CharacterProperty):
# 太初积分以上,每超过70点数增加1%技能攻击力 # 太初积分以上,每超过70点数增加1%技能攻击力
if self.max_point >= 2550: if self.max_point >= 2550:
skillAttack = (self.max_point - 2550) // 70 * 0.01 skillAttack = (self.max_point - 2550) // 70 * 0.01
buffer = (self.max_point - 2550) // 70 * 100 buffer = (self.max_point - 2550) // 70 * 100
self.SetStatus(SkillAttack=skillAttack,Buffer=buffer) self.SetStatus(SkillAttack=skillAttack, Buffer=buffer)
return res return res
def calc_equs(self): def calc_equs(self):
@@ -748,7 +755,7 @@ class Character(CharacterProperty):
fun(self) fun(self)
pass pass
def calc_weapon(self,cur:CharacterEquipInfo): def calc_weapon(self, cur: CharacterEquipInfo):
# 锻造独立计算 # 锻造独立计算
value = 锻造计算(115, '史诗', cur.refine) value = 锻造计算(115, '史诗', cur.refine)
self.SetStatus(AtkI=value) self.SetStatus(AtkI=value)
@@ -776,7 +783,7 @@ class Character(CharacterProperty):
continue continue
for key in self.防具精通属性: for key in self.防具精通属性:
value = 精通计算(115, equ.rarity, reinforce, equ.itemDetailType, self.防具类型,self.buffer,key) value = 精通计算(115, equ.rarity, reinforce, equ.itemDetailType, self.防具类型, self.buffer, key)
key = get_key_by_value(key) key = get_key_by_value(key)
setattr(self, key, getattr(self, key) + value) setattr(self, key, getattr(self, key) + value)
# 115增幅强化品级固定史诗 # 115增幅强化品级固定史诗
@@ -811,40 +818,31 @@ class Character(CharacterProperty):
funs = get_equipment(self.equVersion).funs funs = get_equipment(self.equVersion).funs
for key in jades: for key in jades:
jade = jades[key] jade = jades[key]
fun = funs.execture(f'jade_{jade.get("id",0)}') fun = funs.execture(f'jade_{jade.get("id", 0)}')
if fun is not None: if fun is not None:
fun(self,jade.get('value', 0)) fun(self, jade.get('value', 0))
pass pass
def calc_sundry(self, sundry: dict): def calc_sundry(self, sundry: dict):
"""计算杂项效果""" """计算杂项效果"""
funs = get_equipment(self.equVersion).funs funs = get_equipment(self.equVersion).funs
funs.execture("sundry_0")(self, funs.execture('sundry_0')(
sundry.get("medal_rarity", 0), self,
sundry.get("medal_reinforce", 0), sundry.get('medal_rarity', 0),
[sundry.get("medal_gem_0", 0), sundry.get("medal_gem_1", 0), sundry.get("medal_gem_2", 0), sundry.get("medal_gem_3", 0)], sundry.get('medal_reinforce', 0),
[sundry.get('medal_gem_0', 0), sundry.get('medal_gem_1', 0), sundry.get('medal_gem_2', 0), sundry.get('medal_gem_3', 0)],
) )
funs.execture("sundry_6")(self, funs.execture('sundry_6')(self, sundry.get('adventure', 1))
sundry.get("adventure", 1) funs.execture('sundry_5')(self, sundry.get('fog', 1))
) funs.execture('sundry_7')(self, sundry.get('marriage_house', 0), sundry.get('marriage_ring', 0))
funs.execture("sundry_5")(self, funs.execture('sundry_9')(self, sundry.get('contract', 0))
sundry.get("fog", 1) funs.execture('sundry_10')(
) self,
funs.execture("sundry_7")(self, sundry.get('collection_type', 0),
sundry.get("marriage_house", 0), sundry.get('collection_num_0', 0),
sundry.get("marriage_ring", 0) sundry.get('collection_num_1', 0),
)
funs.execture("sundry_9")(self,
sundry.get("contract", 0)
)
funs.execture("sundry_10")(self,
sundry.get("collection_type", 0),
sundry.get("collection_num_0", 0),
sundry.get("collection_num_1", 0),
)
funs.execture("sundry_13")(self,
sundry.get("costume_card", 0)
) )
funs.execture('sundry_13')(self, sundry.get('costume_card', 0))
pass pass
def calc(self, setInfo: dict[str, dict]): def calc(self, setInfo: dict[str, dict]):
@@ -883,21 +881,14 @@ class Character(CharacterProperty):
self.输出类型 = '魔法百分比' self.输出类型 = '魔法百分比'
else: else:
self.输出类型 = '物理百分比' self.输出类型 = '物理百分比'
skillInfos = self.calc_carry_skills(setInfo.get("DSB", False),setInfo.get("BUFF", False)) skillInfos = self.calc_carry_skills(setInfo.get('DSB', False), setInfo.get('BUFF', False))
info = self.get_carry_info() info = self.get_carry_info()
return { return {'uuid': uuid1().hex, 'skills': skillInfos, 'info': info, 'suits': suit, 'buffer': self.buffer}
'uuid': uuid1().hex,
'skills': skillInfos,
'info': info,
'suits': suit,
'buffer':self.buffer
}
# 技能影响角色的属性,如属强、抗性等 # 技能影响角色的属性,如属强、抗性等
# region 输出计算项 # region 输出计算项
def calc_damage_ration(self,DSB:bool,BUFF:bool): def calc_damage_ration(self, DSB: bool, BUFF: bool):
"""计算属性系数""" """计算属性系数"""
# 计算最终属性 # 计算最终属性
# 力/智 攻击力 攻击力%(特效不吃这部分) # 力/智 攻击力 攻击力%(特效不吃这部分)
@@ -937,7 +928,7 @@ class Character(CharacterProperty):
ratio_9 = 1.0 * self.ElementIncrease ratio_9 = 1.0 * self.ElementIncrease
return (ratio_0, ratio_1, ratio_2, ratio_3, ratio_4, ratio_5, ratio_6, ratio_7, ratio_8, ratio_9) return (ratio_0, ratio_1, ratio_2, ratio_3, ratio_4, ratio_5, ratio_6, ratio_7, ratio_8, ratio_9)
def calc_carry_skills(self,DSB:bool,BUFF:bool): def calc_carry_skills(self, DSB: bool, BUFF: bool):
skillInfos = [] skillInfos = []
for i in self.skills: for i in self.skills:
if i.damage and i.lv > 0: if i.damage and i.lv > 0:
@@ -957,24 +948,13 @@ class Character(CharacterProperty):
'type': i.type, 'type': i.type,
} }
) )
ratios = self.calc_damage_ration(DSB,BUFF) ratios = self.calc_damage_ration(DSB, BUFF)
ratio_char_skill = ratios[0] * ratios[1] * ratios[2] * ratios[3] * ratios[4] * ratios[5] * ratios[6] * ratios[7] * ratios[8] * ratios[9] / 1000 ratio_char_skill = ratios[0] * ratios[1] * ratios[2] * ratios[3] * ratios[4] * ratios[5] * ratios[6] * ratios[7] * ratios[8] * ratios[9] / 1000
ratuio_equ_skill = ratios[0] * ratios[1] * ratios[3] * ratios[4] * ratios[6] * ratios[7] * ratios[8] * ratios[9] / 1000 ratuio_equ_skill = ratios[0] * ratios[1] * ratios[3] * ratios[4] * ratios[6] * ratios[7] * ratios[8] * ratios[9] / 1000
for i in skillInfos: for i in skillInfos:
i['damage'] = ratio_char_skill * i['data'] * i['ratio'] / 100 i['damage'] = ratio_char_skill * i['data'] * i['ratio'] / 100
for i in self.equ_effect: for i in self.equ_effect:
skillInfos.append( skillInfos.append({'name': i.name, 'icon': i.icon, 'lv': 0, 'data': i.data, 'ratio': 10.0, 'cd': i.cd, 'damage': ratuio_equ_skill * i.data * 10 * self.EquEffectRatio / 100, 'mode': ''})
{
'name': i.name,
'icon': i.icon,
'lv': 0,
'data': i.data,
'ratio': 10.0,
'cd': i.cd,
'damage': ratuio_equ_skill * i.data * 10 * self.EquEffectRatio / 100,
'mode':''
}
)
# 合并相同 name、cd、damage 的项 # 合并相同 name、cd、damage 的项
# merged = {} # merged = {}
# for skill in skillInfos: # for skill in skillInfos:
@@ -997,7 +977,7 @@ class Character(CharacterProperty):
if self.输出类型 == '魔法固伤': if self.输出类型 == '魔法固伤':
attrs.extend(['INT', 'AtkI']) attrs.extend(['INT', 'AtkI'])
info = [] info = []
attrs.extend(['Attack', 'AttackP', 'SkillAttack','EquEffectRatio', 'ElementDB']) attrs.extend(['Attack', 'AttackP', 'SkillAttack', 'EquEffectRatio', 'ElementDB'])
for attr in attrs: for attr in attrs:
temp = getattr(CharacterInfo, attr) temp = getattr(CharacterInfo, attr)
if attr.startswith('Atk'): if attr.startswith('Atk'):
@@ -1006,7 +986,7 @@ class Character(CharacterProperty):
else: else:
value = getattr(self, attr) value = getattr(self, attr)
if attr == 'SkillAttack': if attr == 'SkillAttack':
value *= (self.jade_effect.SkillAttack + 1) value *= self.jade_effect.SkillAttack + 1
if attr == 'AttackP': if attr == 'AttackP':
value += self.jade_effect.AttackP value += self.jade_effect.AttackP
info.append( info.append(
@@ -1017,9 +997,10 @@ class Character(CharacterProperty):
) )
pass pass
return info return info
# endregion # endregion
#region 辅助计算项 # region 辅助计算项
def calc_buffer_skills(self): def calc_buffer_skills(self):
skillInfos = [] skillInfos = []
@@ -1028,10 +1009,10 @@ class Character(CharacterProperty):
# 增益量 # 增益量
buffer_power = self.Buffer * self.BufferP buffer_power = self.Buffer * self.BufferP
# buff系数 # buff系数
buff_ratio_new = (main / 2993 +1) * (buffer_power / 4800 + 1) if buffer_power > 0 else 0 buff_ratio_new = (main / 2993 + 1) * (buffer_power / 4800 + 1) if buffer_power > 0 else 0
buff_ratio_old = main / 2993 + 1 buff_ratio_old = main / 2993 + 1
# 觉醒系数 # 觉醒系数
awake_ratio_new = ((main + 7500) / 7500 + 1) *((buffer_power + 68000) / 8500 + 1) if buffer_power > 0 else 0 awake_ratio_new = ((main + 7500) / 7500 + 1) * ((buffer_power + 68000) / 8500 + 1) if buffer_power > 0 else 0
awake_ratio_old = main / 7500 + 1 awake_ratio_old = main / 7500 + 1
for i in self.skills: for i in self.skills:
if i.lv > 0 and i.hasUP and i.up is not None and i.up > 0: if i.lv > 0 and i.hasUP and i.up is not None and i.up > 0:
@@ -1042,42 +1023,47 @@ class Character(CharacterProperty):
value = info[0] value = info[0]
# buff技能 # buff技能
if i.buffType == 'buff' or i.buffType == 'buffSub': if i.buffType == 'buff' or i.buffType == 'buffSub':
value1 = (info[1][0] + info[1][2])*info[1][1]*buff_ratio_old + info[1][0]*buff_ratio_new value1 = (info[1][0] + info[1][2]) * info[1][1] * buff_ratio_old + info[1][0] * buff_ratio_new
value2 = (info[2][0] + info[2][2])*info[2][1]*buff_ratio_old + info[2][0]*buff_ratio_new value2 = (info[2][0] + info[2][2]) * info[2][1] * buff_ratio_old + info[2][0] * buff_ratio_new
# 觉醒技能 # 觉醒技能
elif i.buffType == 'awake' or i.buffType == 'awakeSub': elif i.buffType == 'awake' or i.buffType == 'awakeSub':
value1 = (info[1][0] + info[1][2])*info[1][1]*awake_ratio_old + info[1][0]*awake_ratio_new value1 = (info[1][0] + info[1][2]) * info[1][1] * awake_ratio_old + info[1][0] * awake_ratio_new
value2 = (info[2][0] + info[2][2])*info[2][1]*awake_ratio_old + info[2][0]*awake_ratio_new value2 = (info[2][0] + info[2][2]) * info[2][1] * awake_ratio_old + info[2][0] * awake_ratio_new
else: else:
value1 = (info[1][0] + info[1][2])*info[1][1] value1 = (info[1][0] + info[1][2]) * info[1][1]
value2 = (info[2][0] + info[2][2])*info[2][1] value2 = (info[2][0] + info[2][2]) * info[2][1]
value3 = info[3] value3 = info[3]
value4 = info[4] value4 = info[4]
if i.buffType == 'awake' and self.bindAwake == 50: if i.buffType == 'awake' and self.bindAwake == 50:
pass pass
else: else:
skillInfos.append({ skillInfos.append(
"name":i.name, {
"cd":value4, 'name': i.name,
"icon":i.icon, 'cd': value4,
"lv": i.lv, 'icon': i.icon,
# 对自己的加成 三攻 力智 伤害直接加成 'lv': i.lv,
"buff":[value, value1, value2, value3], # 对自己的加成 三攻 力智 伤害直接加成
"type":i.type 'buff': [value, value1, value2, value3],
}) 'type': i.type,
}
)
return skillInfos return skillInfos
def get_buffer_info(self): def get_buffer_info(self):
attrs = [get_key_by_value(self.适用属性),'Buffer','BufferP'] attrs = [get_key_by_value(self.适用属性), 'Buffer', 'BufferP']
info = [] info = []
for attr in attrs: for attr in attrs:
temp = getattr(CharacterInfo, attr) temp = getattr(CharacterInfo, attr)
value = getattr(self, attr) value = getattr(self, attr)
info.append({ info.append(
'name': temp.name, {
'value': temp.value(value), 'name': temp.name,
}) 'value': temp.value(value),
}
)
return info return info
# endregion # endregion
# endregion # endregion
+19 -9
View File
@@ -1,16 +1,20 @@
import importlib import importlib
from database.models import EmblemData, OathData, OathSuitData, OathSuitSkillData, PrimerData, Session, EquData, StoneData, SuitData, EnchantData,JadeData from database.models import EmblemData, OathData, OathSuitData, OathSuitSkillData, PrimerData, Session, EquData, StoneData, SuitData, EnchantData, JadeData
from database.connect import get_db_engine as get_engine from database.connect import get_db_engine as get_engine
def parse_to_number_list(info: str, default: list[float] = [0]) -> list[float]: def parse_to_number_list(info: str, default: list[float] = [0]) -> list[float]:
return default if not info else [float(i) for i in info.split(',')] return default if not info else [float(i) for i in info.split(',')]
def parse_to_string_list(info: str, default: list[str] = ['']) -> list[str]: def parse_to_string_list(info: str, default: list[str] = ['']) -> list[str]:
return default if not info else [i for i in info.split(',')] return default if not info else [i for i in info.split(',')]
def parse_to_int_list(info: str, default: list[int] = [0]) -> list[int]: def parse_to_int_list(info: str, default: list[int] = [0]) -> list[int]:
return default if not info else [int(i) for i in info.split(',')] return default if not info else [int(i) for i in info.split(',')]
class Equ: class Equ:
id: str id: str
name: str name: str
@@ -51,6 +55,7 @@ class Equ:
temp[attr] = value[min(adaptation, len(value) - 1)] if isinstance(value, list) else value temp[attr] = value[min(adaptation, len(value) - 1)] if isinstance(value, list) else value
return Equ(**temp) return Equ(**temp)
class Suit: class Suit:
id: int id: int
suitId: int suitId: int
@@ -67,6 +72,7 @@ class Suit:
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
class Equipments: class Equipments:
def __init__(self, version='0'): def __init__(self, version='0'):
self.version = version self.version = version
@@ -90,6 +96,8 @@ class Equipments:
self.init_stones() self.init_stones()
self.init_emblem() self.init_emblem()
self.init_jades() self.init_jades()
self.init_oaths()
self.init_oath_suits()
self.engine.dispose() self.engine.dispose()
def init_equs(self): def init_equs(self):
@@ -189,7 +197,6 @@ class Equipments:
db_list_1 = session.query(OathData).all() db_list_1 = session.query(OathData).all()
db_list_2 = session.query(PrimerData).all() db_list_2 = session.query(PrimerData).all()
keys = [key for key in OathData.__dict__.keys() if key[0].isupper()] keys = [key for key in OathData.__dict__.keys() if key[0].isupper()]
print(keys)
for item in db_list_1 + db_list_2: for item in db_list_1 + db_list_2:
max_adaptation = 0 max_adaptation = 0
item.id = str(item.id) item.id = str(item.id)
@@ -199,7 +206,7 @@ class Equipments:
value = parse_to_number_list(getattr(item, attr)) value = parse_to_number_list(getattr(item, attr))
max_adaptation = max(max_adaptation, len(value) - 1) max_adaptation = max(max_adaptation, len(value) - 1)
setattr(item, attr, value) setattr(item, attr, value)
for attr in ['wearUrl','position','suit']: for attr in ['wearUrl', 'position', 'suit']:
value = [] if getattr(item, attr) is None else getattr(item, attr).split(',') value = [] if getattr(item, attr) is None else getattr(item, attr).split(',')
setattr(item, attr, value) setattr(item, attr, value)
oath_dict = {k: v for k, v in item.__dict__.items() if not k.startswith('_')} oath_dict = {k: v for k, v in item.__dict__.items() if not k.startswith('_')}
@@ -232,13 +239,12 @@ class Equipments:
pass pass
pass pass
def init_func(self): def init_func(self):
"""根据装备版本加载装备效果""" """根据装备版本加载装备效果"""
try: try:
funs = importlib.import_module(f"core.equipment.version_{self.version}") funs = importlib.import_module(f'core.equipment.version_{self.version}')
except Exception: except Exception:
funs = importlib.import_module("core.equipment.version_0") funs = importlib.import_module('core.equipment.version_0')
return funs return funs
def get_suit_info(self, suitId: str | int, point: int = 0, count: int = 0) -> list[Suit]: def get_suit_info(self, suitId: str | int, point: int = 0, count: int = 0) -> list[Suit]:
@@ -273,6 +279,7 @@ class Equipments:
result[suit.count] = suit result[suit.count] = suit
return list(result.values()) return list(result.values())
class EquEffect: class EquEffect:
name: str = '' name: str = ''
"""装备技能名称""" """装备技能名称"""
@@ -280,7 +287,7 @@ class EquEffect:
"""技能图标""" """技能图标"""
cd: float = 0 cd: float = 0
"""技能冷却时间""" """技能冷却时间"""
data:float = 0 data: float = 0
"""伤害量""" """伤害量"""
def __init__(self, name: str, icon: str, cd: float, data: float): def __init__(self, name: str, icon: str, cd: float, data: float):
@@ -289,6 +296,7 @@ class EquEffect:
self.cd = cd self.cd = cd
self.data = data self.data = data
class Oath: class Oath:
id: str id: str
name: str name: str
@@ -348,6 +356,7 @@ class OathSuitSkill:
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
class OathSuit: class OathSuit:
id: int id: int
key: str key: str
@@ -368,12 +377,13 @@ class OathSuit:
global equ0 global equ0
equ0 = Equipments("0") equ0 = Equipments('0')
def get_equipment(version: str = '0') -> Equipments: def get_equipment(version: str = '0') -> Equipments:
# print('加载装备信息') # print('加载装备信息')
try: try:
temp = eval(f"equ{version}".format(version)) temp = eval(f'equ{version}'.format(version))
except Exception: except Exception:
temp = equ0 temp = equ0
return temp return temp
+27 -7
View File
@@ -1,7 +1,7 @@
from enum import Enum from enum import Enum
from typing import Union from typing import Union
from core.basic.equipment import Equ, get_equipment from core.basic.equipment import Equ, get_equipment, Oath
class CharacterEquipInfo: class CharacterEquipInfo:
@@ -29,13 +29,13 @@ class CharacterEquipInfo:
"""装备信息""" """装备信息"""
fusionInfo: Union['Equ', None] fusionInfo: Union['Equ', None]
"""贴膜信息""" """贴膜信息"""
precision:float precision: float
"""秘宝精度""" """秘宝精度"""
def __init__(self, info={}, equVerison=0, part='') -> None: def __init__(self, info={}, equVerison=0, part='') -> None:
info["fusion"] = info.get("fusion", None) info['fusion'] = info.get('fusion', None)
info["precision"] = info.get("precision", 0) info['precision'] = info.get('precision', 0)
info["weaponFusion"] = info.get("weaponFusion", None) info['weaponFusion'] = info.get('weaponFusion', None)
self.__dict__.update(info) self.__dict__.update(info)
equ = get_equipment(equVerison).equ_dict.get(self.id, None) equ = get_equipment(equVerison).equ_dict.get(self.id, None)
fusion = get_equipment(equVerison).stone_dict.get(self.fusion, None) fusion = get_equipment(equVerison).stone_dict.get(self.fusion, None)
@@ -43,7 +43,7 @@ class CharacterEquipInfo:
self.equInfo = equ.adapt(self.adaptation) self.equInfo = equ.adapt(self.adaptation)
self.adaptation = min(self.adaptation, self.equInfo.max_adaptation) self.adaptation = min(self.adaptation, self.equInfo.max_adaptation)
if part == '副武器' and equ.itemType == '武器': if part == '副武器' and equ.itemType == '武器':
self.equInfo.itemType = "副武器" self.equInfo.itemType = '副武器'
else: else:
self.equInfo = None self.equInfo = None
if fusion is not None and (fusion.itemType == part or fusion.itemDetailType == part): if fusion is not None and (fusion.itemType == part or fusion.itemDetailType == part):
@@ -52,6 +52,26 @@ class CharacterEquipInfo:
self.fusionInfo = None self.fusionInfo = None
class CharacterOathInfo:
id: str
"""誓约ID"""
adaptation: int
"""调适等级"""
oathInfo: Union['Oath', None]
"""誓约信息"""
def __init__(self, info={}, equVerison=0, position='') -> None:
self.__dict__.update(info)
self.id = str(self.id)
oath = get_equipment(equVerison).oath_dict.get(self.id, None)
print(position, oath)
if oath is not None and position in oath.position:
self.oathInfo = oath.adapt(self.adaptation)
self.adaptation = min(self.adaptation, self.oathInfo.max_adaptation)
else:
self.oathInfo = None
class CharacterWeaponInfo(CharacterEquipInfo): class CharacterWeaponInfo(CharacterEquipInfo):
refine: int refine: int
"""锻造等级""" """锻造等级"""
@@ -104,7 +124,7 @@ class CharacterAttributes(Enum):
AttackP = '攻击强化%' AttackP = '攻击强化%'
mapping = {value.value : key for key, value in CharacterAttributes.__members__.items()} mapping = {value.value: key for key, value in CharacterAttributes.__members__.items()}
def get_key_by_value(value: str) -> str: def get_key_by_value(value: str) -> str:
+8 -10
View File
@@ -1,11 +1,9 @@
from core.basic.equipment import Equipments from core.basic.character import createCharacter
equ = Equipments("0")
equ.init_oath_suits() char = createCharacter('GF.gunner_female.spitfire_female')
item = equ.oath_suits[3]
for i in range(1, 7): char.calc_init({'oaths': {'0': {'id': '2010201', 'adaptation': 3}, '11': {'id': '2050200', 'adaptation': 0}}, 'equips': {}})
print(f"Lv{i}:")
print(equ.oath_suits[i])
for skill in equ.oath_suits[i]['skills']: for oath in char.charOathInfo:
print(skill.__dict__) print(oath.id, oath.adaptation, oath.oathInfo.position, oath.oathInfo.max_adaptation, oath.oathInfo.Point)
print("------------------")