From 3f3c8bce41295942bcb80bc0fe692b805b9ac15a Mon Sep 17 00:00:00 2001 From: masquevil Date: Mon, 22 Apr 2024 00:11:41 +0800 Subject: [PATCH] =?UTF-8?q?[coc-card]=20bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/coc-card/character.ts | 5 +---- src/types/coc-card/character.ts | 4 ++-- src/views/COCCardSections/SkillSection.vue | 7 ++++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/models/coc-card/character.ts b/src/models/coc-card/character.ts index 4a128eb..befa5e2 100644 --- a/src/models/coc-card/character.ts +++ b/src/models/coc-card/character.ts @@ -16,10 +16,7 @@ export function createPC( hometown: '', attributes: {}, battleAttributes: {}, - pointValues: { - pro: '', - interest: '', - }, + pointValues: {}, proSkills: [], skillPoints: [], weapons: [createWeapon(weapons[0])], diff --git a/src/types/coc-card/character.ts b/src/types/coc-card/character.ts index b686d4f..a67e3b5 100644 --- a/src/types/coc-card/character.ts +++ b/src/types/coc-card/character.ts @@ -18,8 +18,8 @@ export interface COCPlayerCharacter { battleAttributes: COCBattleAttributes; // 技能与点数 pointValues: { - pro: string; - interest: string; + pro?: string; + interest?: string; }; proSkills: COCPCSkill[]; skillPoints: [COCPCSkill, SkillPoint][]; diff --git a/src/views/COCCardSections/SkillSection.vue b/src/views/COCCardSections/SkillSection.vue index 35decf5..98be5ce 100644 --- a/src/views/COCCardSections/SkillSection.vue +++ b/src/views/COCCardSections/SkillSection.vue @@ -88,7 +88,7 @@ watch( const int = attributes?.int; const newInterest = int ? `${int * 2}` : ''; - const customInterest = pc?.value.pointValues.pro; + const customInterest = pc?.value.pointValues.interest; if (newInterest) { updateLocalValue('interest', customInterest ?? newInterest); } @@ -109,8 +109,9 @@ watch( ) => { // import from txt if (newPointValues !== oldPointValues) { - updateLocalValue('pro', newPro); - updateLocalValue('interest', newInterest); + if (typeof newPro !== 'undefined') updateLocalValue('pro', newPro); + if (typeof newInterest !== 'undefined') + updateLocalValue('interest', newInterest); return; } if (newPro !== oldPro) {