From d553ddc9c5bde4f9b66b95358766fe1b0c8d8850 Mon Sep 17 00:00:00 2001 From: panfudan Date: Fri, 25 Apr 2025 13:48:53 +0800 Subject: [PATCH] dd --- assets/script/game/hero/BuffComp.ts | 1 + assets/script/game/hero/HeroViewComp.ts | 47 +++++++++++++++++-------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/assets/script/game/hero/BuffComp.ts b/assets/script/game/hero/BuffComp.ts index 4e68fd95..7dd28017 100644 --- a/assets/script/game/hero/BuffComp.ts +++ b/assets/script/game/hero/BuffComp.ts @@ -73,6 +73,7 @@ export class BuffComp extends Component { update_info_hp(){ let ihp_node = this.top_node.getChildByName("ihp"); ihp_node.getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).hp.toFixed(0) + this.hp_show() } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 989c19fe..efa3cb9c 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -184,38 +184,57 @@ export class HeroViewComp extends CCComp { * 增加英雄的攻击(AP)。 * @param ap 要增加的攻击。 */ - add_ap(ap: number){ - this.ap += Math.floor(ap); + add_ap(ap: number,is_num:boolean=false){ + if(is_num){ + this.ap += Math.floor(ap); + }else{ + this.ap += Math.floor(ap/100*this.ap); + } this.BUFFCOMP.update_info_ap() } - de_ap(ap: number){ - this.ap -= Math.floor(ap); + de_ap(ap: number,is_num:boolean=false){ + if(is_num){ + this.ap -= Math.floor(ap); + }else{ + this.ap -= Math.floor(ap/100*this.ap); + } this.BUFFCOMP.update_info_ap() } - add_hp_max(hprate: number=0){ - this.hp_max += Math.floor(hprate) ; - this.hp += Math.floor(hprate) ; + add_hp_max(hp: number=0,is_num:boolean=false){ + if(is_num){ + this.hp_max += Math.floor(hp) ; + this.hp += Math.floor(hp) ; + }else{ + this.hp_max += Math.floor(hp/100*this.hp_max); + this.hp += Math.floor(hp/100*this.hp_max); + } this.BUFFCOMP.update_info_hp() } - de_hp_max(hprate: number=0){ - this.hp_max -= Math.floor(hprate) ; + de_hp_max(hp: number=0,is_num:boolean=false){ + if(is_num){ + this.hp_max -= Math.floor(hp) ; + }else{ + this.hp_max -= Math.floor(hp/100*this.hp_max); + } this.BUFFCOMP.update_info_hp() } - add_hp(hp: number = 0) { + add_hp(hp: number = 0,is_num:boolean=false) { this.BUFFCOMP.heathed(); - this.hp+=Math.floor(hp); + if(is_num){ + this.hp+=Math.floor(hp); + }else{ + this.hp+=Math.floor(hp/100*this.hp_max); + } if(this.hp > this.hp_max){ this.hp = this.hp_max; } this.BUFFCOMP.tooltip(2,hp.toFixed(0)); } - add_hp2(hprate: number=0){ - this.hp += Math.floor(hprate/100*this.hp_max) ; - } + /** 静止时间 */ in_stop (dt: number) {