Fix spirit stance flip-flop: 3-turn cooldown on toggle

Spirit stance was toggling on/off every turn because conditions (OC >= 60,
SP > 10%) would be met immediately after toggling off. Added a 3-turn
cooldown via STATE._spiritCooldown that blocks re-toggling until it
expires. Prevents wasted turns on spirit stance spam.
This commit is contained in:
GaboGG 2026-07-20 20:00:19 -04:00
parent eb5f99dbfb
commit e415a7660f
3 changed files with 24 additions and 9 deletions

View file

@ -1006,11 +1006,16 @@ function strategyAdept() {
}
}
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
if (STATE.sp < 0.03 && STATE.spiritStance)
}
if (STATE.sp < 0.03 && STATE.spiritStance && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
}
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
// 7. Damage spells
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;

View file

@ -1006,11 +1006,16 @@ function strategyAdept() {
}
}
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
if (STATE.sp < 0.03 && STATE.spiritStance)
}
if (STATE.sp < 0.03 && STATE.spiritStance && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
}
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
// 7. Damage spells
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;

View file

@ -363,11 +363,16 @@ function strategyAdept() {
}
}
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
if (STATE.sp < 0.03 && STATE.spiritStance)
}
if (STATE.sp < 0.03 && STATE.spiritStance && !STATE._spiritCooldown) {
STATE._spiritCooldown = 3;
return { type: 'toggle_spirit' };
}
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
// 7. Damage spells
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;