From 0aa268b3f91b9ca424c8c583d5461e5531789bf4 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Sun, 26 Jul 2026 15:09:38 -0400 Subject: [PATCH] v0.13.23 - Fix affordable MP check using actual current MP from DOM - Was using vrhd (HP element) instead of vrm (current MP) - Now reads #vrm textContent for current MP value - Simply compares mpCost > curMp to skip unaffordable spells - This prevents the infinite Heartseeker loop when you don't have enough MP even though the buff is a good target --- scripts/hv-unified.user.js | 9 +++++---- scripts/latest.user.js | 9 +++++---- src/config.js | 2 +- src/header.user.js | 2 +- src/strategy-engine.js | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index daf950f..b633f36 100644 --- a/scripts/hv-unified.user.js +++ b/scripts/hv-unified.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.22 +// @version 0.13.23 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -17,7 +17,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.22'; +const VERSION = '0.13.23'; const CFG = { // — Battle automation @@ -940,8 +940,9 @@ function findBestChannelingTarget() { } // Skip if we can't afford the base cost — game pre-checks even when // channeling makes the effective cost 1 MP - const maxMp = parseInt((document.getElementById('vrhd') || {}).textContent) || 414; - if (mpCost > 0 && (mpCost / maxMp) > STATE.mp) continue; + const curMp = parseInt((document.getElementById('vrm') || {}).textContent) || 0; + const estMaxMp = (STATE.mp > 0 && curMp > 0) ? Math.round(curMp / STATE.mp) : 414; + if (mpCost > 0 && curMp > 0 && mpCost > curMp) continue; // Fill level: how empty is this buff relative to its max observed duration let maxDur = STATE.maxBuffDur[b.icon] || 0; // If max matches current (first observation, no learning yet), assume min 30 turns diff --git a/scripts/latest.user.js b/scripts/latest.user.js index daf950f..b633f36 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.22 +// @version 0.13.23 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* @@ -17,7 +17,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.22'; +const VERSION = '0.13.23'; const CFG = { // — Battle automation @@ -940,8 +940,9 @@ function findBestChannelingTarget() { } // Skip if we can't afford the base cost — game pre-checks even when // channeling makes the effective cost 1 MP - const maxMp = parseInt((document.getElementById('vrhd') || {}).textContent) || 414; - if (mpCost > 0 && (mpCost / maxMp) > STATE.mp) continue; + const curMp = parseInt((document.getElementById('vrm') || {}).textContent) || 0; + const estMaxMp = (STATE.mp > 0 && curMp > 0) ? Math.round(curMp / STATE.mp) : 414; + if (mpCost > 0 && curMp > 0 && mpCost > curMp) continue; // Fill level: how empty is this buff relative to its max observed duration let maxDur = STATE.maxBuffDur[b.icon] || 0; // If max matches current (first observation, no learning yet), assume min 30 turns diff --git a/src/config.js b/src/config.js index 3e1b810..520e212 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.22'; +const VERSION = '0.13.23'; const CFG = { // — Battle automation diff --git a/src/header.user.js b/src/header.user.js index c352ef9..63fba9b 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.22 +// @version 0.13.23 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* diff --git a/src/strategy-engine.js b/src/strategy-engine.js index 513c687..2cb8953 100644 --- a/src/strategy-engine.js +++ b/src/strategy-engine.js @@ -255,8 +255,9 @@ function findBestChannelingTarget() { } // Skip if we can't afford the base cost — game pre-checks even when // channeling makes the effective cost 1 MP - const maxMp = parseInt((document.getElementById('vrhd') || {}).textContent) || 414; - if (mpCost > 0 && (mpCost / maxMp) > STATE.mp) continue; + const curMp = parseInt((document.getElementById('vrm') || {}).textContent) || 0; + const estMaxMp = (STATE.mp > 0 && curMp > 0) ? Math.round(curMp / STATE.mp) : 414; + if (mpCost > 0 && curMp > 0 && mpCost > curMp) continue; // Fill level: how empty is this buff relative to its max observed duration let maxDur = STATE.maxBuffDur[b.icon] || 0; // If max matches current (first observation, no learning yet), assume min 30 turns