Skip to content

Instantly share code, notes, and snippets.

@Stas-Buzunko
Last active December 13, 2022 23:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stas-Buzunko/94a7b5167b333db1d09f802fa008fdd6 to your computer and use it in GitHub Desktop.
Save Stas-Buzunko/94a7b5167b333db1d09f802fa008fdd6 to your computer and use it in GitHub Desktop.
Script for Board Game Arena 6 nimmt! game
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