战斗等级显示需要完善

This commit is contained in:
2025-05-26 16:38:59 +08:00
parent 85856ccc28
commit 3efbf21a14
8 changed files with 159 additions and 109 deletions

View File

@@ -44,7 +44,7 @@ export class BuffComp extends Component {
update(deltaTime: number) {
if(smc.mission.pause) return
this.hp_show()
// this.hp_show()
if(this.wind_cd > 0 ) this.wind_cd -= deltaTime;
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
this.node.getChildByName("wind").active = false;
@@ -59,12 +59,18 @@ export class BuffComp extends Component {
}
hp_show(){
let hp=this.node.getComponent(HeroViewComp).hp;
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
let hp_progress= hp/hp_max;
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.node.getComponent(HeroViewComp).is_boss) return
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
if(this.node.getComponent(HeroViewComp).fac == 0) {
this.update_info_hp()
}else{
let hp=this.node.getComponent(HeroViewComp).hp;
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
let hp_progress= hp/hp_max;
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.node.getComponent(HeroViewComp).is_boss) return
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
}
}
show_shield(val:boolean){
this.node.getChildByName("shielded").active=val

View File

@@ -254,6 +254,28 @@ export class HeroViewComp extends CCComp {
}
do_dead(){
}
do_atked(remainingDamage:number){
if (this.shield > 0) {
this.shield -= 1
this.BUFFCOMP.tooltip(5,"*吸收*");
remainingDamage = 0
if (this.shield <= 0) {
if(this == null) return;
this.BUFFCOMP.show_shield(false);
}
}else{
if(this == null) return;
this.hp -= remainingDamage;
if(this.hp <= 0) {
if(this == null) return;
this.BUFFCOMP.dead()
if(this.ent == null) return;
this.ent.destroy();
}
this.BUFFCOMP.hp_show()
this.showDamage(remainingDamage, true);
}
}
dead(){
this.BUFFCOMP.dead()

View File

@@ -108,7 +108,7 @@ export class MissionHeroCompComp extends CCComp {
}
get_info_and_remove(fight_pos:number,uuid:number){
let info:any={ap:0,hp:0}
let info:any={ap:0,hp:0,lv:0}
let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){
if(hero.get(HeroViewComp).fight_pos==fight_pos){
@@ -123,6 +123,7 @@ export class MissionHeroCompComp extends CCComp {
let s_hp_up = (HeroUpInfo[uuid] || {}).hp_up || 0 //替换 升级的英雄额外替换血量增长值
info.ap=Math.floor(hv.ap*(AP_UP_RATE+o_ap_rate+s_ap_rate)/100+o_ap+s_ap)
info.hp=Math.floor(o_hp_up+s_hp_up)
info.lv=hv.lv
hero.destroy()
return info
}

View File

@@ -103,25 +103,7 @@ export class SkillCom extends CCComp {
if(oCol.group!=this.group){
if(target == null) return;
let remainingDamage = this.ap;
if (target.shield > 0) {
target.shield -= 1
target.BUFFCOMP.tooltip(5,"*吸收*");
remainingDamage = 0
if (target.shield <= 0) {
if(target == null) return;
target.BUFFCOMP.show_shield(false);
}
}else{
if(target == null) return;
target.hp -= remainingDamage;
if(target.hp <= 0) {
if(target == null) return;
target.BUFFCOMP.dead()
if(target.ent == null) return;
target.ent.destroy();
}
target.showDamage(remainingDamage, true);
}
target.do_atked(remainingDamage)
this.ent.destroy()
}
}