光环逻辑优化

This commit is contained in:
yuexin 2020-12-09 20:48:29 +08:00
parent 19b212ced8
commit 3430eab7f2

View File

@ -280,56 +280,37 @@ export class PlayerHandler {
};
public onHaloAdd(apet: PetHandler, only_checkother: boolean = false){
let bkself = this._self._effhalos.length;
let bkpets: number[] = [];
let lst: PetHandler[] = [];
if(only_checkother){
this._pets.forEach((obj: PetHandler)=>{
if(apet.checkHalo(obj)){
if(apet.addEffHalo(obj)){
lst.push(obj);
}
});
if(this._self != apet){
if(apet.checkHalo(this._self)){
if(apet.addEffHalo(this._self)){
lst.push(this._self);
}
}
}else{
this._self.clearEffHalos();
this._pets.forEach((obj:PetHandler)=>{
bkpets.push(obj._effhalos.length);
obj.clearEffHalos();
});
apet.checkHalo(apet);
apet.addEffHalo(apet);
this._pets.forEach((obj: PetHandler)=>{
if(obj != apet){
obj.checkHalo(apet);
apet.checkHalo(obj);
obj.addEffHalo(apet);
if(apet.addEffHalo(obj)){
lst.push(obj);
}
}
});
if(this._self != apet){
this._self.checkHalo(apet);
apet.checkHalo(this._self);
}
if(bkself != this._self._effhalos.length){
if(this._self != apet){
this._self.addEffHalo(apet);
if(apet.addEffHalo(this._self)){
lst.push(this._self);
}
}
for(let i = 0; i < bkpets.length; i++){
let bk = bkpets[i];
let obj = this._pets[i];
if(obj != apet && obj._effhalos.length != bk){
lst.push(obj);
}
}
}
this._owner.onUpdatePetsNotify(lst);