From 5dd14512b3b89856e6db5a3b92e388dd6f7d15df Mon Sep 17 00:00:00 2001 From: Shaun Date: Tue, 27 Apr 2021 18:45:21 +0200 Subject: [PATCH] bug #1752 --- .../spells/spellBloodBarrier.js | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/server/mods/class-necromancer/spells/spellBloodBarrier.js b/src/server/mods/class-necromancer/spells/spellBloodBarrier.js index a82ea686..854b7d4c 100644 --- a/src/server/mods/class-necromancer/spells/spellBloodBarrier.js +++ b/src/server/mods/class-necromancer/spells/spellBloodBarrier.js @@ -18,37 +18,41 @@ module.exports = { noTargetSelf: true, cast: function (action) { - let obj = this.obj; - let target = action.target; + const { target } = action; this.sendBump(target); - this.queueCallback(this.explode.bind(this, target), 1, null, target); - - this.sendBump({ - x: obj.x, - y: obj.y - 1 - }); + this.queueCallback(this.explode.bind(this, action), 1, null, target); return true; }, - explode: function (target) { - if ((this.obj.destroyed) || (target.destroyed)) + + explode: function (action) { + const { obj } = this; + const { target } = action; + + if ((obj.destroyed) || (target.destroyed)) return; - let amount = (this.obj.stats.values.hpMax / 100) * this.drainPercentage; - let damage = { - amount: amount - }; - this.obj.stats.takeDamage(damage, 0, this.obj); + let amount = (obj.stats.values.hpMax / 100) * this.drainPercentage; + const damage = { amount }; + obj.stats.takeDamage(damage, 0, obj); amount = amount * this.shieldMultiplier; - let heal = { - amount: amount - }; - target.stats.getHp(heal, this.obj); + const heal = { amount }; + target.stats.getHp(heal, obj); + + //Only reset the first spell's cooldown if it's an auto attack and not a spell + const firstSpell = target.spellbook.spells[0]; + const resetFirstSpell = ( + firstSpell && + firstSpell.isAttack && + firstSpell.auto + ); + + if (resetFirstSpell) + target.spellbook.spells[0].cd = 0; - target.spellbook.spells[0].cd = 0; target.effects.addEffect({ type: 'frenzy', ttl: this.frenzyDuration,