From 2f87603ff82d968569c25f96c1372b75032de319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E7=93=9C=C2=B0?= Date: Sat, 17 May 2025 11:58:06 +0800 Subject: [PATCH] dev --- backend/core/basic/character.py | 3 +- backend/core/basic/skill.py | 16 +++- frontend/src/api/info/type.ts | 2 + .../Skill/components/Skill/index.tsx | 45 ++++++++++ .../Skill/components/SkillReinforce/index.tsx | 89 +++++++++++++++++++ frontend/src/pages/Character/Skill/index.vue | 14 +++ frontend/src/stores/config.ts | 4 +- images | 2 +- 8 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 frontend/src/pages/Character/Skill/components/Skill/index.tsx create mode 100644 frontend/src/pages/Character/Skill/components/SkillReinforce/index.tsx diff --git a/backend/core/basic/character.py b/backend/core/basic/character.py index 82f47aee..3e5a0360 100644 --- a/backend/core/basic/character.py +++ b/backend/core/basic/character.py @@ -467,7 +467,8 @@ class Character(CharacterProperty): 'position': skill.position, 'line': skill.line, 'bind': skill.bind, - 'damage':skill.damage + 'hasVP': skill.hasVP, + 'hasReinforce': skill.hasReinforce } ) info['skills'] = skillInfo diff --git a/backend/core/basic/skill.py b/backend/core/basic/skill.py index 56bd8610..51a87e95 100644 --- a/backend/core/basic/skill.py +++ b/backend/core/basic/skill.py @@ -73,6 +73,10 @@ class Skill: """是否是增益技能""" bind: bool = None uuid: str = None + hasVP: bool = None + """是否有VP形态""" + hasReinforce: bool = None + """是否有技能强化""" def __init__(self, char): self.char = char @@ -84,6 +88,16 @@ class Skill: self.bind = False if self.learnLv in [50, 85, 100]: self.bind = True + if self.hasVP is None: + if self.learnLv not in [50, 85, 100] and self.learnLv >= 35 and self.learnLv <= 80 and self.damage: + self.hasVP = True + else: + self.hasVP = False + if self.hasReinforce is None: + if self.learnLv not in [50, 85, 100] and self.learnLv >= 15 and self.learnLv <= 80 and self.damage: + self.hasReinforce = True + else: + self.hasReinforce = False # self.lv = self._calculate_lv() pass @@ -216,7 +230,7 @@ class ActiveSkill(Skill): self.vp_2() def setReinforce(self): - if self.learnLv in [50, 85, 100] or not self.damage: + if not self.hasReinforce: return if self.reinforce == 1: if self.learnLv < 35: diff --git a/frontend/src/api/info/type.ts b/frontend/src/api/info/type.ts index 8dbf491e..b1b67d55 100644 --- a/frontend/src/api/info/type.ts +++ b/frontend/src/api/info/type.ts @@ -83,6 +83,8 @@ export interface ISkill { maxLearnLv: number maxLv: number bind: boolean + hasVP: boolean + hasReinforce: boolean } export interface ISuit { diff --git a/frontend/src/pages/Character/Skill/components/Skill/index.tsx b/frontend/src/pages/Character/Skill/components/Skill/index.tsx new file mode 100644 index 00000000..ebb93371 --- /dev/null +++ b/frontend/src/pages/Character/Skill/components/Skill/index.tsx @@ -0,0 +1,45 @@ +import { getImageURL, getLocalImageURL } from '@/utils/images' +import type { ISkill } from '@/api/info/type' +import { useVModel } from '@vueuse/core' +import CalcButton from '@/components/calc/button/index.vue' +import CalcCheckbox from '@/components/calc/checkbox/index.vue' +import { renderList } from 'vue' + +export default defineComponent({ + name: 'SkillTree', + props: { + skills: { + type: Array as PropType, + default: () => [], + }, + lvInfo: { + type: Object as PropType>, + default: () => ({}), + }, + }, + setup(props) { + const lvInfo = useVModel(props, 'lvInfo') + const skills = computed(() => props.skills.filter((a) => a.hasReinforce).sort((a, b) => a.learnLv - b.learnLv)) + + const reinforce = (type:number,id:number)=>{ + return computed({ + get(){ + return lvInfo.value[id].reinforce + }, + set(value){ + + } + }) + } + + return () => ( + <> +
+
+
+
+
+ + ) + }, +}) diff --git a/frontend/src/pages/Character/Skill/components/SkillReinforce/index.tsx b/frontend/src/pages/Character/Skill/components/SkillReinforce/index.tsx new file mode 100644 index 00000000..595a5bcc --- /dev/null +++ b/frontend/src/pages/Character/Skill/components/SkillReinforce/index.tsx @@ -0,0 +1,89 @@ +import { getImageURL, getLocalImageURL } from '@/utils/images' +import type { ISkill } from '@/api/info/type' +import { useVModel } from '@vueuse/core' +import CalcButton from '@/components/calc/button/index.vue' +import CalcCheckbox from '@/components/calc/checkbox/index.vue' +import { renderList } from 'vue' + +export default defineComponent({ + name: 'SkillTree', + props: { + skills: { + type: Array as PropType, + default: () => [], + }, + lvInfo: { + type: Object as PropType>, + default: () => ({}), + }, + }, + setup(props) { + const lvInfo = useVModel(props, 'lvInfo') + const skills = computed(() => props.skills.filter((a) => a.hasVP).sort((a, b) => a.learnLv - b.learnLv)) + + const currentUsedVP = computed(()=>{ + return Object.keys(lvInfo.value).map(a=>lvInfo.value[a].vp).filter(a=>!!a && a > 0).length + }) + + const itemChecked = (skillID:string,vp:number)=>{ + return computed({ + get(){ + if(!lvInfo.value[skillID].vp){ + lvInfo.value[skillID].vp = 0 + } + return lvInfo.value[skillID]?.vp == vp + }, + set(value:boolean){ + // 选中当前VP形态 并且当前已选VP大于5 并且当前技能没有VP + if(value && currentUsedVP.value >= 5 && lvInfo.value[skillID]?.vp == 0){ + return + } + if(value){ + lvInfo.value[skillID].vp = vp + }else{ + lvInfo.value[skillID].vp = 0 + } + } + }) + } + + return () => ( + <> +
+ {renderList(skills.value, (item) => ( +
+
{item.learnLv}
+
+ {item.name} +
{item.name}
+
+ {renderList(2, (index) => ( +
{ + itemChecked(item.id.toString(), index).value = !itemChecked(item.id.toString(), index).value + }}> +
+
+
+
+ {item.name} +
+ +
+ +
+ ))} +
+ ))} +
+ + ) + }, +}) diff --git a/frontend/src/pages/Character/Skill/index.vue b/frontend/src/pages/Character/Skill/index.vue index f55819fe..640042c7 100644 --- a/frontend/src/pages/Character/Skill/index.vue +++ b/frontend/src/pages/Character/Skill/index.vue @@ -1,11 +1,23 @@ @@ -13,10 +25,12 @@ diff --git a/frontend/src/stores/config.ts b/frontend/src/stores/config.ts index 6d73603e..c3061eae 100644 --- a/frontend/src/stores/config.ts +++ b/frontend/src/stores/config.ts @@ -32,7 +32,7 @@ export interface IConfigEquip { } export interface IConfig { - skills: Record + skills: Record equips: Record jades: Record< string, @@ -160,6 +160,8 @@ export const useConfigStore = defineStore('configStore', () => { config.value && (config.value.skills[id] = { lv: infoStore.skills.find((skill) => skill.id.toString() === id)?.maxLearnLv ?? 0, + vp: 0, + reinforce: 0, }) }) ;( diff --git a/images b/images index 49f13fdc..41638081 160000 --- a/images +++ b/images @@ -1 +1 @@ -Subproject commit 49f13fdced42d378b59e463ab374b58e87837153 +Subproject commit 4163808153ba5caf289d96ca8e9b6805ccfafbc1