添加免伤

This commit is contained in:
pan
2024-10-22 16:41:38 +08:00
parent 46fd88d75a
commit 6dc379f5c3
2 changed files with 14 additions and 3 deletions

View File

@@ -80,7 +80,11 @@ export class RoleViewComp extends CCComp {
ospeed: number = 100; /** 角色初始速度 */ ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0); Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0.5; /*停止倒计时*/ stop_cd: number = 0.5; /*停止倒计时*/
//暴击
crit: number = 1.5;
crit_rate: number = 0;
//免伤
dodge_rate: number = 0;
shield:number = 0; //护盾量 shield:number = 0; //护盾量
shield_max:number = 200; shield_max:number = 200;
shield_time:number = 0; //护盾持续时间 shield_time:number = 0; //护盾持续时间
@@ -126,7 +130,8 @@ export class RoleViewComp extends CCComp {
if(this.hp <= 0 ){ if(this.hp <= 0 ){
return return
} }
this.hp_change(skill.atk); let loss_hp=skill.atk*(100-this.dodge_rate)/100
this.hp_change(loss_hp);
} }
} }
} }

View File

@@ -73,6 +73,11 @@ export class HeroViewComp extends CCComp {
ospeed: number = 100; /** 角色初始速度 */ ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0); Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0.5; /*停止倒计时*/ stop_cd: number = 0.5; /*停止倒计时*/
//暴击
crit: number = 1.5;
crit_rate: number = 0;
//免伤
dodge_rate: number = 0;
shield:number = 0; //护盾量 shield:number = 0; //护盾量
shield_max:number = 200; shield_max:number = 200;
@@ -139,7 +144,8 @@ export class HeroViewComp extends CCComp {
if(this.hp <= 0 ){ if(this.hp <= 0 ){
return return
} }
this.hp_change(skill.atk); let loss_hp=skill.atk*(100-this.dodge_rate)/100
this.hp_change(loss_hp);
} }
} }