Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduces overrun for nukes and naplam #296

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions autoPlay.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
var disableRenderer = getPreferenceBoolean("disableRenderer", false);
var useTrollTracker = getPreferenceBoolean("useTrollTracker", false);
var praiseGoldHelm = getPreferenceBoolean("praiseGoldHelm", true);
var disableNukes = getPreferenceBoolean("disableNukes", false);

var autoRefreshMinutes = 30; // refresh page after x minutes
var autoRefreshMinutesRandomDelay = 10;
Expand All @@ -61,7 +62,7 @@
var control = {
speedThreshold: 2000,
// Stop using offensive abilities shortly before rain/wormhole rounds.
rainingSafeRounds: 5,
rainingSafeRounds: 9,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable should not be changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough I'll adjust canUseOffensiveAbility() to +4 to scope it to just office skills.

rainingRounds: 100,
timePerUpdate: 60000,
useSlowMode: false,
Expand Down Expand Up @@ -238,6 +239,9 @@
if (disableRenderer) {
toggleRenderer();
}
if (disableNukes) {
toggleNukes();
}

if (w.CSceneGame !== undefined) {
w.CSceneGame.prototype.DoScreenShake = function() {};
Expand Down Expand Up @@ -302,6 +306,7 @@
options1.appendChild(makeCheckBox("removeGoldText", "Remove gold text", removeGoldText, handleEvent, false));
options1.appendChild(makeCheckBox("removeAllText", "Remove all text", removeAllText, toggleAllText, false));
options1.appendChild(makeCheckBox("disableRenderer", "Throttle game renderer", disableRenderer, toggleRenderer, true));
options1.appendChild(makeCheckBox("disableNukes", "Disable Nukes and Napalm", disableNukes, toggleNukes, false));

if (typeof GM_info !== "undefined") {
options1.appendChild(makeCheckBox("enableAutoRefresh", "Enable auto-refresh", enableAutoRefresh, toggleAutoRefresh, false));
Expand Down Expand Up @@ -548,9 +553,9 @@
w.$J('.name', ele).text( rgEntry.actor_name );
w.$J('.ability', ele).text( this.m_Game.m_rgTuningData.abilities[ rgEntry.ability ].name + " on level " + getGameLevel());
w.$J('img', ele).attr( 'src', w.g_rgIconMap['ability_' + rgEntry.ability].icon );

w.$J(ele).v_tooltip({tooltipClass: 'ta_tooltip', location: 'top'});

this.m_eleUpdateLogContainer[0].insertBefore(ele[0], this.m_eleUpdateLogContainer[0].firstChild);
advLog(rgEntry.actor_name + " used " + this.m_Game.m_rgTuningData.abilities[ rgEntry.ability ].name + " on level " + getGameLevel(), 1);
w.$J('.name', ele).attr( "style", "color: red; font-weight: bold;" );
Expand All @@ -560,9 +565,9 @@
w.$J('.ability', ele).text( this.m_Game.m_rgTuningData.abilities[ rgEntry.ability ].name + " on level " + getGameLevel());
w.$J('img', ele).attr( 'src', w.g_rgIconMap['ability_' + rgEntry.ability].icon );
w.$J('.name', ele).attr( "style", "color: yellow" );

w.$J(ele).v_tooltip({tooltipClass: 'ta_tooltip', location: 'top'});

this.m_eleUpdateLogContainer[0].insertBefore(ele[0], this.m_eleUpdateLogContainer[0].firstChild);
}
} else {
Expand Down Expand Up @@ -808,6 +813,12 @@
}
}

function toggleNukes(event) {
if (event !== undefined) {
disableNukes = handleCheckBox(event);
}
}

function toggleCritText(event) {
var value = removeCritText;
if (event !== undefined) {
Expand Down Expand Up @@ -1099,6 +1110,11 @@
enableAbility(ABILITIES.WORMHOLE);
}
}
//hides nuke button
if ( disableNukes ){
disableAbility(ABILITIES.TACTICAL_NUKE);
disableAbility(ABILITIES.NAPALM);
}
}

function useCooldownIfRelevant() {
Expand Down Expand Up @@ -1179,7 +1195,7 @@

function useNapalmIfRelevant() {
//Check if Napalm is purchased and cooled down
if (!canUseAbility(ABILITIES.NAPALM) || !canUseOffensiveAbility() || Math.random() > control.useAbilityChance) {
if (!canUseAbility(ABILITIES.NAPALM) || !canUseOffensiveAbility() || Math.random() > control.useAbilityChance || disableNukes) {
return;
}

Expand All @@ -1190,7 +1206,7 @@
var level = getGameLevel();

// Prevent this outright if its within control.rainingSafeRounds of the next rainingRound
if (level % control.rainingRounds > control.rainingRounds - control.rainingSafeRounds) {
if (level % control.rainingRounds > control.rainingRounds - ( control.rainingSafeRounds + 20 ) ) {
return;
}

Expand Down Expand Up @@ -1233,7 +1249,7 @@

function useTacticalNukeIfRelevant() {
// Check if Tactical Nuke is purchased
if (!canUseAbility(ABILITIES.TACTICAL_NUKE) || !canUseOffensiveAbility() || Math.random() > control.useAbilityChance) {
if (!canUseAbility(ABILITIES.TACTICAL_NUKE) || !canUseOffensiveAbility() || Math.random() > control.useAbilityChance || disableNukes) {
return;
}

Expand Down