++护盾技能

This commit is contained in:
2025-07-10 00:30:35 +08:00
parent 7dcaf19925
commit 541a944c0c
21 changed files with 1288 additions and 834 deletions

View File

@@ -195,6 +195,7 @@ export class HeroViewComp extends CCComp {
add_shield(shield:number){
this.shield =shield
if(this.shield>6) this.shield=6
if(this.shield>0) this.BUFFCOMP.show_shield(true)
}
// add_cd(cd: number){
@@ -255,19 +256,30 @@ export class HeroViewComp extends CCComp {
add_hp(hp: number = 0,is_num:boolean=true) {
this.BUFFCOMP.heathed();
let real_hp=0
let hp_max=Math.floor(this.hp_max*(100+this.buff_hp)/100)
let lost_hp=hp_max-this.hp
if(is_num){
this.hp+=Math.floor(hp);
if(lost_hp > hp){
real_hp=Math.floor(hp);
}else{
real_hp=lost_hp;
}
}else{
this.hp+=Math.floor(hp/100*this.hp_max);
if(lost_hp > hp/100*hp_max){
real_hp=Math.floor(hp/100*hp_max);
}else{
real_hp=lost_hp;
}
}
if(this.hp > this.hp_max){
this.hp = this.hp_max;
if(real_hp > 0){
this.hp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
this.BUFFCOMP.tooltip(TooltipTypes.health,hp.toFixed(0));
this.BUFFCOMP.vmdata_update(true)
}
/** 静止时间 */
in_stop (dt: number) {
if(this.stop_cd > 0){