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); }; /**