Last active
December 13, 2022 23:55
-
-
Save Stas-Buzunko/94a7b5167b333db1d09f802fa008fdd6 to your computer and use it in GitHub Desktop.
Script for Board Game Arena 6 nimmt! game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = Array(104).fill(null).map((x,y) => y + 1) | |
let playerHandCardsNumber = 10 | |
setInterval(() => { | |
const table = document.getElementById('cards_on_table') | |
for (let i = 0; i < table.children.length; i++) { | |
const el = table.children[i] | |
const numberOnCard = +el.getAttribute('id').replace('card_', '') | |
if (array.includes(numberOnCard)) { | |
const index = array.findIndex(c => c === numberOnCard) | |
array.splice(index, 1) | |
} | |
const numberOfCardsInHand = document.getElementById("player_hand").children.length | |
if (playerHandCardsNumber === 0 && numberOfCardsInHand === 10) { | |
array = Array(104).fill(null).map((x,y) => y + 1) | |
} | |
playerHandCardsNumber = numberOfCardsInHand | |
console.warn(array) | |
} | |
}, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment