From 6f8d63f6758004d99bee63f4f93d50d32c3be44e Mon Sep 17 00:00:00 2001 From: mengyxu Date: Sun, 18 May 2025 00:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=88=98=E6=96=97=E4=B8=AD=E6=9B=B4=E6=8D=A2=E8=A3=85=E5=A4=87?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E6=AD=BBBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/beings.ts | 6 ++++++ src/tool/caller/attribute.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config/beings.ts b/src/config/beings.ts index 08888e4..71db175 100644 --- a/src/config/beings.ts +++ b/src/config/beings.ts @@ -52,6 +52,12 @@ export class Attribute { }); } } + + copy(attr: Attribute) { + Object.keys(attr).forEach((key) => { + this[key] = attr[key]; + }); + } } export class Player { diff --git a/src/tool/caller/attribute.ts b/src/tool/caller/attribute.ts index f0533b1..7863f4c 100644 --- a/src/tool/caller/attribute.ts +++ b/src/tool/caller/attribute.ts @@ -48,7 +48,8 @@ export const callPlayerAttribute = (player: Player, base: any) => { attribute.dps = Math.ceil((1 - crit + crit * critdmg) * atk * (1 + dmgPercent)); //计算减伤比例 attribute.reducPercent = callReducPercent(attribute.def, player.lv); - player.attribute = attribute; + + player.attribute.copy(attribute); }; /**