refactor: iterateForEach

This commit is contained in:
cha0s 2019-11-25 03:33:10 -06:00
parent 9f6cae5b9b
commit e814e80682

View File

@ -5,6 +5,7 @@ import {
buildTraversal,
Context,
} from '@avocado/behavior';
import {iterateForEach} from '@avocado/core';
import {hasGraphics, TextNodeRenderer} from '@avocado/graphics';
import {randomNumber, Vector} from '@avocado/math';
@ -345,13 +346,7 @@ export class Vulnerable extends Trait {
this.damageTickingPromises[i].tick(elapsed);
}
if (AVOCADO_SERVER) {
const keyIterator = this.locks.keys();
for (
let thisKey = keyIterator.next();
thisKey.done !== true;
thisKey = keyIterator.next()
) {
const {value: key} = thisKey;
iterateForEach(this.locks.keys(), (key) => {
const remaining = this.locks.get(key) - elapsed;
if (remaining <= 0) {
this.locks.delete(key);
@ -359,7 +354,7 @@ export class Vulnerable extends Trait {
else {
this.locks.set(key, remaining);
}
}
});
}
}