buff 优化 heroset 不再使用json
This commit is contained in:
@@ -52,7 +52,7 @@ export class MonsterBuffComp extends CCComp {
|
||||
|
||||
}
|
||||
add_buff(uuid:number=0,eid:number=0,group:number=0){
|
||||
// console.log("add_buff",event,args,smc.skills[uuid]);
|
||||
// console.log("add_buff",smc.skills[uuid]);
|
||||
|
||||
let new_buff={
|
||||
skill_uuid:uuid,
|
||||
@@ -87,35 +87,51 @@ export class MonsterBuffComp extends CCComp {
|
||||
}
|
||||
|
||||
buff_add(buff:any){
|
||||
// console.log("buff add:",this.buffs);
|
||||
if(!this.node.isValid){ return }
|
||||
let i = 0
|
||||
if(this.buffs.length >=0){
|
||||
this.buffs.forEach((b:any,index:number)=>{
|
||||
if(b.skill_uuid==buff.skill_uuid){
|
||||
b.time=buff.time;
|
||||
this.mv.atk+=(buff.atk-b.atk);
|
||||
this.mv.hp+=(buff.hp-b.hp);
|
||||
this.mv.hp_max+=(buff.hp-b.hp);
|
||||
this.mv.shield=buff.shield-b.shield;
|
||||
if(buff.atk>0){
|
||||
this.mv.atk+=(buff.atk-b.atk);
|
||||
}
|
||||
if(buff.hp>0){
|
||||
this.mv.hp+=(buff.hp-b.hp);
|
||||
this.mv.hp_max+=(buff.hp-b.hp);
|
||||
}
|
||||
if(buff.shield>0){
|
||||
this.mv.shield=buff.shield;
|
||||
this.mv.shield_max=buff.shield;
|
||||
}
|
||||
|
||||
i=index
|
||||
}
|
||||
})
|
||||
}
|
||||
if (i==0||this.buffs.length==0) {
|
||||
this.buffs.push(buff);
|
||||
this.mv.atk+=buff.atk;
|
||||
this.mv.hp+=buff.hp;
|
||||
this.mv.hp_max+=buff.hp;
|
||||
this.mv.shield+=buff.shield;
|
||||
if(buff.atk>0){
|
||||
this.mv.atk+=buff.atk;
|
||||
}
|
||||
if(buff.hp>0){
|
||||
this.mv.hp+=buff.hp;
|
||||
this.mv.hp_max+=buff.hp;
|
||||
}
|
||||
if(buff.shield>0){
|
||||
this.mv.shield=buff.shield;
|
||||
this.mv.shield_max=buff.shield;
|
||||
}
|
||||
|
||||
}
|
||||
// console.log("buff add:"+this.mv.ent.eid,this.node);
|
||||
console.log("buff add:",this.mv);
|
||||
}
|
||||
buff_remove(index:number){
|
||||
this.mv.atk=this.mv.atk-this.buffs[index].atk;
|
||||
this.mv.hp_max=this.mv.hp_max-this.buffs[index].hp;
|
||||
this.mv.shield=this.mv.shield-this.buffs[index].shield;
|
||||
// console.log("buff remove:"+this.mv.ent.eid,this.node)
|
||||
this.mv.atk-=this.buffs[index].atk;
|
||||
this.mv.hp_max-=this.buffs[index].hp;
|
||||
// this.mv.shield=0;
|
||||
this.mv.shield_max-=this.buffs[index].shield;
|
||||
console.log("buff remove:",this.mv);
|
||||
}
|
||||
buff_update(){
|
||||
this.buffs.forEach((buff:any,index:number)=>{
|
||||
|
||||
Reference in New Issue
Block a user