From 2b826f8b1e5fc3c19a8f0d3831fb0fbab322baf7 Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 13 Nov 2023 12:00:49 -0500 Subject: [PATCH] Conditional Code Adjustments Re:Biome When multiple falsey conditions are being checked Biome recommends to check for all the truthy conditions negated. Logic remains untouched, while only using one negation. Apparently easier to comprehend. --- project/src/generators/BotEquipmentModGenerator.ts | 6 ++---- project/src/generators/LocationGenerator.ts | 4 ++-- project/src/generators/LootGenerator.ts | 2 +- project/src/services/ProfileFixerService.ts | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index d572694c..c5a1740a 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -199,11 +199,9 @@ export class BotEquipmentModGenerator const compatibleModsPool = modPool[parentTemplate._id]; // Null guard against bad input weapon - // biome-ignore lint/complexity/useSimplifiedLogicExpression: if ( - !parentTemplate._props.Slots.length && - !parentTemplate._props.Cartridges?.length && - !parentTemplate._props.Chambers?.length + !((parentTemplate._props.Slots.length || parentTemplate._props.Cartridges?.length) || + parentTemplate._props.Chambers?.length) ) { this.logger.error( diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index bdb1bd8e..93e9554a 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -133,8 +133,8 @@ export class LocationGenerator // randomisation is turned off globally or just turned off for this map if ( - !this.locationConfig.containerRandomisationSettings.enabled || - !this.locationConfig.containerRandomisationSettings.maps[locationId] + !(this.locationConfig.containerRandomisationSettings.enabled && + this.locationConfig.containerRandomisationSettings.maps[locationId]) ) { this.logger.debug( diff --git a/project/src/generators/LootGenerator.ts b/project/src/generators/LootGenerator.ts index 7658f480..3f5babb6 100644 --- a/project/src/generators/LootGenerator.ts +++ b/project/src/generators/LootGenerator.ts @@ -410,7 +410,7 @@ export class LootGenerator x._parent === rewardTypeId && x._type.toLowerCase() === "item" && !this.itemFilterService.isItemBlacklisted(x._id) && - (!containerSettings.allowBossItems && !this.itemFilterService.isBossItem(x._id)) && + (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id))) && !x._props.QuestItem ); diff --git a/project/src/services/ProfileFixerService.ts b/project/src/services/ProfileFixerService.ts index 9d672128..3fdb0212 100644 --- a/project/src/services/ProfileFixerService.ts +++ b/project/src/services/ProfileFixerService.ts @@ -424,7 +424,7 @@ export class ProfileFixerService const existsInQuests = pmcProfile.Quests.some((q) => q.qid === backendCounter.qid); // if BackendCounter's quest is neither in activeQuests nor Quests it's stale - if (!existsInActiveRepeatableQuests && !existsInQuests) + if (!(existsInActiveRepeatableQuests || existsInQuests)) { counterKeysToRemove.push(key); }