Skip to content

Instantly share code, notes, and snippets.

@brunos3d
Last active May 20, 2021 19:57
Show Gist options
  • Save brunos3d/5b92b82b83b975edd07cb1e5e292259c to your computer and use it in GitHub Desktop.
Save brunos3d/5b92b82b83b975edd07cb1e5e292259c to your computer and use it in GitHub Desktop.
Simple script that plays Kill the King automagically. https://codepen.io/jcoulterdesign/full/MWeZWxQ
document.querySelector('div.game_intro__inner.start > p').click();
setTimeout(() => {
document.querySelector('div.game_intro__inner.end > div > p.continue').click();
var lastXp = 0;
function loop() {
var stage = parseInt(document.querySelector('div.ui > div > div.ui_progress__stage').innerText.slice(6));
try {
var xp = parseInt(document.querySelector('div.game_inner__footer > div.resources > div').innerText.replace('xp', ''));
for (var idx = 1; idx <= 3; idx++) document.querySelector(`div.upgrades > div:nth-child(${idx}) > div`).click();
if (lastXp <= 0) document.querySelector('div.nextPhase').click();
lastXp = xp;
} catch {
document.body.onkeyup({ keyCode: 32 });
}
setTimeout(loop, stage === 9 ? 350 : 1);
}
loop();
}, 5000);
@mukaschultze
Copy link

easy peasy lemon squeezy

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment