比例添加还是有问题的

This commit is contained in:
2025-10-17 13:40:59 +08:00
parent d9282b7469
commit 13874f3618

View File

@@ -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) {