refactor: lock first

This commit is contained in:
cha0s 2019-11-25 05:50:49 -06:00
parent e814e80682
commit 21fb634e69

View File

@ -283,6 +283,10 @@ export class Vulnerable extends Trait {
const damageSpecs = entity.damageSpecs; const damageSpecs = entity.damageSpecs;
for (let i = 0; i < damageSpecs.length; ++i) { for (let i = 0; i < damageSpecs.length; ++i) {
const damageSpec = damageSpecs[i]; const damageSpec = damageSpecs[i];
if (this.locks.has(damageSpec)) {
continue;
}
this.locks.set(damageSpec, damageSpec.lock);
let power = damageSpec.power; let power = damageSpec.power;
// Check if vulnerable to this affinity. // Check if vulnerable to this affinity.
if (this.params.modifiers) { if (this.params.modifiers) {
@ -290,10 +294,6 @@ export class Vulnerable extends Trait {
power *= this.params.modifiers[damageSpec.affinity]; power *= this.params.modifiers[damageSpec.affinity];
} }
} }
if (this.locks.has(damageSpec)) {
continue;
}
this.locks.set(damageSpec, damageSpec.lock);
// Give any knockback. // Give any knockback.
if (damageSpec.knockback) { if (damageSpec.knockback) {
if ( if (