This commit is contained in:
2026-04-10 18:25:08 +08:00
parent 0b2035f459
commit c882a64ec9
11 changed files with 1230 additions and 2034 deletions
+12 -3
View File
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from typing import Any, Literal, Mapping
class CharacterProperty(ABC):
"""
抽象类,用于定义Character的接口和属性
@@ -152,7 +153,8 @@ class CharacterProperty(ABC):
攻击强化P=0,
增益量=0,
增益量P=0,
**kwargs: Mapping[Literal[
**kwargs: Mapping[
Literal[
'STR',
'INT',
'AtkP',
@@ -187,7 +189,9 @@ class CharacterProperty(ABC):
'Spirit',
'Vitality',
'EquEffectRatio',
], Any],
],
Any,
],
) -> None:
"""设置角色属性"""
pass
@@ -198,7 +202,7 @@ class CharacterProperty(ABC):
pass
@abstractmethod
def AddSkillLv(self, min: int, max: int, lv: int, type=-1,exceptSkills:list[str]=[]) -> None:
def AddSkillLv(self, min: int, max: int, lv: int, type=-1, exceptSkills: list[str] = []) -> None:
"""增加技能等级"""
pass
@@ -236,3 +240,8 @@ class CharacterProperty(ABC):
def calc(self, setInfo: dict[str, dict]) -> dict:
"""计算角色属性"""
pass
@abstractmethod
def GetReinforceSum(self) -> list[int]:
"""获取强化总和"""
pass
+34 -1
View File
@@ -3,7 +3,7 @@ from typing import Any, Literal
from core.abstract.character import CharacterProperty
from core.basic.skill import Skill
from core.basic.equipment import EquEffect
from core.basic.equipment import EquEffect, OathSuit, OathSuitSkill, Suit
from ..formula import 获取基础属性, 获取唤醒属性
from ..roleinfo import CharacterEquipInfo, get_key_by_value, CharacterOathInfo
from .jade import Jade
@@ -22,6 +22,14 @@ class CharacterBase(CharacterProperty):
"""装备打造信息"""
charOathInfo: list['CharacterOathInfo']
"""誓约打造信息"""
charOathSkillId: int
"""誓约技能ID"""
suitInfo: list['Suit']
"""套装信息"""
oathSuitInfo: list['OathSuit']
"""誓约套装信息"""
oathSkillInfo: list['OathSuitSkill']
"""誓约技能信息"""
equ_effect: list['EquEffect'] = []
"""装备效果列表"""
equ_options: dict[str, int] = {}
@@ -336,3 +344,28 @@ class CharacterBase(CharacterProperty):
return weapon.itemDetailType, weapon.categorize
# endregion
def GetReinforceSum(self) -> list[int]:
"""获取强化总和"""
reinforce_0 = 0
"""防具"""
reinforce_1 = 0
"""首饰"""
reinforce_2 = 0
"""特殊装备"""
reinforce_3 = 0
"""武器"""
for part in self.charEquipInfo.keys():
if self.charEquipInfo[part] is None:
continue
num = self.charEquipInfo[part].reinforce
# if part == '武器':
# reinforce_3 += num
if part in ['上衣', '头肩', '下装', '腰带', '鞋']:
reinforce_0 += num
if part in ['手镯', '项链', '戒指']:
reinforce_1 += num
if part in ['耳环', '辅助装备', '魔法石']:
reinforce_2 += num
reinforce = reinforce_0 + reinforce_1 + reinforce_2 + reinforce_3
return [reinforce, reinforce_0, reinforce_1, reinforce_2, reinforce_3]
+53 -22
View File
@@ -1,7 +1,7 @@
import sys
from uuid import uuid1
from core.basic.equipment import get_equipment
from core.basic.equipment import OathSuit, Suit, get_equipment
from ..formula import 增幅计算, 强化技攻, 武器强化计算, 精通计算, 耳环计算, 左右计算, 锻造计算
from ..roleinfo import CharacterEquipInfo, CharacterOathInfo, get_key_by_value
from .base import CharacterBase
@@ -22,6 +22,7 @@ class CalcEquipMixin(CharacterBase):
for key in info['oaths']:
# 导入誓约打造信息、誓约信息
self.charOathInfo.append(CharacterOathInfo(info['oaths'][key], self.equVersion, key))
self.charOathSkillId = info.get('oathSkill', 1)
def calc_init(self, setInfo: dict[str, dict]):
self.equ_options = setInfo.get('options', {})
@@ -89,8 +90,8 @@ class CalcEquipMixin(CharacterBase):
oathSuitInfo[max_point_oath_suit]['point'] -= min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point'])
pass
suits = zero_point_suits + ([max_point_suit] if max_point_suit is not None else [])
suitList = []
oathSuitList = []
suitList: list[Suit] = []
oathSuitList: list[OathSuit] = []
res = []
for suit in suits:
if suitInfo[suit]['point'] == 0:
@@ -99,20 +100,20 @@ class CalcEquipMixin(CharacterBase):
suitList += equs.get_suit_info(suit, suitInfo[suit]['point'], 0)
if len(suitList) == 0:
continue
temp = suitList[-1]
res.append(
{
'id': temp.id,
'name': temp.name,
'rarity': temp.rarity,
'point': suitInfo[suit]['point'],
'count': suitInfo[suit]['count'],
'level': temp.level,
'imageUrl': temp.imageUrl,
'value': temp.value,
}
)
self.suitInfo = suitList
temp = suitList[-1]
res.append(
{
'id': temp.id,
'name': temp.name,
'rarity': temp.rarity,
'point': suitInfo[suit]['point'],
'count': suitInfo[suit]['count'],
'level': temp.level,
'imageUrl': temp.imageUrl,
'value': temp.value,
}
)
for suit in oathSuitInfo:
if oathSuitInfo[suit]['point'] == 0:
oathSuitList += equs.get_oath_suit_info(suit, 0, oathSuitInfo[suit]['count'])
@@ -120,17 +121,47 @@ class CalcEquipMixin(CharacterBase):
oathSuitList += equs.get_oath_suit_info(suit, oathSuitInfo[suit]['point'], 0)
if len(oathSuitList) == 0:
continue
print(oathSuitList[0].__dict__)
suits_effect = [i.id for i in suitList]
for i in suits_effect:
for suit in suitList:
i = suit.id
func = equs.funs.execture(f'suit_{i}')
suit = next((x for x in equs.suits if str(x.id) == str(i)), None)
if func is not None:
func(self)
# 誓约和套装进行匹配
# 如果存在誓约和套装是同一个套装
# 则直接不执行原套装效果,执行誓约套装增强的效果
oathEffect = next((x for x in oathSuitList if x.suitId == suit.suitId), None)
if suit is not None:
filtered_dict = {k: v for k, v in suit.__dict__.items() if k[0].isupper()}
self.SetStatus(**filtered_dict)
if func is not None and oathEffect is None:
print(f'套装 {suit.name} 生效')
func(self)
else:
# 当存在套装和誓约不匹配的时候,誓约技能只能是1号位
self.charOathSkillId = 1
oathSkillEffect = []
self.max_point = max([i['point'] for i in res], default=0)
self.oathSuitInfo = []
self.oathSkillInfo = []
# 当套装点数达到太初时,誓约技能生效
if self.max_point >= 2550:
for oathSuit in oathSuitList:
skill = next((x for x in oathSuit.skills if x.skillId == self.charOathSkillId), None)
# 誓约套装效果生效
filtered_dict = {k: v for k, v in oathSuit.__dict__.items() if k[0].isupper()}
self.SetStatus(**filtered_dict)
if skill is not None:
oathSkillEffect.append(skill)
# 誓约技能效果生效
filtered_dict = {k: v for k, v in skill.__dict__.items() if k[0].isupper()}
self.SetStatus(**filtered_dict)
self.oathSkillInfo.append(skill)
self.oathSuitInfo.append(oathSuit)
for skill in oathSkillEffect:
func = equs.funs.execture(f'oath_skill_{skill.id}')
if func is not None:
print(f'誓约技能 {skill.name} 生效')
func(self)
if self.max_point >= 2550:
skillAttack = (self.max_point - 2550) // 70 * 0.01
buffer = (self.max_point - 2550) // 70 * 100
+1 -1
View File
@@ -20,7 +20,7 @@ from core.abstract.character import CharacterProperty
from core.basic.property import CharacterInfo
from core.basic.skill import Skill
from core.basic.equipment import get_equipment, EquEffect, Equ
from core.basic.equipment import Suit, get_equipment, EquEffect, Equ, OathSuit
# from core.basic.equipment import equipments
# from core.basic.skill import Skill, ActiveSkill, PassiveSkill
+19 -3
View File
@@ -151,9 +151,22 @@ class Equipments:
with Session(self.engine) as session:
db_list = session.query(SuitData).all()
for item in db_list:
suit = Suit(**{k: v for k, v in item.__dict__.items() if not k.startswith('_')})
self.suits.append(suit)
self.suit_dict.setdefault(str(suit.suitId), []).append(suit)
lvs = len(item.point.split(','))
suits = {k: v for k, v in item.__dict__.items() if not k.startswith('_')}
for i in range(1, lvs + 1):
suit = {k: v for k, v in suits.items()}
suit['point'] = int(suit['point'].split(',')[i - 1])
suit['level'] = i
skillAttaks = parse_to_number_list(suit['SkillAttack'], [0])
suit['SkillAttack'] = 0 if i - 1 >= len(skillAttaks) else skillAttaks[i - 1]
attacks = parse_to_number_list(suit['Attack'], [0])
suit['Attack'] = 0 if i - 1 >= len(attacks) else attacks[i - 1]
buffers = parse_to_number_list(suit['Buffer'], [0])
suit['Buffer'] = 0 if i - 1 >= len(buffers) else buffers[i - 1]
suit_obj = Suit(**suit)
self.suits.append(suit_obj)
self.suit_dict.setdefault(str(suit['suitId']), []).append(suit_obj)
pass
pass
def init_enchants(self):
@@ -357,6 +370,9 @@ class OathSuitSkill:
bufferValue: str
def __init__(self, **kwargs):
for key in ['SkillAttack', 'Attack', 'Buffer']:
if kwargs.get(key) is None:
kwargs[key] = 0
self.__dict__.update(kwargs)
+35 -2
View File
@@ -6,10 +6,18 @@ from . import emblem
from . import enchant
from . import sundry
from . import suit
from . import oathSuitSkill
from .register import execture
options = [{'id': 1, 'name': '龙战八荒', 'options': ['BUFF OFF', 'BUFF ON', '期望']}, {'id': 2, 'name': '混沌净化', 'options': ['净化', '堕落']}, {'id': 3, 'name': '群猎美学', 'options': ['单刷', '组队']}, {'id': 4, 'name': '魔攻核', 'options': ['普通', '追击']}, {'id': 5, 'name': '传世手杖', 'options': ['BUFF ON', 'BUFF OFF', '期望']}, {'id': 6, 'name': '传世嵌合弓', 'options': ['本能飞跃', '非理性着陆']}]
options = [
{'id': 1, 'name': '龙战八荒', 'options': ['BUFF OFF', 'BUFF ON', '期望']},
{'id': 2, 'name': '混沌净化', 'options': ['净化', '堕落']},
{'id': 3, 'name': '群猎美学', 'options': ['单刷', '组队']},
{'id': 4, 'name': '魔攻核', 'options': ['普通', '追击']},
{'id': 5, 'name': '传世手杖', 'options': ['BUFF ON', 'BUFF OFF', '期望']},
{'id': 6, 'name': '传世嵌合弓', 'options': ['本能飞跃', '非理性着陆']},
]
sundryList = {
'medal_rarity': {'id': 0, 'options': [{'name': f'品质:{i}', 'value': idx} for idx, i in enumerate(['普通', '高级', '稀有', '神器', '传说', '史诗'])]},
@@ -28,4 +36,29 @@ sundryList = {
'costume_card': {'id': 13, 'options': [{'name': f'{i}', 'value': idx} for idx, i in enumerate(['无', '四维(3)|三速(1%)'])]},
}
__all__ = [get_dress_list, calc_dress_effect, options, execture, sundryList, equ, stone, jade, emblem, enchant, sundry, suit]
__all__ = [get_dress_list, calc_dress_effect, options, execture, sundryList, equ, stone, jade, emblem, enchant, sundry, suit, oathSuitSkill]
def get_reinforce_sum(char):
reinforce_0 = 0
"""防具"""
reinforce_1 = 0
"""首饰"""
reinforce_2 = 0
"""特殊装备"""
reinforce_3 = 0
"""武器"""
for part in char.charEquipInfo.keys():
if char.charEquipInfo[part] is None:
continue
num = char.charEquipInfo[part].reinforce
# if part == '武器':
# reinforce_3 += num
if part in ['上衣', '头肩', '下装', '腰带', '鞋']:
reinforce_0 += num
if part in ['手镯', '项链', '戒指']:
reinforce_1 += num
if part in ['耳环', '辅助装备', '魔法石']:
reinforce_2 += num
reinforce = reinforce_0 + reinforce_1 + reinforce_2 + reinforce_3
return reinforce
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff