信息展示 继续
This commit is contained in:
@@ -52,6 +52,7 @@ export class HeroViewComp extends CCComp {
|
||||
hp_up:number=0;
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_buff:number=0;
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
@@ -90,16 +91,10 @@ export class HeroViewComp extends CCComp {
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = []
|
||||
|
||||
DEBUFF_SLOW: number = 0;
|
||||
DEBUFF_FROST: number = 0;
|
||||
DEBUFF_STUN: number = 0;
|
||||
|
||||
VM_TYPE:any={
|
||||
ALL:0,
|
||||
HP:1,
|
||||
OTHER:2,
|
||||
}
|
||||
private damageQueue: Array<{
|
||||
damage: number,
|
||||
isCrit: boolean,
|
||||
@@ -115,7 +110,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.FIGHTCON=this.node.parent.getComponent(FightConComp);
|
||||
console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
|
||||
|
||||
this.on(GameEvent.UpdateHP,this.update_hp,this)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
}
|
||||
@@ -226,7 +221,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap += Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
this.BUFFCOMP.vmdata_update()
|
||||
}
|
||||
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
@@ -237,9 +232,20 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
this.BUFFCOMP.vmdata_update()
|
||||
}
|
||||
update_hp(e:GameEvent,data:any){
|
||||
console.log("[HeroViewComp]:update_hp",data)
|
||||
if(this.is_master===data.is_master&&this.fac===FacSet.HERO){
|
||||
this.hp_buff += data.hp
|
||||
if(data.hp > 0){
|
||||
this.hp += this.hp_max*data.hp/100
|
||||
if(this.hp > this.hp_max*(100+this.hp_buff/100)){
|
||||
this.hp=this.hp_max*(100+this.hp_buff/100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_hp_max(hp: number=0,is_num:boolean=true){
|
||||
console.log("[HeroViewComp]:add_hp_max add:",hp,this.hp_max)
|
||||
if(is_num){
|
||||
@@ -260,7 +266,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_max -= Math.floor(hp/100*this.hp_max);
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
}
|
||||
|
||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||
@@ -274,7 +280,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -345,6 +351,9 @@ export class HeroViewComp extends CCComp {
|
||||
case DebuffAttr.BURN:
|
||||
this.DEBUFF_BURNS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.SLOW:
|
||||
this.DEBUFF_SLOW+=deV
|
||||
break
|
||||
@@ -357,15 +366,16 @@ export class HeroViewComp extends CCComp {
|
||||
this.DEBUFF_STUN+=deV
|
||||
this.is_stop=true
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.DEHP:
|
||||
this.hp_max-=deV
|
||||
this.hp_max-=deV/100*this.hp_max
|
||||
if(this.hp-this.hp_max>0) this.hp=this.hp_max
|
||||
break
|
||||
case DebuffAttr.DEATK:
|
||||
this.ap-=deV
|
||||
case DebuffAttr.DEATK: //99为具体数字 并且局内永久生效,其他为百分比
|
||||
if(deC == 99){
|
||||
this.ap-=deV
|
||||
}else{
|
||||
this.DEBUFF_DEATKS.push({value:deV,count:deC})
|
||||
}
|
||||
break
|
||||
case DebuffAttr.DECOUNT:
|
||||
this.atk_count-=deV
|
||||
@@ -416,7 +426,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
this.showDamage(damage, is_crit);
|
||||
|
||||
}
|
||||
@@ -439,14 +449,12 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFF_DEFS.splice(i,1)
|
||||
}
|
||||
}
|
||||
let buff_key=null
|
||||
if(this.is_master) {buff_key="hero"}
|
||||
if(this.is_friend) {buff_key="friend"}
|
||||
if(this.is_boss) {buff_key="enemy"}
|
||||
if(this.is_kalami) {buff_key="enemy"}
|
||||
if(buff_key==null) return
|
||||
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
let buff=null
|
||||
if(this.is_master) buff=this.FIGHTCON.hero_buff
|
||||
if(this.is_friend) buff=this.FIGHTCON.friend_buff
|
||||
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
|
||||
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
|
||||
if(buff==null) return
|
||||
damage=remainingDamage*(100-(buff.DEF+def)+Burn)/100
|
||||
|
||||
return Math.floor(damage)
|
||||
|
||||
Reference in New Issue
Block a user