From 86ae9ab3b138ceddc080a6fd33ddce573f6437ee Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 3 May 2019 19:53:44 -0500 Subject: [PATCH] fix: continue instead of return --- common/combat/vulnerable.trait.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/common/combat/vulnerable.trait.js b/common/combat/vulnerable.trait.js index e6beacf..02a5ac3 100644 --- a/common/combat/vulnerable.trait.js +++ b/common/combat/vulnerable.trait.js @@ -169,7 +169,7 @@ export class Vulnerable extends Trait { for (let i = 0; i < damageSpecs.length; ++i) { const damageSpec = damageSpecs[i]; if (this.locks.has(damageSpec)) { - return; + continue; } this.locks.set(damageSpec, damageSpec.lock); const variance = Math.random() * damageSpec.variance * 2 - damageSpec.variance; @@ -212,9 +212,18 @@ export class Vulnerable extends Trait { } } if (AVOCADO_SERVER) { - const keys = Array.from(this.locks.keys()); - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; + const keyIterator = this.locks.keys(); + // const keys = Array.from(this.locks.keys()); + for ( + let thisKey = keyIterator.next(); + thisKey.done !== true; + thisKey = keyIterator.next() + ) { + // newArray.push(nextValue.value); + // } + // for (let i = 0; i < keys.length; ++i) { + // const key = keys[i]; + const {value: key} = thisKey; const remaining = this.locks.get(key) - elapsed; if (remaining <= 0) { this.locks.delete(key);