From 3430eab7f29b153ebb7368812e3888d4f2790d6d Mon Sep 17 00:00:00 2001 From: yuexin Date: Wed, 9 Dec 2020 20:48:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=89=E7=8E=AF=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/logic/Handler/PlayerHandler.ts | 37 ++++++------------------ 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/rooms/logic/Handler/PlayerHandler.ts b/src/rooms/logic/Handler/PlayerHandler.ts index d98ad5f..51eab52 100644 --- a/src/rooms/logic/Handler/PlayerHandler.ts +++ b/src/rooms/logic/Handler/PlayerHandler.ts @@ -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);