From e0bdb5eacfa5b5411b9a27e957f43be9e77d594e Mon Sep 17 00:00:00 2001 From: yuexin Date: Wed, 23 Dec 2020 11:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E6=89=A3=E8=A1=80?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/logic/Handler/PetHandler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rooms/logic/Handler/PetHandler.ts b/src/rooms/logic/Handler/PetHandler.ts index e4535ce..54e5806 100644 --- a/src/rooms/logic/Handler/PetHandler.ts +++ b/src/rooms/logic/Handler/PetHandler.ts @@ -66,6 +66,9 @@ export class PetHandler { this._id = id || 0; this._cfg = CfgMan.findUnitCfg(this._id); + if(!this._cfg){ + console.log('[error]no cfg:' + this._id); + } this._exredhurt = this._cfg.defense / 100; this._enmagic = this._cfg.spell_power; @@ -240,9 +243,10 @@ export class PetHandler { this._baseap += value; if(this._baseap <= 0){ if(this._isHero){ + let tmp = this._baseap; this._baseap = 0; this.dataChanged(); - this.addHP(this._baseap); + this.addHP(tmp); }else{ this.die(); }