diff --git a/autoPlay.user.js b/autoPlay.user.js index 688688a..b39c112 100644 --- a/autoPlay.user.js +++ b/autoPlay.user.js @@ -63,11 +63,12 @@ speedThreshold: 2000, // Stop using offensive abilities shortly before rain/wormhole rounds. rainingSafeRounds: 5, - rainingRounds: 100, + rainingRounds: 10, timePerUpdate: 60000, useSlowMode: false, minsLeft: 60, allowWormholeLevel: 180000, + wormholeRounds: 100, githubVersion: SCRIPT_VERSION, useAbilityChance: 0.03, useLikeNewMinChance: 0.02, @@ -382,6 +383,29 @@ } } } + + function isGoldRainRound() { + var level = getGameLevel(); + // Don't use gold rain below gold threshold + if (level < control.useGoldThreshold) { + return false; + } + + // Don't use gold rain past the speedThreshold + if (level > control.speedThreshold) { + // ...and if level is not a raining round + if (level % control.rainingRounds !== 0) { + return false; + } + } + + // Don't use gold rain on wormhole rounds + if (level % control.wormholeRounds === 0) { + return false; + } + + return true; + } function isNearEndGame() { var cTime = new Date(); @@ -420,9 +444,7 @@ useTacticalNukeIfRelevant(); useCrippleMonsterIfRelevant(); useCrippleSpawnerIfRelevant(); - if ((level < control.speedThreshold || level % control.rainingRounds === 0) && level > control.useGoldThreshold) { - useGoldRainIfRelevant(); - } + useGoldRainIfRelevant(); useCrippleMonsterIfRelevant(level); useReviveIfRelevant(level); useMaxElementalDmgIfRelevant(); @@ -1077,7 +1099,9 @@ // Prevent attack abilities and items if up against a boss or treasure minion var level = getGameLevel(); - if (targetIsTreasure || (targetIsBoss && (level < control.speedThreshold || level % control.rainingRounds === 0))) { + if (targetIsTreasure) { + BOSS_DISABLED_ABILITIES.forEach(disableAbility); + } else if (targetIsBoss && (isGoldRainRound() || level % control.wormholeRounds === 0)) { BOSS_DISABLED_ABILITIES.forEach(disableAbility); } else { BOSS_DISABLED_ABILITIES.forEach(enableAbility); @@ -1155,7 +1179,7 @@ var enemy = s().GetEnemy(currentLane, i); if (enemy) { enemyCount++; - if (enemy.m_data.type === 0 || (level > control.speedThreshold && level % control.rainingRounds !== 0 && level % 10 === 0)) { + if (enemy.m_data.type === 0 || (!isGoldRainRound() && level % 10 === 0)) { enemySpawnerExists = true; } } @@ -1188,7 +1212,7 @@ var enemy = s().GetEnemy(currentLane, i); if (enemy) { enemyCount++; - if (enemy.m_data.type === 0 || (level > control.speedThreshold && level % control.rainingRounds !== 0 && level % 10 === 0)) { + if (enemy.m_data.type === 0 || (!isGoldRainRound() && level % 10 === 0)) { enemySpawnerExists = true; } } @@ -1235,7 +1259,7 @@ for (var i = 0; i < 4; i++) { var enemy = s().GetEnemy(currentLane, i); if (enemy) { - if (enemy.m_data.type === 0 || (level > control.speedThreshold && level % control.rainingRounds !== 0 && level % 10 === 0)) { + if (enemy.m_data.type === 0 || (!isGoldRainRound() && level % 10 === 0)) { enemySpawnerExists = true; enemySpawnerHealthPercent = enemy.m_flDisplayedHP / enemy.m_data.max_hp; } @@ -1286,6 +1310,10 @@ if (!canUseItem(ABILITIES.RAINING_GOLD)) { return; } + + if (!isGoldRainRound()) { + return; + } var enemy = s().GetEnemy(s().m_rgPlayerData.current_lane, s().m_rgPlayerData.target); // check if current target is a boss, otherwise its not worth using the gold rain @@ -1345,7 +1373,7 @@ function useWormholeIfRelevant() { // Check the time before using wormhole. var level = getGameLevel(); - if (level % control.rainingRounds !== 0 && !wormHoleConstantUse) { + if (level % control.wormholeRounds !== 0 && !wormHoleConstantUse) { return; } @@ -1360,7 +1388,7 @@ function useLikeNew() { // Check the time before using like new. var level = getGameLevel(); - if (level % control.rainingRounds !== 0) { + if (level % control.wormholeRounds !== 0) { return; } @@ -1373,7 +1401,7 @@ // Make sure that we're still in the boss round when we actually use it. var level = getGameLevel(); - if (level % control.rainingRounds === 0) { + if (level % control.wormholeRounds === 0) { if (triggerAbility(ABILITIES.LIKE_NEW)) { advLog('We can actually use Like New semi-reliably! Cooldowns-b-gone.', 2); } @@ -1820,7 +1848,7 @@ } //During baws round fc - if (level % control.rainingRounds == 0) { + if (level % control.wormholeRounds == 0) { if (predictLastWormholesUpdate !== wormholesNow) { predictTicks++; predictJumps += wormholesNow;