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:
parent
eb5f99dbfb
commit
e415a7660f
3 changed files with 24 additions and 9 deletions
|
|
@ -1006,11 +1006,16 @@ function strategyAdept() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
|
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
|
||||||
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
|
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
|
||||||
|
STATE._spiritCooldown = 3;
|
||||||
return { type: 'toggle_spirit' };
|
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' };
|
return { type: 'toggle_spirit' };
|
||||||
|
}
|
||||||
|
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
|
||||||
|
|
||||||
// 7. Damage spells
|
// 7. Damage spells
|
||||||
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
||||||
|
|
|
||||||
|
|
@ -1006,11 +1006,16 @@ function strategyAdept() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
|
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
|
||||||
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
|
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
|
||||||
|
STATE._spiritCooldown = 3;
|
||||||
return { type: 'toggle_spirit' };
|
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' };
|
return { type: 'toggle_spirit' };
|
||||||
|
}
|
||||||
|
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
|
||||||
|
|
||||||
// 7. Damage spells
|
// 7. Damage spells
|
||||||
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
||||||
|
|
|
||||||
|
|
@ -363,11 +363,16 @@ function strategyAdept() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Spirit Stance at OC 60 — but only if we have SP to sustain it
|
// 6. Spirit Stance at OC 60 — with cooldown to prevent flip-flopping
|
||||||
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10)
|
if (STATE.oc >= 60 && !STATE.spiritStance && STATE.sp > 0.10 && !STATE._spiritCooldown) {
|
||||||
|
STATE._spiritCooldown = 3;
|
||||||
return { type: 'toggle_spirit' };
|
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' };
|
return { type: 'toggle_spirit' };
|
||||||
|
}
|
||||||
|
if (STATE._spiritCooldown > 0) STATE._spiritCooldown--;
|
||||||
|
|
||||||
// 7. Damage spells
|
// 7. Damage spells
|
||||||
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
const dmg = CFG.useAttackSpells ? getBestDamageSpell() : null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue