diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index 2ab5c74..ddc8dc9 100644 --- a/scripts/hv-unified.user.js +++ b/scripts/hv-unified.user.js @@ -969,6 +969,11 @@ function strategyNovice() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -1084,6 +1089,11 @@ function strategyAdept() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -1212,6 +1222,11 @@ function strategyVeteran() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -3269,11 +3284,6 @@ function initializeBattle() { const vobs = new MutationObserver(() => { parseBattleState(); logRound(); // Also log on vitals changes (catches end-of-round) - // Auto-execute strategy even without hover — for auto-battle - if (CFG.hoverEnabled && !STATE.interruptHover && !STATE.interruptAlert) { - const a = getSmartAction(); - if (a) executeAction(a); - } refreshUI(); updateConfigButton(); // Check if battle ended (completion pane appeared) diff --git a/scripts/latest.user.js b/scripts/latest.user.js index 2ab5c74..ddc8dc9 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -969,6 +969,11 @@ function strategyNovice() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -1084,6 +1089,11 @@ function strategyAdept() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -1212,6 +1222,11 @@ function strategyVeteran() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -3269,11 +3284,6 @@ function initializeBattle() { const vobs = new MutationObserver(() => { parseBattleState(); logRound(); // Also log on vitals changes (catches end-of-round) - // Auto-execute strategy even without hover — for auto-battle - if (CFG.hoverEnabled && !STATE.interruptHover && !STATE.interruptAlert) { - const a = getSmartAction(); - if (a) executeAction(a); - } refreshUI(); updateConfigButton(); // Check if battle ended (completion pane appeared) diff --git a/src/init.js b/src/init.js index 633ba4c..d87b1fb 100644 --- a/src/init.js +++ b/src/init.js @@ -85,11 +85,6 @@ function initializeBattle() { const vobs = new MutationObserver(() => { parseBattleState(); logRound(); // Also log on vitals changes (catches end-of-round) - // Auto-execute strategy even without hover — for auto-battle - if (CFG.hoverEnabled && !STATE.interruptHover && !STATE.interruptAlert) { - const a = getSmartAction(); - if (a) executeAction(a); - } refreshUI(); updateConfigButton(); // Check if battle ended (completion pane appeared) diff --git a/src/strategy-engine.js b/src/strategy-engine.js index cf4653c..7a66a37 100644 --- a/src/strategy-engine.js +++ b/src/strategy-engine.js @@ -321,6 +321,11 @@ function strategyNovice() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -436,6 +441,11 @@ function strategyAdept() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue; @@ -564,6 +574,11 @@ function strategyVeteran() { const ib = castInitialBuffs(); if (ib) return ib; } + // If channeling is active, prioritize most expensive buff for best value + if (STATE.channeling && STATE.mp > 0.10) { + const ch = findBestChannelingTarget(); + if (ch) return ch; + } for (const b of BUFF_PRIORITY) { if (shouldBuff(b.icon, b.minTurns) && STATE.mp > 0.2 && hasSpell(b.spell)) { if (b.icon === 'regen' && STATE.hp >= CFG.cureRegenHP) continue;