This commit is contained in:
2025-06-10 14:36:23 +08:00
parent 2b0abd5618
commit ddc8c7a0b6
4 changed files with 76 additions and 84 deletions
+2 -32
View File
@@ -47,8 +47,8 @@ pnpm run dev:backend
- 技能设置 - 技能设置
- [x] 技能等级设置 - [x] 技能等级设置
- [ ] 觉醒绑定选择 - [x] 觉醒绑定选择
- [ ] 技能次数设置 - [x] 技能次数设置
- [ ] 技能次数自动计算 - [ ] 技能次数自动计算
- [ ] buff数值设置 - [ ] buff数值设置
@@ -67,33 +67,3 @@ pnpm run dev:backend
- [x] 装备特效计算 - [x] 装备特效计算
- [x] 装备效果/点数计算 - [x] 装备效果/点数计算
- [x] 角色基础展示 - [x] 角色基础展示
- 一期职业
- 鬼剑士(男)
- [ ] 鬼泣
- [ ] 狂战士
- [ ] 剑影
- 鬼剑士(女)
- [ ] 暗殿骑士
- [ ] 契魔者
- [ ] 流浪武士
- [ ] 刃影
- 格斗家(男)
- [ ] 柔道家
- 格斗家(女)
- [ ] 气功师
- [ ] 散打
- [ ] 柔道家
- 神枪手(男)
- [ ] 漫游枪手
- [ ] 枪炮师
- [ ] 弹药专家
- 神枪手(女)
- [ ] 漫游枪手
- [ ] 枪炮师
- [x] 弹药专家
- 魔法师(男)
- [ ] 冰结师
- [ ] 血法师
- 魔法师(女)
- [ ] 战斗法师
-1
View File
@@ -55,7 +55,6 @@ async def get_cn_skill_info(redis: RedisDep, jobId: Annotated[str, Path(..., des
skill_info = {} skill_info = {}
key = f'openapi:{jobId}:{jobGrowId}:{skillId}' key = f'openapi:{jobId}:{jobGrowId}:{skillId}'
try: try:
def get_skill_info(): def get_skill_info():
# This function should retrieve the skill info based on job and jobGrow # This function should retrieve the skill info based on job and jobGrow
# For now, we return a placeholder dictionary # For now, we return a placeholder dictionary
+39 -15
View File
@@ -1,13 +1,39 @@
from copy import deepcopy from copy import deepcopy
from functools import cache
import json
import re import re
from typing import Literal, TYPE_CHECKING from typing import Literal, TYPE_CHECKING
from .formula import 武器冷却惩罚 from .formula import 武器冷却惩罚
from database.connect import get_redis
from api.core.Redis import get_redis_info
if TYPE_CHECKING: if TYPE_CHECKING:
from core.basic.character import Character from core.basic.character import Character
characterLv = 115 + 5 characterLv = 115 + 5
@cache
def get_data(prefix: str, key: int, func):
print(f"loading skill {prefix} {key} data from redis")
redis = next(get_redis())
def get_skill_info():
# This function should retrieve the skill info based on job and jobGrow
# For now, we return a placeholder dictionary
with open(f'./openapi/{prefix}.json', encoding='utf-8') as f:
skill_data = json.load(f)
try:
data = [0] + list(map(lambda x: x["optionValue"].get(
"value" + str(key+1), 0), skill_data["levelInfo"]["rows"]))
except Exception as e:
print(e)
data = None
return data
data = get_redis_info(redis, f'dcalc:skill:{prefix}:{key}', get_skill_info, without_gzip=True)
return func(data)
class Skill: class Skill:
name: str = '' name: str = ''
"""技能名称""" """技能名称"""
@@ -189,6 +215,7 @@ class Skill:
def skillInfo(self, mode: str | None = None): def skillInfo(self, mode: str | None = None):
pass pass
class ActiveSkill(Skill): class ActiveSkill(Skill):
type: str = 'active' type: str = 'active'
"""技能类型 active主动 passive被动""" """技能类型 active主动 passive被动"""
@@ -203,7 +230,7 @@ class ActiveSkill(Skill):
def __init__(self, char): def __init__(self, char):
super().__init__(char) super().__init__(char)
keys = [key.replace("data","") for key in dir(self) if key.startswith('data') and not key.startswith('plus')] keys = [key.replace('data', '') for key in dir(self) if key.startswith('data') and not key.startswith('plus')]
for i in keys: for i in keys:
power = getattr(self, f'power{i}', None) power = getattr(self, f'power{i}', None)
if power is None: if power is None:
@@ -251,17 +278,18 @@ class ActiveSkill(Skill):
def getSkillData(self, lv: int = 0): def getSkillData(self, lv: int = 0):
res = 0 res = 0
keys = [key.replace("data","") for key in dir(self) if key.startswith('data') and not key.startswith('dataplus')] keys = [key.replace('data', '') for key in dir(self) if key.startswith('data') and not key.startswith('dataplus')]
for i in keys: for i in keys:
data = getattr(self, f'data{i}', []) data = getattr(self, f'data{i}', [])
plus = getattr(self, f'plus{i}', 0) plus = getattr(self, f'plus{i}', 0)
if len(data) == 0: hit = getattr(self, f'hit{i}', 0)
if len(data) == 0 or hit == 0:
break break
if lv < len(data): if lv < len(data):
hit = getattr(self, f'hit{i}', 0) hit = getattr(self, f'hit{i}', 0)
power = getattr(self, f'power{i}', 1) power = getattr(self, f'power{i}', 1)
res += hit * power * (data[lv] + plus) res += hit * power * (data[lv] + plus)
keys = [key.replace("dataplus","") for key in dir(self) if key.startswith('dataplus')] keys = [key.replace('dataplus', '') for key in dir(self) if key.startswith('dataplus')]
for i in keys: for i in keys:
data = getattr(self, f'dataplus{i}', 0) data = getattr(self, f'dataplus{i}', 0)
hit = getattr(self, f'hitplus{i}', 1) hit = getattr(self, f'hitplus{i}', 1)
@@ -290,11 +318,7 @@ class ActiveSkill(Skill):
return 1 - cdr return 1 - cdr
def getSkillCD(self, mode=None): def getSkillCD(self, mode=None):
return max(0,round(max( return max(0, round(max(self.cd * 0.3, self.cd * self.cdReduce / self.cdRecover * self.getWeaponCDRatio() * self.getQuickCDRatio()) * self.cdRatio - self.cdCut, 2))
self.cd * 0.3,
self.cd * self.cdReduce / self.cdRecover * self.getWeaponCDRatio() * self.getQuickCDRatio()) * self.cdRatio
- self.cdCut,2
))
def vp_1(self): def vp_1(self):
pass pass
@@ -302,6 +326,7 @@ class ActiveSkill(Skill):
def vp_2(self): def vp_2(self):
pass pass
class PassiveSkill(Skill): class PassiveSkill(Skill):
type: str = 'passive' type: str = 'passive'
"""技能类型 active主动 passive被动""" """技能类型 active主动 passive被动"""
@@ -310,6 +335,7 @@ class PassiveSkill(Skill):
buffer: bool = False buffer: bool = False
"""是否是buff技能""" """是否是buff技能"""
class BuffSkill(Skill): class BuffSkill(Skill):
buffer: bool = True buffer: bool = True
"""是否是增益技能""" """是否是增益技能"""
@@ -348,9 +374,10 @@ class BuffSkill(Skill):
"""技能VP形态""" """技能VP形态"""
up: int = 0 up: int = 0
"""技能强化""" """技能强化"""
def __init__(self, char): def __init__(self, char):
super().__init__(char) super().__init__(char)
keys = [key.replace("data","") for key in dir(self) if key.startswith('data') and not key.startswith('plus')] keys = [key.replace('data', '') for key in dir(self) if key.startswith('data') and not key.startswith('plus')]
for i in keys: for i in keys:
power = getattr(self, f'power{i}', None) power = getattr(self, f'power{i}', None)
if power is None: if power is None:
@@ -409,6 +436,7 @@ class BuffSkill(Skill):
def vp_2(self): def vp_2(self):
pass pass
class PassiveBufferSkill(BuffSkill): class PassiveBufferSkill(BuffSkill):
type: str = 'passive' type: str = 'passive'
@@ -437,8 +465,4 @@ class ActiveBufferSkill(BuffSkill):
return 1 - cdr return 1 - cdr
def getSkillCD(self, mode=None): def getSkillCD(self, mode=None):
return max(0,round(max( return max(0, round(max(self.cd * 0.3, self.cd * self.cdReduce / self.cdRecover * self.getWeaponCDRatio() * self.getQuickCDRatio(), 1) - self.cdCut, 2))
self.cd * 0.3,
self.cd * self.cdReduce / self.cdRecover * self.getWeaponCDRatio() * self.getQuickCDRatio(),1)
- self.cdCut,2
))
@@ -288,8 +288,7 @@ class Skill14(ActiveBufferSkill):
buffType = "buffSub" buffType = "buffSub"
uuid = "506e7ed77d517419a6e1c437a2cedb17" uuid = "506e7ed77d517419a6e1c437a2cedb17"
hasVP = True hasVP = True
hasUP = True
hasVP = True
vps = [ vps = [
{ {
"name": "圣音协奏", "name": "圣音协奏",