mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
lint under new rules
This commit is contained in:
@@ -462,7 +462,7 @@ function showButtons (back, forward, forwardHandler, backHandler, builtGame = nu
|
||||
// Display a widget for each default card that allows copies of it to be added/removed. Set initial deck state.
|
||||
function showIncludedCards (deckManager) {
|
||||
document.querySelectorAll('.compact-card').forEach((el) => { el.remove(); });
|
||||
for (let i = 0; i < deckManager.getCurrentDeck().length; i++) {
|
||||
for (let i = 0; i < deckManager.getCurrentDeck().length; i ++) {
|
||||
const card = deckManager.getCurrentDeck()[i];
|
||||
const cardEl = constructCompactDeckBuilderElement(card, deckManager);
|
||||
if (card.team === globals.ALIGNMENT.GOOD) {
|
||||
@@ -487,7 +487,7 @@ function loadDefaultCards (deckManager) {
|
||||
return a.role.localeCompare(b.role);
|
||||
});
|
||||
const deck = [];
|
||||
for (let i = 0; i < defaultCards.length; i++) {
|
||||
for (let i = 0; i < defaultCards.length; i ++) {
|
||||
const card = defaultCards[i];
|
||||
card.quantity = 0;
|
||||
deck.push(card);
|
||||
@@ -631,7 +631,7 @@ function addOptionsToList (deckManager, selectEl) {
|
||||
}
|
||||
return a.role.localeCompare(b.role);
|
||||
});
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
for (let i = 0; i < options.length; i ++) {
|
||||
const optionEl = document.createElement('div');
|
||||
optionEl.innerHTML = HTMLFragments.DECK_SELECT_ROLE;
|
||||
optionEl.classList.add('deck-select-role');
|
||||
|
||||
@@ -56,7 +56,7 @@ export const UserUtility = {
|
||||
|
||||
function createRandomUserId () {
|
||||
let id = '';
|
||||
for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) {
|
||||
for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i ++) {
|
||||
id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)];
|
||||
}
|
||||
return id;
|
||||
|
||||
@@ -216,7 +216,7 @@ class GameManager {
|
||||
codeDigits = [];
|
||||
let iterations = globals.ACCESS_CODE_LENGTH;
|
||||
while (iterations > 0) {
|
||||
iterations--;
|
||||
iterations --;
|
||||
codeDigits.push(charPool[getRandomInt(charCount)]);
|
||||
}
|
||||
accessCode = codeDigits.join('');
|
||||
@@ -373,9 +373,9 @@ function initializePeopleForGame (uniqueCards, moderator) {
|
||||
let cards = []; // this will contain copies of each card equal to the quantity.
|
||||
let numberOfRoles = 0;
|
||||
for (const card of uniqueCards) {
|
||||
for (let i = 0; i < card.quantity; i++) {
|
||||
for (let i = 0; i < card.quantity; i ++) {
|
||||
cards.push(card);
|
||||
numberOfRoles++;
|
||||
numberOfRoles ++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ function initializePeopleForGame (uniqueCards, moderator) {
|
||||
moderator.gameRoleDescription = cards[j].description;
|
||||
moderator.alignment = cards[j].team;
|
||||
people.push(moderator);
|
||||
j++;
|
||||
j ++;
|
||||
}
|
||||
|
||||
while (j < numberOfRoles) {
|
||||
@@ -404,14 +404,14 @@ function initializePeopleForGame (uniqueCards, moderator) {
|
||||
person.customRole = cards[j].custom;
|
||||
person.hasEnteredName = false;
|
||||
people.push(person);
|
||||
j++;
|
||||
j ++;
|
||||
}
|
||||
|
||||
return people;
|
||||
}
|
||||
|
||||
function shuffleArray (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
for (let i = 0; i < array.length; i ++) {
|
||||
const randIndex = Math.floor(Math.random() * i);
|
||||
const temp = array[i];
|
||||
array[i] = array[randIndex];
|
||||
@@ -422,7 +422,7 @@ function shuffleArray (array) {
|
||||
|
||||
function createRandomId () {
|
||||
let id = '';
|
||||
for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) {
|
||||
for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i ++) {
|
||||
id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)];
|
||||
}
|
||||
return id;
|
||||
|
||||
@@ -264,7 +264,7 @@ describe('GameManager', () => {
|
||||
describe('#generateAccessCode', () => {
|
||||
it('should continue to generate access codes up to the max attempts when the generated code is already in use by another game', () => {
|
||||
gameManager.activeGameRunner.activeGames = {
|
||||
'AAAA': {}
|
||||
AAAA: {}
|
||||
};
|
||||
|
||||
const accessCode = gameManager.generateAccessCode(['A']);
|
||||
@@ -273,11 +273,11 @@ describe('GameManager', () => {
|
||||
|
||||
it('should generate and return a unique access code', () => {
|
||||
gameManager.activeGameRunner.activeGames = {
|
||||
'AAAA': {}
|
||||
AAAA: {}
|
||||
};
|
||||
|
||||
const accessCode = gameManager.generateAccessCode(['B']);
|
||||
expect(accessCode).toEqual('BBBB');
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user