remove the no-bitwise rule and all the eslint-disable-rule stuff

This commit is contained in:
IvarK 2022-08-04 19:02:39 +03:00
parent 871626e992
commit a590c353a9
28 changed files with 2 additions and 93 deletions

View File

@ -200,7 +200,6 @@
], ],
"new-parens": "error", "new-parens": "error",
"no-array-constructor": "warn", "no-array-constructor": "warn",
"no-bitwise": "warn",
"no-inline-comments": "error", "no-inline-comments": "error",
"no-lonely-if": "error", "no-lonely-if": "error",
"no-mixed-spaces-and-tabs": "error", "no-mixed-spaces-and-tabs": "error",

View File

@ -1,4 +1,4 @@
/* eslint-disable no-bitwise, no-console */ /* eslint-disable no-console */
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");

View File

@ -5,9 +5,7 @@ class AchievementState extends GameMechanicState {
super(config); super(config);
this._row = Math.floor(this.id / 10); this._row = Math.floor(this.id / 10);
this._column = this.id % 10; this._column = this.id % 10;
// eslint-disable-next-line no-bitwise
this._bitmask = 1 << (this.column - 1); this._bitmask = 1 << (this.column - 1);
// eslint-disable-next-line no-bitwise
this._inverseBitmask = ~this._bitmask; this._inverseBitmask = ~this._bitmask;
this.registerEvents(config.checkEvent, args => this.tryUnlock(args)); this.registerEvents(config.checkEvent, args => this.tryUnlock(args));
} }
@ -33,7 +31,6 @@ class AchievementState extends GameMechanicState {
} }
get isUnlocked() { get isUnlocked() {
// eslint-disable-next-line no-bitwise
return (player.achievementBits[this.row - 1] & this._bitmask) !== 0; return (player.achievementBits[this.row - 1] & this._bitmask) !== 0;
} }
@ -52,13 +49,11 @@ class AchievementState extends GameMechanicState {
} }
lock() { lock() {
// eslint-disable-next-line no-bitwise
player.achievementBits[this.row - 1] &= this._inverseBitmask; player.achievementBits[this.row - 1] &= this._inverseBitmask;
} }
unlock(auto) { unlock(auto) {
if (this.isUnlocked) return; if (this.isUnlocked) return;
// eslint-disable-next-line no-bitwise
player.achievementBits[this.row - 1] |= this._bitmask; player.achievementBits[this.row - 1] |= this._bitmask;
if (this.id === 85 || this.id === 93) { if (this.id === 85 || this.id === 93) {
Autobuyer.bigCrunch.bumpAmount(4); Autobuyer.bigCrunch.bumpAmount(4);

View File

@ -5,9 +5,7 @@ class SecretAchievementState extends GameMechanicState {
super(config); super(config);
this._row = Math.floor(this.id / 10); this._row = Math.floor(this.id / 10);
this._column = this.id % 10; this._column = this.id % 10;
// eslint-disable-next-line no-bitwise
this._bitmask = 1 << (this.column - 1); this._bitmask = 1 << (this.column - 1);
// eslint-disable-next-line no-bitwise
this._inverseBitmask = ~this._bitmask; this._inverseBitmask = ~this._bitmask;
this.registerEvents(config.checkEvent, args => this.tryUnlock(args)); this.registerEvents(config.checkEvent, args => this.tryUnlock(args));
} }
@ -25,7 +23,6 @@ class SecretAchievementState extends GameMechanicState {
} }
get isUnlocked() { get isUnlocked() {
// eslint-disable-next-line no-bitwise
return (player.secretAchievementBits[this.row - 1] & this._bitmask) !== 0; return (player.secretAchievementBits[this.row - 1] & this._bitmask) !== 0;
} }
@ -37,14 +34,12 @@ class SecretAchievementState extends GameMechanicState {
unlock() { unlock() {
if (this.isUnlocked) return; if (this.isUnlocked) return;
// eslint-disable-next-line no-bitwise
player.secretAchievementBits[this.row - 1] |= this._bitmask; player.secretAchievementBits[this.row - 1] |= this._bitmask;
GameUI.notify.success(`Secret Achievement: ${this.name}`); GameUI.notify.success(`Secret Achievement: ${this.name}`);
EventHub.dispatch(GAME_EVENT.ACHIEVEMENT_UNLOCKED); EventHub.dispatch(GAME_EVENT.ACHIEVEMENT_UNLOCKED);
} }
lock() { lock() {
// eslint-disable-next-line no-bitwise
player.secretAchievementBits[this.row - 1] &= this._inverseBitmask; player.secretAchievementBits[this.row - 1] &= this._inverseBitmask;
} }
} }

View File

@ -176,7 +176,6 @@ export const V = {
return VUnlocks.vAchievementUnlock.canBeUnlocked; return VUnlocks.vAchievementUnlock.canBeUnlocked;
}, },
unlockCelestial() { unlockCelestial() {
// eslint-disable-next-line no-bitwise
player.celestials.v.unlockBits |= (1 << VUnlocks.vAchievementUnlock.id); player.celestials.v.unlockBits |= (1 << VUnlocks.vAchievementUnlock.id);
GameUI.notify.success("You have unlocked V, The Celestial Of Achievements!", 10000); GameUI.notify.success("You have unlocked V, The Celestial Of Achievements!", 10000);
V.quotes.unlock.show(); V.quotes.unlock.show();

View File

@ -53,11 +53,9 @@ export const Effarig = {
get glyphEffectAmount() { get glyphEffectAmount() {
const genEffectBitmask = Glyphs.activeList const genEffectBitmask = Glyphs.activeList
.filter(g => generatedTypes.includes(g.type)) .filter(g => generatedTypes.includes(g.type))
// eslint-disable-next-line no-bitwise
.reduce((prev, curr) => prev | curr.effects, 0); .reduce((prev, curr) => prev | curr.effects, 0);
const nongenEffectBitmask = Glyphs.activeList const nongenEffectBitmask = Glyphs.activeList
.filter(g => !generatedTypes.includes(g.type)) .filter(g => !generatedTypes.includes(g.type))
// eslint-disable-next-line no-bitwise
.reduce((prev, curr) => prev | curr.effects, 0); .reduce((prev, curr) => prev | curr.effects, 0);
return countValuesFromBitmask(genEffectBitmask) + countValuesFromBitmask(nongenEffectBitmask); return countValuesFromBitmask(genEffectBitmask) + countValuesFromBitmask(nongenEffectBitmask);
}, },

View File

@ -204,12 +204,10 @@ class EnslavedProgressState extends BitUpgradeState {
set bits(value) { player.celestials.enslaved.hintBits = value; } set bits(value) { player.celestials.enslaved.hintBits = value; }
get hasProgress() { get hasProgress() {
// eslint-disable-next-line no-bitwise
return Boolean(player.celestials.enslaved.progressBits & (1 << this.id)); return Boolean(player.celestials.enslaved.progressBits & (1 << this.id));
} }
get hasHint() { get hasHint() {
// eslint-disable-next-line no-bitwise
return this.hasProgress || this.isUnlocked; return this.hasProgress || this.isUnlocked;
} }
@ -227,7 +225,6 @@ class EnslavedProgressState extends BitUpgradeState {
player.celestials.enslaved.zeroHintTime -= Math.log(2) / Math.log(3) * TimeSpan.fromDays(1).totalMilliseconds; player.celestials.enslaved.zeroHintTime -= Math.log(2) / Math.log(3) * TimeSpan.fromDays(1).totalMilliseconds;
GameUI.notify.success("You found a crack in The Enslaved Ones' Reality!", 10000); GameUI.notify.success("You found a crack in The Enslaved Ones' Reality!", 10000);
} }
// eslint-disable-next-line no-bitwise
player.celestials.enslaved.progressBits |= (1 << this.id); player.celestials.enslaved.progressBits |= (1 << this.id);
} }
} }

View File

@ -417,19 +417,16 @@ dev.testReplicantiCode = function(singleId, useDebugger = false) {
], ],
[ [
function() { function() {
// eslint-disable-next-line no-bitwise
player.achievementBits[8] |= 16; player.achievementBits[8] |= 16;
} }
], ],
[ [
function() { function() {
// eslint-disable-next-line no-bitwise
player.achievementBits[12] |= 8; player.achievementBits[12] |= 8;
} }
], ],
[ [
function() { function() {
// eslint-disable-next-line no-bitwise
player.achievementBits[12] |= 128; player.achievementBits[12] |= 128;
} }
], ],
@ -459,7 +456,6 @@ dev.testReplicantiCode = function(singleId, useDebugger = false) {
], ],
[ [
function() { function() {
// eslint-disable-next-line no-bitwise
player.reality.upgReqs = (1 << 6); player.reality.upgReqs = (1 << 6);
player.reality.upgradeBits = 64; player.reality.upgradeBits = 64;
} }

View File

@ -35,7 +35,6 @@ function giveEternityRewards(auto) {
AutomatorData.lastECCompletionCount = completionCount; AutomatorData.lastECCompletionCount = completionCount;
if (Enslaved.isRunning && completionCount > 5) EnslavedProgress.ec1.giveProgress(); if (Enslaved.isRunning && completionCount > 5) EnslavedProgress.ec1.giveProgress();
} }
// eslint-disable-next-line no-bitwise
player.challenge.eternity.requirementBits &= ~(1 << challenge.id); player.challenge.eternity.requirementBits &= ~(1 << challenge.id);
respecTimeStudies(auto); respecTimeStudies(auto);
} }

View File

@ -20,16 +20,13 @@ export class BitPurchasableMechanicState extends PurchasableMechanicState {
get bitIndex() { throw new NotImplementedError(); } get bitIndex() { throw new NotImplementedError(); }
get isBought() { get isBought() {
// eslint-disable-next-line no-bitwise
return (this.bits & (1 << this.bitIndex)) !== 0; return (this.bits & (1 << this.bitIndex)) !== 0;
} }
set isBought(value) { set isBought(value) {
if (value) { if (value) {
// eslint-disable-next-line no-bitwise
this.bits |= (1 << this.bitIndex); this.bits |= (1 << this.bitIndex);
} else { } else {
// eslint-disable-next-line no-bitwise
this.bits &= ~(1 << this.bitIndex); this.bits &= ~(1 << this.bitIndex);
} }
} }

View File

@ -16,7 +16,6 @@ export class BitUpgradeState extends GameMechanicState {
set bits(value) { throw new NotImplementedError(); } set bits(value) { throw new NotImplementedError(); }
get isUnlocked() { get isUnlocked() {
// eslint-disable-next-line no-bitwise
return Boolean(this.bits & (1 << this.id)); return Boolean(this.bits & (1 << this.id));
} }
@ -33,7 +32,6 @@ export class BitUpgradeState extends GameMechanicState {
unlock() { unlock() {
if (!this.canBeUnlocked) return; if (!this.canBeUnlocked) return;
// eslint-disable-next-line no-bitwise
this.bits |= (1 << this.id); this.bits |= (1 << this.id);
this.onUnlock(); this.onUnlock();
} }

View File

@ -201,14 +201,12 @@ export function findGlyphTypeEffects(glyphType) {
} }
export function makeGlyphEffectBitmask(effectList) { export function makeGlyphEffectBitmask(effectList) {
// eslint-disable-next-line no-bitwise
return effectList.reduce((mask, eff) => mask + (1 << GlyphEffects[eff].bitmaskIndex), 0); return effectList.reduce((mask, eff) => mask + (1 << GlyphEffects[eff].bitmaskIndex), 0);
} }
export function getGlyphEffectsFromBitmask(bitmask) { export function getGlyphEffectsFromBitmask(bitmask) {
return orderedEffectList return orderedEffectList
.map(effectName => GlyphEffects[effectName]) .map(effectName => GlyphEffects[effectName])
// eslint-disable-next-line no-bitwise
.filter(effect => (bitmask & (1 << effect.bitmaskIndex)) !== 0); .filter(effect => (bitmask & (1 << effect.bitmaskIndex)) !== 0);
} }

View File

@ -424,7 +424,6 @@ export const Glyphs = {
}, },
sortByEffect() { sortByEffect() {
function reverseBitstring(eff) { function reverseBitstring(eff) {
// eslint-disable-next-line no-bitwise
return parseInt(((1 << 30) + (eff >>> 0)).toString(2).split("").reverse().join(""), 2); return parseInt(((1 << 30) + (eff >>> 0)).toString(2).split("").reverse().join(""), 2);
} }
// The bitwise reversal is so that the effects with the LOWER id are valued higher in the sorting. // The bitwise reversal is so that the effects with the LOWER id are valued higher in the sorting.
@ -449,7 +448,6 @@ export const Glyphs = {
g.type === glyph.type && g.type === glyph.type &&
g.id !== glyph.id && g.id !== glyph.id &&
(g.level >= glyph.level || g.strength >= glyph.strength) && (g.level >= glyph.level || g.strength >= glyph.strength) &&
// eslint-disable-next-line no-bitwise
((g.effects & glyph.effects) === glyph.effects)); ((g.effects & glyph.effects) === glyph.effects));
let compareThreshold = glyph.type === "effarig" || glyph.type === "reality" ? 1 : 5; let compareThreshold = glyph.type === "effarig" || glyph.type === "reality" ? 1 : 5;
compareThreshold = Math.clampMax(compareThreshold, threshold); compareThreshold = Math.clampMax(compareThreshold, threshold);
@ -614,10 +612,8 @@ export const Glyphs = {
applyGamespeed(glyph) { applyGamespeed(glyph) {
if (!Ra.unlocks.allGamespeedGlyphs.canBeApplied) return; if (!Ra.unlocks.allGamespeedGlyphs.canBeApplied) return;
if (BASIC_GLYPH_TYPES.includes(glyph.type)) { if (BASIC_GLYPH_TYPES.includes(glyph.type)) {
// eslint-disable-next-line no-bitwise
glyph.effects |= (1 << GlyphEffects.timespeed.bitmaskIndex); glyph.effects |= (1 << GlyphEffects.timespeed.bitmaskIndex);
if (glyph.type === "time") { if (glyph.type === "time") {
// eslint-disable-next-line no-bitwise
glyph.effects |= (1 << GlyphEffects.timeshardpow.bitmaskIndex); glyph.effects |= (1 << GlyphEffects.timeshardpow.bitmaskIndex);
} }
} }

View File

@ -66,7 +66,6 @@ export function getGlyphEffectValues(effectKey) {
throw new Error(`Unknown Glyph effect requested "${effectKey}"'`); throw new Error(`Unknown Glyph effect requested "${effectKey}"'`);
} }
return player.reality.glyphs.active return player.reality.glyphs.active
// eslint-disable-next-line no-bitwise
.filter(glyph => ((1 << GlyphEffects[effectKey].bitmaskIndex) & glyph.effects) !== 0) .filter(glyph => ((1 << GlyphEffects[effectKey].bitmaskIndex) & glyph.effects) !== 0)
.filter(glyph => generatedTypes.includes(glyph.type) === GlyphEffects[effectKey].isGenerated) .filter(glyph => generatedTypes.includes(glyph.type) === GlyphEffects[effectKey].isGenerated)
.map(glyph => getSingleGlyphEffectFromBitmask(effectKey, glyph)); .map(glyph => getSingleGlyphEffectFromBitmask(effectKey, glyph));
@ -110,7 +109,6 @@ export function getGlyphEffectValuesFromBitmask(bitmask, level, baseStrength, ty
// Pulls out a single effect value from a glyph's bitmask, returning just the value (nothing for missing effects) // Pulls out a single effect value from a glyph's bitmask, returning just the value (nothing for missing effects)
export function getSingleGlyphEffectFromBitmask(effectName, glyph) { export function getSingleGlyphEffectFromBitmask(effectName, glyph) {
const glyphEffect = GlyphEffects[effectName]; const glyphEffect = GlyphEffects[effectName];
// eslint-disable-next-line no-bitwise
if ((glyph.effects & (1 << glyphEffect.bitmaskIndex)) === 0) { if ((glyph.effects & (1 << glyphEffect.bitmaskIndex)) === 0) {
return undefined; return undefined;
} }
@ -122,9 +120,7 @@ export function countValuesFromBitmask(bitmask) {
let numEffects = 0; let numEffects = 0;
let bits = bitmask; let bits = bitmask;
while (bits !== 0) { while (bits !== 0) {
// eslint-disable-next-line no-bitwise
numEffects += bits & 1; numEffects += bits & 1;
// eslint-disable-next-line no-bitwise
bits >>= 1; bits >>= 1;
} }
return numEffects; return numEffects;

View File

@ -154,7 +154,6 @@ export const GlyphGenerator = {
const effectList = GlyphEffects.all.filter(e => e.id.startsWith(type)); const effectList = GlyphEffects.all.filter(e => e.id.startsWith(type));
effectList.push(GlyphEffects.timespeed); effectList.push(GlyphEffects.timespeed);
let bitmask = 0; let bitmask = 0;
// eslint-disable-next-line no-bitwise
for (const effect of effectList) bitmask |= 1 << effect.bitmaskIndex; for (const effect of effectList) bitmask |= 1 << effect.bitmaskIndex;
const glyphLevel = Math.max(player.records.bestReality.glyphLevel, 5000); const glyphLevel = Math.max(player.records.bestReality.glyphLevel, 5000);
return { return {

View File

@ -24,7 +24,6 @@ class ImaginaryUpgradeState extends BitPurchasableMechanicState {
} }
get isAvailableForPurchase() { get isAvailableForPurchase() {
// eslint-disable-next-line no-bitwise
return (player.reality.imaginaryUpgReqs & (1 << this.id)) !== 0; return (player.reality.imaginaryUpgReqs & (1 << this.id)) !== 0;
} }
@ -42,7 +41,6 @@ class ImaginaryUpgradeState extends BitPurchasableMechanicState {
tryUnlock() { tryUnlock() {
if (!MachineHandler.isIMUnlocked || this.isAvailableForPurchase || !this.config.checkRequirement()) return; if (!MachineHandler.isIMUnlocked || this.isAvailableForPurchase || !this.config.checkRequirement()) return;
// eslint-disable-next-line no-bitwise
player.reality.imaginaryUpgReqs |= (1 << this.id); player.reality.imaginaryUpgReqs |= (1 << this.id);
GameUI.notify.reality(`You've unlocked an Imaginary Upgrade: ${this.config.name}`); GameUI.notify.reality(`You've unlocked an Imaginary Upgrade: ${this.config.name}`);
} }
@ -114,7 +112,6 @@ export const ImaginaryUpgrades = {
return this.all.countWhere(u => u.isBought); return this.all.countWhere(u => u.isBought);
}, },
get allBought() { get allBought() {
// eslint-disable-next-line no-bitwise
return (player.reality.imaginaryUpgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.imaginaryUpgrades.length - 5); return (player.reality.imaginaryUpgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.imaginaryUpgrades.length - 5);
} }
}; };

View File

@ -64,12 +64,10 @@ class InfinityChallengeState extends GameMechanicState {
} }
get isCompleted() { get isCompleted() {
// eslint-disable-next-line no-bitwise
return (player.challenge.infinity.completedBits & (1 << this.id)) !== 0; return (player.challenge.infinity.completedBits & (1 << this.id)) !== 0;
} }
complete() { complete() {
// eslint-disable-next-line no-bitwise
player.challenge.infinity.completedBits |= 1 << this.id; player.challenge.infinity.completedBits |= 1 << this.id;
EventHub.dispatch(GAME_EVENT.INFINITY_CHALLENGE_COMPLETED); EventHub.dispatch(GAME_EVENT.INFINITY_CHALLENGE_COMPLETED);
} }

View File

@ -516,13 +516,11 @@ window.logFactorial = (function() {
/** 32 bit XORSHIFT generator */ /** 32 bit XORSHIFT generator */
window.xorshift32Update = function xorshift32Update(state) { window.xorshift32Update = function xorshift32Update(state) {
/* eslint-disable no-bitwise */
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
state ^= state << 13; state ^= state << 13;
state ^= state >>> 17; state ^= state >>> 17;
state ^= state << 5; state ^= state << 5;
/* eslint-enable no-param-reassign */ /* eslint-enable no-param-reassign */
/* eslint-enable no-bitwise */
return state; return state;
}; };

View File

@ -22,7 +22,6 @@ export const NewsHandler = {
// If the bit array isn't large enough (ie. the numerical ID is the largest we've seen so far by a long shot), then // If the bit array isn't large enough (ie. the numerical ID is the largest we've seen so far by a long shot), then
// we pad the array with zeroes until we can fit the new ID in before actually adding it. // we pad the array with zeroes until we can fit the new ID in before actually adding it.
while (this.BITS_PER_MASK * player.news.seen[type].length <= number) player.news.seen[type].push(0); while (this.BITS_PER_MASK * player.news.seen[type].length <= number) player.news.seen[type].push(0);
// eslint-disable-next-line no-bitwise
player.news.seen[type][Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK); player.news.seen[type][Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK);
}, },
@ -33,7 +32,6 @@ export const NewsHandler = {
const bitArray = player.news.seen[type]; const bitArray = player.news.seen[type];
if (!bitArray || this.BITS_PER_MASK * bitArray.length < number) return false; if (!bitArray || this.BITS_PER_MASK * bitArray.length < number) return false;
// eslint-disable-next-line no-bitwise
return (bitArray[Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK)) !== 0; return (bitArray[Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK)) !== 0;
}, },

View File

@ -94,12 +94,10 @@ class NormalChallengeState extends GameMechanicState {
} }
get isCompleted() { get isCompleted() {
// eslint-disable-next-line no-bitwise
return (player.challenge.normal.completedBits & (1 << this.id)) !== 0; return (player.challenge.normal.completedBits & (1 << this.id)) !== 0;
} }
complete() { complete() {
// eslint-disable-next-line no-bitwise
player.challenge.normal.completedBits |= 1 << this.id; player.challenge.normal.completedBits |= 1 << this.id;
// Since breaking infinity maxes even autobuyers that aren't unlocked, // Since breaking infinity maxes even autobuyers that aren't unlocked,
// it's possible to get r52 or r53 from completing a challenge // it's possible to get r52 or r53 from completing a challenge

View File

@ -35,7 +35,6 @@ class RealityUpgradeState extends BitPurchasableMechanicState {
} }
get isAvailableForPurchase() { get isAvailableForPurchase() {
// eslint-disable-next-line no-bitwise
return (player.reality.upgReqs & (1 << this.id)) !== 0; return (player.reality.upgReqs & (1 << this.id)) !== 0;
} }
@ -46,7 +45,6 @@ class RealityUpgradeState extends BitPurchasableMechanicState {
tryUnlock() { tryUnlock() {
const realityReached = PlayerProgress.realityUnlocked() || TimeStudy.reality.isBought; const realityReached = PlayerProgress.realityUnlocked() || TimeStudy.reality.isBought;
if (!realityReached || this.isAvailableForPurchase || !this.config.checkRequirement()) return; if (!realityReached || this.isAvailableForPurchase || !this.config.checkRequirement()) return;
// eslint-disable-next-line no-bitwise
player.reality.upgReqs |= (1 << this.id); player.reality.upgReqs |= (1 << this.id);
GameUI.notify.reality(`You've unlocked a Reality Upgrade: ${this.config.name}`); GameUI.notify.reality(`You've unlocked a Reality Upgrade: ${this.config.name}`);
} }
@ -102,7 +100,6 @@ export const RealityUpgrades = {
*/ */
all: RealityUpgradeState.index.compact(), all: RealityUpgradeState.index.compact(),
get allBought() { get allBought() {
// eslint-disable-next-line no-bitwise
return (player.reality.upgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.upgrades.length - 5); return (player.reality.upgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.upgrades.length - 5);
} }
}; };

View File

@ -1,4 +1,4 @@
/* eslint-disable no-bitwise,no-param-reassign */ /* eslint-disable no-param-reassign */
// Copyright (c) 2011, Daniel Guerrero // Copyright (c) 2011, Daniel Guerrero
// All rights reserved. // All rights reserved.

View File

@ -2,7 +2,6 @@ import { GameStorage } from "./storage";
function arrayToBits(array) { function arrayToBits(array) {
let bits = 0; let bits = 0;
// eslint-disable-next-line no-bitwise
for (const id of array) bits |= (1 << id); for (const id of array) bits |= (1 << id);
return bits; return bits;
} }
@ -288,7 +287,6 @@ GameStorage.devMigrations = {
player.reality.upgradeBits = arrayToBits(player.reality.upg); player.reality.upgradeBits = arrayToBits(player.reality.upg);
delete player.reality.upg; delete player.reality.upg;
} }
// eslint-disable-next-line no-bitwise
if ((player.reality.upgradeBits & (1 << 25)) === 0) { if ((player.reality.upgradeBits & (1 << 25)) === 0) {
player.realityBuyer.isOn = false; player.realityBuyer.isOn = false;
} }
@ -358,7 +356,6 @@ GameStorage.devMigrations = {
for (const effect of orderedEffectList) { for (const effect of orderedEffectList) {
const typeEffect = separateEffectKey(effect); const typeEffect = separateEffectKey(effect);
if (glyph.type === typeEffect[0] && glyph.effects[typeEffect[1]] !== undefined) { if (glyph.type === typeEffect[0] && glyph.effects[typeEffect[1]] !== undefined) {
// eslint-disable-next-line no-bitwise
effectBitmask += 1 << GlyphEffects[effect].bitmaskIndex; effectBitmask += 1 << GlyphEffects[effect].bitmaskIndex;
} }
} }
@ -751,7 +748,6 @@ GameStorage.devMigrations = {
} }
}, },
player => { player => {
// eslint-disable-next-line no-bitwise
player.celestials.ra.unlockBits &= ~(1 << 29); player.celestials.ra.unlockBits &= ~(1 << 29);
}, },
player => { player => {
@ -975,7 +971,6 @@ GameStorage.devMigrations = {
let reqBitmask = 0; let reqBitmask = 0;
for (let i = 0; i <= player.reality.upgReqs.length; i++) { for (let i = 0; i <= player.reality.upgReqs.length; i++) {
// eslint-disable-next-line no-bitwise
if (player.reality.upgReqs[i]) reqBitmask |= (1 << i); if (player.reality.upgReqs[i]) reqBitmask |= (1 << i);
} }
player.reality.upgReqs = reqBitmask; player.reality.upgReqs = reqBitmask;
@ -1218,42 +1213,29 @@ GameStorage.devMigrations = {
player.celestials.pelle.galaxyGenerator.unlocked = player.celestials.pelle.galaxyGenerator.generatedGalaxies > 0; player.celestials.pelle.galaxyGenerator.unlocked = player.celestials.pelle.galaxyGenerator.generatedGalaxies > 0;
}, },
player => { player => {
// eslint-disable-next-line no-bitwise
if (player.celestials.pelle.doomed) player.achievementBits[17] |= 1; if (player.celestials.pelle.doomed) player.achievementBits[17] |= 1;
// eslint-disable-next-line no-bitwise
if (player.celestials.pelle.upgrades.has(4)) player.achievementBits[17] |= 2; if (player.celestials.pelle.upgrades.has(4)) player.achievementBits[17] |= 2;
if (player.celestials.pelle.doomed && player.challenge.infinity.completedBits === 510) { if (player.celestials.pelle.doomed && player.challenge.infinity.completedBits === 510) {
// eslint-disable-next-line no-bitwise
player.achievementBits[17] |= (1 << 2); player.achievementBits[17] |= (1 << 2);
} }
// eslint-disable-next-line no-bitwise
if (player.timestudy.studies.compact().includes(181)) player.achievementBits[17] |= (1 << 5); if (player.timestudy.studies.compact().includes(181)) player.achievementBits[17] |= (1 << 5);
}, },
player => { player => {
// eslint-disable-next-line no-bitwise
player.achievementBits[16] |= (player.achievementBits[16] & (1 << 4)) << 3; player.achievementBits[16] |= (player.achievementBits[16] & (1 << 4)) << 3;
// eslint-disable-next-line no-bitwise
player.achievementBits[16] &= ~(1 << 4); player.achievementBits[16] &= ~(1 << 4);
// eslint-disable-next-line no-bitwise
player.achievementBits[16] |= (player.achievementBits[16] & (1 << 2)) << 2; player.achievementBits[16] |= (player.achievementBits[16] & (1 << 2)) << 2;
// eslint-disable-next-line no-bitwise
player.achievementBits[16] &= ~(1 << 2); player.achievementBits[16] &= ~(1 << 2);
}, },
player => { player => {
// eslint-disable-next-line no-bitwise
player.achievementBits[17] &= ~(1 << 5); player.achievementBits[17] &= ~(1 << 5);
if (player.timestudy.studies.compact().includes(181) && player.celestials.pelle.doomed) { if (player.timestudy.studies.compact().includes(181) && player.celestials.pelle.doomed) {
// eslint-disable-next-line no-bitwise
player.achievementBits[17] |= (1 << 5); player.achievementBits[17] |= (1 << 5);
} }
}, },
player => { player => {
// eslint-disable-next-line no-bitwise
if (player.celestials.pelle.doomed && (player.challenge.infinity.completedBits & (1 << 5)) !== 0) { if (player.celestials.pelle.doomed && (player.challenge.infinity.completedBits & (1 << 5)) !== 0) {
// eslint-disable-next-line no-bitwise
player.achievementBits[17] |= (1 << 2); player.achievementBits[17] |= (1 << 2);
} else { } else {
// eslint-disable-next-line no-bitwise
player.achievementBits[17] &= ~(1 << 2); player.achievementBits[17] &= ~(1 << 2);
} }
}, },
@ -1351,7 +1333,6 @@ GameStorage.devMigrations = {
}, },
player => { player => {
const cel = player.celestials; const cel = player.celestials;
// eslint-disable-next-line no-bitwise
const convToBit = x => x.toBitmask() >> 1; const convToBit = x => x.toBitmask() >> 1;
if (cel.teresa.quotes) player.celestials.teresa.quoteBits = convToBit(cel.teresa.quotes); if (cel.teresa.quotes) player.celestials.teresa.quoteBits = convToBit(cel.teresa.quotes);
if (cel.effarig.quotes) player.celestials.effarig.quoteBits = convToBit(cel.effarig.quotes); if (cel.effarig.quotes) player.celestials.effarig.quoteBits = convToBit(cel.effarig.quotes);

View File

@ -325,7 +325,6 @@ GameStorage.migrations = {
if (player.challenges) { if (player.challenges) {
for (const fullID of player.challenges) { for (const fullID of player.challenges) {
const parsed = parseChallengeName(fullID); const parsed = parseChallengeName(fullID);
// eslint-disable-next-line no-bitwise
player.challenge[parsed.type].completedBits |= 1 << parsed.id; player.challenge[parsed.type].completedBits |= 1 << parsed.id;
} }
delete player.challenges; delete player.challenges;
@ -665,7 +664,6 @@ GameStorage.migrations = {
const number = parseInt(groups[2], 10); const number = parseInt(groups[2], 10);
if (!player.news.seen[type]) player.news.seen[type] = []; if (!player.news.seen[type]) player.news.seen[type] = [];
while (maskLength * player.news.seen[type].length < number) player.news.seen[type].push(0); while (maskLength * player.news.seen[type].length < number) player.news.seen[type].push(0);
// eslint-disable-next-line no-bitwise
player.news.seen[type][Math.floor(number / maskLength)] |= 1 << (number % maskLength); player.news.seen[type][Math.floor(number / maskLength)] |= 1 << (number % maskLength);
} }
@ -708,21 +706,17 @@ GameStorage.migrations = {
if (!isSecret && [row, column].join(",") in swaps) { if (!isSecret && [row, column].join(",") in swaps) {
[row, column] = swaps[[row, column].join(",")].split(","); [row, column] = swaps[[row, column].join(",")].split(",");
} }
// eslint-disable-next-line no-bitwise
newAchievements[row - 1] |= (1 << (column - 1)); newAchievements[row - 1] |= (1 << (column - 1));
} }
// Handle the changed achievement "No DLC Required" correctly (otherwise saves could miss it). // Handle the changed achievement "No DLC Required" correctly (otherwise saves could miss it).
if (!isSecret && (player.infinityUpgrades.size >= 16 || player.eternities.gt(0) || player.realities > 0)) { if (!isSecret && (player.infinityUpgrades.size >= 16 || player.eternities.gt(0) || player.realities > 0)) {
// eslint-disable-next-line no-bitwise
newAchievements[3] |= 1; newAchievements[3] |= 1;
} else { } else {
// eslint-disable-next-line no-bitwise
newAchievements[3] &= ~1; newAchievements[3] &= ~1;
} }
// "Professional Bodybuilder" (s38) was changed and shouldn't be migrated // "Professional Bodybuilder" (s38) was changed and shouldn't be migrated
if (isSecret) { if (isSecret) {
// eslint-disable-next-line no-bitwise
newAchievements[2] &= ~128; newAchievements[2] &= ~128;
} }
}; };
@ -911,7 +905,6 @@ GameStorage.migrations = {
}, },
etercreqConversion(player) { etercreqConversion(player) {
// eslint-disable-next-line no-bitwise
if (player.etercreq) player.challenge.eternity.requirementBits |= 1 << player.etercreq; if (player.etercreq) player.challenge.eternity.requirementBits |= 1 << player.etercreq;
delete player.etercreq; delete player.etercreq;
}, },

View File

@ -33,7 +33,6 @@ export class ECTimeStudyState extends TimeStudyState {
if (!auto) { if (!auto) {
Tab.challenges.eternity.show(); Tab.challenges.eternity.show();
} }
// eslint-disable-next-line no-bitwise
player.challenge.eternity.requirementBits |= 1 << this.id; player.challenge.eternity.requirementBits |= 1 << this.id;
Currency.timeTheorems.subtract(this.cost); Currency.timeTheorems.subtract(this.cost);
TimeStudyTree.commitToGameState([TimeStudy.eternityChallenge(this.id)]); TimeStudyTree.commitToGameState([TimeStudy.eternityChallenge(this.id)]);
@ -118,7 +117,6 @@ export class ECTimeStudyState extends TimeStudyState {
get wasRequirementPreviouslyMet() { get wasRequirementPreviouslyMet() {
if (this.id === 11 || this.id === 12) return false; if (this.id === 11 || this.id === 12) return false;
// eslint-disable-next-line no-bitwise
return (player.challenge.eternity.requirementBits & (1 << this.id)) !== 0; return (player.challenge.eternity.requirementBits & (1 << this.id)) !== 0;
} }

View File

@ -9,7 +9,6 @@ class TabNotificationState {
} }
get triggered() { get triggered() {
// eslint-disable-next-line no-bitwise
return player.triggeredTabNotificationBits & (1 << this.config.id); return player.triggeredTabNotificationBits & (1 << this.config.id);
} }
@ -17,7 +16,6 @@ class TabNotificationState {
if (!this.config.condition() || this.triggered) return; if (!this.config.condition() || this.triggered) return;
this.config.tabsToHighLight.map(t => t.parent + t.tab) this.config.tabsToHighLight.map(t => t.parent + t.tab)
.forEach(tab => player.tabNotifications.add(tab)); .forEach(tab => player.tabNotifications.add(tab));
// eslint-disable-next-line no-bitwise
player.triggeredTabNotificationBits |= 1 << this.config.id; player.triggeredTabNotificationBits |= 1 << this.config.id;
// Force all tabs and subtabs of this notification to be unhidden // Force all tabs and subtabs of this notification to be unhidden

View File

@ -22,7 +22,6 @@ class SubtabState {
get isHidden() { get isHidden() {
if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false; if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false;
// eslint-disable-next-line no-bitwise
return ((player.options.hiddenSubtabBits[this._parent.id] & (1 << this.id)) !== 0) && return ((player.options.hiddenSubtabBits[this._parent.id] & (1 << this.id)) !== 0) &&
this.hidable; this.hidable;
} }
@ -53,13 +52,11 @@ class SubtabState {
unhideTab() { unhideTab() {
this._parent.unhideTab(); this._parent.unhideTab();
// eslint-disable-next-line no-bitwise
player.options.hiddenSubtabBits[this._parent.id] &= ~(1 << this.id); player.options.hiddenSubtabBits[this._parent.id] &= ~(1 << this.id);
} }
toggleVisibility() { toggleVisibility() {
if (this._parent.id === Tabs.current.id && this.id === Tabs.current._currentSubtab.id) return; if (this._parent.id === Tabs.current.id && this.id === Tabs.current._currentSubtab.id) return;
// eslint-disable-next-line no-bitwise
player.options.hiddenSubtabBits[this._parent.id] ^= (1 << this.id); player.options.hiddenSubtabBits[this._parent.id] ^= (1 << this.id);
checkTabVisibilityForSecretAchievement(); checkTabVisibilityForSecretAchievement();
@ -111,7 +108,6 @@ class TabState {
get isHidden() { get isHidden() {
if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false; if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false;
const hasVisibleSubtab = this.subtabs.some(t => t.isAvailable); const hasVisibleSubtab = this.subtabs.some(t => t.isAvailable);
// eslint-disable-next-line no-bitwise
return (((player.options.hiddenTabBits & (1 << this.id)) !== 0) || !hasVisibleSubtab) && this.hidable; return (((player.options.hiddenTabBits & (1 << this.id)) !== 0) || !hasVisibleSubtab) && this.hidable;
} }
@ -155,13 +151,11 @@ class TabState {
} }
unhideTab() { unhideTab() {
// eslint-disable-next-line no-bitwise
player.options.hiddenTabBits &= ~(1 << this.id); player.options.hiddenTabBits &= ~(1 << this.id);
} }
toggleVisibility() { toggleVisibility() {
if (this.id === Tabs.current.id) return; if (this.id === Tabs.current.id) return;
// eslint-disable-next-line no-bitwise
player.options.hiddenTabBits ^= (1 << this.id); player.options.hiddenTabBits ^= (1 << this.id);
checkTabVisibilityForSecretAchievement(); checkTabVisibilityForSecretAchievement();

View File

@ -230,12 +230,9 @@ export default {
throw new Error(`Unrecognized glyph type "${this.glyph.type}" in glyph effect icons`); throw new Error(`Unrecognized glyph type "${this.glyph.type}" in glyph effect icons`);
} }
const effectIDs = []; const effectIDs = [];
// eslint-disable-next-line no-bitwise
let remainingEffects = this.glyph.effects >> minEffectID; let remainingEffects = this.glyph.effects >> minEffectID;
for (let id = 0; remainingEffects > 0; id++) { for (let id = 0; remainingEffects > 0; id++) {
// eslint-disable-next-line no-bitwise
if ((remainingEffects & 1) === 1) effectIDs.push(id); if ((remainingEffects & 1) === 1) effectIDs.push(id);
// eslint-disable-next-line no-bitwise
remainingEffects >>= 1; remainingEffects >>= 1;
} }
return effectIDs; return effectIDs;