From 13874f361884c83261c06bb4347f2c86d1346b8e Mon Sep 17 00:00:00 2001 From: walkpan Date: Fri, 17 Oct 2025 13:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E4=BE=8B=E6=B7=BB=E5=8A=A0=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/hero/HeroViewComp.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 0b3dafac..79ff4016 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -95,7 +95,6 @@ export class HeroViewComp extends CCComp { is_friend:boolean =false; is_kalami:boolean =false; - speed: number = 100; /** 角色移动速度 */ mp: number = 100; hp: number = 100; /** 血量 */ shield:number=0; //当前护甲值 @@ -105,6 +104,7 @@ export class HeroViewComp extends CCComp { base_def: number = 5; base_hp: number = 100; base_mp: number = 100; + base_speed: number = 100; /** 角色移动速度 */ Attrs:any=[] //数值型debuff @@ -302,13 +302,15 @@ export class HeroViewComp extends CCComp { this.Attrs[Attrs.DEF] = this.base_def; this.Attrs[Attrs.AP] = this.base_ap; this.Attrs[Attrs.MAP] = this.base_map; + this.Attrs[Attrs.SPEED] = this.base_speed; this.Attrs[Attrs.SHIELD_MAX] = 0; // 护盾默认为 0 // 2. 初始化其他属性(无初始值的) - for (let i = 0; i <= 26; i++) { + let length = Object.keys(this.Attrs).length; + for (let i = 0; i < length; i++) { if (!(i in this.Attrs) || (i !== Attrs.HP_MAX && i !== Attrs.MP_MAX && i !== Attrs.DEF && - i !== Attrs.AP && i !== Attrs.MAP && i !== Attrs.SHIELD_MAX)) { + i !== Attrs.AP && i !== Attrs.MAP && i !== Attrs.SHIELD_MAX&&13 && i !== Attrs.SPEED)) { this.Attrs[i] = 0; } } @@ -360,6 +362,7 @@ export class HeroViewComp extends CCComp { baseValues[Attrs.DEF] = this.base_def; baseValues[Attrs.AP] = this.base_ap; baseValues[Attrs.MAP] = this.base_map; + baseValues[Attrs.SPEED] = this.base_speed; // 持久型 buff for (const buff of this.R_BUFF) { @@ -411,6 +414,7 @@ export class HeroViewComp extends CCComp { baseValues[Attrs.DEF] = this.base_def; baseValues[Attrs.AP] = this.base_ap; baseValues[Attrs.MAP] = this.base_map; + this.Attrs[Attrs.SPEED] = this.base_speed; // 持久型 debuff for (const debuff of this.R_DBUFF) {